/* ═══════════════════════════════════════════════════════════════════════
   Übersicht, Befundliste und Herkunft der Referenzbereiche
   ═══════════════════════════════════════════════════════════════════════ */

.dash-head h1 { margin: 0 0 0.2rem; }
.dash-head p { margin: 0 0 0.9rem; }

/* Zwei Filterzeilen: Domäne und Status. Am Telefon scrollen beide waagerecht. */
.filters {
    position: sticky; top: 3.4rem; z-index: 20;
    background: var(--bg);
    padding: 0.4rem 0 0.5rem;
    margin-bottom: 0.6rem;
}
.filters .chips {
    display: flex; gap: 0.4rem;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 0.35rem;
    scrollbar-width: none;
}
.filters .chips::-webkit-scrollbar { display: none; }
.filters .chips .chip { flex: none; white-space: nowrap; }
.view-toggle { margin-left: auto; }

/* Herkunft des Massstabs — der wichtigste Unterschied auf dieser Seite.
   Ein Laborbereich ist geprüft, ein allgemeiner Richtwert nicht, und der
   eigene Normalbereich sagt nur "ungewöhnlich für dich". */
.ref-src {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.02rem 0.35rem;
    font-size: 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
}
.ref-lab       { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.ref-published { background: color-mix(in srgb, var(--primary) 20%, transparent); color: var(--primary); }
.ref-baseline  { background: var(--border); color: var(--text-muted); }

.mk-when { display: block; font-size: 0.7rem; color: var(--text-muted); margin-top: 0.15rem; }
.st-badge-none { background: var(--border); color: var(--text-muted); }

/* Werte ohne Massstab bleiben unauffällig — keine erfundene Ampel. */
.marker.f-unknown { border-left-color: var(--border); }

/* --- Kompakte Listendarstellung -------------------------------------- */
.dash.is-list .markers {
    display: flex; flex-direction: column; gap: 1px;
    background: var(--border); border-radius: 8px; overflow: hidden;
}
.dash.is-list .marker {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.7rem;
    border: 0; border-radius: 0;
    background: var(--bg-elev);
    min-height: 44px;
}
.dash.is-list .mk-head { display: contents; }
.dash.is-list .mk-name { font-size: 0.88rem; }
.dash.is-list .mk-value { font-size: 0.9rem; text-align: right; white-space: nowrap; }
.dash.is-list .mk-ref,
.dash.is-list .mk-bar,
.dash.is-list .mk-advice { display: none; }
.dash.is-list .st-badge { justify-self: end; }

/* --- Befundliste ------------------------------------------------------ */
.event-list { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0; }
.event-row {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.75rem 0.85rem;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 9px;
    text-decoration: none; color: var(--text);
    min-height: 44px;
}
.event-row:active { background: var(--bg-card); }
.ev-ic { font-size: 1.4rem; flex: none; }
.ev-body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; flex: 1; }
.ev-title { font-weight: 600; font-size: 0.95rem; }
.ev-meta { font-size: 0.76rem; color: var(--text-muted); }
.ev-badge {
    flex: none;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 767px) {
    .filters { top: 3.6rem; }
    .ev-badge { font-size: 0.66rem; padding: 0.15rem 0.4rem; }
    .dash.is-list .marker { grid-template-columns: 1fr auto auto; }
}
@media (min-width: 768px) {
    .filters { top: 4rem; }
}

/* --- Einstieg in die Gesamtauswertung --------------------------------- */
.dash-head { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.4rem; }
.dash-cta { align-self: stretch; text-align: center; }

.overall-teaser {
    display: flex; gap: 0.7rem; align-items: flex-start;
    padding: 0.8rem 0.9rem;
    margin-bottom: 0.9rem;
    background: color-mix(in srgb, var(--primary) 8%, var(--bg-elev));
    border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
    border-radius: 10px;
    text-decoration: none; color: var(--text);
}
.overall-teaser:active { background: color-mix(in srgb, var(--primary) 14%, var(--bg-elev)); }
.ot-ic { font-size: 1.2rem; flex: none; line-height: 1.3; }
.ot-body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.ot-text { font-size: 0.9rem; line-height: 1.5; }
.ot-meta { font-size: 0.72rem; color: var(--text-muted); }

@media (min-width: 768px) {
    .dash-head { flex-direction: row; align-items: flex-start; justify-content: space-between; }
    .dash-cta { align-self: auto; }
}

/* --- Diagramm: waagerecht scrollbar ----------------------------------- */
.chart-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 0.5rem 0.4rem;
}
.chart-inner { height: 260px; position: relative; }
.chart-hint { margin: 0.35rem 0 0.9rem; }
.range-info { align-self: center; font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }

/* --- Kennzahlen zur Reihe --------------------------------------------- */
.series-stats { margin: 0.8rem 0; }
.ss-label {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.82rem; font-weight: 600; margin-bottom: 0.35rem;
}
.ss-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--series-color); }
.stat-d { font-weight: 400; opacity: 0.75; }
.stat-avg { border-color: var(--primary); }
.ch-up { color: var(--warn); }
.ch-down { color: var(--low); }

@media (min-width: 768px) {
    .chart-inner { height: 320px; }
}

/* --- Kennzahlen: Differenz gehört zu ihrem Paar ----------------------- */
.stat-pair {
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-elev);
    overflow: hidden;
}
.sp-head {
    padding: 0.35rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--border) 40%, transparent);
}
.sp-body {
    display: grid;
    grid-template-columns: 1fr auto 1fr 1fr;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem;
}
.sp-body .stat { border: 0; background: transparent; padding: 0.3rem 0.2rem; }
.sp-arrow { color: var(--text-muted); font-size: 1rem; padding: 0 0.1rem; }
.stat-delta {
    border-left: 1px solid var(--border) !important;
    border-radius: 0 !important;
}
.stat-wide {
    display: block;
    text-align: left;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.5rem;
}
.stat-wide .stat-v { font-size: 1.25rem; }
.stat-u { font-size: 0.8rem; font-weight: 400; color: var(--text-muted); }
.ch-good { color: var(--ok); }
.ch-bad  { color: var(--high); }

/* --- Eigener Zeitraum ------------------------------------------------- */
.custom-range {
    display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end;
    padding: 0.8rem;
    margin-bottom: 0.9rem;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 9px;
}
.custom-range label {
    display: flex; flex-direction: column; gap: 0.25rem;
    font-size: 0.78rem; color: var(--text-muted);
}
.custom-range input[type=date] {
    padding: 0.5rem 0.6rem; min-height: 44px;
    border: 1px solid var(--border); border-radius: 7px;
    background: var(--bg); color: var(--text);
    font-size: 1rem;   /* unter 16px zoomt iOS beim Antippen hinein */
}
.custom-range .btn { min-height: 44px; }

@media (max-width: 480px) {
    .sp-body { grid-template-columns: 1fr auto 1fr; }
    .sp-body .stat-delta {
        grid-column: 1 / -1;
        border-left: 0 !important;
        border-top: 1px solid var(--border) !important;
        padding-top: 0.45rem !important;
    }
    .custom-range label { flex: 1 1 45%; }
    .custom-range .btn { flex: 1 1 100%; text-align: center; }
}
