/* ============================================================
   DESIGN SYSTEM — VENTURA ECOM  ·  tokens do handoff (Claude Design)
   Azul #2E5AE8 + cinza-frio + Hanken Grotesk (UI) + IBM Plex Mono (números).
   Mantém os nomes de classe/var do sistema → telas re-skinam automático.
   Temas claro (padrão) e escuro via data-theme.
   ============================================================ */

:root {
  /* superfícies — branco + cinzas muito suaves (dropship é claro e arejado) */
  --canvas:        #FFFFFF;
  --surface:       #FFFFFF;
  --surface-2:     #F7F8FB;
  --surface-sunk:  #F0F2F6;
  --border:        #ECEEF2;
  --border-strong: #DEE1E7;

  /* ink / primário azul royal dropship */
  --ink:        #2563EB;
  --ink-soft:   #1D4FD8;
  --on-ink:     #FFFFFF;

  /* texto */
  --text:   #1A1D26;
  --muted:  #646B7A;
  --faint:  #9AA1AD;

  /* accent (= primário azul) */
  --accent:        #2563EB;
  --accent-hover:  #1D4FD8;
  --accent-soft:   #EEF3FF;
  --accent-on:     #FFFFFF;

  /* semáforo de margem / status */
  --success: #0E7A41; --success-soft: #E6F4EC;
  --warning: #92610A; --warning-soft: #FBF1DC;
  --danger:  #C2362B; --danger-soft:  #FCEBE9;
  --info:    #2563EB; --info-soft:    #EEF3FF;

  /* cores de marketplace (dots de identificação) */
  --mp-shopee: #EE4D2D;
  --mp-ml:     #F5C518;
  --mp-tiktok: #0D1525;

  /* gráficos */
  --chart-1: #2E5AE8;  --chart-2: #0E7A41;  --chart-3: #F5C518;  --chart-4: #8A93A2;

  /* profundidade */
  --shadow-card: 0 1px 2px rgba(16,24,40,.05);
  --shadow-pop:  0 16px 40px rgba(16,24,40,.18);

  /* raios */
  --r-sm: 10px; --r-md: 12px; --r-lg: 16px; --r-xl: 18px; --r-2xl: 20px; --r-full: 999px;

  /* altura padrão dos controles (inputs, botões, pills) — coerência em todo o sistema */
  --ctl-h: 40px; --ctl-h-sm: 34px;

  --hover: #F5F8FF;        /* hover de linha */
  --meta-tick: #B9C0CC;    /* marcador de meta nas barras */
}

[data-theme="dark"] {
  --canvas:        #0A0E17;
  --surface:       #11151F;
  --surface-2:     #0E121B;
  --surface-sunk:  #0C0F18;
  --border:        #1E2430;
  --border-strong: #2A3242;

  --ink:        #3D72FF;
  --ink-soft:   #5B8DEF;
  --on-ink:     #FFFFFF;

  --text:   #FFFFFF;
  --muted:  #A0A6B3;
  --faint:  #6B7280;

  --accent:        #2E63F6;
  --accent-hover:  #3D72FF;
  --accent-soft:   rgba(46,99,246,.16);
  --accent-on:     #FFFFFF;

  --success: #5FC78F; --success-soft: #16301F;
  --warning: #E0B560; --warning-soft: #32290F;
  --danger:  #F0938A; --danger-soft:  #37201E;
  --info:    #3D72FF; --info-soft:    rgba(46,99,246,.16);

  --mp-tiktok: #EEF2F8;
  --chart-1: #7C9CFF;  --chart-2: #5FC78F;  --chart-3: #E0B560;  --chart-4: #677183;

  --shadow-card: 0 1px 2px rgba(0,0,0,.4);
  --shadow-pop:  0 16px 48px rgba(0,0,0,.6);

  --hover: #161E30;
  --meta-tick: #4A5568;
}

/* ---------------- base ---------------- */
* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  background: var(--canvas);
  color: var(--text);
  font-family: 'Hanken Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}
/* títulos */
h1, .font-display { font-family: 'Hanken Grotesk', system-ui, sans-serif; font-weight: 800; letter-spacing: -.01em; }
/* NÚMEROS, VALORES e SKUs em IBM Plex Mono (assinatura do design) */
.num { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--canvas); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- cards ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
}
.card-soft { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-card); }
/* KPI/feature em destaque — card azul */
.card-ink, .kpi.card-ink { background: var(--accent); color: #fff; border: 1px solid transparent; border-radius: var(--r-xl); }
.card-ink .kpi-value, .kpi.card-ink .kpi-value { color: #fff !important; }
.card-ink .kpi-label, .kpi.card-ink .kpi-label { color: rgba(255,255,255,.78) !important; }
/* o conteúdo do card-ink (texto/barras) é todo branco — precisa do fundo azul mesmo quando
   combinado com .kpi-pro (que também define background e venceria pela ordem no arquivo).
   Sem isto, em tema claro o card fica com surface clara e o conteúdo branco some. */
.kpi-pro.card-ink { background: var(--accent); border-color: transparent; }
.card-sage { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-xl); }
.card-green { background: var(--success-soft); border: 0; border-radius: var(--r-xl); }
.card-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.card-bd { padding: 20px; }
.hairline { border-color: var(--border) !important; }

/* ---------------- botões ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--ctl-h); border-radius: var(--r-md); padding: 0 16px; font-weight: 600; font-size: 13.5px;
  border: 1px solid transparent; cursor: pointer; transition: all .15s ease;
  white-space: nowrap; line-height: 1;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { height: var(--ctl-h-sm); padding: 0 13px; font-size: 13px; }
.btn-primary { background: var(--accent); color: var(--accent-on); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-accent  { background: var(--accent); color: var(--accent-on); }
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.96); }

/* botão de ícone circular */
.icon-btn {
  width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  cursor: pointer; transition: all .15s; font-size: 15px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.active { background: var(--accent); color: var(--accent-on); border-color: var(--accent); }

/* ---------------- nav em pills (segmentado) ---------------- */
.pillnav { display: inline-flex; align-items: stretch; gap: 4px; min-height: var(--ctl-h); background: var(--surface-2); padding: 4px; border-radius: var(--r-md); border: 1px solid var(--border); }
.pillnav-item {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; border: 0; background: transparent; transition: all .15s;
}
.pillnav-item:hover { color: var(--text); }
.pillnav-item.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-card); }
/* variante compacta dos pills (toolbars) — mesma altura dos demais controles -sm */
.pillnav-sm { min-height: var(--ctl-h-sm); }
.pillnav-sm .pillnav-item { font-size: 13px; padding: 0 12px; }

/* ---------------- sidebar ---------------- */
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 13px; margin: 1px 10px; border-radius: var(--r-md);
  color: var(--ink2, var(--muted)); font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: all .13s; border: 0; width: calc(100% - 20px); text-align: left; background: transparent;
}
.nav-item:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(16,24,40,.07);
}
.nav-item.active svg { color: var(--accent); }
.nav-item:disabled { opacity: .4; cursor: not-allowed; }
.nav-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 16px 23px 6px; }
button.nav-section { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; background: transparent; border: 0; cursor: pointer; text-align: left; }
button.nav-section:hover { color: var(--muted); }
.nav-chevron { flex-shrink: 0; opacity: .6; transition: transform .18s ease; }
.nav-chevron.closed { transform: rotate(-90deg); }
/* sidebar com fundo levemente diferente do conteúdo (a pílula branca do item ativo "salta") */
aside.bg-surface { background: var(--surface-2); }

/* ===== Sidebar retrátil (encolher para só ícones) ===== */
aside { transition: width .18s ease; }
.menu-toggle-btn {
  display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0;
  border-radius: var(--r-sm); background: transparent; border: 1px solid var(--border);
  cursor: pointer; color: var(--muted); transition: all .13s;
}
.menu-toggle-btn:hover { background: var(--surface); color: var(--accent); border-color: var(--accent); }
.menu-toggle-btn svg { transition: transform .18s ease; }
aside.colapsado { width: 64px; }
aside.colapsado .menu-head { justify-content: center; padding-left: 0; padding-right: 0; }
aside.colapsado .menu-brand-mark,
aside.colapsado .menu-brand-text,
aside.colapsado .nav-section,
aside.colapsado .nav-item span { display: none; }
aside.colapsado .menu-toggle-btn { margin-left: 0; }   /* sem ml-auto: centraliza o ícone */
aside.colapsado nav > div { display: block !important; }   /* mostra todos os ícones (ignora o accordion) */
aside.colapsado .nav-item { justify-content: center; gap: 0; padding-left: 0; padding-right: 0; margin: 1px 8px; width: calc(100% - 16px); }
aside.colapsado .menu-foot { justify-content: center; padding-left: 0; padding-right: 0; }

/* ---------------- pills / badges ---------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 700; line-height: 1.4;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.pill-plain::before { display: none; }
.pill-accent  { background: var(--accent-soft); color: var(--accent); }
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-danger  { background: var(--danger-soft);  color: var(--danger); }
.pill-info    { background: var(--info-soft);    color: var(--info); }
.pill-ink     { background: var(--accent); color: var(--accent-on); }
.pill-ink::before { background: #fff; }
.pill-muted   { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.lime-tag { background: var(--accent); color: var(--accent-on); font-weight: 700; font-size: 12px; padding: 3px 9px; border-radius: var(--r-full); }

/* ---------------- inputs ---------------- */
.field-label { font-size: 12.5px; color: var(--muted); font-weight: 500; display: block; margin-bottom: 5px; }
.input {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 9px 12px; font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input { cursor: pointer; }
/* altura padrão de controle p/ input e select (textarea fica de fora, mantém multilinha) */
input.input, select.input { height: var(--ctl-h); padding-top: 0; padding-bottom: 0; }
input.input-sm, select.input-sm { height: var(--ctl-h-sm); font-size: 13px; }
.input-soft { border-radius: var(--r-sm); }

/* ---------------- tabela ---------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--faint);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;   /* mantém o título + a seta de ordenação na mesma linha (não quebra) */
}
.table tbody td { padding: 11px 16px; border-bottom: 1px solid var(--border); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.cell-input, .cell-edit {
  width: 100%; background: transparent; color: var(--text); text-align: right;
  border: 1px solid transparent; border-radius: 8px; padding: 5px 8px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums;
}
.cell-input:hover, .cell-edit:hover { border-color: var(--border-strong); }
.cell-input:focus, .cell-edit:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------------- linha expansível (detalhe) — componente reutilizável ---------------- */
/* botão de expandir: chevron num botão-ícone discreto que gira 180° ao abrir */
.exp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); cursor: pointer; vertical-align: middle;
  transition: background .15s, color .15s, border-color .15s;
}
.exp-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.exp-btn svg { width: 15px; height: 15px; transition: transform .22s ease; }
.exp-btn.open { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.exp-btn.open svg { transform: rotate(180deg); }

/* a célula que abriga o painel: sem padding, fundo rebaixado pra dar profundidade */
td.exp-cell { padding: 0 !important; background: var(--surface-sunk); }
.table tbody tr:hover td.exp-cell { background: var(--surface-sunk); }   /* não clarear no hover */

/* painel do detalhe: cartão interno, com respiro, em vez de tabela-dentro-de-tabela */
.exp-panel {
  margin: 12px 16px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.exp-panel-hd {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--faint); padding: 12px 16px 2px;
}

/* subtabela: leve, sem sticky, separadores suaves (cabeçalho não vaza em maiúsculas grandes) */
.subtable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.subtable thead th {
  background: transparent; color: var(--faint);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.subtable tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.subtable tbody tr:last-child td { border-bottom: 0; }
.subtable tbody tr:hover { background: var(--hover); }

/* ---------------- KPI ---------------- */
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 18px 20px; box-shadow: var(--shadow-card); }
.kpi-label { font-size: 11px; color: var(--faint); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { font-size: 25px; font-weight: 600; margin-top: 6px; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; margin-top: 6px; }
.kpi-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); font-size: 17px; }

/* ---------------- diversos ---------------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50% } 100% { background-position: 0 50% } }
.divider { height: 1px; background: var(--border); border: 0; }
.track { background: var(--surface-sunk); border-radius: 999px; overflow: hidden; }
.track > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
/* toggle switch */
.toggle { width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .15s; border: 0; cursor: pointer; flex-shrink: 0; padding: 0; }
.toggle.on { background: var(--accent); }
.toggle > span { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 999px; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.toggle.on > span { left: 18px; }
/* ---------------- tooltip (cartão flutuante minimalista) ---------------- */
.tip { position: relative; display: inline-flex; align-items: center; vertical-align: middle; }
.tip-ic { width: 14px; height: 14px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--muted); font-size: 9px !important; font-weight: 800 !important; font-style: normal; text-transform: none !important; letter-spacing: 0 !important; display: inline-flex; align-items: center; justify-content: center; line-height: 1; cursor: help; transition: color .15s, border-color .15s; }
.tip:hover .tip-ic { color: var(--accent); border-color: var(--accent); }
.tip-bubble { position: absolute; z-index: 70; top: calc(100% + 8px); right: 0; width: max-content; max-width: 250px; white-space: normal; font-family: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity .15s ease, transform .15s ease;
  /* !important: o balão pode ficar dentro de th/buttons que herdam maiúsculas, cor e peso — força o visual de cartão normal em qualquer contexto */
  text-align: left !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--text) !important; font-size: 12px !important; font-weight: 500 !important; line-height: 1.5 !important; padding: 10px 12px !important; }
.tip:hover .tip-bubble, .tip:focus-within .tip-bubble { opacity: 1; transform: translateY(0); }
.tip-bubble b { color: var(--text) !important; font-weight: 700 !important; }
[x-cloak] { display: none !important; }

/* ============================================================
   POLISH PROFISSIONAL (vitrine — jun/2026)
   Refinamentos no design system compartilhado: profundidade sutil,
   microinterações e hierarquia. Eleva o Painel e replica em todas as telas.
   ============================================================ */
.card, .kpi, .card-soft { box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 2px 6px rgba(16,24,40,.05); }
[data-theme="dark"] .card, [data-theme="dark"] .kpi, [data-theme="dark"] .card-soft { box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.22); }

.kpi { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: 0 8px 22px rgba(16,24,40,.09); }
[data-theme="dark"] .kpi:hover { box-shadow: 0 10px 26px rgba(0,0,0,.45); }
.kpi-value { font-size: 27px; letter-spacing: -.015em; }
.kpi-label { letter-spacing: .07em; }

.nav-item, .pillnav-item, .pill, .icon-btn { transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease; }

.card-hover { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; cursor: pointer; }
.card-hover:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: 0 8px 22px rgba(16,24,40,.09); }

/* ---- KPI "pro" (ícone + variação, estilo SaaS) ---- */
.kpi-pro { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 18px; box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 2px 6px rgba(16,24,40,.05);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.kpi-pro:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: 0 10px 26px rgba(16,24,40,.10); }
[data-theme="dark"] .kpi-pro { box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.22); }
[data-theme="dark"] .kpi-pro:hover { box-shadow: 0 12px 28px rgba(0,0,0,.45); }
.kpi-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  color: var(--ic, var(--accent)); background: color-mix(in srgb, var(--ic, var(--accent)) 14%, transparent); }
.kpi-ic svg { width: 20px; height: 20px; }
.kpi-pro .kpi-label { margin-top: 14px; display: block; }
.kpi-pro .kpi-value { margin-top: 3px; }
.kpi-sub { font-size: 12px; color: var(--faint); margin-top: 5px; }
.kpi-trend { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; line-height: 1; white-space: nowrap; }
.kpi-trend.up { color: var(--success); background: var(--success-soft); }
.kpi-trend.down { color: var(--danger); background: var(--danger-soft); }
.kpi-trend.flat { color: var(--muted); background: var(--surface-2); }
