/* ---------- Header / Executive dashboard ---------- */
header, #view-overview {
  background: linear-gradient(155deg, var(--ink) 0%, #16213d 100%);
  color: var(--paper); position:relative; overflow:hidden;
}
header { padding: 28px 28px 24px; }
#view-overview { padding: 24px 28px 28px; }
#view-overview .dashboard { margin-top:0; }
.brand { display:flex; align-items:center; gap:18px; position:relative; z-index:1; }
.compass { color: var(--brass); flex-shrink:0; }
.compass .needle { transform-origin: 50px 50px; transition: transform .7s cubic-bezier(.22,1,.36,1); }
.brand:hover .compass .needle { transform: rotate(14deg); }
header h1 {
  margin:0; font-family:var(--font-sans); font-weight:800; font-size:2.3rem;
  letter-spacing:-0.01em; line-height:1.08;
  animation: fadeInUp .6s ease-out both;
}
header .route-line {
  font-family:var(--font-mono); font-size:0.74rem; letter-spacing:0.22em;
  color: var(--brass); text-transform:uppercase; margin-top:8px;
  animation: fadeInUp .6s ease-out .08s both;
}
header .sub {
  color:#aab4cc; font-size:0.95rem; margin-top:14px; position:relative; z-index:1;
  animation: fadeInUp .6s ease-out .14s both;
}

/* ---------- Dashboard stat cards ---------- */
.dashboard { display:flex; flex-wrap:wrap; gap:12px; margin-top:22px; position:relative; z-index:1; }
.stat-card {
  flex:1 1 150px; min-width:142px; display:flex; align-items:flex-start; gap:12px;
  background: rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius-md); padding:13px 16px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background-color .2s ease, transform .2s ease, border-color .2s ease;
  animation: fadeInUp .5s ease-out both;
}
.stat-card:hover { background: rgba(255,255,255,0.09); transform: translateY(-2px); }
.stat-card:nth-child(2) { animation-delay:.04s; }
.stat-card:nth-child(3) { animation-delay:.08s; }
.stat-card:nth-child(4) { animation-delay:.12s; }
.stat-card:nth-child(5) { animation-delay:.16s; }
.stat-card:nth-child(6) { animation-delay:.20s; }
.stat-card:nth-child(7) { animation-delay:.24s; }
.stat-card:nth-child(8) { animation-delay:.28s; }
.stat-icon {
  flex-shrink:0; width:36px; height:36px; border-radius:10px; font-size:1.25rem;
  display:flex; align-items:center; justify-content:center; background:rgba(255,255,255,0.07);
}
.stat-body { display:flex; flex-direction:column; min-width:0; flex:1; }
.stat-value { font-family:var(--font-mono); font-weight:700; font-size:0.95rem; color:#fff; line-height:1.35; }
.stat-label { font-size:0.7rem; color:#9aa6c4; margin-top:2px; line-height:1.35; }
.stat-card.stat-primary { border-color: rgba(59,130,246,0.55); background: rgba(59,130,246,0.14); }
.stat-card.stat-primary .stat-value { color:#8fbcff; }
.stat-card.stat-status .stat-icon { font-size:0.7rem; color:#9aa6c4; animation: pulse 2.4s ease-in-out infinite; }
.stat-card.stat-status.status-live .stat-icon { color: #4ade80; }
.stat-card.stat-status.status-plan .stat-icon { color: #fbbf24; }
.stat-card.stat-status.status-done .stat-icon { color: #9aa6c4; animation:none; }

/* ---------- Sticky top nav ---------- */
.topnav {
  position: sticky; top:0; z-index:1000; display:flex; align-items:center; gap:4px;
  background: rgba(11,18,32,0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom:1px solid rgba(255,255,255,0.08);
  padding: 6px 14px; overflow-x:auto; white-space:nowrap;
  font-family:var(--font-sans); font-size:0.84rem; font-weight:500;
  transition: background-color .35s ease, border-color .35s ease;
}
.topnav .nav-tab {
  display:flex; align-items:center; gap:7px; color:#aab4cc; text-decoration:none;
  padding:9px 14px; border-radius:999px; flex-shrink:0;
  border:none; background:none; font-family:inherit; font-size:inherit; font-weight:inherit; cursor:pointer;
  transition: color .2s ease, background-color .2s ease;
}
.topnav .nav-tab:hover { color:#fff; background:rgba(255,255,255,0.06); }
.topnav .nav-tab.active { color:#fff; background: rgba(59,130,246,0.22); }
.topnav .nav-icon { font-size:1rem; line-height:1; }
.topnav .nav-spacer { flex:1 1 auto; min-width:8px; }
.topnav .countdown {
  color: var(--brass); font-weight:700; font-family:var(--font-mono); font-size:0.76rem;
  padding:0 12px; flex-shrink:0;
}
.topnav button {
  background: rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.1); color:#cfd6e8; border-radius:999px;
  height:36px; min-width:36px; flex-shrink:0; cursor:pointer; line-height:1;
  display:flex; align-items:center; justify-content:center; gap:6px; margin:0 0 0 6px; padding:0 12px;
  font-family:var(--font-sans); font-weight:500; font-size:0.82rem;
  transition: background-color .2s ease, transform .15s ease, border-color .2s ease;
}
.topnav button:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.18); }
.topnav button:active { transform: scale(0.94); }
.topnav .theme-btn { padding:0; width:36px; font-size:1rem; }
.topnav .theme-btn .sun { display:none; }
:root[data-theme="dark"] .topnav .theme-btn .moon { display:none; }
:root[data-theme="dark"] .topnav .theme-btn .sun { display:inline; }

/* ---------- View tabs (top-level) ---------- */
.view { animation: fadeInUp .4s ease-out both; }
.view[hidden] { display:none; }

/* ---------- Map + sidebar ---------- */
.container { display:flex; gap:20px; padding:24px; flex-wrap:wrap; }
.map-frame { position:relative; flex:2 1 600px; min-width:300px; }
#map {
  height:620px; border-radius: var(--radius-lg); border:1px solid var(--line);
  box-shadow: var(--shadow-md); overflow:hidden;
  transition: border-color .35s ease, box-shadow .35s ease;
}

.sidebar-col { flex: 1 1 320px; min-width:300px; display:flex; flex-direction:column; }
.sidebar { max-height: clamp(420px, 65vh, 620px); overflow-y:auto; padding:2px 6px 2px 2px; }

/* ---------- Tabs (segmented control) ---------- */
.tabs {
  display:flex; gap:4px; background: var(--surface-2); border-radius: var(--radius-md);
  padding:4px; margin-bottom:12px; transition: background-color .35s ease;
}
.tab-btn {
  flex:1; background:none; border:none; border-radius: var(--radius-sm);
  font-family:var(--font-sans); font-size:0.8rem; font-weight:600;
  color:var(--muted); padding:9px 8px; cursor:pointer;
  transition: color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.tab-btn:hover { color: var(--ink-soft); }
.tab-btn.active { color: var(--ink); background: var(--card); box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .tab-btn.active { color: var(--text); }

/* ---------- Sub-tabs (Pontos Parada AR) ---------- */
.sidebar-stops { display:flex; flex-direction:column; }
.sidebar-stops[hidden] { display:none; }
.subtabs {
  display:flex; gap:6px; flex-wrap:nowrap; overflow-x:auto; margin-bottom:10px;
  padding-bottom:2px; scrollbar-width:thin;
}
.subtab-btn {
  background: var(--surface-2); border:1px solid var(--line); border-radius:999px;
  font-family:var(--font-sans); font-size:0.78rem; font-weight:500;
  color:var(--muted); padding:7px 14px; cursor:pointer; flex-shrink:0; white-space:nowrap;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.subtab-btn:hover { color:var(--ink-soft); border-color:var(--ink-soft); }
.subtab-btn.active { color:var(--card); background:var(--accent); border-color:var(--accent); font-weight:700; }
.sub-panel { max-height: clamp(380px, 60vh, 580px); overflow-y:auto; padding:2px 6px 2px 2px; }

/* ---------- Footer ---------- */
footer {
  background: var(--ink); color:#aab1c2; padding: 22px 24px 36px;
  font-family:var(--font-mono); font-size:0.76rem; line-height:1.8;
}
footer a { color: var(--brass); }
footer code { background:rgba(241,231,210,0.08); padding:2px 6px; border-radius:3px; color:var(--paper); }
