:root {
  --bg: #F5F6F8;
  --panel: #FFFFFF;
  --ink: #1B2430;
  --ink-soft: #5B6472;
  --sidebar: #17202B;
  --sidebar-ink: #C7D0DB;
  --accent: #2F8F80;
  --accent-ink: #0E4A40;
  --warn: #C1533E;
  --warn-bg: #FBEAE6;
  --border: #E3E6EA;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
}

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
}

.brand-center { justify-content: center; border: none; margin-bottom: 24px; }

.brand-mark {
  font-family: var(--mono);
  font-weight: 700;
  background: var(--accent);
  color: #06231D;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.brand-name { font-weight: 600; letter-spacing: 0.2px; }

.nav-list { list-style: none; margin: 0; padding: 0; flex: 1; }
.nav-list li a {
  display: block;
  padding: 11px 20px;
  color: var(--sidebar-ink);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.nav-list li a:hover { background: rgba(255,255,255,0.05); }
.nav-list li a.active {
  color: #fff;
  border-left-color: var(--accent);
  background: rgba(47,143,128,0.15);
}

.sidebar-footer {
  padding: 16px 20px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.sidebar-footer a { color: var(--sidebar-ink); }

.content { flex: 1; padding: 32px 40px; max-width: 1100px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }

.hint { color: var(--ink-soft); font-size: 13px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin: 18px 0;
}

.inline-form {
  display: flex;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
}
.inline-form label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--ink-soft);
  gap: 4px;
}

label { display: flex; flex-direction: column; font-size: 12px; color: var(--ink-soft); gap: 4px; }

input, select, button {
  font-family: var(--sans);
  font-size: 14px;
}

input[type=text], input[type=password], input[type=date], select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

button {
  padding: 9px 16px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
button:hover { background: var(--accent-ink); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  font-weight: 500;
}
.btn-ghost:hover { background: #EEF1F4; }
.btn-danger { color: var(--warn); border-color: #EBC9C0; }
.btn-danger:hover { background: var(--warn-bg); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.data-table th {
  background: #FAFBFC;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.data-table tr:last-child td { border-bottom: none; }
.mono { font-family: var(--mono); font-size: 13px; }

.row-actions { display: flex; gap: 8px; }
.row-actions form { display: inline; }

.pill {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 100px;
  font-weight: 600;
}
.pill-ok { background: #E4F3EF; color: var(--accent-ink); }
.pill-off { background: #EEF0F2; color: var(--ink-soft); }

.card-row { display: flex; gap: 16px; margin: 20px 0; }
.status-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 4px solid var(--accent);
}
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.big-name { font-size: 24px; font-weight: 700; }
.big-name.muted { color: var(--ink-soft); font-weight: 500; }
.range { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); }

.plan-header { display: flex; justify-content: space-between; align-items: baseline; }
.year-switch { display: flex; gap: 10px; align-items: center; }
.year-switch button { background: transparent; color: var(--ink); border: 1px solid var(--border); }

.plan-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 16px 0 20px;
  flex-wrap: wrap;
}

.plan-layout { display: flex; gap: 24px; align-items: flex-start; }
.plan-table-wrap { flex: 1; }
.plan-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  position: sticky;
  top: 20px;
}

.dropzone {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dropzone.pool { flex-direction: column; }

.chip {
  background: #EEF6F4;
  border: 1px solid #CFE7E1;
  color: var(--accent-ink);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: grab;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.chip:active { cursor: grabbing; }
.chip-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  background: #fff;
  padding: 1px 6px;
  border-radius: 100px;
}
.chip-conflict { background: var(--warn-bg); border-color: #EBC9C0; color: var(--warn); }
.chip-flag {
  background: var(--warn);
  color: #fff;
  border-radius: 100px;
  width: 15px;
  height: 15px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.row-conflict td { background: var(--warn-bg); }
.row-manual td:nth-child(1)::after { content: " *"; color: var(--accent); }

.flash-stack { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.flash-stack-standalone { max-width: 420px; margin: 40px auto 0; }
.flash {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
}
.flash-success { background: #E4F3EF; color: var(--accent-ink); }
.flash-error { background: var(--warn-bg); color: var(--warn); }

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar);
}
.auth-card {
  background: var(--panel);
  padding: 32px;
  border-radius: 12px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-card button { margin-top: 6px; }

/* ---------------------------------------------------------- View-Tabs */
.view-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 18px 0 6px;
  flex-wrap: wrap;
}
.tab {
  padding: 8px 14px;
  border-radius: 7px 7px 0 0;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab-active {
  color: var(--accent-ink);
  background: var(--panel);
  border-color: var(--border);
  border-bottom-color: var(--panel);
}
.bundesland-form { margin-left: auto; }
.bl-label { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; }
.bl-label select { padding: 6px 8px; }

/* ---------------------------------------------------------- Warnbanner */
.gap-banner { display: flex; flex-direction: column; gap: 10px; }
.gap-banner-actions { display: flex; gap: 10px; align-items: center; }
.row-past td { opacity: 0.55; }

/* ---------------------------------------------------------- Chips */
.chip-label { margin-right: 2px; }
.chip-remove {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.55;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  margin: 0;
  margin-left: 2px;
  cursor: pointer;
}
.chip-remove:hover { opacity: 1; background: rgba(0,0,0,0.06); }
.pill-holiday {
  background: #FDECD2;
  color: #8A5A18;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 100px;
  font-weight: 600;
  margin-right: 4px;
  display: inline-block;
  margin-bottom: 2px;
}

.inline-form-compact { gap: 8px; }
.inline-form-compact input { padding: 6px 8px; font-size: 13px; }

/* ---------------------------------------------------------- Jahresübersicht */
.year-overview { display: flex; flex-direction: column; gap: 22px; margin-top: 10px; }
.month-group h3 { margin-bottom: 10px; font-size: 15px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.week-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.week-chip {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  position: relative;
  background: #fff;
}
.week-chip-kw { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
.week-chip-name { font-weight: 600; font-size: 13px; }
.week-chip-empty { background: repeating-linear-gradient(45deg, #F4F5F7, #F4F5F7 6px, #ECEEF1 6px, #ECEEF1 12px); }
.week-chip-conflict { border-color: #EBC9C0; }
.week-chip-holiday-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 100%;
  background: #C1804A;
}

/* ---------------------------------------------------------- Monatsübersicht */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0;
}
.month-title { font-weight: 700; font-size: 16px; }

.month-calendar {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.month-calendar th {
  background: #FAFBFC;
  font-size: 12px;
  color: var(--ink-soft);
  padding: 8px 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kw-cell { background: #FAFBFC; color: var(--ink-soft); font-size: 12px; width: 42px; }
.day-cell {
  border: 1px solid var(--border);
  vertical-align: top;
  height: 68px;
  padding: 4px 6px;
  font-size: 11px;
  position: relative;
}
.day-cell-out { color: #C3C9D1; background: #FAFBFC !important; }
.day-number { font-weight: 700; font-size: 12px; display: block; }
.day-holiday-name {
  display: block;
  color: #8A5A18;
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
}
.day-oncall-name {
  display: block;
  font-size: 10.5px;
  margin-top: 2px;
  font-weight: 600;
}
.day-cell-holiday { box-shadow: inset 0 0 0 2px #E9B673; }
.day-cell-today { box-shadow: inset 0 0 0 2px var(--accent); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); }
.legend-swatch {
  width: 14px; height: 14px; border-radius: 4px;
  border: 1px solid var(--border);
  display: inline-block;
}
.legend-holiday { box-shadow: inset 0 0 0 2px #E9B673; background: #fff; }

/* ---------------------------------------------------------- Zusammengefuehrte Uebersicht */
.section-divider { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.plan-year-title { margin: 0; }
.gap-banner { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.gap-banner-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.row-past td { opacity: 0.55; }

.plan-layout { display: flex; gap: 24px; align-items: flex-start; }
.plan-main { flex: 1; min-width: 0; }
.plan-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  position: sticky;
  top: 20px;
}

/* ---------------------------------------------------------- Chips (gemeinsam) */
.chip-compact { padding: 3px 6px; font-size: 11px; }
.chip-compact .chip-remove { font-size: 12px; }
.chip-mini {
  width: 100%;
  height: 18px;
  border-radius: 3px;
  padding: 0;
  margin: 0;
  cursor: grab;
  display: block;
  border-width: 1px;
  border-style: solid;
}

/* ---------------------------------------------------------- Monatsuebersicht: Dropzone im Tag */
.day-cell { position: relative; }
.day-dropzone {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  min-height: 20px;
}
.day-dropzone-mini {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 18px;
  height: 100%;
}

/* ---------------------------------------------------------- Jahresuebersicht als Tagesraster */
.year-grid-wrap { overflow-x: auto; }
.year-calendar {
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 900px;
}
.year-calendar th {
  background: #FAFBFC;
  font-size: 10px;
  color: var(--ink-soft);
  padding: 4px 2px;
  width: 24px;
  text-align: center;
}
.month-col-header { width: 90px !important; text-align: left !important; padding-left: 10px !important; }
.month-col {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 4px 10px;
  white-space: nowrap;
  border-right: 1px solid var(--border);
}
.day-cell-mini {
  width: 24px;
  height: 26px;
  border: 1px solid #F0F1F3;
  padding: 2px;
  vertical-align: middle;
}
.day-cell-weekend { background: #E8EAEE; }
.day-cell-mini.day-cell-holiday { box-shadow: inset 0 0 0 2px #E9B673; }
.day-cell-mini.day-cell-today { box-shadow: inset 0 0 0 2px var(--accent); }

/* ---------------------------------------------------------- Responsives Layout (v3) */
.content { max-width: 1500px; }
.plan-layout { display: block; }
.plan-main { width: 100%; }
.plan-sidebar { display: none; } /* ersetzt durch horizontalen Pool oberhalb */

.pool-horizontal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 10px 0 18px;
  width: fit-content;
  max-width: 100%;
}
.chip-flag-swap { background: var(--accent); }
.legend-weekend { background: #E8EAEE; border-color: #D3D7DD; }

.year-switch { display: flex; align-items: center; gap: 8px; }
.year-select-form, .month-select-form { display: inline-flex; gap: 8px; }
.year-select, .month-select-form select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-weight: 600;
}

/* ---------------------------------------------------------- Monatsuebersicht: skaliert mit Bildschirm */
.month-calendar { table-layout: fixed; }
.day-cell {
  height: clamp(90px, 13vw, 160px);
  padding: 6px 8px;
  font-size: clamp(11px, 0.9vw, 13px);
}
.day-number { font-size: clamp(12px, 1vw, 15px); }
.day-holiday-name { font-size: clamp(9px, 0.75vw, 11px); }
.chip-compact { padding: 4px 7px; font-size: clamp(10px, 0.85vw, 12.5px); }

/* ---------------------------------------------------------- Jahresuebersicht: volle Breite, skaliert */
.year-calendar { width: 100%; min-width: 0; table-layout: fixed; }
.year-grid-wrap { overflow-x: visible; }
.month-col-header { width: 110px !important; }
.month-col { font-size: clamp(11px, 0.9vw, 13.5px); padding: 4px 10px; }
.year-calendar th { font-size: clamp(9px, 0.7vw, 11px); }
.day-cell-mini {
  width: auto;
  height: clamp(24px, 2.8vw, 44px);
}
.chip-mini { height: 100%; }

/* ---------------------------------------------------------- Auswertung */
.card-row-wrap { flex-wrap: wrap; }
.card-row-wrap .status-card { min-width: 160px; }
.status-card-warn { border-left-color: var(--warn); }
.table-scroll { overflow-x: auto; }
.bar-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.bar-row:last-child { border-bottom: none; }
.bar-row-label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 14px; }
.bar-row-name { font-weight: 700; }
.bar-row-value { font-family: var(--mono); color: var(--ink-soft); font-size: 13px; }
.bar-track { background: #EEF0F3; border-radius: 100px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 100px; }
.bar-row-meta { display: flex; gap: 16px; margin-top: 6px; font-size: 12px; color: var(--ink-soft); flex-wrap: wrap; }
.meta-positive { color: var(--warn); }
.meta-negative { color: var(--accent-ink); }

/* ---------------------------------------------------------- Luecken-Details (Auswertung) */
.gap-summary { cursor: pointer; }
.gap-date-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gap-date-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.btn-tiny { padding: 3px 8px; font-size: 11px; }

/* ---------------------------------------------------------- Geteilte Woche (Listenansicht) */
.dropzone-split { gap: 4px; }
.split-hint { display: block; margin-top: 4px; font-size: 11px; }
.split-hint a { color: var(--accent-ink); }
