/* Fangbuch – Gestaltung
   Systemschriften, keine externen Dateien. Große Bedienelemente und hohe Kontraste für die Nutzung
   am Wasser (Sonne, nasse Finger). Petrol als Hausfarbe, Posen-Orange nur für das Wichtigste. */

:root {
  --bg: #f3f4f0;
  --surface: #ffffff;
  --surface-2: #e9ece6;
  --text: #13242b;
  --muted: #55656b;
  --border: #dde1da;
  --field-border: #849195;
  --primary: #0b5d7a;
  --primary-text: #ffffff;
  --primary-soft: #d9eaf0;
  --accent: #c8490f;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --ok-bg: #e0f2e4; --ok-text: #1d5b2a;
  --warn-bg: #fdf1cf; --warn-text: #5f4300;
  --error-bg: #fbe3e0; --error-text: #8c1d17;
  --info-bg: #dfedf8; --info-text: #17456f;
  --hero-from: #0b5d7a;
  --hero-to: #083e54;
  --shadow: 0 1px 2px rgb(19 36 43 / 0.05), 0 4px 16px rgb(19 36 43 / 0.05);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2355656b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --r-s: 10px;
  --r-m: 14px;
  --r-l: 20px;
  --bar-h: 58px;
  --nav-h: 68px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1417;
    --surface: #131f24;
    --surface-2: #1d2c32;
    --text: #e7eff1;
    --muted: #a0b2b8;
    --border: #25363d;
    --field-border: #62767f;
    --primary: #62c2de;
    --primary-text: #04212c;
    --primary-soft: #173a48;
    --accent: #f27a41;
    --accent-text: #1f0b02;
    --danger: #ff8a80;
    --danger-soft: #3a1b19;
    --ok-bg: #16361f; --ok-text: #b7e6c2;
    --warn-bg: #362c0d; --warn-text: #f5dc92;
    --error-bg: #3d1a18; --error-text: #ffb4ab;
    --info-bg: #142d45; --info-text: #b6d6f7;
    --hero-from: #14404f;
    --hero-to: #0e2933;
    --shadow: none;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0b2b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

main { max-width: 640px; margin: 0 auto; padding: 16px 16px 48px; }
main.narrow { max-width: 460px; padding-top: 32px; }
main.wide { max-width: 1500px; }
main.wide .hint { max-width: 85ch; }
/* Die Verwaltung ist für den PC gebaut; auf kleinen Bildschirmen nur ein Hinweis, keine Sperre */
.desktop-hint { display: none; }
@media (max-width: 900px) { .desktop-hint { display: block; margin: 12px 16px 0; } }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; font-weight: 750; margin: 28px 0 12px; }
h3 { font-size: 1.05rem; font-weight: 700; margin: 24px 0 10px; }
main > h2:first-child, main > div:first-child > h2:first-child, main > div:first-child > h3:first-child { margin-top: 8px; }
main > .card:first-child, main > div:first-child > .card:first-child { margin-top: 4px; }
a { color: var(--primary); }
small { font-size: 0.85em; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.icon { flex: none; display: block; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.03em; }
.hint { color: var(--muted); font-size: 0.88rem; margin: 6px 0; }
.center { text-align: center; }
.loading { padding: 48px 32px; text-align: center; color: var(--muted); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.span-all { grid-column: 1 / -1; }
.span-all:empty { display: none; }

/* --- Kopfzeile --- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  margin: 0; font-size: 1.15rem; font-weight: 800;
}
.topbar-logo { width: 30px; height: 30px; border-radius: 9px; flex: none; }
.topbar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.topbar .who { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.topbar:has(.back) { justify-content: flex-start; gap: 4px; padding-left: 6px; }
.back, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: none;
  color: var(--text); background: transparent; border: 0; border-radius: 50%;
  text-decoration: none; cursor: pointer;
}
.back:active, .icon-btn:active { background: var(--surface-2); }
.topbar a.who.icon-btn { background: var(--surface-2); color: var(--text); width: 40px; height: 40px; }

/* --- Reiter --- */
.tabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 8px 14px; border-radius: 999px; white-space: nowrap;
  font-size: 0.95rem; font-weight: 600; text-decoration: none; color: var(--muted);
  transition: background-color 0.15s, color 0.15s;
}
.tabs a.active { color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.subtabs {
  position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top)); z-index: 9;
  gap: 0; padding: 8px 6px; justify-content: space-between;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.subtabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 9px; font-size: 0.89rem; }

/* Verwaltung: auf großen Bildschirmen Seitenleiste statt Reiter */
@media (min-width: 1100px) {
  #app:has(> .admin-nav) {
    display: grid; grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh;
  }
  #app:has(> .admin-nav) > .topbar { grid-column: 1 / -1; }
  .admin-nav {
    flex-direction: column; gap: 2px; padding: 16px 12px;
    position: sticky; top: var(--bar-h); align-self: start; height: calc(100vh - var(--bar-h));
    background: transparent; border-bottom: 0; border-right: 1px solid var(--border);
  }
  .admin-nav a { padding: 10px 14px; border-radius: var(--r-s); white-space: normal; }
  main.wide { width: 100%; padding: 24px 32px 64px; }
}

/* --- Anmeldung --- */
.auth-hero {
  position: relative; overflow: hidden; isolation: isolate;
  padding: calc(44px + env(safe-area-inset-top)) 24px 76px;
  text-align: center; color: #fff;
  background: linear-gradient(165deg, var(--hero-from), var(--hero-to));
}
.auth-hero img { display: block; width: 68px; height: 68px; margin: 0 auto 14px; border-radius: 19px; box-shadow: 0 0 0 1.5px rgb(255 255 255 / 0.28); }
.auth-hero h1 { margin: 0; font-size: 2.1rem; font-weight: 800; letter-spacing: -0.02em; }
.auth-hero p { margin: 6px 0 0; color: rgb(255 255 255 / 0.86); }
main.auth { margin-top: -52px; padding-top: 0; position: relative; }
main.auth > .card:first-child { margin-top: 0; }

/* Ringe wie um eine Pose auf dem Wasser */
.hero::before, .auth-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-radial-gradient(circle at 92% 6%, transparent 0 26px, rgb(255 255 255 / 0.1) 26px 27.5px);
  -webkit-mask-image: radial-gradient(circle at 92% 6%, #000, transparent 72%);
  mask-image: radial-gradient(circle at 92% 6%, #000, transparent 72%);
}

/* --- Karten, Formulare --- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l);
  padding: 20px; margin: 16px 0; box-shadow: var(--shadow);
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 0.93rem; font-weight: 650; margin-bottom: 6px; }
.field.inline { display: flex; align-items: center; gap: 10px; }
.field.inline label { margin: 0; }

input, select, textarea {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  font: inherit;
  color: var(--text);
  background-color: var(--surface);
  border: 1.5px solid var(--field-border);
  border-radius: var(--r-m);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: auto; resize: vertical; display: block; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 28%, transparent);
}
input:disabled, select:disabled, textarea:disabled { background-color: var(--surface-2); opacity: 1; color: var(--muted); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 42px; cursor: pointer;
  background-image: var(--chevron); background-repeat: no-repeat; background-position: right 12px center; background-size: 20px;
}
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input.short { width: 7.5em; }
.field.inline select { width: auto; }

/* Kontrollkästchen */
input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: none; cursor: pointer;
  width: 26px; height: 26px; min-height: 0; padding: 0; margin: 0; vertical-align: middle;
  background-position: center; background-repeat: no-repeat; background-size: 18px;
  border-radius: 8px;
}
input[type="checkbox"]:checked {
  background-color: var(--primary); border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4.5 4.5L19 7'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2304212c' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4.5 4.5L19 7'/%3E%3C/svg%3E");
  }
}
.check, .field label.check { display: inline-flex; align-items: center; gap: 10px; margin: 0; font-weight: 600; cursor: pointer; }

/* Große Variante als Schalter (Zeile mit Text links, Schalter rechts) */
.check.big {
  display: flex; flex-direction: row-reverse; justify-content: space-between; gap: 14px;
  min-height: 56px; margin: 4px 0 14px; padding: 8px 14px;
  font-weight: 600; background: var(--surface-2); border-radius: var(--r-m);
}
.check.big input[type="checkbox"] {
  width: 52px; height: 32px; border: 0; border-radius: 999px;
  background: radial-gradient(circle closest-side, #fff 92%, transparent) no-repeat 4px center / 24px 24px, var(--field-border);
  transition: background-position 0.15s, background-color 0.15s;
}
.check.big input[type="checkbox"]:checked {
  background: radial-gradient(circle closest-side, #fff 92%, transparent) no-repeat 24px center / 24px 24px, var(--primary);
}

.stepper { display: flex; gap: 8px; }
.stepper input { text-align: center; font-size: 1.3rem; font-weight: 700; flex: 1; min-width: 0; }
.btn-step { min-width: 64px; min-height: 52px; font-size: 1.6rem; font-weight: 500; padding: 0; }

.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 18px; }
.row .field { margin-bottom: 0; flex: 1 1 150px; }
.row > .btn { min-height: 52px; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 8px 18px;
  font: inherit; font-weight: 650; text-decoration: none; text-align: center;
  color: var(--text); background: var(--surface-2);
  border: 0; border-radius: var(--r-m);
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s, background-color 0.15s;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
@media (hover: hover) { .btn:hover:not(:disabled) { filter: brightness(0.96); } }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-accent { background: var(--accent); color: var(--accent-text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-link { background: transparent; color: var(--primary); }
.btn-small { min-height: 38px; padding: 4px 14px; font-size: 0.9rem; border-radius: var(--r-s); }
.btn-big { display: flex; width: 100%; min-height: 56px; font-size: 1.08rem; margin: 12px 0; }
.btn-huge { display: flex; width: 100%; min-height: 68px; font-size: 1.3rem; font-weight: 750; margin: 12px 0; border-radius: 18px; }
form .btn-link, form .btn-danger { display: flex; width: 100%; margin-top: 8px; }

.actions { margin: 8px 0 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.toolbar select { width: auto; min-height: 46px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions.spread { align-items: center; gap: 10px; }

/* Zu-/Absage als zusammenhängende Auswahl */
.segmented { display: flex; flex: 1 1 240px; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: var(--r-m); }
.segmented .btn { flex: 1; min-height: 44px; padding: 4px 6px; background: transparent; border-radius: 11px; }
.segmented .btn[aria-pressed="true"] { background: var(--primary); color: var(--primary-text); }

/* --- Meldungen --- */
.msg { padding: 12px 14px; border-radius: var(--r-m); margin: 12px 0; font-size: 0.97rem; }
.msg .btn { margin-left: 6px; vertical-align: middle; background: color-mix(in srgb, currentColor 14%, transparent); color: inherit; }
.msg-error { background: var(--error-bg); color: var(--error-text); }
.msg-warn { background: var(--warn-bg); color: var(--warn-text); }
.msg-ok { background: var(--ok-bg); color: var(--ok-text); }
.msg-info { background: var(--info-bg); color: var(--info-text); }
a.msg { display: block; text-decoration: none; }
.announcement-banner > div + div { margin-top: 6px; }

.badge {
  display: inline-block; margin-top: 8px; padding: 2px 10px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; background: var(--surface-2); color: var(--text);
}
.badge + .badge { margin-left: 6px; }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge-error { background: var(--error-bg); color: var(--error-text); }
.badge-new { background: var(--accent); color: var(--accent-text); margin-top: 0; }

/* --- Startseite: Saison-Karte --- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  margin: 4px 0 16px; padding: 16px 18px 18px;
  color: #fff; border-radius: 24px;
  background: linear-gradient(160deg, var(--hero-from), var(--hero-to));
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.year-select { position: relative; display: inline-flex; }
.year-select select {
  width: auto; min-height: 40px; padding: 4px 38px 4px 14px;
  font-weight: 700; color: #fff; border: 0; border-radius: 999px;
  background-color: rgb(255 255 255 / 0.16);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.year-select select:focus { box-shadow: 0 0 0 3px rgb(255 255 255 / 0.5); }
.year-select option { color: #13242b; background: #fff; }
.sync-ok { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; font-weight: 600; color: rgb(255 255 255 / 0.9); }
.hero .tiles { display: flex; gap: 0; margin: 16px 0 6px; }
.hero .tile { flex: 1; padding: 0; text-align: left; background: none; border: 0; border-radius: 0; box-shadow: none; }
.hero .tile + .tile { padding-left: 18px; border-left: 1px solid rgb(255 255 255 / 0.22); }
.hero .tile strong { font-size: 3rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.hero .tile span { color: rgb(255 255 255 / 0.82); font-size: 0.95rem; }
.hero .btn-huge { margin: 16px 0 0; }
.hero .btn-ghost {
  display: flex; width: 100%; margin-top: 8px; color: #fff; background: rgb(255 255 255 / 0.14);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; }
.chips li {
  padding: 4px 12px; font-size: 0.88rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
}
.chips b { font-weight: 750; font-variant-numeric: tabular-nums; }

/* --- Kacheln --- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }
.tile {
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-l); box-shadow: var(--shadow);
}
.tile strong { display: block; font-size: 2rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 0.9rem; }

/* --- Listen --- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 8px; }
.section-head h2 { margin: 0; }
.month { margin: 18px 4px 8px; font-size: 0.88rem; font-weight: 700; color: var(--muted); }
.entries { list-style: none; padding: 0; margin: 0; }
.entry {
  display: block; padding: 14px 16px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-m);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow);
}
a.entry { transition: transform 0.1s, border-color 0.15s; }
a.entry:active { transform: scale(0.99); }
@media (hover: hover) { a.entry:hover { border-color: var(--field-border); } }
.entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.entry-head span { color: var(--muted); font-size: 0.9rem; text-align: right; white-space: nowrap; }
.entry.with-icon { display: flex; gap: 12px; align-items: center; padding: 12px 10px 12px 12px; }
.entry-icon {
  display: flex; align-items: center; justify-content: center; align-self: flex-start;
  width: 44px; height: 44px; flex: none;
  color: var(--primary); background: var(--primary-soft); border-radius: 13px;
}
.entry.trip .entry-icon { color: var(--muted); background: var(--surface-2); }
.entry-body { flex: 1; min-width: 0; }
.entry-sub { color: var(--muted); font-size: 0.92rem; }
.entry-go { color: var(--muted); opacity: 0.7; }

.empty-state { padding: 32px 20px; text-align: center; color: var(--muted); }
.empty-state .icon { margin: 0 auto 10px; opacity: 0.6; }
.empty-state p { margin: 0; }

/* --- Tabellen --- */
.table-wrap { overflow-x: auto; margin: 8px 0 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-m); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { font-size: 0.82rem; font-weight: 700; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tfoot td { font-weight: 700; border-top: 1.5px solid var(--field-border); border-bottom: 0; }
td.empty { color: var(--muted); text-align: center; }
td .hint { margin: 0; }
td select { min-width: 17rem; }
input[type="search"] { max-width: 320px; }
@media (hover: hover) { tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); } }

.list-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-row input:not([type="checkbox"]) { flex: 1 1 220px; width: auto; min-height: 46px; }
.list-row .msg, .list-row > div:last-child:empty { flex-basis: 100%; }

.species-table { overflow-x: auto; }
.species-row {
  display: grid; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border);
  grid-template-columns: minmax(200px, 1.4fr) repeat(6, minmax(84px, 1fr)) 80px 110px; min-width: 958px;
}
.species-row input:not([type="checkbox"]) { min-height: 46px; padding: 6px 10px; }
.species-row input.short { width: 100%; }
.species-head { font-weight: 650; font-size: 0.85rem; color: var(--muted); border-bottom: 0; }

.filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.filter .btn { border-radius: 999px; }
tr.status-offen td { background: var(--warn-bg); }
tr.status-offen .status-badge { font-weight: 700; color: var(--warn-text); }
tr.status-nicht-aktiviert td, tr.status-gesperrt td { color: var(--muted); }

/* --- Rangliste --- */
.leaderboard { list-style: none; padding: 0; margin: 8px 0 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-m); box-shadow: var(--shadow); }
.leaderboard li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.leaderboard li:last-child { border-bottom: 0; }
.rank {
  display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: none;
  font-weight: 750; font-variant-numeric: tabular-nums; color: var(--muted); background: var(--surface-2); border-radius: 50%;
}
.leaderboard li:first-child .rank { color: var(--accent-text); background: var(--accent); }
.lb-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.lb-score { text-align: right; font-size: 1.25rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lb-score small { display: block; font-size: 0.75rem; font-weight: 500; color: var(--muted); }

/* --- Mitglieder-Navigation unten --- */
main.with-nav { padding-bottom: calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 6px 8px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 0.78rem; font-weight: 650; text-decoration: none; color: var(--muted);
}
.nav-icon {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 58px; height: 32px; border-radius: 999px; transition: background-color 0.15s;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a.active .nav-icon { background: var(--primary-soft); }
.bottom-nav .dot {
  position: absolute; top: 2px; right: 13px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--surface);
}

/* Bildschirmtastatur offen: Die Leiste würde nur halb sichtbar darüber kleben */
.keyboard-open .bottom-nav { display: none; }
.keyboard-open main.with-nav { padding-bottom: 32px; }
/* Chrome rechnet bei randlosem Android die Höhe der Gestenleiste nicht mit, das Feld läge sonst teils unter
   der Tastatur. Der Wert ist bei offener Tastatur nicht mehr abfragbar, app.js merkt ihn sich vorher. */
.keyboard-open .chat-form { bottom: var(--keyboard-gap, 0px); }
.safe-area-probe { position: fixed; bottom: 0; width: 0; height: env(safe-area-inset-bottom); visibility: hidden; }

/* --- Mitteilungen, Termine --- */
.announcement h2, .announcement h3 { margin: 6px 0 8px; }
.announcement .meta, .event .meta { color: var(--muted); font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.announcement-banner { display: block; text-decoration: none; }
.event h2, .event h3 { margin: 6px 0 8px; }
.event .row-actions { margin-top: 14px; }
.place { display: flex; align-items: center; gap: 6px; }

/* --- Gruppen --- */
.invite-code {
  font-size: 1.7rem; font-weight: 750; text-align: center; margin: 14px 0; padding: 14px 8px;
  letter-spacing: 0.08em; background: var(--surface-2); border-radius: var(--r-m);
}
.member-list { list-style: none; padding: 0; margin: 0; }
.member-list li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.member-list li:last-child { border-bottom: 0; }
.member-list li > span:first-child { flex: 1 1 auto; }

/* --- Chat --- */
.chat { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.bubble {
  max-width: 85%; padding: 8px 12px; align-self: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px 18px 18px 6px;
  overflow-wrap: anywhere;
}
.bubble.mine {
  align-self: flex-end; background: var(--primary-soft); border-color: transparent; border-radius: 18px 18px 6px 18px;
}
.bubble .author { font-size: 0.82rem; font-weight: 700; color: var(--primary); }
.bubble .time { font-size: 0.74rem; color: var(--muted); text-align: right; margin-top: 2px; }
.bubble.has-image { padding: 5px; }
.bubble.has-image .author, .bubble.has-image .pre, .bubble.has-image .time { padding: 0 7px; }
.chat-form {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  display: flex; gap: 8px; align-items: flex-end;
  margin: 0 -16px -32px; padding: 8px 12px;
  background: var(--bg);
}
.chat-form textarea { flex: 1; min-width: 0; min-height: 48px; max-height: 160px; padding: 11px 16px; border-radius: 24px; resize: none; }
.btn-photo, .btn-send { flex: none; width: 48px; min-height: 48px; padding: 0; border-radius: 50%; }
.chat-img { display: block; width: 100%; max-width: 280px; height: auto; border-radius: 14px; cursor: zoom-in; background: var(--surface-2); margin-bottom: 4px; }
.chat-preview:empty { display: none; }
.chat-preview { display: flex; gap: 12px; align-items: center; padding: 8px; margin-bottom: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-m); }
.chat-preview img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--r-s); }
.chat-preview .hint { margin: 2px 0; }
.link-btn { background: none; border: 0; padding: 0 0 0 8px; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgb(0 0 0 / 0.92); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; width: 48px; height: 48px; border: 0; border-radius: 50%; font-size: 1.4rem; background: rgb(255 255 255 / 0.2); color: #fff; cursor: pointer; }

/* --- Zettel zum Aushändigen --- */
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 370px), 1fr)); gap: 12px; }
.slip { border: 2px dashed var(--field-border); border-radius: 8px; padding: 14px; background: var(--surface); break-inside: avoid; }
.slip-title { font-weight: 700; margin-bottom: 8px; }
.slip dl { margin: 0 0 8px; }
.slip dt { color: var(--muted); font-size: 0.8rem; }
.slip dd { margin: 0 0 4px; }
.slip dd.big { font-size: 1.15rem; font-weight: 700; white-space: nowrap; }
.slip ol { margin: 6px 0; padding-left: 20px; font-size: 0.9rem; }
.slip-note { font-size: 0.8rem; color: var(--muted); margin: 6px 0 0; }
.slip-body { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.slip-body > div { flex: 1 1 180px; min-width: 0; }
.slip-qr { margin: 0; flex: 0 0 auto; text-align: center; }
.slip-qr .qr { display: block; width: 34mm; height: 34mm; }
.slip-qr figcaption { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

/* --- Erneute Bestätigung & Zwei-Faktor-Einrichtung --- */
.modal {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgb(5 15 20 / 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal-card { width: 100%; max-width: 420px; margin: 0; }
.modal-wide { max-width: 720px; max-height: calc(100vh - 32px); overflow-y: auto; }
.totp-qr { margin: 12px auto; width: 220px; }
.totp-qr .qr { display: block; width: 220px; height: 220px; }
.totp-secret { font-size: 1.1rem; letter-spacing: 0.08em; word-break: break-all; }

/* --- Weniger Bewegung, wenn gewünscht --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* --- Druck (Zettel, Auswertung als PDF) --- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #eee; --text: #000; --muted: #333; --border: #999; --field-border: #999; --shadow: none; }
  body { font-size: 11pt; background: #fff; }
  #app { display: block !important; }
  .no-print, .topbar, .tabs { display: none !important; }
  main, main.wide { max-width: none; padding: 0; }
  .tile { border: 1px solid #999; }
  .table-wrap { overflow: visible; border-radius: 0; }
  tr.status-offen td { background: #eee; }
  body.print-slips main > div > :not(:nth-child(2)) { display: none !important; }
  body.print-slips .slips { grid-template-columns: 1fr 1fr; gap: 0; }
  body.print-slips .slip { border-radius: 0; margin: 0; }
  body.print-letters main > div > :not(.letters) { display: none !important; }
  body.print-letters .letters { display: block; }
  body.print-letters .letter { box-shadow: none; margin: 0; }
}

.report { border-left: 3px solid var(--warn-bg); }
.report-context { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.report-msg { background: var(--surface-2); border-radius: 10px; padding: 6px 10px; }
.report-msg.reported { background: var(--warn-bg); color: var(--warn-text); }
.report-msg-head { font-size: 0.82rem; color: var(--muted); margin-bottom: 2px; }
.report-msg.reported .report-msg-head { color: inherit; }
.report-flag { font-weight: 650; }
.report-reason { margin-top: 6px; font-size: 0.92rem; }

.role-flag { margin-left: 6px; }

.feedback-item { border-left: 3px solid var(--accent); }
.feedback-item.done { opacity: 0.6; border-left-color: var(--border); }

/* --- Rundschreiben (Verwaltung) --- */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 0 24px; }
.cols h4, .card h4 { margin: 8px 0; }
.pick-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; max-height: 260px; overflow-y: auto; }
.check.pick { align-items: flex-start; font-weight: 500; }
.check.pick input { margin-top: 3px; }
.steps { margin: 0 0 16px; padding-left: 22px; }
.steps li { margin-bottom: 4px; }
.mail-preview { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: var(--r-s); padding: 12px 14px; font: 0.92rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; max-height: 420px; overflow-y: auto; }
details > summary { cursor: pointer; font-weight: 650; margin: 8px 0; }
.col-map select { min-width: 130px; min-height: 40px; }
.col-map td.hint, .col-map tr.hint td { font-size: 0.85rem; }
.letters { display: none; }
.letter-preview { overflow-x: auto; padding: 8px 0 4px; }

/* Brief nach DIN 5008 Form B. Seitenrand oben/unten 12 mm, links/rechts 0 – deshalb die Abstände
   unten jeweils von der Blattkante minus 12 mm. Anschriftfeld 20 mm von links, ab 45 mm von oben. */
@page letter { size: A4; margin: 12mm 0; }
.letter {
  page: letter;
  position: relative; box-sizing: border-box; width: 210mm; min-height: 273mm; margin: 0 auto;
  padding: 0 20mm 0 25mm; background: #fff; color: #000; box-shadow: 0 1px 6px rgb(0 0 0 / 0.25);
  font: 11pt/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; break-after: page;
}
.letters .letter:last-child { break-after: auto; }
.letter-mark { position: absolute; left: 5mm; width: 5mm; border-top: 0.3pt solid #000; }
.letter-mark.fold1 { top: 93mm; }
.letter-mark.hole { top: 136.5mm; width: 7mm; }
.letter-mark.fold2 { top: 198mm; }
.letter-window { position: absolute; top: 33mm; left: 20mm; width: 85mm; height: 45mm; overflow: hidden; }
.letter-sender { height: 5mm; line-height: 5mm; font-size: 7pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 0.3pt solid #000; display: inline-block; max-width: 100%; }
.letter-address { margin-top: 12.7mm; font-size: 10.5pt; line-height: 1.25; }
.letter-date { position: absolute; top: 38mm; right: 20mm; }
.letter-body { padding-top: 86.5mm; padding-bottom: 4mm; }
.letter-body .pre { white-space: pre-wrap; }
.letter-subject { font-size: 12pt; font-weight: 700; margin: 0 0 8mm; }
.letter h3 { font-size: 11.5pt; margin: 7mm 0 2mm; border-bottom: 0.5pt solid #000; padding-bottom: 1mm; }
.letter-event, .letter-ann { display: flex; gap: 6mm; justify-content: space-between; align-items: flex-start; padding: 2.5mm 0; border-bottom: 0.3pt solid #bbb; break-inside: avoid; }
.letter-event > div:first-child { flex: 1; min-width: 0; }
.letter-ann { display: block; }
.letter-when { font-weight: 700; }
.letter-title { font-weight: 700; font-size: 12pt; }
.letter-qr { margin: 0; text-align: center; flex: none; }
.letter-qr .qr { display: block; width: 22mm; height: 22mm; }
.letter-qr figcaption { font-size: 7pt; }
.letter-outro { margin-top: 8mm; }
