/* Redaktionsoberflaeche. Schriften bewusst systemseitig: keine Google Fonts,
   damit beim Aufruf keine Daten an Dritte gehen (DSGVO). */

:root {
  --paper: #f3f6f3;
  --surface: #ffffff;
  --ink: #17211d;
  --muted: #6a7671;
  --line: #dde3de;
  --accent: #2f6b54;
  --accent-soft: #e6efea;
  --alert: #a8451c;
  --amber: #9a7b1f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}

a { color: var(--accent); }

.shell { display: flex; min-height: calc(100vh - var(--banner-h)); }

/* Umgebungsbalken (nur dev): Entwicklung und Betrieb duerfen nie verwechselt werden. */
:root { --banner-h: 0px; }
body:has(.env-banner) { --banner-h: 32px; padding-top: var(--banner-h); }
.env-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: 32px; line-height: 32px;
  background: #b3261e; color: #fff; text-align: center;
  font-weight: 700; letter-spacing: 0.06em;
}

nav.rail {
  position: sticky; top: var(--banner-h); align-self: flex-start;
  height: calc(100vh - var(--banner-h)); overflow-y: auto;
  width: 208px;
  flex: 0 0 208px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 0;
  display: flex;
  flex-direction: column;
}
.rail .brand {
  padding: 0 20px 18px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.rail .brand span { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.rail a {
  display: block;
  padding: 8px 20px;
  color: var(--ink);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.rail a:hover { background: var(--paper); }
.rail a.active { border-left-color: var(--accent); color: var(--accent); font-weight: 500; }
.rail .spacer { flex: 1; }
.rail .quiet { color: var(--muted); font-size: 13px; }
/* Abmelden: immer sichtbar (Leiste bleibt beim Scrollen stehen), echter Knopf. */
.rail form.logout { margin: 12px 20px 0; }
.rail form.logout button {
  width: 100%; padding: 9px 12px; cursor: pointer; font: inherit; font-weight: 600;
  color: var(--alert); background: var(--surface);
  border: 2px solid var(--alert); border-radius: 6px;
}
.rail form.logout button:hover { background: var(--alert); color: #fff; }

main { flex: 1; padding: 34px 40px 80px; max-width: 980px; }

h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
h2 { font-size: 17px; font-weight: 600; margin: 34px 0 12px; }
.lede { color: var(--muted); margin: 0 0 26px; max-width: 62ch; }

.figures { display: flex; gap: 34px; margin: 0 0 30px; }
.figures div b { display: block; font-size: 24px; font-weight: 600; }
.figures div span { color: var(--muted); font-size: 13px; }

ul.items { list-style: none; margin: 0; padding: 0; }
ul.items li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  margin-bottom: 6px;
  padding: 11px 15px;
  display: flex;
  gap: 14px;
  align-items: baseline;
}
li.draft { border-left-color: var(--muted); }
li.scheduled { border-left-color: var(--amber); }
li.published { border-left-color: var(--accent); }
li.failed { border-left-color: var(--alert); }
li.important { border-left-color: var(--alert); }
ul.items .when { color: var(--muted); font-size: 13px; white-space: nowrap; }
ul.items .grow { flex: 1; }
ul.items .state { color: var(--muted); font-size: 13px; white-space: nowrap; }
ul.items a { text-decoration: none; }
ul.items a:hover { text-decoration: underline; }

form.stack { background: var(--surface); border: 1px solid var(--line); padding: 22px; }
label { display: block; margin: 0 0 16px; }
label > i { display: block; font-style: normal; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], textarea, select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  border-radius: 2px;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
textarea.tall { min-height: 320px; }
.cols { display: flex; gap: 16px; }
.cols > label { flex: 1; }

button {
  font: inherit;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  border-radius: 2px;
}
button:hover { background: #26583f; }
button.ghost { background: transparent; color: var(--accent); }
button.ghost:hover { background: var(--accent-soft); }
button.danger { border-color: var(--alert); background: transparent; color: var(--alert); }
button.danger:hover { background: #f6e9e3; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

.note { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 12px 15px; margin: 0 0 22px; }
.warn { background: #f8ece6; border-left: 3px solid var(--alert); padding: 12px 15px; margin: 0 0 22px; }
.empty { color: var(--muted); padding: 26px 0; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); }
th { font-weight: 500; color: var(--muted); font-size: 13px; }
tr:last-child td { border-bottom: none; }
code { background: var(--accent-soft); padding: 2px 6px; font-size: 14px; }

.login { display: grid; place-items: center; min-height: calc(100vh - var(--banner-h)); }
.login form { width: 340px; background: var(--surface); border: 1px solid var(--line); padding: 28px; }
.login-stack { display: flex; flex-direction: column; gap: 16px; }
.login .login-box { width: 340px; box-sizing: border-box; background: var(--surface); border: 1px solid var(--line); padding: 28px; }
.login .login-inner { width: auto; padding: 0; border: 0; margin-top: 14px; }
.login details.login-box summary { cursor: pointer; }
.login .pruefzahl { font-size: 64px; font-weight: 600; text-align: center; letter-spacing: 4px; margin: 14px 0; }
/* "Angemeldet als ..." - oben im Inhaltsbereich, rechtsbuendig, unauffaellig. */
.whoami { text-align: right; color: var(--muted); font-size: 13px; margin: -18px 0 14px; }

.tg-menu { margin: 0 0 22px; }
.tg-row { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.tg-btn {
  display: inline-block;
  padding: 7px 12px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 13px;
}
.tg-msg {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 15px;
  margin: 0 0 22px;
  white-space: pre-wrap;
  font-size: 14px;
}
.tg-msg pre { margin: 4px 0; font: 13px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; }

.checks { display: flex; gap: 18px; flex-wrap: wrap; }
label.check { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
label.check input { width: auto; }

tr.inactive td { color: var(--muted); }
ul.items .state, td .state { color: var(--muted); font-size: 12px; }

.tabs { display: flex; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.tabs a {
  padding: 8px 16px;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

.month-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0 0 20px;
  flex-wrap: wrap;
}
.month-nav b { font-size: 16px; min-width: 160px; }
a.ghost-link { color: var(--accent); text-decoration: none; font-size: 14px; }
a.ghost-link:hover { text-decoration: underline; }

table.plan { table-layout: fixed; }
table.plan th:first-child, table.plan td:first-child { width: 44px; }
table.plan th:nth-child(2), table.plan td:nth-child(2) { width: 90px; }
table.plan tr.weekend td, table.plan tr.weekend th { background: #f8ece0; }
table.plan td.muted { color: var(--muted); }
table.plan td.editable { padding: 4px 8px; vertical-align: top; }
.cell-slots { display: flex; gap: 6px; }
.cell-slots select { flex: 1 1 0; min-width: 0; padding: 4px 6px; font-size: 14px; }

.muted { color: var(--muted); }

.request-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.request-head { font-size: 15px; margin-bottom: 6px; }
.request-comment { color: var(--muted); margin: 0 0 10px; }

table.staffing { margin: 10px 0; font-size: 13px; }
table.staffing th, table.staffing td { padding: 6px 10px; }
table.staffing td.staffing-warn { background: #f8ece6; color: var(--alert); font-weight: 600; }

details > summary { cursor: pointer; font-weight: 500; margin: 8px 0 14px; }

.ti-block {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 10px 18px;
  margin: 0 0 22px;
}
.ti-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line);
}
.ti-row:last-of-type { border-bottom: none; }
.ti-tag {
  font-size: 11px; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 3px; padding: 1px 5px; margin-left: 4px;
}

.ti-dienstart-row {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.ti-dienstart-row:last-of-type { border-bottom: none; }
.ti-dienstart-label { width: 110px; flex: 0 0 110px; font-weight: 500; }
.ti-dienstart-row .muted { margin-left: auto; font-size: 13px; }

.ti-compact { background: var(--surface); border: 1px solid var(--line); margin: 0 0 22px; }
.ti-compact-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.ti-compact-row:last-child { border-bottom: none; }
.ti-compact-row.conflict { background: #f8ece6; }
.plan td.conflict, .plan td.rule-conflict { background: #f8ece6; }
.badge-abwesend { color: var(--alert); font-weight: 600; font-size: 12px; }
.rule-marks { margin-top: 4px; font-size: 12px; line-height: 1.35; color: var(--alert); }
.badge-regel { color: var(--alert); font-weight: 600; margin-right: 4px; }
.ti-compact-label { width: 130px; flex: 0 0 130px; font-weight: 500; }
.ti-compact-row select { width: auto; flex: 1 1 180px; }
.ti-compact-row .muted { flex: 0 0 auto; font-size: 13px; }

/* Sammel-Speichern (templates/_batch_save.html, static/batch_save.js) - fuer jede Panel-Seite */
.savebar {
  position: sticky; top: var(--banner-h); z-index: 20;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line);
  padding: 8px 14px; margin: 0 0 16px;
  box-shadow: 0 2px 6px rgba(23, 33, 29, 0.08);
}
.savebar-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.savebar-state { font-weight: 500; }
.savebar.has-changes { border-left-color: var(--amber); background: #fffbe8; }
.savebar.tone-ok { border-left-color: var(--accent); background: var(--accent-soft); }
.savebar.tone-warn { border-left-color: var(--alert); background: #fdf1ec; }
.savebar-problems {
  margin: 8px 0 2px; padding: 0 0 0 18px; max-height: 28vh; overflow-y: auto;
  font-size: 13px; color: var(--alert);
}
.savebar-problems a { color: var(--alert); font-weight: 500; }
.cell-dirty select { background: #fffbe8; border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.cell-error select { background: #fdf1ec; border-color: var(--alert); box-shadow: 0 0 0 1px var(--alert); }
.cell-msg { color: var(--alert); font-size: 12px; line-height: 1.35; margin-top: 4px; flex: 1 1 100%; }
.cell-confirm {
  font: inherit; font-size: 12px; font-weight: 500; margin-top: 4px; padding: 2px 8px;
  color: var(--alert); background: #fff; border: 1px solid var(--alert); border-radius: 4px; cursor: pointer;
}
.cell-confirm:hover { background: #fdf1ec; }
table.plan tr td.cell-dirty { box-shadow: inset 4px 0 0 var(--amber); }
table.plan tr td.cell-error { background: #f8ece6; box-shadow: inset 4px 0 0 var(--alert); }
.ti-compact-row.cell-dirty { box-shadow: inset 4px 0 0 var(--amber); }
.ti-compact-row.cell-error { background: #f8ece6; box-shadow: inset 4px 0 0 var(--alert); }

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  nav.rail { width: auto; flex: none; flex-direction: row; overflow-x: auto; padding: 10px 0; }
  .rail .brand, .rail .spacer, .rail .quiet { display: none; }
  .rail a { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .rail a.active { border-bottom-color: var(--accent); }
  main { padding: 22px 18px 60px; }
}

/* Wuensche (Schritt 2g-1) */
.note.note-warn { background: #f8ece6; border-left-color: var(--alert); color: var(--alert); }
table.wishes td { vertical-align: top; }
.wish-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 2px 0; }
.wish-line form.inline { display: inline; margin: 0; }
.wish-line button.ghost { padding: 2px 8px; font-size: 12px; }
.wish-frei { color: var(--amber); font-weight: 600; }
.wish-dienst { color: var(--accent); font-weight: 600; }
.wish-ok { color: var(--accent); }
.wish-no { color: var(--alert); }
/* Dienstplan: Wunsch-Chips in den Zellen; gelber Hinweis (keine Sperre) bei Einteilung an Wunschfrei */
.wish-chips { margin-top: 4px; font-size: 12px; line-height: 1.35; }
.wish-chip { display: inline-block; margin-right: 6px; }
.wish-chip.wish-frei { color: var(--amber); }
.wish-chip.wish-dienst { color: var(--accent); }
.wish-note { margin-top: 4px; font-size: 12px; line-height: 1.35; color: var(--amber); font-weight: 600; }
.plan td.wish-hint:not(.conflict):not(.rule-conflict):not(.cell-error) { background: #fbf3d6; }
