:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --sidebar-bg: #ffffff;
  --sidebar-bg-active: #eaf1ff;
  --sidebar-text: #55617a;
  --sidebar-text-hover: #172038;
  --sidebar-border: #ecf0f6;
  --accent: #2f6fed;
  --accent-dark: #1f57d1;
  --accent-light: #e8f0fe;
  --border: #e6eaf2;
  --border-strong: #cbd5e1;
  --text: #172038;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --dark-bg: #10192f;
  --radius-lg: 14px;
  --radius-md: 9px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 1px 3px rgba(15, 23, 42, 0.07), 0 4px 12px -4px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 30px -8px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ---------- Sidebar ---------- */
.sb {
  width: 250px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}
.sb-brand {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sb-brand img { display: block; width: 100%; height: auto; }

.sb-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  overflow-y: auto;
  gap: 1px;
}
.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  list-style: none;
  transition: background-color .12s ease, color .12s ease;
}
.sb-link::-webkit-details-marker { display: none; }
.sb-link:hover { background: var(--surface-alt); color: var(--sidebar-text-hover); }
.sb-link.active { background: var(--sidebar-bg-active); color: var(--accent-dark); font-weight: 600; }
.sb-icon { width: 18px; height: 18px; flex-shrink: 0; }
.sb-link span { flex: 1; }
.sb-chevron { width: 14px; height: 14px; flex-shrink: 0; transition: transform .15s ease; }
.sb-group[open] > .sb-link .sb-chevron { transform: rotate(180deg); }
.sb-group-children { display: flex; flex-direction: column; padding: 2px 0 4px 34px; }
.sb-sublink {
  padding: 7px 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.sb-sublink:hover { background: var(--surface-alt); color: var(--sidebar-text-hover); }
.sb-sublink.active { color: var(--accent); font-weight: 600; }

.sb-current-project {
  margin: 10px 14px 16px;
  padding: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  display: block;
}
.sb-cp-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin-bottom: 8px; }
.sb-cp-thumb {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; margin-bottom: 8px;
}
.sb-cp-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-cp-progress { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.sb-cp-progress div { height: 100%; background: var(--accent); border-radius: 3px; }
.sb-cp-pct { font-size: 11.5px; color: var(--text-muted); }

/* ---------- Main / topbar ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tb {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.tb-search { flex: 1; max-width: 460px; position: relative; display: flex; align-items: center; }
.tb-search-icon { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--text-faint); pointer-events: none; }
.tb-search input {
  width: 100%;
  padding: 9px 40px 9px 36px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 999px;
  font-size: 13.5px;
}
.tb-search input:focus { background: var(--surface); }
.tb-search kbd {
  position: absolute; right: 10px; font-size: 11px; color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; background: var(--surface-alt);
}
.tb-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.tb-new { position: relative; }
.tb-new-btn { display: inline-flex; align-items: center; gap: 6px; }
.tb-new-btn svg { width: 15px; height: 15px; }
.tb-new-menu {
  display: none;
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); min-width: 190px; padding: 6px; z-index: 20;
}
.tb-new-menu.open { display: block; }
.tb-new-menu a { display: block; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: 13.5px; }
.tb-new-menu a:hover { background: var(--surface-alt); }
.tb-icon-btn {
  position: relative; width: 36px; height: 36px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); text-decoration: none;
}
.tb-icon-btn:hover { background: var(--surface-alt); color: var(--text); }
.tb-icon-btn svg { width: 19px; height: 19px; }
.tb-badge {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px; padding: 0 3px;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.tb-user { display: flex; align-items: center; gap: 10px; padding-left: 10px; border-left: 1px solid var(--border); }
.tb-avatar {
  width: 34px; height: 34px; border-radius: 999px; background: var(--accent-light); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.tb-user-text { line-height: 1.25; }
.tb-user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.tb-user-role { font-size: 11.5px; color: var(--text-muted); }
.tb-logout { color: var(--text-faint); display: flex; }
.tb-logout:hover { color: var(--danger); }
.tb-logout svg { width: 16px; height: 16px; }

.content { padding: 28px 32px; max-width: 1400px; width: 100%; margin: 0 auto; }

h1 { font-size: 21px; font-weight: 650; margin: 0 0 18px; letter-spacing: -.01em; }
h2 { font-size: 15.5px; font-weight: 600; margin: 0 0 14px; letter-spacing: -.005em; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 10px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.toolbar .search { flex: 1; max-width: 320px; }

/* ---------- Tables ---------- */
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); }
table.grid th, table.grid td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
table.grid th {
  background: var(--surface-alt);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
table.grid tbody tr { transition: background-color .1s ease; }
table.grid tr:hover td { background: var(--surface-alt); }
table.grid tr:last-child td { border-bottom: none; }
.card table.grid { border-radius: inherit; }
.card[style*="padding:0"] table.grid th:first-child,
.card[style*="padding: 0"] table.grid th:first-child { border-top-left-radius: var(--radius-lg); }
.card[style*="padding:0"] table.grid th:last-child,
.card[style*="padding: 0"] table.grid th:last-child { border-top-right-radius: var(--radius-lg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, transform .05s ease;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-alt); border-color: #94a3b8; }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn.small { padding: 5px 11px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.editor-toolbar { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Forms ---------- */
form.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 20px;
}
form.form-grid .full { grid-column: 1 / -1; }
label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 13px; color: #334155; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local],
input[type=number], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
input:disabled, select:disabled, textarea:disabled { background: var(--surface-alt); color: var(--text-faint); cursor: not-allowed; }
textarea { resize: vertical; }

/* ---------- Material-Picker (Hintergrundsuche statt Dropdown) ---------- */
.material-picker { position: relative; }
.material-picker-results {
  display: none;
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); max-height: 280px; overflow-y: auto;
}
.material-picker-results.open { display: block; }
.material-picker-item { padding: 8px 11px; cursor: pointer; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.material-picker-item:last-child { border-bottom: none; }
.material-picker-item:hover, .material-picker-item.active { background: var(--surface-alt); }
.material-picker-item .mp-name { color: var(--text); }
.material-picker-item .mp-meta { color: var(--text-muted); font-size: 11.5px; margin-left: 8px; }
.material-picker-empty { padding: 8px 11px; color: var(--text-faint); font-size: 13px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
}
.badge.status-angelegt, .badge.status-entwurf { background: #e2e8f0; color: #334155; }
.badge.status-kalkulation, .badge.status-angebot { background: #fef3c7; color: #92400e; }
.badge.status-beauftragt, .badge.status-in_ausfuehrung { background: #dbeafe; color: #1e40af; }
.badge.status-abgeschlossen { background: #dcfce7; color: #166534; }
.badge.status-storniert { background: #fee2e2; color: #991b1b; }
.badge.status-bestaetigt { background: #dbeafe; color: #1e40af; }
.badge.status-teilweise_geliefert { background: #fef3c7; color: #92400e; }
.badge.status-versendet { background: #dbeafe; color: #1e40af; }
.badge.status-angenommen { background: #dcfce7; color: #166534; }
.badge.status-abgelehnt { background: #fee2e2; color: #991b1b; }
.badge.status-abgelaufen { background: #e2e8f0; color: #334155; }
.badge.status-festgeschrieben { background: #dbeafe; color: #1e40af; }
.badge.status-bezahlt { background: #dcfce7; color: #166534; }
.badge.type-rechnung { background: #e2e8f0; color: #334155; }
.badge.type-storno { background: #fee2e2; color: #991b1b; }
.badge.type-korrektur { background: #fef3c7; color: #92400e; }
.badge.source-freies_angebot { background: #e2e8f0; color: #334155; }
.badge.source-gaeb_import { background: #dbeafe; color: #1e40af; }
.badge.source-pdf_import { background: #fee2e2; color: #991b1b; }
.badge.kind-abschlag { background: #fef3c7; color: #92400e; }
.badge.kind-schluss { background: #dcfce7; color: #166534; }
.badge.kind-regie { background: #dbeafe; color: #1e40af; }
.badge.kind-reverse-charge { background: #ede9fe; color: #5b21b6; }

.badge.doctype-pdf { background: #e2e8f0; color: #334155; }
.badge.doctype-zugferd { background: #ede9fe; color: #5b21b6; }
.badge.doctype-xrechnung { background: #ede9fe; color: #5b21b6; }
.badge.doctype-gaeb { background: #dbeafe; color: #1e40af; }
.badge.doctype-lieferschein { background: #fef3c7; color: #92400e; }
.badge.doctype-sonstige { background: #e2e8f0; color: #334155; }

.badge.invstatus-neu { background: #e2e8f0; color: #334155; }
.badge.invstatus-klassifiziert { background: #fef3c7; color: #92400e; }
.badge.invstatus-zugeordnet { background: #fef3c7; color: #92400e; }
.badge.invstatus-geprueft { background: #dbeafe; color: #1e40af; }
.badge.invstatus-freigegeben { background: #dcfce7; color: #166534; }
.badge.invstatus-abgelehnt { background: #fee2e2; color: #991b1b; }
.badge.invstatus-archiviert { background: #dbeafe; color: #1e40af; }

.badge.warn { background: #fef3c7; color: #92400e; }
.badge.ok { background: #dcfce7; color: #166534; }

.badge.tstatus-laufend { background: #dbeafe; color: #1e40af; }
.badge.tstatus-abgeschlossen { background: #fef3c7; color: #92400e; }
.badge.tstatus-genehmigt { background: #dcfce7; color: #166534; }
.badge.tstatus-abgelehnt { background: #fee2e2; color: #991b1b; }
.badge.tstatus-abgerechnet { background: #ede9fe; color: #5b21b6; }

/* ---------- Alerts ---------- */
.alert {
  padding: 11px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.alert.error { background: #fef2f2; color: #991b1b; border-left-color: var(--danger); }
.alert.success { background: #f0fdf4; color: #166534; border-left-color: var(--success); }
.alert.info { background: var(--accent-light); color: var(--accent-dark); border-left-color: var(--accent); }
.alert.warn { background: #fef3c7; color: #92400e; border-left-color: var(--warn); }

/* ---------- Handbuch (Hilfe) ---------- */
.help-shell { display: flex; gap: 24px; align-items: flex-start; }
.help-nav { width: 232px; flex-shrink: 0; position: sticky; top: 84px; }
.help-nav-group { margin-bottom: 14px; }
.help-nav-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); padding: 0 10px 6px; }
.help-nav a {
  display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-muted); font-size: 13px; cursor: pointer;
}
.help-nav a:hover { background: var(--surface-alt); color: var(--text); }
.help-nav a.active { background: var(--accent-light); color: var(--accent-dark); font-weight: 600; }
.help-nav a .help-num { font-family: ui-monospace, "SF Mono", "Roboto Mono", monospace; font-size: 11px; color: var(--text-faint); min-width: 16px; flex-shrink: 0; }
.help-nav a.active .help-num { color: var(--accent); }

.help-content { flex: 1; min-width: 0; }
.help-chapter { display: none; }
.help-chapter.active { display: block; }
.help-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--accent-dark); margin-bottom: 6px; }
.help-chapter h2.help-title { font-size: 22px; margin: 0 0 6px; }
.help-dek { color: var(--text-muted); margin: 0 0 22px; max-width: 62ch; }
.help-chapter h3 { margin-top: 26px; }
.help-chapter h4 { font-size: 13px; font-weight: 700; margin: 16px 0 6px; }
.help-chapter p, .help-chapter ul, .help-chapter ol { max-width: 66ch; }

.help-path {
  display: inline-flex; align-items: center; gap: 6px; font-family: ui-monospace, "SF Mono", "Roboto Mono", monospace;
  font-size: 12px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 3px 9px; color: var(--text-muted); margin-bottom: 14px;
}
.help-path b { color: var(--text); font-weight: 600; }
.help-field, .help-btn-ref {
  font-family: ui-monospace, "SF Mono", "Roboto Mono", monospace; font-size: 12.5px; padding: 1px 6px;
  border-radius: var(--radius-sm); white-space: nowrap;
}
.help-field { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }
.help-btn-ref { background: var(--accent-light); color: var(--accent-dark); }

.help-flow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 6px 0 20px; font-family: ui-monospace, "SF Mono", "Roboto Mono", monospace; font-size: 12.5px; }
.help-flow span.help-step { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 10px; }
.help-flow span.help-step.now { background: var(--accent); border-color: var(--accent); color: #fff; }
.help-flow span.help-arrow { color: var(--text-faint); }

table.help-ref { width: 100%; border-collapse: collapse; margin: 8px 0 20px; font-size: 13.5px; }
table.help-ref th, table.help-ref td { text-align: left; padding: 7px 12px 7px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
table.help-ref th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 600; }
table.help-ref td:first-child { font-family: ui-monospace, "SF Mono", "Roboto Mono", monospace; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

.help-chapter-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border); }
.help-chapter-nav a { text-decoration: none; font-size: 13px; color: var(--text-muted); max-width: 46%; }
.help-chapter-nav a:hover { color: var(--accent); }
.help-chapter-nav .help-lbl { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-bottom: 2px; }
.help-chapter-nav .help-next { text-align: right; margin-left: auto; }

@media (max-width: 860px) {
  .help-shell { flex-direction: column; }
  .help-nav { width: 100%; position: static; }
}

/* ---------- Login ---------- */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 15%, rgba(99, 102, 241, 0.25), transparent 40%),
    radial-gradient(circle at 80% 85%, rgba(79, 70, 229, 0.2), transparent 45%),
    var(--dark-bg);
}
.login-box {
  background: var(--surface);
  padding: 36px 34px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 360px;
}
.login-box h1 { text-align: center; }
.login-box .btn { margin-top: 4px; }

.muted { color: var(--text-muted); font-size: 12.5px; }
.report-icon { width: 20px; height: 20px; }

/* ---------- Dashboard ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-card { margin-bottom: 0; }
.kpi-icon {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent-light); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.kpi-label { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.dash-main, .dash-side { min-width: 0; }

.progress-row { display: flex; align-items: center; gap: 12px; }
.progress-track { flex: 1; height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; }

.activity-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); margin-top: 6px; flex-shrink: 0; }

.widget-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: 13.5px;
}
.widget-row:last-of-type { border-bottom: none; }
.widget-row:hover { color: var(--accent); }

@media (max-width: 960px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

/* ---------- Status tabs ---------- */
.status-tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.status-tab {
  display: flex; align-items: center; gap: 6px; padding: 9px 14px; font-size: 13.5px; font-weight: 500;
  color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap;
}
.status-tab:hover { color: var(--text); }
.status-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.status-tab span { background: var(--surface-alt); color: var(--text-muted); border-radius: 999px; padding: 1px 7px; font-size: 11.5px; font-weight: 600; }
.status-tab.active span { background: var(--accent-light); color: var(--accent-dark); }

/* ---------- Form tabs ---------- */
.form-tabs { display: flex; gap: 2px; padding: 10px 14px 0; border-bottom: 1px solid var(--border); }
.form-tab {
  background: none; border: none; padding: 9px 14px; font-size: 13.5px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent; font-family: inherit;
}
.form-tab:hover { color: var(--text); }
.form-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- Gantt (Personaleinsatzplanung) ---------- */
.gantt-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; }
.gantt-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); }
.gantt-legend-dot { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; }

.gantt-wrap { padding: 0; overflow-x: auto; }
.gantt { display: grid; position: relative; width: max-content; }
.gantt-corner {
  position: sticky; left: 0; z-index: 3; background: var(--surface-alt);
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 14px; font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
}
.gantt-daycell {
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-muted);
  background: var(--surface-alt); border-bottom: 1px solid var(--border); border-left: 1px solid var(--border);
}
.gantt-daycell.weekend { background: #eef1f6; }
.gantt-daycell.today { background: var(--accent-light); color: var(--accent-dark); font-weight: 700; }
.gantt-section {
  display: flex; align-items: center; padding: 0 14px; background: var(--surface-alt);
  border-bottom: 1px solid var(--border); border-top: 1px solid var(--border);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
}
.gantt-label {
  position: sticky; left: 0; z-index: 2; background: var(--surface);
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: center; padding: 4px 14px; font-size: 13px; font-weight: 500;
}
.gantt-bar {
  align-self: center; height: 22px; margin: 0 2px; border-radius: 5px; color: #fff; font-size: 10.5px; font-weight: 600;
  display: flex; align-items: center; padding: 0 6px; overflow: hidden; white-space: nowrap; text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.gantt-bar:hover { filter: brightness(0.9); }
.gantt-bar-draggable { cursor: grab; touch-action: none; }
.gantt-bar-draggable:active { cursor: grabbing; }
.gantt-deps { pointer-events: none; align-self: start; justify-self: start; }
