@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

/* ════════════════════════════════════════════════
   Fangmeldung – Design System v2 "Tiefes Wasser"
   Petrol/Tiefseegrün + Bernstein-Akzent, klare
   Flächen, ruhige Typographie (Manrope).
   ════════════════════════════════════════════════ */

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

:root {
    color-scheme: light;
    --bg: #f4f6f5;
    --bg-alt: #e9eeec;
    --bg2: #e9eeec;
    --surface: #ffffff;
    --surface-solid: #ffffff;
    --surface-hover: #f0f5f3;
    --text: #182622;
    --text-secondary: #4e635d;
    --text-muted: #7e928c;
    --primary: #0e7569;
    --primary-light: #e0f1ee;
    --primary-hover: #0a5d53;
    --primary-glow: rgba(14,117,105,0.16);
    --danger: #d6453d;
    --danger-hover: #b53229;
    --danger-light: #fdecea;
    --accent: #c2700a;
    --accent-light: #fcf0de;
    --border: #d8e0dd;
    --border-light: #e7ecea;
    --shadow-sm: 0 1px 2px rgba(24,38,34,0.05);
    --shadow: 0 1px 3px rgba(24,38,34,0.06), 0 6px 20px rgba(24,38,34,0.05);
    --shadow-lg: 0 4px 12px rgba(24,38,34,0.07), 0 16px 40px rgba(24,38,34,0.08);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --code-bg: #e4efec;
    --code-color: #0a5d53;
    --header-bg: rgba(255,255,255,0.88);
    --header-text: #182622;
    --header-border: rgba(24,38,34,0.08);
    --input-bg: #fafcfb;
    --row-stripe: #f7faf9;
    --row-hover: #edf4f2;
    --flash-success-bg: #e3f4ec;
    --flash-success-text: #135c40;
    --flash-success-border: #bfe5d2;
    --flash-error-bg: #fdecea;
    --flash-error-text: #92271f;
    --flash-error-border: #f5c6c1;
    --flash-info-bg: #e7f0f8;
    --flash-info-text: #1d4d6e;
    --flash-info-border: #c4dcee;
    --backdrop-blur: 14px;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1416;
    --bg-alt: #0f1b1e;
    --bg2: #0f1b1e;
    --surface: #122024;
    --surface-solid: #122024;
    --surface-hover: #182b30;
    --text: #e1eae7;
    --text-secondary: #9cb3ad;
    --text-muted: #627e77;
    --primary: #3cc0ae;
    --primary-light: rgba(60,192,174,0.13);
    --primary-hover: #5ad4c3;
    --primary-glow: rgba(60,192,174,0.18);
    --danger: #ef7068;
    --danger-hover: #d44f46;
    --danger-light: rgba(239,112,104,0.12);
    --accent: #eba24e;
    --accent-light: rgba(235,162,78,0.13);
    --border: #233a3e;
    --border-light: #1a2c30;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.25);
    --shadow: 0 2px 8px rgba(0,0,0,0.32);
    --shadow-lg: 0 6px 24px rgba(0,0,0,0.45);
    --code-bg: #16292c;
    --code-color: #6fd6c6;
    --header-bg: rgba(11,20,22,0.88);
    --header-text: #e1eae7;
    --header-border: rgba(255,255,255,0.07);
    --input-bg: #15262a;
    --row-stripe: #15262a;
    --row-hover: #1a2e33;
    --flash-success-bg: rgba(60,192,174,0.13);
    --flash-success-text: #7eddcd;
    --flash-success-border: rgba(60,192,174,0.28);
    --flash-error-bg: rgba(239,112,104,0.12);
    --flash-error-text: #f4a09a;
    --flash-error-border: rgba(239,112,104,0.25);
    --flash-info-bg: rgba(94,170,222,0.12);
    --flash-info-text: #93c5e8;
    --flash-info-border: rgba(94,170,222,0.25);
    --backdrop-blur: 16px;
}

html { scroll-behavior: smooth; }

body {
    font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s, color 0.3s;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, var(--primary-glow) 0%, transparent 65%);
    background-attachment: fixed;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Header ───────────────────────────────────── */
header {
    background: var(--header-bg);
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    border-bottom: 1px solid var(--header-border);
    color: var(--header-text);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s, border-color 0.3s;
}
.header-inner {
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.7rem 0;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: inherit;
}
.brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 11px;
    background: linear-gradient(140deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #fff;
    box-shadow: 0 2px 8px var(--primary-glow);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
header h1, .brand-title {
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -0.015em;
    white-space: nowrap;
    color: var(--text);
}
.brand-sub {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ── Theme Toggle ─────────────────────────────── */
.theme-btn {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    line-height: 1;
    transition: all 0.2s;
}
.theme-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: none; }

/* ── Nav ──────────────────────────────────────── */
nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
/* Header-Navigation: rechts vor dem Theme-Umschalter */
.header-nav { display: flex; align-items: center; margin-left: auto; }

/* ── QR-Codes immer mittig ────────────────────── */
/* qrcodejs setzt selbst display:block auf das <img> → text-align greift nicht,
   margin:auto zentriert es (auch in html2canvas). WICHTIG: display hier nicht
   überschreiben – das <canvas> wird von der Bibliothek per Inline-Style
   versteckt, ein !important darauf zeigt den QR doppelt. */
#qr-container { text-align: center; padding: 0.5rem 0; }
#qr-container img, #qr-container canvas { margin: 0 auto !important; }

/* ── Mitglieder-Sidebar (Desktop, wie Admin) ───── */
.member-shell .member-content { flex: 1; min-width: 0; }
@media (max-width: 900px) {
    .member-sidebar { display: none; }
    .member-shell { display: block; }
}
/* Desktop: Bereichs-Links wandern in die Sidebar → im Header ausblenden */
@media (min-width: 901px) {
    body:has(.member-sidebar) .header-nav nav .nav-area { display: none; }
}
.user-info {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    padding: 0.28rem 0.7rem;
    background: var(--primary-light);
    border-radius: 20px;
    border: 1px solid transparent;
    white-space: nowrap;
}

/* ── Main / Footer ────────────────────────────── */
main {
    flex: 1;
    max-width: 1240px;
    width: 100%;
    margin: 1.75rem auto 3.5rem;
    padding: 0 1.25rem;
}
footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    background: var(--surface);
    transition: background 0.3s;
}

/* ── Cards ────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.6rem;
    margin-bottom: 1.4rem;
    transition: box-shadow 0.25s, border-color 0.25s, background 0.3s;
}
.card:hover {
    box-shadow: var(--shadow-lg);
}
.card.narrow { max-width: 460px; margin-left: auto; margin-right: auto; margin-top: 2.5rem; }
.card h2 {
    font-size: 1.08rem;
    font-weight: 800;
    margin-bottom: 1.15rem;
    color: var(--text);
    letter-spacing: -0.015em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}
.card h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 42px;
    height: 2px;
    border-radius: 2px;
    background: var(--primary);
}
.subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
}

/* ── Choice Cards ─────────────────────────────── */
.text-center { text-align: center; }
.choice-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}
.choice-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    padding: 2.2rem 1.4rem;
    background: var(--surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 176px;
    justify-content: center;
}
.choice-card::after {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.choice-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.choice-card:hover::after { transform: scaleX(1); }
.choice-icon {
    font-size: 1.9rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: var(--primary-light);
    transition: transform 0.25s;
}
.choice-card:hover .choice-icon { transform: scale(1.08) rotate(-4deg); }
.choice-card strong {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.choice-card small {
    color: var(--text-muted);
    font-size: 0.82rem;
    text-align: center;
    line-height: 1.4;
}

/* ── Forms ────────────────────────────────────── */
.form label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.3rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}
.form input,
.form textarea,
.form select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
    transition: all 0.2s;
    margin-bottom: 0.9rem;
    outline: none;
}
.form input:focus,
.form textarea:focus,
.form select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface-solid);
}
.form input::placeholder,
.form textarea::placeholder { color: var(--text-muted); }

/* Dropdown-Optionen im Dark Mode lesbar (Browser-übergreifend) */
[data-theme="dark"] select option,
[data-theme="dark"] select optgroup {
    background: var(--surface-solid);
    color: var(--text);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}
.form-grid .span-2 { grid-column: 1 / -1; }
.form-inline {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 1.25rem;
}
.form-inline input,
.form-inline select {
    flex: 1 1 150px;
    min-width: 120px;
    margin-bottom: 0;
}
.form-inline .btn { margin-bottom: 0; white-space: nowrap; }
.form-actions {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
.form-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.form-row label { margin-bottom: 0; white-space: nowrap; }
.form-row select { width: auto; margin-bottom: 0; }
.inline-edit { display: flex; gap: 0.25rem; align-items: center; }
.email-inline {
    width: 140px !important;
    padding: 0.3rem 0.5rem !important;
    font-size: 0.78rem !important;
    margin-bottom: 0 !important;
}

/* ── Fish Table ───────────────────────────────── */
.fish-table { min-width: 100%; }
.fish-table input,
.fish-table select {
    padding: 0.45rem 0.5rem;
    margin-bottom: 0;
    font-size: 0.8rem;
    min-width: 55px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.fish-table input:focus,
.fish-table select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
.fish-table input:disabled,
.fish-table select:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: var(--row-stripe);
}
.fish-table .species-sel { min-width: 150px; }
.fish-row td {
    padding: 0.3rem 0.3rem !important;
    vertical-align: middle;
}

/* ── Buttons ──────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.58rem 1.3rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    letter-spacing: 0.01em;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 14px var(--primary-glow);
}
[data-theme="dark"] .btn-primary { color: #06211d; }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-small {
    padding: 0.32rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 20px;
    background: var(--surface-solid);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-weight: 600;
}
.btn-small:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.btn-small.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border-color: transparent;
}
.btn-small.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}
.btn-small.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
}
[data-theme="dark"] .btn-small.btn-primary { color: #06211d; }
.btn-small.btn-primary:hover { background: var(--primary-hover); }

.btn-export {
    background: var(--accent);
    color: #fff !important;
    border: none !important;
}
.btn-export:hover {
    filter: brightness(1.08);
    border: none !important;
    color: #fff !important;
}

.save-btn {
    background: var(--primary) !important;
    color: #fff !important;
    border: none !important;
    padding: 0.2rem 0.5rem !important;
    border-radius: var(--radius-sm) !important;
}

/* ── Tables ───────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--surface-solid);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}
thead {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
}
thead th {
    font-weight: 700;
    padding: 0.65rem 0.75rem;
    text-align: left;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
tbody td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: var(--row-stripe); }
tbody tr:hover { background: var(--row-hover); }
tfoot {
    border-top: 2px solid var(--primary);
    background: var(--primary-light);
}
tfoot td {
    font-weight: 700;
    padding: 0.55rem 0.75rem;
}
.actions { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.inline { display: inline; }

/* ── Flash ────────────────────────────────────── */
.flash-container { margin-bottom: 1rem; }
.flash {
    padding: 0.75rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.84rem;
    border-left-width: 4px;
    border-left-style: solid;
    animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.flash-success { background: var(--flash-success-bg); color: var(--flash-success-text); border: 1px solid var(--flash-success-border); border-left: 4px solid var(--primary); }
.flash-error   { background: var(--flash-error-bg);   color: var(--flash-error-text);   border: 1px solid var(--flash-error-border); border-left: 4px solid var(--danger); }
.flash-info    { background: var(--flash-info-bg);    color: var(--flash-info-text);    border: 1px solid var(--flash-info-border); border-left: 4px solid #4a90c4; }

/* ── Expandable Groups ────────────────────────── */
.species-group {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 0.4rem;
    overflow: hidden;
    transition: border-color 0.2s;
}
.species-group:hover { border-color: var(--border); }
.species-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    background: var(--surface-solid);
    transition: background 0.15s;
    user-select: none;
    font-weight: 600;
}
.species-summary:hover { background: var(--surface-hover); }
.expand-icon {
    font-size: 0.65rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    flex-shrink: 0;
    color: var(--text-muted);
}
.species-group.expanded .expand-icon { transform: rotate(90deg); }
.summary-stats {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}
.species-detail {
    display: none;
    border-top: 1px solid var(--border-light);
    background: var(--row-stripe);
}
.species-group.expanded .species-detail { display: block; }
.species-detail table { width: 100%; }
.species-detail th {
    font-size: 0.68rem;
    padding: 0.3rem 0.5rem;
    background: transparent;
}
.species-detail td {
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
}

/* ── Water Groups ─────────────────────────────── */
.water-group {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 0.6rem;
    overflow: hidden;
}
.water-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.9rem;
    cursor: pointer;
    background: var(--bg-alt);
    border-left: 4px solid var(--primary);
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 700;
    margin: 0;
    user-select: none;
    transition: background 0.15s;
    letter-spacing: -0.01em;
}
.water-heading:hover { background: var(--surface-hover); }
.water-total {
    margin-left: auto;
    font-size: 0.76rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}
.water-detail {
    display: none;
    padding: 0.5rem;
    background: var(--surface-solid);
}
.water-group.expanded .water-detail { display: block; }
.water-group .expand-icon { color: var(--text-muted); font-size: 0.65rem; }
.water-group.expanded .expand-icon { transform: rotate(90deg); }

/* ── Checkboxes ───────────────────────────────── */
input[type="checkbox"] {
    accent-color: var(--primary);
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}
input[type="checkbox"]:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Misc ─────────────────────────────────────── */
code {
    background: var(--code-bg);
    color: var(--code-color);
    padding: 0.15rem 0.4rem;
    border-radius: 5px;
    font-family: "SF Mono","Fira Code","JetBrains Mono",monospace;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}
.empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.88rem;
}
.footer-link {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.82rem;
}
.footer-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.footer-link a:hover { text-decoration: underline; }
.hidden { display: none !important; }
em { color: var(--text-muted); }

/* ── Tabs ─────────────────────────────────────── */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1.4rem;
    padding: 0.3rem;
    background: var(--surface-solid);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}
.tab-btn {
    flex: 1 1 auto;
    min-width: 80px;
    padding: 0.55rem 0.7rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
    text-align: center;
}
.tab-btn:hover { background: var(--surface-hover); color: var(--text); }
.tab-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px var(--primary-glow);
}
[data-theme="dark"] .tab-btn.active { background: var(--primary); color: #06211d; }
.tab-content { display: none; }
.tab-content.active { display: block; }

.sub-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1rem;
}
.sub-tab-btn {
    padding: 0.32rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}
.sub-tab-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.sub-tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
[data-theme="dark"] .sub-tab-btn.active { background: var(--primary); color: #06211d; border-color: var(--primary); }
.sub-content { display: none; }
.sub-content.active { display: block; }

/* ── Stats ────────────────────────────────────── */
.stats-row { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    min-width: 110px;
    padding: 1rem 1.25rem;
    background: var(--bg-alt);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}
.stat-num { font-size: 1.9rem; font-weight: 800; color: var(--primary); line-height: 1.1; letter-spacing: -0.02em; }
.stat-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }

.stat-card {
    background: var(--surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1.1rem 1.4rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}
.stat-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.stat-number { font-size: 1.7rem; font-weight: 800; color: var(--primary); display: block; line-height: 1.2; }

/* ── KPI Cards (Finanzen u.a.) ────────────────── */
.kpi-card { text-align: center; }
.kpi-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.kpi-label { font-size: 0.78rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.25rem; }

/* ── Tabs (mobile wrap) ───────────────────────── */
@media (max-width: 600px) {
    .tabs { gap: 0.15rem; padding: 0.2rem; }
    /* Text umbrechen, damit der aktive (farbige) Hintergrund den ganzen
       Text abdeckt – sonst läuft heller Text über den Button hinaus. */
    .tab-btn { font-size: 0.68rem; padding: 0.4rem 0.45rem; min-width: 0; white-space: normal; line-height: 1.2; }
    .sub-tab-btn { white-space: normal; }
}

/* ── Service Cards ────────────────────────────── */
.services-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.service-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    transition: all 0.2s;
}
.service-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}
.service-card.past {
    opacity: 0.55;
}
.service-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    height: 58px;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-glow);
    border-radius: var(--radius-sm);
    font-weight: 800;
}
.date-day { font-size: 1.3rem; line-height: 1; }
.date-month { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.service-body { flex: 1; min-width: 0; }
.service-body h3 { font-size: 0.94rem; font-weight: 700; margin-bottom: 0.2rem; }
.service-desc { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.2rem; }
.service-loc { font-size: 0.78rem; color: var(--text-muted); }
.service-count { font-size: 0.75rem; color: var(--text-muted); }
.service-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    min-width: 80px;
}
.badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.badge-success { background: var(--primary-light); color: var(--primary); }
.badge-muted { background: var(--bg-alt); color: var(--text-muted); }

/* ── Charts ───────────────────────────────────── */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.chart-box {
    background: var(--surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1rem;
    min-width: 0;          /* verhindert Grid-Overflow (Canvas sprengt sonst die Spalte) */
    overflow: hidden;
}
.chart-box h3 {
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.chart-box canvas { max-height: 350px; min-height: 250px; max-width: 100% !important; }

/* ── Calendar ─────────────────────────────────── */
.calendar-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.calendar-nav h3 { margin: 0; font-size: 1rem; font-weight: 800; color: var(--primary); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border-light); border: 1px solid var(--border-light); border-radius: var(--radius); overflow: hidden; }
.calendar-day-header { background: var(--bg-alt); color: var(--text-secondary); text-align: center; padding: 0.45rem 0.2rem; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.calendar-day { background: var(--surface-solid); min-height: 70px; padding: 0.25rem; font-size: 0.72rem; position: relative; }
.calendar-day.other-month { opacity: 0.35; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--primary); background: var(--primary-light); }
.day-num { font-weight: 700; margin-bottom: 0.1rem; }
.day-service { display: block; background: var(--primary); color: #fff; padding: 0.15rem 0.3rem; border-radius: 4px; font-size: 0.6rem; font-weight: 600; cursor: pointer; margin-bottom: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-theme="dark"] .day-service { color: #06211d; }
.day-service:hover { background: var(--primary-hover); }
.service-popup { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1.25rem; z-index: 200; min-width: 280px; max-width: 90vw; }
.service-popup.active { display: block; }
.popup-overlay { display: none; position: fixed; inset: 0; background: rgba(8,16,14,0.45); z-index: 199; }
.popup-overlay.active { display: block; }

/* ── Map ──────────────────────────────────────── */
#water-map { height: 400px; border-radius: var(--radius); border: 1px solid var(--border-light); z-index: 1; }

/* ── Diff colors ──────────────────────────────── */
.diff-positive { color: var(--primary); font-weight: 700; }
.diff-negative { color: var(--danger); font-weight: 700; }
.diff-neutral { color: var(--text-muted); }

/* ── Catch Photo ──────────────────────────────── */
.catch-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); transition: all 0.25s; }
.catch-thumb:hover { border-color: var(--primary); transform: scale(1.08); }
.catch-thumb.expanded { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: auto; height: auto; max-width: 90vw; max-height: 85vh; border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 300; border: 3px solid var(--primary); }
.inline-upload { display: inline-flex; gap: 0.3rem; align-items: center; }
.inline-upload input[type="file"] { font-size: 0.7rem; margin-bottom: 0; width: auto; }

/* ── PWA: Standalone Mode ─────────────────────── */
@media (display-mode: standalone) {
    body { padding-top: 0; }
    header { padding-top: calc(env(safe-area-inset-top, 0) + 0rem); }
    main { min-height: calc(100vh - 180px); }
}

/* ── PWA Install Banner ───────────────────────── */
.pwa-banner {
    display: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0;
    animation: slideDown 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.pwa-banner-inner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    max-width: 1240px;
    margin: 0 auto;
}
.pwa-banner-icon { font-size: 1.4rem; flex-shrink: 0; }
.pwa-banner-text { flex: 1; font-size: 0.85rem; font-weight: 600; }
.pwa-banner-close {
    position: absolute;
    right: 0.3rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    color: rgba(255,255,255,0.7);
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    line-height: 1;
}
.pwa-banner-close:hover { color: #fff; }

/* ── PWA Update Toast ─────────────────────────── */
.pwa-update-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    background: var(--surface-solid);
    border: 1px solid var(--primary);
    color: var(--text);
    padding: 0.7rem 1.2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Install Guides (iOS / generisch) ─────────── */
.ios-install-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8,16,14,0.6);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.ios-install-card {
    background: var(--surface-solid);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.ios-install-arrow {
    font-size: 3rem;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
    animation: bounce 1.5s ease-in-out infinite;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.ios-install-card h2 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text);
}
.ios-install-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}
.ios-install-card .btn { width: 100%; }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 768px) {
    header h1, .brand-title { font-size: 0.88rem; }
    .brand-sub { display: none; }
    .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
    .brand-mark svg { width: 18px; height: 18px; }
    header { padding: 0 0.6rem; }
    .header-inner { gap: 0.3rem; padding: 0.5rem 0; }
    main { padding: 0 0.5rem 2rem; margin-top: 0.85rem; }
    .card { padding: 1rem; border-radius: var(--radius); }
    .card h2 { font-size: 0.95rem; margin-bottom: 0.75rem; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .choice-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
    .choice-card { padding: 1.2rem 0.8rem; min-height: 130px; }
    .choice-icon { font-size: 1.4rem; width: 44px; height: 44px; border-radius: 13px; }
    .choice-card strong { font-size: 0.85rem; }
    .choice-card small { font-size: 0.7rem; }
    .form-inline { flex-direction: column; align-items: stretch; }
    .form-inline input { flex: none; width: 100%; }
    .fish-table input, .fish-table select { font-size: 0.7rem; padding: 0.25rem 0.3rem; }
    th, td { padding: 0.3rem 0.35rem; font-size: 0.72rem; }
    .btn-small { font-size: 0.68rem; padding: 0.22rem 0.5rem; }
    .charts-grid { grid-template-columns: 1fr; }
    .service-card { flex-wrap: wrap; gap: 0.4rem; padding: 0.75rem; }
    .service-action { flex-direction: row; min-width: auto; }
    .stats-row { gap: 0.5rem; }
    .stat-item { min-width: 90px; padding: 0.7rem 0.8rem; }
    .stat-num { font-size: 1.35rem; }
    .sub-tabs { gap: 0.15rem; }
    .sub-tab-btn { font-size: 0.68rem; padding: 0.25rem 0.45rem; }

    /* Tabellen → gestapelte Karten */
    .table-wrap { border: none; overflow-x: visible; background: transparent; }
    .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap th, .table-wrap td, .table-wrap tr { display: block; }
    .table-wrap thead { display: none; }
    .table-wrap tr {
        background: var(--surface-solid) !important;
        border: 1px solid var(--border-light);
        border-radius: var(--radius-sm);
        padding: 0.55rem 0.65rem;
        margin-bottom: 0.45rem;
        box-shadow: var(--shadow-sm);
    }
    .table-wrap td {
        border: none;
        padding: 0.18rem 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        min-width: 0;
    }
    .table-wrap td::after { min-width: 0; }
    .table-wrap td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.66rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
        white-space: nowrap;
        min-width: 85px;
    }
    .table-wrap .actions, .table-wrap td:has(.btn) {
        justify-content: flex-end; padding-top: 0.25rem;
    }
    .table-wrap td:has(.btn)::before, .table-wrap td:has(form)::before { content: none; }
    .table-wrap code { font-size: 0.7rem; }
}

@media (max-width: 480px) {
    .choice-grid { grid-template-columns: 1fr; }
    nav { gap: 0.2rem; }
    nav .btn-small { font-size: 0.63rem; padding: 0.18rem 0.4rem; }
    .user-info { font-size: 0.66rem; padding: 0.12rem 0.45rem; }
    .service-card { padding: 0.55rem; }
    .calendar-day { min-height: 50px; padding: 0.12rem; font-size: 0.62rem; }
    .calendar-day-header { font-size: 0.58rem; padding: 0.2rem 0.08rem; }
    .tabs { gap: 0.1rem; padding: 0.15rem; }
    .tab-btn { font-size: 0.62rem; padding: 0.3rem 0.3rem; min-width: 45px; }
    .day-service { font-size: 0.5rem; padding: 0.1rem 0.2rem; }
    .stat-num { font-size: 1.15rem; }
    .stat-label { font-size: 0.62rem; }
}

/* ── Druck: nur Inhalt, keine Website-Bedienelemente ──────────── */
@media print {
    /* Navigation & Rahmenelemente ausblenden */
    header, footer, nav,
    .tabs, .sub-tabs,
    .pwa-banner, .pwa-update-toast,
    .ios-install-overlay, #pwa-install-banner,
    .theme-btn,
    .btn, .actions, .no-print,
    .qr-modal-overlay {
        display: none !important;
    }
    /* Saubere, weiße Druckfläche ohne Verläufe/Schatten */
    body {
        background: #fff !important;
        background-image: none !important;
        color: #000;
    }
    main {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    .card {
        box-shadow: none !important;
        border: none !important;
        background: #fff !important;
        padding: 0 !important;
        margin: 0 0 0.5cm 0 !important;
    }
    .table-wrap { border: none !important; box-shadow: none !important; overflow: visible !important; }
    a { color: #000 !important; text-decoration: none; }
}

/* ── Mobile Bottom-Navigation (Mitglieder) ─────────────────────────────── */
.bottom-nav {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 200;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--header-border);
    padding: 0.3rem 0.4rem calc(env(safe-area-inset-bottom, 0) + 0.3rem);
    align-items: center;
    justify-content: space-around;
    gap: 0.15rem;
}
.bn-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.25rem 0.1rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    min-width: 0;
}
.bn-item .bn-icon { font-size: 1.15rem; line-height: 1; }
.bn-item .bn-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.bn-item.active { color: var(--primary); background: var(--primary-light, rgba(14,117,105,0.1)); }
.bn-item:active { transform: scale(0.96); }
.bn-fab {
    flex: 0 0 auto;
    width: 48px; height: 48px;
    margin-top: -18px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--surface-solid);
}
.bn-fab:active { transform: scale(0.95); }

@media (max-width: 768px) {
    .bottom-nav { display: flex; }
    body:has(.bottom-nav) main { padding-bottom: 5.2rem; }
    body:has(.bottom-nav) footer { padding-bottom: 4.5rem; }
    /* Top-Nav-Bereichslinks ausblenden – die Bottom-Nav übernimmt */
    body:has(.bottom-nav) nav .nav-area { display: none; }
}

/* ── Admin-Shell: Sidebar (Desktop) / Drawer (Mobil) ───────────────────── */
.admin-shell { display: flex; gap: 1.25rem; align-items: flex-start; }
.admin-sidebar {
    flex: 0 0 185px;
    position: sticky;
    top: 4.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    background: var(--surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 0.5rem;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
}
.as-item {
    display: block;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}
.as-item:hover { background: var(--surface-hover); color: var(--text); }
.as-item.active { background: var(--primary-light, rgba(14,117,105,0.12)); color: var(--primary); }
.as-sub { display: flex; flex-direction: column; margin: 0.1rem 0 0.3rem; }
.as-sub a {
    display: block;
    padding: 0.28rem 0.6rem 0.28rem 1.7rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.as-sub a:hover { background: var(--surface-hover); color: var(--text); }
.admin-content { flex: 1 1 auto; min-width: 0; }
/* Mobil: Bottom-Tab-Bar statt Sidebar (wie eine App) */
.admin-bottom-nav { display: none; }
.admin-subnav { display: none; }
.admin-more-sheet { display: none; }
.admin-more-overlay { display: none; }

@media (max-width: 900px) {
    .admin-sidebar { display: none; }
    .bottom-nav.admin-bottom-nav { display: flex; }
    body:has(.admin-bottom-nav) main { padding-bottom: 5.2rem; }
    body:has(.admin-bottom-nav) footer { padding-bottom: 4.5rem; }

    /* Unterpunkte des aktiven Bereichs als horizontale Chip-Leiste */
    .admin-subnav {
        display: flex;
        gap: 0.35rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.25rem 0.1rem 0.6rem;
        margin-bottom: 0.5rem;
        scrollbar-width: none;
    }
    .admin-subnav::-webkit-scrollbar { display: none; }
    .admin-subnav a {
        flex: 0 0 auto;
        padding: 0.35rem 0.75rem;
        border-radius: 999px;
        background: var(--surface-solid);
        border: 1px solid var(--border-light);
        color: var(--text-secondary);
        font-size: 0.75rem;
        font-weight: 600;
        text-decoration: none;
        white-space: nowrap;
    }
    .admin-subnav a:active { background: var(--surface-hover); }

    /* "Mehr"-Sheet: restliche Bereiche von unten einblenden */
    .admin-more-sheet {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 0; right: 0;
        bottom: calc(3.4rem + env(safe-area-inset-bottom, 0));
        z-index: 398;
        background: var(--surface-solid);
        border-top: 1px solid var(--header-border);
        border-radius: var(--radius) var(--radius) 0 0;
        box-shadow: var(--shadow-lg);
        padding: 0.6rem 0.6rem 0.8rem;
        transform: translateY(120%);
        transition: transform 0.22s ease;
        visibility: hidden;
    }
    .admin-more-sheet.open { transform: translateY(0); visibility: visible; }
    .ams-item {
        display: block;
        padding: 0.7rem 0.9rem;
        border-radius: var(--radius-sm);
        text-decoration: none;
        color: var(--text);
        font-size: 0.95rem;
        font-weight: 600;
    }
    .ams-item:active { background: var(--surface-hover); }
    .ams-item.active { background: var(--primary-light, rgba(14,117,105,0.12)); color: var(--primary); }
    .admin-more-overlay.open {
        display: block;
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 397;
    }
}
@media (prefers-reduced-motion: reduce) {
    .admin-more-sheet { transition: none; }
}

@media print {
    .admin-sidebar, .admin-subnav, .admin-more-sheet, .admin-more-overlay, .bottom-nav { display: none !important; }
}

button.bn-item {
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
