/* =====================================================================
   FMS — Design system
   Tokens no :root, modo escuro automático (prefers-color-scheme) e
   forçado (data-theme). Sem etapa de build: este arquivo é servido direto.
   ===================================================================== */

/* ---------- fontes do sistema (arquivos locais em static/fonts, licença OFL) ---------- */
@font-face { font-family: "Inter FMS"; src: url("../fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Jakarta FMS"; src: url("../fonts/plus-jakarta-sans.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Mono FMS"; src: url("../fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }

:root {
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f1f3f5;
  --border: #e4e7eb;
  --border-strong: #cfd4da;
  --text: #15181d;
  --text-2: #4b5360;
  --text-3: #7b8491;

  --brand: #d71a28;
  --brand-hover: #b9141f;
  --brand-soft: #fdecee;
  --brand-text: #a3101b;

  --blue: #2563eb;   --blue-soft: #e8efff;   --blue-text: #1e48b8;
  --green: #16a34a;  --green-soft: #e6f6ec;  --green-text: #11713a;
  --amber: #d97706;  --amber-soft: #fdf3e2;  --amber-text: #94530a;
  --red: #dc2626;    --red-soft: #fdeaea;    --red-text: #a51d1d;
  --purple: #7c3aed; --purple-soft: #f1ebfe; --purple-text: #5b23b8;
  --gray-soft: #eef0f3; --gray-text: #4b5360;

  --sidebar-bg: #121418;
  --sidebar-text: #a8afba;
  --sidebar-text-strong: #f3f4f6;
  --sidebar-hover: #1d2026;
  --sidebar-active: #262a31;
  --sidebar-border: #23262c;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14), 0 4px 8px rgba(16, 24, 40, .06);
  --ring: 0 0 0 3px rgba(37, 99, 235, .22);  /* foco em azul: vermelho é reservado para erro */

  --sidebar-w: 256px;
  --topbar-h: 60px;

  /* séries de gráficos (validadas para contraste nos dois temas) */
  --c1: #d71a28; --c2: #2563eb; --c3: #16a34a; --c4: #d97706; --c5: #7c3aed; --c6: #0891b2; --c7: #db2777; --c8: #64748b;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1013;
    --surface: #16191e;
    --surface-2: #1b1f25;
    --surface-3: #22262d;
    --border: #2a2f37;
    --border-strong: #3a404a;
    --text: #eef0f3;
    --text-2: #b4bbc6;
    --text-3: #838c99;
    --brand: #ef3442;
    --brand-hover: #ff4b58;
    --brand-soft: #3a1418;
    --brand-text: #ff8a92;
    --blue-soft: #172341;   --blue-text: #8fb1ff;
    --green-soft: #12291b;  --green-text: #6fd99a;
    --amber-soft: #33240c;  --amber-text: #f5bd66;
    --red-soft: #3a1515;    --red-text: #ff9a9a;
    --purple-soft: #261a40; --purple-text: #c4a6ff;
    --gray-soft: #22262d;   --gray-text: #b4bbc6;
    --sidebar-bg: #0a0b0d;
    --sidebar-hover: #15171b;
    --sidebar-active: #1d2025;
    --sidebar-border: #1a1c20;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 1px 3px rgba(0,0,0,.5);
    --shadow-lg: 0 16px 40px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1013;
  --surface: #16191e;
  --surface-2: #1b1f25;
  --surface-3: #22262d;
  --border: #2a2f37;
  --border-strong: #3a404a;
  --text: #eef0f3;
  --text-2: #b4bbc6;
  --text-3: #838c99;
  --brand: #ef3442;
  --brand-hover: #ff4b58;
  --brand-soft: #3a1418;
  --brand-text: #ff8a92;
  --blue-soft: #172341;   --blue-text: #8fb1ff;
  --green-soft: #12291b;  --green-text: #6fd99a;
  --amber-soft: #33240c;  --amber-text: #f5bd66;
  --red-soft: #3a1515;    --red-text: #ff9a9a;
  --purple-soft: #261a40; --purple-text: #c4a6ff;
  --gray-soft: #22262d;   --gray-text: #b4bbc6;
  --sidebar-bg: #0a0b0d;
  --sidebar-hover: #15171b;
  --sidebar-active: #1d2025;
  --sidebar-border: #1a1c20;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 1px 3px rgba(0,0,0,.5);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
small, .small { font-size: 12px; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.strong { font-weight: 600; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
  transition: transform .2s ease;
}
.sidebar-brand {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--sidebar-border);
  color: var(--sidebar-text-strong);
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #8f0d16);
  color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .02em;
  box-shadow: 0 4px 12px rgba(215, 26, 40, .35);
}
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--sidebar-text); }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px 20px; }
.nav-section { margin-top: 14px; }
.nav-section:first-child { margin-top: 0; }
.nav-title {
  padding: 6px 10px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #6b7280;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin: 1px 0;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-weight: 500; font-size: 13.5px;
  text-decoration: none;
  position: relative;
}
.nav a:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
.nav a.active { background: var(--sidebar-active); color: var(--sidebar-text-strong); }
.nav a.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav a .icon { width: 17px; height: 17px; opacity: .85; }
.nav .count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.sidebar-foot { padding: 12px 14px; border-top: 1px solid var(--sidebar-border); font-size: 11.5px; color: #6b7280; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .crumbs { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; min-width: 0; }
.topbar .crumbs strong { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.icon-btn.menu-toggle { display: none; }

.content { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-3); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- user menu / notifications ---------- */
.icon-btn {
  position: relative;
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center;
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  min-width: 240px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px;
}
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 7px; border: 0; background: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer; text-decoration: none;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); text-decoration: none; }
.dropdown-menu .sep { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 10px; }
.user-chip:hover { background: var(--surface-3); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  background: var(--brand-soft); color: var(--brand-text);
  font-weight: 700; font-size: 12.5px;
}
.user-chip .who { line-height: 1.15; }
.user-chip .who b { display: block; font-size: 13px; font-weight: 600; }
.user-chip .who span { font-size: 11.5px; color: var(--text-3); }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head .sub { font-size: 12.5px; color: var(--text-3); }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-flush .card-body { padding: 0; }

.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-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }

/* ---------- KPI tiles ---------- */
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  text-decoration: none; color: inherit;
}
a.kpi:hover { border-color: var(--border-strong); text-decoration: none; box-shadow: var(--shadow); }
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; font-weight: 550; }
.kpi-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.kpi-icon .icon { width: 16px; height: 16px; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-meta { font-size: 12px; color: var(--text-3); }
.tone-brand .kpi-icon { background: var(--brand-soft); color: var(--brand-text); }
.tone-blue .kpi-icon { background: var(--blue-soft); color: var(--blue-text); }
.tone-green .kpi-icon { background: var(--green-soft); color: var(--green-text); }
.tone-amber .kpi-icon { background: var(--amber-soft); color: var(--amber-text); }
.tone-red .kpi-icon { background: var(--red-soft); color: var(--red-text); }
.tone-purple .kpi-icon { background: var(--purple-soft); color: var(--purple-text); }
.tone-gray .kpi-icon { background: var(--gray-soft); color: var(--gray-text); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; font-size: 13.5px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-dark { background: var(--text); border-color: var(--text); color: var(--surface); }
.btn-dark:hover { opacity: .9; background: var(--text); }
.btn-danger { color: var(--red-text); border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.btn-danger:hover { background: var(--red-soft); }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: #b91c1c; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-icon { width: 32px; padding: 0; height: 32px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; gap: 4px; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--gray-soft); color: var(--gray-text);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge-green { background: var(--green-soft); color: var(--green-text); }
.badge-amber { background: var(--amber-soft); color: var(--amber-text); }
.badge-red { background: var(--red-soft); color: var(--red-text); }
.badge-blue { background: var(--blue-soft); color: var(--blue-text); }
.badge-purple { background: var(--purple-soft); color: var(--purple-text); }
.badge-brand { background: var(--brand-soft); color: var(--brand-text); }
.badge-gray { background: var(--gray-soft); color: var(--gray-text); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); background: var(--surface-2);
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table .actions .btn { margin-left: 2px; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: 12px; color: var(--text-3); }
.table-compact td { padding: 7px 12px; }
.table tfoot td { font-weight: 600; background: var(--surface-2); }

/* ---------- forms ---------- */
.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.col-1 { grid-column: span 1; } .col-2 { grid-column: span 2; } .col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; } .col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; } .col-9 { grid-column: span 9; } .col-10 { grid-column: span 10; } .col-11 { grid-column: span 11; } .col-12 { grid-column: span 12; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--brand); margin-left: 2px; }
.help { font-size: 12px; color: var(--text-3); }
.errorlist { list-style: none; margin: 0; padding: 0; color: var(--red-text); font-size: 12px; font-weight: 500; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"],
input[type="time"], input[type="search"], input[type="tel"], input[type="file"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: 38px;
  padding: 8px 11px;
  border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px;
  transition: border-color .12s, box-shadow .12s;
}
input[type="file"] { padding: 6px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: var(--ring); }
.field.has-error input:focus, .field.has-error select:focus, .field.has-error textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .18); }
input[readonly] { background: var(--surface-3); color: var(--text-2); }
select { appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b8491' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; color: var(--text); font-size: 13.5px; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }
.checks-inline { display: flex; flex-wrap: wrap; gap: 10px 22px; padding-top: 6px; }

.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; pointer-events: none; }
.input-icon input { padding-left: 34px; }

.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 0; }
.fieldset + .fieldset { margin-top: 16px; }
.fieldset > legend { padding: 0 6px; font-weight: 650; font-size: 13.5px; color: var(--text); }

.form-section { padding: 20px 22px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.form-section-head .step {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-text); font-weight: 700; font-size: 12.5px;
}
.form-section-head h3 { font-size: 14.5px; }
.form-section-head .help { margin-left: auto; }
.form-actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 22px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.opcao { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; font-weight: 550; }
.opcao:hover { background: var(--surface-2); }
.opcao input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }
.opcao:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }

/* ---------- toolbar / filters ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.toolbar .field { min-width: 150px; flex: 1 1 160px; }
.toolbar .field.grow { flex: 3 1 260px; }
.toolbar .field > label { font-size: 11.5px; }
.toolbar input, .toolbar select { min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 13.5px; }
.toolbar .btns { display: flex; gap: 6px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); font-size: 12.5px; font-weight: 550; text-decoration: none;
}
.chip:hover { background: var(--surface-3); text-decoration: none; }
.chip.active { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip .n { font-size: 11px; opacity: .75; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tabs a, .tabs button {
  padding: 12px 12px 11px; border: 0; background: none; font: inherit; font-weight: 550; font-size: 13.5px;
  color: var(--text-3); border-bottom: 2px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .active { color: var(--text); border-bottom-color: var(--brand); }

/* ---------- pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; }
.pagination a, .pagination span.cur {
  min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid var(--border); color: var(--text-2); text-decoration: none; font-weight: 550;
}
.pagination a:hover { background: var(--surface-3); }
.pagination span.cur { background: var(--text); color: var(--surface); border-color: var(--text); }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .icon { width: 40px; height: 40px; stroke-width: 1.5; color: var(--border-strong); margin-bottom: 10px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }
.empty .btn .icon { width: 16px; height: 16px; stroke-width: 2; color: inherit; margin: 0; }

/* ---------- alerts / callouts ---------- */
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2); font-size: 13.5px;
}
.callout .icon { margin-top: 1px; }
.callout-info { background: var(--blue-soft); border-color: transparent; color: var(--blue-text); }
.callout-warning { background: var(--amber-soft); border-color: transparent; color: var(--amber-text); }
.callout-danger { background: var(--red-soft); border-color: transparent; color: var(--red-text); }
.callout-success { background: var(--green-soft); border-color: transparent; color: var(--green-text); }
.callout b { font-weight: 650; }

/* ---------- toasts (Django messages) ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13.5px;
  animation: toast-in .25s ease-out;
}
.toast .icon { margin-top: 1px; }
.toast-success .icon { color: var(--green); }
.toast-error .icon { color: var(--red); }
.toast-warning .icon { color: var(--amber); }
.toast-info .icon { color: var(--blue); }
.toast .close { margin-left: auto; border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 0; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- modal (dialog) ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
}
dialog.modal.wide { width: min(820px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10, 12, 16, .55); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-y: auto; max-height: calc(100vh - 200px); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ---------- description lists ---------- */
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 20px; }
.dl > div { min-width: 0; }
.dl dt { font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-3); margin-bottom: 3px; }
.dl dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.dl dd.empty-val { color: var(--text-3); font-weight: 400; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .meta { font-size: 12px; color: var(--text-3); }
.list-link { color: inherit; text-decoration: none; display: contents; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 16px 14px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline .when { font-size: 12px; color: var(--text-3); }

/* ---------- progress / bars ---------- */
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.bar.green > span { background: var(--green); }
.bar.amber > span { background: var(--amber); }
.bar.red > span { background: var(--red); }
.bar.blue > span { background: var(--blue); }

/* ---------- charts (SVG gerado no servidor) ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { stroke: var(--border-strong); }
.chart .value-label { fill: var(--text-2); font-weight: 600; font-size: 11px; }
.chart rect.bar-rect { rx: 4; }
.chart .donut-center { fill: var(--text); font-size: 22px; font-weight: 700; }
.chart .donut-sub { fill: var(--text-3); font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; 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; }
.hbar-list { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(110px, 200px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hbar-row .val { font-weight: 650; font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }

/* ---------- signature ---------- */
.sig-box { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: #fff; position: relative; touch-action: none; }
.sig-box canvas { display: block; width: 100%; height: 160px; cursor: crosshair; border-radius: var(--radius); }
.sig-box .sig-hint { position: absolute; left: 12px; bottom: 8px; font-size: 11.5px; color: #9aa1ab; pointer-events: none; }
.sig-preview { max-height: 90px; background: #fff; border-radius: 8px; border: 1px solid var(--border); padding: 4px; }

/* ---------- auth pages ---------- */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
}
.auth-art {
  position: relative; overflow: hidden;
  background: radial-gradient(1200px 600px at 10% 10%, #2a0a0e 0%, transparent 60%), linear-gradient(160deg, #121418 0%, #1b0a0d 55%, #3a0810 100%);
  color: #f3f4f6; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-art::after {
  content: ""; position: absolute; right: -160px; bottom: -160px; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 52, 66, .35), transparent 65%);
}
.auth-art h1 { font-size: 34px; line-height: 1.15; max-width: 460px; letter-spacing: -.02em; }
.auth-art p { color: #b4bbc6; max-width: 440px; margin-top: 14px; font-size: 15px; }
.auth-feats { display: grid; gap: 14px; max-width: 440px; position: relative; z-index: 1; }
.auth-feats div { display: flex; gap: 12px; align-items: flex-start; color: #d1d5db; }
.auth-feats .icon { color: #ff6b76; margin-top: 2px; }
.auth-panel { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-marca { display: none; align-items: center; gap: 12px; margin-bottom: 28px; }
@media (max-width: 1024px) { .auth-marca { display: flex; } }
.auth-card h2 { font-size: 24px; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-3); margin-bottom: 24px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn { height: 42px; }
.pw-rules { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 4px; font-size: 12px; color: var(--text-3); }
.pw-rules li { display: flex; align-items: center; gap: 6px; }
.pw-rules li.ok { color: var(--green-text); }
.pw-rules li::before { content: "○"; font-size: 10px; }
.pw-rules li.ok::before { content: "●"; }

/* ---------- misc ---------- */
.divider-label { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; margin: 6px 0; }
.divider-label::before, .divider-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); }
.pill-num { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--surface-3); font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.stat-inline { display: flex; gap: 20px; flex-wrap: wrap; }
.stat-inline div { display: flex; flex-direction: column; }
.stat-inline b { font-size: 18px; font-variant-numeric: tabular-nums; }
.stat-inline span { font-size: 12px; color: var(--text-3); }
.overlay { display: none; }
.combo { position: relative; }
.combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 4px;
}
.combo-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; cursor: pointer; font: inherit; color: var(--text); }
.combo-list button:hover, .combo-list button.hl { background: var(--surface-3); }
.combo-list .sub { font-size: 12px; color: var(--text-3); display: block; }
.combo-list .none { padding: 10px; color: var(--text-3); font-size: 13px; }

.timer { font-family: var(--mono); font-size: 28px; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; }


/* ---------- extras de usabilidade ---------- */
.sucesso-icone { width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 18px; display: grid; place-items: center; background: var(--green-soft); color: var(--green-text); }
.sucesso-icone .icon { width: 30px; height: 30px; }
.ajuda-login summary { cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 550; text-align: center; list-style: none; }
.ajuda-login summary::-webkit-details-marker { display: none; }
.ajuda-login summary:hover { color: var(--text); text-decoration: underline; }
.ajuda-login p { margin-top: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }

/* aviso e página de novidades */
.novidade + .novidade { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.novidade-data { font-size: 12px; font-weight: 600; color: var(--brand); }
.novidade h4 { margin: 2px 0 10px; font-size: 16px; }
.novidade-grupo { display: flex; align-items: center; gap: 6px; margin: 12px 0 6px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.novidade-grupo.melhoria .icon { color: var(--green-text); }
.novidade-grupo.correcao .icon { color: var(--blue-text); }
.novidade ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; color: var(--text); }
.sidebar-foot a.versao { color: inherit; text-decoration: none; }
.sidebar-foot a.versao:hover { color: #f3f4f6; text-decoration: underline; }

/* verificação em duas etapas */
.passos-2fa { margin: 4px 0 14px; padding-left: 20px; display: grid; gap: 6px; font-size: 13.5px; color: var(--text-2); }
.qr-2fa { width: 196px; margin: 0 auto 12px; padding: 10px; border-radius: 14px; background: #fff; box-shadow: 0 6px 20px -8px rgba(0, 0, 0, .35); }
.qr-2fa svg { display: block; width: 100%; height: auto; }
.qr-2fa svg path { fill: #111; }
.segredo-2fa { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 13px; letter-spacing: .04em; word-break: break-all; }
input.codigo-2fa { font-family: var(--mono); font-size: 20px; letter-spacing: .35em; text-align: center; }
.codigos-recuperacao { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.codigos-recuperacao code { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-family: var(--mono); font-size: 15px; letter-spacing: .06em; text-align: center; }
@media print {
  .auth-art, .auth-marca, .auth-card .btn, .auth-card form { display: none !important; }
  .codigos-recuperacao code { border: 1px solid #999; }
}
.contador { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.contador.ok { color: var(--green-text); }
.contador.falta { color: var(--amber-text); }
.combo-list .combo-criar { color: var(--blue-text); font-weight: 600; border-top: 1px solid var(--border); border-radius: 0 0 7px 7px; margin-top: 2px; }
.toolbar-toggle { display: none; }
.passos { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.passos li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.passos .num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; background: var(--surface-3); color: var(--text-2); flex: none; }
.passos li.feito .num { background: var(--green-soft); color: var(--green-text); }
.passos li.feito .titulo { color: var(--text-3); text-decoration: line-through; }
.passos .titulo { font-weight: 600; }
.passos .grow { flex: 1; min-width: 0; }
.passos li.atual { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .10); }

@media (max-width: 720px) {
  /* rodapé de formulário: botões quebram linha em vez de sair da tela */
  .form-actions { flex-wrap: wrap; padding: 10px 14px; }
  .form-actions .btn, .form-actions form { flex: 1 1 auto; }
  .form-actions form .btn { width: 100%; }
  /* topo: só o nome da página */
  .topbar .crumbs > :not(strong) { display: none; }
  /* filtros recolhíveis */
  .toolbar-toggle { display: inline-flex; align-self: flex-end; }
  form.toolbar:not(.aberto) .field:not(.grow), form.toolbar:not(.aberto) .btns { display: none; }
  .toolbar .field.grow { flex-basis: 100%; }
  /* tabelas principais viram cartões */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { padding: 10px 16px; border-bottom: 1px solid var(--border); }
  .table-cards tbody tr:hover td { background: transparent; }
  .table-cards td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table-cards td::before { content: attr(data-label); color: var(--text-3); font-family: var(--font); letter-spacing: normal; font-size: 12px; font-weight: 600; text-align: left; flex: none; }
  .table-cards td:not([data-label])::before { content: none; }
  .table-cards td.principal { display: block; text-align: left; padding-bottom: 6px; }
  .table-cards td.principal::before { content: none; }
  .table-cards td.actions { width: 100%; justify-content: flex-end; padding-top: 8px; }
  .table-cards td.vazio { display: block; }
  /* tabelas de digitação (proporções, produtos BEG) empilham */
  .tabela-empilhada thead { display: none; }
  .tabela-empilhada tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .tabela-empilhada td { border: 0 !important; padding: 0 !important; min-width: 0 !important; }
  .tabela-empilhada td.cab { grid-column: 1 / -1; }
  .tabela-empilhada td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 600; color: var(--text-3); margin-bottom: 3px; }
  .tabela-empilhada.beg tr { grid-template-columns: 1fr 1fr; }
}


/* =====================================================================
   VISUAL MODERNO (v2.1) — sobrescreve as regras anteriores
   ===================================================================== */
:root {
  --font: "Inter FMS", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-display: "Jakarta FMS", "Inter FMS", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: "Mono FMS", "Cascadia Code", Consolas, monospace;
  --radius: 11px;
  --radius-lg: 16px;
  --grad-brand: linear-gradient(135deg, #f23443 0%, #d1131f 55%, #9a0b16 100%);
  --grad-escuro: radial-gradient(900px 500px at 85% 20%, rgba(226, 36, 52, .28), transparent 60%), radial-gradient(700px 500px at 0% 100%, rgba(37, 99, 235, .14), transparent 60%), linear-gradient(160deg, #101115 0%, #17090c 60%, #250a0f 100%);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 1px rgba(16, 24, 40, .03);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .12);
  --shadow-lg: 0 24px 48px -16px rgba(16, 24, 40, .28), 0 4px 10px rgba(16, 24, 40, .06);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar-w: 264px;
}
/* tipografia: Jakarta nos títulos e números de destaque, Inter no texto, Mono nos códigos */
body { letter-spacing: -.003em; }
h1, h2, h3, .kpi-value, .brand-name, section.hero h1, .auth-card h2, .legenda-3d h3, .timer, .stat-inline b, .empty h3 {
  font-family: var(--font-display); font-feature-settings: normal; letter-spacing: -.02em;
}
h1 { font-weight: 750; }
h2, h3 { font-weight: 700; }
.kpi-value { font-weight: 750; letter-spacing: -.03em; }
.btn, .nav a, .tabs a, .chip, .badge { font-weight: 600; }
.table th { font-family: var(--font-display); letter-spacing: .05em; }
.mono, code, .kbd { font-family: var(--mono); font-feature-settings: "zero" 1; }
.num, .kpi-value, .table td.num, .pill-num, .stat-inline b { font-variant-numeric: tabular-nums; }
h1 { font-size: 25px; letter-spacing: -.02em; }

body {
  background:
    radial-gradient(1100px 520px at 105% -10%, rgba(215, 26, 40, .07), transparent 60%),
    radial-gradient(900px 520px at -10% 110%, rgba(37, 99, 235, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

/* ---------- barras de rolagem finas em todo o sistema ---------- */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text-3) 40%, transparent) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: color-mix(in srgb, var(--text-3) 38%, transparent);
  border-radius: 99px; border: 3px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--text-3) 65%, transparent); }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- menu lateral ---------- */
.sidebar {
  background:
    radial-gradient(420px 260px at 0% 0%, rgba(226, 36, 52, .20), transparent 70%),
    radial-gradient(300px 300px at 100% 100%, rgba(37, 99, 235, .10), transparent 70%),
    linear-gradient(180deg, #121318 0%, #0b0c0f 100%);
  border-right: 1px solid rgba(255, 255, 255, .05);
  transition: width .28s var(--ease), transform .2s ease;
}
.sidebar-brand { border-bottom-color: rgba(255, 255, 255, .06); }
.brand-mark { background: var(--grad-brand); transition: transform .5s var(--ease); transform-style: preserve-3d; }
/* símbolo EmDia (gota com check) dentro do quadrado vermelho */
.brand-mark .marca-simbolo { width: 100%; height: 100%; display: block; }
.sidebar-brand:hover .brand-mark { transform: perspective(200px) rotateY(180deg); }

/* rolagem do menu: invisível em repouso, fina e arredondada ao passar o mouse */
.nav {
  padding: 10px 10px 24px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 22px), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 22px), transparent 100%);
}
.nav:hover { scrollbar-color: rgba(255, 255, 255, .22) transparent; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-track { background: transparent; margin: 8px 0; }
.nav::-webkit-scrollbar-thumb { background: transparent; border: 0; border-radius: 99px; transition: background .3s; }
.nav:hover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); }
.nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .32); }

.nav-title { color: #5b616c; font-size: 10px; letter-spacing: .12em; padding: 6px 12px 4px; }
.nav a {
  gap: 11px; padding: 6px 10px; border-radius: 12px; font-size: 13.5px; color: #a3aab5;
  transition: background .18s, color .18s, transform .18s var(--ease);
}
.nav a .ico {
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .04);
  transition: background .2s, box-shadow .2s, color .2s, transform .25s var(--ease);
}
.nav a .ico .icon { width: 16px; height: 16px; opacity: 1; }
.nav a .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a:hover { background: rgba(255, 255, 255, .045); color: #f3f4f6; transform: translateX(2px); }
.nav a:hover .ico { background: rgba(255, 255, 255, .08); }
.nav a.active { background: linear-gradient(90deg, rgba(226, 36, 52, .20), rgba(226, 36, 52, .02) 85%); color: #fff; }
.nav a.active::before { left: -10px; top: 10px; bottom: 10px; width: 3px; background: #ff4b5a; box-shadow: 0 0 12px #ff4b5a; }
.nav a.active .ico { background: var(--grad-brand); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -6px rgba(226, 36, 52, .75); }
.nav .count { box-shadow: 0 0 0 3px #121318; }

.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-top-color: rgba(255, 255, 255, .06); }
.recolher {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .03); color: #9aa1ab;
  font: inherit; font-size: 12.5px; cursor: pointer; transition: background .2s, color .2s;
}
.recolher:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.recolher .icon { width: 15px; height: 15px; transition: transform .3s var(--ease); }
.versao { font-size: 11px; color: #555b66; }

/* menu recolhido (só no computador) */
@media (min-width: 1025px) {
  .nav-mini { --sidebar-w: 78px; }
  .nav-mini .sidebar .lbl, .nav-mini .brand-texto, .nav-mini .nav-title { display: none; }
  .nav-mini .sidebar-brand { padding: 0; justify-content: center; }
  .nav-mini .nav { padding: 10px 12px 24px; }
  .nav-mini .nav-section { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .06); }
  .nav-mini .nav-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
  .nav-mini .nav a { justify-content: center; padding: 6px; }
  .nav-mini .nav a:hover { transform: none; }
  .nav-mini .nav .count { position: absolute; top: 1px; right: 4px; min-width: 17px; height: 17px; font-size: 10px; }
  .nav-mini .sidebar-foot { justify-content: center; }
  .nav-mini .recolher { padding: 0 9px; }
  .nav-mini .recolher .icon { transform: rotate(180deg); }
}
.main { transition: margin-left .28s var(--ease); }

/* ---------- barra superior ---------- */
.topbar { background: color-mix(in srgb, var(--surface) 75%, transparent); transition: box-shadow .25s, background .25s; }
.topbar.rolou { box-shadow: 0 10px 30px -18px rgba(16, 24, 40, .35); }
.avatar { background: var(--grad-brand); color: #fff; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); }
.icon-btn { border-radius: 10px; transition: background .15s, color .15s, transform .15s; }
.icon-btn:active { transform: scale(.94); }
.dropdown-menu { border-radius: 14px; animation: aparecer .18s var(--ease); transform-origin: top right; }
@keyframes aparecer { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* ---------- cartões ---------- */
.card { border-radius: var(--radius-lg); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--border) 85%, transparent); }
.card-head { padding: 15px 20px; }
.card-head h2 { font-size: 16px; }
.card-body { padding: 20px; }
.table th { background: color-mix(in srgb, var(--surface-2) 80%, transparent); }
.table tbody tr { transition: background .15s; }
.table tbody tr.clickable:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand); }

/* KPIs com inclinação 3D e reflexo seguindo o mouse */
.kpi {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); box-shadow: var(--shadow);
  transform-style: preserve-3d; will-change: transform;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .2s;
}
.kpi::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .55), transparent 45%);
  mix-blend-mode: soft-light;
}
.kpi:hover::after { opacity: 1; }
.kpi:hover { box-shadow: var(--shadow-lg); }
.kpi-icon { border-radius: 10px; width: 34px; height: 34px; box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 18%, transparent); }
.kpi-value { font-size: 29px; }

/* ---------- botões ---------- */
.btn { border-radius: 10px; transition: background .15s, border-color .15s, box-shadow .2s, transform .12s; }
.btn:active { transform: translateY(1px) scale(.985); }
.btn-primary {
  background: var(--grad-brand); border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 18px -8px rgba(215, 26, 40, .65);
}
.btn-primary:hover { background: var(--grad-brand); filter: brightness(1.07); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 12px 24px -10px rgba(215, 26, 40, .75); }
.btn-success { background: linear-gradient(135deg, #22c55e, #15803d); border-color: transparent; box-shadow: 0 8px 18px -8px rgba(22, 163, 74, .6); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"],
input[type="time"], input[type="search"], input[type="tel"], input[type="file"], input[type="datetime-local"], select, textarea {
  border-radius: 10px; transition: border-color .15s, box-shadow .2s, background .2s;
}

/* ---------- entrada suave do conteúdo ---------- */
.content > * { animation: subir .5s var(--ease) backwards; }
.content > *:nth-child(2) { animation-delay: .05s; }
.content > *:nth-child(3) { animation-delay: .1s; }
.content > *:nth-child(4) { animation-delay: .15s; }
.content > *:nth-child(5) { animation-delay: .2s; }
.content > *:nth-child(n+6) { animation-delay: .25s; }
@keyframes subir { from { opacity: 0; transform: translateY(10px); } }
.grid > .kpi { animation: subir .5s var(--ease) backwards; }
.grid > .kpi:nth-child(2) { animation-delay: .06s; }
.grid > .kpi:nth-child(3) { animation-delay: .12s; }
.grid > .kpi:nth-child(4) { animation-delay: .18s; }
.grid > .kpi:nth-child(5) { animation-delay: .24s; }

/* ---------- gráficos que crescem ---------- */
.chart rect.bar-rect { transform-box: fill-box; transform-origin: 50% 100%; animation: crescer .9s var(--ease) both; }
@keyframes crescer { from { transform: scaleY(0); } }
.chart polyline { stroke-dasharray: 3000; stroke-dashoffset: 3000; animation: tracar 1.6s .4s ease forwards; }
@keyframes tracar { to { stroke-dashoffset: 0; } }
.chart.rosca { animation: girar-entrar 1s var(--ease) both; }
@keyframes girar-entrar { from { transform: rotate(-120deg) scale(.8); opacity: 0; } }
.bar > span { animation: encher 1.1s var(--ease) both; }
@keyframes encher { from { width: 0; } }

/* ---------- avisos (toasts) com barra de tempo ---------- */
.toast { position: relative; overflow: hidden; border-radius: 14px; animation: toast-in .35s var(--ease); }
.toast:not(.toast-error)::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: currentColor; opacity: .25; transform-origin: left; animation: tempo-toast 6s linear forwards;
}
.toast-success::after { color: var(--green); } .toast-info::after { color: var(--blue); } .toast-warning::after { color: var(--amber); }
@keyframes tempo-toast { to { transform: scaleX(0); } }
@keyframes toast-in { from { transform: translateY(14px) scale(.97); opacity: 0; } }

/* ---------- palcos 3D ---------- */
canvas.palco-3d { display: block; width: 100%; height: 100%; }
canvas.palco-3d.mini { width: 150px; height: 150px; margin: 0 auto 6px; }
canvas.palco-3d.medio { width: 210px; height: 190px; margin: 0 auto; }

/* tela de entrada */
.auth-art { background: var(--grad-escuro); padding: 40px 44px; isolation: isolate; }
.auth-art::after { display: none; }
.auth-art > canvas.palco-3d { position: absolute; inset: 0; z-index: 0; }
.auth-art::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(10, 10, 13, .55) 0%, transparent 28%, transparent 62%, rgba(10, 10, 13, .7) 100%);
}
.auth-art-topo, .auth-art-texto, .legenda-3d { position: relative; z-index: 2; }
.auth-art-topo { display: flex; align-items: center; gap: 12px; }
.auth-art-texto { margin-top: 26px; max-width: 420px; margin-bottom: auto; }
.auth-art-texto h1 { font-size: 30px; line-height: 1.15; color: #fff; text-shadow: 0 2px 18px rgba(0, 0, 0, .5); }
.selo {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; padding: 5px 11px; border-radius: 99px;
  font-size: 12px; font-weight: 600; color: #ffd2d6; background: rgba(226, 36, 52, .16); border: 1px solid rgba(255, 90, 105, .3);
  backdrop-filter: blur(6px);
}
.legenda-3d {
  max-width: 360px; padding: 16px 18px; border-radius: 16px; color: #e5e7eb;
  background: rgba(16, 17, 21, .55); border: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(12px) saturate(140%); box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .6);
}
.legenda-3d .leg-num { font-size: 12px; color: #8f96a1; letter-spacing: .08em; }
.legenda-3d .leg-num b { color: #ff6b77; }
.legenda-3d h3 { font-size: 19px; color: #fff; margin: 4px 0 4px; font-family: var(--font-display); }
.legenda-3d p { font-size: 13.5px; color: #b8bec8; min-height: 2.6em; }
.legenda-3d.trocou p { animation: legenda-in .6s var(--ease) .25s both; }
@keyframes legenda-in { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } }
.leg-barras { display: flex; gap: 6px; margin-top: 12px; }
.leg-barras i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.leg-barras b { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff4b5a, #ffb3ba); border-radius: 3px; }
.auth-panel { background: radial-gradient(600px 400px at 100% 0%, rgba(215, 26, 40, .05), transparent 60%), var(--surface); }
.auth-card h2 { font-size: 26px; }
.auth-card .btn { height: 44px; border-radius: 12px; }
.auth-card input { min-height: 44px; border-radius: 12px; }

/* painel de boas-vindas da página inicial */
section.hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) 440px; align-items: stretch;
  min-height: 236px; margin-bottom: 18px; border-radius: 20px; color: #e5e7eb;
  background: var(--grad-escuro); box-shadow: 0 30px 60px -30px rgba(80, 8, 16, .55);
}
.hero-texto { position: relative; z-index: 2; padding: 26px 28px; display: flex; flex-direction: column; gap: 10px; }
.hero-data { font-size: 12.5px; color: #ff9aa3; font-weight: 600; letter-spacing: .02em; }
section.hero h1 { color: #fff; font-size: 28px; }
section.hero p { color: #b8bec8; max-width: 560px; }
section.hero p b { color: #fff; }
.hero-acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
section.hero .btn:not(.btn-primary) { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .14); color: #f3f4f6; backdrop-filter: blur(6px); }
section.hero .btn:not(.btn-primary):hover { background: rgba(255, 255, 255, .14); }
.hero-palco { position: relative; }
/* A cena 3D tem fundo transparente: a borda esquerda some num degradê de transparência e o fundo do painel
   continua por baixo. Antes era uma faixa de cor sólida, que aparecia como uma divisão no vermelho. */
.hero-palco canvas {
  position: absolute; inset: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 120px);
          mask-image: linear-gradient(90deg, transparent 0, #000 120px);
}
.hero-legenda {
  position: absolute; right: 16px; top: 14px; z-index: 2; display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 12px; border-radius: 99px; background: rgba(16, 17, 21, .55); border: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(8px); font-size: 12px; color: #e5e7eb; font-weight: 600;
}
.hero-legenda .leg-barras { margin: 0; width: 90px; gap: 4px; }

.passos-3d { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 8px; align-items: center; }

/* ---------- modo escuro: ajustes finos ---------- */
:root[data-theme="dark"] body, :root:not([data-theme="light"]) body { background-attachment: fixed; }

/* ---------- celular ---------- */
@media (max-width: 1024px) {
  section.hero { grid-template-columns: minmax(0, 1fr); }
  .hero-palco { height: 200px; }
  .hero-palco canvas {
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 40px);
            mask-image: linear-gradient(180deg, transparent 0, #000 40px);
  }
}
@media (max-width: 720px) {
  .hero-texto { padding: 20px; }
  section.hero h1 { font-size: 23px; }
  .passos-3d { grid-template-columns: minmax(0, 1fr); }
  .passos-3d canvas { display: none; }
}


/* ---------- textos animados: só em pontos de destaque ---------- */
.tx-anima { perspective: 600px; }
.tx-anima .tx-p { display: inline-block; }
.tx-palavras .tx-p {
  animation: tx-subir .75s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 75ms + var(--atraso, 0ms));
  transform-origin: 50% 100%;
}
@keyframes tx-subir { from { opacity: 0; transform: translateY(.5em) rotateX(-55deg); filter: blur(8px); } }
.tx-letras .tx-p { white-space: nowrap; }
.tx-letras .tx-l {
  display: inline-block;
  animation: tx-letra .6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 26ms + var(--atraso, 0ms));
}
@keyframes tx-letra { from { opacity: 0; transform: translateY(.65em) scale(.85); filter: blur(5px); } }

/* destaque com brilho que corre devagar (usado só na frase da entrada) */
.destaque-texto {
  background: linear-gradient(100deg, #ff4b5a 0%, #ffc2c8 40%, #ff4b5a 65%, #ff4b5a 100%);
  background-size: 250% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: tx-brilho 8s linear infinite;
  text-shadow: none;
}
.tx-palavras .destaque-texto.tx-p {
  animation: tx-subir .75s var(--ease) both, tx-brilho 8s linear infinite;
  animation-delay: calc(var(--i, 0) * 75ms + var(--atraso, 0ms)), 0s;
}
@keyframes tx-brilho { from { background-position: 100% center; } to { background-position: -150% center; } }
.nome-destaque { background: linear-gradient(90deg, #ffffff, #ffb3ba); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- respeita quem prefere menos movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .overlay { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.4); }
  .main { margin-left: 0; }
  .icon-btn.menu-toggle { display: grid; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth { grid-template-rows: auto 1fr; }
  .auth-art { min-height: 300px; padding: 20px 22px; }
  .auth-art-texto { margin-top: 14px; }
  .auth-art-texto h1 { font-size: 20px; max-width: 200px; }
  .auth-art-texto .selo { display: none; }
  .legenda-3d { max-width: 190px; padding: 10px 12px; }
  .legenda-3d p { display: none; }
  .legenda-3d h3 { font-size: 15px; margin: 2px 0 0; }
  .auth-marca { display: none !important; }
}
@media (max-width: 720px) {
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: auto; }
  .form-grid > [class*="col-"] { grid-column: span 12; }
  .user-chip .who { display: none; }
  .page-head { align-items: flex-start; }
  .hbar-row { grid-template-columns: 100px 1fr auto; }
}

/* ---------- print ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; color: #000; font-size: 11.5px; }
  .sidebar, .topbar, .toasts, .page-actions, .no-print, .form-actions, .pagination, .toolbar { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .badge { border: 1px solid #999; background: #fff !important; color: #000 !important; }
  a { color: #000; }
  .print-only { display: block !important; }
}
.print-only { display: none; }

/* campo-armadilha contra robôs no pedido de acesso */
.armadilha { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

/* =====================================================================
   Análises: cores e marcas dos gráficos
   Paleta categórica validada para daltonismo (protan/deutan) nos dois
   temas; situação (--st-*) sempre acompanha ícone e texto.
   ===================================================================== */
:root {
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --o1: #86b6ef; --o2: #5598e7; --o3: #2a78d6; --o4: #1c5cab; --o5: #104281;
  --st-bom: #0ca30c; --st-atencao: #fab219; --st-serio: #ec835a; --st-critico: #d03b3b; --st-neutro: #9aa3ae;
  --dv-v3: #b42f2f; --dv-v2: #e0706b; --dv-v1: #f5c6c2; --dv-0: #eceae6; --dv-a1: #b7d3f6; --dv-a2: #2a78d6;
  --viz-grade: #eceef1; --viz-base: #cfd4da;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --o1: #1c5cab; --o2: #256abf; --o3: #3987e5; --o4: #6da7ec; --o5: #9ec5f4;
    --st-neutro: #5f6772;
    --dv-v3: #e66767; --dv-v2: #b0443f; --dv-v1: #5b2a28; --dv-0: #34363a; --dv-a1: #1f4a80; --dv-a2: #5598e7;
    --viz-grade: #23272e; --viz-base: #3a404a;
  }
}
:root[data-theme="dark"] {
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --o1: #1c5cab; --o2: #256abf; --o3: #3987e5; --o4: #6da7ec; --o5: #9ec5f4;
  --st-neutro: #5f6772;
  --dv-v3: #e66767; --dv-v2: #b0443f; --dv-v1: #5b2a28; --dv-0: #34363a; --dv-a1: #1f4a80; --dv-a2: #5598e7;
  --viz-grade: #23272e; --viz-base: #3a404a;
}

/* ---------- SVG (colunas e linhas) ---------- */
.viz-rolagem { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; padding-top: 4px; }
.viz-svg { width: 100%; height: auto; display: block; overflow: visible; font-family: var(--font); }
.viz-svg text { font-size: 11px; }
.viz-svg .eixo { fill: var(--text-3); font-variant-numeric: tabular-nums; }
.viz-svg .grade { stroke: var(--viz-grade); stroke-width: 1; }
.viz-svg .base { stroke: var(--viz-base); stroke-width: 1; }
.viz-svg .valor { fill: var(--text-2); font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.viz-svg .referencia { stroke: var(--text-2); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: .7; }
.viz-svg .ref-texto { fill: var(--text-2); font-weight: 600; }
.viz-svg .ref-valor { fill: var(--text-3); font-variant-numeric: tabular-nums; }
.viz-svg .linha { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-svg .lavagem { fill-opacity: .1; stroke: none; }
.viz-svg .ponto, .viz-svg .ponto-mira { stroke: var(--surface); stroke-width: 2; }
.viz-svg .col { outline: none; cursor: default; }
.viz-svg .col .alvo { fill: transparent; }
.viz-svg .col:hover .marca, .viz-svg .col:focus .marca { filter: brightness(1.12) saturate(1.05); }
.viz-svg .col:focus-visible .alvo { fill: var(--blue-soft); fill-opacity: .5; }
.viz-svg .mira { stroke: var(--text-3); stroke-width: 1; opacity: 0; }
.viz-svg .ponto-mira { opacity: 0; }
.viz-svg .col-linha:hover .mira, .viz-svg .col-linha:focus .mira,
.viz-svg .col-linha:hover .ponto-mira, .viz-svg .col-linha:focus .ponto-mira { opacity: 1; }
.viz-svg .marca { transform-box: fill-box; transform-origin: 50% 100%; animation: vizSobe .7s cubic-bezier(.2, .8, .2, 1) backwards; }
@keyframes vizSobe { from { transform: scaleY(0); } }
.viz-svg { animation: vizSurge .5s ease-out backwards; }
@keyframes vizSurge { from { opacity: 0; } }
.viz-mini { width: 112px; height: 30px; display: block; flex: none; }
.viz-mini polyline { fill: none; stroke: var(--text-3); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; opacity: .8; }
.viz-mini circle { fill: var(--s1); stroke: var(--surface); stroke-width: 1.5; }

/* ---------- barras horizontais, pilhas e barra segmentada (HTML) ---------- */
.vb-lista { display: flex; flex-direction: column; gap: 4px; }
.vb-linha { display: grid; grid-template-columns: minmax(110px, 190px) minmax(0, 1fr) auto; gap: 12px; align-items: center;
  font-size: 13px; padding: 5px 6px; margin: 0 -6px; border-radius: 8px; outline: none; }
.vb-linha:hover, .vb-linha:focus-visible { background: var(--surface-2); }
.vb-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.vb-nome a { color: var(--text); font-weight: 550; }
.vb-trilho { position: relative; height: 10px; }
.vb-barra { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; transform-origin: left; animation: vizEstica .7s cubic-bezier(.2, .8, .2, 1) backwards; }
.vb-ref { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px dashed var(--text-2); opacity: .75; }
.vb-nota { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); margin-top: 6px; }
.vb-ref-chave { display: inline-block; width: 0; height: 12px; border-left: 2px dashed var(--text-2); }
.vb-valor { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.vb-valor small { font-weight: 450; color: var(--text-3); margin-left: 6px; font-size: 12px; }
.vb-trilho-limpo { height: 12px; }
.vb-pilha { display: flex; gap: 2px; height: 100%; transform-origin: left; animation: vizEstica .7s cubic-bezier(.2, .8, .2, 1) backwards; }
.vb-seg { display: block; height: 100%; min-width: 2px; outline: none; }
.vb-seg:last-child { border-radius: 0 4px 4px 0; }
.vb-seg:hover, .vb-seg:focus-visible { filter: brightness(1.12); }
@keyframes vizEstica { from { transform: scaleX(0); } }
.vs-barra { display: flex; gap: 2px; height: 28px; }
.vs-bloco { display: flex; align-items: center; padding-left: 8px; min-width: 2px; border-radius: 4px; font-size: 12px; font-weight: 650;
  overflow: hidden; white-space: nowrap; outline: none; transform-origin: left; animation: vizEstica .7s cubic-bezier(.2, .8, .2, 1) backwards; }
.vs-bloco:hover, .vs-bloco:focus-visible { filter: brightness(1.1); }
.viz-legenda { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); margin-top: 12px; }
.viz-legenda span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.viz-legenda i.chave-linha { width: 16px; height: 2px; border-radius: 1px; }
.viz-legenda i.chave-ref { width: 16px; height: 0; border-top: 2px dashed var(--text-2); border-radius: 0; }

/* ---------- mapa de calor ---------- */
.mc { display: grid; gap: 2px; font-size: 12px; min-width: 520px; }
.mc-canto { min-height: 1px; }
.mc-col { text-align: center; color: var(--text-3); font-size: 11px; padding-bottom: 4px; white-space: nowrap; }
.mc-lin { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 10px; align-self: center; }
.mc-lin a { color: var(--text); font-weight: 550; }
.mc-cel { height: 34px; display: grid; place-items: center; border-radius: 4px; font-weight: 650; font-variant-numeric: tabular-nums; outline: none; }
.mc-cel:hover, .mc-cel:focus-visible { box-shadow: 0 0 0 2px var(--text); }
/* Foco do teclado nos gráficos: contorno azul visível nos dois temas (antes o fundo
   mudava de --surface para --surface-2, contraste de 1,05, e sumia no escuro). */
.viz-svg .col:focus-visible, .vb-linha:focus-visible, .vb-seg:focus-visible, .vs-bloco:focus-visible, .mc-cel:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}
.dv-v3 { background: var(--dv-v3); color: #fff; }
.dv-v2 { background: var(--dv-v2); color: #fff; }
.dv-v1 { background: var(--dv-v1); color: #0b0b0b; }
.dv-0 { background: var(--dv-0); color: var(--text); }
.dv-a1 { background: var(--dv-a1); color: #0b0b0b; }
.dv-a2 { background: var(--dv-a2); color: #fff; }
.dv-vazio { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.mc-legenda i { width: 14px; height: 10px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dv-v1, :root:not([data-theme="light"]) .dv-a1 { color: #fff; } }
:root[data-theme="dark"] .dv-v1, :root[data-theme="dark"] .dv-a1 { color: #fff; }

/* ---------- medidor ---------- */
.vm { position: relative; height: 8px; border-radius: 99px; }
.vm > span { display: block; height: 100%; border-radius: 99px; transform-origin: left; animation: vizEstica .8s cubic-bezier(.2, .8, .2, 1) backwards; }
.vm-bom { background: color-mix(in srgb, var(--st-bom) 16%, var(--surface)); } .vm-bom > span { background: var(--st-bom); }
.vm-atencao { background: color-mix(in srgb, var(--st-atencao) 22%, var(--surface)); } .vm-atencao > span { background: var(--st-atencao); }
.vm-critico { background: color-mix(in srgb, var(--st-critico) 16%, var(--surface)); } .vm-critico > span { background: var(--st-critico); }
.vm-neutro { background: color-mix(in srgb, var(--s1) 14%, var(--surface)); } .vm-neutro > span { background: var(--s1); }
.vm-meta { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; }

/* ---------- dica (tooltip) ---------- */
.viz-dica { position: fixed; z-index: 1000; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); border-radius: 10px; padding: 8px 11px; font-size: 12.5px; min-width: 130px; max-width: 290px;
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.viz-dica.on { opacity: 1; transform: none; }
.viz-dica .t { color: var(--text-3); font-size: 11.5px; margin-bottom: 4px; }
.viz-dica .r { display: flex; align-items: center; gap: 8px; line-height: 1.6; }
.viz-dica .r i { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.viz-dica .r b { font-variant-numeric: tabular-nums; }
.viz-dica .r span { color: var(--text-2); }

/* ---------- páginas de análise ---------- */
.an-topo { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.an-topo h1 { font-size: 26px; }
.an-topo .sub { color: var(--text-3); margin-top: 4px; max-width: 72ch; }
.an-abas { margin-bottom: 16px; padding: 0; }
.an-abas a { display: inline-flex; align-items: center; gap: 7px; }
.an-abas .icon { width: 16px; height: 16px; }
.an-filtros { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 18px; }
.an-filtros select { width: auto; min-width: 170px; }
.an-nota { font-size: 12.5px; color: var(--text-3); }

.an-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 14px; margin-bottom: 18px; }
.an-tile { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: 15px 16px 14px; display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; min-width: 0; }
a.an-tile:hover { border-color: var(--border-strong); text-decoration: none; box-shadow: var(--shadow); }
.an-tile .cab { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; }
.an-tile .rot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.an-tile .rot .icon { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.an-tile .val { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: normal; }
.an-tile .val small { font-size: 15px; font-weight: 600; color: var(--text-3); margin-left: 3px; letter-spacing: 0; }
.an-tile .linha-base { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; }
.an-tile .ctx { font-size: 12px; color: var(--text-3); }
.an-tile .vm { margin: 4px 0 2px; }
.an-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 650; padding: 1px 7px; border-radius: 99px; white-space: nowrap; }
.an-delta .icon { width: 13px; height: 13px; }
.an-delta.bom { background: var(--green-soft); color: var(--green-text); }
.an-delta.ruim { background: var(--red-soft); color: var(--red-text); }
.an-delta.neutro { background: var(--gray-soft); color: var(--gray-text); }
.an-tile.hero { grid-column: span 2; background: linear-gradient(135deg, var(--surface) 55%, color-mix(in srgb, var(--s1) 8%, var(--surface))); }
.an-tile.hero .val { font-size: 54px; }
.an-tile .st-ico { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; color: var(--text-2); white-space: nowrap; }
.an-tiles.com-hero { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.an-tiles.com-hero .hero { grid-row: span 2; justify-content: space-between; }
.an-tile.hero .linha-base { margin-top: 0; }
.an-tile .st-ico .icon { width: 15px; height: 15px; }
.icon.st-critico { color: var(--st-critico); }
.icon.st-atencao { color: #c98500; }
.icon.st-bom { color: var(--st-bom); }
.icon.st-info { color: var(--s1); }

.an-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.an-grade > .largo { grid-column: 1 / -1; }
.an-grade + .an-grade { margin-top: 16px; }
.an-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.an-card-head { padding: 16px 18px 6px; display: flex; justify-content: space-between; align-items: flex-start; gap: 6px 14px; flex-wrap: wrap; }
.an-card-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.an-card-head h2 .icon { width: 17px; height: 17px; color: var(--text-3); }
.an-card-head .serve { font-size: 13px; color: var(--text-2); margin-top: 4px; max-width: 74ch; }
.an-card-head .viz-legenda { margin-top: 2px; }
.an-card-body { padding: 12px 18px 16px; }
.an-card-flush .an-card-body { padding: 0; }
.an-card-foot { display: flex; flex-direction: column; gap: 2px; padding: 8px 18px 10px; border-top: 1px solid var(--border); }
.an-card-foot summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2); list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 3px 0; }
.an-card-foot summary::-webkit-details-marker { display: none; }
.an-card-foot summary:hover { color: var(--text); }
.an-card-foot summary .icon { width: 14px; height: 14px; color: var(--text-3); transition: transform .15s; }
.an-card-foot details[open] summary .seta { transform: rotate(90deg); }
.an-card-foot .explica { font-size: 13px; color: var(--text-2); padding: 4px 0 8px 20px; display: grid; gap: 6px; max-width: 80ch; }
.an-card-foot .explica b { color: var(--text); }
.an-card-foot .tabela-num { margin: 6px 0 6px; max-height: 340px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.an-card-foot .tabela-num table { font-size: 12.5px; }
.an-vazio { padding: 26px 8px; text-align: center; color: var(--text-3); font-size: 13px; }
.an-vazio .icon { width: 28px; height: 28px; color: var(--border-strong); display: block; margin: 0 auto 8px; }

.acoes { list-style: none; margin: 0; padding: 0; }
.acoes li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 13px 18px; border-top: 1px solid var(--border); }
.acoes li:first-child { border-top: 0; }
.acoes .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); }
.acoes .ico .icon { width: 18px; height: 18px; }
.acoes .nivel { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.acoes .tit { font-weight: 650; margin: 1px 0 2px; }
.acoes .txt { font-size: 13px; color: var(--text-2); }
.acoes li.st-critico .ico { background: color-mix(in srgb, var(--st-critico) 13%, var(--surface)); }
.acoes li.st-atencao .ico { background: color-mix(in srgb, var(--st-atencao) 20%, var(--surface)); }
.acoes li.st-bom .ico { background: color-mix(in srgb, var(--st-bom) 13%, var(--surface)); }
.acoes li.st-info .ico { background: color-mix(in srgb, var(--s1) 12%, var(--surface)); }
.acoes-compacta li { padding: 11px 18px; }

@media (max-width: 1180px) {
  .an-tiles.com-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-tiles.com-hero .hero { grid-row: auto; }
}
@media (max-width: 960px) {
  .an-grade { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .an-tiles.com-hero { grid-template-columns: minmax(0, 1fr); }
  .an-tile.hero { grid-column: auto; }
}
@media (max-width: 720px) {
  .vb-linha { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nome valor" "trilho trilho"; row-gap: 6px; }
  .vb-nome { grid-area: nome; } .vb-valor { grid-area: valor; } .vb-trilho { grid-area: trilho; }
  .an-tile.hero .val { font-size: 44px; }
  .acoes li { grid-template-columns: 34px minmax(0, 1fr); }
  .acoes li > .btn { grid-column: 2; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  .viz-svg, .viz-svg .marca, .vb-barra, .vb-pilha, .vs-bloco, .vm > span { animation: none !important; }
}
@media print {
  .an-filtros, .an-abas, .an-card-foot summary { display: none !important; }
  .an-card { break-inside: avoid; box-shadow: none; }
}

/* menu de períodos da apresentação de resultados (tela de evolução do técnico) */
.menu-apresentacao { position: relative; }
.menu-apresentacao > summary { list-style: none; cursor: pointer; }
.menu-apresentacao > summary::-webkit-details-marker { display: none; }
.menu-apresentacao-lista { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 270px; padding: 12px; display: grid; gap: 6px; }
.menu-apresentacao-lista p { margin: 0 0 4px; }
