/* spt base styles (v1, docs/DESIGN.md). Colours exist only as the tokens
   below: one light block, one dark block for the system preference and one
   identical dark block for the toggle. internal/web/static_test.go checks
   every block for WCAG 2.2 AA contrast and that no hex colour appears
   outside the token blocks. Primary and accent are the club's CI colours
   (ADR-007, ADR-010: turquoise and rust, derived per scheme); M1-05a
   replaces them through a generated theme sheet. The dark scheme is the
   default (layout.html sets data-theme="dark"). */

:root {
  --bg: #ffffff;
  --surface: #f3f4f6;
  --surface-2: #e5e7eb;
  --text: #16181d;
  --muted: #4b5160;
  --border: #767c8a;
  --focus: #16181d;
  /* CI colours (ADR-007/ADR-010): theme.Derive(theme.Default()); replaced
     per club via the generated theme sheet. */
  --primary: #007879;
  --on-primary: #ffffff;
  --primary-tint: #ebf4f4;
  --accent: #af3d04;
  --on-accent: #ffffff;
  --accent-tint: #f5e8e1;
  /* Login button (ADR-010): Grau #2 of the club, white label. */
  --login-button: #525252;
  --on-login-button: #ffffff;
  /* Status colours: fixed, never configurable. */
  --success: #1b7a3d;
  --success-bg: #e6f4ea;
  --warning: #8a5a00;
  --warning-bg: #fef7e0;
  --error: #b3261e;
  --error-bg: #fce8e6;
  --info: #1565c0;
  --info-bg: #e8f0fe;
  /* Area palette (fixed, from v0): stripe and tinted background. */
  --area-red: #c62828;
  --area-red-bg: #fde2e2;
  --area-orange: #b45309;
  --area-orange-bg: #fdebd3;
  --area-yellow: #8a6d00;
  --area-yellow-bg: #fbf3c4;
  --area-green: #2e7d32;
  --area-green-bg: #dcf2de;
  --area-teal: #00796b;
  --area-teal-bg: #d3f0ec;
  --area-blue: #1565c0;
  --area-blue-bg: #dce9fb;
  --area-indigo: #3949ab;
  --area-indigo-bg: #e2e5f8;
  --area-purple: #7b1fa2;
  --area-purple-bg: #efe0f7;
  --area-pink: #ad1457;
  --area-pink-bg: #fbe0ec;
  --area-gray: #616161;
  --area-gray-bg: #e8e9ec;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171717;
    --surface: #1f1f1f;
    --surface-2: #262626;
    --text: #cfcfcf;
    --muted: #8c8c8c;
    --border: #707070;
    --focus: #cfcfcf;
    --primary: #00aaac;
    --on-primary: #171717;
    --primary-tint: #1a3536;
    --accent: #fa6115;
    --on-accent: #171717;
    --accent-tint: #39271e;
    --login-button: #525252;
    --on-login-button: #ffffff;
    --success: #6cc070;
    --success-bg: #17301f;
    --warning: #e3b341;
    --warning-bg: #3a2f0f;
    --error: #f28b82;
    --error-bg: #3d1a1a;
    --info: #7fb2f0;
    --info-bg: #1c2b45;
    --area-red: #ef7a7a;
    --area-red-bg: #3f1d1d;
    --area-orange: #f0a45c;
    --area-orange-bg: #3d2a14;
    --area-yellow: #e3c84a;
    --area-yellow-bg: #3a3312;
    --area-green: #6cc070;
    --area-green-bg: #1a3320;
    --area-teal: #4fc3b5;
    --area-teal-bg: #133330;
    --area-blue: #7fb2f0;
    --area-blue-bg: #172a45;
    --area-indigo: #9aa5ec;
    --area-indigo-bg: #22264a;
    --area-purple: #c58be0;
    --area-purple-bg: #331f40;
    --area-pink: #ee88b4;
    --area-pink-bg: #3d1b2c;
    --area-gray: #a8adb8;
    --area-gray-bg: #2a2d34;
  }
}

:root[data-theme="dark"] {
  --bg: #171717;
  --surface: #1f1f1f;
  --surface-2: #262626;
  --text: #cfcfcf;
  --muted: #8c8c8c;
  --border: #707070;
  --focus: #cfcfcf;
  --primary: #00aaac;
  --on-primary: #171717;
  --primary-tint: #1a3536;
  --accent: #fa6115;
  --on-accent: #171717;
  --accent-tint: #39271e;
  --login-button: #525252;
  --on-login-button: #ffffff;
  --success: #6cc070;
  --success-bg: #17301f;
  --warning: #e3b341;
  --warning-bg: #3a2f0f;
  --error: #f28b82;
  --error-bg: #3d1a1a;
  --info: #7fb2f0;
  --info-bg: #1c2b45;
  --area-red: #ef7a7a;
  --area-red-bg: #3f1d1d;
  --area-orange: #f0a45c;
  --area-orange-bg: #3d2a14;
  --area-yellow: #e3c84a;
  --area-yellow-bg: #3a3312;
  --area-green: #6cc070;
  --area-green-bg: #1a3320;
  --area-teal: #4fc3b5;
  --area-teal-bg: #133330;
  --area-blue: #7fb2f0;
  --area-blue-bg: #172a45;
  --area-indigo: #9aa5ec;
  --area-indigo-bg: #22264a;
  --area-purple: #c58be0;
  --area-purple-bg: #331f40;
  --area-pink: #ee88b4;
  --area-pink-bg: #3d1b2c;
  --area-gray: #a8adb8;
  --area-gray-bg: #2a2d34;
}


/* Non-colour tokens (docs/DESIGN.md 3.2–3.3): spacing, type scale, radii,
   shadows and the hairline. Components use these steps only; --line is
   the decorative hairline between rows and around cards (the tone of
   --surface-2, no contrast requirement), while borders of controls
   (fields, buttons, chips, focus) stay in --border or --primary. */
:root {
  color-scheme: light dark;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --text-xs: 0.75rem;
  --text-s: 0.875rem;
  --text-m: 1rem;
  --text-l: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 2rem;
  --radius-s: 0.375rem;
  --radius: 0.5rem;
  --radius-l: 0.75rem;
  --radius-full: 999px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.16);
  --line: var(--surface-2);
  --tap: 2.75rem;
  --nav-height: 3.5rem;
  --content-width: 64rem;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-m);
  line-height: 1.5;
}
/* Headings (ADR-010, deviation 7): only h1 carries the club's rust – the
   exact rust in the light scheme, the derived lighter tone in the dark one
   (rust itself has only 2.98:1 on Nacht). h2 and h3 stay in the text colour
   so the accent marks one place per page. */
h1, h2, h3 { line-height: 1.25; margin: 0 0 var(--space-3); letter-spacing: -0.01em; }
h1 { font-size: var(--text-xl); font-weight: 700; color: var(--accent); }
h2 { font-size: var(--text-l); font-weight: 600; }
h3 { font-size: var(--text-m); font-weight: 600; }
p { margin: 0 0 var(--space-3); }
ul, ol { margin: 0 0 var(--space-3); padding-left: 1.25rem; }
code, pre { font-family: var(--font-mono); }
a { color: var(--primary); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.big-number { margin: 0; font-size: var(--text-2xl); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.big-number + .muted { margin-top: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.skip-link {
  position: absolute; left: var(--space-2); top: -10rem; z-index: 100;
  padding: var(--space-2) var(--space-3);
  background: var(--primary); color: var(--on-primary); border-radius: var(--radius-s);
}
.skip-link:focus { top: var(--space-2); }

/* Header (docs/DESIGN.md 5.1): one quiet line on the page background with
   a hairline below – brand (logo and name), on large screens the
   navigation as a text line, right the colour scheme button and, on large
   screens, the account name and logging out. */
.app-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.app-header-inner {
  max-width: var(--content-width); margin: 0 auto;
  display: flex; align-items: center; gap: var(--space-4);
  min-height: var(--nav-height); padding: 0 var(--space-4);
}
/* Brand: the rust logo (2 rem high, at least 24 px as the CI draft asks)
   and the app name in primary. The gap of 0.5 rem keeps the clear space of
   a quarter of the logo width (1.5 rem). */
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 700; font-size: var(--text-l); letter-spacing: 0.01em; color: var(--primary); text-decoration: none; flex: 0 0 auto; }
.brand-logo { display: block; height: 2rem; width: auto; flex: 0 0 auto; }
.header-actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; flex: 0 0 auto; }
.header-actions form { margin: 0; }
.header-account { display: none; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: var(--text-s); text-decoration: none; }
.header-account:hover { text-decoration: underline; }
.header-logout { display: none; }
.header-login { font-size: var(--text-s); }
/* Colour scheme as an icon button: theme.js sets data-theme-state and the
   aria-label; the icon of the current state is shown, the others hidden. */
.theme-toggle .theme-icon { display: none; }
.theme-toggle[data-theme-state="system"] .theme-icon[data-theme-icon="system"],
.theme-toggle[data-theme-state="light"] .theme-icon[data-theme-icon="light"],
.theme-toggle[data-theme-state="dark"] .theme-icon[data-theme-icon="dark"] { display: inline-flex; }

/* Navigation: one list, at most four targets per role. Fixed at the bottom
   on phones (icon above word, hairline above), from 48 rem a text line in
   the header. Active entry: primary colour and a 2-px line. */
.app-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--bg); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.app-nav ul { list-style: none; margin: 0; padding: 0; display: flex; }
.app-nav li { flex: 1; min-width: 0; }
.app-nav a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--nav-height); padding: var(--space-1);
  text-decoration: none; color: var(--muted); font-size: var(--text-xs); font-weight: 600;
}
.app-nav a::after { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 2px; border-radius: var(--radius-full); background: transparent; }
.app-nav a:hover { color: var(--text); }
.app-nav a[aria-current="page"] { color: var(--primary); }
.app-nav a[aria-current="page"]::after { background: var(--primary); }
.app-nav a:focus-visible { outline-offset: -3px; }
.app-nav .icon { width: 1.5rem; height: 1.5rem; stroke-width: 1.75; }
.app-nav .count { position: absolute; top: var(--space-1); left: calc(50% + 0.5rem); }
.app-main {
  max-width: var(--content-width); margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-8);
  display: flex; flex-direction: column; gap: var(--space-5);
}
body.with-nav .app-main { padding-bottom: calc(var(--nav-height) + var(--space-6) + env(safe-area-inset-bottom)); }
.app-main:focus { outline: none; }
.app-main > h1, .app-main > p, .app-main > ul, .app-main > ol { margin-bottom: 0; }
@media (min-width: 48rem) {
  .header-account, .header-logout { display: inline-flex; }
  .app-nav { position: static; flex: 1; min-width: 0; background: transparent; border-top: 0; padding-bottom: 0; }
  .app-nav ul { gap: var(--space-2); }
  .app-nav li { flex: 0 0 auto; }
  .app-nav a { flex-direction: row; gap: var(--space-2); padding: 0 var(--space-2); font-size: var(--text-m); font-weight: 500; }
  .app-nav a::after { top: auto; bottom: 0; left: var(--space-2); right: var(--space-2); }
  .app-nav .icon { display: none; }
  .app-nav .count { position: static; }
  body.with-nav .app-main { padding-bottom: var(--space-8); }
}

.icon { display: inline-block; width: 1.25rem; height: 1.25rem; vertical-align: -0.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* Auth frame: login, password, setup, invitation, confirmation, error and
   offline pages – one narrow card, centred on both axes. */
.auth {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: calc(100vh - var(--nav-height) - var(--space-8) - var(--space-5));
  min-height: calc(100dvh - var(--nav-height) - var(--space-8) - var(--space-5));
  padding: var(--space-4) 0;
}
body.with-nav .auth {
  min-height: calc(100vh - 2 * var(--nav-height) - var(--space-8) - var(--space-5));
  min-height: calc(100dvh - 2 * var(--nav-height) - var(--space-8) - var(--space-5));
}
@media (min-width: 48rem) {
  body.with-nav .auth {
    min-height: calc(100vh - var(--nav-height) - var(--space-8) - var(--space-5));
    min-height: calc(100dvh - var(--nav-height) - var(--space-8) - var(--space-5));
  }
}
.auth-card {
  width: 100%; max-width: 22rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-1);
  padding: var(--space-6) var(--space-5);
}
.auth-card-wide { max-width: 26rem; }
.auth-card > :last-child { margin-bottom: 0; }
.auth-card h1 { text-align: center; margin-bottom: var(--space-5); }
.auth-card h2 { margin-bottom: var(--space-3); }
.auth-card .steps { justify-content: center; }
.auth-card .form { max-width: none; }
.auth-card .form .button-row { margin-top: var(--space-2); }
.auth-card .form .button-row .button { flex: 1; }
.auth-card .flash { margin-bottom: var(--space-4); }
.auth-aside { margin-top: var(--space-3); display: flex; flex-direction: column; align-items: center; gap: var(--space-1); }
.auth-aside form { margin: 0; width: 100%; }
.auth-aside .button { width: 100%; }
.auth-links { margin: var(--space-4) 0 0; text-align: center; font-size: var(--text-s); }
.auth-links p { margin: 0 0 var(--space-2); }
/* Login page (ADR-010): the rust logo above the heading. */
.login-logo { display: block; height: 6rem; width: auto; margin: 0 auto var(--space-4); }

/* Buttons (5.4): primary filled, secondary outlined, quiet (text only),
   danger, big, icon. Controls keep --primary or --border (≥ 3:1). */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap); padding: 0 var(--space-4);
  border: 1px solid var(--primary); border-radius: var(--radius-s);
  background: var(--primary); color: var(--on-primary);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.button-secondary { background: transparent; color: var(--primary); }
.button-secondary:hover { background: var(--primary-tint); }
.button-quiet { background: transparent; color: var(--primary); border-color: transparent; }
.button-quiet:hover { background: var(--surface); }
.button-danger { background: var(--error); border-color: var(--error); color: var(--on-primary); }
.button-big { width: 100%; min-height: 3.5rem; font-size: var(--text-l); }
.button-icon { width: var(--tap); padding: 0; border-radius: var(--radius-full); flex: 0 0 auto; }
.button-icon .icon { width: 1.5rem; height: 1.5rem; vertical-align: middle; }
/* Login button (ADR-010): the club's grey with a white label; the 1-px
   border in --border keeps the outline visible on the dark surfaces, where
   the grey alone has less than 3:1. On hover the fill turns primary. */
.button-login { background: var(--login-button); color: var(--on-login-button); border-color: var(--border); }
.button-login:hover { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.button[aria-disabled="true"], .button:disabled { opacity: 0.55; cursor: not-allowed; }
.button-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.button-row form { margin: 0; }

/* Cards (5.2): one topic, one main action; a hairline instead of a frame. */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--space-4);
}
.card h1, .card h2, .card h3 { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card-primary { border-left: 0.25rem solid var(--primary); }
.card-accent { border-color: var(--accent); background: var(--accent-tint); }
.card-narrow { max-width: 30rem; }
@media (min-width: 48rem) {
  .card { padding: var(--space-5); }
}
/* Stamp card (M5-02): the big button first, the others below it. Clocking
   needs the server, so the offline copy of the start page hides it. */
.stamp-actions { margin-top: var(--space-3); }
.stamp-actions .button-big { flex-basis: 100%; }
[data-offline-stand]:not([hidden]) ~ .stamp { display: none; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.section-title h2, .section-title h3 { margin: 0; }
.two { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }

/* Lists and rows (5.3): the whole row is the target; a hairline between
   rows, no box. Cards in a list keep a gap instead. */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list > li + li > .row, .list > li + li.row { border-top: 1px solid var(--line); }
.list > li + li.card { margin-top: var(--space-3); }
.list .card p { margin: 0 0 var(--space-1); }
.list .card p:last-child { margin-bottom: 0; }
.row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-3);
  min-height: var(--tap); padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-s);
  color: inherit; text-decoration: none;
}
a.row:hover { background: var(--surface); }
.row:focus-visible { outline-offset: -3px; }
.row:empty { display: none; }
.row .when { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .what { min-width: 0; grid-column: 2; }
.row .what strong { display: block; }
.row .what .muted { overflow-wrap: anywhere; }
.row .what .line { display: block; }
.row .chev { color: var(--muted); display: inline-flex; }
.row .chips { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-1); }
.row-day { display: block; font-weight: 600; color: var(--muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; margin: var(--space-4) 0 var(--space-1); }
.row.past { color: var(--muted); }
.today { box-shadow: inset 0.25rem 0 0 var(--accent); padding-left: var(--space-4); }
.pager { display: flex; gap: var(--space-4); flex-wrap: wrap; font-size: var(--text-s); }

/* Chips (5.6): a word in a pill, colour never alone. */
.chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  min-height: 1.75rem; padding: 0 var(--space-2);
  border: 1px solid var(--border); border-radius: var(--radius-full);
  font-size: var(--text-s); font-weight: 600; line-height: 1; white-space: nowrap;
  background: var(--bg); color: var(--text);
}
.chip-success { background: var(--success-bg); border-color: var(--success); }
.chip-warning { background: var(--warning-bg); border-color: var(--warning); }
.chip-error { background: var(--error-bg); border-color: var(--error); border-width: 2px; }
.chip-info { background: var(--info-bg); border-color: var(--info); }
.chip-primary { background: var(--primary-tint); border-color: var(--primary); color: var(--primary); }
.chip-accent { background: var(--accent-tint); border-color: var(--accent); }
.area-chip { border-color: var(--area-stripe); background: var(--area-bg); }
.count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.5rem; height: 1.5rem; padding: 0 var(--space-1);
  border-radius: var(--radius-full); background: var(--accent); color: var(--on-accent);
  font-size: var(--text-xs); font-weight: 700; line-height: 1;
}

/* Conflict codes (5.7): letter plus outline shape, three severities. */
.code {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.75rem; height: 1.75rem; padding: 0 var(--space-1);
  border: 2px solid var(--warning); border-radius: var(--radius-s);
  font-size: var(--text-xs); font-weight: 700; line-height: 1; color: var(--text); background: var(--warning-bg);
}
.code-error { border-color: var(--error); background: var(--error); color: var(--on-primary); border-radius: var(--radius-full); }
.code-note { border-style: dashed; border-color: var(--info); background: var(--info-bg); }

/* Flash messages (5.12): stripe in the status colour on the status tint,
   text in --text, no outer frame. */
.flash {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-left: 0.25rem solid var(--border); border-radius: var(--radius-s);
  color: var(--text);
}
.flash p { margin: 0; }
.flash-success { background: var(--success-bg); border-left-color: var(--success); }
.flash-warning { background: var(--warning-bg); border-left-color: var(--warning); }
.flash-error { background: var(--error-bg); border-left-color: var(--error); }
.flash-info { background: var(--info-bg); border-left-color: var(--info); }
.card .flash { margin-bottom: var(--space-3); }

/* Forms (5.5): label above, 44-px fields in --border, hint and error below
   the field. */
.form { display: flex; flex-direction: column; gap: var(--space-4); max-width: 28rem; }
.form-wide { max-width: none; }
.form-wide .two > div { max-width: 28rem; }
.form label, .form .label { font-weight: 600; font-size: var(--text-s); display: block; margin-bottom: var(--space-1); }
.form input, .form select, .form textarea {
  width: 100%; min-height: var(--tap); padding: var(--space-2) var(--space-3);
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-s);
}
.form input[type="time"], .form input[type="date"] { width: auto; }
.form input[readonly] { color: var(--muted); background: var(--surface-2); }
/* Qualification rows of the profile (M2-03): checkbox line, end date below. */
.form .qualification .until { display: flex; align-items: center; gap: var(--space-2); margin-left: calc(1.5rem + var(--space-2)); }
.form .qualification .until label { margin: 0; font-weight: 400; }
/* Catalogue entries on the settings page (M2-04): one small form each,
   separated by a hairline. */
.catalogue-entry { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.catalogue-entry .button-row { margin-top: var(--space-2); }
.catalogue-new { margin-top: var(--space-5); }
.form .hint, .hint { margin: var(--space-1) 0 0; font-size: var(--text-s); color: var(--muted); }
.error-text { margin: var(--space-1) 0 0; font-size: var(--text-s); font-weight: 600; color: var(--error); }
.form > .error-text { margin: 0; }
.form [aria-invalid="true"] { border: 2px solid var(--error); }
.form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.form legend { font-weight: 600; font-size: var(--text-s); padding: 0; margin-bottom: var(--space-1); }
.form .choice, .choice { display: flex; align-items: center; gap: var(--space-2); min-height: var(--tap); font-weight: 400; font-size: var(--text-m); margin: 0; }
.form .choice input, .choice input { width: 1.5rem; height: 1.5rem; min-height: auto; margin: 0; accent-color: var(--primary); flex: 0 0 auto; }
.choices { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.form .button-row { margin-top: var(--space-1); }
.segmented { display: flex; border: 1px solid var(--border); border-radius: var(--radius-s); overflow: hidden; }
.segmented label { flex: 1; margin: 0; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 var(--space-2); font-weight: 600; text-align: center; }
.segmented input:checked + span { background: var(--primary); color: var(--on-primary); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }
/* Availability (M4-06): one button per answer, the given one pressed. */
.segmented button { flex: 1; min-height: var(--tap); margin: 0; padding: 0 var(--space-2); border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.segmented button:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.availability form { flex: 1 1 18rem; margin: 0; }

/* Setup: numbered step list, current step bold. */
.steps { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-4); padding: 0; list-style: none; color: var(--muted); font-size: var(--text-s); }
.steps [aria-current="step"] { font-weight: 700; color: var(--text); }
.prefs .button-row { gap: var(--space-3); }

/* Facts (key/value lists, e.g. account details). */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-4); margin: 0 0 var(--space-4); }
.facts dt { font-weight: 600; font-size: var(--text-s); color: var(--muted); padding-top: 0.125rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts dd.notes { white-space: pre-line; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: var(--space-3); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }

/* Empty state (5.10), loading (5.11), confirmation (5.13). */
.empty { text-align: center; padding: var(--space-7) var(--space-4); color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: var(--text-l); margin-bottom: var(--space-2); }
.empty .button { margin-top: var(--space-4); }
.skeleton { height: 1em; border-radius: var(--radius-s); background: var(--surface-2); margin-bottom: var(--space-2); }
.spinner { display: inline-block; width: 1.25rem; height: 1.25rem; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.htmx-indicator { opacity: 0; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
dialog.confirm { border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-2); background: var(--surface); color: var(--text); padding: var(--space-5); max-width: 24rem; }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); }

/* Staffing (5.9) and plan grid (5.8): shift blocks with an area stripe;
   the meter fills in tenths (meter-fill-0 … -10, set by the server – the
   CSP allows no inline style). */
.shift { border-left: 0.25rem solid var(--area-stripe, var(--border)); }
.meter { display: inline-block; width: 4.5rem; height: 0.5rem; border-radius: var(--radius-full); background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; vertical-align: middle; }
.meter-fill { display: block; height: 100%; width: 0; background: var(--success); }
.meter-short .meter-fill { background: var(--warning); }
.meter-fill-1 { width: 10%; }
.meter-fill-2 { width: 20%; }
.meter-fill-3 { width: 30%; }
.meter-fill-4 { width: 40%; }
.meter-fill-5 { width: 50%; }
.meter-fill-6 { width: 60%; }
.meter-fill-7 { width: 70%; }
.meter-fill-8 { width: 80%; }
.meter-fill-9 { width: 90%; }
.meter-fill-10 { width: 100%; }

/* Besetzung (5.9, M3-04): the places of a shift, the candidate list in
   place and the codes with their texts behind a tap. Places and candidates
   are rows with a hairline, not boxes. */
.slots { list-style: none; margin: var(--space-2) 0 0; padding: 0; }
.slot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); min-height: var(--tap); padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.slot:first-child { border-top: 0; }
.slot .person { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; min-width: 0; }
.slot-open .person { color: var(--muted); font-style: italic; }
.slot .reason { flex-basis: 100%; font-size: var(--text-s); }
/* Read confirmation at a staffed place (M10-07): quiet when seen, bold when not. */
.slot .seen { font-size: var(--text-s); color: var(--muted); }
.slot .seen-not { font-weight: 600; }
.slot form { margin: 0; }
.slot > .error-text { flex-basis: 100%; margin: 0; }
.pick { min-height: var(--tap); padding: 0 var(--space-3); }
.picker-sheet { flex-basis: 100%; margin-top: var(--space-2); padding: var(--space-3); }
.picker-search input { width: 100%; }
.picker { list-style: none; margin: var(--space-2) 0 0; padding: 0; }
.picker li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); min-height: var(--tap); padding: var(--space-1) 0; border-top: 1px solid var(--line); }
.picker .name { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; min-width: 0; }
.picker form.assign { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-1); margin: 0; }
.picker form.assign label { font-weight: 600; font-size: var(--text-s); }
.picker form.assign textarea { width: 100%; min-width: 14rem; min-height: 3.5rem; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--bg); color: var(--text); padding: var(--space-2); font: inherit; }
.picker form.assign [aria-invalid="true"] { border: 2px solid var(--error); }
.picker .error-text { margin: 0; }
.picker-hint { margin: var(--space-2) 0 0; font-size: var(--text-s); }
.codes { display: inline-block; }
.codes summary { list-style: none; display: inline-flex; gap: var(--space-1); cursor: pointer; }
.codes summary::-webkit-details-marker { display: none; }
.code-texts { list-style: none; margin: var(--space-1) 0 0; padding: 0; font-size: var(--text-s); display: flex; flex-direction: column; gap: var(--space-1); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.shift-delete { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--line); }

/* Planen (5.8): month navigation (title between two round icon buttons),
   the event row with its date column, and the confirmation sheets (5.13)
   as <details>. */
.month-nav { display: flex; align-items: center; gap: var(--space-2); }
.month-nav h1, .month-nav h2, .month-nav h3 { margin: 0; flex: 1; text-align: center; }
.month-nav > span { width: var(--tap); flex: 0 0 auto; }
.row.event { grid-template-columns: 3.25rem 1fr auto; }
.row.event .date { text-align: center; line-height: 1.1; }
.row.event .date b { display: block; font-size: var(--text-xl); font-variant-numeric: tabular-nums; }
.row.event .date small { color: var(--muted); font-weight: 600; font-size: var(--text-xs); }
details.sheet { margin-top: var(--space-4); }
.app-main > details.sheet { margin-top: 0; }
details.sheet summary { cursor: pointer; font-weight: 600; min-height: var(--tap); display: flex; align-items: center; }
details.sheet summary:focus-visible { outline-offset: -3px; }
details.sheet[open] summary { margin-bottom: var(--space-3); }
/* Offen (M4-03): a shift with "Übernehmen", the confirmation opens below it. */
.offer .what strong { display: block; }
.offer details.take { margin: 0; }
.offer details.take[open] { flex-basis: 100%; }
.offer details.take summary { list-style: none; display: inline-flex; align-items: center; cursor: pointer; }
.offer details.take summary::-webkit-details-marker { display: none; }
.offer details.take[open] summary { display: none; }
/* Prüfen (M4-05): when and who on their own lines, the actions below. */
.review-row { row-gap: var(--space-1); }
.review-row > .person { flex-basis: 100%; }
.review-row > form.form { gap: var(--space-2); }
/* Veröffentlichen (M4-01): the main action of the event page and the month
   list, a sheet framed in the primary colour. */
details.publish { border-color: var(--primary); }
details.publish summary { color: var(--primary); }
.area-red { --area-stripe: var(--area-red); --area-bg: var(--area-red-bg); }
.area-orange { --area-stripe: var(--area-orange); --area-bg: var(--area-orange-bg); }
.area-yellow { --area-stripe: var(--area-yellow); --area-bg: var(--area-yellow-bg); }
.area-green { --area-stripe: var(--area-green); --area-bg: var(--area-green-bg); }
.area-teal { --area-stripe: var(--area-teal); --area-bg: var(--area-teal-bg); }
.area-blue { --area-stripe: var(--area-blue); --area-bg: var(--area-blue-bg); }
.area-indigo { --area-stripe: var(--area-indigo); --area-bg: var(--area-indigo-bg); }
.area-purple { --area-stripe: var(--area-purple); --area-bg: var(--area-purple-bg); }
.area-pink { --area-stripe: var(--area-pink); --area-bg: var(--area-pink-bg); }
.area-gray { --area-stripe: var(--area-gray); --area-bg: var(--area-gray-bg); }

/* Erscheinungsbild (M1-05a): colour fields, table of derived tones and
   the two preview panels. The panels get their tokens (neutrals and CI
   colours of their scheme) from theme-preview.js, so each shows its own
   scheme whatever the page uses. */
.colour-field { display: flex; gap: var(--space-2); align-items: center; }
.colour-field input[type="color"] { width: var(--tap); height: var(--tap); min-height: auto; padding: var(--space-1); flex: 0 0 auto; cursor: pointer; }
.tokens { border-collapse: collapse; font-size: var(--text-s); }
.tokens caption { text-align: left; font-weight: 600; padding-bottom: var(--space-1); }
.tokens th, .tokens td { text-align: left; padding: var(--space-1) var(--space-3) var(--space-1) 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.preview { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.preview-panel {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
}
.preview-panel p, .preview-panel .card { margin: 0; }
.preview-title { font-weight: 600; color: var(--muted); }
.preview-active { color: var(--primary); font-weight: 600; box-shadow: inset 0 -2px 0 var(--primary); }

/* Auditlog (M6-01): the changed fields of an entry; long values wrap. */
.audit-changes { width: 100%; margin-top: var(--space-2); }
.audit-changes th[scope="row"] { font-weight: 600; white-space: nowrap; }
.audit-changes td { overflow-wrap: anywhere; }

/* Two-factor setup (M10-02): the QR code stays black on white in both
   themes (readable for every camera), the key and the recovery codes in a
   monospace font so 0/O and 1/I are told apart. */
.qr { max-width: 15rem; margin: var(--space-3) 0; }
.qr-code { display: block; width: 100%; height: auto; border-radius: var(--radius-s); }
.mono, .recovery-codes code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: 0.05em; }
.recovery-codes {
  list-style: none; margin: var(--space-3) 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: var(--space-2);
}
.recovery-codes code { font-size: var(--text-m); }
