/* Rei dos Calçados — CRM  |  tema preto + amarelo */
:root {
  --bg: #0b0b0b;
  --bg-2: #111111;
  --card: #161616;
  --card-2: #1d1d1d;
  --line: #262626;
  --line-2: #333333;
  --text: #f4f4f2;
  --muted: #9b9b95;
  --muted-2: #6f6f6a;
  --gold: #e3b409;          /* amarelo escuro principal */
  --gold-2: #f6c915;        /* hover / destaque (tom do logo) */
  --gold-soft: rgba(227, 180, 9, .12);
  --gold-line: rgba(227, 180, 9, .35);
  --cream: #efe3b0;         /* 2ª série nos gráficos */
  --ok: #3ecf8e;
  --bad: #ff6b5b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--gold); color: #000; }

/* ---------- logo ---------- */
.logo { display: flex; align-items: center; gap: 12px; color: var(--gold); }
.logo svg { flex: none; }
.logo-text { text-transform: uppercase; font-weight: 500; line-height: 1.02; letter-spacing: .02em; font-size: 13px; }
.logo-text b { display: block; font-weight: 700; font-size: 15px; letter-spacing: .03em; }

/* ---------- botões / inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--card-2); cursor: pointer;
  font-weight: 600; font-size: 14px; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--muted-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #0b0b0b; }
.btn-gold:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-2); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-xl { height: 56px; font-size: 16px; width: 100%; letter-spacing: .04em; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.input, select.input {
  height: 48px; padding: 0 14px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--line-2); outline: none;
  font-size: 16px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.input.sm { height: 38px; font-size: 14px; }
.input::placeholder { color: var(--muted-2); }
.hint { font-size: 12px; color: var(--muted); }
.hint.ok { color: var(--ok); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); cursor: pointer; user-select: none; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--bg-2); cursor: pointer; font-weight: 600; font-size: 14px; transition: .15s;
}
.chip:hover { border-color: var(--muted-2); }
.chip.on { background: var(--gold); border-color: var(--gold); color: #0b0b0b; }

.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { height: 32px; padding: 0 12px; border: 0; background: transparent; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card-2); color: var(--gold-2); box-shadow: inset 0 0 0 1px var(--line-2); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3 { margin: 0 0 14px; font-size: 14px; font-weight: 700; letter-spacing: .02em; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h3 small { font-weight: 500; color: var(--muted); font-size: 12px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(227,180,9,.10), transparent 60%), var(--bg); }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.login .logo { justify-content: center; margin-bottom: 12px; }
.login .card { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { margin: 0; font-size: 18px; }
.login p { margin: 0; color: var(--muted); font-size: 13px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ---------- topo simples (lançamento) ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: rgba(11,11,11,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .who { font-size: 12px; color: var(--muted); text-align: right; }
.topbar .who b { display: block; color: var(--text); font-size: 14px; }

/* ---------- lançamento ---------- */
.launch { max-width: 560px; margin: 0 auto; padding: 18px 16px 60px; display: flex; flex-direction: column; gap: 16px; }
.launch .card { display: flex; flex-direction: column; gap: 16px; }
.launch h2 { margin: 4px 0 0; font-size: 20px; }
.launch h2 + p { margin: 0; color: var(--muted); font-size: 13px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }

.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--card-2);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); }
.ac-list button { display: block; width: 100%; text-align: left; padding: 12px 14px; background: none; border: 0; cursor: pointer; font-size: 15px; }
.ac-list button:hover, .ac-list button.hi { background: var(--gold-soft); color: var(--gold-2); }
.ac-list .empty { padding: 12px 14px; color: var(--muted); font-size: 13px; }

.items { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border: 1px solid var(--gold-line);
  background: var(--gold-soft); border-radius: var(--radius-sm); }
.item .name { flex: 1; font-weight: 700; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg-2); }
.qty button { width: 36px; height: 36px; border: 0; background: none; cursor: pointer; font-size: 18px; color: var(--gold-2); }
.qty span { min-width: 30px; text-align: center; font-weight: 700; }
.item .rm { width: 36px; height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; border-radius: 8px; }
.item .rm:hover { color: var(--bad); }
.pairs-total { font-size: 12px; color: var(--muted); text-align: right; }

.today { display: flex; flex-direction: column; }
.today-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.today-row:first-child { border-top: 0; }
.today-row .t { color: var(--muted); }
.today-row .c b { display: block; font-size: 14px; }
.today-row .c span { color: var(--muted); }
.today-row .v { font-weight: 700; text-align: right; }
.today-row .v span { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }

/* ---------- layout do painel ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100%; }
.side { position: sticky; top: 0; height: 100vh; padding: 20px 14px; border-right: 1px solid var(--line); background: var(--bg-2);
  display: flex; flex-direction: column; gap: 22px; }
.side .logo { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 14px; }
.nav a:hover { color: var(--text); background: var(--card); }
.nav a.on { color: var(--gold-2); background: var(--gold-soft); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .foot { margin-top: auto; padding: 0 8px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.main { min-width: 0; }
.head { position: sticky; top: 0; z-index: 9; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 16px 24px; background: rgba(11,11,11,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.head h1 { margin: 0; font-size: 20px; }
.head .filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.content { padding: 22px 24px 60px; display: flex; flex-direction: column; gap: 18px; }
.mobile-nav { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .head { padding: 12px 16px; }
  .content { padding: 16px 16px 90px; }
  .mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: rgba(17,17,17,.96);
    backdrop-filter: blur(10px); border-top: 1px solid var(--line); justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--muted); font-weight: 600; padding: 4px 6px; }
  .mobile-nav a.on { color: var(--gold-2); }
  .mobile-nav svg { width: 20px; height: 20px; }
}

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 12px; }
@media (max-width: 1250px) { .kpis { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 560px)  { .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi .l { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.kpi .v { font-size: clamp(19px, 1.1vw + 8px, 24px); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .d { font-size: 12px; color: var(--muted); }
.kpi .d.up { color: var(--ok); }
.kpi .d.down { color: var(--bad); }
.kpi.hl { border-color: var(--gold-line); background: linear-gradient(180deg, rgba(227,180,9,.10), transparent 70%), var(--card); }
.kpi.hl .v { color: var(--gold-2); }

.grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.grid2b { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .grid2, .grid2b { grid-template-columns: 1fr; } }
.grid2 > *, .grid2b > *, .card, .content > * { min-width: 0; }

/* barras horizontais */
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.hbar .top b { font-weight: 700; }
.hbar .top span { color: var(--muted); }
.hbar .track { height: 10px; border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 6px; background: var(--gold); }
.hbar:first-child .fill { background: var(--gold-2); }
.rank { width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 800;
  background: var(--card-2); color: var(--muted); margin-right: 8px; }
.hbar:first-child .rank { background: var(--gold); color: #000; }

/* gráfico de colunas */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--muted-2); font-size: 10px; font-family: var(--font); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* tabelas */
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 10px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--card-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--card-2); border: 1px solid var(--line-2); margin: 1px 2px 1px 0; }
.tag.gold { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-2); }
.wa { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.wa:hover { color: var(--gold-2); }
.wa svg { width: 14px; height: 14px; color: #25d366; }

.empty-state { padding: 28px 10px; text-align: center; color: var(--muted); font-size: 14px; }
.bday { display: flex; flex-direction: column; }
.bday-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.bday-row:first-child { border-top: 0; }
.bday-row .day { width: 42px; height: 42px; border-radius: 10px; background: var(--gold-soft); border: 1px solid var(--gold-line); color: var(--gold-2);
  display: grid; place-items: center; font-weight: 800; line-height: 1; font-size: 15px; flex: none; }
.bday-row .day small { display: block; font-size: 9px; font-weight: 700; }
.bday-row .n { flex: 1; min-width: 0; }
.bday-row .n b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bday-row .n span { color: var(--muted); }

/* filtros clientes */
.filterbar { display: grid; grid-template-columns: 1.6fr 1fr 1.1fr 1fr auto auto; gap: 10px; align-items: end; }
@media (max-width: 1100px) { .filterbar { grid-template-columns: 1fr 1fr; } }

/* drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; justify-content: flex-end; }
.drawer { width: min(480px, 100%); height: 100%; background: var(--bg-2); border-left: 1px solid var(--line); overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.drawer > * { flex-shrink: 0; }
.drawer h2 { margin: 0; font-size: 20px; }
.drawer .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drawer .meta div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.drawer .meta span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.drawer .meta b { font-size: 15px; }

/* config */
.cfg-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.cfg-row:first-of-type { border-top: 0; }
.cfg-row .n { flex: 1; font-weight: 600; }
.cfg-row .n small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.cfg-row.off .n { color: var(--muted-2); text-decoration: line-through; }
.add-row { display: flex; gap: 8px; margin-top: 12px; }

/* chat IA */
.chat { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 420px; padding: 0; overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 82%; padding: 12px 14px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: var(--gold); color: #0b0b0b; border-bottom-right-radius: 4px; font-weight: 500; }
.msg.ai { align-self: flex-start; background: var(--card-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.ai table { margin-top: 8px; font-size: 12px; }
.msg.ai td, .msg.ai th { padding: 6px 8px; }
.msg.sys { align-self: center; color: var(--muted); font-size: 12px; background: none; }
.chat-in { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); background: var(--bg-2); }
.chat-in textarea { flex: 1; resize: none; height: 48px; padding: 13px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line-2); outline: none; }
.chat-in textarea:focus { border-color: var(--gold); }
.sugs { display: flex; flex-wrap: wrap; gap: 8px; }
.sugs button { border: 1px solid var(--line-2); background: var(--card); border-radius: 999px; padding: 8px 12px; font-size: 13px; cursor: pointer; color: var(--muted); }
.sugs button:hover { color: var(--gold-2); border-color: var(--gold-line); }
.dots::after { content: '•••'; letter-spacing: 2px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 100;
  background: var(--card-2); border: 1px solid var(--line-2); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow); transition: .25s; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.ok { border-color: rgba(62,207,142,.5); }
.toast.ok::before { content: '✓  '; color: var(--ok); }
.toast.bad { border-color: rgba(255,107,91,.5); }

.loading { opacity: .55; pointer-events: none; transition: opacity .2s; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(0,0,0,.25); border-top-color: #000; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.mt0 { margin-top: 0; }

.donut-leg { display: flex; flex-direction: column; gap: 12px; flex: 1; min-width: 150px; }
.donut-leg div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; }
.donut-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }
.donut-leg small { display: block; color: var(--muted); font-size: 12px; margin-left: 18px; }
.donut-leg b { white-space: nowrap; }
.donut-leg div { flex-wrap: wrap; }
@media (max-width: 560px) {
  .cfg-row { flex-wrap: wrap; }
  .cfg-row .n { flex-basis: 100%; }
  .donut-leg b { white-space: normal; }
}
.seg.tabs { display: flex; width: 100%; }
.seg.tabs button { flex: 1; height: 42px; font-size: 14px; }
[hidden] { display: none !important; }
