* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: #0f172a;
    color: #e2e8f0;
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.logo {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid #1e293b;
}

.logo h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.logo .subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.nav-links {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
}

.nav-links li a {
    display: block;
    padding: 0.6rem 1.5rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.nav-links li a:hover,
.nav-links li.active a {
    color: #fff;
    background: #1e293b;
}

.nav-divider {
    height: 1px;
    background: #1e293b;
    margin: 0.5rem 1.5rem;
}

.nav-section-label {
    padding: 0.5rem 1.5rem 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #64748b;
}

.corporate-links {
    padding: 0 !important;
}

.corporate-links li a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.5rem;
    font-size: 0.82rem;
}

.corp-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #1e293b;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.15s;
}

.corporate-links li a:hover .corp-icon {
    background: #2563eb;
    color: #fff;
}

.nav-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #1e293b;
}

.etl-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #475569;
}

.status-dot.ok { background: #22c55e; }
.status-dot.warn { background: #f59e0b; }
.status-dot.error { background: #ef4444; }

/* Main content */
.content {
    flex: 1;
    margin-left: 220px;
    padding: 2rem;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
}

.top-bar-left {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.top-bar h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.range-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.range-presets {
    display: flex;
    gap: 0.25rem;
    background: #e2e8f0;
    border-radius: 8px;
    padding: 3px;
}

.range-btn {
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    transition: all 0.15s;
}

.range-btn:hover {
    background: #fff;
    color: #1e293b;
}

.range-btn.active {
    background: #2563eb;
    color: #fff;
}

.range-custom {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.range-sep {
    font-size: 0.82rem;
    color: #94a3b8;
}

.range-apply {
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #2563eb;
    background: #fff;
    color: #2563eb;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.range-apply:hover {
    background: #2563eb;
    color: #fff;
}

.range-arrows {
    display: flex;
    gap: 0.35rem;
}

.date-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.date-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #e2e8f0;
    color: #1e293b;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    transition: background 0.15s;
}

.date-arrow:hover {
    background: #2563eb;
    color: #fff;
}

.date-input {
    font-family: inherit;
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #1e293b;
    background: #fff;
}

.date-display {
    font-size: 0.95rem;
    color: #64748b;
}

/* Summary cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.card.highlight {
    background: #2563eb;
    color: #fff;
}

.card.highlight .card-sub { color: #bfdbfe; }

.card.warn .card-value { color: #dc2626; }

.card-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.card-sub {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}

/* Data tables */
.data-section {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
}

.data-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tfoot td {
    border-top: 2px solid #e2e8f0;
    border-bottom: none;
    background: #f8fafc;
}

.office-name {
    font-weight: 600;
}

.warn-cell {
    color: #dc2626;
    font-weight: 600;
}

.sub-val {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 400;
}

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chart-container h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Data source grid */
.source-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.source-card {
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.source-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.source-status {
    font-size: 0.8rem;
    padding: 0.2rem 0.75rem;
    border-radius: 100px;
    display: inline-block;
}

.source-status.loading { background: #dbeafe; color: #2563eb; }
.source-status.ok { background: #dcfce7; color: #16a34a; }
.source-status.pending { background: #f1f5f9; color: #94a3b8; }
.source-status.error { background: #fee2e2; color: #dc2626; }

/* Data health alert banner */
.data-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #dc2626;
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1.5rem;
    font-size: 0.88rem;
    color: #7f1d1d;
    line-height: 1.45;
}

.data-alert-icon { font-size: 1.2rem; line-height: 1.2; }

.data-alert-body a {
    color: #b91c1c;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    margin-left: 0.25rem;
}

.data-alert-body a:hover { text-decoration: underline; }

/* Section subtitle */
.section-sub {
    font-size: 0.82rem;
    color: #94a3b8;
    margin: -0.5rem 0 1rem;
    max-width: 75ch;
    line-height: 1.45;
}

/* Status badges */
.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 100px;
}

.badge-ok { background: #dcfce7; color: #16a34a; }
.badge-warn { background: #fef9c3; color: #a16207; }
.badge-stale { background: #fee2e2; color: #dc2626; }
.badge-unknown { background: #f1f5f9; color: #94a3b8; }

/* Partial-coverage marker (e.g. Kasper data incomplete for the period) */
.partial-val {
    color: #a16207;
    font-style: italic;
    font-weight: 500;
    cursor: help;
}

.th-note {
    font-weight: 400;
    text-transform: none;
    color: #cbd5e1;
    font-size: 0.7rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .charts-row { grid-template-columns: 1fr; }
    .source-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .content { margin-left: 0; }
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
}
