/* ── Base ──────────────────────────────────────────────── */
:root {
    --ku: #1e3a5f;      /* Kürschner – dunkelblau */
    --hs: #0ea5e9;      /* HubSpot    – hellblau  */
    --vu: #10b981;      /* VU         – grün      */
    --warn: #f59e0b;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
}
main { flex: 1; }

/* ── Navbar ────────────────────────────────────────────── */
.navbar {
    background: var(--ku) !important;
    border-bottom: 3px solid var(--hs);
    padding: 0.6rem 1rem;
}
.navbar-brand {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 0.03em;
    color: #fff !important;
}
.navbar-brand small {
    font-weight: 400;
    font-size: 0.7rem;
    opacity: 0.6;
    display: block;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.nav-link { color: rgba(255,255,255,0.75) !important; font-size: 0.85rem; padding: 0.5rem 0.85rem !important; }
.nav-link:hover, .nav-link.active { color: #fff !important; }
.nav-link.active { border-bottom: 2px solid var(--hs); }

/* ── Page header ────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; margin: 0 0 0.2rem; }
.page-header p { color: var(--muted); margin: 0; font-size: 0.85rem; }

/* ── Stat tiles ─────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.stat-tile {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem 0.9rem;
    position: relative;
    overflow: hidden;
}
.stat-tile::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.stat-tile.ku::before { background: var(--ku); }
.stat-tile.hs::before { background: var(--hs); }
.stat-tile.vu::before { background: var(--vu); }
.stat-tile.warn::before { background: var(--warn); }
.stat-tile.danger::before { background: var(--danger); }

.stat-tile .label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.3rem;
}
.stat-tile .value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}
.stat-tile .sub {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 0.3rem;
}
.stat-tile a.stretched-link::after { z-index: 1; }

/* ── Source badge ───────────────────────────────────────── */
.src-ku { background: var(--ku); color: #fff; font-size: 0.65rem; padding: 1px 6px; border-radius: 4px; }
.src-hs { background: var(--hs); color: #fff; font-size: 0.65rem; padding: 1px 6px; border-radius: 4px; }
.src-vu { background: var(--vu); color: #fff; font-size: 0.65rem; padding: 1px 6px; border-radius: 4px; }
.src-miss { background: var(--danger); color: #fff; font-size: 0.65rem; padding: 1px 6px; border-radius: 4px; }

/* ── Card ───────────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(15,23,42,.04);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.7rem 1rem;
    color: var(--text);
}
.card-body { padding: 1rem; }

/* ── Tabs ───────────────────────────────────────────────── */
.nav-tabs { border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; }
.nav-tabs .nav-link {
    color: var(--muted) !important;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 0;
    background: none;
}
.nav-tabs .nav-link:hover { color: var(--text) !important; }
.nav-tabs .nav-link.active {
    color: var(--ku) !important;
    border-bottom-color: var(--ku);
    font-weight: 700;
}

/* ── Parliament breakdown bar ───────────────────────────── */
.parl-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
    gap: 2px;
}
.parl-bar span { flex: 1; min-width: 4px; }

/* ── Table ──────────────────────────────────────────────── */
.table { font-size: 0.82rem; margin: 0; }
.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding: 0.5rem 0.75rem;
    position: sticky;
    top: 0;
    z-index: 2;
}
.table td { padding: 0.45rem 0.75rem; border-color: var(--border); vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }
.table-scroll-x {
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}
.table-scroll-x table {
    min-width: 1800px;
    white-space: nowrap;
}

/* Sticky first two columns in horizontally scrollable tables */
.table-sticky-cols th:nth-child(1),
.table-sticky-cols td:nth-child(1) {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #fff;
}
.table-sticky-cols th:nth-child(2),
.table-sticky-cols td:nth-child(2) {
    position: sticky;
    left: 110px;
    z-index: 3;
    background: #fff;
}
.table-sticky-cols thead th:nth-child(1),
.table-sticky-cols thead th:nth-child(2) {
    z-index: 4;
    background: #f8fafc;
}
.table-sticky-cols th:nth-child(1),
.table-sticky-cols td:nth-child(1) {
    min-width: 110px;
    max-width: 110px;
}
.table-sticky-cols th:nth-child(2),
.table-sticky-cols td:nth-child(2) {
    min-width: 220px;
}
.table-sticky-cols td:nth-child(1),
.table-sticky-cols td:nth-child(2),
.table-sticky-cols th:nth-child(1),
.table-sticky-cols th:nth-child(2) {
    box-shadow: 1px 0 0 var(--border);
}

/* ── Filter bar ─────────────────────────────────────────── */
.filter-bar {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem 1rem;
    margin-bottom: 0.9rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-bar .form-control,
.filter-bar .form-select { font-size: 0.82rem; padding: 0.3rem 0.6rem; }

/* ── Diff badge ─────────────────────────────────────────── */
.badge-zugang { background: #dcfce7; color: #166534; }
.badge-abgang { background: #fee2e2; color: #991b1b; }
.badge-warn   { background: #fef9c3; color: #854d0e; }

/* ── Comparison table cell colour ───────────────────────── */
td.ok   { background: #f0fdf4; }
td.miss { background: #fef2f2; }
td.diff { background: #fffbeb; }

/* ── Misc ───────────────────────────────────────────────── */
code { font-size: 0.8em; color: var(--ku); }
pre { white-space: pre-wrap; word-break: break-word; font-size: 0.78rem; }
.text-ku { color: var(--ku); }
.text-hs { color: var(--hs); }
.text-vu { color: var(--vu); }
a { color: var(--ku); }
a:hover { color: var(--hs); }
.btn-primary { background: var(--ku); border-color: var(--ku); }
.btn-primary:hover { background: #152d4a; border-color: #152d4a; }
.btn-outline-primary { color: var(--ku); border-color: var(--ku); }
.btn-outline-primary:hover { background: var(--ku); color: #fff; }
.result-count { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.5rem; }
