:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --border: #e3e8ec;
  --text: #0f1b24;
  --muted: #5d6b76;
  --faint: #8a96a0;
  --brand: #0f766e;
  --brand-strong: #0b5e58;
  --brand-soft: #e2f4f1;
  --side: #0c1a20;
  --side-text: #c6d3d8;
  --side-active: #16323a;
  --ok: #15803d;
  --ok-soft: #dcf5e4;
  --on-ok: #ffffff;
  --warn: #b45309;
  --warn-soft: #fdf0d8;
  --bad: #c2410c;
  --bad-soft: #fde6dc;
  --info: #1d4ed8;
  --info-soft: #e0e9fd;
  --shadow: 0 1px 2px rgba(15, 27, 36, 0.05), 0 4px 16px rgba(15, 27, 36, 0.06);
  --shadow-lg: 0 20px 60px rgba(15, 27, 36, 0.22);
  --radius: 14px;
  --radius-sm: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1418;
    --surface: #111d22;
    --surface-2: #15242a;
    --border: #22343b;
    --text: #e6eef1;
    --muted: #9db0b8;
    --faint: #6f848c;
    --brand: #2bb3a6;
    --brand-strong: #49c9bc;
    --brand-soft: #123a37;
    --side: #08100f;
    --side-text: #a9bcc2;
    --side-active: #14282c;
    --ok: #4ade80;
    --ok-soft: #10301f;
    --on-ok: #052e16;
    --warn: #fbbf24;
    --warn-soft: #362812;
    --bad: #fb923c;
    --bad-soft: #3a1d12;
    --info: #7aa2ff;
    --info-soft: #172446;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
svg.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.layout > div { min-width: 0; }
.side {
  background: var(--side);
  color: var(--side-text);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; color: #fff; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  box-shadow: 0 6px 18px rgba(20, 184, 166, 0.35);
}
.brand-logo svg { width: 20px; height: 20px; fill: #fff; stroke: none; }
.brand b { display: block; font-size: 15px; letter-spacing: 0.2px; }
.brand small { color: #7f9aa2; font-size: 12px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--side-text); text-decoration: none; font-weight: 500; font-size: 14px;
  border: 0; background: none; cursor: pointer; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav-item.ativo { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 #2dd4bf; }
.nav-item .contador {
  margin-left: auto; background: #f59e0b; color: #1c1300; font-size: 11px; font-weight: 700;
  border-radius: 99px; padding: 1px 8px;
}
.side-spacer { flex: 1; }
.me {
  display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: #1f3a40; color: #5eead4; font-weight: 700; font-size: 13px;
}
.me-info { min-width: 0; flex: 1; }
.me-info b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-info small { color: #7f9aa2; font-size: 12px; text-transform: capitalize; }
.icon-btn {
  border: 0; background: none; color: inherit; cursor: pointer; padding: 7px; border-radius: 8px; display: grid; place-items: center;
}
.icon-btn:hover { background: rgba(127, 127, 127, 0.15); }

.main { padding: 32px 40px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 26px; margin: 0; letter-spacing: -0.4px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card h2 { font-size: 16px; margin: 0 0 4px; }
.card .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background 0.15s, transform 0.05s, box-shadow 0.15s; white-space: nowrap; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(15, 118, 110, 0.28); }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-ok { background: var(--ok); color: var(--on-ok); }
.btn-bad { background: var(--surface); color: var(--bad); border-color: var(--bad-soft); }
.btn-bad:hover:not(:disabled) { background: var(--bad-soft); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }

.grid-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.stat-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat-ic svg { width: 22px; height: 22px; }
.stat b { font-size: 26px; line-height: 1.1; display: block; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.t-warn { background: var(--warn-soft); color: var(--warn); }
.t-ok { background: var(--ok-soft); color: var(--ok); }
.t-bad { background: var(--bad-soft); color: var(--bad); }
.t-info { background: var(--info-soft); color: var(--info); }
.t-brand { background: var(--brand-soft); color: var(--brand); }

.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.pendente { background: var(--warn-soft); color: var(--warn); }
.chip.aprovado { background: var(--ok-soft); color: var(--ok); }
.chip.rejeitado { background: var(--bad-soft); color: var(--bad); }

.num { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand); }
.num.vazio { color: var(--faint); font-weight: 500; }

.lista-item {
  display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.lista-item:last-child { border-bottom: 0; }
.lista-item:hover .li-title { color: var(--brand); }
.li-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-meta { font-size: 13px; color: var(--muted); }

.barras { display: flex; flex-direction: column; gap: 14px; }
.barra-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.barra-top b { font-variant-numeric: tabular-nums; }
.barra { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.barra i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #14b8a6, #0f766e); }

.vazio-box { text-align: center; padding: 48px 20px; color: var(--muted); }
.vazio-box .vazio-ic { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--brand-soft); color: var(--brand); }
.vazio-box h3 { color: var(--text); margin: 0 0 4px; font-size: 16px; }

/* ---------- Formulário ---------- */
.form-sec { padding: 22px; border-bottom: 1px solid var(--border); }
.form-sec:last-of-type { border-bottom: 0; }
.sec-title { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 14px; font-weight: 700; }
.sec-title .n { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 12px; }
.fields { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.f { grid-column: span 6; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.f.s3 { grid-column: span 3; } .f.s4 { grid-column: span 4; } .f.s8 { grid-column: span 8; } .f.s12 { grid-column: span 12; }
.f label { font-size: 13px; font-weight: 600; color: var(--muted); }
.f label em { color: var(--bad); font-style: normal; }
.input, .f input, .f select, .f textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; transition: border-color 0.15s, box-shadow 0.15s; min-height: 42px;
}
.f textarea { resize: vertical; min-height: 84px; }
.input:focus, .f input:focus, .f select:focus, .f textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.with-suffix { position: relative; }
.with-suffix input { padding-right: 46px; }
.with-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 13px; pointer-events: none; }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label {
  cursor: pointer; border: 1px solid var(--border); background: var(--surface); padding: 9px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 8px; transition: 0.15s;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 22px; background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Tabela ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; padding: 16px; border-bottom: 1px solid var(--border); align-items: center; }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { padding-left: 38px; }
.toolbar .input { width: auto; }
.tabela-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--faint); font-weight: 600; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { cursor: pointer; transition: background 0.1s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td .sm { display: block; font-size: 12px; color: var(--muted); }
.tabela-rodape { padding: 12px 16px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }

/* ---------- Aprovação ---------- */
.aprov-lista { display: grid; gap: 16px; }
.aprov { padding: 20px 22px; }
.aprov-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.aprov-top h3 { margin: 0; font-size: 17px; }
.aprov-top p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.aprov-acoes { display: flex; gap: 8px; }
.kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 18px; margin-top: 18px; padding: 16px; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--border); }
.kv div span { display: block; font-size: 12px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.kv div b { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.bloco-texto { margin-top: 14px; }
.bloco-texto span { display: block; font-size: 12px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px; }
.bloco-texto p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Modal / painel lateral ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8, 16, 20, 0.5); backdrop-filter: blur(3px); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade 0.15s ease; }
.modal { width: 100%; max-width: 460px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: up 0.2s ease; }
.modal-head { padding: 20px 22px 0; display: flex; gap: 14px; align-items: flex-start; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.modal-body { padding: 18px 22px; display: grid; gap: 14px; }
.modal-foot { padding: 0 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.drawer-overlay { place-items: stretch end; padding: 0; }
.drawer { width: min(520px, 100vw); height: 100vh; background: var(--surface); overflow-y: auto; box-shadow: var(--shadow-lg); animation: slide 0.22s ease; display: flex; flex-direction: column; }
.drawer-head { padding: 22px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; position: sticky; top: 0; background: var(--surface); }
.drawer-head h3 { margin: 6px 0 0; font-size: 20px; }
.drawer-body { padding: 22px 24px; flex: 1; }
.drawer-body .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
.timeline { margin-top: 22px; display: grid; gap: 14px; }
.tl { display: flex; gap: 12px; }
.tl-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.tl-dot svg { width: 15px; height: 15px; }
.tl b { display: block; font-size: 14px; }
.tl small { color: var(--muted); font-size: 13px; }
.aviso-rej { margin-top: 18px; padding: 14px 16px; border-radius: 12px; background: var(--bad-soft); color: var(--bad); }
.aviso-rej p { margin: 2px 0 0; color: var(--text); white-space: pre-wrap; }

@keyframes fade { from { opacity: 0; } }
@keyframes up { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

/* ---------- Toasts ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 100; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 380px; padding: 12px 16px; border-radius: 12px;
  background: #0f1b24; color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; animation: up 0.2s ease;
}
.toast.ok svg { color: #4ade80; }
.toast.erro svg { color: #fb923c; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
  position: relative; overflow: hidden; color: #e6fffb; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at -10% -20%, #14b8a6 0%, transparent 55%), radial-gradient(900px 500px at 120% 120%, #0891b2 0%, transparent 50%), #0b2a2c;
}
.auth-hero::after {
  content: ""; position: absolute; inset: 0; opacity: 0.12; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: linear-gradient(180deg, #000, transparent 85%);
}
.auth-hero .brand { padding: 0; position: relative; z-index: 1; }
.auth-hero h2 { font-size: 40px; line-height: 1.12; letter-spacing: -1px; margin: 0 0 14px; max-width: 480px; position: relative; z-index: 1; }
.auth-hero p { color: #a7dcd5; max-width: 440px; margin: 0; font-size: 16px; position: relative; z-index: 1; }
.auth-feats { display: grid; gap: 12px; margin-top: 28px; position: relative; z-index: 1; }
.auth-feats div { display: flex; gap: 10px; align-items: center; color: #d2f3ee; font-size: 14px; }
.auth-feats svg { color: #5eead4; }
.auth-side { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.4px; }
.auth-card > p { margin: 0 0 24px; color: var(--muted); }
.auth-card form { display: grid; gap: 14px; }
.auth-troca { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }
.link-btn { background: none; border: 0; color: var(--brand); font-weight: 600; cursor: pointer; padding: 0; }
.dica { padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-strong); font-size: 13px; margin-bottom: 18px; }

.carregando { display: grid; place-items: center; min-height: 40vh; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand); animation: gira 0.8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

.mobile-top { display: none; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: 1fr; }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 22px; }
  .auth-hero h2 { font-size: 28px; }
  .auth-feats { display: none; }
  .layout { grid-template-columns: 1fr; }
  .side {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 40; flex-direction: row;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 2px; justify-content: space-around;
  }
  .side .brand, .side .side-spacer, .side .me { display: none; }
  .nav-item { flex-direction: column; gap: 3px; font-size: 11px; padding: 7px 4px; text-align: center; position: relative; justify-content: center; }
  .nav-item.ativo { box-shadow: none; }
  .nav-item .contador { position: absolute; top: 2px; right: 50%; margin-right: -22px; padding: 0 6px; font-size: 10px; }
  .mobile-top {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--side); color: #fff;
    position: sticky; top: 0; z-index: 30;
  }
  .mobile-top .brand { padding: 0; }
  .mobile-top .brand-logo { width: 32px; height: 32px; }
  .main { padding: 20px 16px 100px; }
  .page-head h1 { font-size: 22px; }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .f, .f.s3, .f.s4, .f.s8, .f.s12 { grid-column: span 2; }
  .f.m1 { grid-column: span 1; }
  .form-sec { padding: 18px 16px; }
  .form-actions { padding: 14px 16px; }
  .form-actions .btn { flex: 1; }
  .aprov { padding: 16px; }
  .aprov-acoes { width: 100%; }
  .aprov-acoes .btn { flex: 1; }
  .esconde-mobile { display: none; }
  .toolbar { padding: 12px; }
  .toolbar .input { flex: 1 1 130px; min-width: 0; }
  .search { flex-basis: 100%; }
  td, th { padding: 12px 10px; }
  #toasts { left: 16px; right: 16px; bottom: 86px; }
  .toast { max-width: none; }
}
@media (max-width: 520px) {
  .grid-stats { gap: 10px; }
  .stat { padding: 14px; gap: 10px; }
  .stat-ic { width: 36px; height: 36px; }
  .stat b { font-size: 21px; }
}

/* ---------- Painel por período ---------- */
.periodo { display: flex; align-items: center; gap: 16px; padding: 12px 14px; margin-bottom: 16px; }
.periodo-ano { display: flex; align-items: center; gap: 4px; padding-right: 14px; border-right: 1px solid var(--border); }
.periodo-ano b { font-size: 18px; font-variant-numeric: tabular-nums; min-width: 48px; text-align: center; }
.periodo-ano .icon-btn:disabled { opacity: 0.3; cursor: default; }
.meses { display: flex; gap: 6px; overflow-x: auto; flex: 1; scrollbar-width: thin; padding: 2px; }
.mes-chip {
  flex: 1 0 auto; min-width: 52px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 6px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; transition: 0.15s;
}
.mes-chip span { font-weight: 600; font-size: 13px; }
.mes-chip small { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.mes-chip:hover { border-color: var(--brand); }
.mes-chip.ativo { background: var(--brand); border-color: var(--brand); color: #fff; }
.mes-chip.ativo small { color: rgba(255, 255, 255, 0.85); }
@media (prefers-color-scheme: dark) { .mes-chip.ativo { color: #052e2b; } .mes-chip.ativo small { color: rgba(5, 46, 43, 0.8); } }

.grid-stats.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat span { display: block; }
.delta { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; }
.delta.sobe { background: var(--warn-soft); color: var(--warn); }
.delta.desce { background: var(--ok-soft); color: var(--ok); }
.delta.neutro { background: var(--surface-2); color: var(--muted); }

.cols { margin-bottom: 20px; }
.card-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }

/* gráfico de colunas por mês */
.colunas { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; height: 230px; align-items: stretch; }
.coluna { border: 0; background: none; padding: 0; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-width: 0; color: inherit; }
.col-area { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-bottom: 1px solid var(--border); position: relative; }
.col-barra { width: min(100%, 34px); min-height: 0; border-radius: 4px 4px 0 0; background: color-mix(in oklab, var(--brand) 45%, var(--surface)); transition: background 0.15s; }
.col-valor { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: 4px; opacity: 0; }
.coluna:hover .col-barra { background: color-mix(in oklab, var(--brand) 70%, var(--surface)); }
.coluna:hover .col-valor, .coluna.ativa .col-valor { opacity: 1; }
.coluna.ativa .col-barra { background: var(--brand); }
.coluna.ativa .col-valor { color: var(--text); font-weight: 700; }
.col-rot { font-size: 12px; color: var(--muted); text-align: center; }
.coluna.ativa .col-rot { color: var(--text); font-weight: 700; }

/* calendário */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-sem { text-align: center; font-size: 11px; font-weight: 700; color: var(--faint); padding-bottom: 2px; }
.dia {
  aspect-ratio: 1 / 0.82; border-radius: 8px; border: 1px solid transparent; position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0; font-size: 12px; background: var(--surface-2); color: var(--muted); padding: 0;
}
button.dia { cursor: pointer; }
button.dia:disabled { cursor: default; }
button.dia:not(:disabled):hover { outline: 2px solid var(--brand); outline-offset: 1px; }
.dia.vazio { background: none; }
.dia-n { font-variant-numeric: tabular-nums; line-height: 1.1; }
.dia-q { font-weight: 700; font-size: 13px; line-height: 1.1; }
.dia.nivel-1 { background: color-mix(in oklab, var(--brand) 18%, var(--surface)); color: var(--text); }
.dia.nivel-2 { background: color-mix(in oklab, var(--brand) 38%, var(--surface)); color: var(--text); }
.dia.nivel-3 { background: color-mix(in oklab, var(--brand) 62%, var(--surface)); color: #fff; }
.dia.nivel-4 { background: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .dia.nivel-3, .dia.nivel-4 { color: #052e2b; } }
.dia.hoje { border-color: var(--text); }
.dia-pend { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px var(--surface); }
.cal-legenda { display: flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.cal-legenda i.dia { width: 16px; height: 16px; aspect-ratio: auto; border-radius: 4px; }
.cal-pend { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.cal-pend .dia-pend { position: static; box-shadow: none; }

/* farol por área */
.farol { margin-bottom: 20px; }
.farol-resumo { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip-status svg { width: 14px; height: 14px; }
.chip-status.ok { background: var(--ok-soft); color: var(--ok); }
.chip-status.warn { background: var(--warn-soft); color: var(--warn); }
.chip-status.bad { background: var(--bad-soft); color: var(--bad); }
.chip-status.neutro { background: var(--surface-2); color: var(--muted); }
.farol-grupos { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 14px 32px; }
.farol-grupo h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--faint); margin: 0 0 6px; }
.farol-linha { display: grid; grid-template-columns: 88px minmax(70px, 1fr) 60px 128px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.farol-grupo .farol-linha:last-child { border-bottom: 0; }
.farol-area { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.farol-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.farol-num b { color: var(--text); }
.farol-barra { display: block; }
.farol-barra i.ok { background: var(--ok); }
.farol-barra i.warn { background: var(--warn); }
.farol-barra i.bad { background: var(--bad); }

/* rankings */
.grid-rank { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.barra-nome { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; margin-right: 10px; }
.barra-top b small { font-weight: 500; color: var(--muted); }
.barras > div { min-width: 0; }

.metas-grid { display: grid; grid-template-columns: 1fr 110px; gap: 8px 12px; align-items: center; max-height: 55vh; overflow-y: auto; padding-right: 4px; }
.metas-area { font-weight: 600; font-size: 14px; display: flex; flex-direction: column; }
.metas-area small { color: var(--faint); font-weight: 500; font-size: 12px; }

@media (max-width: 1100px) { .grid-stats.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .periodo { flex-direction: column; align-items: stretch; gap: 10px; }
  .periodo-ano { border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 8px; justify-content: center; }
  .grid-rank { grid-template-columns: 1fr; }
  .colunas { height: 180px; gap: 3px; }
  .col-rot { font-size: 10px; }
  .farol-linha { grid-template-columns: 76px minmax(50px, 1fr) 52px auto; gap: 8px; }
  .farol-grupos { grid-template-columns: 1fr; }
}

@media (max-width: 520px) { .kpis .stat b { font-size: 18px; } }
