/* The bets board (DESIGN-v2-amendments-2.md §W2b.5, §W2b.9; package W2b).
   The look of board.html v1, without its web-font import (a foreign address the CSP and the
   build refuse): the fonts fall back to the system stack. A textarea grows with its text
   through `field-sizing`, with its `rows` as the fallback; no height is set from script. */

:root {
  --scheme: light;
  --bg: #f2f6f6;
  --surface: #ffffff;
  --field: #f3f7f7;
  --field-hover: #e9f1f2;
  --ink: #1b2a2d;
  --ink-2: #475a5e;
  --ink-3: #5a6c6f;
  --line: #d3dfe0;
  --accent: #326876;
  --accent-strong: #264f5a;
  --accent-soft: #e0edf0;
  --focus: #43899c;
  --danger: #a1392b;
  --ok: #2f7a64;
  --busy: #9a6a12;
  --banner-bg: #fbf1dc;
  --banner-ink: #6e4b0e;
  --banner-line: #ecd6a6;
  --st-entworfen-bg: #e5ebec; --st-entworfen-ink: #3d4f53;
  --st-aktiv-bg: #d9eee6;     --st-aktiv-ink: #1d6650;
  --st-verdoppeln-bg: #dde7f6; --st-verdoppeln-ink: #264d87;
  --st-weiter-bg: #d9ebef;    --st-weiter-ink: #326876;
  --st-aufhoeren-bg: #f6ddd8; --st-aufhoeren-ink: #983224;
  --st-geparkt-bg: #f1e8d3;   --st-geparkt-ink: #6b5519;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  color-scheme: var(--scheme);
}
@media (prefers-color-scheme: dark) {
  :root {
    --scheme: dark;
    --bg: #111a1c;
    --surface: #182326;
    --field: #1e2c30;
    --field-hover: #243539;
    --ink: #e1ebeb;
    --ink-2: #a9bbbe;
    --ink-3: #8ea2a5;
    --line: #2c3e42;
    --accent: #73b6c8;
    --accent-strong: #9fd0dc;
    --accent-soft: #1e3a41;
    --focus: #73b6c8;
    --danger: #f0a193;
    --ok: #86d2b6;
    --busy: #e6c27a;
    --banner-bg: #372c17;
    --banner-ink: #f0d59e;
    --banner-line: #574421;
    --st-entworfen-bg: #29373a; --st-entworfen-ink: #c3d1d3;
    --st-aktiv-bg: #16392f;     --st-aktiv-ink: #8fd8bd;
    --st-verdoppeln-bg: #1b2b44; --st-verdoppeln-ink: #a9c4f0;
    --st-weiter-bg: #1e3a41;    --st-weiter-ink: #9fd0dc;
    --st-aufhoeren-bg: #42211b; --st-aufhoeren-ink: #f2a99b;
    --st-geparkt-bg: #39301e;   --st-geparkt-ink: #e5cf94;
  }
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  overflow-x: hidden;
}
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: var(--accent); }

/* Kopf */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1240px; margin: 0 auto; padding: 12px 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
}
h1 { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 700; color: var(--accent-strong); }
.sub { margin: 2px 0 0; color: var(--ink-2); font-size: 15px; }
.kopf-rechts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.nclink { font-size: 14px; }
.save {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink-2); font-size: 14px;
}
.save:empty { display: none; }
.save.klickbar { cursor: pointer; color: var(--danger); }
/* Sign-in pieces of nc_web, in this site's colours (as kanban.css does with its own). */
.nc-kopf button { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; }
.nc-angemeldet { color: var(--ink-2); }

main { max-width: 1240px; margin: 0 auto; padding: 16px 16px 48px; }
@media (min-width: 720px) {
  .top-inner { padding: 14px 28px; }
  main { padding: 24px 28px 64px; }
}

.banner {
  margin: 0 0 16px; padding: 10px 14px; border-radius: 8px;
  background: var(--banner-bg); color: var(--banner-ink); border: 1px solid var(--banner-line);
}
.ohneart { margin: 0 0 16px; color: var(--ink-2); font-size: 14px; }
.neu { margin: 12px 0 0; color: var(--ink-2); font-size: 14px; }
.foot { margin: 24px 0 0; color: var(--ink-3); font-size: 13px; }

/* Karten */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr));
  align-items: start;
}
.card {
  min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.card.mark-geaendert { border-color: var(--busy); }
.card.mark-abgelehnt { border-color: var(--danger); }
.kicker { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.nr { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.marke { font-size: 13px; color: var(--busy); }
.marke.abgelehnt { color: var(--danger); }
.meta { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.einsatz { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lbl, legend { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.einsatz .lbl { font-size: 12.5px; font-weight: 400; color: var(--ink-3); }
.hint { display: block; font-size: 12.5px; color: var(--ink-3); }
.card-foot { font-size: 12px; color: var(--ink-3); text-align: right; min-height: 1em; }

textarea, input[type="text"] {
  width: 100%; min-width: 0; margin: 0;
  font: inherit; color: var(--ink);
  background: var(--field); border: 1px solid transparent; border-radius: 6px;
  padding: 5px 8px;
}
input[inputmode="decimal"] { font-family: var(--mono); font-size: 14px; }
textarea {
  resize: vertical; display: block; line-height: 1.4;
  field-sizing: content; min-height: 2.2em;
}
textarea:hover, input[type="text"]:hover { background: var(--field-hover); }
textarea:focus, input[type="text"]:focus { border-color: var(--focus); background: var(--surface); }
textarea:disabled, input:disabled { background: transparent; color: var(--ink); opacity: 1; }
::placeholder { color: var(--ink-3); font-style: italic; opacity: 1; }
textarea.title { font-size: 20px; font-weight: 600; line-height: 1.25; padding: 3px 8px; }
textarea, input { transition: border-color .15s ease, background-color .15s ease; }

select {
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--field); border: 1px solid transparent; border-radius: 6px;
  padding: 4px 6px; max-width: 100%;
}
select.pill {
  appearance: none; -webkit-appearance: none;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 28px 4px 12px; cursor: pointer;
  background-color: var(--st-entworfen-bg); color: var(--st-entworfen-ink);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select.pill:disabled { cursor: default; opacity: 1; background-image: none; padding-right: 12px; }
select.pill[data-s="aktiv"]      { background-color: var(--st-aktiv-bg);      color: var(--st-aktiv-ink); }
select.pill[data-s="verdoppeln"] { background-color: var(--st-verdoppeln-bg); color: var(--st-verdoppeln-ink); }
select.pill[data-s="weiter"]     { background-color: var(--st-weiter-bg);     color: var(--st-weiter-ink); }
select.pill[data-s="aufhoeren"]  { background-color: var(--st-aufhoeren-bg);  color: var(--st-aufhoeren-ink); }
select.pill[data-s="geparkt"]    { background-color: var(--st-geparkt-bg);    color: var(--st-geparkt-ink); }
select.pill option { background: var(--surface); color: var(--ink); }

.msg { display: block; font-size: 13px; color: var(--busy); }
.msg:empty { display: none; }
.msg.fehler { color: var(--danger); }
.msg.gespeichert { color: var(--ok); }
/* A note appears beside a label or in a row's head line, never as a new line below a field. */
.lbl-zeile { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 8px; }
.lbl-zeile .msg, .kicker .msg, .zeilenkopf .msg { display: inline; }
.zeilenkopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; min-height: 1.3em; }
/* Fixed-time rows: the note lies over the field's top right corner, so it takes no height and
   moves nothing when it appears. */
ol.fest li > div { position: relative; min-width: 0; }
ol.fest .msg {
  position: absolute; top: 2px; right: 4px; z-index: 1; max-width: calc(100% - 8px);
  padding: 0 4px; border-radius: 4px; background: var(--surface);
  font-size: 12px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
/* A lasting error („Nur eine Zahl“, „ungültiger Wert“) must not hide the value it is about: it
   goes below the field and takes its line only while it shows. „gespeichert“ stays an overlay. */
ol.fest .msg.fehler {
  position: static; max-width: none; padding: 0; background: none;
  white-space: normal; overflow: visible;
}

/* Unterer Bereich */
.lower { display: grid; gap: 16px; margin-top: 24px; grid-template-columns: minmax(0, 1fr); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; }
.panel h2 { margin: 0 0 12px; font-size: 18px; font-weight: 700; color: var(--accent-strong); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 8rem) minmax(0, 1fr); gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
ol.liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
ol.fest li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 8rem) minmax(0, 1fr); gap: 6px; align-items: start; }

/* Agenda oben: volle Inhaltsbreite, kompakte Zeilen */
.agenda-panel { margin: 0 0 24px; padding: 12px 16px; border-left: 3px solid var(--accent); }
.agenda-panel h2 { margin-bottom: 6px; }
ol.agenda { gap: 0; }
/* One grid per item: the head line (date, notes) above, the checkbox in the title's row, so the
   box lines up with the title whether or not a date is shown. */
ol.agenda li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 3px 6px; align-items: start; padding: 4px 0; border-top: 1px solid var(--line); }
ol.agenda li:first-child { border-top: 0; }
ol.agenda input[type="checkbox"] { width: 20px; height: 20px; margin: 7px 0 0; accent-color: var(--accent); cursor: pointer; }
ol.agenda .punkt { display: contents; }
ol.agenda .zeilenkopf { grid-column: 2; grid-row: 1; }
ol.agenda li > div:first-child { grid-column: 1; grid-row: 2; }
ol.agenda .punkt-text { grid-column: 2; grid-row: 2; min-width: 0; }
ol.agenda .notiz { grid-column: 2; grid-row: 3; min-width: 0; }
ol.agenda .datum { font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
ol.agenda li.done .punkt-text { text-decoration: line-through; color: var(--ink-2); }
ol.agenda .notiz { font-size: 14px; }
.leer { color: var(--ink-3); font-style: italic; }

/* Schmale Fenster: nichts abschneiden, Eingaben mit 16 px (kein Zoom beim Tippen), der Kopf
   bleibt nicht stehen. Fester Zeitbetrag: Bereich über die ganze Zeile, darunter Stunden und Notiz;
   die Zeilen durch eine Linie getrennt wie die Agenda. */
@media (max-width: 519.98px) {
  .top { position: static; }
  .einsatz { grid-template-columns: minmax(0, 1fr); }
  .cols, ol.fest li { grid-template-columns: minmax(0, 6.5rem) minmax(0, 1fr); }
  .cols span:first-child, ol.fest li > div:first-child { grid-column: 1 / -1; }
  ol.fest { gap: 0; }
  ol.fest li { padding: 4px 0; border-top: 1px solid var(--line); }
  ol.fest li:first-child { border-top: 0; }
  input, select, textarea, input[inputmode="decimal"] { font-size: 16px; }
  ol.agenda .notiz { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
