/* Slotplaner – Gestaltung
   Marineblau und Messing einer Turnierjacke auf kühlem Grau.
   Laut ist nur eines: die Kalenderwoche als große Zahl in der Display-Schrift.
   Alles andere bleibt ruhig: wenige Linien, Flächen statt Rahmen. */

@font-face {
  font-family: "Bricolage";
  src: url("fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --bg: #f1f3f6;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --sunken: #e7ebf0;
  --line: #e1e5eb;
  --line-strong: #c9d0da;
  --ink: #111a27;
  --ink-2: #3a4555;
  --muted: #6a7586;
  --primary: #1d3a63;
  --primary-hover: #284d80;
  --primary-soft: #e2e9f4;
  --on-primary: #ffffff;
  --brass: #a07b30;
  --brass-soft: #f3ead8;
  --yes: #1f774a;
  --yes-soft: #dff1e6;
  --maybe: #a8600a;
  --maybe-soft: #fbecd2;
  --no: #ad3832;
  --no-soft: #f8e0de;
  --open: #737f90;
  --open-soft: #eaedf2;
  --bar: #14294a;
  --on-bar: #ffffff;
  --shadow-float: 0 18px 40px -18px rgb(14 24 40 / 0.45), 0 2px 6px rgb(14 24 40 / 0.08);
  --shadow-lift: 0 1px 2px rgb(14 24 40 / 0.08), 0 1px 1px rgb(14 24 40 / 0.04);

  --r-s: 8px;
  --r-m: 14px;
  --r-l: 22px;
  --row: 1.75rem;
  --display: "Bricolage", "Avenir Next", "Segoe UI Variable Display", system-ui, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --tabbar-h: 0px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1117;
    --surface: #151c26;
    --surface-2: #19212c;
    --sunken: #0a0e13;
    --line: #232d3a;
    --line-strong: #334051;
    --ink: #e8ecf1;
    --ink-2: #c3cad4;
    --muted: #8e99a9;
    --primary: #9dbbea;
    --primary-hover: #b8cff3;
    --primary-soft: #1b2a40;
    --on-primary: #0c1522;
    --brass: #d9b46a;
    --brass-soft: #2d2514;
    --yes: #72d29d;
    --yes-soft: #15301f;
    --maybe: #f0ac4c;
    --maybe-soft: #33250e;
    --no: #f18d85;
    --no-soft: #3a1c1a;
    --open: #8893a4;
    --open-soft: #1d2530;
    --bar: #101c2e;
    --on-bar: #e8ecf1;
    --shadow-float: 0 18px 40px -16px rgb(0 0 0 / 0.7), 0 0 0 1px var(--line);
    --shadow-lift: 0 0 0 1px var(--line-strong);
    color-scheme: dark;
  }
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--text);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}
h1, h2, h3 { margin: 0; font-family: var(--display); line-height: 1.15; letter-spacing: -0.015em; }
h1 { font-size: 1.85rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--primary); text-underline-offset: 2px; }
[hidden] { display: none !important; }
svg.i { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2.5px solid var(--brass); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App-Leiste ---------- */
.appbar { background: var(--bar); color: var(--on-bar); padding-top: env(safe-area-inset-top, 0px); position: sticky; top: 0; z-index: 30; }
.appbar-inner { max-width: 1240px; margin: 0 auto; padding: 0 1.25rem; height: 3.5rem; display: flex; align-items: center; gap: 2rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-family: var(--display); font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.brand-mark { width: 1.9rem; height: 1.9rem; border-radius: 9px; background: var(--brass); display: grid; place-items: center; color: var(--bar); }
.brand-mark svg { width: 1.1rem; height: 1.1rem; stroke-width: 2.6; }
.nav { display: flex; gap: 0.25rem; }
.nav a {
  display: flex; align-items: center; gap: 0.45rem; color: inherit; text-decoration: none;
  padding: 0.45rem 0.8rem; border-radius: 999px; opacity: 0.72; font-weight: 550; font-size: 0.92rem;
}
.nav a:hover { opacity: 1; background: rgb(255 255 255 / 0.08); }
.nav a[aria-current="page"] { opacity: 1; background: rgb(255 255 255 / 0.14); }

@media (max-width: 720px) {
  :root { --tabbar-h: 4rem; }
  .appbar-inner { height: 3.1rem; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; gap: 0;
    background: var(--surface); color: var(--muted); border-top: 1px solid var(--line);
    padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
  }
  .nav a { flex: 1; flex-direction: column; gap: 0.15rem; padding: 0.35rem 0; border-radius: var(--r-s); font-size: 0.72rem; opacity: 1; }
  .nav a svg.i { width: 1.35rem; height: 1.35rem; }
  .nav a:hover { background: none; }
  .nav a[aria-current="page"] { color: var(--primary); background: none; }
}

/* ---------- Seitengerüst ---------- */
.page { max-width: 880px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
.page.wide { max-width: 1240px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; }
.title-row { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.count { font-family: var(--display); font-size: 1.1rem; color: var(--muted); font-weight: 600; }
.section { display: grid; gap: 0.9rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.surface { background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow-lift); }
.pad { padding: 1.1rem 1.25rem; }
.stack { display: grid; gap: 0.75rem; }
.row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.lede { color: var(--ink-2); max-width: 62ch; }

/* ---------- Kalenderwoche (das eine laute Element) ---------- */
.weekswitch { display: flex; align-items: center; gap: 0.9rem; }
.week-num { display: flex; align-items: baseline; gap: 0.35rem; font-family: var(--display); line-height: 0.9; }
.week-num .kw { font-size: 1rem; font-weight: 600; color: var(--muted); }
.week-num .n { font-size: 3.4rem; font-weight: 780; letter-spacing: -0.045em; }
.week-meta { display: grid; gap: 0.35rem; }
.week-range { color: var(--muted); font-size: 0.875rem; white-space: nowrap; }
.week-arrows { display: flex; gap: 0.3rem; }

/* ---------- Buttons ---------- */
button { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 2.5rem; padding: 0.5rem 1rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 560; font-size: 0.92rem; line-height: 1.1; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--muted); }
a.btn { text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--sunken); border-color: transparent; }
.btn-danger { color: var(--no); }
.btn-danger-fill { background: var(--no); border-color: var(--no); color: #fff; }
.btn-danger-fill:hover { filter: brightness(1.08); border-color: var(--no); }
.btn-sm { min-height: 2rem; padding: 0.3rem 0.75rem; font-size: 0.82rem; }
.btn-lg { min-height: 3rem; padding: 0.7rem 1.4rem; font-size: 1rem; }
.icon-btn {
  width: 2.5rem; height: 2.5rem; padding: 0; border-radius: 50%; display: inline-grid; place-items: center;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; flex: none;
}
.icon-btn:hover { border-color: var(--muted); color: var(--ink); }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.icon-btn.ghost:hover { background: var(--sunken); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Formulare ---------- */
input[type="text"], input[type="number"], input[type="time"], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-s);
  padding: 0.5rem 0.7rem; min-height: 2.5rem; min-width: 0; width: 100%;
}
select { appearance: none; padding-right: 2rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%);
  background-position: right 0.95rem center, right 0.65rem center; background-size: 0.32rem 0.32rem; background-repeat: no-repeat; }
input::placeholder { color: var(--muted); }
input:focus-visible, select:focus-visible { outline-offset: 0; border-color: var(--brass); }
.field { display: grid; gap: 0.35rem; }
.field > span { font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.85rem; }
.pill-select { width: auto; border-radius: 999px; min-height: 2.5rem; padding-left: 1rem; font-weight: 560; font-size: 0.92rem; }

/* Eingabe mit Button darin */
.inline-add { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.4rem 0.4rem 1rem; }
.inline-add input { border: 0; padding: 0.4rem 0; background: transparent; font-size: 1rem; }
.inline-add input:focus-visible { outline: none; }
.inline-add:focus-within { box-shadow: 0 0 0 2.5px var(--brass); }

/* Zahl ±  */
.stepper { display: inline-flex; align-items: center; background: var(--sunken); border-radius: 999px; padding: 0.15rem; flex: none; }
.stepper button { width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }
.stepper button:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
.stepper button:disabled { opacity: 0.35; cursor: default; }
.stepper output { min-width: 1.6rem; text-align: center; font-weight: 700; font-family: var(--display); font-size: 1rem; }
.stepper-label { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.8125rem; }

/* Segment-Schalter (ersetzt Radiobuttons) */
.seg { display: inline-flex; background: var(--sunken); border-radius: 999px; padding: 0.2rem; gap: 0.15rem; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button {
  border: 0; background: transparent; cursor: pointer; border-radius: 999px; padding: 0.45rem 0.95rem;
  font-size: 0.875rem; font-weight: 560; color: var(--ink-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 2.25rem; transition: background-color 0.15s, color 0.15s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lift); }
.seg.block { display: flex; }
.seg.block button { flex: 1; justify-content: center; }
@media (max-width: 560px) {
  .field .seg, .step-body .seg { display: flex; width: 100%; }
  .field .seg button, .step-body .seg button { flex: 1 1 auto; justify-content: center; padding: 0.45rem 0.55rem; }
}

/* Schalter (ersetzt Checkboxen) */
.switch { display: flex; align-items: flex-start; gap: 0.85rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { flex: none; width: 2.6rem; height: 1.5rem; border-radius: 999px; background: var(--line-strong); position: relative; transition: background-color 0.18s; margin-top: 0.1rem; }
.switch .track::after { content: ""; position: absolute; top: 0.2rem; left: 0.2rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.3); transition: transform 0.18s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(1.1rem); }
.switch input:focus-visible + .track { outline: 2.5px solid var(--brass); outline-offset: 2px; }
.switch-text { display: grid; gap: 0.15rem; }
.switch-text b { font-weight: 600; }

/* ---------- Status ---------- */
.st-yes { --c: var(--yes); --tone-bg: var(--yes-soft); }
.st-maybe { --c: var(--maybe); --tone-bg: var(--maybe-soft); }
.st-no { --c: var(--no); --tone-bg: var(--no-soft); }
.st-open { --c: var(--open); --tone-bg: var(--open-soft); }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.22rem 0.65rem; border-radius: 999px;
  background: var(--tone-bg, var(--sunken)); color: var(--c, var(--ink)); font-size: 0.8125rem; font-weight: 600; white-space: nowrap;
}
.chip .badge { background: var(--c, var(--muted)); color: var(--surface); border-radius: 999px; padding: 0 0.4rem; font-size: 0.72rem; line-height: 1.35rem; min-width: 1.35rem; text-align: center; }
.dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--c); display: inline-block; flex: none; }
.pill-status { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; background: var(--tone-bg); color: var(--c); }

.alert { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.85rem 1rem; border-radius: var(--r-m); background: var(--tone-bg, var(--primary-soft)); color: var(--ink); }
.alert > svg.i { color: var(--c, var(--primary)); margin-top: 0.15rem; }
.alert-body { display: grid; gap: 0.4rem; }
.alert-body b { font-weight: 650; }

/* ---------- Schritte (Planung) ---------- */
.step { display: grid; grid-template-columns: 2.25rem 1fr; gap: 0 1rem; }
.step-num {
  width: 2.25rem; height: 2.25rem; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; background: var(--primary); color: var(--on-primary);
}
.step-line { grid-column: 1; justify-self: center; width: 2px; background: var(--line-strong); margin: 0.4rem 0; border-radius: 1px; }
.step-body { grid-column: 2; grid-row: 1 / span 2; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; padding-bottom: 2.25rem; min-width: 0; }
.step-body > h2 { padding-top: 0.35rem; }
.step.done .step-num { background: var(--yes); }
.step.waiting .step-num { background: var(--sunken); color: var(--muted); }
@media (max-width: 560px) {
  .step { grid-template-columns: 1.9rem 1fr; gap: 0 0.75rem; }
  .step-num { width: 1.9rem; height: 1.9rem; font-size: 0.9rem; }
}

/* Fortschritt */
.progress-big { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.fraction { font-family: var(--display); font-weight: 750; font-size: 2.6rem; line-height: 1; letter-spacing: -0.03em; }
.fraction small { font-size: 1.2rem; color: var(--muted); font-weight: 600; }
.bar { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }
.bar.done > i { background: var(--yes); }

/* Kennzahlen */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.25rem, 1fr)); gap: 0.6rem; }
.kpi { background: var(--surface-2); border-radius: var(--r-m); padding: 0.8rem 1rem; display: grid; gap: 0.15rem; }
.kpi b { font-family: var(--display); font-size: 1.75rem; font-weight: 720; line-height: 1.05; letter-spacing: -0.02em; }
.kpi b small { font-size: 0.95rem; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.kpi span { color: var(--muted); font-size: 0.8125rem; }
.kpi.good b { color: var(--yes); }
.kpi.warn b { color: var(--maybe); }
.kpi.bad b { color: var(--no); }

/* ---------- Listen ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.list-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.75rem 1rem; flex-wrap: wrap; }
.list-row.inactive { opacity: 0.55; }
.avatar {
  width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-family: var(--display); font-weight: 700; font-size: 0.95rem; background: var(--av-bg); color: var(--av-fg);
}
.name-cell { flex: 1 1 10rem; min-width: 0; display: grid; }
.name-input {
  border: 1px solid transparent !important; background: transparent !important; padding: 0.15rem 0.35rem !important;
  margin-left: -0.35rem; min-height: 0 !important; font-weight: 650; font-size: 1rem; border-radius: 6px !important;
}
.name-input:hover { border-color: var(--line-strong) !important; }
.name-input:focus { background: var(--surface) !important; border-color: var(--brass) !important; outline: none; }
.row-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; flex-wrap: wrap; }
.list-row > .icon-btn { flex: none; }
@media (max-width: 560px) {
  .list-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.55rem 0.75rem; padding: 0.75rem 0.5rem 0.85rem 0.85rem; }
  .list-row > .avatar { grid-column: 1; grid-row: 1; }
  .list-row > .name-cell { grid-column: 2; grid-row: 1; }
  .list-row > .icon-btn { grid-column: 3; grid-row: 1; }
  .list-row > .row-actions { grid-column: 2 / 4; grid-row: 2; margin-left: 0; justify-content: space-between; padding-right: 0.35rem; }
}

details.disclosure > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 0.4rem; color: var(--primary); font-weight: 600; font-size: 0.9rem; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: ""; width: 0.45rem; height: 0.45rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; margin-right: 0.15rem; }
details.disclosure[open] > summary::before { transform: rotate(45deg); }
details.disclosure[open] > summary { margin-bottom: 0.85rem; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; color: var(--muted); font-size: 0.78rem; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
.cellnote { display: block; font-size: 0.75rem; color: var(--no); margin-top: 0.1rem; }

.matrix { font-size: 0.75rem; }
.matrix th, .matrix td { padding: 0.25rem; text-align: center; border: 0; }
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; background: var(--surface); text-align: left; z-index: 1; white-space: nowrap; padding-right: 0.75rem; font-size: 0.85rem; }
.matrix th { white-space: nowrap; line-height: 1.2; background: var(--surface); }
.matrix th.daystart, .matrix td.daystart { padding-left: 0.6rem; }
.matrix .cell span { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 6px; background: var(--tone-bg); color: var(--c); font-weight: 700; margin: auto; }

/* ---------- Wochenkalender (Verwaltung) ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.toolbar-group { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.25rem 0.25rem 0.9rem; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow-lift); }
.toolbar-group > .muted { font-size: 0.8125rem; white-space: nowrap; }
.toolbar-group select { border: 0; background-color: var(--sunken); min-height: 2.1rem; padding-top: 0.3rem; padding-bottom: 0.3rem; }

.daytabs { display: none; gap: 0.3rem; }
.daytabs button {
  flex: 1 1 0; min-width: 0; border: 0; background: transparent; border-radius: var(--r-s); cursor: pointer; padding: 0.4rem 0;
  display: grid; justify-items: center; gap: 0.1rem; color: var(--ink-2);
}
.daytabs button small { font-size: 0.7rem; color: var(--muted); }
.daytabs button b { font-family: var(--display); font-size: 1.15rem; font-weight: 700; width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border-radius: 50%; }
.daytabs button[aria-pressed="true"] b { background: var(--primary); color: var(--on-primary); }
.daytabs button.has-slots small::after { content: ""; display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--brass); margin: 2px auto 0; }

.cal { position: relative; background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow-lift); overflow: hidden; }
.cal-grid { display: grid; grid-template-columns: 3.6rem repeat(7, minmax(0, 1fr)); }
.cal-dayhead { padding: 0.75rem 0.5rem 0.6rem; display: flex; align-items: baseline; gap: 0.4rem; border-bottom: 1px solid var(--line); }
.cal-dayhead span { color: var(--muted); font-size: 0.8125rem; font-weight: 600; }
.cal-dayhead b { font-family: var(--display); font-size: 1.35rem; font-weight: 700; line-height: 1; }
.cal-dayhead.today b { color: var(--brass); }
.cal-dayhead.today span { color: var(--brass); }
.cal-corner { border-bottom: 1px solid var(--line); }
.cal-gutter { position: relative; height: calc(var(--row) * var(--rows)); }
.cal-gutter span { position: absolute; right: 0.55rem; font-size: 0.72rem; color: var(--muted); transform: translateY(-50%); }
.cal-gutter span:first-child { transform: translateY(0.15rem); }
.cal-col {
  position: relative; height: calc(var(--row) * var(--rows)); border-left: 1px solid var(--line);
  cursor: cell; touch-action: manipulation;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--row) * var(--per-hour) - 1px), var(--line) calc(var(--row) * var(--per-hour) - 1px), var(--line) calc(var(--row) * var(--per-hour)));
}
.cal-col.past { background-color: var(--surface-2); }
.cal-col.today { background-color: color-mix(in srgb, var(--brass-soft) 45%, transparent); }
.cal-col.readonly { cursor: default; }
.cal-ghost { position: absolute; left: 4px; right: 4px; border-radius: var(--r-s); border: 1.5px dashed var(--primary); background: var(--primary-soft); opacity: 0.6; pointer-events: none; }
.slot {
  position: absolute; border-radius: var(--r-s); padding: 0.3rem 0.45rem; overflow: hidden;
  background: var(--primary-soft); border: 0; box-shadow: inset 3px 0 0 var(--primary);
  font-size: 0.75rem; line-height: 1.3; cursor: pointer; text-align: left;
  display: grid; align-content: start; gap: 0.1rem; color: var(--ink);
  transition: transform 0.12s, box-shadow 0.12s;
}
.slot:hover { box-shadow: inset 3px 0 0 var(--primary), 0 0 0 1.5px var(--primary); }
.slot .t { font-weight: 700; color: var(--primary); }
.slot .meta { color: var(--ink-2); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.slot .meta span { display: inline-flex; align-items: center; gap: 0.2rem; }
.slot .meta svg.i { width: 0.85rem; height: 0.85rem; }
.slot .lbl { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal.locked .slot { background: var(--sunken); box-shadow: inset 3px 0 0 var(--line-strong); cursor: pointer; }
.cal.locked .slot .t { color: var(--ink-2); }
.slot.just-added { animation: pop 0.3s ease-out; }
@keyframes pop { from { transform: scale(0.9); opacity: 0.3; } to { transform: none; opacity: 1; } }

.cal-empty {
  position: absolute; inset: 4.2rem 0 auto 0; margin: 0 auto; width: min(24rem, calc(100% - 5rem)); z-index: 2;
  background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow-float);
  padding: 1.25rem; display: grid; gap: 0.75rem; justify-items: start; pointer-events: auto;
}

@media (max-width: 760px) {
  .daytabs { display: flex; }
  .cal-grid { grid-template-columns: 3.4rem minmax(0, 1fr); }
  .cal-dayhead:not(.selected):not(.cal-corner), .cal-col:not(.selected) { display: none; }
  .cal-dayhead.selected { display: none; }
  .cal-corner { display: none; }
  :root { --row: 2rem; }
  .slot { font-size: 0.875rem; padding: 0.4rem 0.6rem; }
  .cal-empty { inset: 1.5rem 0 auto 0; width: calc(100% - 2rem); }
}

/* ---------- Plan ---------- */
.plan-days { display: grid; gap: 1.5rem 1.75rem; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); }
.plan-day { display: grid; gap: 0.15rem; align-content: start; }
.plan-day h3 { display: flex; align-items: baseline; gap: 0.5rem; padding-bottom: 0.45rem; margin-bottom: 0.2rem; border-bottom: 2px solid var(--ink); }
.plan-day h3 span { font-family: var(--text); font-weight: 500; color: var(--muted); font-size: 0.8125rem; }
.plan-slot { display: grid; grid-template-columns: 4.6rem 1fr; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); align-items: start; }
.plan-slot .time { font-weight: 700; font-size: 0.875rem; padding-top: 0.15rem; }
.plan-slot .time small { display: block; font-weight: 500; color: var(--muted); font-size: 0.75rem; }
.plan-slot .who { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.plan-slot.empty .time { color: var(--muted); font-weight: 500; }
.free { color: var(--muted); font-size: 0.8125rem; padding-top: 0.2rem; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.8125rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }

/* Aktionsleiste unten (Festlegen, Berechnen) */
.actionbar {
  position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 0.75rem); z-index: 20;
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; justify-content: space-between;
  background: var(--surface); border-radius: 999px; box-shadow: var(--shadow-float); padding: 0.45rem 0.45rem 0.45rem 1.25rem;
}
.actionbar .muted { font-size: 0.875rem; }
@media (max-width: 560px) {
  .actionbar { border-radius: var(--r-m); padding: 0.6rem; }
  .actionbar .btn { width: 100%; }
  .actionbar .muted { width: 100%; text-align: center; }
}

/* ---------- Dialoge & Menüs ---------- */
dialog {
  border: 0; border-radius: var(--r-l); padding: 0; background: var(--surface); color: var(--ink);
  width: min(30rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); box-shadow: var(--shadow-float);
}
dialog::backdrop { background: rgb(8 14 24 / 0.45); backdrop-filter: blur(2px); }
dialog[open] { animation: rise 0.2s ease-out; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet { padding: 1.4rem; display: grid; gap: 1.1rem; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.sheet-head h2 { font-size: 1.3rem; }
.sheet-head p { color: var(--muted); font-size: 0.875rem; margin-top: 0.2rem; }
.sheet-actions { display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.sheet-actions .spacer { flex: 1; }
@media (max-width: 600px) {
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-l) var(--r-l) 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .sheet-actions .btn { flex: 1; }
  .sheet-actions .spacer { display: none; }
}

.menu {
  position: absolute; z-index: 60; min-width: 13rem; background: var(--surface); border-radius: var(--r-m);
  box-shadow: var(--shadow-float); padding: 0.35rem; display: grid;
}
.menu button {
  display: flex; align-items: center; gap: 0.65rem; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 0.6rem 0.75rem; border-radius: var(--r-s); cursor: pointer; font-size: 0.9rem; color: var(--ink);
}
.menu button:hover, .menu button:focus-visible { background: var(--sunken); outline: none; }
.menu button.danger { color: var(--no); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 0.3rem 0.4rem; }

/* Rückmeldungs-Balken */
.resp-bar { display: flex; height: 0.5rem; border-radius: 4px; overflow: hidden; background: var(--open-soft); }
.resp-bar i { display: block; height: 100%; background: var(--c); }
.resp-legend { display: flex; gap: 0.9rem; flex-wrap: wrap; font-size: 0.8125rem; color: var(--ink-2); }
.resp-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }

/* ---------- Einstellungen ---------- */
.settings { display: grid; gap: 0; }
.setting-group { display: grid; grid-template-columns: 15rem 1fr; gap: 1.5rem; padding: 1.5rem 0; border-top: 1px solid var(--line-strong); }
.setting-group:first-child { border-top: 0; padding-top: 0.25rem; }
.setting-group > header { display: grid; gap: 0.3rem; align-content: start; }
.setting-group > header p { color: var(--muted); font-size: 0.875rem; }
.setting-items { display: grid; gap: 1.25rem; }
.setting-items .hint { color: var(--muted); font-size: 0.8125rem; margin-top: 0.35rem; }
@media (max-width: 720px) { .setting-group { grid-template-columns: 1fr; gap: 1rem; } }

/* ---------- Teilnehmerseite ---------- */
.hello { display: grid; gap: 0.35rem; }
.hello h1 { font-size: 2.1rem; }
.weekpills { display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: none; margin: 0 -1.25rem; padding: 0.15rem 1.25rem; }
.weekpill {
  flex: none; display: grid; gap: 0.05rem; text-align: left; cursor: pointer; padding: 0.6rem 1rem; min-width: 8rem;
  border: 0; border-radius: var(--r-m); background: var(--surface); box-shadow: var(--shadow-lift); color: var(--ink);
}
.weekpill b { font-family: var(--display); font-size: 1.1rem; font-weight: 700; }
.weekpill small { color: var(--muted); font-size: 0.75rem; }
.weekpill[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.weekpill[aria-pressed="true"] small { color: inherit; opacity: 0.8; }
.weekpill .state { display: inline-flex; align-items: center; gap: 0.3rem; }

.progress-sticky {
  position: sticky; top: calc(3.1rem + env(safe-area-inset-top, 0px)); z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); margin: 0 -1.25rem; padding: 0.6rem 1.25rem; display: grid; gap: 0.4rem;
}
.progress-sticky .row { justify-content: space-between; font-size: 0.875rem; }
.day { display: grid; gap: 0.5rem; }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.day-head h2 { font-size: 1.15rem; display: flex; align-items: baseline; gap: 0.45rem; }
.day-head h2 span { font-family: var(--text); font-size: 0.875rem; font-weight: 500; color: var(--muted); }
.slots { list-style: none; margin: 0; padding: 0; }
.slots > li + li { border-top: 1px solid var(--line); }
.avail { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.75rem 0.7rem 1rem; flex-wrap: wrap; }
.avail .when { flex: 1 1 6rem; display: grid; min-width: 0; }
.avail .when b { font-family: var(--display); font-size: 1.1rem; font-weight: 650; display: flex; align-items: center; gap: 0.45rem; }
.avail .when small { color: var(--muted); font-size: 0.8125rem; }
.avail .when small.prev { color: var(--maybe); font-weight: 650; }
.avail.unset .when b::after { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--maybe); }
.choice { display: inline-flex; background: var(--sunken); border-radius: 999px; padding: 0.2rem; gap: 0.15rem; }
.choice button {
  border: 0; background: transparent; border-radius: 999px; cursor: pointer; min-height: 2.4rem; padding: 0 0.85rem;
  display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.875rem; font-weight: 600; color: var(--muted);
  transition: background-color 0.15s, color 0.15s;
}
.choice button svg.i { width: 1rem; height: 1rem; stroke-width: 2.5; }
.choice button:hover:not(:disabled) { color: var(--ink); }
.choice button[aria-pressed="true"] { background: var(--c); color: #fff; }
@media (prefers-color-scheme: dark) { .choice button[aria-pressed="true"] { color: var(--bg); } }
.choice button:disabled { cursor: default; }
@media (max-width: 440px) {
  .avail { padding: 0.6rem 0.5rem 0.6rem 0.85rem; gap: 0.5rem; }
  .avail .when b { font-size: 1.02rem; }
  .choice button { padding: 0 0.6rem; font-size: 0.82rem; }
  .choice button svg.i { display: none; }
}
@media (max-width: 350px) {
  .choice button .lbl { display: none; }
  .choice button svg.i { display: inline; }
  .choice button { padding: 0 0.8rem; }
}

/* Ticket: der zugeteilte Termin */
.ticket {
  display: grid; grid-template-columns: 6.5rem 1fr; border-radius: var(--r-l); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-float);
}
.ticket-date {
  background: var(--primary); color: var(--on-primary); display: grid; place-content: center; justify-items: center; gap: 0.1rem; padding: 1rem 0.5rem;
  position: relative;
}
.ticket-date::after {
  content: ""; position: absolute; right: -6px; top: 0; bottom: 0; width: 12px;
  background: radial-gradient(circle at 6px 9px, var(--surface) 4px, transparent 4.5px) 0 0 / 12px 18px repeat-y;
}
.ticket-date span { font-size: 0.8125rem; font-weight: 600; opacity: 0.85; }
.ticket-date b { font-family: var(--display); font-size: 2.9rem; font-weight: 780; line-height: 0.95; letter-spacing: -0.04em; }
.ticket-body { padding: 1.1rem 1.25rem; display: grid; gap: 0.3rem; align-content: center; }
.ticket-body .kicker { color: var(--muted); font-size: 0.8125rem; font-weight: 600; }
.ticket-body .time { font-family: var(--display); font-size: 1.6rem; font-weight: 720; letter-spacing: -0.02em; line-height: 1.1; }
.ticket-body .with { color: var(--ink-2); font-size: 0.9rem; display: flex; align-items: center; gap: 0.4rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 1.25rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 0.65rem 1.1rem; border-radius: 999px; display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.9rem; font-weight: 550; z-index: 100; max-width: calc(100vw - 2rem); box-shadow: var(--shadow-float);
  animation: rise 0.2s ease-out;
}
.toast.error { background: var(--no); color: #fff; border-radius: var(--r-m); }

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

@media print {
  .appbar, .nav, .no-print, .actionbar, button, .toast { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .surface { box-shadow: none; }
  .page { padding: 0; }
  .plan-days { grid-template-columns: repeat(3, 1fr); }
  .chip { border: 1px solid #999; }
}
@media (max-width: 600px) { .hide-mobile { display: none !important; } }

/* ---------- Benachrichtigungen ---------- */
.push-prompt { background: var(--surface); box-shadow: var(--shadow-lift); }
.push-prompt > svg.i { color: var(--brass); width: 1.4rem; height: 1.4rem; margin-top: 0.05rem; }
.push-prompt .row { margin-top: 0.25rem; }
.push-mark { color: var(--muted); display: inline-flex; vertical-align: -0.15em; }
.push-mark svg.i { width: 0.95rem; height: 0.95rem; }
.device-status { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.footer-note { display: flex; align-items: center; justify-content: center; gap: 0.5rem; flex-wrap: wrap; color: var(--muted); font-size: 0.8125rem; padding-top: 1rem; }

/* ---------- Absagen ---------- */
.ticket-actions { margin-top: 0.4rem; margin-left: -0.6rem; gap: 0.1rem !important; }
.ticket-actions .btn { padding: 0.3rem 0.6rem; }
.ticket.cancelled { box-shadow: var(--shadow-lift); }
.ticket.cancelled .ticket-date { background: var(--sunken); color: var(--muted); }
.ticket.cancelled .time { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.chip.cancelled { text-decoration: line-through; opacity: 0.85; }
.cancelled-text { color: var(--no); text-decoration: line-through; }

/* ---------- Fußzeile ---------- */
.site-footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.site-footer a:hover { color: var(--ink); }
.site-footer { text-align: center; color: var(--muted); font-size: 0.75rem; padding: 0 1.25rem calc(1.5rem + var(--tabbar-h)); opacity: 0.85; }
@media print { .site-footer { padding-bottom: 0; } }

/* ---------- Eigenes Bild ---------- */
.brand-mark.custom { background: none; overflow: hidden; }
.brand-mark.custom img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-preview { width: 5.5rem; height: 5.5rem; border-radius: 22%; overflow: hidden; box-shadow: var(--shadow-lift); flex: none; background: var(--sunken); }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Kalender ---------- */
.cal-options { display: grid; gap: 0.5rem; }
.cal-options .btn { justify-content: flex-start; width: 100%; border-radius: var(--r-m); min-height: 3rem; }
.cal-card { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; padding: 0.85rem 1rem; }
.cal-card > svg.i { width: 1.5rem; height: 1.5rem; color: var(--primary); }
.cal-card .grow { min-width: 12rem; }

/* ---------- Schnell ausfüllen ---------- */
.quickfill { display: grid; gap: 0.6rem; padding: 0.85rem 1rem; }
.quickfill .row { gap: 0.5rem; }
.quickfill .btn-primary small { font-weight: 500; opacity: 0.85; margin-left: 0.25rem; }

textarea { resize: vertical; min-height: 4.5rem; line-height: 1.45; }
a.with { text-decoration: none; color: var(--ink-2); }
a.with:hover { color: var(--primary); }
.cal-preview { background: var(--surface-2); border-radius: var(--r-m); padding: 0.75rem 0.9rem; display: grid; gap: 0.15rem; font-size: 0.875rem; }
.cal-preview b { font-size: 0.95rem; }
@media (max-width: 430px) {
  .ticket { grid-template-columns: 5.4rem 1fr; }
  .ticket-date b { font-size: 2.5rem; }
  .ticket-body { padding: 1rem 1rem 1rem 1.15rem; }
}
