/* ============================================================
   RepasseNet — Design System v2
   Tema claro · Mobile-first · WebView-ready
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg:        #f9f8f6;
  --surface:   #ffffff;
  --surface2:  #f4f3f0;
  --surface3:  #eeece8;
  --border:    #e8e6e1;
  --border2:   #d4d1cb;
  --accent:    #2563eb;
  --accent-h:  #1d55d4;
  --accent-bg: #eff6ff;
  --accent-t:  #1d4ed8;
  --text:      #111111;
  --text2:     #555550;
  --text3:     #999893;
  --success:   #16a34a;
  --success-bg:#dcfce7;
  --warning:   #d97706;
  --warning-bg:#fef3c7;
  --danger:    #dc2626;
  --danger-bg: #fee2e2;
  --info:      #0891b2;
  --info-bg:   #e0f2fe;
  --radius-sm: 8px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --font:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-h:  56px;
  --sidebar-w: 220px;
  --tap:       44px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font); border: none; }
input, select, textarea {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
input::placeholder, textarea::placeholder { color: var(--text3); }
select option { background: #fff; }
img { display: block; max-width: 100%; }

h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.15; }
h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.3px; }
h3 { font-size: 16px; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 18px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  transition: all 0.15s; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:active  { background: var(--accent-h); transform: scale(0.98); }
.btn-outline  { background: var(--surface); color: var(--text2); border: 1px solid var(--border); }
.btn-outline:active  { background: var(--surface2); }
.btn-ghost    { background: transparent; color: var(--text2); }
.btn-ghost:active    { background: var(--surface2); }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-sm  { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-xs  { min-height: 28px; padding: 0 10px; font-size: 12px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.input  { width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); min-height: var(--tap); }
.select {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); min-height: var(--tap); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
.input-sm, .select-sm { min-height: 36px; padding: 7px 12px; font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-tap { transition: transform 0.15s; -webkit-tap-highlight-color: transparent; cursor: pointer; }
.card-tap:active { transform: scale(0.985); }

.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 5px; font-size: 11px; font-weight: 600; }
.badge-blue   { background: var(--accent-bg);  color: var(--accent-t); }
.badge-green  { background: var(--success-bg); color: var(--success); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); }
.badge-red    { background: var(--danger-bg);  color: var(--danger); }
.badge-gray   { background: var(--surface2);   color: var(--text2); }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; }
.pill::before { content:''; width:6px; height:6px; border-radius:50%; display:inline-block; flex-shrink:0; }
.pill-green  { color: var(--success); } .pill-green::before  { background: var(--success); }
.pill-yellow { color: var(--warning); } .pill-yellow::before { background: var(--warning); }
.pill-gray   { color: var(--text3);   } .pill-gray::before   { background: var(--text3); }
.pill-blue   { color: var(--accent);  } .pill-blue::before   { background: var(--accent); }
.pill-red    { color: var(--danger);  } .pill-red::before    { background: var(--danger); }

.header {
  height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; position: sticky; top: 0; z-index: 100;
}
.logo { font-size: 17px; font-weight: 800; letter-spacing: -0.5px; color: var(--text); display: flex; align-items: center; gap: 6px; }
.logo-icon { width: 28px; height: 28px; background: var(--accent); border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; }
.header-nav { display: flex; align-items: center; gap: 6px; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 4px; min-height: 52px;
  color: var(--text3); font-size: 10px; font-weight: 500; gap: 3px;
  -webkit-tap-highlight-color: transparent; cursor: pointer; position: relative;
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-badge {
  position: absolute; top: 6px; right: calc(50% - 18px);
  background: var(--danger); color: #fff; font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 10px; min-width: 16px; text-align: center;
}
.has-bnav { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }

.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column; z-index: 50; overflow-y: auto;
}
.sidebar-logo { padding: 16px; border-bottom: 1px solid var(--border); }
.sidebar-loja { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.loja-av {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent-bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: var(--accent);
  margin-bottom: 6px; overflow: hidden;
}
.loja-av img { width: 100%; height: 100%; object-fit: cover; }
.loja-nome-s  { font-size: 12px; font-weight: 600; }
.loja-plano-s { font-size: 10px; color: var(--accent); font-weight: 600; margin-top: 1px; }
.nav-section  { padding: 10px 8px; flex: 1; }
.nav-label    { font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text3); padding: 0 8px; margin: 10px 0 4px; }
.nav-label:first-child { margin-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  min-height: var(--tap); padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--text2);
  transition: all 0.15s; margin-bottom: 1px;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:active { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; min-width: 18px; text-align: center; }
.sidebar-bottom { padding: 12px; border-top: 1px solid var(--border); }
.uso-wrap   { background: var(--surface2); border-radius: var(--radius-sm); padding: 10px 12px; }
.uso-label  { display: flex; justify-content: space-between; font-size: 11px; color: var(--text3); margin-bottom: 6px; }
.uso-track  { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.uso-fill   { height: 100%; background: var(--accent); border-radius: 2px; transition: width 1s ease; }

.topbar {
  height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 16px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 40;
}
.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.painel-layout  { display: flex; min-height: 100vh; }
.painel-main    { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }
.painel-content { padding: 20px; flex: 1; }

.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; border-left: 3px solid var(--border2); }
.kpi-blue   { border-left-color: var(--accent); }
.kpi-green  { border-left-color: var(--success); }
.kpi-yellow { border-left-color: var(--warning); }
.kpi-purple { border-left-color: #7c3aed; }
.kpi-label  { font-size: 11px; color: var(--text3); margin-bottom: 5px; font-weight: 500; }
.kpi-value  { font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; line-height: 1; }
.kpi-delta  { font-size: 11px; color: var(--text3); margin-top: 4px; }
.kpi-delta.up   { color: var(--success); }
.kpi-delta.down { color: var(--danger); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text3); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface2); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:active td { background: var(--surface2); }

.section-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.section-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.section-title { font-size: 13px; font-weight: 700; }
.section-link  { font-size: 12px; color: var(--accent); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200;
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  transform: translateY(40px);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
  -webkit-overflow-scrolling: touch;
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-handle { width: 36px; height: 4px; background: var(--border2); border-radius: 2px; margin: 12px auto 0; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title  { font-size: 16px; font-weight: 700; }
.modal-body   { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.modal-close  { background: var(--surface2); border: none; color: var(--text2); font-size: 16px; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }

.toast {
  position: fixed; bottom: calc(60px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1a1a1a; color: #fff;
  border-radius: var(--radius-lg); padding: 11px 18px;
  font-size: 13px; font-weight: 500;
  opacity: 0; transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 999; display: flex; align-items: center; gap: 8px;
  max-width: calc(100vw - 40px); white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.toast-success .toast-dot { background: #4ade80; }
.toast-error   .toast-dot { background: #f87171; }
.toast-info    .toast-dot { background: #60a5fa; }

.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.65s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 48px 20px; color: var(--text3); font-size: 13px; }

.empty { text-align: center; padding: 48px 20px; color: var(--text3); }
.empty-icon { font-size: 32px; margin-bottom: 10px; }
.empty h3 { font-size: 15px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }
.empty p  { font-size: 13px; }

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-hint  { font-size: 12px; color: var(--text3); margin-top: 4px; }
.toggle-check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text2); cursor: pointer; min-height: var(--tap); }
.toggle-check input { width: 17px; height: 17px; accent-color: var(--accent); flex-shrink: 0; }

.text-accent  { color: var(--accent); }
.text-muted   { color: var(--text3); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.font-bold { font-weight: 700; }
.truncate  { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4  { gap: 4px; }  .gap-8  { gap: 8px; }  .gap-12 { gap: 12px; }
.mt-4  { margin-top: 4px; }  .mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.hidden  { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

@keyframes fadeUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.fade-up { animation: fadeUp 0.3s ease both; }
.delay-1 { animation-delay: 0.06s; }
.delay-2 { animation-delay: 0.12s; }
.delay-3 { animation-delay: 0.18s; }

@media (min-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .painel-content { padding: 24px 28px; }
  .modal-overlay { align-items: center; padding: 20px; }
  .modal { border-radius: var(--radius-xl); max-height: 85vh; }
  .toast { bottom: 24px; }
  .hide-desktop { display: none !important; }
}
@media (max-width: 767px) {
  .sidebar     { display: none; }
  .painel-main { margin-left: 0; }
  .painel-content { padding: 16px; }
  .hide-mobile { display: none !important; }
  .kpi-grid    { grid-template-columns: 1fr 1fr; }
  .form-row    { grid-template-columns: 1fr; }
  h1 { font-size: 20px; }
}

