/* ======================== BASE ======================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: background-color .2s ease, color .2s ease;
}
@media (prefers-reduced-motion: reduce) { body { transition: none; } }
a { color: var(--link); }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brand-blue); outline-offset: 2px; border-radius: 8px; }
.wrap { max-width: 1360px; margin: 0 auto; }

/* ======================== TOPO (opção G) ======================== */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar__row { padding: 14px 32px 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }

.brand { flex: 0 0 auto; display: flex; align-items: center; text-decoration: none; color: var(--heading);
  font-weight: 800; font-size: 24px; letter-spacing: .02em; line-height: 1; }
.brand svg { margin: 0 1px; }

.search-slot { flex: 1 1 320px; display: flex; justify-content: center; }
.search { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 640px; height: 48px;
  padding: 0 8px 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--sunken); color: var(--muted); }
.search input { flex: 1 1 auto; min-width: 0; border: 0; outline: none; background: transparent;
  font: inherit; font-size: 15px; color: var(--heading); }
.search input::placeholder { color: var(--muted); }
.search kbd { flex: none; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  font-family: "JetBrains Mono", monospace; font-size: 12px; font-weight: 600; color: var(--muted); }

.actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; position: relative; }
.scope-btn { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); font: inherit; font-size: 14px; font-weight: 700; color: var(--heading); cursor: pointer; }
.scope-btn .pin { color: var(--link); }
.icon-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 0;
  border-radius: 10px; background: transparent; color: var(--heading); cursor: pointer; }
.icon-btn:hover { background: var(--sunken); }
.avatar { width: 44px; height: 44px; border-radius: 999px; border: 0; background: var(--avatar-bg); color: var(--avatar-fg);
  font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }

/* ---------- Seletor de tema (ícone no formato do logo) ---------- */
.theme-switch { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; padding: 0; }
.theme-switch:hover { background: var(--sunken); }
.theme-switch[aria-expanded="true"] { border-color: var(--link); box-shadow: 0 0 0 3px var(--action-soft); }
.theme-switch .peak { transition: opacity .15s ease, transform .15s ease; transform-origin: center bottom; }
html[data-theme="creme"]  .theme-switch .peak--creme,
html[data-theme="salvia"] .theme-switch .peak--salvia,
html[data-theme="noite"]  .theme-switch .peak--noite { stroke-width: 1.6; }

.theme-menu { position: absolute; top: calc(100% + 8px); right: 52px; z-index: 50; width: 280px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); }
.theme-menu[hidden] { display: none; }
.theme-menu__title { margin: 6px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.theme-opt { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 10px; border: 0;
  border-radius: 10px; background: transparent; font: inherit; text-align: left; color: var(--text); cursor: pointer; }
.theme-opt:hover, .theme-opt:focus-visible { background: var(--sunken); }
.theme-opt[aria-checked="true"] { background: var(--action-soft); }
.theme-opt__preview { flex: none; width: 36px; height: 36px; border-radius: 10px; overflow: hidden; display: grid;
  grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; border: 1px solid var(--line); }
.theme-opt__preview span:first-child { grid-row: 1 / 3; }
.theme-opt__text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.theme-opt__name { font-size: 14px; font-weight: 700; color: var(--heading); }
.theme-opt__desc { font-size: 12px; color: var(--muted); }
.theme-opt__check { flex: none; color: var(--link); visibility: hidden; }
.theme-opt[aria-checked="true"] .theme-opt__check { visibility: visible; }

/* ---------- Menu principal ---------- */
.nav-row { padding: 0 20px; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; min-height: 48px; padding: 0 14px;
  font-size: 14px; font-weight: 600; color: var(--text); text-decoration: none; }
.nav a:hover { color: var(--heading); }
.nav a[aria-current="page"] { font-weight: 800; color: var(--heading); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--brand-gradient); }

/* ======================== PÁGINA ======================== */
.page { padding: 28px 32px 40px; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { margin: 0; font-size: 38px; line-height: 1.08; font-weight: 800; letter-spacing: -.025em; color: var(--heading); }
.page-head p { margin: 6px 0 0; font-size: 15px; color: var(--muted); }
.page-head__right { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px;
  font-size: 13px; font-weight: 700; text-decoration: none; }
.pill--ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill--ok .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--ok); }
.pill--warn { background: var(--warn-soft); color: var(--warn-ink); }
.btn-primary { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border: 0; border-radius: 10px;
  background: var(--action); color: var(--on-action); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpi { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent);
  border-radius: 14px; display: flex; flex-direction: column; gap: 6px; }
.kpi--ok { --accent: var(--ok); --chip-bg: var(--ok-soft); --chip-fg: var(--ok-ink); }
.kpi--blue { --accent: var(--kpi-blue); --chip-bg: var(--action-soft); --chip-fg: var(--action-soft-ink); }
.kpi--warn { --accent: var(--warn); --chip-bg: var(--warn-soft); --chip-fg: var(--warn-ink); }
.kpi--petrol { --accent: var(--petrol); --chip-bg: var(--petrol-soft); --chip-fg: var(--petrol-ink); }
.kpi__icon { width: 34px; height: 34px; border-radius: 10px; background: var(--chip-bg); color: var(--chip-fg);
  display: flex; align-items: center; justify-content: center; }
.kpi__value { font-family: "JetBrains Mono", monospace; font-size: 26px; font-weight: 700; color: var(--heading); }
.kpi__label { font-size: 14px; font-weight: 700; color: var(--heading); }
.kpi__note { font-size: 12px; color: var(--muted); }
.status-card { padding: 18px; background: var(--sunken); border: 1px solid var(--line); border-radius: 14px;
  display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); font-size: 13px; }
.status-card strong { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--heading); }
.status-card strong svg { color: var(--ok-ink); }
.status-card .muted { color: var(--muted); }
.status-card .more { color: var(--link); font-weight: 700; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px;
  display: flex; flex-direction: column; gap: 14px; }
.card__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card__head h2 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; color: var(--heading); }
.card__head h2 svg { color: var(--link); }
.card__sub { font-size: 13px; color: var(--muted); }
.card__link { font-size: 14px; font-weight: 700; text-decoration: none; padding: 10px 0; }
.tag { padding: 6px 10px; border-radius: 8px; background: var(--sunken); font-size: 12px; font-weight: 700; color: var(--text); }

.modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.module { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); font-size: 14px; font-weight: 700; color: var(--heading); text-decoration: none; }
.module:hover { border-color: var(--link); }
.module svg { flex: none; color: var(--link); }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 12px; border-radius: 999px; background: var(--sunken); color: var(--text); font-size: 13px; font-weight: 600; }
.chip strong { font-family: "JetBrains Mono", monospace; }
.chip--blue { background: var(--action-soft); color: var(--chip-blue-fg); }
.chip--warn { background: var(--warn-soft); color: var(--warn-ink); }
.rows { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding: 12px 0;
  border-bottom: 1px solid var(--line); font-size: 14px; color: var(--text); text-decoration: none; }
.row:last-child { border-bottom: 0; }
.row strong { color: var(--link); }
.row .mono { font-size: 12px; color: var(--muted); }

.chart { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 8px; border-bottom: 1px solid var(--line); }
.chart__col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.chart__val { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--muted); }
.chart__bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--chart); }
.chart__bar--zero { height: 2px !important; border-radius: 0; background: var(--line); }
.chart__col--peak .chart__val { font-weight: 700; color: var(--heading); }
.chart__col--peak .chart__bar { background: var(--chart-peak); }
.chart__labels { display: flex; gap: 10px; font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--muted); }
.chart__labels span { flex: 1 1 0; text-align: center; }

@media (max-width: 720px) {
  .topbar__row { padding: 12px 16px 4px; }
  .nav-row { padding: 0 6px; }
  .nav { flex-wrap: nowrap; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  .page { padding: 20px 16px 32px; }
  .page-head h1 { font-size: 30px; }
  .theme-menu { right: 0; }
}
