/* Scalo — painel admin. Padrão visual em DESIGN.md */
:root {
  --bg-app: #0b0b0c;
  --bg-sidebar: #111112;
  --bg-card: #141415;
  --bg-inner: #19191a;
  --bg-elev: #202022;
  --bg-hover: #232325;
  --border: #232325;
  --border-2: #2c2c2f;
  --border-3: #3a3a3d;
  --text: #f4f4f5;
  --text-2: #d4d4d8;
  --muted: #8b8b90;
  --faint: #5c5c61;
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, .12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, .12);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, .12);
  --max: 1680px;
  --pad: 28px;
  --gap: 16px;
  --r-lg: 14px;
  --r-md: 10px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Geist', 'Inter', system-ui, sans-serif;
  --stripes: repeating-linear-gradient(135deg, rgba(255, 255, 255, .022) 0 1px, transparent 1px 7px);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  background: var(--bg-app);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }
svg { display: block; flex-shrink: 0; }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: #2e2e31 transparent; }
::selection { background: #f4f4f5; color: #0b0b0c; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.small { font-size: 12.5px; }
.up { color: var(--green); }
.down { color: var(--red); }
.flat { color: var(--muted); }

/* ---------- Login ---------- */
/* Fundo quase preto com um feixe de luz diagonal; cartão de vidro com a mesma textura e tokens do painel */
.login { position: relative; min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 28px; padding: 56px 16px 32px; overflow: hidden;
  background: radial-gradient(90% 70% at 50% 110%, #111113 0%, #070708 55%, #050506 100%); }
.login-beam { position: absolute; inset: 0; pointer-events: none; filter: blur(42px); }
.login-beam::before { content: ""; position: absolute; top: -12%; left: calc(50% + 120px); width: 420px; height: 82vh;
  clip-path: polygon(43% 0, 60% 0, 100% 100%, 0 100%); transform: rotate(34deg); transform-origin: 50% 0;
  background: linear-gradient(180deg, rgba(255,255,255,.62) 0%, rgba(255,255,255,.2) 38%, rgba(255,255,255,.05) 70%, transparent 92%); }
.login-beam::after { content: ""; position: absolute; top: -260px; left: calc(50% + 120px); width: 520px; height: 420px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,255,255,.18), transparent); }
.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 404px; padding: 36px 32px 26px; text-align: center; border-radius: 30px;
  background: var(--stripes), linear-gradient(180deg, rgba(40,40,44,.62) 0%, rgba(22,22,24,.78) 100%);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -1px 0 rgba(255,255,255,.03), 0 40px 90px rgba(0,0,0,.65);
  backdrop-filter: blur(22px) saturate(120%); -webkit-backdrop-filter: blur(22px) saturate(120%);
}
.login-card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(80% 60% at 92% 0%, rgba(255,255,255,.1), transparent 70%); }
.login-card > * { position: relative; }
/* Símbolo animado: as setas sobem em loop (escalar), um brilho passa e o halo pulsa a cada subida */
.login-mark { position: relative; width: 44px; height: 44px; margin: 0 auto 22px; }
.login-mark::before { content: ""; position: absolute; inset: -22px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,255,255,.2), transparent); animation: lm-glow 3.2s ease-in-out infinite; }
.login-mark svg { position: relative; display: block; overflow: visible; }
.lm-stack { animation: lm-climb 3.2s cubic-bezier(.65, 0, .35, 1) infinite; }
.lm-a { animation: lm-out 3.2s ease-in-out infinite; }
.lm-c { opacity: 0; animation: lm-in 3.2s ease-in-out infinite; }
@keyframes lm-climb { 0%, 55% { transform: translateY(0); } 85%, 100% { transform: translateY(-12px); } }
@keyframes lm-out { 0%, 55% { opacity: 1; } 78%, 100% { opacity: 0; } }
@keyframes lm-in { 0%, 62% { opacity: 0; } 85%, 100% { opacity: 1; } }
@keyframes lm-glow { 0%, 50%, 100% { opacity: .45; transform: scale(.9); } 74% { opacity: 1; transform: scale(1.12); } }
/* Ao entrar: as setas decolam e o halo acende */
.login-mark.launch .lm-stack { animation: lm-launch .55s cubic-bezier(.5, 0, .75, 0) forwards; }
.login-mark.launch .lm-a { animation: none; opacity: 1; }
.login-mark.launch .lm-c { animation: none; opacity: 0; }
.login-mark.launch::before { animation: lm-flash .55s ease-out forwards; }
@keyframes lm-launch { 30% { transform: translateY(3px); } 100% { transform: translateY(-38px); opacity: 0; } }
@keyframes lm-flash { 40% { opacity: 1; transform: scale(1.5); } 100% { opacity: 0; transform: scale(2.2); } }
.login-card { animation: card-in .7s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@media (prefers-reduced-motion: reduce) {
  .login-card, .lm-stack, .lm-a, .lm-c, .login-mark::before { animation: none !important; }
}
.login h1 { font-family: var(--font-display); font-size: 24px; font-weight: 500; letter-spacing: -.03em; }
.login-sub { color: var(--muted); margin: 8px 0 24px; font-size: 13.5px; }
.login form { display: grid; gap: 10px; text-align: left; }
.field {
  width: 100%; height: 42px; border-radius: 12px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.08);
  padding: 0 14px; font-size: 13.5px; outline: none; transition: border-color .15s, background .15s, box-shadow .15s;
}
.field:hover { border-color: rgba(255,255,255,.13); }
.field:focus { border-color: rgba(255,255,255,.24); background: rgba(255,255,255,.06); box-shadow: 0 0 0 3px rgba(255,255,255,.05); }
.field::placeholder { color: #75757b; }
.pw { position: relative; }
.pw .field { padding-right: 42px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.pw-toggle:hover { color: var(--text); }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { accent-color: #f4f4f5; width: 14px; height: 14px; }
.login-err { color: #fca5a5; font-size: 12.5px; min-height: 18px; text-align: center; line-height: 1.4; }
.login-err:empty { min-height: 0; }
.btn-primary {
  height: 42px; border-radius: 12px; background: #f4f4f5; color: #0b0b0c; font-weight: 500; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s, transform .1s;
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 8px 24px rgba(255,255,255,.08);
}
.btn-primary:hover { background: #fff; }
.btn-primary:active { transform: scale(.99); }
.btn-primary[disabled] { opacity: .7; cursor: default; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Estrutura ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: 272px; flex-shrink: 0; background: var(--bg-sidebar);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px 14px 12px;
  transition: width .2s, transform .25s;
}
.sb-head { display: flex; align-items: center; justify-content: space-between; height: 40px; padding: 0 2px 0 6px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -.045em; white-space: nowrap; }
.sb-rule { border-top: 1px dashed var(--border-2); margin: 12px -14px 14px; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.sb-search { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 8px 0 12px; border-radius: 10px; background: var(--bg-inner); border: 1px solid var(--border-2); color: var(--muted); }
.sb-search:focus-within { border-color: var(--border-3); }
.sb-search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font-size: 13.5px; }
.sb-search input::placeholder { color: var(--muted); }
.kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--border-3); border-radius: 5px; padding: 0 5px; line-height: 18px; white-space: nowrap; }
.sb-scroll { flex: 1; overflow-y: auto; margin: 0 -8px; padding: 0 8px 8px; }
.nav-label { font-size: 12px; color: var(--muted); padding: 18px 8px 8px; white-space: nowrap; }
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px; border-radius: 10px; color: var(--text-2);
  font-size: 14px; width: 100%; text-align: left; transition: background .15s, color .15s; white-space: nowrap;
}
.nav-item:hover { background: #19191b; color: var(--text); }
.nav-item.active { background: var(--bg-hover); color: var(--text); box-shadow: inset 0 0 0 1px #2c2c2f; }
.nav-item svg { color: var(--muted); }
.nav-item.active svg, .nav-item:hover svg { color: var(--text); }
.nav-item .grow { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { font-size: 11px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--green-soft); color: #4ade80; display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.nav-sub { margin: 2px 0 4px 19px; }
.nav-sub a { position: relative; display: flex; align-items: center; justify-content: space-between; height: 30px; padding: 0 8px 0 24px; font-size: 13px; color: var(--muted); border-radius: 8px; }
.nav-sub a::before { content: ""; position: absolute; left: 0; top: -15px; height: 30px; width: 13px; border-left: 1px solid var(--border-3); border-bottom: 1px solid var(--border-3); border-bottom-left-radius: 7px; }
.nav-sub a:hover, .nav-sub a.active { color: var(--text); }
.nav-sub a .c { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 1.8s infinite; flex-shrink: 0; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.sb-foot { border-top: 1px dashed var(--border-2); margin: 6px -14px 0; padding: 10px 14px 0; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px 6px 2px; }
.user-card .info { flex: 1; min-width: 0; line-height: 1.3; }
.user-card .info b { display: block; font-weight: 500; font-size: 13.5px; }
.user-card .info span { font-size: 12px; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #3a3a3d, #1f1f21); border: 1px solid var(--border-3); display: grid; place-items: center; font-size: 11.5px; font-weight: 600; flex-shrink: 0; }
.sb-backdrop { display: none; }

body.sb-collapsed .sidebar { width: 76px; }
body.sb-collapsed .sidebar .brand span,
body.sb-collapsed .sidebar .sb-search,
body.sb-collapsed .sidebar .nav-item .grow,
body.sb-collapsed .sidebar .nav-item .nav-badge,
body.sb-collapsed .sidebar .nav-item .chev,
body.sb-collapsed .sidebar .nav-sub,
body.sb-collapsed .sidebar .user-card .info,
body.sb-collapsed .sidebar .user-card .icon-btn { display: none; }
body.sb-collapsed .sidebar .nav-label { font-size: 0; padding: 12px 0 6px; }
body.sb-collapsed .sidebar .nav-label::after { content: ""; display: block; border-top: 1px dashed var(--border-2); margin: 0 6px; }
body.sb-collapsed .sidebar .nav-item { justify-content: center; padding: 0; }
body.sb-collapsed .sidebar .sb-head { flex-direction: column; height: auto; gap: 8px; padding: 0; }
body.sb-collapsed .sidebar .user-card { justify-content: center; padding: 8px 0 2px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* Topo e conteúdo dividem a mesma largura máxima, centralizada (alinha em telas ultrawide) */
.topbar {
  position: sticky; top: 0; z-index: 30; padding: 12px var(--pad);
  background: rgba(11, 11, 12, .85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px dashed var(--border-2);
}
.topbar-inner { max-width: var(--max); margin: 0 auto; display: flex; align-items: center; gap: 12px; min-height: 40px; }
.crumbs { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; white-space: nowrap; min-width: 0; }
.crumbs b { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--faint); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; }
.store-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.l-short { display: none; }
.content { padding: 24px var(--pad) 56px; width: 100%; max-width: calc(var(--max) + var(--pad) * 2); margin: 0 auto; container: main / inline-size; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-size: 26px; font-weight: 500; letter-spacing: -.03em; line-height: 1.2; }
.page-head p { color: var(--muted); margin-top: 6px; }

/* ---------- Cards ---------- */
.card { background: var(--bg-card) var(--stripes); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 4px; min-width: 0; display: flex; flex-direction: column; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px 10px 10px; min-height: 44px; }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; }
.card-title svg, .head-icon { color: var(--muted); }
.card-body { background: var(--bg-inner); border: 1px solid var(--border-2); border-radius: var(--r-md); padding: 16px; flex: 1; min-width: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.02); }
.card-body.flush { padding: 0; overflow: hidden; }
.card-body.tight { padding: 6px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px 5px; font-size: 12.5px; color: var(--muted); }

.grid { display: grid; gap: var(--gap); }
.g-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 360px; }
.g-side { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.stack > .card:only-child { flex: 1; }
.mt { margin-top: var(--gap); }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }

/* KPI */
.kpi-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 18px 16px 14px; }
.kpi-value { font-family: var(--font-display); font-size: 28px; font-weight: 500; letter-spacing: -.025em; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; }
.kpi-meta { margin-top: 10px; font-size: 12.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kpi-main { flex-shrink: 0; min-width: 0; }
.spark { flex: 0 1 auto; width: clamp(72px, 36%, 220px); min-width: 52px; height: 42px; overflow: visible; }

/* Faixa de métricas */
.strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); overflow: hidden; }
.strip.s5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.strip > div { padding: 14px 16px; border-left: 1px dashed var(--border-2); border-top: 1px dashed var(--border-2); margin: -1px 0 0 -1px; min-width: 0; }
.strip .label { font-size: 12.5px; color: var(--muted); display: flex; gap: 7px; align-items: center; white-space: nowrap; }
.strip .val { font-size: 18px; font-weight: 500; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.01em; }
.strip .sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; }

/* Controles */
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--bg-inner); border: 1px solid var(--border-2); border-radius: 999px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { height: 28px; padding: 0 12px; border-radius: 999px; font-size: 13px; color: var(--muted); white-space: nowrap; transition: background .15s, color .15s; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.active { background: #f4f4f5; color: #0b0b0c; font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.seg button .c { font-size: 11.5px; opacity: .65; font-variant-numeric: tabular-nums; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 10px; background: var(--bg-inner); border: 1px solid var(--border-2); font-size: 13px; color: var(--text-2); white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn:hover { border-color: var(--border-3); color: var(--text); background: #1d1d1f; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn.white { background: #f4f4f5; color: #0b0b0c; border-color: #f4f4f5; font-weight: 500; }
.btn.white:hover { background: #fff; }
.btn.ghost { background: none; border-color: transparent; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.dropdown { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 240px; background: #18181a; border: 1px solid var(--border-3); border-radius: 12px; padding: 6px; box-shadow: 0 24px 48px rgba(0,0,0,.55); z-index: 50; display: none; }
.menu.open { display: block; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: 8px; font-size: 13px; color: var(--text-2); text-align: left; }
.menu-item:hover, .menu-item.active { background: var(--bg-hover); color: var(--text); }
.menu-item .grow { flex: 1; }
.menu-sep { border-top: 1px dashed var(--border-2); margin: 6px 2px; }
.menu-title { font-size: 11.5px; color: var(--muted); padding: 6px 8px 4px; }
.input, .select { height: 34px; border-radius: 10px; background: var(--bg-inner); border: 1px solid var(--border-2); padding: 0 12px; outline: none; font-size: 13px; color: var(--text); min-width: 0; }
.input:focus, .select:focus { border-color: var(--border-3); }
.input::placeholder { color: var(--muted); }
.select { padding-right: 8px; }
.input[type="date"] { color-scheme: dark; }
.search { position: relative; display: flex; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 34px; width: 100%; }
.label-f { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
.custom-pop { padding: 12px; min-width: 280px; }
.custom-pop .grid { gap: 10px; }

/* Lojas, pílulas e status */
.s-av { width: 30px; height: 30px; border-radius: 8px; background: var(--bg-elev); border: 1px solid var(--border-3); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--text-2); flex-shrink: 0; letter-spacing: .02em; }
.s-av.sm { width: 22px; height: 22px; border-radius: 6px; font-size: 9.5px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; border: 1px solid var(--border-3); color: var(--text-2); white-space: nowrap; }
.pill.green { background: var(--green-soft); color: #4ade80; border-color: transparent; }
.pill.amber { background: var(--amber-soft); color: #fbbf24; border-color: transparent; }
.pill.red { background: var(--red-soft); color: #f87171; border-color: transparent; }
.live-chip { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--bg-inner); border: 1px solid var(--border-2); font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; }
.status.pago { color: var(--text); }
.status.pago svg { color: var(--green); }
.status.copiado { color: var(--text-2); }
.status.copiado svg { color: var(--amber); }
.status.pendente { color: var(--muted); }
.dev { display: inline-flex; align-items: center; gap: 7px; }
.dev svg { color: var(--muted); }

/* Tabela */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { font-weight: 500; color: var(--muted); text-align: left; padding: 10px 14px; background: var(--bg-elev); white-space: nowrap; font-size: 12.5px; }
.tbl th:first-child { border-radius: 8px 0 0 8px; }
.tbl th:last-child { border-radius: 0 8px 8px 0; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: rgba(255,255,255,.025); }
.tbl .r { text-align: right; }
.tbl .strong { color: var(--text); }
.tbl .id { color: var(--text); font-weight: 500; }
.tbl .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.tbl .trunc { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 4px; font-size: 12.5px; color: var(--muted); }

/* Gráfico */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .grid-l { stroke: #26262a; stroke-width: 1; }
.chart .ax { fill: #7c7c82; font-size: 11.5px; font-family: var(--font); }
.chart .bar { fill: url(#barGrad); stroke: #34343a; stroke-width: 1; transition: fill .15s; }
.chart .bar.active { fill: url(#barActive); stroke: #d4d4d8; }
.chart .guide { stroke: #a1a1aa; stroke-dasharray: 3 4; stroke-width: 1; }
.chart .guide-dot { fill: #f4f4f5; }
.chart .hit { fill: transparent; cursor: pointer; }
.tip { position: absolute; pointer-events: none; transform: translate(-100%, -50%); margin-left: -12px; background: #1b1f2a; border: 1px solid #343a4c; color: #e4e4e7; border-radius: 8px; padding: 4px 9px; font-size: 12px; white-space: nowrap; box-shadow: 0 8px 20px rgba(0,0,0,.4); font-variant-numeric: tabular-nums; }
.tip.right { transform: translate(0, -50%); margin-left: 12px; }
.big-num { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.big-num .v { font-family: var(--font-display); font-size: 34px; font-weight: 500; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }

/* Listas */
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 10px; width: 100%; text-align: left; transition: background .15s; }
button.list-row:hover, a.list-row:hover { background: rgba(255,255,255,.03); }
.list-row.active { background: var(--bg-hover); box-shadow: inset 0 0 0 1px var(--border-2); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-size: 13.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .d { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .v { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list-row .v b { display: block; font-weight: 500; color: var(--text); font-size: 13.5px; }
.list-row .v span { font-size: 12px; color: var(--muted); }
.rank { width: 18px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; flex-shrink: 0; }
.rank.top { color: var(--text); font-weight: 600; }
.divided > * + * { border-top: 1px dashed var(--border-2); border-radius: 0; }
.hbar { height: 6px; border-radius: 99px; background: var(--bg-elev); overflow: hidden; }
.hbar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #5c5c61, #e4e4e7); }
.hbar.lg { height: 8px; }

/* Linha do tempo */
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 16px; top: 36px; bottom: 2px; border-left: 1px dashed var(--border-3); }
.tl-ic { width: 33px; height: 33px; border-radius: 9px; border: 1px solid var(--border-3); background: var(--bg-elev); display: grid; place-items: center; color: var(--text-2); flex-shrink: 0; }
.tl-ic.ok { color: var(--green); }
.tl-ic.warn { color: var(--amber); }
.tl-ic.off { color: var(--faint); border-style: dashed; background: transparent; }
.tl-main { min-width: 0; flex: 1; padding-top: 1px; }
.tl-t { font-size: 13.5px; color: var(--text); font-weight: 500; display: flex; justify-content: space-between; gap: 8px; }
.tl-t time { font-size: 12px; color: var(--muted); font-weight: 400; white-space: nowrap; }
.tl-d { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.tl-item:hover .tl-t span, button.tl-item:hover .tl-t span { text-decoration: underline; text-decoration-color: var(--faint); }
button.tl-item { width: 100%; text-align: left; }

/* Funil */
.funnel { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 10px; min-width: 700px; }
.f-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.f-top { min-height: 64px; }
.f-label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.f-val { font-family: var(--font-display); font-size: 24px; font-weight: 500; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.f-bar-wrap { height: 240px; display: flex; align-items: flex-end; border-radius: 10px; background: repeating-linear-gradient(0deg, transparent 0 47px, #232326 47px 48px); }
.f-bar { width: 100%; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, #38383c, #1f1f22); border: 1px solid #404045; min-height: 4px; transition: height .4s cubic-bezier(.2,.8,.2,1); }
.f-col.last .f-bar { background: linear-gradient(180deg, #fafafa, #8f8f94); border-color: #e4e4e7; }
.f-foot { font-size: 12px; display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.f-step { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; }
.f-step .lbl { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; gap: 8px; }
.f-step .lbl span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Mapa de calor */
.heat-wrap { overflow-x: auto; }
.heat { display: grid; grid-template-columns: 34px repeat(24, minmax(16px, 1fr)); gap: 3px; min-width: 620px; font-size: 10.5px; color: var(--muted); }
.heat .c { aspect-ratio: 1; border-radius: 4px; background: #f4f4f5; }
.heat .h { text-align: center; }
.heat .d { display: flex; align-items: center; }

/* Drawer */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; }
.overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 8px; right: 8px; bottom: 8px; width: min(540px, calc(100vw - 16px)); background: var(--bg-card) var(--stripes);
  border: 1px solid var(--border-2); border-radius: 16px; z-index: 61; transform: translateX(calc(100% + 16px));
  transition: transform .28s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; padding: 4px; box-shadow: -20px 0 60px rgba(0,0,0,.5);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 12px 12px; }
.drawer-head h3 { font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.drawer-body { flex: 1; overflow-y: auto; background: var(--bg-inner); border: 1px solid var(--border-2); border-radius: 12px; padding: 18px; }
.dsec { margin-bottom: 24px; }
.dsec:last-child { margin-bottom: 0; }
.dsec h4 { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: .04em; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); font-size: 13px; border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden; }
.kv > * { padding: 9px 12px; border-top: 1px solid var(--border); }
.kv > :nth-child(1), .kv > :nth-child(2) { border-top: 0; }
.kv dt { color: var(--muted); background: rgba(255,255,255,.015); }
.kv dd { color: var(--text); word-break: break-word; font-variant-numeric: tabular-nums; }
.kv dd code, code { font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: 12px; color: var(--text-2); }
.hero-val { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 4px 0 20px; flex-wrap: wrap; }
.hero-val .v { font-family: var(--font-display); font-size: 32px; font-weight: 500; letter-spacing: -.03em; line-height: 1.1; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden; margin-bottom: 24px; }
.mini-stats > div { padding: 12px; border-left: 1px dashed var(--border-2); border-top: 1px dashed var(--border-2); margin: -1px 0 0 -1px; }
.mini-stats .l { font-size: 12px; color: var(--muted); }
.mini-stats .v { font-size: 16px; font-weight: 500; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hint { font-size: 12.5px; color: var(--muted); background: rgba(255,255,255,.02); border: 1px dashed var(--border-3); border-radius: 10px; padding: 10px 12px; line-height: 1.55; }
.hint b { color: var(--text-2); font-weight: 500; }
.codebox { position: relative; background: #111113; border: 1px solid var(--border-2); border-radius: 10px; padding: 12px 44px 12px 12px; font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: 12px; color: var(--text-2); word-break: break-all; line-height: 1.6; }
.codebox .icon-btn { position: absolute; top: 6px; right: 6px; }

/* Alertas */
.alert { display: flex; gap: 12px; padding: 14px; border-radius: 10px; }
.alert + .alert { border-top: 1px dashed var(--border-2); border-radius: 0; }
.alert .tl-ic { width: 32px; height: 32px; }
.alert .t { font-size: 13.5px; color: var(--text); font-weight: 500; }
.alert .d { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #f4f4f5; color: #0b0b0c; padding: 10px 16px; border-radius: 12px; font-size: 13px; font-weight: 500; opacity: 0; pointer-events: none; transition: .2s; z-index: 90; display: flex; gap: 8px; align-items: center; box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.fade-in { animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }


/* Listas compactas do celular (substituem tabelas largas) */
.m-list, .m-only { display: none; }
.m-row { display: block; width: 100%; text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); }
.m-row:last-child { border-bottom: 0; }
button.m-row:active { background: rgba(255,255,255,.03); }
.m-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.m-line + .m-line { margin-top: 5px; }
.m-t { color: var(--text); font-size: 13.5px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-d { color: var(--muted); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-d svg { display: inline-block; vertical-align: -2px; margin-right: 4px; }
.m-v { color: var(--text); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.m-line > :last-child:not(:first-child) { flex-shrink: 0; }
.m-chips { margin: var(--gap) 0; }
.m-chips .seg { width: 100%; }

/* ---------- Telas grandes: largura máxima cresce, mantendo tudo centralizado ---------- */
@media (min-width: 2200px) { :root { --max: 2040px; --pad: 40px; --gap: 20px; } }
@media (min-width: 2800px) { :root { --max: 2400px; --pad: 48px; --gap: 22px; } }

/* ---------- Grades: seguem a largura útil do conteúdo (já descontado o menu) ---------- */
@container main (min-width: 1800px) {
  .g-main { grid-template-columns: minmax(0, 1fr) 420px; }
  .g-side { grid-template-columns: 340px minmax(0, 1fr); }
  .kpi-value { font-size: 32px; }
  .page-head h1 { font-size: 28px; }
}
@container main (max-width: 1320px) {
  .kpi-value { font-size: 24px; }
  .strip .val { font-size: 17px; }
}
@container main (max-width: 1180px) {
  .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 28px; }
  .strip, .strip.s5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container main (max-width: 1060px) {
  .g-main, .g-side { grid-template-columns: minmax(0, 1fr); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@container main (max-width: 720px) {
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .g-3 > :last-child:nth-child(odd) { grid-column: auto; }
  .page-head h1 { font-size: 22px; }
}
@container main (max-width: 540px) {
  .g-kpi { grid-template-columns: minmax(0, 1fr); }
  .kpi-value { font-size: 26px; }
  .strip, .strip.s5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip .sub, .strip .label { white-space: normal; }
  .strip .label { align-items: flex-start; }
  .g-4 { gap: 10px; }
  .g-4 .kpi-value { font-size: 20px !important; }
  .big-num .v { font-size: 28px; }
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* ---------- Tablet e celular: menu vira gaveta, topo em duas linhas ---------- */
@media (max-width: 1024px) {
  :root { --pad: 16px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 70; transform: translateX(-100%); width: 284px !important; box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  body.sb-open .sidebar { transform: none; }
  body.sb-open .sb-backdrop { display: block; position: fixed; inset: 0; z-index: 69; background: rgba(0,0,0,.55); }
  body.sb-collapsed .sidebar .brand span, body.sb-collapsed .sidebar .sb-search, body.sb-collapsed .sidebar .nav-item .grow,
  body.sb-collapsed .sidebar .nav-sub, body.sb-collapsed .sidebar .user-card .info { display: revert; }
  .collapse-btn { display: none !important; }
  .menu-btn { display: grid; margin-left: -6px; }
  .topbar { padding: 10px var(--pad); }
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .top-actions { display: contents; }
  .crumbs { flex: 1; }
  .dd-period { flex: 1 1 100%; min-width: 0; }
  .dd-period .seg { width: 100%; }
  .dd-period .seg button { flex: 1; justify-content: center; padding: 0 8px; }
  .dd-period .menu { left: 0; right: 0; min-width: 0; }
  .content { padding-top: 18px; padding-bottom: 48px; }
}
@media (max-width: 640px) {
  .desk-only { display: none !important; }
  .m-list, .m-only { display: block; }
  .card-head { flex-wrap: wrap; }
  .card-head > .row.wrap { width: 100%; min-width: 0; }
  .card-head .search { flex: 1 1 100%; }
  .card-head .search .input { width: 100% !important; }
  .page-head { margin-bottom: 16px; }
}
@media (max-width: 560px) {
  .crumbs > svg, .crumb-root { display: none; }
  .crumbs b { font-size: 15px; }
  .store-name { max-width: 120px; }
  .l-full { display: none; }
  .l-short { display: inline-flex; }
  .kv { grid-template-columns: 118px minmax(0, 1fr); }
  .login-card { padding: 30px 20px 22px; border-radius: 24px; }
  .login-beam::before { left: calc(50% - 20px); width: 300px; }
  .drawer { top: auto; height: 92vh; right: 0; left: 0; bottom: 0; width: 100%; border-radius: 18px 18px 0 0; transform: translateY(100%); }
  .drawer.open { transform: none; }
}

.kv .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
