/* =========================================================================
   Dienstplan-Generator — Styles auf Basis des broediger Design-Systems
   (Tokens: ink / paper / accent, vgl. broediger-web/styles/tokens.css)
   ========================================================================= */
:root {
  /* broediger Tokens */
  --ink-900: #0e1b27; --ink-800: #16293c; --ink-700: #22384c;
  --ink-600: #364e63; --ink-500: #5a7286; --ink-400: #8499ab;
  --ink-300: #b1c0cd; --ink-200: #d6dfe7; --ink-100: #ebeff3;
  --paper: #f4f1eb; --paper-2: #ebe6dc; --paper-3: #ddd6c7;
  --accent-700: #ad5d05; --accent-600: #d77508; --accent-500: #f08810;
  --accent-200: #fce0b8; --accent-100: #fdf0dc;
  --success: #2f9e6b; --success-bg: #e3f3eb;
  --warning: #d4a017; --warning-bg: #faf2d9;
  --danger: #c5392f; --danger-bg: #fae6e3;
  --shadow-1: 0 1px 2px rgba(14, 27, 39, 0.06);
  --shadow-2: 0 2px 6px rgba(14, 27, 39, 0.08), 0 1px 2px rgba(14, 27, 39, 0.04);
  --shadow-3: 0 8px 24px rgba(14, 27, 39, 0.12), 0 2px 6px rgba(14, 27, 39, 0.06);
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Legacy-Aliase (werden von app.js/ui.js referenziert) */
  --blau: var(--ink-800);
  --hell: var(--paper);
  --rand: var(--ink-200);
  --gruen: var(--success);
  --rot: var(--danger);
  --grau: var(--ink-500);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-sans); color: var(--ink-900);
  background: var(--paper); font-size: 14px; }

header { display: flex; align-items: center; justify-content: space-between;
  background: var(--ink-900); color: var(--paper); padding: 12px 20px;
  border-bottom: 3px solid var(--accent-600); }
header h1 { font-size: 17px; margin: 0; font-weight: 600;
  letter-spacing: -0.02em; display: flex; align-items: baseline; gap: 12px; }
header h1 svg.wortmarke { height: 20px; width: auto; color: var(--paper);
  transform: translateY(2px); }
header .app-name { color: var(--ink-300); font-weight: 500; font-size: 14px;
  letter-spacing: 0.04em; text-transform: uppercase; }
.kopf-rechts { display: flex; gap: 10px; align-items: center; }
.kopf-rechts label { font-size: 13px; color: var(--ink-300); }
header select { margin-left: 6px; background: var(--ink-800);
  color: var(--paper); border-color: var(--ink-600); }

nav#tabs { display: flex; gap: 4px; background: var(--ink-900);
  padding: 10px 16px 0; }
nav#tabs button { border: 0; padding: 9px 18px; cursor: pointer;
  font-size: 13px; font-weight: 500; font-family: var(--font-sans);
  background: var(--ink-800); color: var(--ink-300);
  border-radius: 6px 6px 0 0; transition: all 120ms ease; }
nav#tabs button:hover { color: var(--paper); }
nav#tabs button.aktiv { background: var(--paper); color: var(--ink-900);
  font-weight: 600; }

main { padding: 20px 20px 64px; max-width: 1440px; }
.tab { display: none; }
.tab.aktiv { display: block; }
h2 { font-size: 15px; margin: 24px 0 6px; font-weight: 600;
  letter-spacing: -0.01em; }
.hinweis { font-size: 12px; color: var(--ink-500); margin: 2px 0 10px; }
.hinweis.negativ { color: var(--danger); }

button { border: 0; background: var(--accent-600); color: #fff;
  padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 13px;
  font-weight: 500; font-family: var(--font-sans);
  transition: background 120ms ease; }
button:hover { background: var(--accent-700); }
button.sekundaer { background: #fff; color: var(--ink-800);
  border: 1px solid var(--ink-300); }
button.sekundaer:hover { background: var(--ink-100); }
button.klein { padding: 3px 10px; font-size: 11px; }
button:disabled { opacity: .5; cursor: wait; }

input, select { padding: 6px 8px; border: 1px solid var(--ink-200);
  border-radius: 6px; font-size: 13px; background: #fff;
  font-family: var(--font-sans); color: var(--ink-900); }
input:focus, select:focus { outline: 2px solid var(--accent-500);
  outline-offset: 0; border-color: var(--accent-500); }
input[type="number"] { width: 80px; }

.formzeile { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 8px 0; font-size: 13px; }
.formzeile label { display: flex; flex-direction: column; gap: 3px;
  font-size: 12px; color: var(--ink-500); }
.fuellen { flex: 1; }

table.daten { border-collapse: collapse; background: #fff; font-size: 13px;
  box-shadow: var(--shadow-1); border-radius: 6px; overflow: hidden; }
table.daten th, table.daten td { border: 1px solid var(--paper-2);
  padding: 6px 9px; text-align: left; }
table.daten th { background: var(--ink-100); font-weight: 600;
  color: var(--ink-700); font-size: 12px; }
table.daten input, table.daten select { font-size: 12px; padding: 3px 5px; }
table.daten input.schmal { width: 64px; }

.spalten { display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 28px; }
.liste { font-size: 13px; }
.liste .zeile { display: flex; gap: 8px; align-items: center; padding: 4px 0;
  border-bottom: 1px solid var(--paper-2); }
.liste .zeile span { flex: 1; }
.liste em { color: var(--ink-500); font-style: normal; font-size: 12px; }

.plansteuerung { background: #fff; border: 1px solid var(--paper-2);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-1); }
#planStatusText { font-size: 13px; color: var(--ink-500); }

#planFortschritt { margin: 10px 0 0; background: #fff;
  border: 1px solid var(--paper-2); border-radius: 12px; padding: 10px 14px;
  display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-1); }
#planFortschrittBalken { flex: 1; height: 10px; border-radius: 999px;
  background: var(--ink-100); position: relative; overflow: hidden; }
#planFortschrittBalken::after { content: ''; position: absolute; inset: 0;
  width: var(--fortschritt, 0%); background: var(--accent-500);
  border-radius: 999px; transition: width .4s linear; }
#planFortschrittText { font-size: 12px; color: var(--ink-500);
  min-width: 170px; text-align: right; }

#planReport { margin: 14px 0; font-size: 13px; }
#planReport .banner { padding: 9px 14px; border-radius: 8px;
  font-weight: 600; }
#planReport .banner.ok { background: var(--success-bg); color: var(--success); }
#planReport .banner.fehler { background: var(--danger-bg); color: var(--danger); }
#planReport .banner.warnung { background: var(--warning-bg);
  color: var(--accent-700); margin-top: 6px; }
#planReport ul { margin: 6px 0 0 18px; color: var(--danger); }
#planReport ul.warnliste { color: var(--accent-700); }

.scrollbox { overflow-x: auto; }
/* border-collapse: separate -> jede Zelle bringt ihre EIGENEN, voll deckenden
   Rahmen mit. Noetig fuer die sticky Namensspalte: bei "collapse" gehoert die
   Rahmenlinie der Tabelle (nicht der Zelle), wodurch am linken Rand eine
   transparente Fuge blieb, durch die die scrollenden Zeilen blitzten. */
table.grid { border-collapse: separate; border-spacing: 0; background: #fff;
  font-size: 13px; box-shadow: var(--shadow-1); }
table.grid th, table.grid td { border-right: 1px solid var(--ink-100);
  border-bottom: 1px solid var(--ink-100);
  padding: 7px 5px; text-align: center; min-width: 34px; }
table.grid th { background: var(--ink-100); color: var(--ink-700);
  border-top: 1px solid var(--ink-100); }              /* obere Aussenkante */
/* Monatsband (spannende Kopfzeile pro Monat) */
table.grid tr.monatsband th { background: var(--ink-800); color: var(--paper);
  font-weight: 700; letter-spacing: .02em; }
table.grid th.we, table.grid td.we { background: var(--paper-2); }
table.grid td.name { text-align: left; white-space: nowrap; font-weight: 600;
  padding: 7px 11px; }
/* Namensspalte beim horizontalen Scrollen fixieren (immer sichtbar). Eigene
   linke + rechte Rahmen decken die Fuge komplett ab; Schatten zum Abheben. */
table.grid td.name,
table.grid th:first-child { position: sticky; left: 0; z-index: 2;
  background: #fff; border-left: 1px solid var(--ink-100);
  box-shadow: 3px 0 5px rgba(0,0,0,.10); }
table.grid th:first-child { background: var(--ink-100); z-index: 3; }
table.grid tr.summe td.name { background: var(--ink-100); }
table.grid td.gruppe { position: sticky; left: 0; z-index: 2;
  border-left: 1px solid var(--ink-100);
  box-shadow: 3px 0 5px rgba(0,0,0,.10); }
table.grid td.name small { color: var(--ink-500); font-weight: 400; }
/* white-space: nowrap verhindert, dass Zellen mit mehreren Markierungen
   (Chip + FA!/fremd/manuell) bei vielen Spalten (lange Planzeitraeume) auf
   eine zweite Zeile umbrechen und dadurch nur diese eine Zeile hoeher wird -
   die Spalte wird stattdessen breiter (Grid ist ohnehin horizontal scrollbar). */
table.grid td.zelle { cursor: pointer; height: 35px; white-space: nowrap; }
table.grid td.zelle:hover { outline: 2px solid var(--accent-500); }
.chip { display: inline-block; color: #fff; border-radius: 4px;
  padding: 2px 6px; font-size: 12px; font-weight: 500; }
/* Freier Tag: allgemein gueltiges Zeichen "C" */
.frei { color: var(--ink-500); font-weight: 700; font-size: 12px; }
/* Nomineller FA in einem FM-Dienst: deutlich hervorheben (Notfall-Einsatz) */
table.grid td.faauffm { outline: 2px solid var(--danger);
  outline-offset: -2px; background: var(--danger-bg); }
.faauffm-mark { color: var(--danger); font-size: 9px; font-weight: 700;
  margin-left: 1px; vertical-align: top; }
.abwmark { color: var(--ink-500); font-weight: 700; }
.abwmark.urlaub { color: var(--success); }
.abwmark.krank { color: var(--danger); }
.sondermark { display: inline-block; background: var(--accent-600); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 3px; padding: 0 4px;
  margin-left: 1px; letter-spacing: .03em; }
.manuellmark { display: inline-block; width: 5px; height: 5px;
  background: var(--accent-600); border-radius: 50%; vertical-align: top;
  margin-left: 1px; }

table.grid tr.summe td { background: var(--ink-100); font-weight: 600;
  color: var(--ink-700); font-size: 11px; }

/* Planungsverbund */
#verbundWahl { display: inline-flex; gap: 8px; align-items: center;
  font-size: 12px; color: var(--ink-500); }
#verbundWahl .vcheck { display: inline-flex; flex-direction: row;
  align-items: center; gap: 4px; color: var(--ink-700); white-space: nowrap; }
table.grid td.gruppe { background: var(--ink-800); color: var(--paper);
  text-align: left; font-weight: 600; padding: 4px 9px; font-size: 12px; }
table.grid td.fremd { outline: 2px solid var(--accent-600);
  outline-offset: -2px; background: var(--accent-100); }
.fremdmark { color: var(--accent-700); font-size: 9px; font-weight: 700;
  margin-left: 1px; white-space: nowrap; }
#planReport .banner.info { background: var(--ink-100); color: var(--ink-700);
  margin-top: 6px; }
#planReport ul.infoliste { color: var(--ink-700); }
#planSaldi table { margin-top: 16px; }
#planSaldi .negativ { color: var(--danger); }

#zellMenue[hidden] { display: none !important; }
#zellMenue { position: absolute; background: #fff;
  border: 1px solid var(--ink-200); border-radius: 12px;
  box-shadow: var(--shadow-3); padding: 8px;
  display: flex; flex-direction: column; gap: 4px; z-index: 50; }
#zellMenue button { text-align: left; background: #fff;
  color: var(--ink-900); border: 1px solid var(--paper-2); }
#zellMenue button:hover { background: var(--paper); }

input.bedarfzahl { width: 44px; text-align: center; font-weight: 600; }
input.bedarfzahl.leer { color: var(--ink-300); font-weight: 400; }
button.optzelle { width: 26px; padding: 3px 0; }
button.optzelle.z_o { background: var(--accent-100);
  color: var(--accent-700); border: 1px solid var(--accent-500); }
button.optzelle.z_o:hover { background: var(--accent-200); }
button.optzelle.z_leer { background: #fff; color: var(--ink-300);
  border: 1px solid var(--ink-200); }
button.optzelle.z_leer:hover { background: var(--ink-100); }
input:disabled { background: var(--ink-100); color: var(--ink-400);
  border-color: var(--paper-2); }
td.aktionen { white-space: nowrap; }
td.aktionen button + button { margin-left: 4px; }

/* Plan-Aktionen: Dropdown + Buttons bleiben zusammen in einer Zeile;
   das Dropdown waechst nicht unbegrenzt mit langen Plan-Namen */
.planaktionen { display: inline-flex; gap: 8px; align-items: flex-end;
  flex-wrap: nowrap; }
#planWahl { max-width: 280px; }

/* Zeitfelder breit genug fuer HH:MM inkl. Uhr-Symbol */
table.daten input[type="time"] { width: 108px; }

/* Summenzeile: mehr als 1 Urlaub am Tag hervorheben */
table.grid tr.summe td.uwarn { background: var(--danger-bg);
  color: var(--danger); font-weight: 700; }

/* Warte-Overlay mit Tetris waehrend der Plangenerierung */
#wartespiel { position: fixed; inset: 0; background: rgba(14, 27, 39, .55);
  display: flex; align-items: center; justify-content: center; z-index: 120; }
#wartespiel[hidden] { display: none; }
.wartebox { background: var(--paper); border-radius: 14px;
  padding: 20px 28px 16px; box-shadow: var(--shadow-3); text-align: center;
  max-width: 440px; }
.wartebox h2 { margin: 0 0 10px; }
.wartebox #planFortschritt { margin: 0 0 6px; }
.wartebox .hinweis { margin: 6px 0 10px; }
#tetrisCanvas { border-radius: 6px; box-shadow: var(--shadow-2); }
#tetrisPunkte { font-weight: 600; color: var(--ink-700); margin: 8px 0 0; }
.tetris-flaeche { display: flex; gap: 14px; align-items: flex-start;
  justify-content: center; }
.tetris-seite { display: flex; flex-direction: column; align-items: center;
  gap: 6px; }
.tetris-label { font-size: 12px; color: var(--ink-700); font-weight: 600; }
#tetrisNext { border-radius: 6px; box-shadow: var(--shadow-2); }
.tetris-info { font-weight: 600; color: var(--ink-800); }

/* Besetzungsmodell (Phase 3) */
label.inline { display: inline-flex; flex-direction: row; align-items: center;
  gap: 4px; margin: 0; }
#tab-modell h2 { margin-top: 22px; }
#tab-modell h2 .hinweis { display: inline; font-weight: 400; }
table.matrix { border-collapse: collapse; }
table.matrix th, table.matrix td { text-align: center; padding: 4px 8px;
  border: 1px solid var(--ink-100); white-space: nowrap; }
table.matrix thead th, table.matrix tbody th { background: var(--ink-100);
  font-weight: 600; position: sticky; }
table.matrix thead th { top: 0; }
.mx-ideal { color: var(--ink-500); font-style: italic; }
.warte-fertig { background: var(--ink-100); color: var(--ink-800);
  border-radius: 8px; padding: 10px 14px; margin: 0 0 10px;
  font-weight: 600; line-height: 1.4; }
.wartebox #spielSchliessen { margin-top: 12px; }
