/* CleanPlan Pro – Designsystem */
:root {
  --navy-900: #071a33;
  --navy-800: #0b2545;
  --navy-700: #13315c;
  --navy-600: #1d4477;
  --navy-100: #e6edf6;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-50: #e6f7f5;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-50: #eaf8ef;
  --amber-600: #b45309;
  --amber-50: #fdf4e4;
  --red-600: #c2410c;
  --red-50: #fdeee6;
  --ink: #0f1f33;
  --ink-2: #44546a;
  --ink-3: #7a889b;
  --line: #e3e8ef;
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(11, 37, 69, .06), 0 4px 16px rgba(11, 37, 69, .05);
  --sidebar-w: 256px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg-soft); }
a { color: var(--navy-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--navy-800); }
h3 { font-size: 15px; font-weight: 650; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.block { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.prewrap { white-space: pre-wrap; margin: 0; }
.icon { width: 20px; height: 20px; flex: none; }
code { font-size: 11px; color: var(--ink-3); }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--navy-800); color: #cfdbea;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 20px 14px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 4px 8px 16px; }
.brand:hover { text-decoration: none; }
.brand-mark svg { width: 32px; height: 32px; display: block; }
.brand-name { font-size: 18px; letter-spacing: -.01em; }
.brand-name strong { color: var(--teal-500); font-weight: 700; }
.company-chip {
  margin: 0 8px 14px; padding: 8px 10px; border-radius: var(--radius-sm); background: rgba(255,255,255,.06);
  font-size: 13px; color: #e9f0f8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: #c4d2e3; font-size: 14px; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.active { background: var(--navy-600); color: #fff; box-shadow: inset 3px 0 0 var(--teal-500); }
.nav a.active .icon { color: var(--teal-500); }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 4px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--teal-600); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 650; flex: none; }
.me-text { display: grid; min-width: 0; }
.me-text strong { color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: #9fb2c8; font-size: 12px; }
.btn-ghost-light { background: none; border: 0; color: #9fb2c8; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; }
.btn-ghost-light:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 14px 28px; min-height: 64px;
}
.page-title { font-size: 20px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); background: var(--bg-soft); padding: 6px 10px; border-radius: 999px; }
.today-chip .icon { width: 16px; height: 16px; }
.menu-btn { display: none; cursor: pointer; padding: 6px; margin-left: -6px; border-radius: var(--radius-sm); color: var(--navy-800); }
.content { padding: 24px 28px 48px; max-width: 1440px; width: 100%; }
.nav-toggle { display: none; }
.backdrop { display: none; }

/* ---------- Bausteine ---------- */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 20px; min-width: 0; }
.card-tight { padding: 16px; margin: 0; display: grid; gap: 8px; align-content: start; }
.card-tight h3 { font-size: 15px; }
.card-narrow { max-width: 720px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.count { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--navy-100); color: var(--navy-700); font-size: 12px; text-align: center; margin-left: 6px; }
.link { font-size: 13px; font-weight: 600; color: var(--teal-600); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 > .card { margin: 0; }
.grid-2-wide { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.empty { color: var(--ink-3); margin: 8px 0; }
.spacer { flex: 1; }

.greeting { margin-bottom: 18px; }
.greeting h2 { font-size: 22px; }
.greeting p { margin: 4px 0 0; }

/* KPI-Karten */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; transition: transform .12s, box-shadow .12s; }
a.kpi:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(11,37,69,.09); }
.kpi-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.kpi-body { display: grid; min-width: 0; }
.kpi-value { font-size: 24px; font-weight: 700; color: var(--navy-800); line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 13px; color: var(--ink-2); }
.kpi-navy .kpi-icon { background: var(--navy-100); color: var(--navy-700); }
.kpi-teal .kpi-icon { background: var(--teal-50); color: var(--teal-600); }
.kpi-green .kpi-icon { background: var(--green-50); color: var(--green-600); }
.kpi-warn .kpi-icon { background: var(--amber-50); color: var(--amber-600); }

/* Wochenbalken */
.weekbars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; height: 200px; align-items: end; }
.wb { display: grid; grid-template-rows: 1fr auto auto; height: 100%; text-align: center; gap: 4px; }
.wb-track { display: flex; align-items: flex-end; justify-content: center; }
.wb-total { width: 100%; max-width: 40px; background: var(--navy-100); border-radius: 6px 6px 2px 2px; display: flex; align-items: flex-end; min-height: 4px; overflow: hidden; }
.wb-done { width: 100%; background: var(--teal-500); }
.wb-num { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.wb-day { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.wb.is-today .wb-day { color: var(--teal-600); }
.wb.is-today .wb-total { box-shadow: 0 0 0 2px var(--teal-500); }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); margin-top: 12px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-done { background: var(--teal-500); }
.lg-total { background: var(--navy-100); margin-left: 10px; }

/* Horizontale Balken (Berichte) */
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: 90px 1fr 56px; gap: 10px; align-items: center; font-size: 13px; }
.hbar-label { color: var(--ink-2); }
.hbar-track { background: var(--bg-soft); border-radius: 4px; height: 14px; }
.hbar-total { display: block; height: 100%; background: var(--navy-100); border-radius: 4px; overflow: hidden; }
.hbar-done { display: block; height: 100%; background: var(--teal-500); }
.hbar-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row > div { display: grid; min-width: 0; }
.list-row small { font-size: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 8px 0; font-size: 14px; }
.timeline .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal-500); margin-top: 7px; flex: none; }
.timeline small { display: block; font-size: 12px; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.quick-btn { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; hyphens: auto; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--navy-800); font-weight: 600; font-size: 14px; background: var(--bg); }
.quick-btn:hover { border-color: var(--teal-500); background: var(--teal-50); text-decoration: none; }
.quick-btn .icon { color: var(--teal-600); }
.quick-btn.is-disabled { color: var(--ink-3); background: var(--bg-soft); justify-content: center; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 5px 10px; border-radius: 999px; background: var(--navy-100); color: var(--navy-700); font-size: 13px; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; }
.callout { display: flex; gap: 10px; margin-top: 14px; padding: 12px; border-radius: var(--radius-sm); background: var(--amber-50); color: var(--amber-600); font-size: 14px; }

/* Badges & Tags */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--navy-100); color: var(--navy-700); }
.badge-done, .badge-tr-completed, .badge-sub-confirmed { background: var(--green-50); color: var(--green-600); }
.badge-in_progress, .badge-tr-in_progress, .badge-sub-proposed { background: var(--teal-50); color: var(--teal-600); }
.badge-planned, .badge-tr-assigned { background: var(--navy-100); color: var(--navy-700); }
.badge-late, .badge-sev-high, .badge-absent-sick { background: var(--red-50); color: var(--red-600); }
.badge-open, .badge-needs_review, .badge-sev-medium, .badge-sub-open, .badge-absent-vacation, .badge-absent-other { background: var(--amber-50); color: var(--amber-600); }
.badge-sev-low, .badge-sub-cancelled { background: var(--bg-soft); color: var(--ink-3); }
.badge-special, .badge-floater { background: #efeafd; color: #5b3fc4; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; background: var(--bg-soft); color: var(--ink-2); border: 1px solid var(--line); justify-self: start; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.score.good { color: var(--green-600); } .score.mid { color: var(--amber-600); } .score.bad { color: var(--red-600); }
.progress { display: inline-block; width: 70px; height: 6px; background: var(--bg-soft); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.progress > span { display: block; height: 100%; background: var(--teal-500); }
.progress-lg { width: 100%; height: 8px; margin: 4px 0 0; }

/* Tabellen */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #fafbfd; }
.table tr.is-inactive { opacity: .55; }
.table-compact td { padding: 7px 8px; }
.matrix td.c { text-align: center; color: var(--teal-600); font-weight: 700; }
.matrix th:not(:first-child) { text-align: center; }

/* Wochenplan */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.seg { display: inline-flex; gap: 4px; }
.seg-views { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; }
.seg-item { padding: 5px 12px; border-radius: 6px; font-size: 13px; color: var(--ink-3); }
.seg-item.active { background: var(--navy-800); color: #fff; }
.weekgrid { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.daycol { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; align-content: start; min-height: 220px; }
.daycol header { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; color: var(--navy-800); padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.daycol header small { color: var(--ink-3); font-weight: 500; }
.daycol.is-today { border-color: var(--teal-500); box-shadow: 0 0 0 1px var(--teal-500); }
.order { border-radius: var(--radius-sm); padding: 9px 10px; background: var(--bg-soft); border-left: 3px solid var(--navy-600); font-size: 13px; display: grid; gap: 2px; }
.order-done { border-left-color: var(--green-500); }
.order-in_progress { border-left-color: var(--teal-500); }
.order-late { border-left-color: var(--red-600); }
.order-open, .order-needs_review { border-left-color: var(--amber-600); }
.order-time { font-weight: 700; color: var(--navy-800); font-variant-numeric: tabular-nums; }
.order-title { font-weight: 600; }
.order-obj, .order-staff { color: var(--ink-2); font-size: 12px; }
.order-foot { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }

/* Hinweis Phase */
.phase-note { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--teal-50); color: var(--teal-600); font-size: 13px; margin-bottom: 16px; border: 1px solid #c7ece7; }
.phase-note .icon { width: 18px; height: 18px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-2); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--navy-800); }
.tabs a.active { color: var(--navy-800); border-bottom-color: var(--teal-500); }

/* Formulare & Buttons */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--ink); padding: 10px 12px; border: 1px solid #cfd8e3; border-radius: var(--radius-sm); background: #fff; width: 100%; min-height: 42px;
}
input[readonly] { background: var(--bg-soft); color: var(--ink-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(20,184,166,.18); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; flex: none; accent-color: var(--teal-600); }
.hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 14px; padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; min-height: 42px; }
.btn:hover { text-decoration: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-light { background: #fff; color: var(--navy-800); border-color: var(--line); }
.btn-light:hover { border-color: var(--teal-500); }
.btn-sm { padding: 6px 10px; min-height: 34px; font-size: 13px; }
.btn-block { width: 100%; }
.inline-form { display: inline-flex; gap: 6px; margin: 0; }
.inline-form select { min-height: 34px; padding: 5px 8px; font-size: 13px; width: auto; }
.copy-field { margin-top: 8px; font-size: 13px; cursor: copy; }

.flash { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.flash-ok { background: var(--green-50); color: #14532d; border: 1px solid #bfe8cd; }
.flash-err { background: var(--red-50); color: #7c2d12; border: 1px solid #f5cdb8; }

.empty-state { text-align: center; padding: 60px 20px; }
.empty-code { font-size: 56px; font-weight: 800; color: var(--navy-100); }

/* ---------- Anmeldung ---------- */
.auth-body { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: linear-gradient(160deg, var(--navy-800) 0%, var(--navy-900) 70%); color: #d6e2f0; padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 28px; position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border-radius: 50%; background: radial-gradient(circle, rgba(20,184,166,.35), transparent 70%); }
.auth-hero h2 { color: #fff; font-size: 32px; max-width: 460px; letter-spacing: -.02em; }
.brand-lg .brand-name { font-size: 22px; }
.brand-lg .brand-mark svg { width: 40px; height: 40px; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; max-width: 440px; }
.hero-points li { padding-left: 30px; position: relative; }
.hero-points li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--green-500); color: #fff; font-size: 12px; display: grid; place-items: center; }
.auth-card { padding: 56px; display: flex; flex-direction: column; justify-content: center; max-width: 520px; width: 100%; margin: 0 auto; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card > p { margin: 0 0 22px; }
.auth-card > .auth-alt { margin: 14px 0 0; font-size: 14px; color: var(--ink-2); }
.auth-card > .auth-alt + .auth-alt { margin-top: 10px; }

/* ---------- Responsiv ---------- */
@media (max-width: 1100px) {
  .grid-2, .grid-2-wide { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s ease; }
  .nav-toggle:checked ~ .shell .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .nav-toggle:checked ~ .shell .backdrop { display: block; position: fixed; inset: 0; background: rgba(7,26,51,.45); z-index: 20; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 40px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 24px; gap: 14px; }
  .auth-hero h2 { font-size: 22px; }
  .hero-points { display: none; }
  .auth-card { padding: 28px 24px 40px; }
}
@media (max-width: 640px) {
  .today-chip { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi-icon { width: 34px; height: 34px; }
  .kpi-value { font-size: 20px; }
  .row-2 { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .weekgrid { grid-template-columns: 1fr; }
  .daycol { min-height: 0; }
  .weekbars { gap: 4px; height: 160px; }
  /* Tabellen werden auf dem Smartphone zu Karten */
  .table:not(.table-compact):not(.matrix) thead { display: none; }
  .table:not(.table-compact):not(.matrix) tr { display: grid; padding: 10px 0; border-bottom: 1px solid var(--line); }
  /* Beschriftung links fest, Inhalt rechts als normaler Textfluss (bricht um statt abgeschnitten zu werden) */
  .table:not(.table-compact):not(.matrix) td { border: 0; padding: 3px 4px; display: flow-root; min-width: 0; overflow-wrap: break-word; }
  .table:not(.table-compact):not(.matrix) td[data-label] { padding-left: 124px; }
  /* Kopfzeile einer Karte mit Filtern: Filter rutschen unter den Titel statt über den Rand */
  .card-head { flex-wrap: wrap; }
  .card-head > .filters { flex: 1 1 100%; }
  .card-head > .filters select, .card-head > .filters input[type=search] { max-width: 100%; }
  .table:not(.table-compact):not(.matrix) td[data-label]::before { content: attr(data-label); float: left; margin: 2px 0 0 -120px; width: 110px; color: var(--ink-3); font-size: 12px; line-height: 1.3; }
  .hbar { grid-template-columns: 76px 1fr 44px; }
}

/* ======================= Phase 2 ======================= */
.mt { margin-top: 12px; } .mt-lg { margin-top: 24px; } .mb { margin-bottom: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form-sections { gap: 0; }
.form-sections > .card { margin-bottom: 16px; }
.form-sections > .card .card-head { margin-bottom: 6px; }
.form-sections > .card { display: grid; gap: 14px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0; display: grid; gap: 12px; min-width: 0; }
.fieldset legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 6px; }
textarea { resize: vertical; line-height: 1.45; }
.btn-success { background: var(--green-600); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger-ghost { background: none; border: 1px solid #f1c4ad; color: var(--red-600); }
.btn-danger-ghost:hover { background: var(--red-50); }
.btn-icon { background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: 14px; padding: 6px 8px; border-radius: 6px; }
.btn-icon:hover { background: var(--red-50); color: var(--red-600); }
.btn-reset { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.card-link { color: inherit; transition: border-color .12s, transform .12s; }
.card-link:hover { text-decoration: none; border-color: var(--teal-500); transform: translateY(-1px); }

/* Filterleiste */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters input[type=search], .filters select { width: auto; min-width: 160px; min-height: 38px; padding: 7px 10px; font-size: 14px; }
.filters .check { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); }
.filters-bar { margin-bottom: 14px; }
.range-label { font-size: 15px; color: var(--navy-800); }
.seg-views a.seg-item { color: var(--ink-2); text-decoration: none; }
.seg-views a.seg-item:hover { background: var(--bg-soft); }
.seg-views a.seg-item.active { color: #fff; background: var(--navy-800); }

/* Auswahl-Kacheln */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.pick { display: flex !important; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-weight: 500 !important; color: var(--ink) !important; font-size: 14px !important; background: #fff; }
.pick:hover { border-color: #b9c6d6; }
.pick.is-on { border-color: var(--teal-500); background: var(--teal-50); }
.pick-name { flex: 1; min-width: 0; }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-card { display: flex !important; gap: 10px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--teal-500); background: var(--teal-50); box-shadow: 0 0 0 1px var(--teal-500); }
.radio-card input { width: 18px; height: 18px; min-height: 0; margin-top: 2px; accent-color: var(--teal-600); }
.radio-card span { display: grid; gap: 2px; }
.radio-card strong { color: var(--navy-800); font-size: 15px; }
.radio-card small { color: var(--ink-3); font-weight: 400; }
.weekday-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.wd { display: block !important; }
.wd input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wd span { display: inline-grid; place-items: center; min-width: 48px; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; color: var(--ink-2); cursor: pointer; background: #fff; }
.wd input:checked + span { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.wd input:focus-visible + span { box-shadow: 0 0 0 3px rgba(20,184,166,.3); }
[hidden] { display: none !important; }

/* Kalender */
a.order { color: inherit; text-decoration: none; transition: box-shadow .12s; }
a.order:hover { box-shadow: 0 2px 10px rgba(11,37,69,.12); }
.order.has-conflict { background: #fff7f2; }
.order-staff .is-absent { color: var(--red-600); text-decoration: line-through; }
.daycol header a { color: var(--navy-800); }
.daylist { display: grid; gap: 10px; }
.daylist .order { grid-template-columns: 110px 1fr; column-gap: 16px; padding: 12px 14px; font-size: 14px; }
.daylist .order-time { grid-row: span 4; font-size: 15px; }
.callout-wide { margin: 0 0 16px; }
.monthgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.mg-head { font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; padding: 4px 6px; }
.mg-day { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); min-height: 118px; padding: 8px; display: flex; flex-direction: column; gap: 3px; color: inherit; overflow: hidden; }
.mg-day:hover { text-decoration: none; border-color: var(--teal-500); }
.mg-day.is-out { background: var(--bg-soft); opacity: .6; }
.mg-day.is-today { border-color: var(--teal-500); box-shadow: 0 0 0 1px var(--teal-500); }
.mg-num { font-weight: 700; color: var(--navy-800); font-size: 14px; }
.mg-warn { color: var(--red-600); }
.mg-count { font-size: 12px; color: var(--ink-2); }
.mg-bar { height: 4px; background: var(--navy-100); border-radius: 2px; overflow: hidden; margin-bottom: 2px; }
.mg-bar span { display: block; height: 100%; background: var(--teal-500); }
.mg-item { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); border-left: 2px solid var(--navy-600); padding-left: 4px; }
.mg-item.mg-done { border-color: var(--green-500); } .mg-item.mg-late { border-color: var(--red-600); } .mg-item.mg-in_progress { border-color: var(--teal-500); }
.mg-more { font-size: 11px; color: var(--ink-3); }

/* Auftragsdetail */
.order-hero { display: flex; gap: 20px; justify-content: space-between; flex-wrap: wrap; }
.order-hero-main { display: grid; gap: 8px; min-width: 0; }
.order-hero h2 { font-size: 22px; }
.order-hero p { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.order-hero .icon { color: var(--teal-600); width: 18px; height: 18px; }
.order-actions { display: grid; gap: 8px; align-content: start; min-width: 220px; }
.order-actions form { margin: 0; }
.order-actions select { min-height: 38px; font-size: 14px; }
.change { display: block; font-size: 12px; color: var(--ink-2); }
.change del { color: var(--ink-3); }
.row-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Profil */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head h2 { font-size: 22px; }
.profile-head p { margin: 2px 0 8px; }
.profile-head > div:nth-child(2) { flex: 1; min-width: 220px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.profile-stats { display: flex; gap: 22px; }
.profile-stats div { display: grid; text-align: center; }
.profile-stats strong { font-size: 22px; color: var(--navy-800); }
.profile-stats small { font-size: 12px; color: var(--ink-3); }

/* Dokumente */
.doclist { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.doc { display: flex; align-items: center; gap: 12px; }
.doc-thumb { width: 48px; height: 48px; border-radius: 8px; background: var(--navy-100); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--navy-700); font-size: 11px; font-weight: 700; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-meta { display: grid; min-width: 0; flex: 1; }
.doc-meta a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 12px; border-top: 1px dashed var(--line); }
.upload-form input[type=file] { width: auto; flex: 1; min-width: 200px; padding: 7px; font-size: 13px; }
.upload-form .check { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-2); }
.upload-form .hint { flex-basis: 100%; }

/* Checklisten-Editor */
.item-editor { display: grid; gap: 6px; }
.ie-head, .ie-row { display: grid; grid-template-columns: 64px 1fr 44px 56px; gap: 8px; align-items: center; }
.ie-head { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; }
.ie-head span:nth-child(n+3) { text-align: center; }
.ie-pos { text-align: center; padding: 8px 4px; }
.ie-check { display: grid !important; place-items: center; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }

/* Ausführung */
.run-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.run-head h2 { font-size: 20px; margin: 6px 0 2px; }
.run-head p { margin: 0; }
.run-progress { display: grid; gap: 6px; min-width: 180px; text-align: right; }
.run-count { font-size: 26px; font-weight: 800; color: var(--navy-800); font-variant-numeric: tabular-nums; }
.run-items { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; }
.run-item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.run-item.is-done { border-color: #bfe8cd; background: #fbfefc; }
.run-item.has-error { border-color: var(--red-600); box-shadow: 0 0 0 1px var(--red-600); }
.run-check { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; }
.run-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.run-box { width: 30px; height: 30px; flex: none; border: 2px solid #b9c6d6; border-radius: 8px; display: grid; place-items: center; background: #fff; transition: all .12s; }
.run-check input:checked + .run-box { background: var(--green-600); border-color: var(--green-600); }
.run-check input:checked + .run-box::after { content: "✓"; color: #fff; font-weight: 800; font-size: 18px; }
.run-check input:focus-visible + .run-box { box-shadow: 0 0 0 3px rgba(20,184,166,.35); }
.run-check input:disabled + .run-box { opacity: .7; }
.run-text { font-size: 16px; font-weight: 500; line-height: 1.4; padding-top: 3px; }
.run-item.is-done .run-text { color: var(--ink-2); }
.run-remark { min-height: 38px; font-size: 14px; padding: 7px 10px; }
.run-remark-text { margin: 0; font-size: 14px; color: var(--ink-2); font-style: italic; }
.run-photos { display: flex; gap: 8px; flex-wrap: wrap; }
.run-photos img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.run-photo-form { margin: 0; }
.run-photo-form label.btn { cursor: pointer; }
.is-busy { opacity: .6; pointer-events: none; }
.sig { display: grid; gap: 6px; }
.sig .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.sig-pad { width: 100%; max-width: 600px; height: 160px; border: 1px dashed #b9c6d6; border-radius: var(--radius-sm); background: #fcfdff; touch-action: none; cursor: crosshair; }
.signature-img { display: block; max-width: 280px; margin-top: 8px; background: #fff; border-radius: 6px; }

@media (max-width: 900px) {
  .order-actions { min-width: 0; width: 100%; }
}
@media (max-width: 640px) {
  .row-3, .radio-cards { grid-template-columns: 1fr; }
  .filters input[type=search], .filters select { min-width: 0; flex: 1 1 140px; }
  .toolbar .btn { flex: 1 1 auto; }
  .monthgrid { gap: 3px; }
  .mg-day { min-height: 64px; padding: 5px; }
  .mg-item, .mg-count { display: none; }
  .mg-head { font-size: 10px; padding: 2px; text-align: center; }
  .daylist .order { grid-template-columns: 1fr; }
  .daylist .order-time { grid-row: auto; }
  .profile-stats { width: 100%; justify-content: space-around; }
  .ie-head, .ie-row { grid-template-columns: 48px 1fr 36px 40px; gap: 6px; }
  .run-item { padding: 12px; }
  .run-text { font-size: 15px; }
}
/* Wochenspalten: lange Wörter umbrechen statt abschneiden */
.daycol { min-width: 0; }
.daycol header { flex-wrap: wrap; gap: 0 6px; }
.daycol header small { font-size: 11px; }
.weekgrid .order { overflow-wrap: anywhere; hyphens: auto; min-width: 0; }
.weekgrid .badge { hyphens: manual; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 1101px) { .weekgrid { grid-template-columns: repeat(7, minmax(0, 1fr)); } }

/* ======================= Phase 3 ======================= */
.text-warn { color: var(--red-600) !important; }
.list-row-wrap { flex-wrap: wrap; }
.decline-form input { width: auto; min-width: 140px; min-height: 34px; padding: 5px 8px; font-size: 13px; }
.btn-block-sm { min-width: 220px; }
.legend-wrap { flex-wrap: wrap; gap: 6px 10px; margin: 0 0 14px; }
.picker-1 { grid-template-columns: 1fr; max-height: 260px; overflow-y: auto; padding-right: 4px; }
.has-file { border-color: var(--green-600) !important; color: var(--green-600) !important; }
.has-file::after { content: " ✓"; }
.badge-def-open { background: var(--amber-50); color: var(--amber-600); }
.badge-def-rework { background: var(--teal-50); color: var(--teal-600); }
.badge-def-resolved { background: var(--green-50); color: var(--green-600); }

/* Schulungen */
.learn-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.learn-card { display: grid; gap: 8px; margin: 0; }
.learn-card.is-done { opacity: .75; }
.learn-cta { font-weight: 700; color: var(--teal-600); font-size: 14px; }
.learn-head { display: grid; gap: 8px; }
.learn-head h2 { font-size: 22px; }
.learn-head p { margin: 0; }
.learn-head .run-progress { text-align: left; max-width: 320px; }
.learn-steps { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 12px; }
.learn-step { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.learn-step.is-done { border-color: #bfe8cd; }
.learn-step p { margin: 0; line-height: 1.55; }
.learn-step-head { display: flex; gap: 12px; align-items: center; }
.learn-step-head h3 { font-size: 17px; }
.step-no { width: 32px; height: 32px; border-radius: 50%; background: var(--navy-800); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; font-size: 14px; }
.learn-step.is-done .step-no { background: var(--green-600); }
.step-media { display: flex; gap: 10px; flex-wrap: wrap; }
.step-img { max-width: 100%; width: 320px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.step-video { width: 100%; max-width: 560px; border-radius: var(--radius-sm); background: #000; }
.step-editor { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.step-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; position: relative; }
.step-head { display: flex; gap: 10px; align-items: center; }
.step-tools { position: absolute; top: 10px; right: 8px; display: flex; gap: 2px; }
.step-card .step-head input { margin-right: 96px; }
.tmatrix th:not(:first-child) { writing-mode: vertical-rl; transform: rotate(180deg); white-space: normal; height: 200px; max-width: 64px; line-height: 1.25; vertical-align: bottom; font-size: 12px; text-transform: none; letter-spacing: 0; }
.tmatrix td { padding: 6px; }
.mx { display: inline-block; width: 18px; height: 18px; border-radius: 5px; background: var(--bg-soft); border: 1px solid var(--line); vertical-align: middle; }
.mx-confirmed { background: var(--green-600); border-color: var(--green-600); }
.mx-completed { background: #86d9a4; border-color: #86d9a4; }
.mx-in_progress { background: var(--teal-500); border-color: var(--teal-500); }
.mx-assigned { background: var(--navy-100); border-color: #b9c6d6; }
.mx-overdue { background: var(--red-600); border-color: var(--red-600); }
.mx-missing { background: #fff; border: 2px dashed var(--red-600); }
.mx-none { background: transparent; border-color: transparent; }

/* Vertretung */
.replan { display: grid; gap: 8px; margin-bottom: 14px; }
.replan-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 320px) auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.replan-order { display: grid; gap: 2px; min-width: 0; }
.replan-row select { min-height: 38px; font-size: 14px; }
.pick-inline { margin: 0; }
.cand-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.cand { display: grid; grid-template-columns: 56px 1fr 180px; gap: 14px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.cand.is-best { border-color: var(--teal-500); background: var(--teal-50); }
.cand-score { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: var(--navy-800); background: var(--navy-100); }
.cand.is-best .cand-score { background: var(--teal-500); color: #fff; }
.cand-main { display: grid; gap: 6px; min-width: 0; }
.cand-actions { display: grid; gap: 6px; }
.cand-actions form { margin: 0; }
.reasons { display: flex; flex-wrap: wrap; gap: 4px; }
.reason { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg-soft); color: var(--ink-2); }
.reason.pos { background: var(--green-50); color: var(--green-600); }
.reason.neg { background: var(--red-50); color: var(--red-600); }
.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pool-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 6px; }
.pool-card small { display: flex; align-items: center; gap: 4px; }
.pool-card .icon { width: 14px; height: 14px; }
.avail-week { display: flex; gap: 3px; }
.avail-day { flex: 1; text-align: center; font-size: 11px; font-weight: 600; padding: 3px 0; border-radius: 4px; background: var(--bg-soft); color: var(--ink-3); }
.avail-day.on { background: var(--teal-50); color: var(--teal-600); }
.avail-form { display: grid; gap: 6px; margin-top: 8px; }
.avail-row { display: grid; grid-template-columns: 70px 1fr 1fr; gap: 6px; align-items: center; }
.avail-row input[type=time] { min-height: 34px; padding: 4px 6px; font-size: 13px; }
.avail-row .check { display: flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 600; }

/* Qualität */
.filters-card { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters-card label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.qc-items { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.qc-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; display: grid; gap: 10px; }
.qc-item[data-result=ok] { border-color: #bfe8cd; background: #fbfefc; }
.qc-item[data-result=fail] { border-color: #f1c4ad; background: #fffaf7; }
.qc-text { font-weight: 600; }
.qc-rating { display: flex; gap: 6px; flex-wrap: wrap; }
.qc-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.qc-btn span { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; background: #fff; min-width: 90px; text-align: center; }
.qc-ok input:checked + span { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.qc-fail input:checked + span { background: var(--red-600); border-color: var(--red-600); color: #fff; }
.qc-na input:checked + span { background: var(--navy-100); border-color: #b9c6d6; }
.qc-btn input:focus-visible + span { box-shadow: 0 0 0 3px rgba(20,184,166,.3); }
.qc-extra { display: grid; grid-template-columns: 1fr 130px auto; gap: 8px; align-items: center; }
.qc-extra input, .qc-extra select { min-height: 38px; font-size: 14px; }
.score-live { font-size: 22px; font-weight: 800; color: var(--ink-3); }
.score-live.good, .big-score.good { color: var(--green-600); } .score-live.mid, .big-score.mid { color: var(--amber-600); } .score-live.bad, .big-score.bad { color: var(--red-600); }
.big-score { font-size: 56px; font-weight: 800; line-height: 1; }
.big-score small { font-size: 22px; }
.defects { display: grid; gap: 8px; }
.defect { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.defect.is-overdue { border-color: #f1c4ad; background: #fffaf7; }
.defect-main { display: grid; gap: 4px; min-width: 0; }
.defect-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.defect-form select, .defect-form input { width: auto; min-height: 34px; padding: 5px 8px; font-size: 13px; }
.defect-resolve { grid-column: 1 / -1; }
.rework-card { display: grid; gap: 10px; margin: 0; }
.rework-card.is-overdue { border-color: var(--red-600); }
.rework-card.is-done { opacity: .7; }
.rework-card h3 { font-size: 16px; }
.rework-card p { margin: 0; }
.file-btn { justify-self: start; }

@media (max-width: 760px) {
  .replan-row { grid-template-columns: 1fr; }
  .cand { grid-template-columns: 44px 1fr; }
  .cand-score { width: 44px; height: 44px; font-size: 15px; }
  .cand-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .qc-extra { grid-template-columns: 1fr auto; }
  .qc-extra select { grid-column: 1; }
  .qc-btn span { min-width: 0; padding: 10px 12px; }
  .qc-rating { display: grid; grid-template-columns: 1fr 1fr 1fr; }
  .defect { grid-template-columns: 1fr; }
  .learn-list { grid-template-columns: 1fr; }
  .btn-block-sm { width: 100%; }
}

/* ======================= Phase 4 ======================= */
.table th.r, .table td.r { text-align: right; font-variant-numeric: tabular-nums; }
.export-btns { display: flex; gap: 8px; }
.radio-3 { grid-template-columns: repeat(3, 1fr); }
.hbar-wide { grid-template-columns: minmax(120px, 1.4fr) 2fr 50px; }
.stockbar { display: block; width: 90px; height: 5px; background: var(--bg-soft); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.stockbar span { display: block; height: 100%; background: var(--teal-500); }
.stockbar span.low { background: var(--red-600); }
.big-stock { display: grid; justify-items: end; font-size: 44px; font-weight: 800; color: var(--navy-800); line-height: 1; gap: 4px; }
.big-stock small { font-size: 16px; font-weight: 600; color: var(--ink-2); }
.big-stock.low { color: var(--red-600); }
.badge-mv-in { background: var(--green-50); color: var(--green-600); }
.badge-mv-out { background: var(--amber-50); color: var(--amber-600); }
.badge-mv-correction { background: var(--navy-100); color: var(--navy-700); }
.consume-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.consume-form select { flex: 2 1 200px; min-height: 38px; font-size: 14px; width: auto; }
.consume-form input { flex: 1 1 90px; min-height: 38px; font-size: 14px; width: auto; }
.callout-ai { background: #eef4ff; color: var(--navy-700); }
.translate-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 14px; border-radius: var(--radius-sm); background: #eef4ff; color: var(--navy-700); font-size: 14px; }
.translate-bar .icon { width: 18px; height: 18px; color: var(--teal-600); }
.orig { font-size: 12px; font-weight: 400; margin-top: 2px; }
.chat { display: grid; gap: 12px; align-content: start; }
.chat-log { display: grid; gap: 10px; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.bubble { padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; max-width: 92%; }
.bubble p { margin: 0 0 6px; } .bubble p:last-child { margin: 0; }
.bubble ul { margin: 0 0 6px; padding-left: 18px; }
.bubble-q { justify-self: end; background: var(--navy-800); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.bubble-a { justify-self: start; background: var(--bg-soft); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.chip-btn { border: 1px solid var(--line); cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.chip-btn:hover { border-color: var(--teal-500); }
.is-busy { opacity: .7; cursor: progress; }
body.ai-busy .chat-log::after { content: "…"; justify-self: start; padding: 10px 16px; border-radius: 14px; background: var(--bg-soft); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .4; } }
@media (max-width: 640px) { .radio-3 { grid-template-columns: 1fr; } .chat-form { grid-template-columns: 1fr; } .big-stock { font-size: 32px; } }
@media print {
  .sidebar, .topbar, .no-print, .backdrop, .flash { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
}
.lang-switch { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 24px; }
.lang-switch a { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 6px; color: var(--ink-3); border: 1px solid var(--line); }
.lang-switch a:hover { text-decoration: none; border-color: var(--teal-500); }
.lang-switch a.active { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }

/* ======================= Benachrichtigungen ======================= */
.topbar-right { display: flex; align-items: center; gap: 10px; }
.bell { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--navy-800); background: var(--bg-soft); }
.bell:hover { text-decoration: none; background: var(--navy-100); }
.bell .icon { width: 20px; height: 20px; }
.bell-count { position: absolute; top: -3px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red-600); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif a { display: flex; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); color: var(--ink); }
.notif a:hover { text-decoration: none; background: var(--bg-soft); }
.notif:last-child a { border-bottom: 0; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: none; background: transparent; }
.notif.is-unread .notif-dot { background: var(--teal-500); }
.notif.is-unread .notif-body > span { font-weight: 600; }
.notif-body { display: grid; gap: 2px; font-size: 14px; }
.push-box { padding-top: 12px; border-top: 1px dashed var(--line); }
@media (max-width: 640px) { .bell { width: 34px; height: 34px; } }

/* ---------- Phase 6: Sicherheit & Datenschutz ---------- */
.callout-warn { margin: 0 0 16px; }
.card .callout-warn { margin: 12px 0 0; }
.code-input { font: 600 20px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .18em; text-align: center; max-width: 220px; }
.steps-list { margin: 0; padding-left: 22px; display: grid; gap: 18px; }
.steps-list li::marker { font-weight: 700; color: var(--navy-700); }
.qr-box { margin: 12px 0 8px; width: 200px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.qr-box svg { display: block; width: 100%; height: auto; }
code.secret { font-size: 13px; letter-spacing: .06em; word-break: break-all; background: var(--bg-soft); padding: 2px 6px; border-radius: 4px; }
.inline-code { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.recovery-codes { list-style: none; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.recovery-codes code { display: block; text-align: center; font-size: 16px; letter-spacing: .08em; padding: 8px; border: 1px dashed var(--line); border-radius: 6px; }
.card h4 { margin: 0; font-size: 14px; color: var(--navy-800); }
.retention-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.danger-zone { border-color: #f1c4ad; }
@media print { .recovery-codes code { border-style: solid; } }
.bullets { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: var(--ink-2); }
.form label.check input[type=radio] { margin-top: 3px; align-self: flex-start; }
.danger-zone { margin-top: 20px; }
.form label.check > span { display: grid; gap: 2px; }

/* ---------- Finanzen ---------- */
.badge-inv-draft { background: var(--bg-soft); color: var(--ink-2); border: 1px dashed var(--line); }
.badge-inv-sent { background: var(--navy-100); color: var(--navy-700); }
.badge-inv-paid { background: var(--green-50); color: var(--green-600); }
.badge-inv-overdue { background: var(--red-50); color: var(--red-600); }
.badge-inv-cancelled { background: var(--bg-soft); color: var(--ink-3); text-decoration: line-through; }
.money-input { width: 110px; text-align: right; font-variant-numeric: tabular-nums; display: inline-block; }
.is-invalid { border-color: var(--red-600) !important; background: var(--red-50); }
.hbar-money { grid-template-columns: 120px 1fr 110px; }
.row-neg td:last-child, .row-neg td:nth-last-child(2) { color: var(--red-600); }
.dl-money dd { text-align: right; font-variant-numeric: tabular-nums; }
.form-actions-sticky { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg-soft) 30%); padding: 14px 0; }
.item-add { border-top: 1px solid var(--line); padding-top: 14px; }
.item-add h4 { margin: 0 0 8px; font-size: 14px; }
@media (max-width: 640px) {
  .hbar-money { grid-template-columns: 70px 1fr 84px; font-size: 12px; }
  .table:not(.table-compact):not(.matrix) td.r { text-align: left; }
}

/* ---------- Ferienwohnungen ---------- */
.badge-flat-vacant { background: var(--bg-soft); color: var(--ink-2); }
.badge-flat-occupied { background: var(--navy-100); color: var(--navy-700); }
.badge-flat-turnover, .badge-flat-open { background: var(--amber-50); color: var(--amber-600); }
.badge-flat-progress { background: var(--teal-50); color: var(--teal-600); }
.badge-flat-ready { background: var(--green-50); color: var(--green-600); }
a.badge:hover { text-decoration: none; filter: brightness(.97); }
.flat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.flat-card { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: var(--bg); }
.flat-card:hover { border-color: var(--teal-500); text-decoration: none; }
.flat-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.occ { display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; margin: 4px 0; }
.occ-day { display: inline-block; height: 10px; border-radius: 2px; background: var(--bg-soft); border: 1px solid var(--line); }
.occ-day.is-occ { background: var(--navy-100); border-color: var(--navy-100); }
.occ-day.is-change { background: var(--amber-50); border-color: var(--amber-600); }
.legend .occ-day { width: 14px; vertical-align: middle; margin-right: 4px; }
.row-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.same-day { display: inline-flex; align-items: center; gap: 4px; color: var(--red-600); font-weight: 600; }
.same-day .icon { width: 14px; height: 14px; }
.list-row.is-off { opacity: .55; }
.turnover-hero { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-left: 4px solid var(--amber-600); }
.turnover-hero.is-ready { border-left-color: var(--green-600); }
.turnover-hero h2 { margin: 0 0 4px; font-size: 20px; }
.facts { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.facts li { display: flex; align-items: center; gap: 8px; }
.facts .icon { width: 16px; height: 16px; color: var(--teal-600); flex: none; }
.ready-stamp { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--green-50); color: var(--green-600); align-self: flex-start; }
.ready-stamp span { display: grid; }
.ready-stamp small { color: var(--ink-2); }
.plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 20px; }
.supply-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; }
.supply-grid label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.thumb { display: block; max-width: 160px; max-height: 120px; margin-top: 6px; border-radius: var(--radius-sm); object-fit: cover; }
.gaps { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; color: var(--amber-600); font-size: 14px; }
.gaps li { display: flex; align-items: center; gap: 8px; }
.gaps .icon { width: 16px; height: 16px; }
.btn-lg { min-height: 48px; padding: 12px 22px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.pre { white-space: pre-line; margin: 0; }
@media (max-width: 640px) {
  .ready-card .btn-lg { width: 100%; justify-content: center; }
  .turnover-row { flex-wrap: wrap; }
  .turnover-row .row-end { justify-content: flex-start; width: 100%; }
}
.turnover-link { text-decoration: none; align-items: center; }
.turnover-link .icon { width: 18px; height: 18px; flex: none; }
.turnover-link.is-ready { background: var(--green-50); color: var(--green-600); }
.turnover-link:hover { text-decoration: none; filter: brightness(.98); }
.row-end > .badge { flex: none; }
.badge-src { background: var(--teal-50); color: var(--teal-600); }
.feed-row > div:first-child { min-width: 0; display: grid; gap: 2px; }
.feed-url { overflow-wrap: anywhere; }
.feed-error { color: var(--red-600); font-size: 12px; }
.howto { font-size: 13px; color: var(--ink-2); margin: 4px 0 8px; }
.howto summary { cursor: pointer; color: var(--teal-600); font-weight: 600; }
.howto ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.export-box { border-top: 1px solid var(--line); padding-top: 14px; }
.export-box h4 { margin: 0 0 4px; font-size: 14px; }
.copy-field { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--bg-soft); }
@media (max-width: 640px) { .feed-row { flex-wrap: wrap; } .feed-row .row-end { width: 100%; justify-content: flex-start; } }

/* ---------- Schulungstests ---------- */
.quiz { gap: 16px; }
.quiz-q { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; display: grid; gap: 8px; min-width: 0; }
.quiz-q legend { font-weight: 700; color: var(--navy-800); padding: 0 4px; display: flex; gap: 8px; align-items: flex-start; }
.quiz-option, .form .quiz-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-weight: 400; min-height: 44px; }
.form .quiz-option:has(input:checked), .quiz-option:has(input:checked) { border-color: var(--teal-500); background: var(--teal-50); }
.quiz-option input { margin-top: 3px; flex: none; width: 18px; height: 18px; }
.quiz-result { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; }
.quiz-result.is-pass { background: var(--green-50); color: var(--green-600); }
.quiz-result.is-fail { background: var(--amber-50); color: var(--amber-600); }
.quiz-review { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.quiz-review li { display: flex; gap: 10px; }
.quiz-review .mark { font-weight: 800; flex: none; width: 18px; }
.quiz-review .ok .mark { color: var(--green-600); }
.quiz-review .wrong .mark { color: var(--red-600); }
.quiz-review small { color: var(--ink-2); margin-top: 2px; }
.quiz-list { padding-left: 0; list-style: none; display: grid; gap: 14px; margin: 0; }
.quiz-list > li { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.quiz-list-head { display: flex; justify-content: space-between; gap: 8px; }
.quiz-answers { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 4px; font-size: 14px; }
.quiz-answers li { padding: 4px 8px; border-radius: 6px; background: var(--bg-soft); }
.quiz-answers .is-correct { background: var(--green-50); color: var(--green-600); font-weight: 600; }
.quiz-edit-options { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; min-width: 0; }
.quiz-edit-options legend { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.quiz-edit-option { display: flex; gap: 8px; align-items: center; }
.quiz-edit-option input[type=radio] { width: 20px; height: 20px; flex: none; }
.quiz-preview { display: grid; gap: 10px; }
.quiz-preview ul { margin: 4px 0 0; }
.quiz-stat.ok { color: var(--green-600); } .quiz-stat.warn { color: var(--amber-600); }
.inline-setting { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
