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

body {
    font-family: 'Inter', sans-serif;
    background: #f7f7f4;
    color: #1a1a1a;
    font-size: 15px;
    line-height: 1.5;
}

.dashboard { max-width: 1600px; margin: 0 auto; padding: 0 20px 56px; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 40px 0 24px;
    border-bottom: 2px solid #2d6a4f;
    margin-bottom: 28px;
}
.header h1   { font-size: 30px; font-weight: 600; color: #1a3a2a; letter-spacing: -0.5px; }
.header p    { font-size: 13px; color: #777; margin-top: 5px; }
.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}
.header-source { font-size: 12px; color: #999; }
.header-source a { color: #2d6a4f; text-decoration: none; }
.header-source a:hover { text-decoration: underline; }

/* ── Language toggle ─────────────────────────────────────────────────────── */
.lang-radio {
    display: inline-flex;
    border: 2px solid #2d6a4f;
    border-radius: 4px;
    overflow: hidden;
}
/* Dash RadioItems renders: .lang-radio > label > input + text */
.lang-radio label {
    font-size: 12px;
    font-weight: 700;
    color: #2d6a4f;
    cursor: pointer;
    padding: 5px 16px;
    transition: background 0.15s, color 0.15s;
    user-select: none;
    line-height: 1.8;
    display: inline-block;
    border-right: 1px solid #2d6a4f;
}
.lang-radio label:last-child { border-right: none; }
.lang-radio input[type="radio"] { display: none; }
/* Active: label whose radio is checked */
.lang-radio label:has(input[type="radio"]:checked) {
    background: #2d6a4f;
    color: #fff;
}

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.filter-item { flex: 1; min-width: 180px; }
.filter-item label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    display: block;
    margin-bottom: 6px;
}

/* ── KPI cards ───────────────────────────────────────────────────────────── */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
.kpi-card {
    background: #fff;
    border: 1px solid #e8e8e5;
    border-radius: 6px;
    padding: 24px 28px;
}
.kpi-title {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 10px;
}
.kpi-value    { font-size: 34px; font-weight: 300; color: #1a3a2a; letter-spacing: -0.5px; }
.kpi-subtitle { font-size: 13px; color: #888; margin-top: 6px; }

/* ── Charts grid ─────────────────────────────────────────────────────────── */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
.chart-card {
    background: #fff;
    border: 1px solid #e8e8e5;
    border-radius: 6px;
    padding: 28px;
}
.chart-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 4px; color: #1a3a2a; }
.chart-sub     { font-size: 13px; color: #999; margin-bottom: 14px; }
.chart-card.full-width { grid-column: 1 / -1; }

/* ── Expand button ────────────────────────────────────────────────────────── */
.chart-card { position: relative; }
.expand-btn {
    position: absolute;
    top: 12px; right: 12px;
    width: 26px; height: 26px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    color: #bbb;
    font-size: 13px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    z-index: 10;
    padding: 0;
    font-family: 'Inter', sans-serif;
}
.expand-btn:hover { color: #2d6a4f; border-color: #2d6a4f; }

/* ── Map controls ─────────────────────────────────────────────────────────── */
.map-controls { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.map-ctrl-btn {
    padding: 5px 16px;
    border: 1px solid #2d6a4f;
    border-radius: 4px;
    background: white;
    color: #2d6a4f;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.map-ctrl-btn:hover { background: #2d6a4f; color: #fff; }

/* ── Simulation context banner ────────────────────────────────────────────── */
.sim-context {
    background: #f4f8f5;
    border-left: 3px solid #2d6a4f;
    border-radius: 0 4px 4px 0;
    padding: 10px 16px;
    font-size: 12px;
    color: #555;
    margin-bottom: 16px;
    line-height: 1.55;
}

/* ── Modal overlay ────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10,20,15,0.72);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.modal-box {
    background: #fff;
    border-radius: 8px;
    width: 93%;
    max-width: 1300px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px 32px;
    position: relative;
    box-shadow: 0 24px 64px rgba(0,0,0,0.32);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #2d6a4f;
}
.modal-header h3 { font-size: 19px; font-weight: 600; color: #1a3a2a; margin-bottom: 0; }
.modal-close-btn {
    border: 1px solid #ddd;
    background: #f5f5f3;
    border-radius: 4px;
    padding: 6px 18px;
    cursor: pointer;
    font-size: 12px;
    color: #555;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: all 0.15s;
    letter-spacing: 0.02em;
}
.modal-close-btn:hover { background: #ececea; }
.modal-body { display: flex; gap: 28px; align-items: flex-start; }
.modal-chart { flex: 3; min-width: 0; }
.modal-lesehilfe {
    flex: 1;
    min-width: 220px;
    max-width: 300px;
    font-size: 13px;
    line-height: 1.65;
    color: #555;
    border-left: 3px solid #2d6a4f;
    padding: 4px 0 0 20px;
}
.modal-lesehilfe::before {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2d6a4f;
    margin-bottom: 16px;
}
body[data-lang="de"] .modal-lesehilfe::before { content: "ℹ  Lesehilfe"; }
body[data-lang="en"] .modal-lesehilfe::before { content: "ℹ  Reading Guide"; }
body[data-lang="pt"] .modal-lesehilfe::before { content: "ℹ  Guia de Leitura"; }
body:not([data-lang]) .modal-lesehilfe::before { content: "ℹ  Lesehilfe"; }
.modal-lesehilfe h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #2d6a4f;
    margin: 16px 0 6px;
}
.modal-lesehilfe h4:first-child { margin-top: 0; }
.modal-lesehilfe p { margin-bottom: 10px; }
.modal-lesehilfe a { color: #2d6a4f; }

/* ── Inline Lesehilfe (below each full-width chart) ─────────────────────── */
.chart-lesehilfe {
    margin-top: 20px;
    padding: 16px 20px;
    border-left: 3px solid #2d6a4f;
    background: #f4f8f5;
    border-radius: 0 4px 4px 0;
    font-size: 13px;
    line-height: 1.65;
    color: #555;
}
.chart-lesehilfe::before {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2d6a4f;
    margin-bottom: 14px;
}
body[data-lang="de"] .chart-lesehilfe::before { content: "ℹ  Lesehilfe"; }
body[data-lang="en"] .chart-lesehilfe::before { content: "ℹ  Reading Guide"; }
body[data-lang="pt"] .chart-lesehilfe::before { content: "ℹ  Guia de Leitura"; }
body:not([data-lang]) .chart-lesehilfe::before { content: "ℹ  Lesehilfe"; }
.chart-lesehilfe h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #2d6a4f;
    margin: 14px 0 5px;
}
.chart-lesehilfe h4:first-child { margin-top: 0; }
.chart-lesehilfe p { margin-bottom: 8px; }
.chart-lesehilfe p:last-child { margin-bottom: 0; }
.chart-lesehilfe a { color: #2d6a4f; }

/* ── Simulation ──────────────────────────────────────────────────────────── */
.simulation-section {
    background: #fff;
    border: 1px solid #e8e8e5;
    border-radius: 6px;
    padding: 28px;
    margin-bottom: 24px;
}
.simulation-section h2 {
    font-size: 17px;
    font-weight: 600;
    color: #1a3a2a;
    margin-bottom: 24px;
}
.sim-controls  { display: flex; gap: 36px; flex-wrap: wrap; margin-bottom: 20px; }
.sim-slider    { flex: 1; min-width: 220px; }
.sim-slider label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    display: block;
    margin-bottom: 10px;
}
.sim-presets   { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.sim-presets button {
    padding: 6px 18px;
    border-radius: 4px;
    border: 1px solid #2d6a4f;
    background: #fff;
    color: #2d6a4f;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.sim-presets button:hover { background: #2d6a4f; color: #fff; }

/* Active heatmap metric pill */
.heatmap-pill-active,
.sim-presets button.heatmap-pill-active {
    background: #2d6a4f;
    color: #fff;
}
.sim-result {
    background: #f4f8f5;
    border-radius: 4px;
    padding: 12px 16px;
    font-size: 13px;
    color: #1a3a2a;
    margin-bottom: 16px;
    min-height: 40px;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
    border-top: 1px solid #e8e8e5;
    padding: 20px 0;
    font-size: 11px;
    color: #aaa;
}

/* ── Simulation projected KPIs ────────────────────────────────────────────── */
.sim-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.sim-kpi-card {
    background: #f4f8f5;
    border: 1px solid #c8ddd0;
    border-radius: 4px;
    padding: 14px 18px;
}
.sim-kpi-label {
    font-size: 10px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 6px;
}
.sim-kpi-val {
    font-size: 22px;
    font-weight: 300;
    color: #1a3a2a;
    letter-spacing: -0.3px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
    .kpi-row     { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .chart-card.full-width { grid-column: 1; }
    .sim-controls { flex-direction: column; }
    .sim-kpi-row  { grid-template-columns: 1fr; }
    .modal-body { flex-direction: column; }
    .modal-lesehilfe {
        max-width: 100%;
        border-left: none;
        padding: 16px 0 0 0;
        border-top: 3px solid #2d6a4f;
    }
}
@media (max-width: 540px) {
    .kpi-row { grid-template-columns: 1fr; }
}
