/* CavalPlan – gemeinsame Gestaltung für Care und Stable. Regeln: brand/GESTALTUNGSREGELN.md */
@import url('./tokens.css');

@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('/shared/fonts/inter-400.woff') format('woff'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('/shared/fonts/inter-600.woff') format('woff'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('/shared/fonts/inter-700.woff') format('woff'); }

:root {
  --bg: var(--c-paper);
  --surface: var(--c-white);
  --surface-2: #FBF9F4;
  --text: var(--c-ink);
  --text-2: var(--c-stone);
  --line: var(--c-line);
  --primary: var(--c-care);
  --primary-soft: var(--c-care-soft);
  --on-primary: var(--c-white);
  --accent: var(--c-hay);
  --focus: #1A73E8;
  --radius-s: 8px; --radius-m: 12px; --radius-l: 16px;
  --shadow: 0 1px 2px rgba(21, 48, 42, .06), 0 2px 8px rgba(21, 48, 42, .06);
  --tap: 48px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
body[data-product='stable'] { --primary: var(--c-stable); --primary-soft: var(--c-stable-soft); }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F2420; --surface: #16302A; --surface-2: #1B3832; --text: #F1EDE3; --text-2: #B9C3BD; --line: #2C4A43;
    --primary: var(--c-care-tint); --primary-soft: #1E3F33; --on-primary: var(--c-ink); color-scheme: dark;
  }
  body[data-product='stable'] { --primary: var(--c-stable-tint); --primary-soft: #1D3546; }
  .chip--done { background: #1E3F33 !important; color: #BFE6CF !important; }
  .chip--pending { background: #3A2E12 !important; color: #F4D58C !important; }
  .chip--review, .chip--conflict { background: #44201C !important; color: #F6B8B0 !important; }
  .chip--offline { background: #26303C !important; color: #C8D3E0 !important; }
  .logo-light, .topbar .brand img.logo-light { display: none !important; } .logo-dark, .topbar .brand img.logo-dark { display: block !important; }
}
.logo-dark, .topbar .brand img.logo-dark { display: none; }
body.large-text { font-size: 19px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.5 var(--font);
  font-feature-settings: 'tnum' 1; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
a { color: var(--primary); font-weight: 600; }
small, .muted { color: var(--text-2); }
.muted { font-size: .92em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.topbar .brand img { height: 30px; width: auto; display: block; }
.topbar .spacer { flex: 1; }
.main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.main > .stack, .main > .grid-2 { margin-top: 12px; }
.main > .banner { margin-bottom: 12px; }
section.stack > h2 { margin-top: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 10px; min-height: 56px;
  color: var(--text-2); text-decoration: none; font-size: .75rem; font-weight: 600;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current='page'] { color: var(--primary); }
.tabbar a { position: relative; }
.tabbar a .badge { position: absolute; top: 4px; left: calc(50% + 6px); }

/* Stable auf großen Bildschirmen: Seitenleiste statt Tabbar */
@media (min-width: 960px) {
  body[data-product='stable'] .app { display: grid; grid-template-columns: 240px 1fr; grid-template-rows: auto 1fr; }
  body[data-product='stable'] .topbar { grid-column: 1 / -1; }
  body[data-product='stable'] .tabbar {
    position: sticky; top: 61px; align-self: start; height: calc(100dvh - 61px); flex-direction: column; justify-content: flex-start;
    border-top: 0; border-right: 1px solid var(--line); padding: 12px 8px; gap: 2px; background: var(--surface-2);
  }
  body[data-product='stable'] .tabbar a { flex: 0; flex-direction: row; gap: 12px; justify-content: flex-start; padding: 10px 12px; border-radius: var(--radius-s); font-size: .95rem; min-height: 44px; }
  body[data-product='stable'] .tabbar a[aria-current='page'] { background: var(--primary-soft); }
  body[data-product='stable'] .tabbar a .badge { position: static; margin-left: auto; }
  body[data-product='stable'] .main { max-width: 1120px; padding-bottom: 32px; }
}

/* ---------- Karten ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 16px; box-shadow: var(--shadow); }
.card--flat { box-shadow: none; }
.card--accent { border-left: 4px solid var(--primary); }
.card h2 { margin-bottom: .25rem; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.divider { height: 1px; background: var(--line); margin: 12px 0; border: 0; }

/* ---------- Schaltflächen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px;
  border-radius: var(--radius-m); border: 1.5px solid transparent; font: 600 1rem var(--font); cursor: pointer; text-decoration: none;
  background: var(--primary); color: var(--on-primary); transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: none; }
.btn--secondary { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn--danger { background: var(--c-danger); color: #fff; }
.btn--small { min-height: 40px; padding: 0 12px; font-size: .92rem; border-radius: var(--radius-s); }
.btn--block { width: 100%; }
.btn--big { min-height: 56px; font-size: 1.05rem; }
.btn svg, .syncbar svg { width: 20px; height: 20px; flex: none; }
.btn--big svg { width: 24px; height: 24px; }
.linkbtn { background: none; border: 0; color: var(--primary); font: 600 1rem var(--font); cursor: pointer; padding: 8px 0; text-decoration: underline; }
.linkbtn--danger { color: var(--danger, #b42318); align-self: flex-start; }

/* ---------- Status ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; line-height: 1.35; max-width: 100%; }
.chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.chip--done { background: var(--c-care-soft); color: var(--c-care); }
.chip--open { background: #EEEBE3; color: var(--c-stone); }
.chip--open::before { background: transparent; border: 2px solid currentColor; width: 6px; height: 6px; }
.chip--pending { background: var(--c-warn-soft); color: var(--c-hay-deep); }
.chip--review, .chip--conflict { background: var(--c-danger-soft); color: var(--c-danger); }
.chip--partial, .chip--skipped { background: var(--c-warn-soft); color: var(--c-hay-deep); }
.chip--offline { background: var(--c-slate-soft); color: var(--c-slate); }
.chip--info { background: var(--primary-soft); color: var(--primary); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--c-danger); color: #fff; font-size: .75rem; font-weight: 700; }

/* Datenstand-Leiste: zeigt Abgleich, Offline-Zustand und wartende Aktionen */
.syncbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 16px; font-size: .9rem;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.syncbar--offline { background: var(--c-slate-soft); color: var(--c-slate); }
.syncbar--pending { background: var(--c-warn-soft); color: var(--c-hay-deep); }
.syncbar strong { font-weight: 700; }
.syncbar .btn { min-height: 36px; }
@media (max-width: 600px) { .syncbar { font-size: .85rem; padding: 6px 12px; gap: 6px; } }
.syncbar .spacer { flex: 1; }

/* ---------- Aufgaben ---------- */
.task { display: grid; grid-template-columns: 56px 1fr; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.task__time { font-weight: 700; font-size: 1.05rem; }
.task__body { min-width: 0; }
.task__title { font-weight: 600; }
.task__meta { color: var(--text-2); font-size: .9rem; margin-top: 2px; }
.task__actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.task--muted .task__title { color: var(--text-2); }
.items { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.items li { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; font-size: .92rem; }
.items li.added { border-color: var(--c-care); background: var(--c-care-soft); color: var(--c-care); font-weight: 600; }
.items li.removed { text-decoration: line-through; color: var(--text-2); }
.hint-line { font-size: .88rem; color: var(--text-2); margin-top: 4px; }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-m); background: var(--c-warn-soft); color: var(--c-hay-deep); }
.banner--info { background: var(--primary-soft); color: var(--primary); }
.banner--danger { background: var(--c-danger-soft); color: var(--c-danger); }
.banner--neutral { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.banner strong { display: block; }
.banner p { margin: 2px 0 0; color: var(--text); }

/* Hinweis auf das andere Produkt – als solcher erkennbar (Konzept S. 12) */
.promo { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; padding: 14px; border-radius: var(--radius-l); border: 1px dashed var(--line); background: var(--surface-2); }
.promo img { width: 44px; height: 44px; border-radius: 10px; }
.promo .promo__kicker { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.promo h3 { margin: 2px 0 4px; }
.promo p { margin: 0 0 8px; font-size: .95rem; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-weight: 600; font-size: .95rem; }
.field .help { font-size: .85rem; color: var(--text-2); }
input[type='text'], input[type='search'], input[type='email'], input[type='date'], input[type='time'], input[type='number'], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: var(--radius-s); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text); font: 400 1rem var(--font);
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.check { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-m); cursor: pointer; background: var(--surface); }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--primary); }
.check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.check small { display: block; }
.error-text { color: var(--c-danger); font-weight: 600; font-size: .92rem; }

.meal-editor { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px; margin-bottom: 10px; background: var(--surface-2); }
.meal-editor__head { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; margin-bottom: 8px; }
.item-row { display: grid; grid-template-columns: 1fr 84px 120px 40px; gap: 6px; margin-bottom: 6px; }
.item-row input, .item-row select { min-height: 44px; }
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--radius-s); border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; color: var(--text-2); font-size: 1.2rem; }

/* ---------- Tabelle ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); padding: 8px; border-bottom: 1.5px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
@media (max-width: 640px) { .table--stack thead { display: none; } .table--stack tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); } .table--stack td { display: block; border: 0; padding: 2px 4px; } }

/* KPI */
.kpis { margin-bottom: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 14px 16px; }
.kpi__value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.kpi__label { color: var(--text-2); font-size: .9rem; }

/* Segmentauswahl */
.segments { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--radius-m); border: 1px solid var(--line); overflow-x: auto; }
.segments button { flex: 1; min-height: 40px; border: 0; background: transparent; border-radius: var(--radius-s); font: 600 .95rem var(--font); color: var(--text-2); cursor: pointer; white-space: nowrap; padding: 0 12px; }
.segments button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Dialog */
dialog { border: 0; border-radius: var(--radius-l); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--surface); color: var(--text); box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(15, 36, 32, .45); }
.dialog__body { padding: 20px; overflow: auto; max-height: calc(100dvh - 120px); }
.dialog__foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px 20px; flex-wrap: wrap; }

/* Hinweise */
.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; background: var(--c-ink); color: var(--c-paper); padding: 12px 18px; border-radius: var(--radius-m); box-shadow: var(--shadow); max-width: calc(100vw - 32px); font-weight: 600; }
.toast--error { background: var(--c-danger); color: #fff; }
.empty { text-align: center; padding: 28px 16px; color: var(--text-2); }
.empty img { width: 56px; opacity: .9; margin-bottom: 8px; }

/* Anmeldung */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth__box { width: 100%; max-width: 440px; }
.auth__logo { height: 52px; margin: 0 auto 20px; display: block; }
.demo-list { display: flex; flex-direction: column; gap: 8px; }
.demo-list button { text-align: left; justify-content: flex-start; }

.codebox { font: 700 1.4rem/1 ui-monospace, 'SFMono-Regular', Menlo, monospace; letter-spacing: .08em; padding: 12px 16px; border-radius: var(--radius-m); background: var(--surface-2); border: 1.5px dashed var(--line); display: inline-block; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--line); position: relative; font-size: .92rem; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }

@media print {
  .topbar, .tabbar, .syncbar, .btn, .promo { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.main:focus { outline: none; }

/* Wochentage-Auswahl und Wochenplan */
.daypicker { display: flex; gap: 6px; flex-wrap: wrap; }
.daypicker label { display: inline-flex; }
.daypicker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.daypicker span { min-width: 44px; min-height: 44px; display: grid; place-items: center; border-radius: var(--radius-s); border: 1.5px solid var(--line); font-weight: 600; cursor: pointer; background: var(--surface); }
.daypicker input:checked + span { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.daypicker input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.routine { display: grid; grid-template-columns: 56px 1fr; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
.routine:first-of-type { border-top: 0; }
.week-day { border-top: 1px solid var(--line); padding: 10px 0; }
.week-day--today { background: var(--primary-soft); border-radius: var(--radius-m); padding: 10px 12px; border-top: 0; }
.week-day h3 { margin: 0 0 6px; }
.week-line { display: grid; grid-template-columns: 52px 1fr; gap: 8px; font-size: .95rem; padding: 2px 0; }
.week-line .muted { font-size: .88rem; }
.source-tag { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }

/* Pferdeteam */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 1.05rem; }

/* Erinnerungen: Kanäle je Art */
.reminder-kind { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.pill-check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: 999px; cursor: pointer; background: var(--surface); font-weight: 600; min-height: 40px; }
.pill-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.pill-check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.pill-check:has(input:focus-visible) { outline: 3px solid var(--focus, var(--primary)); outline-offset: 2px; }

/* Akte: Notfallblatt, Termine, Beobachtungen, Turniere */
.btn--danger-outline { background: transparent; color: var(--c-danger); border: 1.5px solid currentColor; }
.emergency-call { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-radius: var(--radius-m); background: var(--surface); border: 1.5px solid var(--line); color: var(--text); text-decoration: none; min-height: 64px; }
.emergency-call small { display: block; color: var(--text-2); }
.emergency-call__nr { font-weight: 700; font-size: 1.15rem; color: var(--primary); white-space: nowrap; }
.emergency-call--primary { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.emergency-call--primary .emergency-call__nr, .emergency-call--primary small { color: #fff; }
.emergency-address { font-size: 1.1rem; font-weight: 600; margin: 4px 0 0; white-space: pre-line; }
.routine--overdue .task__time { color: var(--c-danger); }
.obs { padding: 10px 0; border-top: 1px solid var(--line); }
.obs p { margin: 4px 0; }
.obs--flagged { border-left: 4px solid var(--c-danger); padding-left: 10px; }
.upcoming { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px dashed var(--line); color: var(--text); text-decoration: none; }
.tournament-link { color: var(--text); text-decoration: none; display: block; }
.checklist { display: grid; gap: 8px; }
.checklist__row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.checklist__row .check:has(input:checked) strong { text-decoration: line-through; color: var(--text-2); }
/* Aktionen einer Zeile (Routine, Termin, Teammitglied) unter dem Inhalt statt als hohe Spalte */
.routine > .stack:last-child { grid-column: 2; display: flex; flex-direction: row; flex-wrap: wrap; gap: 0 18px; margin-top: -6px; }
.routine > span:last-child:empty { display: none; }

/* Erste Schritte */
.setup__list { margin: 0; padding-left: 1.4em; display: grid; gap: 8px; }
.setup__list a { color: var(--text); text-decoration: none; display: block; }
.setup__list small { display: block; }
.setup__list li.is-done { color: var(--text-2); }
.setup__list li.is-done strong { text-decoration: line-through; font-weight: 600; }
.setup__list li.is-done::marker { content: '✓  '; color: var(--primary); }

/* Stallplan */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.segmented { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; }
.segmented a { padding: 6px 14px; color: var(--text); text-decoration: none; font-weight: 600; min-height: 36px; display: inline-flex; align-items: center; }
.segmented a[aria-current="page"] { background: var(--primary); color: #fff; }
.boxgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.boxtile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 92px; padding: 10px 12px; border-radius: var(--radius-m);
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: default; }
button.boxtile { cursor: pointer; }
button.boxtile:hover { border-color: var(--primary); }
.boxtile__name { font-weight: 700; font-size: 1.15rem; }
.boxtile__horse { font-weight: 600; }
.boxtile__kind { font-size: .78rem; color: var(--text-2); }
.boxtile__free { color: var(--primary); font-weight: 600; }
.boxtile--free { border-style: dashed; background: var(--primary-soft); }
.mapgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.table-wrap { overflow-x: auto; }
.table tr.row--muted td { color: var(--text-2); }

/* Druckansichten: Boxenschilder und Futterplan */
.qr svg { width: 100%; height: auto; display: block; }
.signs { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.sign { display: grid; grid-template-columns: 1fr 120px; gap: 12px; align-items: center; padding: 18px; border: 2px solid var(--text); border-radius: 12px; background: #fff; color: #111; break-inside: avoid; }
.sign__label { font-size: .85rem; color: #555; font-weight: 600; }
.sign__box { font-size: 3.2rem; font-weight: 800; line-height: 1; }
.sign__horse { font-size: 1.5rem; font-weight: 700; margin-top: 6px; min-height: 1.6em; }
.sign__meta { font-size: .8rem; color: #555; margin-top: 4px; }
.sign__qr small { display: block; font-size: .65rem; color: #555; text-align: center; margin-top: 4px; }
.plan-sheet { background: #fff; color: #111; padding: 24px; border-radius: 12px; border: 1px solid var(--line); }
.plan-sheet__head { display: grid; grid-template-columns: 1fr 110px; gap: 16px; align-items: start; }
.plan-sheet__title { font-size: 2.4rem; margin: 4px 0; }
.plan-sheet__table td, .plan-sheet__table th { color: #111; font-size: 1.05rem; }
.plan-sheet__warn { font-weight: 700; border-left: 4px solid #b42318; padding-left: 10px; }
.print-foot { font-size: .8rem; color: #555; margin-top: 12px; }
@media print {
  .no-print { display: none !important; }
  .main { padding: 0 !important; }
  .signs { grid-template-columns: 1fr 1fr; gap: 8mm; }
  .sign { border-width: 1.5pt; }
  .plan-sheet { border: 0; padding: 0; }
}

/* Stalltafel (großer Bildschirm, aus der Ferne lesbar) */
body.board-mode { background: #10241d; }
.board { color: var(--text); }
body.board-mode .board { color: #f4f1e8; padding: 2vw 2.5vw; min-height: 100vh; font-size: clamp(16px, 1.25vw, 28px); }
.board__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 1.2em; }
.board__head h1 { font-size: 2.2em; margin: 0; }
body.board-mode .board__head .btn { background: transparent; color: #f4f1e8; border-color: rgba(255,255,255,.35); }
.board__head .btn[aria-pressed="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }
.board__day { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); gap: 1.5em; align-items: start; }
.board__table { width: 100%; border-collapse: collapse; }
.board__table th { text-align: left; font-size: .75em; letter-spacing: .06em; text-transform: uppercase; opacity: .75; padding: .3em .5em; }
.board__table td { padding: .35em .5em; border-top: 1px solid rgba(127,127,127,.25); font-size: 1.05em; }
.board__table tr.is-changed td { background: rgba(224,168,46,.16); }
.board__flag { margin-left: .5em; font-size: .7em; padding: .1em .5em; border-radius: 999px; background: var(--c-hay, #E0A82E); color: #15302a; font-weight: 700; vertical-align: middle; }
.board__slot { font-weight: 800; font-size: 1.3em; white-space: nowrap; }
.board__slot small { font-size: .55em; font-weight: 500; opacity: .7; margin-left: .3em; }
.board__slot--done { color: #3fae76; }
.board__slot--partial, .board__slot--skipped { color: #e0a82e; }
.board__slot.is-due { color: #ff7a6b; }
.board__slot.is-review { text-decoration: underline wavy; }
.board__side section { margin-bottom: 1.2em; }
.board__side h2, .board__weekday h2 { font-size: 1.05em; margin: 0 0 .4em; opacity: .85; }
.board__side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35em; }
.board__job--done { opacity: .6; }
.board__week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .8em; }
.board__weekday { padding: .6em; border-radius: 10px; background: rgba(127,127,127,.12); min-height: 8em; }
.board__weekday p { margin: .25em 0; font-size: .9em; }
.board__change strong { color: #e0a82e; }
.board__foot { margin-top: 1.5em; font-size: .8em; opacity: .7; }
.board__error { padding: 10vh 5vw; color: #f4f1e8; }
.board--inline .board__head h1 { font-size: 1.6rem; }
@media (max-width: 900px) { .board__day { grid-template-columns: 1fr; } .board__week { grid-template-columns: 1fr; } }
body.board-mode #app { display: block; max-width: none; padding: 0; }

/* Übungen und Schleife der Woche */
.pre-line { white-space: pre-line; margin: 2px 0 0; }
.schleife-card { display: flex; gap: 14px; align-items: center; color: var(--text); text-decoration: none; }
.schleife-card__muted { opacity: .55; }
.schleife-dots { display: flex; gap: 6px; margin-top: 6px; }
.schleife-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--c-hay-deep, #a87a14); }
.schleife-dots span.is-on { background: var(--c-hay, #E0A82E); border-color: var(--c-hay, #E0A82E); }
.schleife-head .kpi__value { font-size: 2rem; }
.leaderboard { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.leaderboard li { display: grid; grid-template-columns: 2.4em 1fr auto auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: var(--radius-s); }
.leaderboard li.is-me { background: var(--primary-soft); font-weight: 600; }
.leaderboard__rank { color: var(--text-2); }
.schleife-hist { display: grid; justify-items: center; gap: 2px; min-width: 48px; }
.schleife-hist__pts { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; }
.join-qr { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.join-qr__img { width: 150px; text-align: center; }

/* Verwaltung (Abschnitt 2f) */
.ops-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.ops-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.ops-table th, .ops-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line, #e5e5e5); vertical-align: top; }
.ops-table th { font-weight: 600; color: var(--muted, #666); }
.ops-scroll { overflow-x: auto; }
.ops-ok { color: var(--success, #1f7a4d); font-weight: 600; }
.ops-warn { color: var(--danger, #b42318); font-weight: 600; }
body.ops-mode #app { display: block; }
body.ops-mode .main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.ops-search { display: flex; gap: 8px; }
.ops-search input { flex: 1; min-width: 0; }
/* Verwaltung: Zugang */
.ops-codes { columns: 2; font-size: 1.05rem; padding-left: 1.4em; }
.ops-codes code { font-family: ui-monospace, monospace; letter-spacing: .04em; }
.ops-keys { list-style: none; margin: 0; padding: 0; }
.ops-keys li { padding: 10px 0; border-bottom: 1px solid var(--line, #e5e5e5); }
.ops-who { font-size: .9rem; }
@media (max-width: 640px) { .ops-who { display: none; } }
@media print { body.ops-mode #app { display: none; } dialog { position: static; box-shadow: none; } .dialog__foot { display: none; } }
