/* S.A Academia Fit CRM - tema escuro (padrão) e tema claro, com o amarelo da marca.
   --brand é só para preenchimento. Texto, foco e linhas finas usam --accent,
   porque o amarelo não tem contraste sobre fundo claro. */
:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --surface: #131415;
  --surface-2: #1a1b1d;
  --surface-3: #232427;
  --border: #2a2b2e;
  --border-strong: #3a3b40;
  --text: #f3f3f1;
  --text-2: #b6b6b2;
  --text-3: #85857f;
  --brand: #ffe100;
  --brand-hover: #fff04d;
  --brand-ink: #141400;
  --brand-soft: rgba(255, 225, 0, .1);
  --accent: #ffe100;
  --topbar-bg: rgba(11, 11, 12, .92);
  --overlay: rgba(0, 0, 0, .68);
  --shadow-color: rgba(0, 0, 0, .5);
  --row-hover: rgba(255, 255, 255, .018);
  --band-hover: rgba(255, 255, 255, .035);
  --cell-out: rgba(0, 0, 0, .25);
  --bad-line: rgba(255, 81, 71, .5);
  --red: #e8130c;
  --orange: #ff6a1a;
  --good: #33c26b;
  --good-soft: rgba(51, 194, 107, .13);
  --warn: #f5b728;
  --warn-soft: rgba(245, 183, 40, .13);
  --bad: #ff5147;
  --bad-soft: rgba(255, 81, 71, .13);
  --info: #6ea8ff;
  --info-soft: rgba(110, 168, 255, .13);
  --chart-1: #ffd60a;
  --chart-a: #cca300;
  --chart-b: #e8552f;
  --kpi-tint-1: rgba(255, 225, 0, .08);
  --kpi-tint-2: rgba(110, 168, 255, .08);
  --kpi-tint-3: rgba(51, 194, 107, .08);
  --kpi-tint-4: rgba(245, 183, 40, .08);
  --kpi-tint-5: rgba(255, 106, 26, .08);
  --kpi-tint-6: rgba(255, 81, 71, .08);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar: 248px;
  --sidebar-min: 68px;
  --header: 64px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #f7f7f4;
  --surface-3: #ecece7;
  --border: #e3e3dd;
  --border-strong: #c8c8c1;
  --text: #18181a;
  --text-2: #4f4f4a;
  --text-3: #696963;
  --brand-hover: #f5d800;
  --brand-soft: rgba(255, 225, 0, .28);
  --accent: #756000;
  --topbar-bg: rgba(255, 255, 255, .94);
  --overlay: rgba(24, 24, 26, .45);
  --shadow-color: rgba(24, 24, 26, .16);
  --row-hover: rgba(24, 24, 26, .025);
  --band-hover: rgba(24, 24, 26, .05);
  --cell-out: rgba(24, 24, 26, .035);
  --bad-line: rgba(192, 31, 23, .45);
  --orange: #c9500f;
  --good: #146c3c;
  --good-soft: rgba(26, 154, 85, .13);
  --warn: #8a5400;
  --warn-soft: rgba(224, 161, 0, .17);
  --bad: #c01f17;
  --bad-soft: rgba(224, 53, 43, .11);
  --info: #1a5bbf;
  --info-soft: rgba(47, 116, 224, .11);
  --chart-1: #b58900;
  --chart-a: #b58900;
  --chart-b: #a83214;
  --kpi-tint-1: rgba(255, 225, 0, .22);
  --kpi-tint-2: rgba(47, 116, 224, .12);
  --kpi-tint-3: rgba(26, 154, 85, .12);
  --kpi-tint-4: rgba(224, 161, 0, .14);
  --kpi-tint-5: rgba(201, 80, 15, .11);
  --kpi-tint-6: rgba(224, 53, 43, .10);
}
/* A logo tem texto branco: a barra lateral continua escura também no tema claro. */
:root[data-theme="light"] .sidebar {
  color-scheme: dark;
  color: #f3f3f1;
  --surface: #131415;
  --surface-2: #1f2022;
  --border: #2a2b2e;
  --text: #f3f3f1;
  --text-2: #c2c2be;
  --text-3: #9a9a94;
  --brand-soft: rgba(255, 225, 0, .1);
  --accent: #ffe100;
}
:root[data-theme="light"] .auth-logo { width: 230px; max-width: 80%; padding: 14px 18px; background: #131415; border-radius: 10px; }
.theme-toggle .theme-moon { display: none; }
:root[data-theme="light"] .theme-toggle .theme-sun { display: none; }
:root[data-theme="light"] .theme-toggle .theme-moon { display: block; }
.icon-btn.auth-theme { position: fixed; top: 14px; right: 14px; }
.theme-menu-item { display: none !important; }
@media (max-width: 640px) {
  .icon-btn.topbar-theme { display: none; }
  .theme-menu-item { display: flex !important; }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
button { font: inherit; color: inherit; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.hide { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--brand); color: var(--brand-ink); }
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* Shell */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .18s ease; }
.shell.collapsed { grid-template-columns: var(--sidebar-min) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40; overflow: hidden; }
.sidebar-brand { height: var(--header); display: flex; align-items: center; padding: 0 16px; border-bottom: 1px solid var(--border); flex: none; }
.sidebar-brand img { height: 42px; max-width: 100%; object-fit: contain; }
.sidebar-brand .mark { display: none; height: 26px; }
.collapsed .sidebar-brand { justify-content: center; padding: 0 8px; }
.collapsed .sidebar-brand .full { display: none; }
.collapsed .sidebar-brand .mark { display: block; }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 11px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; white-space: nowrap; position: relative; transition: background .12s, color .12s; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--accent); }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.collapsed .nav a { justify-content: center; padding: 0; }
.collapsed .nav a span { display: none; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 10px; flex: none; }
.sidebar-foot button { width: 100%; display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 11px; border: 0; background: transparent; color: var(--text-3); border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; }
.sidebar-foot button:hover { background: var(--surface-2); color: var(--text); }
.collapsed .sidebar-foot button { justify-content: center; padding: 0; }
.collapsed .sidebar-foot span { display: none; }
.collapsed .collapse-icon { transform: rotate(180deg); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--header); display: flex; align-items: center; gap: 12px; padding: 0 24px; background: var(--topbar-bg); border-bottom: 1px solid var(--border); }
.icon-btn.menu-btn { display: none; }
.search-box { position: relative; flex: 1; max-width: 460px; }
.search-box svg.icon { position: absolute; left: 11px; top: 11px; color: var(--text-3); width: 16px; height: 16px; }
.search-box input { width: 100%; height: 38px; padding: 0 12px 0 34px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font: inherit; }
.search-box input:focus { outline: none; border-color: var(--accent); }
.search-results { position: absolute; top: 44px; left: 0; right: 0; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px; max-height: 420px; overflow-y: auto; box-shadow: 0 12px 32px var(--shadow-color); }
.search-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); }
.search-item:hover, .search-item.active { background: var(--surface-3); }
.top-spacer { flex: 1; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); cursor: pointer; flex: none; transition: color .12s, border-color .12s; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.badge-dot { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.user-btn { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; cursor: pointer; padding: 4px; border-radius: var(--radius-sm); text-align: left; }
.user-btn:hover { background: var(--surface-2); }
.user-btn .who { line-height: 1.25; }
.user-btn .who b { display: block; font-weight: 600; font-size: 13px; }
.user-btn .who small { color: var(--text-3); font-size: 12px; }
.dropdown { position: absolute; top: calc(var(--header) - 6px); right: 20px; width: 260px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px; box-shadow: 0 12px 32px var(--shadow-color); z-index: 50; }
.dropdown.wide { width: 380px; max-width: calc(100vw - 24px); }
.dropdown button, .dropdown a.item { width: 100%; display: flex; gap: 10px; align-items: center; padding: 9px 10px; background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer; text-align: left; color: var(--text); }
.dropdown button:hover, .dropdown a.item:hover { background: var(--surface-3); }
.content { padding: 24px; flex: 1; min-width: 0; animation: fadein .16s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.demo-banner { background: var(--warn-soft); color: var(--warn); padding: 7px 24px; font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.backdrop { display: none; position: fixed; inset: 0; background: var(--overlay); z-index: 35; }

/* Títulos */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--text-2); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .06s; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg.icon { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 650; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-danger { background: transparent; border-color: var(--bad-line); color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }

/* Cartões */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); min-height: 54px; flex-wrap: wrap; }
.card-body { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: block; transition: border-color .12s, transform .12s, box-shadow .12s; min-width: 0; box-shadow: 0 8px 18px var(--shadow-color); }
.kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent); opacity: .75; }
.kpis .kpi:nth-child(6n+1) { background: linear-gradient(180deg, var(--kpi-tint-1), var(--surface) 72%); }
.kpis .kpi:nth-child(6n+2) { background: linear-gradient(180deg, var(--kpi-tint-2), var(--surface) 72%); }
.kpis .kpi:nth-child(6n+3) { background: linear-gradient(180deg, var(--kpi-tint-3), var(--surface) 72%); }
.kpis .kpi:nth-child(6n+4) { background: linear-gradient(180deg, var(--kpi-tint-4), var(--surface) 72%); }
.kpis .kpi:nth-child(6n+5) { background: linear-gradient(180deg, var(--kpi-tint-5), var(--surface) 72%); }
.kpis .kpi:nth-child(6n+6) { background: linear-gradient(180deg, var(--kpi-tint-6), var(--surface) 72%); }
a.kpi:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: 0 12px 24px var(--shadow-color); }
.kpi .label { color: var(--text-2); font-size: 12.5px; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.2; }
.kpi .hint { color: var(--text-3); font-size: 12px; margin-top: 3px; }
.kpi.accent { border-left: 3px solid var(--brand); }
.kpi.danger .value { color: var(--bad); }
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 20px; }
.dl div { min-width: 0; }
.dl dt, .dt { color: var(--text-3); font-size: 12px; margin-bottom: 1px; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
dl { margin: 0; }

/* Etiquetas */
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.plain::before { display: none; }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.brand { background: var(--brand-soft); color: var(--accent); }

/* Avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 650; font-size: 13px; color: var(--text-2); flex: none; overflow: hidden; object-fit: cover; border: 1px solid var(--border); }
.avatar.lg { width: 84px; height: 84px; font-size: 26px; }
.avatar.xl { width: 60px; height: 60px; font-size: 20px; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .t { min-width: 0; line-height: 1.3; }
.person b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; }
.person small { color: var(--text-3); font-size: 12px; }

/* Abas */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs button { padding: 10px 14px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 550; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Formulários */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.field small { color: var(--text-3); font-size: 12px; }
.field .err { color: var(--bad); font-size: 12px; }
.req::after { content: " *"; color: var(--accent); }
.input { width: 100%; min-height: 38px; padding: 7px 11px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); font: inherit; }
.input:focus { outline: none; border-color: var(--accent); }
.input.invalid { border-color: var(--bad); }
textarea.input { resize: vertical; min-height: 80px; }
select.input { appearance: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2, .span-all { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; font-weight: 650; padding-top: 6px; border-top: 1px solid var(--border); margin-top: 4px; color: var(--text); }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 2px 0 0; flex: none; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.form-error { background: var(--bad-soft); color: var(--bad); border-radius: var(--radius-sm); padding: 9px 12px; margin: 12px 0 0; }
.note { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--text-3); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text-2); font-size: 13px; }
.note.warn { border-left-color: var(--warn); }
.note.info { border-left-color: var(--info); }
.note.danger { border-left-color: var(--bad); }
.note b { color: var(--text); }
.win-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.ac { position: relative; }
.ac-list { position: absolute; z-index: 90; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); max-height: 220px; overflow-y: auto; padding: 4px; box-shadow: 0 8px 24px var(--shadow-color); }
.ac-item { padding: 7px 9px; border-radius: 5px; cursor: pointer; }
.ac-item:hover, .ac-item.active { background: var(--surface-3); }

/* Filtros e tabelas */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); align-items: flex-end; }
.toolbar .field { flex: 0 1 170px; }
.toolbar .field.grow { flex: 1 1 220px; }
.toolbar .field > span { font-size: 11.5px; }
.filters-toggle { display: none; }
.toolbar .tb-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0 10px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 4px 14px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; vertical-align: middle; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.table tbody tr td:first-child { border-left: 1px solid var(--border); border-radius: 12px 0 0 12px; }
.table tbody tr td:last-child { border-right: 1px solid var(--border); border-radius: 0 12px 12px 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover td { background: var(--band-hover); }
.table .right { text-align: right; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); flex-wrap: wrap; color: var(--text-2); font-size: 13px; }
.pager .btns { display: flex; gap: 6px; align-items: center; }
.empty { padding: 44px 20px; text-align: center; color: var(--text-2); }
.empty svg.icon { width: 30px; height: 30px; color: var(--text-3); margin-bottom: 8px; }
.empty b { display: block; color: var(--text); margin-bottom: 2px; }
.skeleton { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading-box { padding: 40px; display: grid; place-items: center; }
.totals-bar { display: flex; gap: 22px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.totals-bar div { font-variant-numeric: tabular-nums; }
.totals-bar small { display: block; color: var(--text-3); font-size: 12px; }
.totals-bar b { font-size: 16px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }

/* Modal */
.modal-back { position: fixed; inset: 0; z-index: 80; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; animation: fadein .12s ease; }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 24px 60px var(--shadow-color); margin-bottom: 5vh; }
.modal.lg { max-width: 820px; }
.modal.sm { max-width: 430px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.secret-box { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; }
.secret-box code { flex: 1; background: none; padding: 0; font-size: 13px; }

/* Toast */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-3); border: 1px solid var(--border-strong); border-left: 3px solid var(--text-3); border-radius: var(--radius-sm); padding: 10px 13px; box-shadow: 0 8px 24px var(--shadow-color); animation: slidein .18s ease; }
.toast.success { border-left-color: var(--good); }
.toast.error { border-left-color: var(--bad); }
.toast.warning { border-left-color: var(--warn); }
@keyframes slidein { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

/* Painel ao vivo */
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(51, 194, 107, .6); animation: pulse 2s infinite; }
.live-dot.off { background: var(--text-3); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(51, 194, 107, 0); } 100% { box-shadow: 0 0 0 0 rgba(51, 194, 107, 0); } }
.event { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); border-left: 3px solid var(--text-3); }
.event:last-child { border-bottom: 0; }
.event.granted { border-left-color: var(--good); }
.event.denied { border-left-color: var(--bad); }
.event.review { border-left-color: var(--warn); }
.event.fresh { animation: flash 1.2s ease; }
@keyframes flash { from { background: var(--surface-3); } to { background: transparent; } }
.event .info { flex: 1; min-width: 0; }
.event .info b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event .info small { color: var(--text-2); display: block; overflow: hidden; text-overflow: ellipsis; }
.event .when { text-align: right; flex: none; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 12.5px; }
.alert-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.alert-item:last-child { border-bottom: 0; }
a.alert-item:hover { background: var(--surface-2); }
.alert-item svg.icon { margin-top: 1px; }
.sev-danger { color: var(--bad); } .sev-warning { color: var(--warn); } .sev-info { color: var(--info); } .sev-success { color: var(--good); }

/* Gráficos */
.chart { position: relative; width: 100%; height: 220px; }
.chart svg { display: block; width: 100%; height: 100%; }
.chart text { fill: var(--text-3); font: 11px var(--font); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .base-line { stroke: var(--border-strong); stroke-width: 1; }
.chart .hover-band { fill: transparent; }
.chart .hover-band:hover, .chart .hover-band.on { fill: var(--band-hover); }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; font-size: 12.5px; white-space: nowrap; z-index: 5; box-shadow: 0 6px 18px var(--shadow-color); }
.chart-tip b { display: block; margin-bottom: 2px; }
.chart-tip .row { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.chart-tip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-empty { height: 100%; display: grid; place-items: center; color: var(--text-3); text-align: center; padding: 16px; }
.link-btn { background: none; border: 0; color: var(--text-3); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.link-btn:hover { color: var(--text); text-decoration: underline; }

/* Perfil */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head .t { flex: 1; min-width: 220px; }
.photo-btn { position: relative; background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; }
.photo-btn::after { content: "Trocar"; position: absolute; inset: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); display: grid; place-items: center; font-size: 12px; opacity: 0; transition: opacity .12s; color: #fff; }
.photo-btn:hover::after, .photo-btn:focus-visible::after { opacity: 1; }
.timeline { display: flex; flex-direction: column; }
.timeline .tl { display: flex; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.timeline .tl:last-child { border-bottom: 0; }
.timeline .tl time { color: var(--text-3); font-size: 12.5px; flex: none; width: 118px; font-variant-numeric: tabular-nums; }

/* Catracas */
.device-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.device-card .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.sim-result { padding: 18px; border-radius: var(--radius); border: 1px solid var(--border); display: flex; align-items: center; gap: 14px; }
.sim-result.granted { background: var(--good-soft); border-color: var(--good); }
.sim-result.denied { background: var(--bad-soft); border-color: var(--bad); }
.sim-result.review { background: var(--warn-soft); border-color: var(--warn); }

/* Vendas */
.pos { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 14px; }
.prod { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color .12s; color: var(--text); }
.prod:hover { border-color: var(--accent); }
.prod:disabled { opacity: .45; cursor: not-allowed; border-color: var(--border); }
.prod b { font-weight: 600; line-height: 1.25; }
.prod .price { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.qty { display: inline-flex; align-items: center; gap: 4px; }
.qty input { width: 48px; text-align: center; min-height: 30px; padding: 3px; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 20px; font-weight: 700; padding: 10px 0; }

/* Agenda */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-title { font-weight: 650; min-width: 180px; text-transform: capitalize; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 8px; color: var(--text-3); font-size: 12px; border-bottom: 1px solid var(--border); }
.cal-cell { min-height: 104px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.out { background: var(--cell-out); color: var(--text-3); }
.cal-cell.today .d { background: var(--brand); color: var(--brand-ink); border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; font-weight: 700; }
.cal-ev { display: block; width: 100%; text-align: left; font-size: 12px; padding: 3px 6px; margin-top: 3px; border-radius: 4px; background: var(--surface-3); border: 0; border-left: 2px solid var(--brand); color: var(--text); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev.assessment { border-left-color: var(--orange); }
.cal-ev.cancelled { opacity: .5; text-decoration: line-through; }
.cal-ev.done { border-left-color: var(--good); }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-height: 340px; }
.cal-wk-day { border-right: 1px solid var(--border); padding: 8px; min-width: 0; }
.cal-wk-day:last-child { border-right: 0; }
.cal-wk-day .dname { font-size: 12px; color: var(--text-3); margin-bottom: 6px; text-transform: capitalize; }
.cal-wk-day.today .dname { color: var(--accent); font-weight: 700; }

/* Permissões */
.perm-mod { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; }
.perm-mod h3 { margin-bottom: 8px; }

/* Login e instalação */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; }
.auth-card.auth-wide { max-width: 620px; }
.auth-logo { display: block; width: 190px; max-width: 70%; margin: 0 auto 22px; }
.auth-card h1 { font-size: 19px; }
.auth-card h2 { margin: 22px 0 6px; font-size: 15px; }
.auth-card form { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn-block { margin-top: 6px; height: 42px; }
.auth-foot { margin-top: 16px; font-size: 12.5px; text-align: center; }
.req-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 3px; font-size: 13px; }
.req-list .ok { color: var(--good); } .req-list .fail { color: var(--bad); font-weight: 600; }

/* Tablet */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-side, .pos { grid-template-columns: minmax(0, 1fr); }
}
/* Celular e tablet: menu em gaveta */
@media (max-width: 860px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 262px; transform: translateX(-100%); transition: transform .18s ease; }
  .shell.drawer .sidebar { transform: none; }
  .shell.drawer .backdrop { display: block; }
  .collapsed .sidebar-brand { justify-content: flex-start; padding: 0 16px; }
  .collapsed .sidebar-brand .full { display: block; }
  .collapsed .sidebar-brand .mark { display: none; }
  .collapsed .nav a { justify-content: flex-start; padding: 0 11px; }
  .collapsed .nav a span { display: inline; }
  .sidebar-foot { display: none; }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; gap: 8px; }
  .content { padding: 16px; }
  .demo-banner { padding: 7px 16px; }
  .user-btn .who { display: none; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid, .form-grid.g3 { grid-template-columns: minmax(0, 1fr); }
  .timeline .tl { flex-direction: column; gap: 2px; }
  .timeline .tl time { width: auto; }
}
/* Celular: tabelas viram cartões */
@media (max-width: 640px) {
  h1 { font-size: 19px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 11px 12px; }
  .kpi .value { font-size: 19px; }
  .page-actions, .page-actions .btn { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; width: auto; }
  .toolbar .field, .toolbar .field.grow { flex: 1 1 100%; }
  .toolbar .field.half { flex: 1 1 calc(50% - 4px); }
  .filters-toggle { display: inline-flex; flex: 1 1 100%; }
  .toolbar.mobile-folded .field:not(.grow) { display: none; }
  .toolbar .tb-actions { margin-left: 0; width: 100%; }
  .toolbar .tb-actions .btn { flex: 1; }
  .table.cards thead { display: none; }
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards tr { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); margin-bottom: 10px; box-shadow: 0 6px 14px var(--shadow-color); }
  .table.cards tr:last-child { border-bottom: 1px solid var(--border); }
  .table.cards td { padding: 4px 0; border: 0; display: flex; justify-content: space-between; gap: 14px; text-align: right; min-height: 26px; align-items: center; }
  .table.cards td::before { content: attr(data-label); color: var(--text-3); font-size: 12px; text-align: left; flex: none; max-width: 45%; }
  .table.cards td[data-label=""]::before { display: none; }
  .table.cards td.main-cell { justify-content: flex-start; text-align: left; padding-bottom: 6px; }
  .table.cards td.main-cell::before { display: none; }
  .table.cards td.actions-cell { justify-content: flex-end; padding-top: 8px; }
  .table.cards td.actions-cell::before { display: none; }
  .row-actions { justify-content: flex-end; }
  .dropdown { right: 12px; left: 12px; width: auto; }
  .dropdown.wide { width: auto; }
  .modal-back { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; border: 0; margin: 0; max-width: none !important; }
  .cal-cell { min-height: 72px; padding: 3px; }
  .cal-ev { font-size: 11px; padding: 2px 3px; }
  .cal-week { grid-template-columns: minmax(0, 1fr); }
  .cal-wk-day { border-right: 0; border-bottom: 1px solid var(--border); }
  .win-row { grid-template-columns: 1fr 1fr auto; }
  .win-row select { grid-column: 1 / -1; }
  .event { padding: 10px 14px; }
  .search-box { min-width: 0; }
  .list-row { padding: 10px 14px; }
}

/* Impressão */
#print-root { display: none; }
@media print {
  @page { margin: 14mm; }
  :root { color-scheme: light; }
  body { background: #fff !important; color: #000 !important; }
  body.printing #app, body.printing #toasts, body.printing #modal-root { display: none !important; }
  body.printing #print-root { display: block !important; }
  .sidebar, .topbar, .toolbar, .pager, .page-actions, .tabs, .row-actions, .demo-banner { display: none !important; }
  .shell { display: block; }
  .card { border: 0; background: #fff; }
  .table th, .table td { color: #000; border-color: #bbb; }
  .tag { background: none; color: #000; padding: 0; }
}
.doc { color: #000; font: 13px/1.45 Arial, sans-serif; }
.doc h1 { font-size: 18px; margin: 0 0 2px; }
.doc h2 { font-size: 14px; margin: 14px 0 6px; }
.doc table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.doc th, .doc td { border-bottom: 1px solid #bbb; padding: 5px 6px; text-align: left; font-size: 12px; }
.doc .r { text-align: right; }
.doc .head { border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 10px; }
.doc .total { font-size: 16px; font-weight: 700; text-align: right; margin-top: 10px; }
.doc .foot { margin-top: 26px; font-size: 11px; color: #444; }
