/* ============================================================
   Reimer Angebotsassistent – Designsystem
   Abgeleitet aus dem RHMD-Logo: Blau als Primärfarbe,
   Rot ausschließlich als gezielter Akzent.
   ============================================================ */

:root {
  /* Markenfarben */
  --c-blue-700: #084c86;
  --c-blue-600: #0a5d9e;
  --c-blue-500: #0d6cb8;
  --c-blue-100: #d9eaf7;
  --c-blue-50: #eef5fb;
  --c-red: #d6231f;
  --c-navy-950: #0b1f30;
  --c-navy-900: #0e2739;
  --c-navy-800: #143349;

  /* Neutrale Töne */
  --c-ink: #18293a;
  --c-ink-2: #43566a;
  --c-muted: #5d7386;
  --c-faint: #6b7f92;
  --c-border-soft: #93a5b5;
  --c-line: #d9e2ea;
  --c-line-strong: #c2cfda;
  --c-canvas: #f2f5f8;
  --c-white: #ffffff;
  --c-field: #fbfcfe;

  /* Semantische Zustandsfarben */
  --c-success: #0e7a4b;
  --c-success-bg: #e6f5ee;
  --c-success-line: #b9e2cd;
  --c-warn: #8f5c05;
  --c-warn-bg: #fdf3de;
  --c-warn-line: #eed9ab;
  --c-danger: #b3251e;
  --c-danger-bg: #fdedec;
  --c-danger-line: #f4c7c3;
  --c-info: #0a5d9e;
  --c-info-bg: #e9f3fb;
  --c-info-line: #c3dcf0;

  /* Abstände */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;

  /* Radien & Schatten */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 38, 58, .06), 0 2px 8px rgba(16, 38, 58, .05);
  --shadow-md: 0 4px 10px rgba(16, 38, 58, .08), 0 12px 32px rgba(16, 38, 58, .10);
  --shadow-lg: 0 24px 60px rgba(11, 31, 48, .22);

  --focus-ring: 2px solid var(--c-blue-500);

  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-ink);
  background: var(--c-canvas);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Basis ---------- */
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--c-canvas); }
h1, h2, h3, h4, p { margin: 0; overflow-wrap: break-word; }
h1 { font-size: 22px; letter-spacing: -.02em; }
h2 { font-size: 17px; letter-spacing: -.012em; }
h3 { font-size: 14.5px; }
small { font-size: 12px; }
a { color: var(--c-blue-600); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { max-width: 100%; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.hidden { display: none !important; }
.muted { color: var(--c-muted); }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: .86em; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { margin: 0 0 4px; color: var(--c-blue-600); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }

/* Sichtbarer Tastaturfokus überall */
:focus { outline: none; }
:focus-visible { outline: var(--focus-ring); outline-offset: 2px; border-radius: 4px; }

.skip-link { position: absolute; left: 12px; top: -48px; z-index: 200; padding: 10px 16px; border-radius: 0 0 8px 8px; background: var(--c-blue-600); color: #fff; font-weight: 600; text-decoration: none; transition: top .15s; }
.skip-link:focus { top: 0; }

/* ============================================================
   Anmeldung
   ============================================================ */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-6); background: var(--c-canvas); }
.login-box { width: min(360px, 100%); }
.login-card { padding: var(--sp-7) var(--sp-6) var(--sp-6); border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-white); box-shadow: var(--shadow-sm); }
.login-card-logo { display: block; width: 180px; margin: 0 auto var(--sp-6); }
.login-card h1 { margin-bottom: var(--sp-5); font-size: 18px; text-align: center; }
.login-card .field { margin-bottom: var(--sp-4); }
.login-card #login-submit { margin-top: var(--sp-5); }
.login-hint { margin-top: var(--sp-4); color: var(--c-faint); font-size: 12px; text-align: center; }

/* ============================================================
   App-Gerüst
   ============================================================ */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 250px; display: flex; flex-direction: column; background: var(--c-white); border-right: 1px solid var(--c-line); }
/* Gleiche Höhe wie die Topbar (72px), damit die Trennlinien fluchten */
.app-logo { height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 16px; text-decoration: none; border-bottom: 1px solid var(--c-line); }
.app-logo img { display: block; height: 34px; width: auto; max-width: 100%; object-fit: contain; }
.app-logo-caption { display: block; color: var(--c-muted); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-align: center; text-transform: uppercase; }
.main-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.main-nav a { display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 8px 12px; border-radius: var(--r-sm); color: var(--c-ink-2); font-size: 13.5px; font-weight: 600; text-decoration: none; text-align: left; }
.main-nav a:hover { color: var(--c-ink); background: #f2f6fa; }
.main-nav a.active { color: var(--c-blue-700); background: var(--c-blue-50); box-shadow: inset 3px 0 0 var(--c-red); }
.main-nav a .icon { color: var(--c-faint); }
.main-nav a.active .icon { color: var(--c-blue-600); }
.main-nav a:hover .icon { color: var(--c-ink-2); }
.nav-sep { margin: 8px 4px; border-top: 1px solid var(--c-line); }
.sidebar-feedback { padding: 12px; border-top: 1px solid var(--c-line); }
.sidebar-feedback button { width: 100%; min-height: 40px; padding: 8px 12px; display: flex; align-items: center; gap: 11px; border-radius: var(--r-sm); color: var(--c-ink-2); font-size: 13px; font-weight: 600; text-align: left; }
.sidebar-feedback button:hover { color: var(--c-blue-700); background: var(--c-blue-50); }
.sidebar-feedback button .icon { color: var(--c-blue-600); }

.sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(10, 26, 40, .5); }

.workspace { grid-column: 2; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; min-height: 72px; padding: 12px clamp(20px, 3.5vw, 44px); display: flex; align-items: center; gap: 16px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--c-line); }
.topbar-heading { min-width: 0; flex: 1; overflow: hidden; }
.topbar-heading .eyebrow { margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1:focus, .topbar h1:focus-visible { outline: none; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.topbar-user { display: flex; align-items: center; gap: 10px; padding-left: 14px; margin-left: 4px; border-left: 1px solid var(--c-line); }
.topbar-user > span { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--c-blue-500); font-size: 12px; font-weight: 700; }
.topbar-user .tu-meta { min-width: 0; max-width: 180px; }
.topbar-user strong, .topbar-user small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.topbar-user strong { font-size: 12.5px; color: var(--c-ink); line-height: 1.25; }
.topbar-user small { color: var(--c-muted); font-size: 11px; }
.topbar .mobile-menu { display: none; }
.dirty-indicator { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border: 1px solid var(--c-warn-line); border-radius: 999px; color: var(--c-warn); background: var(--c-warn-bg); font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.dirty-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.content { width: 100%; max-width: 1460px; margin: 0 auto; padding: var(--sp-6) clamp(20px, 3.5vw, 44px) 80px; }

/* ============================================================
   Buttons
   ============================================================ */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 16px; border: 1px solid transparent; border-radius: var(--r-sm); font-size: 13px; font-weight: 650; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
.button .icon { width: 16px; height: 16px; }
.button.primary { color: #fff; background: var(--c-blue-500); box-shadow: var(--shadow-sm); }
.button.primary:hover { background: var(--c-blue-600); }
.button.secondary { color: var(--c-blue-700); background: var(--c-blue-50); border-color: var(--c-blue-100); }
.button.secondary:hover { background: var(--c-blue-100); }
.button.ghost { color: var(--c-ink-2); background: var(--c-white); border-color: var(--c-line-strong); }
.button.ghost:hover { border-color: var(--c-faint); background: #f7fafc; }
.button.danger { color: var(--c-danger); background: var(--c-white); border-color: var(--c-danger-line); }
.button.danger:hover { background: var(--c-danger-bg); }
.button.subtle { color: var(--c-blue-600); background: transparent; }
.button.subtle:hover { background: var(--c-blue-50); }
.button.sm { min-height: 32px; padding: 5px 12px; font-size: 12.5px; }
.button.lg { min-height: 44px; padding: 11px 20px; font-size: 14px; }
.button.block { width: 100%; }
.button:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.button.busy { position: relative; color: transparent !important; pointer-events: none; }
.button.busy::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.button.busy.ghost::after, .button.busy.secondary::after, .button.busy.subtle::after { border-color: var(--c-blue-100); border-top-color: var(--c-blue-600); }

.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--c-line-strong); border-radius: var(--r-sm); color: var(--c-ink-2); background: var(--c-white); transition: background-color .15s, color .15s, border-color .15s; }
.icon-button:hover { background: #f2f6fa; color: var(--c-ink); }
.icon-button.sm { width: 30px; height: 30px; border-radius: 7px; }
.icon-button.sm .icon { width: 15px; height: 15px; }
.icon-button.ib-success:hover { color: var(--c-success); border-color: var(--c-success-line); background: var(--c-success-bg); }
.icon-button.ib-danger:hover { color: var(--c-danger); border-color: var(--c-danger-line); background: var(--c-danger-bg); }
.icon-button.ib-delete { color: var(--c-danger); border-color: var(--c-danger-line); background: #fffbfb; }
.icon-button.ib-delete:hover { color: var(--c-danger); border-color: var(--c-danger); background: var(--c-danger-bg); }

/* Beschriftete Statusaktionen (Annehmen / Ablehnen) in der Angebotsliste */
.action-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 1px solid var(--c-line-strong); border-radius: 7px; color: var(--c-ink-2); background: var(--c-white); font-size: 12px; font-weight: 650; transition: background-color .15s, color .15s, border-color .15s; }
.action-chip .icon { width: 14px; height: 14px; }
.ac-success .icon { color: var(--c-success); }
.ac-danger .icon { color: var(--c-danger); }
.ac-success:hover { color: var(--c-success); border-color: var(--c-success-line); background: var(--c-success-bg); }
.ac-danger:hover { color: var(--c-danger); border-color: var(--c-danger-line); background: var(--c-danger-bg); }

@media (pointer: coarse) {
  .button, .icon-button, .action-chip { min-height: 44px; }
  .button.sm { min-height: 40px; }
  .icon-button { width: 44px; height: 44px; }
}

/* ============================================================
   Formulare
   ============================================================ */
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .field > .label { color: #33465a; font-size: 12.5px; font-weight: 650; line-height: 1.35; }
.req::after { content: " *"; color: var(--c-red); font-weight: 700; }
.required-note { margin: 2px 0 0; color: var(--c-muted); font-size: 11.5px; }
.required-note b { color: var(--c-red); }

input, select, textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--c-line-strong); border-radius: var(--r-sm);
  background: var(--c-field); color: var(--c-ink); outline: none;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--c-faint); }
input:focus, select:focus, textarea:focus { border-color: var(--c-blue-500); background: #fff; box-shadow: 0 0 0 3px rgba(13, 108, 184, .14); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--c-blue-500); }
input[type="date"] { min-width: 0; }
input[type="color"] { padding: 4px; height: 40px; cursor: pointer; }
textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2362788c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 15px;
}

.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--c-danger); background: #fffbfb; }
.field.invalid input:focus, .field.invalid select:focus, .field.invalid textarea:focus { box-shadow: 0 0 0 3px rgba(179, 37, 30, .13); }
.field-help { color: var(--c-muted); font-size: 11.5px; font-weight: 400; line-height: 1.4; }
.field-error { display: flex; align-items: flex-start; gap: 6px; margin: 0; color: var(--c-danger); font-size: 12px; font-weight: 550; }
.field-error .icon { width: 14px; height: 14px; margin-top: 2px; }

.form-error { display: flex; gap: 8px; align-items: flex-start; margin: var(--sp-3) 0 0; padding: 10px 12px; border: 1px solid var(--c-danger-line); border-radius: var(--r-sm); color: var(--c-danger); background: var(--c-danger-bg); font-size: 12.5px; }

/* Eingaben mit Einheit / Zusatzknopf */
.input-affix { position: relative; }
.input-affix input { padding-right: 44px; }
.affix-button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 34px; height: 32px; border-radius: 6px; color: var(--c-muted); }
.affix-button:hover { color: var(--c-ink); background: var(--c-blue-50); }
.input-unit { position: relative; display: block; }
.input-unit input { padding-right: 56px; }
.input-unit > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--c-muted); font-size: 12px; font-weight: 600; pointer-events: none; }

/* Zahlenfelder: nativen Browser-Spinner ausblenden, eigene −/+‑Tasten verwenden */
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.num-stepper { display: flex; align-items: stretch; min-height: 40px; border: 1px solid var(--c-line-strong); border-radius: var(--r-sm); background: var(--c-field); overflow: hidden; transition: border-color .15s, box-shadow .15s, background-color .15s; }
.num-stepper:hover { border-color: var(--c-faint); }
.num-stepper:focus-within { border-color: var(--c-blue-500); background: #fff; box-shadow: 0 0 0 3px rgba(13, 108, 184, .14); }
.num-stepper .input-unit { flex: 1 1 auto; min-width: 0; }
.num-stepper .input-unit input { min-height: 0; height: 100%; border: 0; border-radius: 0; background: transparent; }
.num-stepper .input-unit input:focus { background: transparent; box-shadow: none; }
.field.invalid .num-stepper { border-color: var(--c-danger); background: #fffbfb; }
.num-stepper .spin-col { flex: 0 0 auto; display: flex; flex-direction: column; align-items: stretch; border-left: 1px solid var(--c-line); }
.step-btn { flex: 1 1 50%; width: 26px; display: grid; place-items: center; border: 0; background: #f3f6f9; color: var(--c-muted); font-size: 12.5px; font-weight: 700; line-height: 1; transition: background .12s, color .12s; }
.step-btn + .step-btn { border-top: 1px solid var(--c-line); }
.step-btn:hover { background: var(--c-blue-50); color: var(--c-blue-700); }
.step-btn:active { background: var(--c-blue-100); }

/* Checkboxen / Auswahlkacheln */
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.check { display: flex; align-items: flex-start; gap: 9px; min-height: 30px; padding: 4px 2px; color: #3c4f63; font-size: 13px; font-weight: 500; cursor: pointer; border-radius: 6px; }
.check input { margin-top: 2px; }
.check:hover { color: var(--c-ink); }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice { position: relative; display: block; }
.choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 13px; border: 1px solid var(--c-line-strong); border-radius: var(--r-sm); color: #41556a; background: var(--c-white); font-size: 12.5px; font-weight: 600; transition: border-color .15s, background-color .15s, color .15s; }
.choice:hover span { border-color: var(--c-faint); }
.choice input:checked + span { color: var(--c-blue-700); border-color: var(--c-blue-500); background: var(--c-blue-50); box-shadow: inset 0 0 0 1px var(--c-blue-500); }
.choice input:focus-visible + span { outline: var(--focus-ring); outline-offset: 2px; }

/* Segmentierte Auswahl (z. B. Zuschlag / Nachlass) */
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--c-line-strong); border-radius: var(--r-sm); background: #eef2f6; }
.seg label { position: relative; display: block; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 14px; border-radius: 6px; color: var(--c-ink-2); font-size: 12.5px; font-weight: 650; }
.seg input:checked + span { color: var(--c-blue-700); background: #fff; box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: var(--focus-ring); outline-offset: 1px; }

/* Umschalter (Benutzer aktiv) */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; font-weight: 600; color: #3c4f63; }
.switch input { position: absolute; width: 44px; height: 24px; margin: 0; opacity: 0; cursor: pointer; }
.switch .track { width: 44px; height: 24px; flex: 0 0 auto; border-radius: 999px; background: var(--c-line-strong); transition: background-color .15s; }
.switch .track::after { content: ""; display: block; width: 18px; height: 18px; margin: 3px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .track { background: var(--c-success); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: var(--focus-ring); outline-offset: 2px; }

/* ============================================================
   Karten, Tabellen, Status
   ============================================================ */
.card { border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-white); box-shadow: var(--shadow-sm); }
.card-header { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--c-line); }
.card-header h2, .card-header h3 { display: flex; align-items: center; gap: 9px; }
.card-header .icon { color: var(--c-blue-500); }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--c-line); background: #fafcfd; border-radius: 0 0 var(--r-md) var(--r-md); }

.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: var(--sp-5); }
.hero-row h2 { font-size: 20px; letter-spacing: -.02em; margin-bottom: 4px; }
.hero-row p { color: var(--c-muted); font-size: 13.5px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: var(--sp-5); }
.metric { display: block; padding: 16px 18px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-white); box-shadow: var(--shadow-sm); color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
a.metric:hover { border-color: var(--c-blue-100); box-shadow: var(--shadow-md); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--c-muted); font-size: 12px; font-weight: 650; }
.metric-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--c-blue-600); background: var(--c-blue-50); }
.metric-icon .icon { width: 16px; height: 16px; }
.metric strong { display: block; margin-top: 10px; font-size: 26px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.metric small { color: var(--c-faint); font-size: 11.5px; }
.metric-cta { display: grid; justify-items: center; align-content: center; gap: 7px; text-align: center; cursor: pointer; color: var(--c-blue-700); background: var(--c-blue-50); border: 1px dashed var(--c-blue-500); transition: background-color .15s, box-shadow .15s, border-color .15s; }
.metric-cta:hover { background: var(--c-blue-100); border-style: solid; box-shadow: var(--shadow-md); }
.metric-cta .cta-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--c-blue-500); }
.metric-cta strong { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.metric-cta small { color: var(--c-blue-600); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 10px 14px; color: #56708a; background: #f7fafc; border-bottom: 1px solid var(--c-line); font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid #e8eef3; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color .12s; }
tbody tr:hover { background: #f7fbfe; }
tbody tr.clickable { cursor: pointer; }
td strong { display: block; color: #223549; font-weight: 650; }
td small { display: block; margin-top: 2px; color: var(--c-faint); font-size: 11.5px; }
th.num, td.num { text-align: right; }
.row-link { color: var(--c-blue-600); font-weight: 650; text-decoration: none; }
.row-link:hover { text-decoration: underline; }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid transparent; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-draft { color: #5a6b7d; background: #eef1f4; border-color: #dde3e9; }
.status-sent { color: var(--c-info); background: var(--c-info-bg); border-color: var(--c-info-line); }
.status-accepted { color: var(--c-success); background: var(--c-success-bg); border-color: var(--c-success-line); }
.status-rejected { color: var(--c-danger); background: var(--c-danger-bg); border-color: var(--c-danger-line); }

/* Filterleiste + Chips */
.filterbar { padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border-bottom: 1px solid var(--c-line); }
.searchbox { position: relative; flex: 1 1 240px; max-width: 380px; }
.searchbox .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--c-faint); width: 16px; height: 16px; pointer-events: none; }
.searchbox input { padding-left: 38px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 5px 13px; border: 1px solid var(--c-line-strong); border-radius: 999px; background: var(--c-white); color: var(--c-ink-2); font-size: 12.5px; font-weight: 600; transition: border-color .15s, background-color .15s, color .15s; }
.chip:hover { border-color: var(--c-faint); }
.chip[aria-pressed="true"] { color: var(--c-blue-700); background: var(--c-blue-50); border-color: var(--c-blue-500); }
.chip .count { padding: 1px 7px; border-radius: 999px; background: #edf1f5; color: var(--c-ink-2); font-size: 11px; font-weight: 700; }
.chip[aria-pressed="true"] .count { background: var(--c-blue-100); color: var(--c-blue-700); }

/* Dashboard-Diagramme */
.dashboard-charts { display: grid; grid-template-columns: 3fr 2fr; gap: var(--sp-4); }
.viz-card { display: flex; flex-direction: column; }
.viz-card .card-header { align-items: center; }
.viz-range { margin-left: auto; color: var(--c-faint); font-size: 12px; font-weight: 600; white-space: nowrap; }
.viz-body { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 16px 18px 14px; }
.viz-body svg { width: 100%; height: auto; display: block; }
.viz-grid { stroke: #edf1f6; stroke-width: 1; }
.viz-baseline { stroke: var(--c-line-strong); stroke-width: 1; }
.viz-axis { fill: var(--c-faint); font-size: 10.5px; font-weight: 500; }
.viz-value { fill: var(--c-ink-2); font-size: 11px; font-weight: 700; }
.viz-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-top: 12px; color: var(--c-ink-2); font-size: 12px; font-weight: 600; }
/* Beide Legenden am unteren Kartenrand verankern, damit sie auf gleicher Höhe stehen. */
.viz-body > .viz-legend { margin-top: auto; padding-top: 12px; }
.viz-legend span { display: inline-flex; align-items: center; }
/* Farbfelder als Klassen statt Inline-Styles – die CSP blockiert style-Attribute. */
.viz-dot { display: inline-block; width: 13px; height: 13px; margin-left: 7px; border-radius: 3px; }
.viz-dot-open { background: #cbe0f2; }
.viz-dot-accepted { background: #0a5d9e; }
.viz-dot-glass { background: #0a5d9e; }
.viz-dot-trash { background: #dd9f27; }
.viz-dot-smoke { background: var(--c-red); }
.viz-dot-winter { background: #157a3b; }
.viz-legend-zero { opacity: .55; }
.viz-pie-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.viz-pie-wrap svg { flex: 0 0 auto; width: min(216px, 62%); margin: auto; }
.viz-pie-legend { justify-content: center; gap: 8px 18px; margin-top: auto; padding-top: 12px; }
.viz-slice { stroke: var(--c-white); stroke-width: 2; }
.viz-slice:hover { opacity: .88; }
.viz-center { fill: var(--c-ink); font-size: 17px; font-weight: 750; text-anchor: middle; }
.viz-center-sub { fill: var(--c-muted); font-size: 10.5px; font-weight: 500; text-anchor: middle; }
.viz-tooltip { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; opacity: 0; padding: 8px 11px; border-radius: 8px; background: var(--c-navy-950); color: #dfe9f2; font-size: 12px; line-height: 1.5; box-shadow: var(--shadow-md); max-width: 250px; transition: opacity .12s; }
.viz-tooltip.show { opacity: 1; }
.viz-tooltip strong { display: block; margin-bottom: 2px; color: #fff; }
.viz-empty { padding: 30px 10px; color: var(--c-muted); font-size: 13px; text-align: center; }
/* Einsatzpreise werden getrennt vom Jahreswert ausgewiesen. */
.viz-footnote { margin-top: 8px; color: var(--c-faint); font-size: 11.5px; text-align: center; }

/* Aktionsspalte in der Angebotsliste */
td.row-actions { white-space: nowrap; text-align: right; }
td.row-actions .icon-button + .icon-button, td.row-actions .action-chip + .action-chip, td.row-actions .action-chip + .icon-button, td.row-actions .icon-button + .action-chip { margin-left: 6px; }

/* Archiv angenommener / abgelehnter Angebote */
.offers-archive { margin-top: var(--sp-4); overflow: hidden; }
.offers-archive > summary { padding: 14px 18px; display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; font-weight: 700; font-size: 13.5px; }
.offers-archive > summary::-webkit-details-marker { display: none; }
.offers-archive .archive-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--c-muted); background: #eef1f5; }
.offers-archive .archive-icon .icon { width: 17px; height: 17px; }
.offers-archive .archive-meta { flex: 1; }
.offers-archive .archive-meta small { display: block; margin-top: 1px; color: var(--c-faint); font-size: 11.5px; font-weight: 500; }
.offers-archive .chevron { color: var(--c-muted); transition: transform .15s; }
.offers-archive[open] > summary { border-bottom: 1px solid var(--c-line); }
.offers-archive[open] > summary .chevron { transform: rotate(180deg); }

/* Leere Zustände */
.empty { padding: 48px 24px; display: grid; justify-items: center; gap: 6px; text-align: center; color: var(--c-muted); }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 8px; border-radius: 50%; color: var(--c-blue-500); background: var(--c-blue-50); }
.empty-icon .icon { width: 24px; height: 24px; }
.empty strong { color: var(--c-ink-2); font-size: 14.5px; }
.empty .button { margin-top: 12px; }

/* Hinweise / Notizen */
.note { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 11px 14px; border: 1px solid; border-radius: var(--r-sm); font-size: 12.5px; line-height: 1.5; }
.note .icon { width: 16px; height: 16px; margin-top: 1px; }
.note-info { color: #114d7c; background: var(--c-info-bg); border-color: var(--c-info-line); }
.note-warn { color: #6d4a08; background: var(--c-warn-bg); border-color: var(--c-warn-line); }
.note-success { color: #0c5e3b; background: var(--c-success-bg); border-color: var(--c-success-line); }
.note-danger { color: var(--c-danger); background: var(--c-danger-bg); border-color: var(--c-danger-line); }

/* ============================================================
   Wizard
   ============================================================ */
.stepper { display: flex; gap: 4px; padding: 8px; margin-bottom: var(--sp-5); overflow-x: auto; }
.step { flex: 1 1 0; min-width: 0; padding: 10px 12px; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 11px; align-items: center; border-radius: var(--r-sm); color: #7c8b9a; text-align: left; font-size: 12.5px; font-weight: 650; }
.step .step-dot { width: 30px; height: 30px; display: grid; place-items: center; border: 1.5px solid var(--c-line-strong); border-radius: 50%; color: #6d8093; background: #fff; font-size: 12px; font-weight: 700; }
.step .step-dot .icon { width: 15px; height: 15px; }
.step .step-text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.step small { display: block; margin-top: 1px; color: var(--c-faint); font-size: 11px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.step:hover:not(:disabled) { background: #f3f7fa; }
.step.active { color: var(--c-blue-700); background: var(--c-blue-50); }
.step.active .step-dot { color: #fff; border-color: var(--c-blue-500); background: var(--c-blue-500); }
.step.done .step-dot { color: #fff; border-color: var(--c-success); background: var(--c-success); }
.step:disabled { cursor: not-allowed; opacity: .6; }
.stepper-progress { display: none; }

/* Sperrhinweis für versendete Angebote – steht zwischen Schrittleiste und Formular. */
.offer-lock { flex-wrap: wrap; align-items: center; margin-bottom: var(--sp-5); }
.offer-lock > span { flex: 1 1 320px; }
.offer-lock .button { flex: 0 0 auto; }

.wizard-main { min-width: 0; }
.wizard-title { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 20px; margin-bottom: var(--sp-4); }
.wizard-title h2 { font-size: 19px; margin: 2px 0 4px; }
.wizard-title p { color: var(--c-muted); font-size: 13px; max-width: 560px; }
.wizard-meta { display: inline-flex; align-items: center; gap: 7px; color: var(--c-muted); font-size: 12px; white-space: nowrap; }
.wizard-meta .icon { width: 14px; height: 14px; color: var(--c-success); }

.form-card { padding: var(--sp-5) var(--sp-5) var(--sp-4); }
fieldset.form-section { margin: 0 0 var(--sp-4); padding: 0 0 var(--sp-4); border: 0; border-bottom: 1px solid #e8eef3; }
fieldset.form-section:last-of-type { margin-bottom: 0; border-bottom: 0; padding-bottom: 4px; }
fieldset.form-section legend { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 0; color: var(--c-blue-700); font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
fieldset.form-section legend .icon { width: 15px; height: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }

/* ---------- Schritt 2: Leistungsformular als geführte Abfrage ---------- */
.service-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--sp-4); align-items: start; }
.service-form { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-4); counter-reset: section; }
.service-form fieldset.form-section { margin: 0; padding: 14px 20px 20px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-white); box-shadow: var(--shadow-sm); counter-increment: section; }
.service-form fieldset.form-section:last-of-type { margin-bottom: 0; padding-bottom: 20px; border-bottom: 1px solid var(--c-line); }
.service-form fieldset.form-section legend { float: left; width: 100%; display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 8px 0 12px; border-bottom: 1px solid #e8eef3; color: var(--c-ink); font-size: inherit; font-weight: inherit; letter-spacing: 0; text-transform: none; }
.service-form fieldset.form-section legend + * { clear: both; }
.sec-num { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; border: 1.5px solid var(--c-line-strong); border-radius: 50%; color: var(--c-muted); background: var(--c-white); font-size: 12.5px; font-weight: 700; }
.sec-num::before { content: counter(section); }
.sec-text { min-width: 0; }
.sec-text strong { display: block; font-size: 14.5px; letter-spacing: -.01em; }
.sec-text small { display: block; margin-top: 1px; color: var(--c-muted); font-size: 11.5px; font-weight: 500; }
.service-form .wizard-actions { margin-top: var(--sp-2); }

.guide-panel { position: sticky; top: 88px; padding: 22px 20px 20px; border-radius: var(--r-md); background: var(--c-navy-950); color: #dfe9f2; box-shadow: var(--shadow-md); }
.guide-eyebrow { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; color: #7fc1ee; font-size: 10.5px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.guide-eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: #4da3e0; }
.guide-panel h3 { color: #fff; font-size: 16px; letter-spacing: -.01em; }
.guide-intro { margin: 4px 0 12px; color: #8fa5b8; font-size: 12px; }
.guide-list { margin: 0; padding: 0; list-style: none; counter-reset: guide; }
.guide-list li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, .09); counter-increment: guide; }
.guide-list li::before { content: counter(guide, decimal-leading-zero); padding-top: 2px; color: #6c839a; font-size: 11px; font-weight: 700; }
.guide-list li p { color: #dfe9f2; font-size: 12.5px; line-height: 1.55; }
.guide-hint { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-sm); background: rgba(255, 255, 255, .07); }
.guide-hint strong { display: block; margin-bottom: 4px; color: #9fb3c5; font-size: 10.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.guide-hint p { color: #c6d4e0; font-size: 12px; line-height: 1.55; }
.rhythm-matrix-wrap { margin: 6px 0 4px; overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--r-sm); }
.rhythm-matrix { min-width: 780px; table-layout: fixed; background: #fff; }
.rhythm-matrix th, .rhythm-matrix td { padding: 10px; }
.rhythm-matrix thead th { text-align: center; white-space: normal; }
.rhythm-matrix thead th:first-child { width: 190px; text-align: left; }
.rhythm-matrix tbody th { color: var(--c-ink); background: #fbfcfe; text-transform: none; letter-spacing: 0; white-space: normal; }
.rhythm-matrix tbody th strong { display: block; font-size: 12.5px; }
.rhythm-matrix tbody th small { display: block; margin-top: 2px; color: var(--c-muted); font-size: 10.5px; font-weight: 500; }
.rhythm-matrix tbody td { border-left: 1px solid #edf1f5; }
.rhythm-matrix tbody tr:last-child th, .rhythm-matrix tbody tr:last-child td { border-bottom: 0; }
.rhythm-matrix .input-unit input { min-height: 0; padding: 7px 42px 7px 9px; text-align: right; }
.rhythm-matrix .input-unit > span { right: 8px; font-size: 10.5px; }
.rhythm-matrix .num-stepper { min-height: 38px; }
.rhythm-matrix .step-btn { width: 22px; font-size: 11.5px; }
.wizard-actions { margin-top: var(--sp-5); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wizard-actions .spacer { flex: 1; }

/* Interne Notizen deutlich abgesetzt */
.intern-block { padding: 12px 14px; border: 1px dashed var(--c-line-strong); border-radius: var(--r-sm); background: #f7f9fb; }
.intern-block .field-help { margin-top: 2px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.tag-intern { color: #5a6b7d; background: #e8edf2; }
.tag .icon { width: 12px; height: 12px; }

/* Leistungsauswahl */
.service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.service-card { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-white); box-shadow: var(--shadow-sm); }
.service-card-head { display: flex; align-items: flex-start; gap: 13px; }
.service-symbol { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: var(--c-blue-600); background: var(--c-blue-50); }
.service-symbol .icon { width: 21px; height: 21px; }
.service-card h3 { margin: 2px 0 4px; }
.service-card p { color: var(--c-muted); font-size: 12px; line-height: 1.45; }
.service-card.saved { border-color: var(--c-success-line); background: #fcfffd; }
.service-card.saved .service-symbol { color: var(--c-success); background: var(--c-success-bg); }
.service-state { display: inline-flex; align-items: center; gap: 6px; color: var(--c-success); font-size: 12px; font-weight: 700; }
.service-state .icon { width: 14px; height: 14px; }
.service-badge { margin-left: auto; flex: 0 0 auto; display: grid; gap: 3px; justify-items: end; text-align: right; }
.service-amount { color: var(--c-ink); font-size: 12px; font-weight: 650; white-space: nowrap; }
.service-card-actions { display: flex; gap: 8px; margin-top: auto; }

/* Kalkulationspanel */
.result-panel { margin-top: var(--sp-4); border: 1px solid var(--c-info-line); border-radius: var(--r-md); overflow: hidden; background: #fbfdff; }
.result-head { padding: 13px 16px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; color: #fff; background: var(--c-blue-600); }
.result-head h3 { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.result-total { font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; }
.result-total small { font-size: 11px; font-weight: 600; opacity: .85; margin-left: 4px; }
.calc-line { padding: 10px 16px; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; border-bottom: 1px solid #e3edf5; font-size: 12.5px; }
.calc-line:last-of-type { border-bottom: 0; }
.calc-line .cl-label { color: var(--c-ink-2); }
.calc-line .cl-cadence { margin-left: 7px; color: var(--c-faint); font-size: 11px; }
.calc-line strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-formula { margin: 2px 0 0; color: var(--c-faint); font-size: 11px; }
.calc-details { border-top: 1px solid #e3edf5; }
.calc-details summary { display: flex; align-items: center; gap: 7px; padding: 10px 16px; color: var(--c-blue-600); font-size: 12px; font-weight: 650; cursor: pointer; list-style: none; }
.calc-details summary::-webkit-details-marker { display: none; }
.calc-details summary .icon { width: 14px; height: 14px; transition: transform .15s; }
.calc-details[open] summary .icon { transform: rotate(180deg); }
.result-warnings { padding: 4px 16px 12px; display: grid; gap: 8px; }

/* Preis-Schritt: errechneter Preis, Anpassung, Preisvorschlag */
.pricing-grid { display: grid; grid-template-columns: minmax(280px, .75fr) minmax(0, 1.25fr); gap: 18px; align-items: stretch; margin-bottom: var(--sp-4); }
.calc-box { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; padding: 30px 24px; text-align: center; color: #fff; background: var(--c-navy-900); border-radius: var(--r-md); box-shadow: var(--shadow-md); }
.cb-caption { color: #9db1c2; font-size: 11px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
#calc-box-rows { display: grid; gap: 10px; width: 100%; }
.cb-row { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.cb-row span { color: #8ba2b6; font-size: 11.5px; font-weight: 600; }
.cb-row strong { color: #fff; font-size: 27px; letter-spacing: -.02em; }
.cb-empty { color: #9db1c2; font-size: 12.5px; }
.cb-note { color: #8ba2b6; font-size: 11px; }
.cb-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; color: #9fc9ec; font-size: 12px; font-weight: 650; }
.cb-link:hover { color: #fff; }
.calc-box :focus-visible { outline-color: #fff; }

.seg-block { display: flex; width: 100%; }
.seg-block label { flex: 1; }
.seg-block span { justify-content: center; }

.deviation-note { margin: 12px 0 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--c-warn-line); border-radius: var(--r-sm); background: var(--c-warn-bg); color: #6d4a08; font-size: 12.5px; }
.deviation-note small { color: #8a6a2f; font-weight: 500; }
.deviation-note strong { font-size: 13.5px; white-space: nowrap; }
.deviation-note .delta-plus { color: #8a4b00; }
.deviation-note .delta-minus { color: var(--c-success); }

.proposed-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 24px; padding: 16px 20px; border: 1px solid var(--c-info-line); border-radius: var(--r-md); background: #f6fafd; box-shadow: var(--shadow-sm); }
.pb-copy strong { display: block; font-size: 14px; }
.pb-copy small { color: var(--c-muted); font-size: 11.5px; }
.pb-amounts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 24px; }
.pa-amount { display: flex; align-items: baseline; gap: 7px; }
.pa-amount strong { color: var(--c-blue-600); font-size: 23px; letter-spacing: -.02em; }
.pa-amount small { color: var(--c-muted); font-size: 11px; }

/* Vorschau & Versand */
.preview-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); gap: 18px; align-items: start; }
/* Bewusst kein border-radius mit overflow:hidden um die PDF-Vorschau:
   Chromium rastert beschnittene iframes sonst unscharf (v. a. bei 125 %/150 % Displayskalierung). */
.pdf-shell { position: relative; max-width: 760px; border: 1px solid var(--c-line); background: #e8ecf0; box-shadow: var(--shadow-sm); }
.pdf-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--c-white); border-bottom: 1px solid var(--c-line); }
.pdf-toolbar h3 { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pdf-toolbar .icon { color: var(--c-blue-500); }
.pdf-frame { display: block; width: 100%; min-height: 580px; border: 0; background: #e8ecf0; }
.pdf-loading { position: absolute; inset: 49px 0 0; display: grid; place-items: center; color: var(--c-muted); background: #eef1f4; font-size: 13px; }
/* Archivierte Versandfassungen */
.revision-list { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--c-line); }
.revision-head { display: flex; align-items: center; gap: 7px; margin: 0 0 8px; color: var(--c-muted); font-size: 11.5px; font-weight: 700; }
.revision-head .icon { width: 14px; height: 14px; }
.revision-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--c-line); border-radius: var(--r-sm); font-size: 12.5px; font-weight: 600; color: var(--c-ink-2); }
.revision-item + .revision-item { margin-top: 6px; }
.revision-item:hover { border-color: var(--c-blue-100); background: var(--c-blue-50); color: var(--c-blue-700); }
.revision-item .icon { width: 15px; height: 15px; flex: 0 0 auto; }
.revision-item small { display: block; margin-top: 1px; color: var(--c-faint); font-size: 11px; font-weight: 500; }

.send-options { display: grid; gap: 10px; margin-top: 4px; }
.note + .send-options { margin-top: 12px; }
.send-options ~ .note { margin-top: 12px; }

/* Texte-Schritt: Aufbau spiegelt das Angebots-PDF */
.doc-sheet { max-width: 860px; margin-bottom: var(--sp-4); padding: 28px 32px 26px; }
.doc-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 2px solid var(--c-red); }
.doc-recipient { display: grid; gap: 1px; color: var(--c-ink); font-size: 13px; }
.doc-recipient span:first-child { font-weight: 650; }
.doc-meta { display: grid; gap: 3px; margin: 0; }
.doc-meta div { display: flex; justify-content: space-between; gap: 18px; min-width: 220px; }
.doc-meta dt { color: var(--c-muted); font-size: 11.5px; }
.doc-meta dd { margin: 0; font-size: 12px; font-weight: 650; }
.doc-title { margin: 0 0 2px; color: var(--c-blue-600); font-size: 19px; font-weight: 750; letter-spacing: -.01em; }
.doc-object { margin: 0 0 14px; color: var(--c-muted); font-size: 12.5px; }
.doc-heading { margin: 24px 0 10px; padding-bottom: 5px; border-bottom: 1px solid var(--c-line); color: var(--c-blue-600); font-size: 14px; font-weight: 750; }
.doc-field { margin-bottom: 0; }
.doc-sheet textarea { min-height: 0; overflow: hidden; resize: none; line-height: 1.55; }
.doc-service { margin-bottom: 18px; }
.doc-service-title { display: flex; align-items: center; gap: 8px; margin: 0 0 7px; font-size: 13px; font-weight: 700; }
.doc-service-title .icon { width: 15px; height: 15px; color: var(--c-blue-500); }
.doc-calc-note { margin: 8px 0 0; color: var(--c-ink-2); font-size: 13px; line-height: 1.55; }
/* Kalkulationsgrundlage: kommt aus der Kalkulation, wird nur angezeigt und nicht bearbeitet. */
.doc-basis { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--c-line-strong); background: #f7fafc; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.doc-basis p { margin: 0; color: var(--c-ink-2); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; }
.doc-basis-head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px !important; color: var(--c-muted); font-size: 11.5px !important; font-weight: 700; }
.doc-basis-head .icon { width: 14px; height: 14px; }
.doc-basis .field-help { display: block; margin-top: 6px; }
.doc-prices { border: 1px solid var(--c-line); border-radius: var(--r-sm); overflow: hidden; font-size: 12.5px; }
.dp-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px 110px; gap: 10px; align-items: baseline; padding: 7px 12px; border-top: 1px solid var(--c-line); }
.dp-row.head { border-top: 0; background: var(--c-blue-50); color: var(--c-blue-700); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.dp-row.total { background: #f7fafc; font-weight: 700; }
.dp-cadence { color: var(--c-muted); font-size: 11.5px; }
.dp-row .num, .dp-row strong:last-child { text-align: right; }
.doc-note { margin: 8px 0 0; color: var(--c-faint); font-size: 11.5px; }
.doc-closing { margin-top: 22px; padding-top: 14px; border-top: 1px dashed var(--c-line-strong); color: var(--c-ink-2); font-size: 13px; }
.doc-closing p { margin: 0 0 10px; }
.doc-signature { color: var(--c-blue-600); font-weight: 750; margin-bottom: 0 !important; }
.doc-owner { margin: 2px 0 0 !important; color: var(--c-muted); font-size: 12px; }
@media (max-width: 640px) {
  .doc-sheet { padding: 18px 16px; }
  .dp-row { grid-template-columns: minmax(0, 1fr) auto; }
  .dp-cadence { display: none; }
}
.ai-box { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--c-blue-100); border-radius: var(--r-sm); background: var(--c-blue-50); }
.ai-box .ai-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; color: var(--c-blue-700); font-size: 12.5px; font-weight: 700; }
.ai-box .ai-head .icon { width: 15px; height: 15px; }
.ai-box p { color: #33586f; font-size: 11.5px; line-height: 1.45; margin-bottom: 10px; }
.ai-controls { display: flex; gap: 8px; }
.ai-controls input { flex: 1; background: #fff; }

/* ============================================================
   Administration
   ============================================================ */
.admin-tabs { display: flex; gap: 4px; margin-bottom: var(--sp-5); border-bottom: 1px solid var(--c-line); overflow-x: auto; }
.admin-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: 8px 8px 0 0; color: var(--c-muted); font-size: 13px; font-weight: 650; white-space: nowrap; }
.admin-tab .icon { width: 16px; height: 16px; }
.admin-tab:hover { color: var(--c-ink); background: #f2f6fa; }
.admin-tab.active { color: var(--c-blue-700); box-shadow: inset 0 -2px 0 var(--c-blue-500); }

.admin-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: var(--sp-4); }
.admin-toolbar .searchbox { flex: 1 1 260px; max-width: 420px; }
.toolbar-spacer { flex: 1; }

.category { margin-bottom: 14px; overflow: hidden; }
.category > summary { padding: 14px 18px; display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; font-weight: 700; font-size: 13.5px; }
.category > summary::-webkit-details-marker { display: none; }
.category > summary .cat-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--c-blue-600); background: var(--c-blue-50); }
.category > summary .cat-icon .icon { width: 17px; height: 17px; }
.category > summary .cat-meta { flex: 1; }
.category > summary .chevron { color: var(--c-muted); transition: transform .15s; }
.category[open] > summary { border-bottom: 1px solid var(--c-line); }
.category[open] > summary .chevron { transform: rotate(180deg); }
.badge-warn { padding: 2px 9px; border-radius: 999px; color: var(--c-warn); background: var(--c-warn-bg); border: 1px solid var(--c-warn-line); font-size: 11px; font-weight: 700; }

.setting-subgroup { padding: 14px 18px 18px; }
.setting-subgroup + .setting-subgroup { border-top: 1px solid #eef2f6; }
.subgroup-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 2px 0 14px; color: var(--c-blue-700); font-size: 11.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.setting-field input.changed, .setting-field select.changed { border-color: var(--c-blue-500); background: #f4faff; }
.surcharge-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 8px; }

.save-bar { position: sticky; bottom: 16px; z-index: 20; margin-top: var(--sp-5); display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: rgba(255, 255, 255, .96); backdrop-filter: blur(4px); box-shadow: var(--shadow-md); }
.save-bar .sb-info { display: flex; align-items: center; gap: 9px; color: var(--c-muted); font-size: 12.5px; }
.save-bar .sb-info .count { color: var(--c-blue-700); font-weight: 700; }

.text-blocks { display: grid; gap: 14px; }
.text-blocks textarea { min-height: 96px; }
.block-usage { color: var(--c-faint); font-size: 11.5px; }

.user-avatar { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--c-blue-500); font-size: 12px; font-weight: 700; }
.users-table td { vertical-align: middle; }
.users-table .field { margin: 0; }
.users-table input, .users-table select { min-height: 36px; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.user-cell .field { flex: 1; min-width: 0; }
tr.user-inactive .user-avatar { background: var(--c-border-soft); }
tr.user-inactive td { background: #fafbfc; }

.audit-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 650; white-space: nowrap; }
.audit-auth { color: #4c5e70; background: #eef1f4; }
.audit-offer { color: var(--c-blue-700); background: var(--c-blue-50); border: 1px solid var(--c-blue-100); }
.audit-admin { color: #6b4d9e; background: #f2edfb; }
.audit-danger { color: var(--c-danger); background: var(--c-danger-bg); }

/* ============================================================
   Toasts, Modale, Ladezustände
   ============================================================ */
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: grid; gap: 10px; max-width: min(400px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid; background: #fff; box-shadow: var(--shadow-md); font-size: 13px; animation: toast-in .22s ease-out; }
.toast .icon { width: 17px; height: 17px; margin-top: 1px; }
.toast p { flex: 1; margin: 0; color: var(--c-ink); line-height: 1.45; }
.toast.success { border-color: var(--c-success-line); }
.toast.success .icon { color: var(--c-success); }
.toast.error { border-color: var(--c-danger-line); }
.toast.error .icon { color: var(--c-danger); }
.toast.info { border-color: var(--c-info-line); }
.toast.info .icon { color: var(--c-info); }
.toast.warning { border-color: var(--c-warn-line); }
.toast.warning .icon { color: var(--c-warn); }
.toast-close { display: grid; place-items: center; width: 26px; height: 26px; margin: -3px -5px 0 0; border-radius: 6px; color: var(--c-faint); }
.toast-close:hover { color: var(--c-ink); background: #f0f3f6; }
.toast-close .icon { width: 14px; height: 14px; margin: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.modal-overlay { position: fixed; inset: 0; z-index: 100; padding: 20px; display: grid; place-items: center; background: rgba(10, 26, 40, .58); animation: fade-in .18s ease-out; }
.modal-card { width: min(480px, 100%); max-height: calc(100vh - 40px); overflow: auto; border-radius: var(--r-lg); background: #fff; box-shadow: var(--shadow-lg); animation: modal-in .2s ease-out; }
.modal-card.wide { width: min(600px, 100%); }
.modal-card.calculation-modal { width: min(760px, 100%); }
.calculation-modal .modal-head > div { min-width: 0; }
.calculation-modal .modal-head h2 { margin-top: 0; }
.calculation-modal .modal-body { padding-top: 16px; }
.calculation-modal .result-panel { margin-top: 0; }
/* Vorher/Nachher-Vergleich über dem Kalkulationsergebnis */
.calc-diff { margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--c-line); border-radius: var(--r-sm); background: #f8fafc; }
.calc-diff.changed { border-color: var(--c-warn-line); background: var(--c-warn-bg); }
.calc-diff-head { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 12.5px; font-weight: 700; color: var(--c-ink-2); }
.calc-diff.changed .calc-diff-head { color: #6d4a08; }
.calc-diff-head .icon { width: 15px; height: 15px; }
.calc-diff-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 14px; align-items: baseline; padding: 4px 0; font-size: 12.5px; }
.calc-diff-row + .calc-diff-row { border-top: 1px solid var(--c-line); }
.calc-diff-row .delta-plus { color: #8a4b00; font-weight: 700; }
.calc-diff-row .delta-minus { color: var(--c-success); font-weight: 700; }
.calc-diff-row .delta-none { color: var(--c-faint); }
.feedback-modal textarea { min-height: 180px; }
.feedback-modal .field + .field { margin-top: 14px; }
.feedback-counter { display: block; margin-top: 4px; color: var(--c-faint); font-size: 11px; text-align: right; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 0; }
.modal-head .modal-icon { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; }
.modal-icon.danger { color: var(--c-danger); background: var(--c-danger-bg); }
.modal-icon.warn { color: var(--c-warn); background: var(--c-warn-bg); }
.modal-icon.info { color: var(--c-blue-600); background: var(--c-blue-50); }
.modal-head h2 { font-size: 16px; margin-top: 8px; }
.modal-body { padding: 10px 20px 4px; color: var(--c-ink-2); font-size: 13.5px; line-height: 1.55; }
.modal-body p + p { margin-top: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 20px 20px; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.loading { min-height: 240px; display: grid; place-items: center; color: var(--c-muted); text-align: center; }
.spinner { width: 30px; height: 30px; margin: 0 auto 12px; border: 3px solid var(--c-blue-100); border-top-color: var(--c-blue-500); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { position: relative; overflow: hidden; border-radius: 6px; background: #e8edf2; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 13px; margin: 8px 0; }
.sk-title { height: 22px; width: 40%; margin: 16px 0 14px; }
.sk-block { height: 90px; border-radius: var(--r-md); }
.sk-block-sm { height: 44px; flex: 1; border-radius: var(--r-sm); }
.sk-row { display: grid; grid-template-columns: 2fr 2fr 1fr 1fr 1fr; gap: 16px; padding: 14px 16px; border-bottom: 1px solid #eef2f6; }
.sk-row .skeleton { height: 13px; }

/* ============================================================
   Responsiv
   ============================================================ */
@media (max-width: 1150px) {
  .pricing-grid, .preview-layout, .service-layout, .dashboard-charts { grid-template-columns: 1fr; }
  .guide-panel { position: static; }
  .calc-box { padding: 22px 20px; }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .step { flex: 1 0 auto; grid-template-columns: 26px auto; padding: 9px 10px; font-size: 12px; }
  .step .step-dot { width: 26px; height: 26px; font-size: 11px; }
  .step small { display: none; }
}

@media (max-width: 640px) {
  .step { grid-template-columns: 26px; }
  .step .step-text { display: none; }
  .stepper-progress { display: block; margin-bottom: 10px; color: var(--c-muted); font-size: 12.5px; font-weight: 600; }
  .stepper-progress .bar { height: 4px; margin-top: 6px; border-radius: 999px; background: #e2e9ef; overflow: hidden; }
  .stepper-progress .bar span { display: block; height: 100%; width: var(--progress, 20%); border-radius: 999px; background: var(--c-blue-500); transition: width .25s; }
}

@media (max-width: 780px) {
  .login-page { align-items: start; padding-top: 48px; }

  .app-shell { display: block; }
  .sidebar { transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .workspace { width: 100%; }
  .topbar .mobile-menu { display: inline-grid; }
  .topbar { min-height: 64px; padding: 10px 16px; }
  .topbar-user { padding-left: 10px; margin-left: 0; }
  .topbar-user .tu-meta { display: none; }
  .topbar-actions .optional-label { display: none; }
  .topbar-actions .button { padding-inline: 12px; }
  .topbar-actions .status { display: none; }
  .dirty-indicator span + * { display: none; }
  .dirty-indicator { padding: 5px 9px; }
  .content { padding: 18px 16px 64px; }
  .hero-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .form-grid, .form-grid-3, .service-grid, .settings-grid, .checks { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .pdf-frame { min-height: 460px; }
  .save-bar { bottom: 10px; flex-direction: column; align-items: stretch; }
  .save-bar .button { width: 100%; }
  .wizard-actions { flex-wrap: wrap; }
  .wizard-actions .button { flex: 1 1 auto; }

  /* Tabellen werden zu Karten */
  table.stack thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack, table.stack tbody { display: block; }
  table.stack tr { display: block; margin: 10px 12px; padding: 6px 2px; border: 1px solid var(--c-line); border-radius: var(--r-sm); background: #fff; }
  table.stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 8px 12px; border-bottom: 1px solid #eef2f6; text-align: right; }
  table.stack td:last-child { border-bottom: 0; }
  table.stack td::before { content: attr(data-label); flex: 0 0 auto; color: var(--c-faint); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-align: left; }
  table.stack td.num { text-align: right; }
  table.stack td strong, table.stack td small { text-align: right; }
}

@media (max-width: 520px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric strong { font-size: 22px; }
  .choice-grid { grid-template-columns: 1fr; }
  .chip { padding: 5px 11px; }
}

/* ============================================================
   Bewegung reduzieren & Druck
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .skeleton::after { display: none; }
}

@media print {
  .sidebar, .topbar, .toast-region, .skip-link, .sidebar-backdrop { display: none !important; }
  .workspace { grid-column: 1; }
  .content { padding: 0; max-width: none; }
  .card, .metric { box-shadow: none; }
}
