
/* ============================================================
   TOKENS — light is the base; dark redefines tokens only.
   ============================================================ */
:root {
  color-scheme: light;

  --plane:       #F6F4FA;
  --surface:     #FFFFFF;
  --surface-2:   #FBFAFD;
  --surface-3:   #F1EDF8;

  --ink:         #171325;
  --ink-2:       #55516B;
  --ink-3:       #837E9B;

  --line:        #E8E3F2;
  --rule:        #D9D3E7;

  --brand:       #9349DE;
  --brand-ink:   #6B27B0;
  --brand-soft:  #EEE6FF;
  --brand-soft-2:#D6C1EB;

  --s1: #4a3aa7;  --s2: #eb6834;  --s3: #2a78d6;
  --s4: #1baf7a;  --s5: #eda100;  --s6: #e87ba4;

  --good:     #0ca30c;
  --warning:  #fab219;
  --serious:  #ec835a;
  --critical: #d03b3b;
  --good-ink:     #0a7d0a;
  --warning-ink:  #8a5c00;
  --critical-ink: #b32a2a;

  --shadow: 0 1px 2px rgba(23,19,37,.05), 0 8px 24px -12px rgba(23,19,37,.14);
  --shadow-lift: 0 2px 4px rgba(23,19,37,.06), 0 16px 40px -16px rgba(23,19,37,.22);

  --r-card: 14px;
  --r-ctl: 9px;

  --step--1: .75rem;
  --step-0:  .875rem;
  --step-1:  1rem;
  --step-2:  1.25rem;
  --step-3:  1.6rem;
  --step-4:  2.1rem;
  --step-5:  3rem;

  --rail: 244px;
  --topbar: 66px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane:       #0E0C14;
    --surface:     #17141F;
    --surface-2:   #1C1826;
    --surface-3:   #221D2E;

    --ink:         #F4F1FA;
    --ink-2:       #B6B0C9;
    --ink-3:       #8B85A1;

    --line:        #2A2436;
    --rule:        #3A3350;

    --brand:       #B375F0;
    --brand-ink:   #C79BF5;
    --brand-soft:  #241B37;
    --brand-soft-2:#3A2C56;

    --s1: #9085e9;  --s2: #d95926;  --s3: #3987e5;
    --s4: #199e70;  --s5: #c98500;  --s6: #d55181;

    --good-ink:     #4cc44c;
    --warning-ink:  #fab219;
    --critical-ink: #ef6a6a;

    --shadow: 0 1px 2px rgba(0,0,0,.5), 0 8px 24px -12px rgba(0,0,0,.7);
    --shadow-lift: 0 2px 4px rgba(0,0,0,.55), 0 16px 40px -16px rgba(0,0,0,.8);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:       #0E0C14;
  --surface:     #17141F;
  --surface-2:   #1C1826;
  --surface-3:   #221D2E;

  --ink:         #F4F1FA;
  --ink-2:       #B6B0C9;
  --ink-3:       #8B85A1;

  --line:        #2A2436;
  --rule:        #3A3350;

  --brand:       #B375F0;
  --brand-ink:   #C79BF5;
  --brand-soft:  #241B37;
  --brand-soft-2:#3A2C56;

  --s1: #9085e9;  --s2: #d95926;  --s3: #3987e5;
  --s4: #199e70;  --s5: #c98500;  --s6: #d55181;

  --good-ink:     #4cc44c;
  --warning-ink:  #fab219;
  --critical-ink: #ef6a6a;

  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 8px 24px -12px rgba(0,0,0,.7);
  --shadow-lift: 0 2px 4px rgba(0,0,0,.55), 0 16px 40px -16px rgba(0,0,0,.8);
}

/* ============================================================
   BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--step-0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: "Familjen Grotesk", "Familjen Grotesk Fallback", ui-sans-serif, system-ui, sans-serif;
  margin: 0;
  text-wrap: balance;
  letter-spacing: -.015em;
  font-weight: 600;
}

.mono, .num {
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}

a { color: var(--brand-ink); }

:where(button, select, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============================================================
   SHELL
   ============================================================ */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }

/* --- left rail --- */
.rail {
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 0 24px;
  scrollbar-width: thin;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 18px 18px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(145deg, var(--brand) 0%, #6B27B0 100%);
  display: grid; place-items: center;
  color: #fff; font-family: "Familjen Grotesk", sans-serif; font-weight: 700; font-size: .95rem;
  box-shadow: 0 2px 8px -2px rgba(147,73,222,.6);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-txt b { font-family: "Familjen Grotesk", sans-serif; font-size: .9rem; font-weight: 600; letter-spacing: -.01em; }
.brand-txt span { font-size: .68rem; color: var(--ink-3); }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.nav-group { padding: 14px 8px 5px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; text-align: left;
  padding: 7px 10px; border: 0; border-radius: var(--r-ctl);
  background: transparent; color: var(--ink-2);
  font: inherit; font-size: .8125rem; cursor: pointer;
  transition: background .13s ease, color .13s ease;
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--rule); transition: background .13s; }
.nav-item[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav-item[aria-current="page"] .dot { background: var(--brand); }

.rail-foot { margin-top: auto; padding: 16px 18px 0; font-size: .68rem; color: var(--ink-3); line-height: 1.45; }

/* --- top bar --- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px;
  min-height: var(--topbar);
  padding: 12px 26px;
  background: color-mix(in srgb, var(--plane) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.crumb { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.crumb .grp { font-size: .75rem; color: var(--ink-3); }
.crumb h1 { font-size: var(--step-2); }

.slicers { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.slicer { display: flex; align-items: center; gap: 6px; }
.slicer > label { font-size: .7rem; color: var(--ink-3); font-family: "IBM Plex Mono", monospace; letter-spacing: .04em; }
select, .btn {
  font: inherit; font-size: .78rem;
  padding: 6px 10px;
  border: 1px solid var(--rule); border-radius: var(--r-ctl);
  background: var(--surface); color: var(--ink);
  cursor: pointer;
}
select:hover, .btn:hover { border-color: var(--brand); }
.btn.pressed { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }

/* --- page canvas --- */
.canvas { padding: 22px 26px 64px; display: flex; flex-direction: column; gap: 18px; }
.page { display: flex; flex-direction: column; gap: 18px; }
.page[hidden] { display: none; }

.note {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 15px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-soft-2);
  border-radius: var(--r-card);
  font-size: .8125rem; color: var(--ink-2);
  line-height: 1.5;
}
.note b { color: var(--brand-ink); font-weight: 600; }
.note .ico { flex: none; color: var(--brand-ink); margin-top: 1px; }
.note code {
  font-family: "IBM Plex Mono", monospace; font-size: .78rem;
  background: var(--surface); border: 1px solid var(--brand-soft-2);
  padding: 1px 5px; border-radius: 5px; color: var(--ink);
}

/* ============================================================
   KPI TILES
   ============================================================ */
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(214px, 1fr)); }

.tile {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 14px 16px 10px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.tile::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--tile-accent, var(--brand));
}
.tile .t-label { font-size: .72rem; color: var(--ink-2); font-weight: 500; letter-spacing: .005em; }
.tile .t-val {
  font-family: "Familjen Grotesk", sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: var(--step-3); font-weight: 600; line-height: 1.12; letter-spacing: -.02em;
  margin-top: 3px;
}
.tile .t-sub { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: .7rem; color: var(--ink-3); }
.tile .spark { margin-top: 6px; height: 30px; }

/* O tile é um link para a página do indicador — sublinhado e cor de link
   destruiriam o cartão, então só o cursor e o realce denunciam isso. */
a.tile { text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
a.tile:hover { box-shadow: var(--shadow-lg, var(--shadow)); transform: translateY(-1px); }
a.tile:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* nota de rodapé do gráfico (escala forçada, recorte, ressalva) */
.foot { margin-top: 8px; font-size: .7rem; color: var(--ink-3); }

.delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums;
  font-size: .7rem; font-weight: 600;
  padding: 1px 5px 1px 4px; border-radius: 5px;
}
.delta.up   { color: var(--good-ink);     background: color-mix(in srgb, var(--good) 13%, transparent); }
.delta.down { color: var(--critical-ink); background: color-mix(in srgb, var(--critical) 13%, transparent); }
.delta.flat { color: var(--ink-2);        background: var(--surface-3); }

/* ============================================================
   CARDS & GRID  (mirrors the report's 768/471 two-column split)
   ============================================================ */
.grid { display: grid; gap: 14px; }
.g-2-1 { grid-template-columns: minmax(0, 1.63fr) minmax(0, 1fr); }
.g-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-full { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1120px) { .g-2-1, .g-1-1 { grid-template-columns: minmax(0, 1fr); } }

.card {
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 15px 17px 12px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0;
}
.card-head { display: flex; align-items: flex-start; gap: 12px; }
.card-head .ttl { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-head h3 { font-size: .95rem; }
.card-head .sub { font-size: .72rem; color: var(--ink-3); }
.card-tools { margin-left: auto; display: flex; gap: 6px; flex: none; }
.tool {
  border: 1px solid transparent; background: transparent;
  color: var(--ink-3); font: inherit; font-size: .68rem;
  font-family: "IBM Plex Mono", monospace; letter-spacing: .04em;
  padding: 3px 7px; border-radius: 6px; cursor: pointer;
}
.tool:hover { background: var(--surface-3); color: var(--ink); }
.tool[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); border-color: var(--brand-soft-2); }

/* legend — always present for >= 2 series */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.legend .li { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--ink-2); }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend .sw.ln { height: 3px; border-radius: 2px; width: 15px; }
.legend .sw.dsh {
  height: 0; width: 15px; border-radius: 0;
  border-top: 2px dashed currentColor; background: none;
}

.plot { position: relative; width: 100%; }
.plot svg { display: block; width: 100%; height: auto; overflow: visible; }

/* chart ink */
.gridline { stroke: var(--line); stroke-width: 1; }
.baseline { stroke: var(--rule); stroke-width: 1; }
.axis-lbl { fill: var(--ink-3); font-family: "IBM Plex Mono", monospace; font-size: 9.5px; }
.dlabel  { fill: var(--ink-2); font-family: "IBM Plex Mono", monospace; font-size: 9.5px; font-weight: 500; }
.zeroline { stroke: var(--rule); stroke-width: 1.25; }
.band-lbl { fill: var(--ink-3); font-family: "IBM Plex Mono", monospace; font-size: 9px; }

.mark { transition: opacity .1s ease; }
.plot.dim .mark { opacity: .42; }
.plot.dim .mark.hot { opacity: 1; }
.mark-ring { stroke: var(--surface); stroke-width: 2; }

/* tooltip */
.tip {
  position: absolute; z-index: 30; pointer-events: none;
  min-width: 132px; max-width: 268px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: var(--shadow-lift);
  padding: 8px 10px; font-size: .74rem;
  opacity: 0; transform: translate(-50%, -100%);
  transition: opacity .09s ease;
}
.tip.on { opacity: 1; }
.tip .tt { font-weight: 600; font-size: .72rem; margin-bottom: 5px; color: var(--ink); }
.tip .tr { display: flex; align-items: center; gap: 7px; margin-top: 2px; }
.tip .tr .sw { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.tip .tr .nm { color: var(--ink-2); }
.tip .tr .vl { margin-left: auto; font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; font-weight: 600; }
.crosshair { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 3 3; }

/* ============================================================
   TABLES (matrix / table view)
   ============================================================ */
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
table { border-collapse: collapse; width: 100%; font-size: .75rem; }
th, td {
  padding: 6px 11px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-3); color: var(--ink-2);
  font-family: "IBM Plex Mono", monospace; font-size: .68rem; font-weight: 500;
  letter-spacing: .04em; text-transform: uppercase;
}
th:first-child, td:first-child { text-align: left; }
td { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; color: var(--ink); }
td:first-child { font-family: "IBM Plex Sans", sans-serif; color: var(--ink-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-3); }
tfoot td { font-weight: 600; background: var(--surface-3); border-top: 1px solid var(--rule); }
.pos { color: var(--good-ink); }
.neg { color: var(--critical-ink); }

/* ============================================================
   STATUS CHIPS — hue never carries meaning alone; label always shown
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: "IBM Plex Mono", monospace; font-size: .68rem; font-weight: 600;
  padding: 2px 8px 2px 6px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.chip .gl { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chip.excelente { color: var(--good-ink);     background: color-mix(in srgb, var(--good) 15%, transparent);     border-color: color-mix(in srgb, var(--good) 34%, transparent); }
.chip.excelente .gl { background: var(--good); }
.chip.saudavel  { color: var(--good-ink);     background: color-mix(in srgb, var(--good) 7%, transparent);      border-color: color-mix(in srgb, var(--good) 26%, transparent); }
.chip.saudavel .gl  { background: var(--good); box-shadow: inset 0 0 0 1.6px var(--surface); }
.chip.aceitavel { color: var(--warning-ink);  background: color-mix(in srgb, var(--warning) 12%, transparent);  border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.chip.aceitavel .gl { background: var(--warning); box-shadow: inset 0 0 0 1.6px var(--surface); }
.chip.alerta    { color: var(--warning-ink);  background: color-mix(in srgb, var(--warning) 20%, transparent);  border-color: color-mix(in srgb, var(--warning) 40%, transparent); }
.chip.alerta .gl    { background: var(--warning); }
.chip.critico   { color: var(--critical-ink); background: color-mix(in srgb, var(--critical) 14%, transparent); border-color: color-mix(in srgb, var(--critical) 34%, transparent); }
.chip.critico .gl   { background: var(--critical); }

/* scorecard rows for Unit Economics */
.ue-row {
  display: grid; grid-template-columns: minmax(150px, 1.05fr) minmax(0, 2.6fr) auto;
  gap: 14px; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.ue-row:last-child { border-bottom: 0; }
.ue-row .nm { display: flex; flex-direction: column; gap: 2px; }
.ue-row .nm b { font-size: .8125rem; font-weight: 600; }
.ue-row .nm span { font-size: .68rem; color: var(--ink-3); font-family: "IBM Plex Mono", monospace; }
.ue-row .val { display: flex; align-items: baseline; gap: 8px; justify-content: flex-end; }
.ue-row .val .n {
  font-family: "Familjen Grotesk", sans-serif; font-variant-numeric: tabular-nums;
  font-size: 1.22rem; font-weight: 600;
}
.ue-track { position: relative; height: 26px; }
.ue-bands {
  position: absolute; inset: 6px 0;
  display: flex; gap: 2px;
  border-radius: 5px; overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--rule);
}
.bd.g  { background: color-mix(in srgb, var(--good) 46%, transparent); }
.bd.gs { background: color-mix(in srgb, var(--good) 21%, transparent); }
.bd.w  { background: color-mix(in srgb, var(--warning) 48%, transparent); }
.bd.c  { background: color-mix(in srgb, var(--critical) 44%, transparent); }
.ue-pin {
  position: absolute; top: 0; bottom: 0; width: 3px;
  border-radius: 2px; background: var(--ink);
  box-shadow: 0 0 0 1.5px var(--surface);
}
@media (max-width: 860px) {
  .ue-row { grid-template-columns: minmax(0,1fr) auto; }
  .ue-track { grid-column: 1 / -1; }
}

/* formula callout */
.formula {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  padding: 11px 15px; border-radius: var(--r-card);
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: .76rem; color: var(--ink-2);
}
.formula .f { display: flex; gap: 7px; align-items: baseline; }
.formula .f b { color: var(--ink); font-weight: 600; }
.formula code { font-family: "IBM Plex Mono", monospace; font-size: .73rem; color: var(--brand-ink); }

/* mini section heading between chart rows */
.sec { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.sec h2 { font-size: .82rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); font-weight: 600; font-family: "IBM Plex Mono", monospace; }
.sec .ln { flex: 1; height: 1px; background: var(--line); }

/* hero (Visão Geral) */
.hero {
  position: relative; overflow: hidden;
  border-radius: 18px; padding: 26px 28px;
  background:
    radial-gradient(120% 150% at 100% 0%, color-mix(in srgb, var(--brand) 30%, transparent) 0%, transparent 58%),
    linear-gradient(135deg, #2A1147 0%, #4A1D7A 46%, #6B27B0 100%);
  color: #fff;
  box-shadow: var(--shadow-lift);
}
.hero h2 { font-size: var(--step-4); color: #fff; max-width: 22ch; }
.hero p { margin: 8px 0 0; font-size: .875rem; color: rgba(255,255,255,.82); max-width: 60ch; }
.hero .hero-grid { display: grid; gap: 22px 34px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-top: 22px; }
.hero .hi .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.6); font-family: "IBM Plex Mono", monospace; }
.hero .hi .v { font-family: "Familjen Grotesk", sans-serif; font-size: var(--step-3); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin-top: 2px; }
.hero .hi .d { font-size: .7rem; color: rgba(255,255,255,.66); font-family: "IBM Plex Mono", monospace; }
.hero .stamp {
  position: absolute; top: 20px; right: 24px;
  font-family: "IBM Plex Mono", monospace; font-size: .66rem; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 3px 10px;
}
@media (max-width: 700px) { .hero { padding: 20px; } .hero .stamp { position: static; display: inline-block; margin-bottom: 12px; } }

/* mobile rail */
.railToggle { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; inset: 0 auto 0 0; width: 258px; z-index: 60;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow-lift);
  }
  .rail.open { transform: none; }
  .railToggle { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; padding: 0; }
  .canvas { padding: 16px 14px 56px; }
  .topbar { padding: 10px 14px; }
  .crumb h1 { font-size: var(--step-1); }
}

/* ============================================================
   ACRÉSCIMOS DESTA APLICAÇÃO
   O CSS acima vem do protótipo publicado como artifact e define o
   sistema visual. Aqui só o que o protótipo não tinha: login, controle
   de acesso, filtro por mês e as abas de dimensão da composição.
   ============================================================ */

/* --- login --- */
body.entrada { display: grid; place-items: center; min-height: 100vh; background: var(--plane); }
.caixa-login { width: 100%; max-width: 390px; padding: 0 20px; }
.caixa-login .card { padding: 32px; gap: 4px; }
.caixa-login .brand { padding: 0 0 14px; }

label.campo { display: block; margin: 14px 0 0; }
label.campo > span { display: block; font-size: .78rem; font-weight: 600; margin-bottom: 5px; color: var(--ink-2); }
input[type=text], input[type=password] {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  font: inherit; background: var(--surface-2); color: var(--ink);
}
input:focus { outline: 2px solid var(--brand-soft-2); border-color: var(--brand); }

.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: #fff; border: 0;
  padding: 11px 20px; border-radius: var(--r-ctl);
  font: inherit; font-weight: 600; cursor: pointer; width: 100%;
  margin-top: 18px;
}
.botao:hover { background: var(--brand-ink); }

/* --- filtros da tabela salarial --- */

.filtros-regua {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}
.filtros-regua label { display: flex; flex-direction: column; gap: 4px; }
.filtros-regua label span {
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 600;
  letter-spacing: .02em;
}
.filtros-regua select,
.filtros-regua input[type=search] {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  min-width: 150px;
  font-family: inherit;
}
.filtros-regua select:focus,
.filtros-regua input[type=search]:focus {
  outline: none;
  border-color: var(--brand-soft-2);
}
.filtros-acoes { display: flex; align-items: center; gap: 10px; }
.filtros-regua button {
  padding: 7px 16px;
  border: 1px solid var(--brand-soft-2);
  border-radius: var(--r-ctl);
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.filtros-regua .limpar { font-size: 12.5px; color: var(--ink-3); }

/* O resumo do recorte ocupa a linha inteira, abaixo dos controles: e o que
   responde "o que estou vendo" sem ter que reler cada campo. */
.filtros-resumo { flex-basis: 100%; margin: 2px 0 0; }

/* --- seletor de dimensão da régua salarial --- */

/* Link, não botão: cada dimensão é um endereço. Assim a escolha sobrevive ao
   recarregar e pode ser mandada por mensagem para outra pessoa. */
.seletor-dim { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.seletor-dim a {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  font-size: 12.5px;
  color: var(--ink-2);
  text-decoration: none;
  background: var(--surface);
}
.seletor-dim a:hover { border-color: var(--rule); }
.seletor-dim a.ativo {
  background: var(--brand-soft);
  border-color: var(--brand-soft-2);
  color: var(--brand-ink);
  font-weight: 600;
}

/* A régua tem sete colunas de valor: apertar a fonte deixa a linha inteira
   visível sem rolagem lateral, que é o que permite comparar os níveis. */
table.regua { font-size: 12.5px; }
table.regua td.num { font-variant-numeric: tabular-nums; }

/* --- de quando é o dado --- */

/* A faixa de erro fica ACIMA do conteúdo, colada no cabeçalho: quem abre o
   painel precisa saber que uma fonte falhou ANTES de ler o número, não depois. */
.faixa-carga { margin: 14px 26px 0; }
.faixa-carga ul { margin: 8px 0 0; padding-left: 20px; font-size: 12.5px; }
.faixa-carga li { margin: 2px 0; }

/* A data fica no rodapé, discreta. É contexto, não alerta — só precisa estar
   ao alcance de quem for perguntar "de quando é isso?". */
.carga-rodape {
  padding: 0 26px 22px;
  margin-top: -8px;
  font-size: 12px;
  color: var(--ink-3);
}
.carga-rodape .ruim { color: var(--critical-ink); font-weight: 600; }

@media (max-width: 720px) {
  .faixa-carga { margin: 12px 14px 0; }
  .carga-rodape { padding: 0 14px 18px; }
}

/* --- avisos --- */
.aviso {
  padding: 11px 15px; border-radius: var(--r-ctl);
  border-left: 3px solid var(--warning);
  background: color-mix(in srgb, var(--warning) 9%, var(--surface));
  font-size: .82rem; color: var(--ink-2);
}
.aviso.ruim { border-left-color: var(--critical); background: color-mix(in srgb, var(--critical) 9%, var(--surface)); }
.aviso.bom  { border-left-color: var(--good);     background: color-mix(in srgb, var(--good) 9%, var(--surface)); }

/* --- faixa de filtro por mês --- */
.filtro-mes {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--brand-soft); border: 1px solid var(--brand-soft-2);
  border-radius: var(--r-ctl); padding: 9px 15px;
  font-size: .82rem; color: var(--ink-2);
}
.filtro-mes a { color: var(--brand-ink); font-weight: 600; }

/* --- abas de dimensão da composição --- */
.abas-dim { display: flex; gap: 5px; flex-wrap: wrap; }
.abas-dim a {
  font-family: "IBM Plex Mono", monospace; font-size: .68rem; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 6px; text-decoration: none;
  color: var(--ink-3); border: 1px solid transparent;
}
.abas-dim a:hover { background: var(--surface-3); color: var(--ink); }
.abas-dim a.ativo { background: var(--brand-soft); color: var(--brand-ink); border-color: var(--brand-soft-2); }

/* --- quem está logado, no topo --- */
.quem { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .76rem; color: var(--ink-3); }
.quem a { color: var(--ink-2); }

/* --- tabela --- */
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
th {
  text-align: left; font-family: "IBM Plex Mono", monospace;
  font-size: .66rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500;
  padding: 7px 9px; border-bottom: 1px solid var(--line);
}
td { padding: 7px 9px; border-bottom: 1px solid var(--surface-3); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--surface-2); }
.tabela-rolavel { overflow-x: auto; }
.linha-foco { background: var(--brand-soft) !important; }

/* --- dica do gráfico --- */
.dica-grafico {
  position: fixed; z-index: 999; display: none;
  background: var(--ink); color: var(--plane);
  padding: 9px 12px; border-radius: 9px;
  font-size: .78rem; line-height: 1.5; pointer-events: none;
  box-shadow: var(--shadow-lift); max-width: 300px;
}
.dica-grafico b { font-weight: 600; }
.mark { cursor: pointer; }
.mark:hover { opacity: 1 !important; filter: brightness(1.08); }

/* O protótipo usava <button> na navegação; aqui são links, que vêm
   sublinhados por padrão. */
.nav-item { text-decoration: none; }
.rail-foot { margin-top: auto; padding: 16px 18px 0; }

/* ---------------------------------------------------------------------------
   Botão e popover de procedência
   --------------------------------------------------------------------------- */
.info {
  width: 17px; height: 17px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 8px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--ink-3);
  font-family: "IBM Plex Mono", monospace; font-size: .62rem; font-weight: 700;
  line-height: 1; cursor: pointer; vertical-align: middle;
  transition: color .12s, border-color .12s, background .12s;
}
.info:hover { color: var(--brand); border-color: var(--brand); }
.info:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h1 .info { transform: translateY(-2px); }

.dica-info {
  position: fixed; z-index: 200;
  width: min(460px, calc(100vw - 24px));
  max-height: min(70vh, 620px); overflow-y: auto;
  padding: 14px 16px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px -8px rgba(20, 12, 40, .28), 0 2px 8px rgba(20, 12, 40, .12);
  font-size: .8rem; line-height: 1.5;
}
.dica-info .verbete + .verbete {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
}
.dica-info .v-titulo {
  font-family: "Familjen Grotesk", sans-serif;
  font-size: .95rem; font-weight: 600; margin-bottom: 8px;
}
.dica-info dl {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0;
}
.dica-info dt {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-3); font-family: "IBM Plex Mono", monospace;
  font-weight: 600; padding-top: 2px; white-space: nowrap;
}
.dica-info dd { margin: 0; color: var(--ink-2); }
.dica-info dd.mono {
  font-family: "IBM Plex Mono", monospace; font-size: .68rem;
  color: var(--ink-3); word-break: break-word;
}
.dica-info .v-nota {
  margin-top: 10px; padding: 9px 11px; border-radius: 8px;
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 26%, transparent);
  color: var(--ink-2); font-size: .76rem;
}
.dica-info .v-nota b {
  display: block; font-size: .64rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--warning-ink); margin-bottom: 3px;
  font-family: "IBM Plex Mono", monospace;
}

/* ---------------------------------------------------------------------------
   Filtros de ano e mês, multisseleção
   --------------------------------------------------------------------------- */
.slicers { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.slicer { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.slicer label {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-3); font-family: "IBM Plex Mono", monospace;
  font-weight: 600; margin-right: 4px;
}
.slicer .btn { padding: 3px 8px; font-size: .7rem; }
.btn.limpar { color: var(--critical-ink); border-color: transparent; }
.btn.limpar:hover { border-color: color-mix(in srgb, var(--critical) 40%, transparent); }

/* Um cartão que ocupa a linha inteira dentro da grade de dois */
.grid .card.largo { grid-column: 1 / -1; }

/* ---------------------------------------------------------------------------
   Matriz de dimensão por mês
   --------------------------------------------------------------------------- */
table.matriz { font-size: .76rem; }
table.matriz th, table.matriz td { white-space: nowrap; }
table.matriz thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface);
}
table.matriz tbody td:first-child,
table.matriz tfoot td:first-child,
table.matriz thead th:first-child {
  position: sticky; left: 0; z-index: 1;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}
table.matriz thead th:first-child { z-index: 3; }
table.matriz .total {
  background: color-mix(in srgb, var(--brand) 5%, transparent);
  font-variant-numeric: tabular-nums;
}
table.matriz tfoot td {
  border-top: 2px solid var(--line);
  background: color-mix(in srgb, var(--brand) 3%, transparent);
}

/* Rosca e legenda lado a lado */
.rosca-caixa { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
/* A rosca é quadrada e tem tamanho próprio. Sem isto a regra geral de .plot
   estica o SVG até a largura do cartão, e a legenda ao lado perde o espaço. */
.plot .rosca-caixa > svg { width: auto; max-width: 100%; }
.rosca-caixa .legend.vertical {
  flex: 1 1 200px; display: grid; gap: 5px 14px; margin-top: 0;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

/* ---------------------------------------------------------------------------
   Filtro de período
   --------------------------------------------------------------------------- */
.periodo { display: flex; align-items: center; gap: 7px; }
.periodo label {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-3); font-family: "IBM Plex Mono", monospace; font-weight: 600;
}
.periodo .ate { font-size: .7rem; color: var(--ink-3); }
.periodo input[type="month"] {
  padding: 3px 7px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--ink);
  font-family: "IBM Plex Mono", monospace; font-size: .72rem;
  font-variant-numeric: tabular-nums;
}
.periodo input[type="month"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.atalhos { display: flex; gap: 4px; }
.atalhos .btn { padding: 3px 9px; font-size: .7rem; }

/* Categoria selecionada e não selecionada, na legenda */
.legend .li.on { font-weight: 600; }
.legend .li.off { opacity: .38; }

/* O que o gráfico mostra, acima da procedência da medida */
.dica-info .v-explica {
  margin-bottom: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2); font-size: .8rem; line-height: 1.55;
}
.dica-info .v-explica b { color: var(--ink); font-weight: 600; }
.dica-info .verbete:first-child { margin-top: 0; }

/* Mês clicável no cabeçalho da matriz */
table.matriz th.mes:hover { color: var(--brand); }
table.matriz th.mes.foco { color: var(--brand); text-decoration: underline; }

/* Coluna de texto fora da primeira posição — nome de cliente, por exemplo.
   Sem isto ela herda o alinhamento à direita que serve aos números. */
td.txt, th.txt { text-align: left; white-space: normal; }

/* ---------------------------------------------------------------------------
   Tela inicial — a escolha de qual painel abrir
   --------------------------------------------------------------------------- */
body.tela-inicial { background: var(--bg); min-height: 100vh; }
.topo-inicial {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 26px; border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topo-inicial .quem { margin-left: auto; }
.canvas-inicial { max-width: 1000px; margin: 0 auto; padding: 48px 26px 64px; }

.abertura h1 {
  font-family: "Familjen Grotesk", sans-serif;
  font-size: var(--step-4); font-weight: 600; letter-spacing: -.02em;
}
.abertura p { margin: 10px 0 0; color: var(--ink-2); max-width: 62ch; font-size: .9rem; }

.cartoes-painel {
  display: grid; gap: 18px; margin-top: 34px;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}
.cartao-painel {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px 24px 18px;
  background: var(--surface); color: inherit; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.cartao-painel::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--acento, var(--brand));
}
.cartao-painel:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--acento) 40%, var(--line));
  box-shadow: 0 12px 28px -12px rgba(20, 12, 40, .3);
}
.cartao-painel:focus-visible { outline: 2px solid var(--acento); outline-offset: 3px; }
.cp-marca {
  width: 38px; height: 38px; border-radius: 10px; margin-bottom: 4px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--acento) 14%, transparent);
  color: var(--acento);
  font-family: "Familjen Grotesk", sans-serif; font-size: 1.1rem; font-weight: 700;
}
.cartao-painel h2 {
  font-family: "Familjen Grotesk", sans-serif;
  font-size: 1.06rem; font-weight: 600; letter-spacing: -.01em;
}
.cartao-painel p { margin: 0; color: var(--ink-2); font-size: .82rem; line-height: 1.5; }
.cp-rodape {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  padding-top: 12px; border-top: 1px solid var(--line);
  font-family: "IBM Plex Mono", monospace; font-size: .7rem; color: var(--ink-3);
}
.cp-seta { margin-left: auto; color: var(--acento); font-weight: 600; }
.nota-inicial {
  margin-top: 30px; color: var(--ink-3); font-size: .76rem; max-width: 68ch;
  line-height: 1.6;
}

/* A marca da barra lateral vira o caminho de volta para a escolha */
a.brand { text-decoration: none; color: inherit; border-radius: 10px; }
a.brand:hover .brand-txt span { color: var(--brand); }

/* Cabeçalho de cada tabela dentro de um cartão de detalhe */
.sub-tabela {
  margin: 14px 0 8px; font-size: .74rem; color: var(--ink-3);
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.sub-tabela:first-child { margin-top: 0; }
.sub-tabela b { color: var(--ink); font-weight: 600; font-size: .8rem; }

/* ---------------------------------------------------------------------------
   Paginação de tabela
   --------------------------------------------------------------------------- */
.paginacao {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
}
.pg-conta {
  font-family: "IBM Plex Mono", monospace; font-size: .7rem; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.pg-nav { margin-left: auto; display: flex; align-items: center; gap: 3px; }
.pg-btn {
  min-width: 26px; height: 26px; padding: 0 7px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--ink-2);
  font-family: "IBM Plex Mono", monospace; font-size: .72rem;
  font-variant-numeric: tabular-nums; cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.pg-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pg-btn.pressed {
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  border-color: color-mix(in srgb, var(--brand) 38%, transparent);
  color: var(--brand); font-weight: 600;
}
.pg-btn:disabled { opacity: .32; cursor: default; }
.pg-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.pg-gap { color: var(--ink-3); font-size: .72rem; padding: 0 2px; }

/* Com dez linhas por página a tabela não rola mais sozinha, e o cabeçalho
   grudado deixa de fazer sentido. */
.tabela-rolavel { max-height: none; }


/* ---------------------------------------------------------------------------
   Plano de cargos e salários — as páginas de estrutura
   --------------------------------------------------------------------------- */

/* Dois avisos com peso diferente. O de dado restrito é vermelho porque quem
   chega por um link precisa registrar antes de rolar; o de dado vencido é
   âmbar porque não é sobre sigilo, é sobre confiar num número velho. */
.aviso-restrito,
.aviso-vencido {
  border-left: 3px solid;
  font-size: 13px;
  line-height: 1.55;
}
.aviso-restrito { border-color: #b4232a; background: #fdf3f3; }
.aviso-vencido  { border-color: #b8860b; background: #fdf9ef; }
.aviso-restrito code,
.aviso-vencido code { font-size: 12px; }

/* Os degraus da evolução de uma pessoa. Barras, não linha: salário fica parado
   e dá um pulo, e uma linha inclinada desenharia meses de aumento que não
   existiram. */
.degraus {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 210px;
  padding: 14px 2px 0;
  overflow-x: auto;
}
.degrau {
  flex: 1 0 68px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: center;
  min-width: 68px;
}
.degrau-barra {
  background: linear-gradient(180deg, #6a4fb3, #8b6fd4);
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  margin-bottom: 6px;
}
.degrau-valor { font-size: 12px; font-weight: 600; }
.degrau-data  { font-size: 11px; color: #6b7280; }
.degrau-motivo {
  font-size: 10px;
  color: #9098a6;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Os três números do enquadramento */
.enq-cartoes { display: flex; gap: 18px; flex-wrap: wrap; }
.enq-cartao {
  flex: 1 1 150px;
  padding: 14px 16px;
  border: 1px solid #e6e8ec;
  border-radius: 6px;
}
.enq-numero { font-size: 30px; font-weight: 600; line-height: 1.1; }
.enq-rotulo { font-size: 12px; color: #6b7280; margin-top: 3px; }
.enq-sim .enq-numero { color: #1f7a4d; }
.enq-nao .enq-numero { color: #b4232a; }

.marca-sim, .marca-nao {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.marca-sim { background: #e6f4ec; color: #1f7a4d; }
.marca-nao { background: #fbeaea; color: #b4232a; }

.barra-dupla {
  display: flex;
  height: 9px;
  border-radius: 5px;
  overflow: hidden;
  background: #eef0f3;
  min-width: 110px;
}
.barra-dupla .parte-sim { background: #3f9c6d; }
.barra-dupla .parte-nao { background: #d2716f; }

tr.linha-ativa { background: #f4f1fb; }

/* Tabela de sete níveis: muitas colunas estreitas de número. O cabeçalho de
   grupo separa os blocos, e a coluna de líquido é a que se procura. */
.tabela-niveis { font-size: 12px; }
.tabela-niveis th.grupo-cab {
  text-align: center;
  border-bottom: 2px solid #dfe3e8;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #6b7280;
}
.tabela-niveis td.num { white-space: nowrap; }
.tabela-niveis .destaque { font-weight: 600; background: #fafbfc; }

/* Variação para cima e para baixo. Verde e vermelho fazem o trabalho, mas o
   sinal + ou - vem junto no texto: quem não distingue as duas cores continua
   lendo a tabela. */
.sobe  { color: #1f7a4d; }
.desce { color: #b4232a; }

/* Férias: o estado do meio, entre em dia e vencido. */
.marca-atencao {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  background: #fdf3e3;
  color: #96690b;
}
