/*
 * Farbschema aus CLAUDE_1.md Abschnitt 13, erweitert um das Redesign aus
 * design-drafts/ASV-App UI Redesign.html (Design/UI-Politur nach M6) - die
 * Primaerfarb-Skala ist unveraendert identisch, neu sind semantische
 * Flaechen-/Status-Token, Typografie (Fraunces/Public Sans, siehe
 * fonts.css) und abgerundetere Komponenten (Karten, Badges, Buttons).
 */
:root {
    --bs-primary: #1A80B6;
    --bs-primary-rgb: 26, 128, 182;

    --primary-50:  #EFF7FA;
    --primary-100: #D8EAF4;
    --primary-200: #B0D4E8;
    --primary-300: #7CBCDE;
    --primary-400: #42A3D7;
    --primary-500: #1A80B6;
    --primary-600: #166A98;
    --primary-700: #0F557B;
    --primary-800: #0A3F5C;

    --bs-body-bg: #F9FAFB;
    --bs-border-color: #DCE7ED;
    --bs-secondary-color: #5B6E76;
    --bs-body-color: #1D2930;
    --surface: #FFFFFF;

    --bs-success: #1E7A3D;
    --succ-bg: #E5F5EA;
    --succ: #1E7A3D;
    --bs-warning: #8A5A05;
    --warn-bg: #FDECD1;
    --warn: #8A5A05;
    --bs-danger: #D64545;
    --accent: #E8A93A;

    --bs-link-color: #1A80B6;
    --bs-link-hover-color: #166A98;

    --bs-body-font-family: 'Public Sans', system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-border-radius: .75rem;
    --bs-border-radius-lg: 1rem;
    --bs-border-radius-sm: .5rem;
}

body {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

h1, h2, h3, .font-serif {
    font-weight: 600;
}

a {
    color: #166a98;
    text-decoration: none;
    font-weight: 500;
}

.navbar-brand {
    color: var(--bs-primary);
}

/*
 * Shared presentation for every icon() SVG (see src/Support/helpers.php +
 * public/assets/icons/sprite.svg) - fill/stroke/stroke-* are inheritable SVG
 * properties, so setting them once here reaches every <use>-referenced
 * <symbol> path exactly like the old per-call inline attributes did. Only
 * width/height (vary per call) and viewBox (no CSS equivalent) stay inline.
 */
.icon {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn {
    --bs-btn-border-radius: .7rem;
}

.btn-primary {
    --bs-btn-bg: #1A80B6;
    --bs-btn-border-color: #1A80B6;
    --bs-btn-hover-bg: #166A98;
    --bs-btn-hover-border-color: #166A98;
}

/*
 * Bootstrap's compiled .btn-outline-primary bakes its own scoped
 * --bs-btn-* custom properties to a hardcoded #0d6efd at build time -
 * it never actually read --bs-primary, so every outline-primary button
 * in the app has been rendering in Bootstrap's default blue instead of
 * the theme color. Values below match the redesign mockup's outline
 * buttons (Profil/Digitaler Ausweis on Start, "Gewaesser" on Meine
 * Karten: border var(--p200), text var(--p700), white background).
 */
.btn-outline-primary {
    --bs-btn-color: var(--primary-700);
    --bs-btn-border-color: var(--primary-200);
    --bs-btn-hover-color: var(--primary-700);
    --bs-btn-hover-bg: var(--primary-50);
    --bs-btn-hover-border-color: var(--primary-300);
    --bs-btn-active-color: var(--primary-700);
    --bs-btn-active-bg: var(--primary-50);
    --bs-btn-active-border-color: var(--primary-300);
    --bs-btn-disabled-color: var(--primary-700);
    --bs-btn-disabled-border-color: var(--primary-200);
}

/* Same fix, for the "Zurueck"-style outline button seen on the Adminbereich mockup. */
.btn-outline-secondary {
    --bs-btn-color: var(--bs-secondary-color);
    --bs-btn-border-color: var(--bs-border-color);
    --bs-btn-hover-color: var(--bs-secondary-color);
    --bs-btn-hover-bg: var(--bs-body-bg);
    --bs-btn-hover-border-color: var(--bs-secondary-color);
    --bs-btn-active-color: var(--bs-secondary-color);
    --bs-btn-active-bg: var(--bs-body-bg);
    --bs-btn-active-border-color: var(--bs-secondary-color);
}

.card {
    --bs-card-border-color: var(--bs-border-color);
    --bs-card-border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(16, 42, 54, .05);
}

.badge {
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: .01em;
}

.text-bg-success {
    background-color: var(--succ-bg) !important;
    color: var(--succ) !important;
}

.text-bg-warning {
    background-color: var(--warn-bg) !important;
    color: var(--warn) !important;
}

.list-group-item {
    border-color: var(--bs-border-color);
}

/*
 * Icon-Badge + Titel/Subtitle + Chevron-Zeile - die im Redesign
 * durchgaengige Listen-/Menuezeile (Dashboard-Kacheln, Kartenliste,
 * Profil-Menue). Baut auf dem bestehenden .list-group-item auf, kein
 * komplett neues Komponentensystem.
 */
.icon-badge {
    width: 44px;
    height: 44px;
    border-radius: .75rem;
    background: var(--primary-50);
    color: var(--primary-700);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.icon-badge.icon-badge-muted {
    background: #EEF2F4;
    color: #8B979C;
}

/* Kleinere Variante fuer dichte Menuelisten (Adminbereich-Mockup). */
.icon-badge.icon-badge-sm {
    width: 34px;
    height: 34px;
    border-radius: .625rem;
}

.list-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: none;
}

.list-row .list-row-body {
    flex: 1 1 auto;
    min-width: 0;
}

.list-row .list-row-title {
    font-weight: 600;
    font-size: .95rem;
    display: block;
}

.list-row .list-row-subtitle {
    font-size: .8125rem;
    color: var(--bs-secondary-color);
    display: block;
}

.list-row .chevron {
    flex: none;
    color: var(--bs-secondary-color);
}

/* Runder Avatar-Ring (Profil-Header). */
.avatar-ring {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--primary-100);
    border: 3px solid var(--primary-500);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-700);
}

/* Stat-Kachel (Fangbuch-Uebersicht). */
.stat-tile {
    background: var(--surface);
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-tile .stat-tile-label {
    font-size: .75rem;
    color: var(--bs-secondary-color);
}

.stat-tile .stat-tile-value {
    font-weight: 600;
    font-size: 1.6rem;
    color: var(--primary-700);
}

/*
 * Mitgliederverwaltung (design-drafts/Mitgliederverwaltung - Desktop/Mobil):
 * rounded/bordered table card for the desktop row layout, plus a couple of
 * small badge modifiers shared with the mobile card layout of the same
 * data. Both layouts are rendered together and toggled with Bootstrap's
 * d-none/d-md-* utilities - see admin/members/index.php.
 */
.table-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    overflow: hidden;
    background: var(--surface);
}

.table-card table {
    --bs-table-border-color: var(--bs-border-color);
    margin-bottom: 0;
}

.table-card thead th {
    background: var(--primary-50);
    color: var(--primary-700);
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .02em;
    border-bottom: 1px solid var(--bs-border-color);
}

.member-self {
    background: var(--primary-50) !important;
}

.member-self.card {
    --bs-card-border-color: var(--primary-200);
}

.badge-you {
    background: var(--primary-600);
    color: #fff;
}

.badge-outline-primary {
    background: var(--surface);
    color: var(--primary-700);
    border: 1px solid var(--primary-200);
}

.badge-number {
    background: var(--primary-50);
    color: var(--primary-700);
}


/*
 * Auswertungen (design-drafts/Auswerung.html, Abschnitt "Auswertungen"):
 * Ringdiagramme mit Legende, Kennzahlen-Mini-Kacheln, ein Messbalken fuer
 * Quoten und ein gruppiertes Saeulendiagramm fuer die Faenge je Monat.
 * Alles serverseitig gerendert - die CSP erlaubt keine fremden Skripte,
 * und eine Diagramm-Bibliothek nur fuer diese Seite waere teuer erkauft.
 *
 * Die vier kategorialen Toene sind mit dem Pruefskript der dataviz-Skill
 * gegen die weisse Karte gerechnet (Helligkeitsband, Chroma, Trennung bei
 * Farbsehschwaeche ueber *alle* Paare, nicht nur benachbarte). Der vierte
 * Ton des Entwurfs (#EDA100) war von --cat2 selbst mit normalem Farbsehen
 * nicht zu unterscheiden (ΔE 7,8 bei einer Untergrenze von 15) und wurde
 * deshalb durch ein Pflaumenrot ersetzt. Mehr als vier Kategorien werden
 * zu "Sonstige" zusammengefasst, statt einen fuenften Ton zu erfinden.
 */
:root {
    --cat1: #1A80B6;
    --cat2: #CE8C18;
    --cat3: #1BAF7A;
    --cat4: #B3478B;
    --cat-other: var(--bs-border-color);
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 9px;
}

.legend-row .dot {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    flex: none;
}

.legend-row .legend-label {
    flex: 1 1 auto;
    font-size: .8125rem;
    color: var(--bs-body-color);
}

.legend-row .legend-val {
    font-size: .8125rem;
    font-weight: 700;
    color: var(--bs-body-color);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.legend-total {
    border-top: 1px solid var(--bs-border-color);
    padding-top: 8px;
}

.stat-mini {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.stat-mini .stat-mini-label {
    font-size: .71875rem;
    color: var(--bs-secondary-color);
    font-weight: 600;
}

.stat-mini .stat-mini-val {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bs-body-color);
}

/* Messbalken: Spur ein Schritt heller als die Fuellung, damit der Zustand
   ueber die ganze Breite lesbar bleibt. Der Wert steht immer als Text
   daneben - ohne ihn waere die helle Spur zu kontrastarm. */
.report-meter {
    flex: 1 1 auto;
    height: 10px;
    border-radius: 999px;
    background: var(--primary-100);
    overflow: hidden;
}

.report-meter > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--primary-500);
}

/* Zahlenspalten in Tabellen untereinander ausrichten - nie auf den grossen
   Werten der Kacheln, dort laesst gleiche Ziffernbreite "121" ausfransen. */
.report-num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.report-chart {
    display: flex;
    gap: 10px;
}

.report-chart .report-axis {
    flex: none;
    width: 26px;
    height: 160px;
    position: relative;
}

.report-chart .report-axis span {
    position: absolute;
    right: 0;
    font-size: .65625rem;
    color: var(--bs-secondary-color);
    font-variant-numeric: tabular-nums;
    transform: translateY(-50%);
}

.report-plot {
    flex: 1 1 auto;
    position: relative;
    height: 160px;
}

/* Hairlines, durchgezogen und eine Stufe neben der Flaeche: ein Raster darf
   nicht mitreden. */
.report-plot .report-grid {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid var(--bs-border-color);
}

.report-plot .report-baseline {
    border-top-color: var(--bs-secondary-color);
}

.report-columns {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
}

.report-columns .report-group {
    flex: 1 1 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    /* 2px Flaechenabstand zwischen benachbarten Saeulen - getrennt wird mit
       Luft, nicht mit einem Rahmen. */
    gap: 2px;
    height: 100%;
}

.report-columns .report-column {
    width: 10px;
    max-width: 24px;
    /* 4px gerundete Kappe, eckig an der Grundlinie */
    border-radius: 4px 4px 0 0;
    background: var(--cat1);
}

.report-months {
    display: flex;
    margin-left: 36px;
}

.report-months span {
    flex: 1 1 0;
    text-align: center;
    font-size: .65625rem;
    color: var(--bs-secondary-color);
}
