/* Premium dark theme, modeled on high-end automotive HMI design (dark
   charcoal, soft gradients, a single restrained metallic-gold accent)
   rather than the club's earlier warm-parchment light look. Deliberately
   the one and only theme now (no prefers-color-scheme split) — this design
   only reads as "edel" if it's consistent everywhere, not toggled. */
:root {
  --color-bg: #0c0e13;
  --color-surface: #15181f;
  --color-surface-2: #1b1e26;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-text: #f2f3f5;
  --color-text-muted: #8b8f9b;
  --color-primary: #d4ac4a;
  --color-primary-hover: #e4c06c;
  --color-danger: #e0785a;
  --color-danger-hover: #ea9377;
  --color-accent: #d4ac4a;
  /* Text color for anything sitting on the gold accent — white on gold
     reads muddy, a deep espresso ink stays crisp and looks intentional. */
  --color-on-accent: #26190a;

  /* Gradients — the "Farbverläufe" that carry the premium feel: a soft
     vignette behind the whole app, subtle top-light on every card, and a
     brushed-gold sheen reserved for primary actions/highlights so it stays
     an accent, not wallpaper. */
  --gradient-bg: radial-gradient(120% 70% at 50% -10%, #232733 0%, #0f1116 45%, #0a0b0f 100%);
  --gradient-surface: linear-gradient(160deg, #1d212a 0%, #14161c 100%);
  --gradient-pill: linear-gradient(160deg, #262a34 0%, #191c23 100%);
  --gradient-accent: linear-gradient(135deg, #ecd08a 0%, #c69a3e 100%);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-pill: 0 4px 14px rgba(0, 0, 0, 0.35);
  /* Tighter "embossed tile" shadow for repeated list rows (evening/konto
     cards) — a thin bright bevel on the top inside edge, a dark gather at
     the bottom inside edge, and a short/close (not soft/floaty) drop shadow.
     Reads as raised/tactile without needing extra gap between rows the way
     --shadow-card's big soft blur does — keeps a dense roster scannable. */
  --shadow-tile: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -8px 10px -8px rgba(0, 0, 0, 0.55), 0 2px 5px rgba(0, 0, 0, 0.35);

  --radius: 16px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--gradient-bg);
  background-attachment: fixed;
  color: var(--color-text);
  font-family: var(--font-body);
  min-height: 100vh;
}

h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0 0 0.5em; }

/* Premium touch: focus rings in the accent gold instead of the browser
   default blue, applied globally so every input/select gets it for free. */
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(212, 172, 74, 0.22);
}

.hidden { display: none !important; }

/* ---------- Beta banner & version badge ---------- */
/* Sits above .signin-gate's fixed full-screen overlay (z-index: 300) —
   otherwise it's invisible on exactly the screen most first-time visitors
   see (before signing in), which defeats "deutlich markieren". */
.beta-banner {
  position: sticky; top: 0; z-index: 310;
  text-align: center; font-weight: 700; font-size: 0.85rem;
  padding: 0.5rem 1rem;
  background: #e6a33d; color: #221a08;
}
body.is-beta .app-header { border-bottom-color: #e6a33d; background: color-mix(in srgb, #e6a33d 10%, var(--color-surface)); }

/* Normal document flow, not fixed/floating — the very last thing on the
   page, after <main>. A fixed overlay always sits on top of whatever
   happens to be at that screen position, which on a short view (little
   content, no scrolling) meant it regularly covered real buttons/text.
   Living in the flow instead can never overlap anything. */
.app-version-footer {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.7rem; font-weight: 600; color: var(--color-text-muted);
  padding: 1rem 0 1.5rem;
  /* Now a <button> (tappable — opens the Änderungsprotokoll) but must keep
     looking like the plain text label it always was, not a default button. */
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}
.app-version-footer:hover { color: var(--color-primary); }

/* ---------- Header & tabs ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: transparent;
  border-bottom: 1px solid var(--color-border);
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-display); font-size: 1.3rem; font-weight: 900; }
/* Gradient wordmark — the one place the gold sheen shows up as text, a
   small signature touch rather than the flat accent color everywhere. */
.brand-name {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-icon { font-size: 1.5rem; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5)); }
.header-actions { display: flex; align-items: center; gap: 0.5rem; }

.online-users-row { display: flex; align-items: center; margin-right: 4px; }
.online-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gradient-accent);
  color: var(--color-on-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  font-family: var(--font-display);
  margin-left: -8px;
  border: 2px solid var(--color-bg);
  overflow: hidden;
  flex-shrink: 0;
}
.online-avatar:first-child { margin-left: 0; }
.online-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Styled as a floating segmented pill (à la premium in-car HMI nav) rather
   than the previous flat top-tab-strip look. */
.tab-bar {
  display: flex;
  gap: 0.2rem;
  margin: 0.5rem 1rem 0;
  padding: 0.2rem;
  background: var(--gradient-pill);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  box-shadow: var(--shadow-pill);
  overflow-x: auto;
}
.tab-btn {
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.tab-btn.active {
  color: var(--color-on-accent);
  background: var(--gradient-accent);
  font-weight: 700;
}

.app-body { max-width: 900px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.view-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.view-header-title { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--gradient-pill);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { border-color: rgba(255, 255, 255, 0.18); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--gradient-accent); border-color: transparent; color: var(--color-on-accent); font-weight: 700; box-shadow: var(--shadow-pill); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-danger-ghost { background: transparent; border-color: var(--color-danger); color: var(--color-danger); }
.btn-danger-ghost:hover { background: var(--color-danger); color: #fff; }
.btn-icon { padding: 0.4rem 0.6rem; border-radius: 999px; }
.btn-small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }

/* ---------- Kegelabend view ---------- */
.evening-date-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.evening-date-row input[type="date"] {
  font-family: var(--font-body);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
}
.evening-total-badge {
  font-weight: 700;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--gradient-accent);
  color: var(--color-on-accent);
  cursor: pointer;
  font-size: 0.9rem;
  box-shadow: var(--shadow-pill);
}
.evening-closed-badge {
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--color-text-muted);
  color: var(--color-bg);
  font-size: 0.85rem;
}

.guest-add-row, .add-row { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.guest-add-row { margin-top: 1.25rem; }
.guest-add-row input:disabled, .guest-add-row button:disabled { opacity: 0.5; cursor: default; }
.guest-add-row input, .add-row input {
  flex: 1;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-family: var(--font-body);
}

/* One row per person — name/attendance/total only, so the whole evening's
   names fit on screen at a glance. Tapping a row opens the full-screen
   per-person editor (#person-detail-modal), at every screen size. */
.evening-list { display: flex; flex-direction: column; gap: 0.3rem; }
.evening-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--gradient-surface);
  box-shadow: var(--shadow-tile);
  padding: 0.45rem 0.8rem;
}
.evening-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}
.evening-card-header:hover .person-name { color: var(--color-primary); }
.expand-chevron { color: var(--color-text-muted); font-size: 0.75rem; width: 0.8rem; display: inline-block; }
/* Left and right wrappers both get flex:1 so .person-name (also flex:1,
   text-align:center) sits on the true row midpoint no matter how wide the
   attendance control on either side is — a narrow guest "Gast" tag used to
   pull the name off-center relative to a member's wider "Anwesend" pill. */
.evening-card-header-left { display: flex; align-items: center; gap: 0.25rem; flex: 1; min-width: 0; }
.evening-card-header .person-name { font-weight: 600; font-size: 1.02rem; flex: 1; min-width: 0; text-align: center; }
.person-badges { display: inline-flex; align-items: center; gap: 0.25rem; }
.person-badges:empty { display: none; }
.king-icon { font-size: 1em; line-height: 1; }
.loui-icon { color: var(--color-accent); vertical-align: -0.15em; }
.evening-card-header { touch-action: pan-y; } /* leaves vertical scroll to the browser, horizontal drag to the swipe handler */
.evening-card-header-right { display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; flex: 1; min-width: 0; }
.evening-card .guest-tag { font-size: 0.75rem; color: var(--color-text-muted); }
.evening-card .row-total { font-weight: 600; color: var(--color-accent); min-width: 4.5rem; text-align: right; }
.absent-card .evening-card-header { cursor: default; }

.evening-card.selected { border-color: var(--color-primary); background: var(--color-bg); }
.multiselect-checkbox { width: 1.3rem; height: 1.3rem; accent-color: var(--color-primary); cursor: pointer; }

.multiselect-actionbar {
  margin-top: 0.75rem; padding: 0.6rem 0.8rem;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  background: var(--color-surface-2);
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem;
}
.multiselect-status { display: flex; flex-direction: column; gap: 0.1rem; }
.multiselect-actionbar #multiselect-count { font-weight: 600; }
#multiselect-hint { font-size: 0.78rem; color: var(--color-text-muted); }
#multiselect-hint.mismatch { color: var(--color-danger); font-weight: 600; }
.multiselect-penalty-buttons { display: flex; flex-wrap: wrap; gap: 0.4rem; flex: 1; }
.multiselect-penalty-btn { font-size: 0.85rem; }

.penalty-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  flex-wrap: nowrap;
  white-space: nowrap;
}
.penalty-chip-label { font-size: 0.8rem; color: var(--color-text-muted); white-space: nowrap; }
.choice-badge { white-space: nowrap; }

.attendance-toggle {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  background: var(--color-surface-2);
  cursor: pointer;
  font-size: 0.85rem;
}
.attendance-toggle.present { background: var(--gradient-accent); border-color: transparent; color: var(--color-on-accent); font-weight: 600; }
.attendance-toggle.absent { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }

.section-divider {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.2rem 0.1rem;
}
.absent-card { opacity: 0.55; }
.absent-card .stepper-btn, .absent-card .choice-cell-btn { cursor: default; }

.open-choices-section { margin-top: 1.5rem; }
.open-choices-section h3 { color: var(--color-text-muted); font-size: 0.95rem; }
.open-choices-list { display: flex; flex-direction: column; gap: 0.4rem; }
.open-choice-entry {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-2);
  cursor: pointer;
  font-size: 0.9rem;
}
.open-choice-entry:hover { border-color: var(--color-primary); }
.open-choice-date { color: var(--color-text-muted); min-width: 4.8rem; }
.open-choice-name { font-weight: 600; flex: 1; }
.open-choice-type { color: var(--color-accent); }

.logbook-row { margin-top: 1.5rem; text-align: center; }

.journal-section-title {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.5rem;
}
.journal-section-title:not(:first-child) { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--color-border); }
.booked-penalties-list { display: flex; flex-direction: column; gap: 0.35rem; }
.booked-penalty-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
}
.booked-penalty-row:last-child { border-bottom: none; }
.booked-penalty-person { font-weight: 600; min-width: 6rem; }
.booked-penalty-type { color: var(--color-accent); }
.booked-penalty-detail { flex: 1; color: var(--color-text-muted); }
.booked-penalty-actions { display: flex; align-items: center; gap: 0.3rem; }
.booked-penalty-edit-btn, .booked-penalty-delete-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.2rem 0.3rem;
  border-radius: var(--radius);
  line-height: 1;
}
.booked-penalty-edit-btn:hover, .booked-penalty-delete-btn:hover { background: var(--color-surface); }

.hint-spaced { margin-top: 0.75rem; }

.changelog-list { display: flex; flex-direction: column; gap: 0.6rem; }
.changelog-entry {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-2);
  padding: 0.6rem 0.8rem;
}
.changelog-entry-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
}
.changelog-version { font-weight: 700; color: var(--color-primary); }
.changelog-date { color: var(--color-text-muted); font-size: 0.78rem; }
.changelog-chevron { margin-left: auto; color: var(--color-text-muted); font-size: 0.75rem; transition: transform 0.15s; }
.changelog-entry.expanded .changelog-chevron { transform: rotate(90deg); }
.changelog-bullets { margin: 0.5rem 0 0; padding-left: 1.1rem; font-size: 0.88rem; display: flex; flex-direction: column; gap: 0.2rem; }
.changelog-detail {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  display: none;
}
.changelog-entry.expanded .changelog-detail { display: block; }

.evening-danger-row {
  margin-top: 1rem; padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
  display: flex; justify-content: center; gap: 0.6rem;
}
.evening-danger-row .btn { font-size: 0.78rem; padding: 0.3rem 0.6rem; opacity: 0.75; }
.evening-danger-row .btn:hover { opacity: 1; }
.logbook-list { display: flex; flex-direction: column; gap: 0.35rem; }
.logbook-entry {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
}
.logbook-entry:last-child { border-bottom: none; }
.logbook-time { color: var(--color-text-muted); font-variant-numeric: tabular-nums; min-width: 3rem; }
.logbook-date { color: var(--color-text-muted); font-variant-numeric: tabular-nums; min-width: 4.6rem; font-size: 0.78rem; }
.logbook-message { flex: 1; }
.logbook-user { color: var(--color-accent); font-size: 0.78rem; white-space: nowrap; }

/* ---------- Hilfe ---------- */
.hilfe-search-input {
  width: 100%;
  padding: 0.6rem 0.9rem;
  margin-bottom: 1rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.hilfe-chapters { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }

.admin-accounts-list { display: flex; flex-direction: column; gap: 0.6rem; }
.admin-account-row {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}
.admin-account-row-main { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; }
.admin-password-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.admin-account-row input, .admin-password-row input {
  flex: 1; min-width: 90px;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.9rem;
}
.admin-badge {
  font-size: 0.7rem; font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--gradient-accent);
  color: var(--color-on-accent);
}
.hilfe-paragraph { font-size: 0.9rem; line-height: 1.5; margin: 0 0 0.6rem; }
.hilfe-paragraph:last-child { margin-bottom: 0; }

.app-log-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.app-log-filters input, .app-log-filters select {
  flex: 1; min-width: 140px;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}

.stepper { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
.stepper-btn {
  width: 1.6rem; height: 1.6rem; line-height: 1;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-2);
  color: var(--color-text);
  cursor: pointer;
  font-size: 1rem;
}
.stepper-btn:disabled { opacity: 0.35; cursor: default; }
.stepper-count { min-width: 1.2rem; text-align: center; font-weight: 600; }
.variable-total { font-size: 0.75rem; color: var(--color-accent); margin-top: 0.15rem; }
.choice-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--gradient-accent);
  color: var(--color-on-accent);
  font-weight: 600;
  margin-top: 0.2rem;
}
.choice-badge.pending { background: var(--color-danger); }
.remove-guest-btn { border: none; background: none; color: var(--color-danger); cursor: pointer; font-size: 0.85rem; margin-left: 0.4rem; }

/* ---------- Verlauf ---------- */
.verlauf-list { display: flex; flex-direction: column; gap: 0.5rem; }
.verlauf-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-2);
  cursor: pointer;
}
.verlauf-item:hover { border-color: var(--color-primary); }
.verlauf-item .verlauf-date { font-weight: 600; }
.verlauf-item .verlauf-meta { color: var(--color-text-muted); font-size: 0.85rem; }
.verlauf-item .verlauf-total { font-weight: 600; color: var(--color-accent); }
.verlauf-status {
  display: inline-block;
  font-weight: 400;
  font-size: 0.72rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  vertical-align: middle;
}
.verlauf-status.closed { background: var(--color-text-muted); color: var(--color-bg); }
.verlauf-status.open { background: var(--gradient-accent); color: var(--color-on-accent); font-weight: 600; }

/* ---------- Konto ---------- */
.konto-guest-section { margin-top: 1.5rem; }
.konto-guest-section h3 { color: var(--color-text-muted); font-size: 0.95rem; }
.konto-list { display: flex; flex-direction: column; gap: 0.5rem; }
.konto-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--gradient-surface);
  box-shadow: var(--shadow-tile);
  padding: 0.75rem 1rem;
}
.konto-item-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  cursor: pointer;
  user-select: none;
}
.konto-item-header:hover .konto-name { color: var(--color-primary); }
.konto-item-header .konto-name { font-weight: 600; flex: 1; }
.konto-item-header .konto-balance { font-weight: 600; }
.konto-item-header .konto-balance.owes { color: var(--color-danger); }
.konto-item-header .konto-balance.settled { color: var(--color-text-muted); }

/* Booking-journal breakdown: date, what happened, signed amount, running balance. */
.konto-journal {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.journal-entry {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.journal-date { color: var(--color-text-muted); min-width: 4.8rem; }
.journal-label { flex: 1; }
.journal-label-link { cursor: pointer; text-decoration: underline; text-decoration-style: dotted; }
.journal-label-link:hover { color: var(--color-primary); }
.journal-amount { font-weight: 600; min-width: 4.5rem; text-align: right; }
.journal-amount.fine { color: var(--color-danger); }
.journal-amount.payment { color: var(--color-primary); }
.journal-balance { color: var(--color-text-muted); font-size: 0.78rem; min-width: 6rem; text-align: right; }
.journal-undo-btn {
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-danger);
  border-radius: 999px;
  width: 1.7rem; height: 1.7rem;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
}
.journal-undo-btn:hover { background: var(--color-danger); color: #fff; }
.journal-undo-spacer { width: 1.7rem; flex-shrink: 0; }

/* ---------- Custom numpad (variable-amount entry) ---------- */
.amount-display {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-accent);
  padding: 0.5rem 0 0.75rem;
}
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-bottom: 0.5rem; }
.numpad-btn {
  padding: 1rem 0;
  font-size: 1.4rem;
  font-weight: 600;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-2);
  color: var(--color-text);
  cursor: pointer;
}
.numpad-btn:active { background: var(--gradient-accent); color: var(--color-on-accent); border-color: transparent; }
.numpad-btn-del { font-size: 1.2rem; color: var(--color-danger); }

/* ---------- Settings ---------- */
.settings-section {
  padding: 1.1rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--gradient-surface);
  box-shadow: var(--shadow-card);
}
.member-list, .penalty-type-list { display: flex; flex-direction: column; gap: 0.4rem; }
.member-row, .penalty-type-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.member-row.inactive { opacity: 0.5; }
.penalty-type-row { cursor: pointer; }
.penalty-type-row:hover { border-color: var(--color-primary); }
.penalty-type-row.dragging { opacity: 0.5; border-color: var(--color-primary); }
.penalty-type-summary { color: var(--color-text-muted); font-size: 0.85rem; }
.drag-handle {
  cursor: grab;
  touch-action: none; /* so dragging on a phone reorders instead of scrolling the page */
  color: var(--color-text-muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 0.3rem;
  user-select: none;
}
.drag-handle:active { cursor: grabbing; }

.fine-amount-row { display: flex; align-items: center; gap: 0.75rem; }
.fine-amount-row input { width: 6rem; padding: 0.4rem 0.6rem; border-radius: var(--radius); border: 1px solid var(--color-border); background: var(--color-surface-2); color: var(--color-text); }

/* ---------- Statistik ---------- */
.stats-table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); }
.stats-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; white-space: nowrap; }
.stats-table th, .stats-table td { padding: 0.5rem 0.7rem; text-align: center; border-bottom: 1px solid var(--color-border); }
.stats-table th { background: var(--color-surface); font-weight: 600; }
.stats-table td:first-child, .stats-table th:first-child { text-align: left; position: sticky; left: 0; background: var(--color-surface); }
.stats-table tbody tr:last-child td { border-bottom: none; }
.stats-table .stats-name { font-weight: 600; }
.stats-table .stats-fines { color: var(--color-accent); font-weight: 600; }
.stats-table tr.best td { background: rgba(94, 140, 103, 0.18); }
.stats-table tr.worst td { background: rgba(168, 84, 47, 0.15); }

/* Deliberately quieter than the member leaderboard above — smaller, muted,
   no best/worst highlighting — guests are occasional visitors, not part of
   the club's season ranking. */
.stats-guest-wrap { max-width: 420px; }
.stats-table-compact { font-size: 0.78rem; }
.stats-table-compact th, .stats-table-compact td { padding: 0.35rem 0.6rem; color: var(--color-text-muted); }
.stats-table-compact .stats-fines { color: var(--color-text-muted); font-weight: 600; }

/* ---------- Kassenbuch ---------- */
.kassenbuch-balance-row { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.kassenbuch-balance { font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.4rem; color: var(--color-primary); }
.kassenbuch-opening { color: var(--color-text-muted); font-size: 0.85rem; }
#kassenbuch-list td:nth-child(2) { text-align: left; }
#kassenbuch-list td:nth-child(4) { color: var(--color-primary); }
#kassenbuch-list td:nth-child(5) { color: var(--color-danger); }
#kassenbuch-list td:nth-child(6) { font-weight: 600; }
.kassenbuch-row-payment { color: var(--color-text-muted); font-style: italic; }
.kassenbuch-edit-btn { font-style: normal; }
.kassensturz-diff.positive { color: var(--color-primary); }
.kassensturz-diff.negative { color: var(--color-danger); }

/* ---------- Termine ---------- */
.termine-calendar-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.termine-calendar-title { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.termine-calendar-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; font-size: 0.75rem; color: var(--color-text-muted);
  padding: 0 0.1rem; margin-bottom: 0.3rem;
}
.termine-calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.25rem;
  margin-bottom: 1.5rem;
}
.termine-day-cell {
  width: 100%;
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.2rem;
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) * 0.6);
  background: var(--gradient-surface);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
}
.termine-day-cell.other-month { opacity: 0.35; }
.termine-day-cell.today { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary); }
.termine-day-markers { display: flex; gap: 0.15rem; min-height: 0.4rem; }
.termine-marker { width: 0.35rem; height: 0.35rem; border-radius: 50%; background: var(--gradient-accent); }
.termine-marker.event { background: var(--color-text-muted); }
.termine-marker.blocked { background: var(--color-danger); }

.termine-upcoming-list { display: flex; flex-direction: column; gap: 0.4rem; }
.termine-upcoming-row {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  cursor: pointer;
  font-size: 0.9rem;
}
.termine-upcoming-row:hover { border-color: var(--color-primary); }
.termine-upcoming-date { color: var(--color-text-muted); min-width: 4.8rem; }
.termine-upcoming-title { font-weight: 600; flex: 1; }
.termine-upcoming-note { color: var(--color-text-muted); font-size: 0.82rem; }

.termin-day-list { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.75rem; }
.termin-day-entry {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}
.termin-day-entry.blocked { opacity: 0.6; }
.termin-day-entry-title { font-weight: 600; }
.termin-day-entry-note { color: var(--color-text-muted); font-size: 0.85rem; margin-top: 0.15rem; }
.termin-day-entry-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.termin-block-note-row { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.termin-block-note-row input {
  flex: 1; padding: 0.4rem 0.6rem;
  border-radius: var(--radius); border: 1px solid var(--color-border);
  background: var(--color-surface-2); color: var(--color-text); font-family: var(--font-body);
}

.settings-section select {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-family: var(--font-body);
  margin-bottom: 0.75rem;
}
.stats-player-checkboxes { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; margin-bottom: 1rem; }
.stats-player-checkbox { display: flex; align-items: center; gap: 0.35rem; font-size: 0.88rem; cursor: pointer; }

.stats-compare-result { display: flex; flex-direction: column; gap: 0.5rem; }
.stats-bar-row { display: flex; align-items: center; gap: 0.6rem; }
.stats-bar-label { width: 6rem; flex-shrink: 0; font-size: 0.85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-bar-track { flex: 1; background: var(--color-bg); border-radius: 999px; height: 1.15rem; overflow: hidden; }
.stats-bar-fill { height: 100%; background: var(--gradient-accent); border-radius: 999px; }
.stats-bar-value { width: 4rem; flex-shrink: 0; text-align: right; font-size: 0.85rem; font-weight: 600; color: var(--color-accent); }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4, 5, 8, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  /* Above .fullscreen-modal (320) — the choice/variable-amount modals must
     stay reachable when opened from within the mobile full-screen editor.
     Also above .beta-banner (310), which is sticky/always-on-screen — a
     close button positioned near the top would otherwise end up hidden
     behind the banner on Beta. */
  padding: 1rem; z-index: 330;
}
.modal {
  background: var(--gradient-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius);
  width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border); }
.modal-body { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.modal-body label { font-size: 0.85rem; color: var(--color-text-muted); margin-top: 0.4rem; }
.modal-body input[type="text"], .modal-body input[type="number"], .modal-body input[type="date"] {
  padding: 0.5rem 0.7rem; border-radius: var(--radius); border: 1px solid var(--color-border);
  background: var(--color-bg); color: var(--color-text); font-family: var(--font-body);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

.mode-radio-group { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.3rem 0; }
.mode-radio { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--color-text); }
.penalty-amount-fields { display: flex; flex-direction: column; gap: 0.3rem; }

.choice-option-btn { width: 100%; margin-bottom: 0.5rem; text-align: left; }

/* ---------- Full-screen per-person editor (mobile) ---------- */
.fullscreen-modal {
  position: fixed; inset: 0; z-index: 320; /* above .beta-banner (310), see .modal-overlay comment */
  background: var(--color-bg);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.fullscreen-modal-header {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  position: sticky; top: 0;
}
.fullscreen-modal-title { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; flex: 1; }
.fullscreen-modal-total { font-weight: 600; color: var(--color-accent); font-size: 1.1rem; }

.person-detail-chips { display: flex; flex-direction: column; gap: 0.7rem; padding: 1rem; }
/* Same .penalty-chip markup as the compact list, just stretched into big,
   full-width, one-per-row touch targets for the full-screen editor. */
.person-detail-chips .penalty-chip {
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  gap: 0.75rem;
}
.person-detail-chips .penalty-chip-label { font-size: 1.05rem; font-weight: 600; color: var(--color-text); }
.person-detail-chips .stepper { gap: 0.9rem; }
.person-detail-chips .stepper-btn { width: 3.2rem; height: 3.2rem; font-size: 1.5rem; }
.person-detail-chips .stepper-count { font-size: 1.3rem; min-width: 1.8rem; }
.person-detail-chips .choice-cell-btn { min-width: 3.2rem; min-height: 3.2rem; font-size: 1.4rem; }
.person-detail-chips .variable-total { font-size: 0.95rem; }

/* ---------- Toast & misc ---------- */
.empty-hint { color: var(--color-text-muted); text-align: center; padding: 2rem 1rem; }
.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--color-text); color: var(--color-bg);
  box-shadow: var(--shadow-pill);
  padding: 0.6rem 1.2rem; border-radius: 999px; font-size: 0.9rem; z-index: 200;
}

/* ---------- Sign-in gate ---------- */
.signin-gate {
  position: fixed; inset: 0; background: var(--gradient-bg);
  display: flex; align-items: center; justify-content: center; z-index: 300; padding: 1rem;
}
.signin-card {
  max-width: 380px; text-align: center;
  background: var(--gradient-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 2rem 1.5rem;
}
.signin-brand { display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-family: var(--font-display); font-size: 1.5rem; font-weight: 900; margin-bottom: 1rem; }
.signin-brand span:not(.brand-icon) { background: var(--gradient-accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.signin-copy { color: var(--color-text-muted); margin-bottom: 1.5rem; line-height: 1.5; }
.signin-form { display: flex; flex-direction: column; gap: 0.7rem; }
.signin-form input {
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
}
.signin-error { color: var(--color-danger); margin-top: 1rem; font-size: 0.9rem; }

@media (max-width: 600px) {
  .app-body { padding: 0.75rem 0.6rem 3rem; }

  .app-header { padding: 0.6rem 0.85rem; }
  .brand-name { font-size: 1.05rem; }

  .view-header { align-items: stretch; }
  .evening-date-row { width: 100%; }
  .evening-date-row input[type="date"] { flex: 1; min-width: 0; }

  .guest-add-row { flex-direction: column; }
  .guest-add-row #btn-add-guest { width: 100%; }

  /* Tap targets stay comfortable via the pill's own padding — kept tight
     here so all 9 regular players fit on one screen without scrolling. */
  .evening-card { padding: 0.4rem 0.65rem; }
  .evening-card-header .person-name { font-size: 1rem; }
  .attendance-toggle { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

  .konto-item-header { flex-wrap: wrap; }
  .konto-item-header .konto-name { flex-basis: 100%; }
  .journal-balance { display: none; }

  .modal { max-width: 100%; }
}
