:root {
  --bg: #f4f3fb;
  --surface: #ffffff;
  --ink: #241f3a;
  --muted: #6f6a88;
  --faint: #a7a2bd;
  --line: #e7e4f4;
  --grid: #eceaf5;
  --green: #16c079;
  --red: #e0245e;
  --radius: 20px;
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--font); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 500px at 90% -10%, rgba(42,120,214,.10), transparent 60%),
    radial-gradient(800px 500px at -5% 4%, rgba(160,107,245,.12), transparent 55%),
    var(--bg);
}
.wrap { max-width: 1120px; margin: 0 auto; padding: clamp(24px,5vw,52px) clamp(16px,4vw,36px) 90px; }

.topnav { margin-bottom: 20px; }
.topnav a { text-decoration: none; font-weight: 800; font-size: 13px; color: var(--muted); padding: 8px 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); transition: color .14s, transform .12s; display: inline-block; }
.topnav a:hover { color: var(--ink); transform: translateX(-2px); }

.eyebrow { display: inline-block; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #fff; font-weight: 800; margin: 0 0 14px; background: linear-gradient(90deg,#2a78d6,#a06bf5); padding: 6px 14px; border-radius: 999px; box-shadow: 0 8px 18px -8px rgba(42,120,214,.5); }
h1 { font-size: clamp(30px,6vw,46px); line-height: 1.03; letter-spacing: -.03em; margin: 0 0 10px; font-weight: 800; }
h1 .pop { background: linear-gradient(90deg,#2a78d6,#a06bf5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { color: var(--muted); font-size: 15.5px; margin: 0 0 8px; max-width: 60ch; font-weight: 500; }
code { background: var(--line); color: var(--muted); padding: 1px 6px; border-radius: 6px; font-size: .9em; }

/* Navegador de mês */
.monthnav { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
.mn-btn { width: 40px; height: 40px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-size: 22px; font-weight: 800; line-height: 1; cursor: pointer; display: grid; place-items: center; transition: border-color .14s, transform .12s; }
.mn-btn:hover:not(:disabled) { border-color: #2a78d6; transform: translateY(-1px); }
.mn-btn:disabled { opacity: .4; cursor: default; }
.mn-btn:focus-visible { outline: 3px solid rgba(42,120,214,.4); outline-offset: 2px; }
.mn-label { font-weight: 800; font-size: 18px; letter-spacing: -.01em; min-width: 12ch; text-align: center; }
.mn-today { border: 2px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 7px 14px; font: inherit; font-weight: 800; font-size: 12.5px; cursor: pointer; transition: border-color .14s, color .14s; }
.mn-today:hover { border-color: #2a78d6; color: var(--ink); }

/* KPIs */
.kpis { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 2px solid var(--line); border-left: 5px solid var(--kc,#2a78d6); border-radius: 16px; padding: 16px 18px; box-shadow: 0 16px 34px -26px rgba(36,31,58,.4); }
.kpi .k-lbl { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 800; }
.kpi .k-val { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 5px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 3px; }
.kpi .k-val.neg { color: var(--red); } .kpi .k-val.pos { color: var(--green); }

/* Charts grid */
.charts { margin-top: 22px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px 18px 14px; box-shadow: 0 18px 40px -30px rgba(36,31,58,.45); min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card h3 { margin: 0 0 2px; font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.card .sub { margin: 0 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.chart-host { width: 100%; overflow: hidden; }
.chart-host svg { width: 100%; height: auto; display: block; }

/* Chart filters (chips, como no controle mensal) */
.chart-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 14px; }
.fchip { border: 2px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 700; font-size: 12px; cursor: pointer; transition: border-color .14s, color .14s, background .14s, transform .12s; }
.fchip:hover { color: var(--ink); border-color: var(--muted); transform: translateY(-1px); }
.fchip.on { color: #fff; border-color: transparent; background: linear-gradient(90deg,#2a78d6,#a06bf5); }
.fchip-bank { border-left: 4px solid var(--fc); }
.fchip-bank.on { background: var(--fc); }

/* SVG chart primitives */
.grid-line { stroke: var(--grid); stroke-width: 1; }
.axis-label { fill: var(--faint); font-size: 11px; font-weight: 700; font-family: var(--font); }
.axis-label.v { text-anchor: end; }
.bar { transition: opacity .12s; }
.bar:hover, .dot:hover { opacity: .82; }
.zero-line { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 3 3; }
.hit { fill: transparent; cursor: pointer; }
.dlabel { fill: var(--ink); font-size: 10.5px; font-weight: 800; text-anchor: middle; font-variant-numeric: tabular-nums; font-family: var(--font); }

/* Legend */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.legend .lgv { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Metas widget */
.metas-goal { margin-bottom: 4px; }
.metas-goal .mg-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 700; }
.metas-goal .mg-next { color: var(--muted); font-size: 13px; }
.metas-goal .mg-pct { font-weight: 800; color: #2a78d6; }
.mbar { height: 14px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.mbar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg,#16c079,#2a78d6); }
.mg-sub { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.milestones { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; max-height: 260px; overflow-y: auto; }
.ms { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.ms .ms-em { font-size: 17px; width: 24px; text-align: center; flex-shrink: 0; }
.ms .ms-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms .ms-val { font-weight: 800; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.ms.done { color: var(--green); } .ms.done .ms-name { text-decoration: line-through; text-decoration-color: rgba(22,192,121,.5); }
.ms.next { background: rgba(42,120,214,.08); border-radius: 10px; padding: 4px 8px; margin: 0 -8px; }

/* Gauges (franquia) */
.gauge { margin-top: 12px; }
.g-top { display: flex; justify-content: space-between; align-items: baseline; }
.g-lbl { font-size: 14px; font-weight: 700; }
.g-val { font-weight: 800; font-variant-numeric: tabular-nums; }
.g-lim { color: var(--faint); font-weight: 700; }
.g-bar { height: 14px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 7px 0 5px; }
.g-bar > div { height: 100%; border-radius: 999px; min-width: 3px; }
.g-sub { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.g-sub.over { color: #b9820f; }

/* Tooltip */
.viz-tip { position: fixed; z-index: 100; pointer-events: none; background: #241f3a; color: #fff; border-radius: 10px; padding: 8px 11px; font-size: 12.5px; font-weight: 600; box-shadow: 0 12px 30px -10px rgba(0,0,0,.5); max-width: 260px; }
.viz-tip b { font-weight: 800; }
.viz-tip .vt-row { display: flex; align-items: center; gap: 7px; margin-top: 3px; }
.viz-tip .vt-sw { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.viz-tip .vt-val { margin-left: auto; font-variant-numeric: tabular-nums; }

.error { margin-top: 24px; background: #fff0f3; border: 2px solid #ffc2d0; color: #b3123b; border-radius: 16px; padding: 16px 20px; font-size: 14px; font-weight: 500; }
.footnote { margin-top: 34px; text-align: center; color: var(--faint); font-size: 12.5px; font-weight: 500; }

@media (max-width: 720px) { .charts { grid-template-columns: 1fr; } .card.wide { grid-column: auto; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
