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

:root {
–bg:       #0f1117;
–surface:  #1a1d27;
–card:     #21253a;
–border:   #2e3350;
–accent:   #5b7cf6;
–accent2:  #38bdf8;
–green:    #34d399;
–yellow:   #fbbf24;
–red:      #f87171;
–text:     #e2e8f0;
–muted:    #64748b;
–radius:   12px;
–font:     ‘Segoe UI’, system-ui, -apple-system, sans-serif;
}

body {
font-family: var(–font);
background: var(–bg);
color: var(–text);
min-height: 100vh;
font-size: 14px;
line-height: 1.5;
}

/* ─── Header ────────────────────────────────────────────────────────────── */
.header {
background: var(–surface);
border-bottom: 1px solid var(–border);
padding: 14px 24px;
display: flex;
align-items: center;
gap: 16px;
flex-wrap: wrap;
position: sticky;
top: 0;
z-index: 100;
}

.header h1 { font-size: 1.15rem; font-weight: 700; flex: 1; min-width: 160px; }
.header h1 span { color: var(–accent); }

.header-controls {
display: flex;
gap: 8px;
align-items: center;
flex-wrap: wrap;
}

select, button {
background: var(–card);
border: 1px solid var(–border);
color: var(–text);
border-radius: 8px;
padding: 6px 12px;
font-size: 13px;
cursor: pointer;
font-family: var(–font);
transition: background .15s, border-color .15s;
}
select:hover, button:hover { border-color: var(–accent); }
button.primary {
background: var(–accent);
border-color: var(–accent);
color: #fff;
font-weight: 600;
}
button.primary:hover { background: #4a6ee0; }

.status-dot {
width: 8px; height: 8px;
border-radius: 50%;
background: var(–muted);
display: inline-block;
margin-right: 4px;
}
.status-dot.ok   { background: var(–green); }
.status-dot.err  { background: var(–red); }

/* ─── Route Chips ───────────────────────────────────────────────────────── */
.route-bar {
background: var(–surface);
border-bottom: 1px solid var(–border);
padding: 8px 24px;
display: flex;
gap: 8px;
flex-wrap: wrap;
}

.chip {
background: var(–card);
border: 1px solid var(–border);
color: var(–muted);
border-radius: 999px;
padding: 4px 14px;
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: all .15s;
white-space: nowrap;
}
.chip:hover  { border-color: var(–accent); color: var(–text); }
.chip.active { background: var(–accent); border-color: var(–accent); color: #fff; }

/* ─── Tab Bar ───────────────────────────────────────────────────────────── */
.tab-bar {
background: var(–surface);
border-bottom: 1px solid var(–border);
padding: 0 24px;
display: flex;
gap: 0;
overflow-x: auto;
}

.tab {
padding: 10px 18px;
font-size: 13px;
font-weight: 600;
color: var(–muted);
cursor: pointer;
border: none;
background: none;
border-bottom: 2px solid transparent;
transition: all .15s;
white-space: nowrap;
}
.tab:hover  { color: var(–text); }
.tab.active { color: var(–accent); border-bottom-color: var(–accent); }

/* ─── Main Content ──────────────────────────────────────────────────────── */
.content { padding: 24px; max-width: 1400px; margin: 0 auto; }

/* ─── Stat Cards ────────────────────────────────────────────────────────── */
.cards-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
gap: 16px;
margin-bottom: 24px;
}

.card {
background: var(–card);
border: 1px solid var(–border);
border-radius: var(–radius);
padding: 18px;
}

.card-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 12px;
}

.card-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(–muted); }
.card-badge {
font-size: 10px;
font-weight: 700;
padding: 2px 8px;
border-radius: 999px;
background: var(–surface);
color: var(–muted);
}
.badge-depart { background: #1e3a5f; color: var(–accent2); }
.badge-arrive { background: #1a3a2b; color: var(–green); }

.card-value { font-size: 2rem; font-weight: 700; color: var(–text); margin-bottom: 4px; }
.card-unit  { font-size: 12px; color: var(–muted); }

.card-stats {
display: flex;
gap: 16px;
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid var(–border);
}
.stat-item label { display: block; font-size: 10px; color: var(–muted); margin-bottom: 2px; }
.stat-item span  { font-size: 13px; font-weight: 600; }
.stat-best  { color: var(–green); }
.stat-worst { color: var(–red); }

/* ─── Section ───────────────────────────────────────────────────────────── */
.section { margin-bottom: 28px; }
.section-title {
font-size: 13px;
font-weight: 700;
color: var(–muted);
text-transform: uppercase;
letter-spacing: .07em;
margin-bottom: 14px;
}

/* ─── Charts ────────────────────────────────────────────────────────────── */
.chart-wrap {
background: var(–card);
border: 1px solid var(–border);
border-radius: var(–radius);
padding: 18px;
margin-bottom: 16px;
}

canvas { display: block; width: 100%; }

/* ─── Tables ────────────────────────────────────────────────────────────── */
.table-wrap {
background: var(–card);
border: 1px solid var(–border);
border-radius: var(–radius);
overflow: hidden;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
text-align: left;
padding: 10px 14px;
background: var(–surface);
font-size: 11px;
text-transform: uppercase;
letter-spacing: .06em;
color: var(–muted);
font-weight: 600;
border-bottom: 1px solid var(–border);
}
tbody tr { border-bottom: 1px solid var(–border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(91,124,246,.06); }
tbody td { padding: 9px 14px; vertical-align: middle; }

.td-route  { font-weight: 600; }
.td-road   { color: var(–accent2); font-size: 12px; }
.td-min    { color: var(–green); font-weight: 600; }
.td-max    { color: var(–red);   font-weight: 600; }
.td-avg    { font-weight: 600; }

.mini-badge {
font-size: 10px;
font-weight: 700;
padding: 2px 8px;
border-radius: 999px;
}

/* ─── Best Routes ───────────────────────────────────────────────────────── */
.best-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 16px;
}

.best-card {
background: var(–card);
border: 1px solid var(–border);
border-radius: var(–radius);
padding: 16px;
}

.best-card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}

.best-card-day   { font-size: 11px; color: var(–muted); font-weight: 600; text-transform: uppercase; }
.best-card-route { font-weight: 700; font-size: 1rem; }
.best-card-road  { color: var(–accent2); font-size: 12px; margin-top: 2px; }

.best-card-stats {
display: flex;
gap: 16px;
margin-top: 12px;
padding-top: 10px;
border-top: 1px solid var(–border);
}

.alts { margin-top: 10px; }
.alt-row {
display: flex;
justify-content: space-between;
font-size: 12px;
color: var(–muted);
padding: 3px 0;
border-bottom: 1px solid var(–border);
}
.alt-row:last-child { border-bottom: none; }
.alt-row span { color: var(–text); }

/* ─── Spinner / empty ───────────────────────────────────────────────────── */
.loading, .empty {
text-align: center;
padding: 60px 20px;
color: var(–muted);
font-size: 15px;
}

.spinner {
width: 36px; height: 36px;
border: 3px solid var(–border);
border-top-color: var(–accent);
border-radius: 50%;
animation: spin .8s linear infinite;
margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Schedule tags in Overview ─────────────────────────────────────────── */
.schedule-table { margin-top: 10px; font-size: 12px; color: var(–muted); }
.schedule-row   { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.schedule-tag {
background: var(–surface);
border: 1px solid var(–border);
border-radius: 6px;
padding: 2px 8px;
font-size: 11px;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
.header  { padding: 10px 14px; }
.content { padding: 14px; }
.tab     { padding: 8px 12px; font-size: 12px; }
}

