/* Men's Day – Oberfläche. Mobil zuerst, ab 760px breiteres Raster. Hell/Dunkel nach Systemeinstellung. */
:root {
  /* Farben nach Golfclub Heidelberg-Lobenfeld: Clubblau #00A0E4 (gchl.de/Logo), Waldgrün #244B2E (Kickoff-Präsentation), Anthrazit #141617.
     Für Schrift und Buttons ein dunkleres Clubblau – das helle Blau erreicht auf Weiß nicht den nötigen Kontrast. */
  --bg: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #141617;
  --muted: #5b6168;
  --line: #e1e4e8;
  --accent: #0072a8;
  --accent-soft: #e3f3fb;
  --on-accent: #ffffff;
  --brand: #00a0e4;
  --green: #244b2e;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn: #8a5a00;
  --warn-soft: #fdf1d8;
  --ok: #1e7a46;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 22, 23, .06), 0 2px 8px rgba(20, 22, 23, .04);
  color-scheme: light;
}
/* Dunkel: nach Systemeinstellung – außer der Nutzer hat im Menü „Hell“ gewählt – oder ausdrücklich „Dunkel“ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141617;
    --surface: #1b1e20;
    --surface-2: #232629;
    --text: #edeff1;
    --muted: #9aa1a8;
    --line: #2c3034;
    --accent: #3db8f0;
    --accent-soft: #0f2d3b;
    --on-accent: #06121a;
    --brand: #00a0e4;
    --green: #5fae7c;
    --danger: #f2887f;
    --danger-soft: #3a1f1c;
    --warn: #f0c060;
    --warn-soft: #362b14;
    --ok: #5cc08b;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141617;
  --surface: #1b1e20;
  --surface-2: #232629;
  --text: #edeff1;
  --muted: #9aa1a8;
  --line: #2c3034;
  --accent: #3db8f0;
  --accent-soft: #0f2d3b;
  --on-accent: #06121a;
  --brand: #00a0e4;
  --green: #5fae7c;
  --danger: #f2887f;
  --danger-soft: #3a1f1c;
  --warn: #f0c060;
  --warn-soft: #362b14;
  --ok: #5cc08b;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a, button, summary, label[for], select, input[type="submit"], input[type="checkbox"] { cursor: pointer; }
h1, h2, h3 { line-height: 1.25; margin: 0; }

/* Grundlayout: Seitenleiste links, Inhalt rechts. Am Handy klappt die Leiste über das Menü-Symbol auf. */
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; }
.brand:hover { text-decoration: none; }
/* Club-Logo: weiß hinterlegtes Oval, damit es auch im Dunkelmodus sauber steht */
.brand-mark { width: 34px; height: 38px; flex: none; display: block; object-fit: contain; background: #fff; border-radius: 50%; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.2; }
.icon { flex: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  border: 0; background: transparent; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}

.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 256px; z-index: 40;
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 12px 18px; }
.sb-close { display: none; }
.sb-nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.sb-group { margin-bottom: 14px; }
.sb-title {
  font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 8px 10px 4px;
}
.sb-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 8px 10px; border-radius: 9px; border: 0; background: none;
  font: inherit; font-size: 15px; color: var(--text); text-align: left;
}
.sb-item .icon { color: var(--muted); }
.sb-item:hover { background: var(--surface-2); text-decoration: none; }
.sb-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.sb-item.active .icon { color: var(--accent); }
.sb-foot { border-top: 1px solid var(--line); padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 6px 10px 8px; min-width: 0; }
.sb-user div { min-width: 0; }
.sb-user b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-backdrop { display: none; }
.app-main { margin-left: 256px; min-width: 0; }
.mobilebar { display: none; }

@media (max-width: 959px) {
  .app-main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  .sb-close { display: inline-grid; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  body.nav-open .sb-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .35); }
  body.nav-open { overflow: hidden; }
  .mobilebar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30;
    padding: calc(6px + env(safe-area-inset-top)) 10px 6px; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .mobilebar .brand-mark { width: 28px; height: 31px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* Reiter innerhalb eines Bereichs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 18px; overflow-x: auto; }
.tabs a {
  padding: 8px 12px; color: var(--muted); font-size: 15px; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Inhalt */
.page { max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px; }
@media (min-width: 960px) { .page { padding: 28px 32px 56px; } }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 24px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 760px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .span-2 { grid-column: span 2; }
}
@media (min-width: 1320px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .span-2 { grid-column: span 2; }
}

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h2 { font-size: 15px; font-weight: 650; }
.card-head .count {
  margin-left: auto; font-size: 13px; font-weight: 600; padding: 1px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.card.danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.card.danger .card-head h2, .card.danger .count { color: var(--danger); }
.card.danger .count { background: var(--danger-soft); }

.empty { color: var(--muted); font-size: 14px; margin: 0; }

/* Nächster Men's Day */
.hero .hero-date { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hero .hero-date strong { font-size: 26px; font-weight: 700; }
.hero h3 { font-size: 17px; font-weight: 600; margin-top: 4px; }
.hero .meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.chip {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.muted { background: var(--surface-2); color: var(--muted); }
.progress { margin-top: 14px; }
.progress-bar { display: block; width: 100%; height: 8px; border: 0; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; appearance: none; -webkit-appearance: none; }
.progress-bar::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
.progress-bar::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.progress-bar::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.progress-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 0; }
.list .main { min-width: 0; flex: 1; }
.list .title { display: block; font-size: 15px; overflow-wrap: anywhere; }
.list a.title { color: var(--text); }
.list .sub { display: block; font-size: 13px; color: var(--muted); }
.list .aside { flex: none; }
.more { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

.dateblock {
  flex: none; width: 46px; text-align: center; border-radius: 10px; background: var(--surface-2);
  padding: 4px 0; line-height: 1.15;
}
.dateblock b { display: block; font-size: 17px; }
.dateblock span { font-size: 11px; color: var(--muted); text-transform: uppercase; }

/* Budget */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px; min-width: 0; }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat.pos b { color: var(--ok); }
.stat.neg b { color: var(--danger); }
.season { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

.group-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 12px 0 4px; }
.group-label:first-child { margin-top: 0; }

.notice {
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 18px; color: var(--muted);
}

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand { justify-content: center; margin-bottom: 20px; font-size: 18px; }
.auth-card .brand-mark { width: 50px; height: 56px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.btn {
  display: inline-block; width: 100%; font: inherit; font-weight: 600; font-size: 16px;
  padding: 12px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent);
}
.btn:hover { filter: brightness(1.05); }
.errors {
  background: var(--danger-soft); color: var(--danger); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; margin-bottom: 14px;
}
.errors p { margin: 0; }

@media (max-width: 759px) {
  .page-head h1 { font-size: 21px; }
}

/* ===== Module: Listen, Formulare, Details ===== */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.h2 { font-size: 20px; margin-bottom: 8px; }
.h3 { font-size: 15px; font-weight: 650; margin-bottom: 12px; }
.row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.head-actions { display: flex; gap: 8px; flex: none; }
.crumb { margin: 0 0 8px; font-size: 14px; }
.crumb a { color: var(--muted); }
.sub-head { margin-top: 28px; }
.sub-head h2 { font-size: 17px; }

.btn { width: auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn-sm { font-size: 14px; padding: 8px 14px; }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.danger-text { color: var(--danger); }
.auth .btn { width: 100%; }

.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.msg { padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 14px; }
.msg.error { background: var(--danger-soft); color: var(--danger); }
.msg.warning { background: var(--warn-soft); color: var(--warn); }
.msg.info { background: var(--surface-2); color: var(--text); }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }

/* Werkzeugleiste */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.toolbar input[type="search"], .toolbar select {
  font: inherit; font-size: 15px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.toolbar input[type="search"] { flex: 1 1 220px; min-width: 0; }
.toolbar .select { flex: 0 1 auto; min-width: 0; }
.toolbar select { max-width: 100%; }
.stats-bar { margin-bottom: 14px; }

/* Tabelle (am Handy als Karten) */
.card.flush { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: .03em; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table td.first a { color: var(--text); font-weight: 550; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { width: 1%; white-space: nowrap; text-align: right; }
.table tr.is-overdue td[data-label="Fällig"] { color: var(--danger); font-weight: 600; }
.table tr.is-done td.first a { color: var(--muted); text-decoration: line-through; }
.check {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface);
  color: transparent; font-size: 15px; font-weight: 700; line-height: 1;
}
.check:hover { border-color: var(--accent); color: var(--accent); }
.check.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check.htmx-request { opacity: .5; }
.actions form { display: inline; }

@media (max-width: 759px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { position: relative; padding: 12px 56px 12px 14px; border-top: 1px solid var(--line); }
  .table tbody tr:first-child { border-top: 0; }
  .table td { padding: 0; border: 0; text-align: left !important; font-size: 14px; color: var(--muted); }
  .table td.first { font-size: 15px; color: var(--text); margin-bottom: 2px; }
  .table td:not(.first):not(.actions):not(.m):not(:empty)::before { content: attr(data-label) ": "; }
  .table td:empty { display: none; }
  .table td.actions { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: auto; }
  .table .num { white-space: normal; }
}

.pager { display: flex; gap: 16px; justify-content: center; align-items: center; margin: 14px 0; font-size: 14px; color: var(--muted); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; margin: 20px 0 0; font-size: 14px; }
.footer-links a { color: var(--muted); }
.footer-links .danger-link { color: var(--danger); }

/* Detail */
.fields { display: grid; grid-template-columns: 1fr; gap: 12px 24px; margin: 0; }
@media (min-width: 760px) { .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fields .wide { grid-column: 1 / -1; } }
.fields dt { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.fields dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.fields dd.pre { white-space: pre-wrap; }
.section { margin-top: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-head h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.section-head .count, .count { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }

/* Formulare */
.form { max-width: 720px; }
.form-group { margin-bottom: 14px; }
.field select, .field textarea, .field input[type="text"], .field input[type="email"], .field input[type="url"],
.field input[type="number"], .field input[type="date"], .field input[type="time"], .field input[type="password"],
.field input[type="file"] {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.field textarea { resize: vertical; min-height: 96px; }
.field select:focus, .field textarea:focus, .field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.field .label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field-check label, .field-multi .multi label { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 15px; }
.field-check input, .field-multi input { width: 20px; height: 20px; accent-color: var(--accent); }
.field-multi .multi { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.req { color: var(--danger); }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.field-error { font-size: 13px; color: var(--danger); margin: 6px 0 0; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.narrow { max-width: 560px; }

/* Verlauf */
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.timeline > li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tl-head { font-size: 14px; }
.changes { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.changes s { color: var(--muted); }

@media (max-width: 759px) { .row-head { flex-wrap: wrap; } }

/* Umschalter Hell / Dunkel / Automatisch */
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; margin: 4px 0 8px;
  background: var(--surface-2); border-radius: 10px; }
.theme-switch button { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 4px;
  border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 12px; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.auth-theme { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 220px; }

/* Mein Konto / 2FA */
a.sb-user { color: var(--text); border-radius: 9px; }
a.sb-user:hover { background: var(--surface-2); text-decoration: none; }
.auth-wide { max-width: 520px; }
.steps { padding-left: 20px; display: grid; gap: 12px; }
.qr { display: inline-block; background: #fff; padding: 8px; border-radius: 12px; margin: 10px 0; line-height: 0; }
.qr svg { width: 200px; height: 200px; display: block; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; letter-spacing: .04em; overflow-wrap: anywhere; }
.field input[type="text"] { max-width: 100%; }

/* Schnellschalter in Listen (z. B. Termin veröffentlichen) */
.pill-toggle { font: inherit; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); white-space: nowrap; }
.pill-toggle:hover { border-color: var(--accent); color: var(--accent); }
.pill-toggle.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.pill-toggle.htmx-request { opacity: .5; }


/* Jahreswertung: Tabellen mit Eingabefeldern, Preisträger, Spaltenzuordnung */
.in-num { width: 76px; max-width: 100%; font: inherit; font-size: 16px; padding: 7px 8px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.in-num:focus, .table-form select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.in-check { width: 22px; height: 22px; accent-color: var(--accent); }
.table-form select { max-width: 260px; width: 100%; font: inherit; font-size: 15px; padding: 7px 8px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.table tr.is-prize td { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.table tr.is-warn td { background: color-mix(in srgb, var(--warn-soft) 70%, transparent); }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; margin-top: 0; z-index: 5; }
.form-wide { max-width: none; }
.colmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.colmap-item label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 4px; overflow-wrap: anywhere; }
.colmap-item select { width: 100%; font: inherit; font-size: 15px; padding: 8px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); }
.rules { margin-top: 8px; font-size: 14px; color: var(--muted); }
.rules summary { font-weight: 600; }
.rules ul { margin: 6px 0 0; padding-left: 20px; }
.section-head { flex-wrap: wrap; }
.section-head h2 { flex-wrap: wrap; min-width: 0; }
.section-head .head-actions { align-items: center; flex-wrap: wrap; flex: 0 1 auto; min-width: 0; }
.head-actions { flex-wrap: wrap; }
.link-danger { font: inherit; font-size: 14px; color: var(--danger); background: none; border: 0; padding: 0; text-decoration: underline; }
a.pill-toggle { display: inline-block; text-decoration: none; }
@media (max-width: 759px) {
  .table-form td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
  .table-form td:not(.first)::before { flex: none; }
  .table-form tr { padding-right: 14px; }
  .table-form select { max-width: 60%; }
}
@media print {
  .sidebar, .mobilebar, .no-print, .messages, .tabs { display: none !important; }
  .app-main { margin-left: 0; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; }
}

/* Name des Tools in der Kopfzeile am Handy: zweizeilig, damit er vollständig lesbar bleibt */
.mobilebar .brand small { font-size: 11px; }
.auth-card .brand small { font-size: 13px; }

/* Bearbeiten direkt aus der Zeile */
.table .actions { display: table-cell; }
.actions > * { vertical-align: middle; }
.row-edit { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: var(--muted); margin-left: 4px; }
.row-edit:hover { background: var(--surface-2); color: var(--accent); text-decoration: none; }
@media (max-width: 759px) {
  .table td.actions { display: flex; align-items: center; gap: 6px; }
  .table tr:has(.row-edit) { padding-right: 64px; }
  .table tr:has(.check):has(.row-edit) { padding-right: 104px; }
  /* Zeilen mit Schalter: Knöpfe unter den Text statt daneben – so bleibt der Text in voller Breite lesbar */
  .table tr:has(.pill-toggle) { padding-right: 14px; }
  .table tr:has(.pill-toggle) td.actions { position: static; transform: none; margin-top: 8px; justify-content: flex-start; }
  .table tr:has(.pill-toggle) .pill-toggle { min-height: 36px; }
  .row-edit { width: 40px; height: 40px; margin-left: 0; }
}

/* Bearbeiten an Ort und Stelle: dieselbe Feldanordnung wie in der Anzeige, nur mit Eingabefeldern */
.fields .slot { min-width: 0; }
.fields.is-edit { gap: 14px 24px; }
.fields.is-edit dt label { cursor: pointer; }
.fields dd.field { margin: 4px 0 0; }
.fields dd.field-check { display: flex; align-items: center; min-height: 40px; }
.fields .hint { margin-top: 4px; }
.card-edit { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 0 0 3px var(--accent-soft); }
.fields dd.field input[type="file"] { padding: 8px; }
.fields dd.field a { overflow-wrap: anywhere; }
#record.htmx-swapping { opacity: .6; }

/* ===== Handy: kürzere Wege ===== */
/* Filter: am Handy hinter einem Knopf, am großen Bildschirm wie bisher nebeneinander */
.filter-toggle { display: none; }
.filter-set { display: contents; }
.jump { display: none; }
.tabbar { display: none; }

@media (max-width: 759px) {
  .toolbar.has-filters { flex-wrap: wrap; }
  .toolbar input[type="search"] { flex: 1 1 0; }
  .filter-toggle {
    display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 42px; padding: 0 12px;
    font: inherit; font-size: 15px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--surface); color: var(--text);
  }
  .filter-toggle.on { border-color: var(--accent); color: var(--accent); }
  .filter-toggle .count { background: var(--accent); color: var(--on-accent); }
  .filter-toggle .count[hidden] { display: none; }
  .filter-set { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; flex: 1 1 100%; }
  .filter-set .select, .filter-set select { width: 100%; }
  .filter-set .select:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .js .toolbar:not(.filters-open) .filter-set { display: none; }

  /* Listenzeilen: Überschrift, darunter die Angaben als eine fortlaufende Zeile statt je Angabe eine Zeile */
  .table td.m { display: inline; }
  .table td.m:empty, .table td.m-hide { display: none; }
  .table td.m.m-sep::before { content: "· "; }
  .table td.m.m-label::before { content: attr(data-label) ": "; }
  .table td.m.m-sep.m-label::before { content: "· " attr(data-label) ": "; }
  .table td.m a { overflow-wrap: anywhere; }

  /* Detailseite: kurze Angaben zweispaltig, lange über die volle Breite */
  .fields:not(.is-edit) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
  .fields:not(.is-edit) .wide { grid-column: 1 / -1; }
  .jump { display: flex; gap: 8px; overflow-x: auto; margin: -6px -16px 14px; padding: 0 16px 4px; scrollbar-width: none; }
  .jump::-webkit-scrollbar { display: none; }
  .jump a {
    flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
    border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 14px;
  }
  .jump a:hover { text-decoration: none; border-color: var(--accent); }
  .section { scroll-margin-top: 64px; }

  /* Bearbeiten: Speichern bleibt am unteren Rand erreichbar, egal wie lang das Formular ist */
  .card-edit ~ .form-actions {
    position: sticky; bottom: 0; z-index: 20; margin: 16px -16px 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line); flex-wrap: nowrap;
  }
  .card-edit ~ .form-actions .btn { flex: 1; }
  form:has(> .card-edit) .head-actions { display: none; }
}

/* Leiste am unteren Rand: die vier meistgenutzten Bereiche und das vollständige Menü */
@media (max-width: 959px) {
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; inset: auto 0 0 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0;
    min-height: 56px; padding: 6px 2px; border: 0; background: none; font: inherit; font-size: 11px; color: var(--muted);
  }
  .tabbar span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--accent); font-weight: 600; }
  .page { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  /* Beim Bearbeiten tritt die Speichern-Leiste an ihre Stelle */
  body:has(.card-edit) .tabbar { display: none; }
  body:has(.card-edit) .page { padding-bottom: 0; }
  .mobilebar > .icon-btn { display: none; }
  .mobilebar { padding-left: 16px; }
}
@media print { .tabbar, .jump, .filter-toggle { display: none !important; } }
