/* Sportgelände Friolzheim – Belegungsplan */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #16201b;
  --ink-2: #56625b;
  --ink-3: #8b958f;
  --line: #e7e5dd;
  --line-2: #f0eee8;
  --accent: #17211c;
  --accent-ink: #ffffff;
  --danger: #c2412d;
  --ground: #e8eee4;
  --grass-a: #5aa567;
  --grass-b: #4f9a5d;
  --chalk: rgba(255, 255, 255, .92);
  --house: #f4f1ea;
  --house-line: #d9d4c7;
  --room: #ffffff;
  --shadow: 0 1px 2px rgba(22, 32, 27, .04), 0 10px 30px rgba(22, 32, 27, .06);
  --shadow-2: 0 2px 6px rgba(22, 32, 27, .10), 0 12px 28px rgba(22, 32, 27, .14);
  --radius: 18px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --hour: 46px;
  --lw: 132px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412;
    --surface: #171d1a;
    --surface-2: #1b2320;
    --ink: #eef2ef;
    --ink-2: #a8b3ac;
    --ink-3: #76817a;
    --line: #28312c;
    --line-2: #202824;
    --accent: #eef2ef;
    --accent-ink: #0f1412;
    --danger: #f08a78;
    --ground: #141c18;
    --grass-a: #2f6e41;
    --grass-b: #2a643b;
    --chalk: rgba(255, 255, 255, .78);
    --house: #222a26;
    --house-line: #36413b;
    --room: #171d1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .4), 0 12px 28px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
}
#app { flex: 1; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.muted { color: var(--ink-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 28px; }
main.wrap { flex: 1; padding-top: 36px; padding-bottom: 56px; }

/* ------------------------------------------------------------ Kopfzeile */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; flex: none; }
.brand svg { width: 30px; height: 30px; display: block; }
.brand span { display: grid; line-height: 1.12; }
.brand b { font-weight: 680; letter-spacing: -.01em; }
.brand i { font-style: normal; font-size: 12.5px; color: var(--ink-2); }
.nav { display: flex; gap: 2px; flex: 1; }
.nav a {
  text-decoration: none; padding: 7px 13px; border-radius: 999px;
  color: var(--ink-2); font-weight: 520; white-space: nowrap; transition: background .15s, color .15s;
}
.nav a:hover { color: var(--ink); }
.nav a.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.top-act { display: flex; align-items: center; gap: 10px; flex: none; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); font-weight: 650; font-size: 13px; letter-spacing: .02em;
}
.avatar:hover { border-color: var(--ink-3); }

/* ------------------------------------------------------------ Bausteine */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; white-space: nowrap; text-decoration: none;
  transition: transform .08s, border-color .15s, background .15s, opacity .15s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { opacity: .92; }
.btn.danger { color: var(--danger); }
.btn.sm { height: 34px; padding: 0 13px; border-radius: 10px; font-size: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--ink); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); display: inline-grid; place-items: center; font-size: 19px; line-height: 1; flex: none;
}
.icon-btn:hover { border-color: var(--ink-3); }
.icon-btn.bare { border-color: transparent; background: none; color: var(--ink-2); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.eyebrow {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 620;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2);
}
h1 { font-size: clamp(30px, 4.2vw, 44px); line-height: 1.06; letter-spacing: -.03em; font-weight: 680; margin-top: 8px; }
h2 { font-size: 19px; letter-spacing: -.015em; font-weight: 660; }
h3 { font-size: 15px; font-weight: 650; letter-spacing: -.005em; }
.input, select.input {
  width: 100%; height: 44px; padding: 0 13px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); min-width: 0;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
/* Leerer Ring = frei, gefüllter Punkt = belegt (in der Vereinsfarbe) */
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; background: var(--c, transparent); box-shadow: inset 0 0 0 2px var(--c, var(--ink-3)); }
.badge {
  font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px; letter-spacing: .01em;
  background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line);
}
.badge.busy { box-shadow: none; background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: color-mix(in srgb, var(--c) 70%, var(--ink)); }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ink) 45%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { to { box-shadow: 0 0 0 9px transparent; } }
@media (prefers-reduced-motion: reduce) { .live { animation: none; } * { transition: none !important; } }

/* ------------------------------------------------------------ Übersicht */
.ov-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 26px; }
.sum { margin-top: 10px; color: var(--ink-2); display: flex; gap: 16px; align-items: center; }
.sum span { display: inline-flex; align-items: center; gap: 7px; }
.sum .dot.busy { --c: var(--ink-2); }
.daynav { display: flex; align-items: center; gap: 8px; }
.daynav .input { width: 158px; height: 40px; }

.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) 312px; gap: 20px; align-items: stretch; }
.map { overflow: hidden; background: var(--ground); display: flex; flex-direction: column; justify-content: space-between; }
.map-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; padding: 16px 20px 6px; }
.map-top .hint { font-size: 13px; }
.map-legend { padding: 6px 20px 16px; }
.map-in { position: relative; width: 100%; line-height: 0; }
.map-svg { display: block; width: 100%; height: auto; }
.map-svg .ground { fill: var(--ground); }
.map-svg .grass { fill: var(--grass-a); }
.map-svg .stripes { fill: var(--grass-b); }
.map-svg .chalk { fill: none; stroke: var(--chalk); stroke-width: 1.6px; }
.map-svg .chalk * { vector-effect: non-scaling-stroke; }
.map-svg .chalk-fill { fill: var(--chalk); }
.map-svg .path { fill: none; stroke: color-mix(in srgb, var(--house-line) 70%, var(--ground)); stroke-width: 14; stroke-linecap: round; }
.map-svg .house { fill: var(--house); stroke: var(--house-line); stroke-width: 1.5; }
.map-svg .room { fill: var(--room); stroke: var(--house-line); stroke-width: 1.5; }
.map-svg .tint-edge { fill: none; stroke: #fff; stroke-width: 13; }
.map-svg .tint { fill: var(--c); fill-opacity: .16; stroke: var(--c); stroke-width: 6; }
.map-svg .room.busy { fill: color-mix(in srgb, var(--c) 24%, var(--room)); stroke: var(--c); stroke-width: 2; }
.map-cap {
  position: absolute; transform: translate(-50%, -50%); line-height: 1.2; text-align: center;
  font-size: 11px; font-weight: 640; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); pointer-events: none;
}
.pin {
  position: absolute; display: grid; place-items: center; padding: 6px;
  background: none; border: 0; border-radius: 14px; line-height: 1.3; color: var(--ink);
}
.pin-card {
  display: grid; gap: 2px; text-align: left; max-width: 100%;
  background: var(--surface); border-radius: 16px; padding: 12px 16px;
  box-shadow: var(--shadow-2); transition: transform .18s;
}
.pin:hover .pin-card { transform: translateY(-2px); }
.pin-name { display: flex; align-items: center; gap: 8px; font-weight: 660; font-size: 15px; }
.pin.busy .dot { background: var(--c); }
.pin-state { color: var(--ink-2); font-size: 13.5px; }
.pin-title { font-size: 13.5px; font-weight: 560; }
.pin.compact .pin-card { background: none; box-shadow: none; padding: 0; text-align: center; justify-items: center; gap: 1px; }
.pin.compact .pin-name { font-size: 13.5px; gap: 6px; }
.pin.compact .pin-state { font-size: 12.5px; }

.rcards { display: grid; gap: 12px; align-content: stretch; }
.rcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow);
}
.rcard header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.rcard.busy { box-shadow: var(--shadow), inset 3px 0 0 var(--c); }
.rc-main { background: none; border: 0; padding: 0; text-align: left; display: grid; gap: 1px; }
.rc-main b { font-weight: 620; }
.rc-main span, .rc-free { color: var(--ink-2); font-size: 14px; }
.rc-main:hover b { text-decoration: underline; text-underline-offset: 3px; }
.rc-next { color: var(--ink-3); font-size: 13px; }
.rcard .btn { align-self: flex-start; margin-top: 6px; }

/* Tagesleiste */
.tl { margin-top: 20px; padding: 14px 20px 18px; position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.tl-row, .tl-headrow { display: grid; grid-template-columns: var(--lw) minmax(0, 1fr); align-items: center; }
.tl-headrow { height: 40px; }
.tl-axis { position: relative; height: 100%; cursor: ew-resize; }
.tl-axis span { position: absolute; bottom: 6px; transform: translateX(-50%); font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tl-row + .tl-row { margin-top: 8px; }
.tl-label { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 12px; }
.tl-track {
  position: relative; height: 38px; border-radius: 10px; background: var(--surface-2); cursor: ew-resize;
  background-image: repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px calc(100% / var(--hours)));
  box-shadow: inset 0 0 0 1px var(--line);
}
.tl-block {
  position: absolute; top: 3px; bottom: 3px; border-radius: 7px; border: 0;
  background: color-mix(in srgb, var(--c) 22%, var(--surface)); box-shadow: inset 3px 0 0 var(--c);
  padding: 0 8px 0 11px; text-align: left; font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-block:hover { background: color-mix(in srgb, var(--c) 32%, var(--surface)); }
.tl-over { position: absolute; left: calc(20px + var(--lw)); right: 20px; top: 14px; bottom: 18px; pointer-events: none; }
.tl-cursor { position: absolute; top: 0; bottom: 0; width: 0; }
.tl-cursor::after { content: ""; position: absolute; left: -1px; top: 30px; bottom: 0; width: 2px; border-radius: 2px; background: var(--ink); }
.tl-knob {
  position: absolute; top: 2px; left: 0; transform: translateX(-50%); pointer-events: auto; cursor: grab;
  height: 28px; padding: 0 10px; border-radius: 999px; border: 0;
  background: var(--ink); color: var(--bg); font-weight: 650; font-size: 13px; font-variant-numeric: tabular-nums;
}
.tl-knob:active { cursor: grabbing; }
.tl-hint { margin-top: 12px; font-size: 13px; color: var(--ink-3); }

/* ------------------------------------------------------------ Kalender */
.cal-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-title { margin-right: auto; }
.cal-title h1 { font-size: clamp(24px, 3.2vw, 32px); margin-top: 6px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button, .seg label span {
  display: inline-flex; align-items: center; height: 32px; padding: 0 13px; border-radius: 9px;
  border: 0; background: none; font-weight: 580; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.seg button.on, .seg input:checked + span { background: var(--ink); color: var(--bg); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { display: inline-flex; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-sub { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; margin-bottom: 16px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-right: auto; }
.pill {
  height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font-weight: 560;
}
.pill.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }

.cal { overflow: hidden; }
.cal-head, .cal-body { display: grid; grid-template-columns: 54px repeat(var(--cols), minmax(0, 1fr)); }
.cal-head { border-bottom: 1px solid var(--line); }
.cal-dh {
  padding: 12px 6px 11px; text-align: center; border-left: 1px solid var(--line-2);
  display: flex; align-items: baseline; justify-content: center; gap: 7px;
  background: none; border-top: 0; border-right: 0; border-bottom: 0; color: inherit; min-width: 0;
}
button.cal-dh:hover b { text-decoration: underline; text-underline-offset: 3px; }
.cal-dh span { font-size: 12px; font-weight: 620; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.cal-dh b { font-size: 17px; font-weight: 640; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-dh.today b { background: var(--accent); color: var(--accent-ink); border-radius: 999px; min-width: 28px; padding: 1px 8px; }
.cal-dh b.res { font-size: 14.5px; }
.cal-body { position: relative; height: calc(var(--hours) * var(--hour)); }
.cal-gutter { position: relative; }
.cal-gutter span { position: absolute; right: 9px; margin-top: 4px; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cal-col {
  position: relative; border-left: 1px solid var(--line-2); cursor: copy;
  background-image: linear-gradient(to bottom, var(--line-2) 1px, transparent 1px);
  background-size: 100% var(--hour);
}
.cal-col.today { background-color: color-mix(in srgb, var(--accent) 4%, transparent); }
.cal-col.past { cursor: default; }
.evt {
  position: absolute;
  top: calc((var(--s) - var(--h0)) / 60 * var(--hour) + 1px);
  height: calc((var(--e) - var(--s)) / 60 * var(--hour) - 2px);
  left: calc(var(--col) / var(--n) * 100% + 2px);
  width: calc(100% / var(--n) - 4px);
  background: color-mix(in srgb, var(--c) 17%, var(--surface));
  border: 0; box-shadow: inset 3px 0 0 var(--c); border-radius: 7px;
  padding: 4px 6px 4px 9px; text-align: left; overflow: hidden;
  display: flex; flex-direction: column; font-size: 12px; line-height: 1.28; color: var(--ink);
}
.evt:hover { background: color-mix(in srgb, var(--c) 27%, var(--surface)); z-index: 2; }
.evt b { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.evt span { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.evt.short { flex-direction: row; align-items: center; gap: 6px; padding-block: 0; }
.nowline { position: absolute; left: 0; right: 0; top: calc((var(--s) - var(--h0)) / 60 * var(--hour)); height: 2px; background: var(--danger); z-index: 3; pointer-events: none; }
.nowline::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

.agenda { display: none; }
.ag-day { padding: 14px 16px; }
.ag-day + .ag-day { border-top: 1px solid var(--line); }
.ag-day > header { display: flex; align-items: center; gap: 8px; font-weight: 650; margin-bottom: 8px; }
.ag-day > header small { font-weight: 520; color: var(--ink-3); font-size: 13px; }
.ag-none { color: var(--ink-3); font-size: 14px; }
.item {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; width: 100%; align-items: start;
  background: color-mix(in srgb, var(--c) 9%, var(--surface)); box-shadow: inset 3px 0 0 var(--c);
  border: 0; border-radius: 10px; padding: 10px 12px 10px 14px; text-align: left;
}
.item + .item { margin-top: 6px; }
.item:hover { background: color-mix(in srgb, var(--c) 16%, var(--surface)); }
.item time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }
.item time small { display: block; font-weight: 500; color: var(--ink-2); font-size: 12.5px; }
.item b { font-weight: 640; display: block; }
.item span { color: var(--ink-2); font-size: 13.5px; display: block; }

/* ------------------------------------------------------------ Listen & Verwaltung */
.page-head { margin-bottom: 26px; }
.page-head p.lead { color: var(--ink-2); margin-top: 10px; max-width: 60ch; }
.stack { display: grid; gap: 20px; }
.panel { padding: 22px 24px; }
.panel > h2 { margin-bottom: 4px; }
.panel > p.muted { font-size: 14px; margin-bottom: 16px; }
.list { display: grid; gap: 6px; margin-top: 14px; }
.empty { padding: 44px 24px; text-align: center; color: var(--ink-2); display: grid; gap: 14px; justify-items: center; }
.table-wrap { overflow-x: auto; margin: 12px -8px 0; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font-size: 12px; font-weight: 620; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 8px; }
td { padding: 8px; border-top: 1px solid var(--line-2); vertical-align: middle; }
td .input { height: 38px; border-radius: 10px; }
td small { color: var(--ink-3); display: block; }
td.acts { white-space: nowrap; text-align: right; }
td.acts .btn + .btn { margin-left: 6px; }
input[type="color"].input { padding: 4px; width: 48px; cursor: pointer; }
.addrow { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.addrow .input { flex: 1; min-width: 160px; }
.check { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ------------------------------------------------------------ Dialoge */
dialog {
  border: 0; padding: 0; border-radius: 22px; background: var(--surface); color: var(--ink);
  width: min(540px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: var(--shadow-2); overflow: hidden;
}
dialog[open] { display: flex; flex-direction: column; animation: pop .18s ease-out; }
dialog::backdrop { background: rgba(12, 18, 15, .46); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.form, .sheet { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 6px 24px; }
.dlg-body { padding: 12px 24px 8px; display: grid; gap: 16px; overflow-y: auto; }
.dlg-foot { display: flex; align-items: center; gap: 10px; padding: 16px 24px 22px; flex-wrap: wrap; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field > span em { font-style: normal; font-weight: 500; color: var(--ink-3); }
.row3 { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 580; cursor: pointer;
}
.chip span::before { content: ""; width: 14px; height: 14px; border-radius: 5px; border: 1.5px solid var(--ink-3); }
.chip input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.chip input:checked + span::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 2.5px var(--surface); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.hint { font-size: 13.5px; color: var(--ink-2); }
.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--ink-2); }
.alert {
  background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border-radius: 12px; padding: 12px 14px;
  font-size: 14px; display: grid; gap: 8px; color: var(--ink);
}
.alert b { color: color-mix(in srgb, var(--danger) 80%, var(--ink)); }
.alert ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; color: var(--ink-2); }
.alert .btn { justify-self: start; }
.demo { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 8px; }
.demo .btn { justify-content: flex-start; height: auto; padding: 9px 14px; text-align: left; white-space: normal; }
.demo .btn small { color: var(--ink-2); font-weight: 500; margin-left: auto; padding-left: 10px; }
.detail-bar { height: 6px; background: var(--c); }
.detail-head { padding: 22px 20px 4px 24px; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.detail-head h2 { font-size: 23px; letter-spacing: -.02em; }
.detail-head p { color: var(--ink-2); margin-top: 4px; display: flex; align-items: center; gap: 8px; }
.detail-head .dot { background: var(--c); }
.facts { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 14px; margin: 0; }
.facts dt { color: var(--ink-3); font-size: 13.5px; padding-top: 1px; }
.facts dd { margin: 0; }
.code { font: 600 20px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .08em; padding: 14px; text-align: center; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 12px; user-select: all; }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 100;
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-weight: 560;
  box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.foot { border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; padding: 20px 0 28px; }
.foot .wrap { display: flex; gap: 8px 20px; flex-wrap: wrap; justify-content: space-between; }

/* ------------------------------------------------------------ Schmal */
@media (max-width: 1000px) {
  .ov-grid { grid-template-columns: 1fr; }
  .rcards { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
@media (max-width: 760px) {
  :root { --lw: 98px; --hour: 42px; }
  .wrap { padding: 0 16px; }
  main.wrap { padding-top: 22px; padding-bottom: 40px; }
  .top-in { height: auto; flex-wrap: wrap; gap: 10px 12px; padding-top: 10px; padding-bottom: 8px; }
  .brand { margin-right: auto; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 6px 12px; }
  .ov-head { margin-bottom: 18px; gap: 16px; }
  .daynav { width: 100%; }
  .daynav .input { flex: 1; width: auto; }
  .tl { padding: 10px 12px 14px; }
  .tl-over { left: calc(12px + var(--lw)); right: 12px; top: 10px; bottom: 14px; }
  .tl-label { font-size: 13px; }
  .tl-block { font-size: 0; padding: 0; }
  .tl-axis span.minor { display: none; }
  .pin-card { padding: 9px 12px; border-radius: 13px; }
  .pin.compact { padding: 2px; }
  .pin.compact .pin-name { font-size: 12.5px; gap: 5px; }
  .pin.compact .pin-state { font-size: 11.5px; }
  .pin.compact .dot { width: 7px; height: 7px; }
  .cal.is-week { display: none; }
  .agenda { display: block; }
  .cal-head, .cal-body { grid-template-columns: 42px repeat(var(--cols), minmax(0, 1fr)); }
  .cal-gutter span { right: 6px; font-size: 10.5px; }
  .cal-dh b.res { font-size: 13px; }
  .cal-title { flex-basis: 100%; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 > :first-child { grid-column: 1 / -1; }
  .panel { padding: 18px 16px; }
  .dlg-head { padding-left: 18px; }
  .dlg-body { padding-inline: 18px; }
  .dlg-foot { padding-inline: 18px; }
  .facts { grid-template-columns: 92px minmax(0, 1fr); }
  .item { grid-template-columns: 84px minmax(0, 1fr); }
}

/* ------------------------------------------------------------ Wappen, Platzhälften, Sperren */
.crest { width: 20px; height: 20px; object-fit: contain; border-radius: 5px; background: #fff; flex: none; vertical-align: -5px; margin-right: 6px; }
.pin-name .crest, .legend .crest, .detail-head .crest { margin-right: 0; }
.crest.lg { width: 40px; height: 40px; border-radius: 9px; margin: 0; box-shadow: 0 0 0 1px var(--line); }
.crest.none { display: inline-block; background: var(--surface-2); }
.logo-cell { display: flex; align-items: center; gap: 10px; }

.badge.shut { background: var(--ink); color: var(--bg); box-shadow: none; }
.badge.half { background: color-mix(in srgb, var(--ink) 9%, var(--surface)); color: var(--ink); box-shadow: none; }
.sum .dot.shut, .pin.shut .dot { --c: var(--ink); }
.rcard.shut, .tl-track.shut {
  background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--ink) 9%, transparent) 0 6px, transparent 6px 13px);
}
.cal-col.shut {
  background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--ink) 8%, transparent) 0 6px, transparent 6px 13px),
    linear-gradient(to bottom, var(--line-2) 1px, transparent 1px);
  background-size: auto, 100% var(--hour);
}
.rc-foot { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.rc-foot .btn { margin-top: 0; }
.rc-lock { font-size: 13px; align-self: flex-start; margin-top: 4px; }
.rc-foot .rc-lock { margin: 0 0 0 auto; align-self: center; }
.rc-half { display: flex; gap: 10px; align-items: baseline; width: 100%; background: none; border: 0; padding: 3px 0; text-align: left; font-size: 14px; }
.rc-half b { font-weight: 620; }
.rc-half small { display: block; color: var(--ink-2); font-size: 13px; }
.rc-half:hover b { text-decoration: underline; text-underline-offset: 3px; }
.rc-half[disabled] { pointer-events: none; }

.map-svg .shut-base { fill: #0c120f; fill-opacity: .46; }
.map-svg .shut-hatch { fill: url(#hatch); }
.map-svg .room-hatch { fill: url(#hatch2); pointer-events: none; }
.map-svg .hatch-w { fill: #fff; fill-opacity: .3; }
.map-svg .hatch-i { fill: var(--ink); fill-opacity: .2; }

.tl-block.half-hinten { bottom: calc(50% + 1px); }
.tl-block.half-vorn { top: calc(50% + 1px); }
.tl-block[class*="half-"] { font-size: 10.5px; padding-left: 8px; border-radius: 5px; }
.tl-block.off, .evt.off { opacity: .5; }
.tl-block.off, .evt.off b, .item.off b { text-decoration: line-through; }
.tl-shut {
  position: absolute; right: 8px; top: 50%; translate: 0 -50%; max-width: 60%; pointer-events: none;
  font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
  background: var(--surface); padding: 3px 9px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-shut {
  position: absolute; top: 4px; left: 4px; right: 4px; z-index: 4; border: 0; border-radius: 6px; padding: 3px 7px;
  background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 650; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ag-shut { display: block; border: 0; border-radius: 8px; padding: 5px 10px; margin-bottom: 8px; background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 620; text-align: left; }
.item.off { opacity: .8; }
.off-note { color: var(--danger) !important; font-weight: 600; }
@media (max-width: 760px) {
  .seg { flex-wrap: wrap; }
  .tl-block[class*="half-"] { font-size: 0; padding: 0; }
}

/* ------------------------------------------------------------ Wochenplan zum Ausdrucken */
#print-sheet { display: none; }
@page { size: A4 landscape; margin: 11mm; }
html.print {
  --bg: #fff; --surface: #fff; --surface-2: #fff; --ink: #111; --ink-2: #444; --ink-3: #777; --line: #c9c9c9;
  color-scheme: light;
}
html.print body { background: #fff; color: #111; display: block; min-height: 0; }
html.print #app > *:not(main), html.print main > *:not(#print-sheet), html.print #toast, html.print dialog { display: none !important; }
html.print main.wrap { max-width: none; padding: 0; }
html.print #print-sheet { display: block; font-size: 9.5pt; line-height: 1.3; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ps-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; border-bottom: 2px solid #111; padding-bottom: 8px; }
.ps-eye { font-size: 8.5pt; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: #444; }
.ps h1 { font-size: 22pt; margin-top: 3px; letter-spacing: -.02em; }
.ps-meta { display: grid; gap: 5px; justify-items: end; font-size: 9pt; }
.ps-legend { display: flex; gap: 16px; }
.ps-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ps-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ps-day { border-right: 1px solid var(--line); padding: 0 6px 8px; min-height: 138mm; }
.ps-day h2 { display: flex; justify-content: space-between; align-items: baseline; font-size: 11pt; padding: 6px 0; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.ps-day h2 span { font-size: 8.5pt; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ps-item { display: grid; border-left: 3px solid var(--c); padding: 0 0 1px 6px; margin-bottom: 8px; break-inside: avoid; }
.ps-time { font-size: 9pt; font-variant-numeric: tabular-nums; }
.ps-title { font-weight: 650; overflow-wrap: anywhere; }
.ps-sub { font-size: 8.5pt; color: #444; }
.ps-item.off .ps-time, .ps-item.off .ps-title { text-decoration: line-through; }
.ps-item.off::after { content: "fällt aus"; font-size: 8.5pt; font-weight: 700; }
.ps-shut { border: 1.5px solid #111; padding: 3px 5px; margin-bottom: 8px; font-size: 8.5pt; font-weight: 650; }
.ps-none { color: #888; font-size: 9pt; }
.ps-foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 7px; font-size: 8pt; color: #555; }
/* Dasselbe ohne JavaScript-Ereignis, falls ein Browser „beforeprint“ nicht meldet */
@media print {
  html:has(#print-sheet) {
    --bg: #fff; --surface: #fff; --surface-2: #fff; --ink: #111; --ink-2: #444; --ink-3: #777; --line: #c9c9c9;
    color-scheme: light;
  }
  html:has(#print-sheet) body { background: #fff; color: #111; display: block; min-height: 0; }
  html:has(#print-sheet) #app > *:not(main), html:has(#print-sheet) main > *:not(#print-sheet), #toast, dialog { display: none !important; }
  html:has(#print-sheet) main.wrap { max-width: none; padding: 0; }
  #print-sheet { display: block; font-size: 9.5pt; line-height: 1.3; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ------------------------------------------------------------ Verlauf */
.log-day + .log-day { margin-top: 26px; }
.log-day h2 { font-size: 12.5px; font-weight: 620; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px; }
.log-row { display: grid; grid-template-columns: 50px 108px minmax(0, 1fr); gap: 4px 12px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--line-2); }
.log-row time { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tag { justify-self: start; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.tag.warn { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: color-mix(in srgb, var(--danger) 80%, var(--ink)); box-shadow: none; }
.log-row p { display: grid; gap: 2px; min-width: 0; }
.log-row p b { font-weight: 640; }
.log-row p span { font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.log-row p small { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-3); margin-top: 2px; }
@media (max-width: 760px) {
  .log-row { grid-template-columns: auto minmax(0, 1fr); }
  .log-row p { grid-column: 1 / -1; }
}
