/* ==========================================================
   Tokens
   Linguagem visual de sinalização rodoviária: verde de placa
   de orientação, laranja de obra, asfalto e concreto.
   ========================================================== */
:root {
  color-scheme: light;
  --page: #e8ebeb;
  --surface: #ffffff;
  --surface-2: #f3f5f5;
  --ink: #1b1f23;
  --ink-2: #4a5157;
  --muted: #6c757c;
  --line: #d3d8da;
  --grid: #e5e8e9;
  --axis: #b9c0c4;

  --sign: #00664a;
  --sign-deep: #004f39;
  --sign-ink: #ffffff;
  --work: #ee7d00;
  --asphalt: #2a2f34;
  --asphalt-2: #353b41;
  --marking: #f4f4f1;
  --focus: #0a66c2;

  --data: #00664a;
  --data-soft: rgba(0, 102, 74, 0.14);
  --band: rgba(42, 47, 52, 0.07);
  --band-hatch: rgba(42, 47, 52, 0.16);

  --radius-sign: 10px;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(20, 24, 28, 0.06), 0 4px 14px rgba(20, 24, 28, 0.05);
  --good-bg: #e2f3e4;
  --good-ink: #0b5d1e;
  --split-bg: #eef0f1;

  --font: 'Overpass', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --maxw: 1160px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #121518;
    --surface: #1b1f23;
    --surface-2: #22272c;
    --ink: #eef1f2;
    --ink-2: #bcc3c8;
    --muted: #8c959b;
    --line: #30363c;
    --grid: #2a3035;
    --axis: #434a51;
    --sign: #0a6e51;
    --sign-deep: #075a42;
    --asphalt: #0d0f11;
    --asphalt-2: #2e343a;
    --marking: #d9dcdc;
    --focus: #5aa7f0;
    --data: #35a780;
    --data-soft: rgba(53, 167, 128, 0.18);
    --band: rgba(255, 255, 255, 0.05);
    --band-hatch: rgba(255, 255, 255, 0.12);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --good-bg: rgba(12, 163, 12, 0.16);
    --good-ink: #7ed98a;
    --split-bg: #262b30;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #121518;
  --surface: #1b1f23;
  --surface-2: #22272c;
  --ink: #eef1f2;
  --ink-2: #bcc3c8;
  --muted: #8c959b;
  --line: #30363c;
  --grid: #2a3035;
  --axis: #434a51;
  --sign: #0a6e51;
  --sign-deep: #075a42;
  --asphalt: #0d0f11;
  --asphalt-2: #2e343a;
  --marking: #d9dcdc;
  --focus: #5aa7f0;
  --data: #35a780;
  --data-soft: rgba(53, 167, 128, 0.18);
  --band: rgba(255, 255, 255, 0.05);
  --band-hatch: rgba(255, 255, 255, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --good-bg: rgba(12, 163, 12, 0.16);
  --good-ink: #7ed98a;
  --split-bg: #262b30;
}

/* ==========================================================
   Base
   ========================================================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ==========================================================
   Login
   ========================================================== */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  /* Linha tracejada central, como a marcação de uma pista */
  background: repeating-linear-gradient(180deg, var(--marking) 0 36px, transparent 36px 72px) center / 6px 100% no-repeat, var(--asphalt);
}

.login-box {
  background: var(--surface);
  padding: 2.25rem 2rem 2rem;
  border-radius: var(--radius-sign);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 380px;
  border-top: 6px solid var(--sign);
}

.login-box h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.login-box > p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

#login-form { display: flex; flex-direction: column; gap: 0.75rem; }

.password-wrapper { position: relative; display: flex; align-items: center; }

#password-input {
  font: inherit;
  font-size: 1rem;
  padding: 0.75rem 2.75rem 0.75rem 1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}

#password-input:focus { outline: none; border-color: var(--sign); }

.toggle-password {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0.35rem;
  display: flex;
}

.toggle-password:hover { color: var(--ink); }

#login-btn {
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.75rem;
  background: var(--sign);
  color: var(--sign-ink);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

#login-btn:hover { background: var(--sign-deep); }

.login-error { color: #c62828; font-size: 0.9rem; margin-top: 0.75rem; }

/* ==========================================================
   Cabeçalho e rodapé
   ========================================================== */
.site-header {
  background: var(--asphalt);
  color: #fff;
  position: relative;
}

/* Faixa tracejada de marcação viária na base do cabeçalho */
.site-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: repeating-linear-gradient(90deg, var(--marking) 0 28px, transparent 28px 52px);
  opacity: 0.85;
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem 16px 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand { text-decoration: none; display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.brand-title { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand-sub { color: rgba(255, 255, 255, 0.65); font-size: 0.95rem; }

.theme-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 999px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  cursor: pointer;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.08); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.5rem 16px 3rem;
}
main:focus, main:focus-visible { outline: none; }

.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem 16px 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

/* ==========================================================
   Tela inicial
   ========================================================== */
.home-intro { max-width: 46rem; margin-bottom: 2.25rem; }

.home-intro h1 {
  font-size: clamp(1.9rem, 4.2vw, 2.75rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.home-intro p { color: var(--ink-2); font-size: 1.075rem; max-width: 40rem; }

/* Aviso de arquivos de simulação com problema (js/sims) */
.data-alert {
  background: var(--surface);
  border-left: 5px solid var(--work);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem;
  margin-bottom: 1.5rem;
}
.data-alert p { color: var(--muted); margin: 0.25rem 0 0.5rem; }
.data-alert ul { padding-left: 1.25rem; display: grid; gap: 0.25rem; overflow-wrap: anywhere; }

.sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Cartão de simulação no formato de placa de orientação */
.sim-sign {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background: var(--surface);
  border-radius: var(--radius-sign);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.sim-sign:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(20, 24, 28, 0.14); }
.sim-sign:focus-visible { outline-offset: 4px; border-radius: var(--radius-sign); }

.sign-face {
  background: var(--sign);
  color: var(--sign-ink);
  margin: 8px 8px 0;
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9);
  padding: 1rem 1.1rem 1.05rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.9rem;
  align-items: center;
  align-content: center;
}

.sign-face.no-shield { grid-template-columns: 1fr; }
.br-shield { width: 46px; height: 52px; grid-row: span 2; }
.br-shield path { fill: #fff; stroke: #1b1f23; stroke-width: 2.5; }
.br-shield text { fill: #1b1f23; font-family: var(--font); font-weight: 800; text-anchor: middle; }

.sign-title { font-size: 1.45rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; }
.sign-direction { font-size: 0.98rem; font-weight: 600; opacity: 0.92; display: flex; align-items: center; gap: 0.35rem; }

.sign-body { padding: 1rem 1.1rem 0.5rem; flex: 1; display: flex; flex-direction: column; gap: 1rem; }

.sign-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem 1rem; }
.sign-facts div { min-width: 0; }
.sign-facts dt { font-size: 0.8rem; color: var(--muted); }
.sign-facts dd { font-size: 0.98rem; font-weight: 600; color: var(--ink); }

.sign-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--line);
  font-weight: 700;
  color: var(--sign);
}
:root[data-theme="dark"] .sign-cta { color: var(--data); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sign-cta { color: var(--data); } }

.sign-cta svg { transition: transform 0.18s ease; }
.sim-sign:hover .sign-cta svg { transform: translateX(3px); }

/* Banner do cronograma */
.schedule-banner {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1.15rem 1.35rem;
  background: var(--surface);
  border: 2px dashed var(--axis);
  border-radius: var(--radius-sign);
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.schedule-banner:hover { border-color: var(--sign); background: var(--surface-2); }

.schedule-icon {
  flex: none;
  width: 48px; height: 48px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--sign);
  display: grid; place-items: center;
}
.schedule-text { flex: 1; min-width: 0; }
.schedule-text strong { display: block; font-size: 1.1rem; font-weight: 700; }
.schedule-text span { color: var(--muted); font-size: 0.92rem; }
.schedule-banner > svg { flex: none; color: var(--muted); }

/* ==========================================================
   Esquema da via (zona de obra)
   ========================================================== */
.road { width: 100%; display: block; }
.road .asphalt { fill: var(--asphalt-2); }
.road .edge { stroke: var(--marking); stroke-width: 1.5; }
.road .lane-mark { stroke: var(--marking); stroke-width: 1.5; stroke-dasharray: 10 8; }
.road .work-label { fill: #fff; font: 700 11px var(--font); text-anchor: middle; paint-order: stroke; stroke: rgba(0,0,0,0.55); stroke-width: 3px; }
.road .km-label { fill: var(--ink-2); font: 600 11px var(--font); text-anchor: middle; }
.road .km-tick { stroke: var(--ink-2); stroke-width: 1.5; }
.road .flow { fill: var(--marking); opacity: 0.9; }

/* ==========================================================
   Página da simulação
   ========================================================== */
.sim-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--axis); background: var(--surface-2); }
.btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

.sim-pager { display: flex; gap: 0.5rem; }

.sim-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 1.5rem;
  align-items: stretch;
  margin-bottom: 2rem;
}

.sim-hero .sign-face { margin: 0; padding: 1.35rem 1.4rem; }
.sim-hero .sign-title { font-size: clamp(1.7rem, 3.4vw, 2.3rem); }
.sim-hero .br-shield { width: 58px; height: 66px; }

.sim-hero-info {
  background: var(--surface);
  border-radius: var(--radius-sign);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sim-hero-info .sign-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* KPIs */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.kpi {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem;
  border-top: 3px solid var(--line);
}
.kpi.is-mean { border-top-color: var(--data); }
.kpi-label { font-size: 0.85rem; color: var(--muted); }
.kpi-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin-top: 0.2rem; }
.kpi-value small { font-size: 1rem; font-weight: 600; color: var(--ink-2); margin-left: 0.15rem; }
.kpi-note { font-size: 0.85rem; color: var(--ink-2); margin-top: 0.2rem; }

/* Seções de resultado */
.result-section { margin-bottom: 2.75rem; }

.section-head { margin-bottom: 1rem; max-width: 48rem; }
.section-head h2 { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.section-head p { color: var(--ink-2); margin-top: 0.35rem; }

.note {
  font-size: 0.92rem;
  color: var(--ink-2);
  background: var(--surface);
  border-left: 4px solid var(--work);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.7rem 0.95rem;
  margin-top: 0.75rem;
}
.note p + p { margin-top: 0.35rem; }

.chart-card {
  background: var(--surface);
  border-radius: var(--radius-sign);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem 0.75rem;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  font-size: 0.9rem;
  color: var(--ink-2);
  margin-bottom: 0.6rem;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 0.45rem; }
.chart-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.chart-legend i.is-line { height: 3px; border-radius: 2px; }
.chart-legend i.is-ref { height: 0; border-top: 2px dashed var(--ink-2); background: none !important; }
.chart-legend i.is-band {
  height: 12px;
  background: repeating-linear-gradient(135deg, var(--band-hatch) 0 2px, var(--band) 2px 6px) !important;
  border: 1px solid var(--axis);
}

.chart-box { position: relative; height: 340px; }
.chart-box.is-short { height: 230px; }

.chart-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 0.75rem;
  padding-top: 0.65rem;
}

details.data-table summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-2);
  padding: 0.25rem 0;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
details.data-table summary::-webkit-details-marker { display: none; }
details.data-table summary svg { transition: transform 0.18s ease; }
details.data-table[open] summary svg { transform: rotate(90deg); }

.table-scroll { overflow-x: auto; margin-top: 0.6rem; max-height: 420px; overflow-y: auto; }
.table-wrap { flex-basis: 100%; }

table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
thead th {
  position: sticky; top: 0;
  background: var(--surface-2);
  color: var(--ink-2);
  font-weight: 700;
  text-align: right;
  padding: 0.55rem 0.85rem;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
thead th:first-child, tbody td:first-child { text-align: left; }
tbody td {
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--grid);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
tbody tr:hover { background: var(--surface-2); }
tbody tr.is-peak td { font-weight: 700; }
tfoot td {
  padding: 0.55rem 0.85rem;
  text-align: right;
  font-weight: 700;
  border-top: 2px solid var(--line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
tfoot td:first-child { text-align: left; }

/* Comparação entre cenários */
.compare-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.compare-grid h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.4rem; }

.empty-state { padding: 3rem 0; }
.empty-state h1 { font-size: 1.6rem; margin-bottom: 0.5rem; }
.empty-state p { color: var(--ink-2); margin-bottom: 1.25rem; }

/* Entrada da página (única animação não acionada pelo usuário) */
.view-enter { animation: view-in 0.35s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

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

/* ==========================================================
   Trechos e faixas horárias
   ========================================================== */
.dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex: none;
  background: var(--period);
}
.dot-lg { width: 14px; height: 14px; }

.period-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; font-size: 0.95rem; font-weight: 600; color: var(--ink); }
.period-legend span { display: inline-flex; align-items: center; gap: 0.45rem; }
.period-legend-title { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.3rem; }

.badge-best, .badge-split, .min-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.2rem 0.65rem 0.2rem 0.5rem;
  white-space: nowrap;
}
.badge-best { background: var(--good-bg); color: var(--good-ink); }
.badge-split { background: var(--split-bg); color: var(--ink-2); }
.min-tag { background: none; color: var(--good-ink); padding: 0; font-size: 0.82rem; }
.min-mark { display: inline-flex; vertical-align: -2px; color: var(--good-ink); }

/* Cartões de trecho */
.trecho-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.trecho-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: var(--surface);
  border-radius: var(--radius-sign);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem 0.95rem;
  text-decoration: none;
  border-top: 5px solid var(--sign);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.trecho-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(20, 24, 28, 0.14); }

.trecho-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.trecho-card-head strong { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; }
.trecho-card-head span { color: var(--muted); font-size: 0.9rem; }

.trecho-mini { font-size: 0.92rem; }
.trecho-mini thead th { position: static; background: none; padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--line); font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.trecho-mini tbody td { padding: 0.45rem 0.5rem; }
.trecho-mini tbody td:first-child { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.trecho-mini tbody tr.is-best td { font-weight: 700; }
.trecho-mini tbody tr:hover { background: none; }

.trecho-card-foot { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: auto; }

/* Botão "Ver gráficos": brilho pulsante e reflexo, para ser achado de imediato */
.cta-glow {
  --glow: rgba(0, 170, 112, 0.55);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.9rem 1.2rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sign) 0%, #00a06b 100%);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 0 0 0 var(--glow), 0 6px 18px -4px var(--glow);
  animation: cta-pulse 2.2s ease-out infinite;
  transition: transform 0.18s ease, filter 0.18s ease;
}
:root[data-theme="dark"] .cta-glow { --glow: rgba(60, 230, 160, 0.6); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cta-glow { --glow: rgba(60, 230, 160, 0.6); } }

.cta-glow::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-20deg);
  animation: cta-shine 3.2s ease-in-out infinite;
}
.cta-glow svg { transition: transform 0.18s ease; }
.trecho-card:hover .cta-glow, .trecho-card:focus-visible .cta-glow { filter: brightness(1.1); transform: scale(1.02); }
.trecho-card:hover .cta-glow svg { transform: translateX(4px); }

@keyframes cta-pulse {
  0% { box-shadow: 0 0 0 0 var(--glow), 0 6px 18px -4px var(--glow); }
  70% { box-shadow: 0 0 0 12px rgba(0, 0, 0, 0), 0 6px 22px -2px var(--glow); }
  100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0), 0 6px 18px -4px var(--glow); }
}
@keyframes cta-shine {
  0%, 55% { left: -60%; }
  100% { left: 130%; }
}

/* Veredito da melhor faixa horária */
.verdict {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  border-radius: var(--radius-sign);
  padding: 1rem 1.2rem;
  margin-bottom: 1.25rem;
}
.verdict.is-best { background: var(--good-bg); color: var(--good-ink); }
.verdict.is-split { background: var(--split-bg); color: var(--ink-2); }
.verdict-icon {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: currentColor;
}
.verdict-icon svg { color: var(--surface); width: 18px; height: 18px; }
.verdict-title { font-size: 1.2rem; font-weight: 800; line-height: 1.25; margin-bottom: 0.15rem; }
.verdict p:not(.verdict-title) { color: var(--ink-2); }

/* Resumo por faixa horária */
.period-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.period-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-top: 5px solid var(--period);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.period-card.is-best { box-shadow: var(--shadow), 0 0 0 2px var(--good-ink) inset; }
.period-card-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.period-card-head strong { font-size: 1.2rem; font-weight: 800; }
.period-card-head span { color: var(--muted); }
.period-card-values { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.period-card-values > div { display: flex; flex-direction: column; align-items: flex-start; }
.period-card .badge-best { align-self: flex-start; }

/* Volume de tráfego horário: um cartão por trecho, uma coluna por faixa horária */
.volume-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem 2rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-top: 5px solid var(--sign);
  padding: 1rem 1.15rem 0.75rem;
}
.volume-period { display: flex; flex-direction: column; gap: 0.5rem; }
.volume-period .period-card-head { align-items: center; }
.volume-period .period-card-head strong { font-size: 1.05rem; }
.volume-period .trecho-mini { border-top: 3px solid var(--period); }

/* Seção de cada faixa horária */
.period-section .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  max-width: none;
  padding-bottom: 0.6rem;
  border-bottom: 3px solid var(--period);
}
.period-section h2 { display: flex; align-items: center; gap: 0.6rem; }
.h2-sub { font-weight: 600; color: var(--muted); font-size: 1.05rem; }
.chart-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--ink-2); }

/* ==========================================================
   Responsivo
   ========================================================== */
@media (max-width: 900px) {
  .sim-hero { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compare-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  main { padding-top: 1.75rem; }
  .sim-grid { grid-template-columns: 1fr; }
  .sim-hero-info .sign-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 1.55rem; }
  .chart-box { height: 290px; }
  .chart-card { padding: 0.9rem 0.75rem 0.6rem; }
  .brand-sub { display: none; }
}

/* ==========================================================
   Impressão
   ========================================================== */
@media print {
  .site-header, .sim-nav, .chart-tools .btn, .theme-toggle { display: none !important; }
  body { background: #fff; }
  .chart-card, .kpi, .sim-hero-info { box-shadow: none; border: 1px solid #ccc; }
  details.data-table .table-scroll { max-height: none; }
  .result-section { break-inside: avoid; }
}
