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

:root {
    --sidebar-w:    240px;
    --topbar-h:     54px;
    --nav:          #1a1a2e;
    --nav-hover:    rgba(255,255,255,0.08);
    --nav-active:   rgba(59,130,246,0.18);
    --nav-active-b: #3b82f6;
    --accent:       #3b82f6;
    --success:      #22c55e;
    --error:        #ef4444;
    --warning:      #f59e0b;
    --text:         #1e293b;
    --muted:        #64748b;
    --border:       #e2e8f0;
    --bg:           #f0f2f5;
    --white:        #ffffff;
    --shadow:       0 1px 4px rgba(0,0,0,0.08);
    --shadow-md:    0 4px 16px rgba(0,0,0,0.10);
    --r:            10px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────────── */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--nav);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.brand-icon { font-size: 22px; }
.brand-text {
    font-size: 15.5px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 10px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 4px 10px 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 7px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
    user-select: none;
}
.nav-item:hover { background: var(--nav-hover); color: rgba(255,255,255,0.9); }
.nav-item.active {
    background: var(--nav-active);
    color: white;
    border-left: 3px solid var(--nav-active-b);
    padding-left: 7px;
}
.nav-item.nav-disabled { cursor: default; opacity: 0.5; }
.nav-item.nav-disabled:hover { background: none; color: rgba(255,255,255,0.65); }

.nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }

.badge-soon {
    margin-left: auto;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.user-name { font-size: 13px; color: rgba(255,255,255,0.7); font-weight: 500; }
.sidebar-logout {
    font-size: 12.5px;
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    transition: color 0.15s;
}
.sidebar-logout:hover { color: rgba(255,255,255,0.8); }

/* ── Main Area ───────────────────────────────────────────────── */
.main-area {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}
.breadcrumb-home { color: var(--muted); text-decoration: none; }
.breadcrumb-home:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--border); }
.page-breadcrumb a { color: var(--muted); text-decoration: none; }
.page-breadcrumb a:hover { color: var(--accent); }

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
    padding: 24px 28px 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.page-title   { font-size: 22px; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ── Content ─────────────────────────────────────────────────── */
.content { padding: 0 28px 40px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    padding: 8px 18px;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    line-height: 1;
}
.btn:hover:not(:disabled) { filter: brightness(0.92); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--nav); color: white; }
.btn-accent  { background: var(--accent); color: white; }
.btn-outline { background: white; color: var(--text); border: 1.5px solid var(--border); }

/* ── Filter Bar ──────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--white);
    padding: 16px 20px;
    border-radius: var(--r);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.filter-select {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-size: 13px;
    color: var(--text);
    background: var(--white);
    cursor: pointer;
    outline: none;
    min-width: 150px;
    transition: border-color 0.15s;
}
.filter-select:focus { border-color: var(--accent); }

/* ── KPI Grid ────────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--white);
    border-radius: var(--r);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 4px solid transparent;
}
.kpi-blue   { border-left-color: #3b82f6; }
.kpi-indigo { border-left-color: #6366f1; }
.kpi-rose   { border-left-color: #f43f5e; }
.kpi-teal   { border-left-color: #14b8a6; }

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}
.kpi-blue   .kpi-icon { background: #eff6ff; color: #3b82f6; }
.kpi-indigo .kpi-icon { background: #eef2ff; color: #6366f1; }
.kpi-rose   .kpi-icon { background: #fff1f2; color: #f43f5e; }
.kpi-teal   .kpi-icon { background: #f0fdfa; color: #14b8a6; }

.kpi-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }

/* ── Charts Grid ─────────────────────────────────────────────── */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--white);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    padding: 20px;
}
.chart-card-wide { /* takes up 2 columns – handled by grid */ }
.chart-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.chart-title { font-size: 15px; font-weight: 600; color: var(--text); }
.chart-year-badge {
    margin-left: auto;
    background: #eff6ff;
    color: #3b82f6;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 10px;
}
.chart-sub { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.chart-container { position: relative; }

/* ── Data Table ──────────────────────────────────────────────── */
.table-card {
    background: var(--white);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}
.table-card-head {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    background: #f8fafc;
    padding: 11px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 11px 16px;
    font-size: 13px;
    border-bottom: 1px solid #f8fafc;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }
.text-right  { text-align: right; }
.font-mono   { font-family: 'SF Mono', 'Cascadia Code', monospace; }

.pg-code { font-weight: 600; color: var(--text); }
.pg-text  { margin-left: 8px; font-size: 12.5px; color: var(--muted); }

.progress-bar-wrap {
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #6366f1);
    border-radius: 3px;
    transition: width 0.4s ease;
    min-width: 1px;
}

/* ── Report Dashboard Grid ───────────────────────────────────── */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.report-card {
    background: var(--white);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s;
    border: 1.5px solid transparent;
}
.report-card:hover:not(.report-card-disabled) {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.report-card-disabled { opacity: 0.6; cursor: default; }

.report-card-icon {
    width: 48px;
    height: 48px;
    background: #eff6ff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.report-card-body { flex: 1; }
.report-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.report-card-title { font-size: 15px; font-weight: 600; }
.report-card-desc  { font-size: 13px; color: var(--muted); line-height: 1.5; }
.report-card-arrow { font-size: 20px; color: var(--accent); font-weight: 300; }

.badge-active {
    font-size: 10.5px;
    font-weight: 700;
    background: #dcfce7;
    color: #15803d;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}
.empty-icon { font-size: 36px; margin-bottom: 12px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 960px) {
    .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .sidebar { transform: translateX(-100%); }
    .main-area { margin-left: 0; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-bar { flex-direction: column; align-items: stretch; }
}
