@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --panel: #fafafa;
  --fill: #f5f5f5;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --text: #0a0a0a;
  --text-2: #404040;
  --muted: #525252;
  --faint: #737373;
  --error: #dc2626;
  --error-text: #b91c1c;
  --error-dark: #7f1d1d;
  --error-soft: #fef2f2;
  --error-border: #fecaca;
  --warning: #f59e0b;
  --warning-text: #92400e;
  --info: #2563eb;
  --info-text: #1d4ed8;
  --ok: #16a34a;
  --ok-text: #166534;
  --ok-soft: #dcfce7;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  min-width: 1100px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 19px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; line-height: 28px; white-space: nowrap; }
h2 { font-size: 14px; font-weight: 600; line-height: 20px; }
h3 { font-size: 14px; font-weight: 600; }
h4 { font-size: 12px; font-weight: 600; color: var(--muted); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
.mono { font-family: var(--mono); }
.grow { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 100; background: var(--bg); padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.icon-sprite { position: absolute; width: 0; height: 0; }
.icon { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Formularelemente */
/* :where keeps the base rule at zero specificity so component rules can override it. */
:where(input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea) {
  display: block;
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg);
  font-size: 13px;
}
:where(textarea) { height: auto; padding: 9px 12px; line-height: 19px; resize: vertical; }
input:disabled, select:disabled, textarea:disabled, input[readonly], textarea[readonly] { background: var(--fill); color: var(--muted); }
input.invalid, textarea.invalid, .missing-input { border-color: var(--error) !important; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input.code { background: var(--panel); height: 40px; font-family: var(--mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; min-width: 0; }
.field .hint, .field .optional { font-weight: 400; }
.optional { color: var(--faint); font-size: 12px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-pair.wide-first { grid-template-columns: 1fr 112px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--text); flex-shrink: 0; }
.hint { color: var(--faint); font-size: 12px; line-height: 17px; }
.lead { color: var(--muted); padding-bottom: 16px; }
.error-text { color: var(--error-text); }
.danger-text { color: var(--error-text) !important; }

.btn, .btn-outline, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn { background: var(--text); color: #fff; }
.btn:hover:not(:disabled) { background: #262626; }
.btn.danger { background: var(--error); }
.btn-outline { background: var(--bg); border-color: var(--border); padding: 0 12px; }
.btn-outline:hover:not(:disabled), .btn-ghost:hover:not(:disabled) { background: var(--fill); }
.btn-ghost { background: transparent; color: var(--muted); padding: 0 10px; }
.btn:disabled, .btn-outline:disabled, .btn-ghost:disabled { opacity: .4; }
.small, .btn-flat.small { height: 28px; padding: 0 10px; border-radius: 6px; font-size: 12px; }
.btn-flat { display: inline-flex; align-items: center; height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; }
.btn-flat:hover:not(:disabled) { background: var(--fill); }
.btn-flat:disabled { opacity: .4; }
.link-btn { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.link-btn:hover { color: var(--text); text-decoration: underline; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); flex-shrink: 0; list-style: none; }
.icon-btn:hover { background: var(--fill); color: var(--text); }
.icon-btn::-webkit-details-marker { display: none; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--fill); color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge strong { font-weight: 500; }
.badge.mono { border-radius: 6px; font-size: 11px; }
.badge.changed { background: #fef3c7; color: var(--warning-text); }
.badge.approved { background: var(--ok-soft); color: var(--ok-text); }
.count { font-family: var(--mono); font-size: 12px; color: var(--faint); font-weight: 400; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; flex-shrink: 0; background: var(--faint); }
.dot.error { background: var(--error); }
.dot.warning { background: var(--warning); }
.dot.info { background: var(--info); }
.dot.ok { background: var(--ok); }

/* Anmeldung */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; background: var(--panel); padding: 24px; }
.login-card { width: 360px; display: flex; flex-direction: column; gap: 16px; padding: 32px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.login-card h1 { padding-bottom: 8px; }
.login-card .btn { height: 36px; margin-top: 4px; }
.login-error { color: var(--error-text); font-size: 13px; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--text); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 13px; font-weight: 600; flex-shrink: 0; }

/* Grundgerüst */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 240px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; padding: 16px 12px 12px; background: var(--panel); border-right: 1px solid var(--border); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 4px 14px; }
.sidebar-brand .sidebar-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-brand strong { font-size: 14px; font-weight: 600; line-height: 18px; }
.sidebar-brand span { font-size: 12px; line-height: 16px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-switch { position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--faint); }
.plan-switch-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.plan-switch-text strong { font-size: 13px; font-weight: 500; line-height: 18px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-switch-text span { font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-switch select { position: absolute; inset: 0; height: 100%; opacity: 0; cursor: pointer; }
.plan-switch:focus-within { outline: 2px solid var(--text); outline-offset: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 18px 10px 6px; font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; color: var(--text-2); font-weight: 500; text-decoration: none; }
.nav-item > .sidebar-text { flex: 1; }
button.nav-item { width: 100%; background: none; font: inherit; font-weight: 500; text-align: left; margin-top: auto; }
button.nav-item:not([hidden]) + .sidebar-account { margin-top: 8px; }
.nav-item:hover { background: #f0f0f0; }
.nav-item.active { background: var(--bg); border-color: var(--border); color: var(--text); }
.nav-badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.nav-badge::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: var(--info); }
.nav-badge.error::before { background: var(--error); }
.nav-badge.warning::before { background: var(--warning); }
.sidebar-account { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 4px 0; border-top: 1px solid var(--border); }
.avatar { width: 32px; height: 32px; border-radius: 16px; background: var(--border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.account-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.account-text strong { font-weight: 500; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-text span { font-size: 12px; line-height: 16px; color: var(--faint); }

.sidebar.collapsed { width: 56px; padding: 12px 0; align-items: center; }
.sidebar.collapsed .sidebar-text { display: none; }
.sidebar.collapsed .sidebar-brand { padding: 0 0 8px; }
.sidebar.collapsed .nav { align-items: center; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.sidebar.collapsed .nav-item { width: 36px; height: 36px; padding: 0; justify-content: center; position: relative; }
.sidebar.collapsed .nav-item .icon { width: 18px; height: 18px; }
.sidebar.collapsed .nav-badge { position: absolute; top: 5px; right: 5px; font-size: 0; }
.sidebar.collapsed .nav-badge::before { width: 8px; height: 8px; border-radius: 4px; border: 1.5px solid var(--panel); }
.sidebar.collapsed .sidebar-account { flex-direction: column-reverse; gap: 6px; padding: 10px 0 0; border-top: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panel > div[id$="View"] { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.page-head { min-height: 64px; flex-shrink: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 32px; border-bottom: 1px solid var(--border); }
#planPanel .page-head { padding: 8px 20px; }
.page-body { flex: 1; min-height: 0; overflow: auto; padding: 24px 32px 32px; }
#planPanel .page-body { padding: 12px 20px 32px; }
.name-input input { width: 180px; height: 32px; font-weight: 500; border-color: var(--border); }
.counts { display: flex; align-items: center; gap: 14px; font-weight: 500; white-space: nowrap; }
.counts span { display: inline-flex; align-items: center; gap: 6px; }
.counts .error { color: var(--error-text); }
.counts .warning { color: var(--warning-text); }
.counts .info { color: var(--info-text); }
.counts .ok { color: var(--ok-text); }
.menu { position: relative; }
.menu-items { position: absolute; right: 0; top: 34px; z-index: 20; min-width: 180px; padding: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .08); display: flex; flex-direction: column; }
.menu-items button { height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: none; text-align: left; }
.menu-items button:hover { background: var(--fill); }

.section { padding-bottom: 32px; }
.section-head { display: flex; align-items: baseline; gap: 8px; padding-bottom: 10px; }
.section-head.sub { padding-top: 28px; }
.status-line, .generation-status { color: var(--muted); font-size: 12px; padding: 8px 0; }
.generation-status.busy { color: var(--info-text); }
.generation-status.failed { color: var(--error-text); }
.empty-state, .empty-note, .rail-empty { color: var(--faint); padding: 12px 0; }
.empty-state.error { color: var(--error-text); }
.loading-text { color: var(--faint); }
body.is-checking .counts { opacity: .5; }

/* Dienstkürzel */
.shift-F { --chip-bg: #dbeafe; --chip-fg: #1e3a8a; }
.shift-S { --chip-bg: #ffedd5; --chip-fg: #9a3412; }
.shift-S2 { --chip-bg: #ffffff; --chip-fg: #9a3412; --chip-border: #fdba74; }
.shift-N { --chip-bg: #312e81; --chip-fg: #ffffff; }
.shift-T { --chip-bg: #ccfbf1; --chip-fg: #115e59; }
.shift-U, .shift-K, .shift-FB { --chip-bg: #ffffff; --chip-fg: #525252; --chip-border: #d4d4d4; }
.shift-EF { --chip-bg: #ffffff; --chip-fg: #1e3a8a; --chip-border: #93c5fd; }
.shift-ES, .shift-ES2 { --chip-bg: #ffffff; --chip-fg: #9a3412; --chip-border: #fdba74; }
.shift-EN { --chip-bg: #ffffff; --chip-fg: #312e81; --chip-border: #a5b4fc; }
.code {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 24px; padding: 0 3px; border-radius: 5px;
  background: var(--chip-bg, var(--fill)); color: var(--chip-fg, var(--text-2));
  box-shadow: inset 0 0 0 1px var(--chip-border, transparent);
  font-family: var(--mono); font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.legend-row { display: flex; align-items: flex-start; gap: 16px; min-height: 36px; padding-bottom: 8px; color: var(--muted); font-size: 12px; }
.shift-legend { flex: 1; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.marks { display: flex; gap: 14px; white-space: nowrap; min-height: 24px; align-items: center; }
.marks span { display: inline-flex; align-items: center; gap: 6px; }
.mark { width: 14px; height: 14px; border-radius: 4px; border: 2px solid var(--text); }
.mark.error { border-color: var(--error); }
.mark.warning { border-color: var(--warning); }

/* Dienstplanraster */
.grid-wrap { overflow-x: auto; padding-bottom: 4px; }
.schedule-grid { border-collapse: separate; border-spacing: 0; }
.schedule-grid th, .schedule-grid td { padding: 0; }
.schedule-grid thead th { width: 24px; min-width: 24px; height: 44px; padding-bottom: 5px; vertical-align: bottom; text-align: center; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 12px; font-weight: 500; line-height: 16px; }
.schedule-grid thead th small { display: block; font-family: var(--sans); font-size: 10px; font-weight: 500; color: var(--faint); letter-spacing: .04em; line-height: 14px; }
.schedule-grid thead th.has-error { color: var(--error-text); }
.schedule-grid thead th.has-warning { color: var(--warning-text); }
.schedule-grid th.employee { position: sticky; left: 0; z-index: 2; width: 152px; min-width: 152px; max-width: 152px; padding-right: 10px; background: var(--bg); text-align: left; font-family: var(--sans); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schedule-grid th.employee small { display: inline; padding-left: 8px; font-size: 11px; font-weight: 400; color: var(--faint); letter-spacing: 0; }
.schedule-grid th.balance { width: 56px; min-width: 56px; padding-left: 6px; text-align: right; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.schedule-grid thead th.balance { font-family: var(--sans); font-size: 11px; color: var(--faint); }
.schedule-grid td { width: 24px; height: 30px; text-align: center; }
.schedule-grid .weekend { background: var(--fill); }
.schedule-grid tr.group-row th { height: 30px; padding-top: 10px; background: var(--bg); text-align: left; font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; position: sticky; left: 0; }
.schedule-grid td select {
  -webkit-appearance: none; appearance: none;
  display: block; width: 22px; height: 24px; margin: 0 auto; padding: 0;
  border: 0; border-radius: 5px;
  background: var(--chip-bg, transparent); color: var(--chip-fg, #c4c4c4);
  box-shadow: inset 0 0 0 1px var(--chip-border, transparent);
  font-family: var(--mono); font-size: 11px; font-weight: 600; line-height: 24px;
  text-align: center; text-align-last: center; cursor: pointer;
}
.schedule-grid td.long select { font-size: 8px; letter-spacing: -0.04em; }
.schedule-grid td select:disabled { cursor: default; opacity: 1; background: var(--chip-bg, transparent); color: var(--chip-fg, #c4c4c4); }
.schedule-grid td.changed select { box-shadow: inset 0 0 0 2px var(--text); }
.schedule-grid td.has-info select { box-shadow: inset 0 0 0 1px var(--info); }
.schedule-grid td.has-warning select { box-shadow: inset 0 0 0 2px var(--warning); }
.schedule-grid td.has-error select { box-shadow: inset 0 0 0 2px var(--error); }
.schedule-grid td.pulse select { animation: pulse 1.2s ease-out; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(10, 10, 10, .5); } 100% { box-shadow: 0 0 0 10px rgba(10, 10, 10, 0); } }
.schedule-grid tr.coverage-row th.employee { font-weight: 500; color: var(--muted); }
.schedule-grid tr.coverage-row.bad th.employee { color: var(--error-text); }
.schedule-grid tr.coverage-row.first th, .schedule-grid tr.coverage-row.first td { border-top: 1px solid var(--border); }
.schedule-grid tr.coverage-row td { height: 28px; }
.cov { display: block; height: 2px; background: var(--border-strong); }
.cov.bad { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin: 0 auto; border-radius: 5px; border: 2px solid var(--error); background: var(--error-soft); color: var(--error-text); font-family: var(--mono); font-size: 11px; font-weight: 600; }

/* Trefferlisten */
.open-findings { padding-top: 32px; max-width: 1100px; }
.rail-item, .finding-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 6px 0; border: 0; border-top: 1px solid var(--border); background: none; text-align: left; font-size: 13px; }
.rail-item:last-child { border-bottom: 1px solid var(--border); }
.rail-item:hover { background: var(--panel); }
.rail-item .rule-id, .finding-row .rule-id { width: 48px; flex-shrink: 0; font-family: var(--mono); font-size: 12px; color: var(--faint); }
.rail-item strong { width: 240px; flex-shrink: 0; font-weight: 500; }
.rail-item small { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item .count { min-width: 28px; text-align: right; }
.rail-item .consequence { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.rail-item.error .consequence { color: var(--error-text); }

.toggle-group { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; font-weight: 500; }
.toggle-group label { cursor: pointer; }
.toggle-group label + label { border-left: 1px solid var(--border); }
.toggle-group input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-group span { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; color: var(--faint); }
.toggle-group b { font-weight: 500; }
.toggle-group .dot { width: 6px; height: 6px; }
.toggle-group input:checked + span { background: var(--fill); color: var(--text); }
.toggle-group input:focus-visible + span { outline: 2px solid var(--text); outline-offset: -2px; }

.findings-list { max-width: 960px; margin-top: -12px; }
.phase + .phase { border-top: 1px solid var(--border); }
.phase-head { display: flex; align-items: center; gap: 12px; height: 46px; }
.phase-head .number { width: 16px; font-family: var(--mono); font-size: 12px; color: var(--faint); }
.phase-head h2 { flex: 1; }
.phase-head .state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.phase-head .state.error { color: var(--error-text); font-weight: 500; }
.phase-head .state .icon { width: 14px; height: 14px; color: var(--ok); stroke-width: 2.5; }
.phase-items { padding-bottom: 8px; }
.finding { padding: 8px 12px 8px 28px; border-radius: 8px; }
.finding.jumpable { cursor: pointer; }
.finding.jumpable:hover { background: var(--panel); }
.finding.error { background: var(--error-soft); color: var(--error-dark); margin-bottom: 4px; }
.finding.error.jumpable:hover { background: #fee2e2; }
.finding-head { display: flex; align-items: center; gap: 12px; min-height: 24px; }
.finding-head strong { width: 216px; flex-shrink: 0; font-weight: 500; }
.finding.error .finding-head strong { font-weight: 600; }
.finding-head .where { flex: 1; min-width: 0; color: var(--muted); }
.finding.error .finding-head .where { color: var(--error-dark); }
.finding-head .rule { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.finding.error .finding-head .rule { color: var(--error-text); }
.finding .consequence { font-size: 12px; color: var(--error-text); }
.finding p.message { padding: 2px 0 0 20px; color: var(--muted); font-size: 12px; }
.finding.error p.message { color: var(--error-dark); }
.occurrences { padding: 4px 0 0 20px; font-size: 12px; }
.occurrences summary { cursor: pointer; color: var(--muted); }
.occurrences ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.occurrences li.detailed { flex-basis: 100%; display: flex; gap: 8px; align-items: baseline; }
.occurrences .message { color: var(--muted); }
.occurrence { display: inline-flex; height: 24px; align-items: center; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); font-size: 12px; color: var(--text-2); }
button.occurrence:hover { background: var(--fill); }

/* Tabellen */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { height: 32px; padding: 0 14px 0 0; border-bottom: 1px solid var(--border); text-align: left; font-size: 12px; font-weight: 400; color: var(--faint); white-space: nowrap; }
.data-table td { height: 40px; padding: 0 14px 0 0; border-bottom: 1px solid var(--border); }
.data-table th.number, .data-table td.number { text-align: right; }
.data-table td.number { font-family: var(--mono); color: var(--text-2); }
.data-table td.id { font-family: var(--mono); font-size: 12px; color: var(--faint); white-space: nowrap; }
.data-table td.muted { color: var(--muted); }
.data-table td.strong { font-weight: 600; color: var(--text); }
.data-table td.near { color: var(--info-text); }
.data-table td.outside { color: var(--warning-text); }
.data-table .severity { display: inline-flex; align-items: center; gap: 6px; }
.data-table .not-implemented { font-weight: 500; color: var(--warning-text); }
.data-table .implemented { color: var(--muted); }
.data-table tr.group td { height: 44px; vertical-align: bottom; padding-bottom: 8px; font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; }
.hours-table { max-width: 960px; }
.hours-table td.person small { padding-left: 8px; font-size: 11px; color: var(--faint); }
.hours-table td.person strong { font-weight: 500; }
.hours-table input { width: 88px; height: 30px; margin-left: auto; padding: 0 8px; text-align: right; font-family: var(--mono); }
.balance-bar { position: relative; width: 120px; height: 10px; margin-left: auto; }
.balance-bar::before { content: ""; position: absolute; left: 0; top: 2px; width: 120px; height: 6px; border-radius: 3px; background: #f0f0f0; }
.balance-bar::after { content: ""; position: absolute; left: 60px; top: 0; width: 1px; height: 10px; background: var(--faint); }
.balance-bar i { position: absolute; top: 2px; height: 6px; border-radius: 3px; background: var(--text); }
.balance-bar.near i { background: var(--info); }
.balance-bar.outside i { background: var(--warning); }

/* Varianten */
#generatorPanel .page-body > * { max-width: 960px; }
.profile-options { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.variant-results { display: flex; flex-direction: column; gap: 12px; }
.variant-results:not(:empty) { padding-top: 8px; }
.variant-comparison p { display: none; }
.variant-table td.profile strong { display: block; font-size: 14px; font-weight: 600; }
.variant-table td { height: 56px; }
.variant-table td.best { font-weight: 600; color: var(--text); }
.variant-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: start; }
.variant-card h4 { font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.variant-card p { color: var(--muted); font-size: 12px; }
.variant-card ul, .variant-card details { grid-column: 1 / -1; margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.variant-card details { padding-left: 0; }
.variant-card details summary { cursor: pointer; }
.status-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--fill); color: var(--text-2); font-size: 12px; font-weight: 500; }
.status-pill.approved, .status-pill.grün { background: var(--ok-soft); color: var(--ok-text); }
.status-pill.rot { background: #fee2e2; color: var(--error-text); }
.status-pill.gelb { background: #fef3c7; color: var(--warning-text); }
.status-pill.blau { background: #dbeafe; color: var(--info-text); }
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--fill); color: var(--text-2); font-size: 12px; font-weight: 500; }
.chip button { display: inline-flex; border: 0; background: none; padding: 0; color: var(--faint); font-size: 14px; line-height: 1; }
.fold { margin-top: 12px; }
.fold > summary { cursor: pointer; font-size: 12px; font-weight: 500; color: var(--muted); }
.fold > summary:hover { color: var(--text); }
.fold-body { display: flex; flex-direction: column; gap: 14px; padding-top: 14px; }
.policy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.constraint-form, .suggestion-form, .user-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.constraint-form .wide { grid-column: span 3; }
.inline-form { display: flex; gap: 12px; align-items: end; padding-bottom: 6px; }
.suggestion-form { padding-top: 10px; }
.wish-batch-rows { display: flex; flex-direction: column; gap: 8px; }
.wish-batch-row { display: grid; grid-template-columns: 1.3fr 1.2fr 1fr 1fr .7fr 1.4fr 28px; gap: 8px; align-items: end; }
.wish-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; }
.wish-field input, .wish-field select { height: 32px; padding: 0 8px; }
.item-list { display: flex; flex-direction: column; }
.constraint-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.scenario-meta { color: var(--muted); font-size: 12px; }
.scenario-list { display: flex; flex-direction: column; }
.scenario-item { display: grid; grid-template-columns: 220px auto 1fr auto; gap: 4px 12px; align-items: center; min-height: 46px; padding: 6px 0; border-top: 1px solid var(--border); }
.scenario-item:last-child { border-bottom: 1px solid var(--border); }
.scenario-item.current .scenario-title strong::after { content: " (geöffnet)"; font-weight: 400; color: var(--faint); }
.scenario-title strong { font-weight: 500; }
.scenario-item .checksum { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.scenario-actions-row { display: flex; gap: 2px; }
.scenario-history { grid-column: 1 / -1; padding: 4px 0 8px; color: var(--muted); font-size: 12px; }

/* Druck & Freigabe */
.approval-layout { display: grid; grid-template-columns: 328px minmax(0, 1fr); gap: 40px; align-items: start; }
.approval-form { display: flex; flex-direction: column; gap: 16px; }
.checklist { display: flex; flex-direction: column; border-bottom: 1px solid var(--border); }
.checklist div { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 0; border-top: 1px solid var(--border); }
.checklist .icon { width: 14px; height: 14px; color: var(--ok); stroke-width: 2.5; }
.checklist .open { color: var(--error-text); }
.checklist .open .dot { margin: 0 3px; }
.confirm-box { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--text); border-radius: 10px; font-weight: 500; cursor: pointer; }
.confirm-box input { margin-top: 1px; }
.print-preview { min-width: 0; overflow: hidden; }
.print-sheet { position: relative; width: 1180px; padding: 22px 24px; border: 1px solid var(--border-strong); border-radius: 4px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .06); color: #111; font-size: 12px; line-height: 1.4; }
.print-sheet-header { display: flex; justify-content: space-between; align-items: end; margin-bottom: 12px; }
.print-sheet-header h2 { font-size: 18px; }
.print-sheet-header p { margin-top: 2px; color: #555; font-size: 11px; }
.print-brand { text-align: right; font-size: 11px; font-weight: 700; }
.print-plan { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 10px; }
.print-plan th, .print-plan td { height: 27px; padding: 2px; border: 1px solid #6f6f6f; text-align: center; }
.print-plan .print-name { width: 150px; padding-left: 6px; text-align: left; font-weight: 700; }
.print-plan .print-hours { width: 52px; font-weight: 700; }
.print-plan .saturday { background: #e6e6e6; }
.print-plan .sunday { background: #d4d4d4; }
.print-meta { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-top: 12px; }
.print-legend { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); gap: 3px 12px; font-size: 10px; }
.print-approval { border: 1px solid #7b7b7b; padding: 8px; font-size: 11px; }
.print-approval p { margin-top: 6px; }
.draft-watermark { position: absolute; inset: 42% 8% auto; z-index: 4; transform: rotate(-10deg); color: rgba(220, 38, 38, .16); font-size: 62px; font-weight: 900; letter-spacing: .08em; text-align: center; pointer-events: none; line-height: 1.1; }

/* Regelstand */
#rulesPanel .page-body > .section { max-width: 960px; }
.search { width: 220px !important; height: 32px !important; border-color: var(--border) !important; }
.rule-list { display: flex; flex-direction: column; }
.rule-row { display: flex; align-items: center; gap: 14px; min-height: 56px; border-top: 1px solid var(--border); }
.rule-row:last-child { border-bottom: 1px solid var(--border); }
.rule-row .title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rule-row .title strong { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rule-row .title span { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.rule-row .scope { width: 190px; flex-shrink: 0; color: var(--muted); white-space: nowrap; }
.rule-row .severity { width: 84px; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; }
.rule-row.off .title strong, .rule-row.off .scope, .rule-row.off .severity { color: var(--faint); }
input.switch { -webkit-appearance: none; appearance: none; position: relative; width: 32px; height: 18px; border-radius: 9px; background: var(--border-strong); cursor: pointer; transition: background .15s; }
input.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 7px; background: #fff; transition: left .15s; }
input.switch:checked { background: var(--text); }
input.switch:checked::after { left: 16px; }
input.switch:disabled { opacity: .5; cursor: not-allowed; }
.rule-editor { display: grid; grid-template-columns: 408px minmax(0, 1fr); gap: 40px; align-items: start; max-width: 960px; }
.rule-form { display: flex; flex-direction: column; gap: 18px; }
.chip-input { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 5px 6px; border: 1px solid var(--border-strong); border-radius: 8px; }
.chip-input select { width: auto; flex: 1; min-width: 120px; height: 24px; padding: 0 4px; border: 0; color: var(--faint); font-weight: 400; }
.segmented { display: flex; gap: 3px; height: 36px; padding: 3px; border: 1px solid var(--border-strong); border-radius: 8px; font-weight: 500; }
.segmented label { flex: 1; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: flex; align-items: center; justify-content: center; gap: 6px; height: 100%; border-radius: 5px; color: var(--muted); }
.segmented .dot { width: 6px; height: 6px; }
.segmented input:checked + span { background: var(--text); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 2px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); font-weight: 500; }
.rule-preview { display: flex; flex-direction: column; gap: 6px; }
.rule-hit { display: flex; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--fill); }
.rule-hit .dot { margin-top: 6px; }
.rule-hit.error { background: var(--error-soft); color: var(--error-dark); }
.rule-hit strong { display: block; font-weight: 600; }

/* Stammdaten */
.admin-layout { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 32px; align-items: start; max-width: 1040px; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.admin-nav a { display: flex; align-items: center; height: 30px; padding: 0 10px; border-radius: 6px; color: var(--muted); text-decoration: none; }
.admin-nav a:hover { background: var(--panel); }
.admin-nav a.active { background: var(--fill); color: var(--text); font-weight: 500; }
.admin-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 640px; }
.span-all { grid-column: 1 / -1; }
.record-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.record { border-bottom: 1px solid var(--border); }
.record > summary { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 0; cursor: pointer; list-style: none; }
.record > summary::-webkit-details-marker { display: none; }
.record > summary:hover { background: var(--panel); }
.record > summary strong { font-weight: 500; min-width: 150px; }
.record > summary .meta { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.record > summary .codes { display: inline-flex; gap: 3px; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--fill); color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.tag.off { color: var(--faint); }
.record-body { display: flex; flex-direction: column; gap: 18px; padding: 8px 0 20px; }
.record-body pre { margin: 6px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--panel); font-family: var(--mono); font-size: 12px; overflow: auto; }
.field-group { display: flex; flex-direction: column; gap: 10px; }
.fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.fields .wide { grid-column: span 2; }
.fields .full { grid-column: 1 / -1; }
.flags { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.record-foot { display: flex; justify-content: flex-end; }
.special-day-editor { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.special-day-card { display: grid; grid-template-columns: 80px 80px 1fr auto auto auto; gap: 12px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--border); }
.config-history { display: flex; flex-direction: column; }
.config-history span { padding: 10px 0; border-top: 1px solid var(--border); color: var(--muted); }
.user-list { display: flex; flex-direction: column; }
.user-row { display: grid; grid-template-columns: minmax(0, 1fr) 132px 96px 132px auto; gap: 12px; align-items: center; min-height: 52px; border-top: 1px solid var(--border); }
.user-row:last-child { border-bottom: 1px solid var(--border); }
.user-row .who { display: flex; flex-direction: column; min-width: 0; }
.user-row .who strong { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row .who span { font-size: 12px; color: var(--faint); }
.user-row select, .user-row input { height: 32px; }
.user-row.off .who strong { color: var(--faint); }

/* Assistent */
.assistant { width: 384px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--border); }
body.assistant-hidden .assistant { display: none; }
.assistant-head { height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--border); }
.assistant-head > .icon { color: var(--text); }
.assistant-head strong { font-size: 14px; font-weight: 600; }
.conversation-select { width: auto !important; max-width: 150px; height: 26px !important; padding: 0 6px !important; border-color: transparent !important; background: transparent !important; color: var(--muted); font-size: 12px !important; text-overflow: ellipsis; }
.conversation-select:hover { background: var(--fill) !important; }
.ai-messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 16px 20px; }
.ai-messages > :first-child { margin-top: auto; }
.ai-message { white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-message.user { align-self: flex-end; max-width: 296px; padding: 9px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px 12px 4px 12px; }
.ai-message.error { color: var(--error-text); }
.ai-tool { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); }
.ai-tool .icon { width: 12px; height: 12px; stroke-width: 2.2; }
.ai-card { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.ai-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; font-size: 12px; font-weight: 600; }
.ai-card-head span { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--faint); }
.ai-card-rows { border-top: 1px solid var(--border); padding: 6px 12px 8px; display: flex; flex-direction: column; gap: 6px; }
.ai-change { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.ai-change .who { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-change .when { color: var(--muted); white-space: nowrap; }
.ai-change .value { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.ai-change .arrow { color: var(--faint); }
.ai-change .path { font-family: var(--mono); font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.ai-examples { display: flex; flex-direction: column; gap: 6px; }
.ai-examples > span { font-size: 12px; color: var(--faint); padding-bottom: 4px; }
.ai-examples button { padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg); text-align: left; line-height: 19px; }
.ai-examples button:hover { background: var(--fill); }
.ai-form { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; padding: 0 16px 16px; }
.ai-input { display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 10px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 12px; }
.ai-input:focus-within { border-color: var(--text); }
.ai-input textarea { height: auto; min-height: 38px; max-height: 160px; padding: 0; border: 0; border-radius: 0; resize: none; outline: none; }
.ai-input-row { display: flex; align-items: center; gap: 8px; }
.ai-input-row .badge { border-radius: 6px; max-width: 250px; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 22px; }
.send-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: var(--text); color: #fff; }
.send-btn .icon { width: 14px; height: 14px; stroke-width: 2.2; }
.send-btn:disabled { opacity: .35; }
.ai-foot { display: flex; gap: 8px; min-height: 16px; padding: 0 4px; font-size: 11px; line-height: 16px; color: var(--faint); }

/* Dialoge und Meldungen */
.modal { width: 440px; padding: 0; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 48px rgba(0, 0, 0, .16); }
.modal::backdrop { background: rgba(0, 0, 0, .4); }
.modal form { display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
.toast-container { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 8px; }
.toast { max-width: 360px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); box-shadow: 0 8px 24px rgba(0, 0, 0, .1); white-space: pre-line; }
.toast.error { border-color: var(--error-border); color: var(--error-dark); }
.toast.success { border-color: #bbf7d0; }

@media print {
  @page { size: A3 landscape; margin: 10mm; }
  html, body { height: auto; }
  body { min-width: 0; background: #fff; }
  .sidebar, .assistant, .modal, .toast-container, .skip-link, .page-head, .no-print { display: none !important; }
  .app, .main { display: block; height: auto; overflow: visible; }
  .panel { display: none !important; }
  body.print-output #printPanel { display: block !important; }
  .page-body { padding: 0; overflow: visible; }
  .approval-layout { display: block; }
  .print-preview { overflow: visible; }
  .print-sheet { width: auto; zoom: 1 !important; margin: 0; padding: 0; border: 0; box-shadow: none; }
  .print-plan { font-size: 7pt; }
  .print-plan th, .print-plan td { height: 7.5mm; }
  .print-sheet, .print-plan .saturday, .print-plan .sunday { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
