/* Planung: recurring tickets, availability, absences.
   Visual language of Entwurf A "Dashboard" (entwuerfe/entwurf-a-leitstand.html): same tokens, Archivo,
   ink buttons, steel lamp strip, radius 14 for boards and 8 for controls. Signal colors only ever mean state.
   All tokens live in :root so the page follows the dashboard when its tokens change. */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  /* self-hosted (no CDN): the integrator places the variable font at this path */
  src: local("Archivo"), url("/nymil-theme/fonts/Archivo.woff2") format("woff2");
}

:root {
  /* Dashboard tokens (1:1) */
  --ground: #E8ECEF;
  --surface: #FFFFFF;
  --ink: #15212C;
  --ink-2: #45525E;
  --line: #C9D2DA;
  --line-soft: #DFE4E9;
  --steel: #D5DCE2;
  --steel-deep: #BCC6CF;
  --hover: #F6F8F9;

  --run: #0A6CFF;    --run-t: #0A58CC;   --run-tint: #EBF2FF;
  --wait: #F2A900;   --wait-t: #6E4A00;  --wait-tint: #FFF5DA; --wait-line: #E3C36C;
  --fault: #E5484D;  --fault-t: #B3261E; --fault-tint: #FCEFEF;
  --free: #1F9D6B;   --free-t: #0F7049;
  --off: #8E99A4;

  --font: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;

  /* Planung additions, derived from the tokens above (no new hues) */
  --ink-hover: #2A3C4D;
  --dock: #F1F4F6;
  --holiday: #EEF1F4;
  --r-board: 14px;
  --r: 8px;
  --r-chip: 6px;
  --page-pad: 32px;
  --drawer-w: 600px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--ground); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.page { max-width: 1440px; margin: 0 auto; padding: 20px var(--page-pad) 28px; }

/* ---------- buttons (Dashboard) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px; font-weight: 600; line-height: 1.1;
  padding: 9px 14px; min-height: 36px;
  border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--ink-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-ink:focus-visible { outline-offset: 3px; }
.btn-small { font-size: 13px; padding: 6px 10px; min-height: 30px; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { border-color: var(--line); color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- lamps (Dashboard) ---------- */
.lamp {
  --c: var(--off);
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #C4CDD5;
  box-shadow: inset 0 1px 3px rgba(21, 33, 44, .45), 0 1px 0 rgba(255, 255, 255, .85);
}
.lamp::after {
  content: ""; grid-area: 1 / 1; border-radius: 50%;
  width: 12px; height: 12px;
  background: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 24%, transparent),
              0 0 10px color-mix(in srgb, var(--c) 60%, transparent);
}
.lamp.s-ready { --c: var(--free); }
.lamp.s-waiting { --c: var(--wait); }
.lamp.s-fault { --c: var(--fault); }
.lamp.s-off::after { background: #97A2AC; box-shadow: inset 0 1px 2px rgba(21, 33, 44, .35); }

/* ---------- head ---------- */
.head { padding-bottom: 16px; }
.bar { display: flex; align-items: center; gap: 16px; min-height: 40px; flex-wrap: wrap; }
.brand { font-size: 17px; font-weight: 700; font-stretch: 112%; letter-spacing: .01em; text-decoration: none; }
.bar-link { margin-left: auto; }
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--steel); border-radius: 10px; }
.tab {
  border: 0; background: transparent; color: var(--ink-2);
  font-size: 14px; font-weight: 600; line-height: 1.1;
  padding: 8px 12px; min-height: 32px; border-radius: 7px; cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 0 var(--steel-deep); }
.lagebild {
  margin-top: 14px;
  max-width: 34em;
  font-size: 36px; line-height: 1.12;
  font-weight: 600; font-stretch: 86%;
  letter-spacing: -.012em;
  text-wrap: pretty;
}

.meldung {
  margin: 0 0 14px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ink);
  border-radius: var(--r); font-size: 14px; font-weight: 600;
}
.meldung.is-error { border-left-color: var(--fault); color: var(--fault-t); background: var(--fault-tint); }
.view:focus { outline: none; }
.view-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 4px 0 12px; }
.view-head h2 { font-size: 17px; font-weight: 650; }
.hint { font-size: 13.5px; color: var(--ink-2); }
.loading, .empty { padding: 18px 20px; color: var(--ink-2); }
.foot { margin-top: 24px; font-size: 13px; color: var(--ink-2); }

/* ---------- board (shared) ---------- */
.board { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-board); overflow: hidden; }
.board-head { font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.board-head > span { padding: 9px 12px; }
.board-head > span:first-child { background: var(--steel); border-right: 1px solid var(--steel-deep); }
.lane-lamp {
  background: var(--steel); border-right: 1px solid var(--steel-deep);
  display: flex; justify-content: center; padding: 14px 0;
}

/* ---------- week ---------- */
.week-head, .week-row { display: grid; grid-template-columns: 58px minmax(150px, 190px) repeat(7, minmax(0, 1fr)); }
.week-head .is-today { color: var(--ink); font-weight: 650; }
.week-head > span { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.head-hints { display: flex; flex-wrap: wrap; gap: 4px; }
.hint-chip {
  display: inline-block; max-width: 100%;
  font-size: 11.5px; line-height: 1.25; font-weight: 600;
  padding: 2px 6px; border-radius: var(--r-chip);
  background: var(--wait-tint); border: 1px solid var(--wait-line); color: var(--wait-t);
  overflow-wrap: anywhere;
}
/* desktop: hints live in the (aria-hidden) day header, this list is for screen readers; mobile shows it */
.week-hints { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.week-row { border-top: 1px solid var(--line-soft); }
.week-row:first-of-type { border-top: 0; }
.who { padding: 14px 12px 14px 16px; min-width: 0; }
.who-name { font-size: 17px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.who-type { font-size: 13px; color: var(--ink-2); margin-top: 1px; }
.who-sum { font-size: 13.5px; font-weight: 600; margin-top: 6px; color: var(--free-t); }
.who-sum.is-low { color: var(--wait-t); }
.who-cap { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

.day {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0; min-height: 112px; margin: 0; padding: 10px 8px;
  border: 0; border-left: 1px solid var(--line-soft); border-radius: 0;
  background: transparent; text-align: left; font-size: 14px;
}
button.day { cursor: pointer; }
button.day:hover { background: var(--hover); }
button.day:focus-visible { outline-offset: -3px; }
.day.is-abwesend { background: var(--wait-tint); }
button.day.is-abwesend:hover { background: #FCEFC8; }
.day.is-feiertag { background: var(--holiday); }
.day.is-frei { background: var(--dock); }
.day.is-today { box-shadow: inset 0 3px 0 var(--ink); }
.day-label { display: none; font-size: 13px; color: var(--ink-2); }
.day-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.day-state { font-size: 13px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.is-verfuegbar .day-state { color: var(--free-t); }
.is-abwesend .day-state { color: var(--wait-t); }
.is-feiertag .day-state, .is-frei .day-state { color: var(--ink-2); font-weight: 500; }
.day-hint { margin-top: auto; font-size: 12px; color: var(--ink-2); opacity: 0; }
button.day:hover .day-hint, button.day:focus-visible .day-hint { opacity: 1; }

.chip {
  display: grid; gap: 1px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-chip);
  padding: 4px 6px; font-size: 12.5px; line-height: 1.25; min-width: 0;
}
.chip-title { font-weight: 600; overflow-wrap: anywhere; }
.chip-state { color: var(--ink-2); font-size: 12px; overflow-wrap: anywhere; }
.chip.s-angelegt { border-left: 3px solid var(--run); }
.chip.s-angelegt .chip-state { color: var(--run-t); }
.chip.s-verschoben { border-style: dashed; border-color: var(--wait-line); }
.chip.s-verschoben .chip-state { color: var(--wait-t); }
.chip.s-uebersprungen { background: transparent; border-style: dashed; }
.chip.s-uebersprungen .chip-title { text-decoration: line-through; text-decoration-thickness: 1px; color: var(--ink-2); }
.chip.s-fehler { border-color: var(--fault); background: var(--fault-tint); }
.chip.s-fehler .chip-state { color: var(--fault-t); }
.chip.s-routine { background: var(--hover); border-color: var(--line-soft); border-left: 3px solid var(--steel-deep); }
.chip.s-routine.r-erledigt .chip-title { text-decoration: line-through; text-decoration-thickness: 1px; color: var(--ink-2); }

.short { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); display: inline-block; }
.legend .l-abwesend { background: var(--wait-tint); border-color: var(--wait-line); }
.legend .l-feiertag { background: var(--holiday); }
.legend .l-frei { background: var(--dock); }
.legend .l-angelegt { border-left: 3px solid var(--run); }
.legend .l-verschoben { border-style: dashed; border-color: var(--wait-line); }
.legend .l-routine { background: var(--hover); border-left: 3px solid var(--steel-deep); }

/* ---------- series ---------- */
.series-head, .series-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) 9.5em;
}
.series-row { border-top: 1px solid var(--line-soft); }
.series-row:first-of-type { border-top: 0; }
.series-row > div { padding: 14px 14px; min-width: 0; }
.series-row > .lane-lamp { padding: 14px 0; }
.series-row.is-paused { background: var(--dock); }
.series-title {
  font-size: 21px; line-height: 1.15; font-weight: 620; font-stretch: 78%;
  letter-spacing: -.004em; overflow-wrap: anywhere;
}
.is-paused .series-title { color: var(--ink-2); }
.series-rule { font-size: 14.5px; margin-top: 4px; }
.series-state { font-size: 13.5px; font-weight: 600; margin-top: 6px; color: var(--free-t); }
.is-paused .series-state { color: var(--ink-2); }
.rows { display: grid; gap: 5px; }
.rows li { display: grid; grid-template-columns: 7.4em minmax(0, 1fr); gap: 6px; font-size: 14px; line-height: 1.35; }
.rows .k { color: var(--ink-2); font-size: 13px; padding-top: 1px; }
.rows .v { overflow-wrap: anywhere; }
.next-list { display: grid; gap: 5px; }
.next-list li { display: grid; grid-template-columns: 6.4em minmax(0, 1fr); gap: 6px; font-size: 14px; line-height: 1.35; }
.next-list .d { font-weight: 600; }
.next-list .s { color: var(--ink-2); font-size: 13px; padding-top: 1px; overflow-wrap: anywhere; }
.next-list .s.is-verschoben { color: var(--wait-t); }
.next-list .s.is-uebersprungen { color: var(--fault-t); }
.series-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }

/* ---------- absences ---------- */
.split { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-board); padding: 16px; display: grid; gap: 12px; }
.panel h3 { font-size: 16px; font-weight: 650; }
.absence-list { display: grid; }
.absence { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.absence:first-child { border-top: 0; padding-top: 0; }
.absence-when { font-size: 15px; font-weight: 650; }
.absence-meta { font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.absence-art { font-weight: 600; color: var(--wait-t); }
.absence.is-past .absence-when { color: var(--ink-2); font-weight: 500; }

/* ---------- notice (401/403) ---------- */
.notice {
  max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-board);
  padding: 20px; display: grid; gap: 10px;
}
.notice h2 { font-size: 22px; font-weight: 650; font-stretch: 88%; line-height: 1.15; }
.notice p { color: var(--ink-2); max-width: 52ch; }

/* ---------- forms (Dashboard composer) ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 4px; min-width: 0; align-content: start; }
.field label, .field .label, .fieldset legend { font-size: 13px; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
  padding: 8px 10px; font-size: 15px; min-height: 38px;
}
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline-offset: 0; border-color: var(--ink); }
.input[aria-invalid="true"] { border-color: var(--fault); }
.textarea { resize: vertical; min-height: 64px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }
.field-help { font-size: 12.5px; color: var(--ink-2); }
.fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
.check, .radio { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.check input, .radio input { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.radios { display: grid; gap: 6px; }
.form-error { font-size: 13px; color: var(--fault-t); font-weight: 600; }
.rule-box { display: grid; gap: 10px; padding: 12px; background: var(--dock); border: 1px solid var(--line-soft); border-radius: var(--r); }
.daypick { display: flex; flex-wrap: wrap; gap: 6px; }
.daypick .btn { min-width: 44px; }
.daypick .btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.preview { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.preview li { display: grid; grid-template-columns: 8.6em minmax(0, 1fr); gap: 8px; padding: 7px 10px; border-top: 1px solid var(--line-soft); font-size: 14px; }
.preview li:first-child { border-top: 0; }
.preview .d { font-weight: 600; }
.preview .s { color: var(--ink-2); overflow-wrap: anywhere; }
.preview .is-verschoben .s { color: var(--wait-t); font-weight: 600; }
.preview .is-uebersprungen .d { color: var(--ink-2); text-decoration: line-through; text-decoration-thickness: 1px; }
.preview .is-uebersprungen .s { color: var(--fault-t); font-weight: 600; }
.preview-empty { padding: 10px; font-size: 14px; color: var(--ink-2); }

/* ---------- drawer (Dashboard) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(21, 33, 44, .32); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(var(--drawer-w), 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgba(21, 33, 44, .16);
  display: flex; flex-direction: column;
  animation: slide-in .18s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; padding: 18px 20px 16px; border-bottom: 1px solid var(--line); background: var(--steel); }
.drawer-head h2 { font-size: 22px; font-weight: 650; font-stretch: 88%; line-height: 1.15; }
.drawer-head p { font-size: 13.5px; color: var(--ink-2); }
.drawer-body { overflow-y: auto; padding: 16px 20px 20px; flex: 1; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface); }
.drawer-sec { display: grid; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.drawer-sec:first-child { border-top: 0; padding-top: 0; }
.drawer-sec h3 { font-size: 15px; font-weight: 650; }

/* ---------- mid widths ---------- */
@media (max-width: 1100px) {
  .week-head, .week-row { grid-template-columns: 48px minmax(120px, 150px) repeat(7, minmax(0, 1fr)); }
  .series-head, .series-row { grid-template-columns: 58px minmax(0, 1.3fr) minmax(0, 1fr) 9.5em; }
  .series-head > span:nth-child(4), .series-row > .series-next { display: none; }
  .split { grid-template-columns: 1fr; }
}

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  :root { --page-pad: 16px; }
  .page { padding-top: 12px; }
  .lagebild { font-size: 23px; line-height: 1.18; margin-top: 10px; }
  .bar { gap: 10px; }
  .tabs { order: 3; width: 100%; }
  .tab { flex: 1; padding: 8px 6px; }
  .field-row, .field-row.three { grid-template-columns: 1fr; }

  .board-head { display: none; }
  .week-hints {
    position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal;
    display: grid; gap: 6px; margin: 0 0 12px; padding: 10px 12px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  }
  .week-hints li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .week-hints .d { font-size: 13px; font-weight: 600; min-width: 5.2em; }
  .week-row { grid-template-columns: 44px minmax(0, 1fr); }
  .week-row > .lane-lamp { grid-row: 1 / span 8; padding: 12px 0; }
  .week-row > .who { grid-column: 2; padding: 12px 14px 8px; }
  .day {
    grid-column: 2; display: grid; grid-template-columns: 5.2em minmax(0, 1fr); gap: 8px;
    min-height: 0; padding: 8px 14px; border-left: 0; border-top: 1px solid var(--line-soft);
  }
  .day.is-today { box-shadow: inset 3px 0 0 var(--ink); }
  .day-label { display: block; padding-top: 1px; }
  /* the legend explains tapping; per-day hints stay for screen readers only */
  .day-hint { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .week-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .week-nav .btn { padding-left: 6px; padding-right: 6px; }
  .long { display: none; }
  .short { display: inline; }
  .daypick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .daypick .btn { min-width: 0; padding-left: 0; padding-right: 0; }

  .series-row { grid-template-columns: 44px minmax(0, 1fr); }
  .series-row > .lane-lamp { grid-row: 1 / span 4; padding: 12px 0; }
  .series-row > div:not(.lane-lamp) { grid-column: 2; padding: 10px 14px 0; }
  .series-row > .series-next { display: block; }
  .series-row > .series-actions { flex-direction: row; flex-wrap: wrap; padding-bottom: 12px; }
  .series-title { font-size: 18.5px; }

  .drawer { width: 100vw; border-left: 0; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .drawer { animation: none; }
}

/* deleting a series (29.09.2026): quiet until armed, then a clear question in the row */
.btn-danger { background: var(--fault-t, #B3261E); border-color: var(--fault-t, #B3261E); color: #fff; }
.btn-danger:hover { background: #8F1E18; border-color: #8F1E18; }
.btn-danger-quiet { border-color: transparent; background: transparent; color: var(--fault-t, #B3261E); }
.btn-danger-quiet:hover { border-color: var(--fault-t, #B3261E); }
.series-confirm { margin: 0; font-size: 13px; line-height: 1.35; font-weight: 600; color: var(--fault-t, #B3261E); }
