/*
 * MitBlick Energie – Gestaltung nach der MitBlick-Finance-Vorgabe (wie das Vertriebsportal):
 * weiße Flächen, helle Karten (#FAF8F2), feine goldene Linien (#D6B345), dunkle serifenlose Schrift
 * (#202428, Nebentext #50555A). Dunkles Design per Umschalter. Serifenschrift nur im Logo.
 * Schriften lokal (OFL-Lizenzen in assets/fonts), keine externen Anfragen.
 */

@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/manrope-latin.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400 800;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/manrope-latin-ext.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400 800;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Playfair Display";
  src: url("assets/fonts/playfair-display-latin.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 500 800;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("assets/fonts/vazirmatn-arabic.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400 800;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

/* ------------------------------------------------------------------------------------------------
   Farben und Maße
   ------------------------------------------------------------------------------------------------ */
:root {
  color-scheme: light;
  --font: "Manrope", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-fa: "Vazirmatn", "Manrope", Tahoma, "Segoe UI", sans-serif;
  --font-logo: "Playfair Display", Georgia, "Times New Roman", serif;
  --bg: #ffffff;
  --surface: #ffffff;
  --card: #faf8f2;
  --card-strong: #f3eee1;
  --line: #e8dfc2;
  --line-strong: #dccf9f;
  --gold: #d6b345;
  --gold-hover: #c4a23a;
  --gold-ink: #7e6010;
  --gold-soft: rgba(214, 179, 69, .12);
  --text: #202428;
  --text-soft: #33373b;
  --muted: #50555a;
  --placeholder: #7b7f84;
  --hairline: rgba(32, 36, 40, .08);
  --field: #ffffff;
  --success: #226b50;
  --success-soft: #e7f2ec;
  --warning: #7d550c;
  --warning-soft: #fbf1d8;
  --danger: #a2453b;
  --danger-soft: #fbece9;
  --info: #2f6199;
  --info-soft: #eaf0f8;
  --test-bg: #ffd84d;
  --test-ink: #2b2200;
  --test-soft: #fff3b8;
  --shadow: 0 24px 60px -36px rgba(32, 36, 40, .3);
  --shadow-dialog: 0 30px 80px rgba(32, 36, 40, .22);
  --backdrop: rgba(32, 36, 40, .45);
  --desk: #f3eee1;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 256px;
  --topbar-h: 64px;
  --band-h: 0px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080a0d;
  --surface: #11151c;
  --card: #0c0f14;
  --card-strong: #171c25;
  --line: rgba(215, 179, 62, .24);
  --line-strong: rgba(215, 179, 62, .4);
  --gold: #d7b33e;
  --gold-hover: #e3c25e;
  --gold-ink: #f0d98b;
  --gold-soft: rgba(215, 179, 62, .1);
  --text: #f4f1e8;
  --text-soft: #d8d2c5;
  --muted: #aaa394;
  --placeholder: #777269;
  --hairline: rgba(255, 255, 255, .08);
  --field: #0b0d11;
  --success: #9bd9a5;
  --success-soft: rgba(69, 151, 91, .16);
  --warning: #edc56f;
  --warning-soft: rgba(215, 179, 62, .14);
  --danger: #ffaaa0;
  --danger-soft: rgba(191, 71, 61, .18);
  --info: #9fc4ef;
  --info-soft: rgba(95, 145, 210, .16);
  --test-soft: rgba(255, 216, 77, .16);
  --shadow: 0 30px 76px -34px rgba(0, 0, 0, .9);
  --shadow-dialog: 0 38px 100px rgba(0, 0, 0, .72);
  --backdrop: rgba(0, 0, 0, .6);
  --desk: #05070a;
}

:root.test-mode { --band-h: 38px; }

/* ------------------------------------------------------------------------------------------------
   Grundlagen
   ------------------------------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
:lang(fa), [lang="fa"] { font-family: var(--font-fa); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--gold-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(214, 179, 69, .75); outline-offset: 2px; }
::selection { background: var(--gold); color: #fff; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.hint { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.hint.is-ok { color: var(--success); }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow::before { content: ""; display: inline-block; width: 18px; height: 2px; margin: 0 9px 0 0; vertical-align: middle; background: var(--gold); }
:root[dir="rtl"] .eyebrow::before, [dir="rtl"] .eyebrow::before { margin: 0 0 0 9px; }
.brand-name { display: block; font-family: var(--font-logo); font-size: 21px; font-weight: 600; line-height: 1; letter-spacing: .01em; color: var(--text); }
.brand-name + small { display: block; margin-top: 3px; color: var(--gold-ink); font-size: 9.5px; font-weight: 800; letter-spacing: .32em; text-transform: uppercase; }

/* ------------------------------------------------------------------------------------------------
   Knöpfe, Felder, Auswahl
   ------------------------------------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; line-height: 1.2;
  text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover:not(:disabled) { border-color: var(--gold); background: var(--card); }
.btn:disabled { opacity: .55; }
.btn-primary { border-color: var(--gold); background: var(--gold); color: #202428; }
.btn-primary:hover:not(:disabled) { border-color: var(--gold-hover); background: var(--gold-hover); }
.btn-secondary { background: var(--surface); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover:not(:disabled) { border-color: var(--line); }
.btn-danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8c3a31; border-color: #8c3a31; }
.btn-danger-text { color: var(--danger); }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 13px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid currentColor; border-color: #202428 #202428 transparent transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--gold-ink); font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--muted); }
.icon-btn:hover { border-color: var(--line); background: var(--card); color: var(--text); }
.icon-btn[aria-pressed="true"] { border-color: var(--gold); background: var(--card); color: var(--gold-ink); }
.icon-btn-sm { width: 28px; height: 28px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 700; color: var(--text-soft); }
.field .optional { color: var(--muted); font-weight: 500; }
.input {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--field); color: var(--text); font-size: 15px; line-height: 1.3;
}
.input::placeholder { color: var(--placeholder); }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(214, 179, 69, .25); }
.input:disabled { background: var(--card); color: var(--muted); }
.input[aria-invalid="true"], [aria-invalid="true"] > .input { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(162, 69, 59, .12); }
select.input { padding-right: 34px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
.input-code { max-width: 220px; font-size: 24px; font-weight: 800; letter-spacing: .32em; text-align: center; font-variant-numeric: tabular-nums; }
.input-iban, .input-link { font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.input-with-suffix { position: relative; display: flex; align-items: stretch; }
.input-with-suffix .input { padding-right: 86px; }
.input-suffix { position: absolute; top: 0; right: 12px; bottom: 0; display: flex; align-items: center; color: var(--muted); font-size: 13px; pointer-events: none; }
.input-narrow { max-width: 160px; }
.field-error { color: var(--danger); font-size: 12.5px; font-weight: 600; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { flex: 0 0 auto; width: 19px; height: 19px; margin: 1px 0 0; accent-color: var(--gold); }
.check-confirm { padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.check-confirm:has(input:checked) { border-color: var(--gold); background: var(--card); }
.check-confirm small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

.segmented { min-width: 0; margin: 0; padding: 0; border: 0; }
.segmented-legend { margin-bottom: 5px; padding: 0; font-size: 13px; font-weight: 700; color: var(--text-soft); }
.segmented-options { display: flex; flex-wrap: wrap; gap: 0; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); }
.segmented-option { position: relative; flex: 1 1 auto; }
.segmented-option { cursor: pointer; }
.segmented-option input { position: absolute; top: 50%; left: 50%; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.segmented-option span { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 12px; border-radius: 4px; color: var(--muted); font-size: 14px; font-weight: 700; text-align: center; }
.segmented-option input:checked + span { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--gold); }
.segmented-option input:focus-visible + span { outline: 3px solid rgba(214, 179, 69, .75); outline-offset: 1px; }
.segmented-sm .segmented-option span { min-height: 30px; font-size: 13px; }

.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 22px; padding: 0 8px; border: 1px solid transparent; border-radius: 999px; font-size: 11.5px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; vertical-align: middle; }
.chip-neutral { background: var(--card-strong); color: var(--text-soft); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-warning { background: var(--warning-soft); color: var(--warning); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-muted { background: transparent; border-color: var(--line); color: var(--muted); }
.chip-test { background: var(--test-bg); color: var(--test-ink); border-color: rgba(43, 34, 0, .2); letter-spacing: .08em; }
.chip-row { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip-btn { min-width: 42px; min-height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 700; }
.chip-btn[aria-pressed="true"] { border-color: var(--gold); background: var(--gold); color: #202428; }
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------------------------------------------
   Testband, Start, Meldungen
   ------------------------------------------------------------------------------------------------ */
.test-band {
  position: sticky; z-index: 60; top: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 7px 16px; background: var(--test-bg); color: var(--test-ink);
  font-size: 13.5px; font-weight: 800; letter-spacing: .01em; text-align: center;
  background-image: repeating-linear-gradient(135deg, rgba(0, 0, 0, .05) 0 12px, transparent 12px 24px);
}
.sign-page .test-band { min-height: 38px; }
.boot { display: grid; place-items: center; align-content: center; gap: 14px; min-height: 100vh; color: var(--muted); }
.spinner { display: inline-block; width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px 16px; color: var(--muted); }
.toasts { position: fixed; z-index: 2000; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--success); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-dialog); animation: toast-in .18s ease-out; }
.toast-error { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--info); }
.toast > .icon { margin-top: 2px; color: var(--success); }
.toast-error > .icon { color: var(--danger); }
.toast-info > .icon { color: var(--info); }
.toast-body { display: flex; flex: 1; flex-direction: column; gap: 2px; font-size: 13.5px; }
.toast-body strong { font-size: 14px; }
.trace-id { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.notice { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); box-shadow: inset 3px 0 0 var(--gold); font-size: 14px; }
.notice > .icon { margin-top: 1px; color: var(--gold-ink); }
.notice-info { box-shadow: inset 3px 0 0 var(--info); }
.notice-success { box-shadow: inset 3px 0 0 var(--success); }
.notice-success > .icon { color: var(--success); }
.notice-warning { background: var(--warning-soft); box-shadow: inset 3px 0 0 var(--warning); }
.notice-error { background: var(--danger-soft); color: var(--danger); box-shadow: inset 3px 0 0 var(--danger); font-weight: 600; }
.notice-test { background: var(--test-soft); box-shadow: inset 3px 0 0 var(--test-bg); }
.notice-advisor { background: var(--gold-soft); border-style: dashed; border-color: var(--gold); box-shadow: none; font-size: 13px; }
.form-error { color: var(--danger); font-size: 13.5px; font-weight: 600; }

/* ------------------------------------------------------------------------------------------------
   Anmeldung
   ------------------------------------------------------------------------------------------------ */
.auth-screen { display: grid; grid-template-columns: minmax(380px, 1.05fr) minmax(420px, .95fr); min-height: 100vh; background: var(--bg); }
.auth-screen-simple { grid-template-columns: 1fr; }
.auth-visual {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 48px clamp(32px, 5vw, 80px);
  border-right: 1px solid var(--line); overflow: hidden;
  background-color: var(--bg);
  background-image: linear-gradient(90deg, rgba(255, 255, 255, .98) 0%, rgba(255, 255, 255, .93) 55%, rgba(255, 255, 255, .7) 100%), url("assets/mb-finance-office.jpeg");
  background-position: center; background-size: cover;
}
:root[data-theme="dark"] .auth-visual { background-image: linear-gradient(90deg, rgba(5, 6, 5, .96) 0%, rgba(5, 6, 5, .86) 55%, rgba(5, 6, 5, .6) 100%), url("assets/mb-finance-office.jpeg"); }
.auth-visual::after { content: ""; position: absolute; right: -8vw; bottom: -16vw; width: min(46vw, 640px); aspect-ratio: 1; border: 1px solid rgba(214, 179, 69, .4); border-radius: 50%; pointer-events: none; }
.auth-brand, .auth-card-brand { display: flex; align-items: center; gap: 12px; }
.auth-message { max-width: 620px; }
.auth-message h2 { font-size: clamp(34px, 3.6vw, 56px); font-weight: 750; line-height: 1.1; letter-spacing: -.03em; }
.auth-message p:last-child { max-width: 520px; margin-top: 18px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.auth-trust { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.auth-trust li { display: flex; align-items: center; gap: 8px; }
.auth-trust .icon { color: var(--gold-ink); }
.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 40px 24px; }
.auth-card { display: flex; flex-direction: column; gap: 16px; width: min(440px, 100%); padding: 32px; border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--radius-lg); background: var(--surface); }
.auth-screen-simple .auth-card { margin: 8vh auto; }
.auth-card h1 { font-size: 28px; font-weight: 750; letter-spacing: -.02em; }
.auth-card .auth-card-brand { margin-bottom: 6px; }
.auth-shield { width: 56px; height: 56px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-foot { font-size: 13px; }
.enroll-steps { margin: 0; padding-left: 20px; color: var(--text-soft); font-size: 14px; }
.enroll-steps li + li { margin-top: 4px; }
.enroll-qr { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.qr-canvas { width: 176px; height: 176px; border-radius: 6px; image-rendering: pixelated; background: #fff; }
.enroll-secret { display: flex; flex: 1 1 160px; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 13px; }
.enroll-secret code { padding: 6px 8px; border: 1px dashed var(--line-strong); border-radius: 4px; background: var(--surface); font-size: 14px; font-weight: 700; letter-spacing: .06em; word-break: break-all; }
.demo-box { width: min(440px, 100%); padding: 14px 16px; border: 1px dashed var(--gold); border-radius: var(--radius); background: var(--gold-soft); font-size: 13px; }
.demo-box ul { margin: 6px 0 0; padding-left: 18px; }

/* ------------------------------------------------------------------------------------------------
   App-Rahmen
   ------------------------------------------------------------------------------------------------ */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: calc(100vh - var(--band-h)); }
.sidebar {
  position: sticky; top: var(--band-h); z-index: 40; display: flex; flex-direction: column; height: calc(100vh - var(--band-h));
  border-right: 1px solid var(--line); background: var(--surface);
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; min-height: var(--topbar-h); padding: 0 18px; border-bottom: 1px solid var(--line); }
.sidebar-brand .brand-copy { flex: 1; }
.sidebar-close { display: none; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px; }
.nav-label { display: flex; align-items: center; gap: 10px; margin: 14px 8px 6px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.nav-label:first-child { margin-top: 4px; }
.nav-label::after { content: ""; flex: 1; height: 1px; background: rgba(214, 179, 69, .55); }
.nav-item { position: relative; display: flex; align-items: center; gap: 11px; height: 38px; margin: 2px 0; padding: 0 10px; border-radius: var(--radius-sm); color: var(--text-soft); font-size: 14.5px; font-weight: 650; text-decoration: none; }
.nav-item .icon { color: var(--muted); }
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.is-active { background: var(--card); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.nav-item.is-active .icon { color: var(--gold-ink); }
.nav-item.is-active::before { content: ""; position: absolute; left: -12px; width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--gold); }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid var(--line); }
.sidebar-note { color: var(--muted); font-size: 12px; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 75; background: var(--backdrop); }

.app-main { display: flex; min-width: 0; flex-direction: column; }
.topbar {
  position: sticky; top: var(--band-h); z-index: 30; display: flex; align-items: center; gap: 12px; min-height: var(--topbar-h);
  padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .97);
}
:root[data-theme="dark"] .topbar { background: rgba(8, 10, 13, .94); }
.menu-btn { display: none; }
.page-title { flex: 1; min-width: 0; overflow: hidden; font-size: 19px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: block; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--gold); border-radius: 50%; background: var(--card); color: var(--gold-ink); font-size: 12px; font-weight: 800; }
.user-text { display: flex; flex-direction: column; line-height: 1.15; }
.user-text strong { font-size: 13px; }
.user-text small { color: var(--muted); font-size: 11.5px; }

.advisor-switch { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px 0 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; user-select: none; }
.advisor-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 32px; height: 18px; border-radius: 999px; background: var(--line-strong); transition: background .15s; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.advisor-switch input:checked + .switch-track { background: var(--gold); }
.advisor-switch input:checked + .switch-track .switch-thumb { transform: translateX(14px); }
.advisor-switch input:focus-visible + .switch-track { outline: 3px solid rgba(214, 179, 69, .75); outline-offset: 2px; }
.advisor-switch.is-on { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-ink); }

.main { width: 100%; max-width: 1320px; padding: 26px 28px 72px; }
.main:focus { outline: none; }
.page { display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--gold); }
.page-head h2 { font-size: clamp(24px, 2.2vw, 30px); font-weight: 750; letter-spacing: -.02em; }
.page-head .muted { margin-top: 6px; max-width: 70ch; }
.panel { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel-head { margin-bottom: 4px; }
.panel-head h2 { font-size: 18px; font-weight: 750; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 12px 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 44px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--card); text-align: center; }
.empty-state .icon { width: 26px; height: 26px; color: var(--gold-ink); }
.empty-state p { max-width: 52ch; color: var(--muted); }
.empty-state .btn { margin-top: 6px; }
.plain-list { margin: 0; padding-left: 18px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; text-decoration: none; }
.back-link:hover { color: var(--text); }

/* Tabellen */
.table-wrap { position: relative; width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { padding: 11px 12px; border-bottom: 1px solid var(--gold); background: var(--card); color: var(--text); font-size: 12px; font-weight: 800; letter-spacing: .03em; text-align: left; white-space: nowrap; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--hairline); color: var(--text-soft); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--card); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .strong { color: var(--text); font-weight: 800; }
.data-table .is-positive { color: var(--success); font-weight: 700; }
.data-table .is-negative { color: var(--danger); }
.data-table tr.is-selected td { background: var(--gold-soft); }
.data-table tr.is-best td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.cell-title { display: block; color: var(--text); font-weight: 700; }
.cell-sub { display: block; color: var(--muted); font-size: 12.5px; }
.cell-badges { display: flex; gap: 4px; margin-top: 3px; }
.row-link { color: var(--text); font-weight: 800; text-decoration-color: var(--gold); text-underline-offset: 3px; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.actions-cell { width: 1%; }
.advisor-col { background: var(--gold-soft); }
.list-meta { min-height: 20px; font-size: 13px; }
.list-foot { display: flex; justify-content: center; }
.list-area { min-height: 80px; }

/* Schlüssel-Wert-Listen */
.kv { display: grid; grid-template-columns: minmax(120px, 42%) 1fr; margin: 0; font-size: 14px; }
.kv dt, .kv dd { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--hairline); }
.kv dt { padding-right: 12px; color: var(--muted); }
.kv dd { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }

/* ------------------------------------------------------------------------------------------------
   Tarifrechner
   ------------------------------------------------------------------------------------------------ */
.calc-layout { display: grid; grid-template-columns: minmax(330px, 380px) minmax(0, 1fr); align-items: start; gap: 22px; }
.calc-form { position: sticky; top: calc(var(--band-h) + var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - var(--band-h) - var(--topbar-h) - 32px); overflow-y: auto; }
.grid-plz { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; }
.grid-street { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; }
.location-note { margin-top: -8px; }
.location-note:empty { display: none; }
.location-note.is-error { color: var(--danger); font-weight: 600; }
.helper-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: -4px; }
.helper-label { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.fold { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
.fold > summary { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--gold-ink); border-bottom: 2px solid var(--gold-ink); transform: rotate(-45deg); transition: transform .15s; }
.fold[open] > summary::before { transform: rotate(45deg); }
.fold-body { display: flex; flex-direction: column; gap: 12px; padding: 4px 12px 14px; }

.calc-results { display: flex; min-width: 0; flex-direction: column; gap: 14px; container: results / inline-size; }
.calc-results.is-loading { opacity: .6; pointer-events: none; }
.calc-intro { display: flex; flex-direction: column; gap: 10px; padding: 28px; background: var(--card); }
.calc-intro h2 { font-size: 26px; font-weight: 750; }
.intro-points { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 0; padding: 0; list-style: none; }
.intro-points li { display: flex; gap: 10px; color: var(--text-soft); }
.intro-points .icon { margin-top: 2px; color: var(--gold-ink); }
.results-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--gold); }
.results-head h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 22px; font-weight: 750; }
.results-meta { margin-top: 4px; font-size: 13.5px; }
.price-basis { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 4px; background: var(--card-strong); font-size: 12.5px; font-weight: 700; }
.view-toggle { display: flex; gap: 4px; }
.stale-note { align-items: center; flex-wrap: wrap; }
.stale-note span { flex: 1 1 240px; }

.tariff-list { display: flex; flex-direction: column; gap: 12px; }
.tariff-card { display: grid; grid-template-columns: minmax(0, 1fr) 250px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.tariff-card.is-best { box-shadow: inset 4px 0 0 var(--gold); }
.tariff-card.is-selected { border-color: var(--gold); background: var(--card); }
.tariff-main { display: flex; min-width: 0; flex-direction: column; gap: 4px; padding: 16px 18px 16px 22px; }
.tariff-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.rank { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold-ink); font-size: 12px; font-weight: 800; }
.best-label { color: var(--gold-ink); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.select-check { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; padding: 4px 10px 4px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.select-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--gold); }
.select-check:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-ink); }
.select-check:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.tariff-table .select-check { margin: 0; padding: 4px; border: 0; background: none; }
.supplier { color: var(--muted); font-size: 13px; font-weight: 700; }
.tariff-name { font-size: 18px; font-weight: 750; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; min-height: 4px; margin: 4px 0 6px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px 16px; margin: 6px 0 0; padding-top: 12px; border-top: 1px solid var(--hairline); }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 1px 0 0; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tariff-side { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 16px 18px; border-left: 1px solid var(--line); background: var(--card); }
.cost-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.cost { font-size: 27px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.installment { color: var(--text-soft); font-size: 13px; }
.savings { display: inline-flex; align-items: center; gap: 5px; margin: 4px 0 6px; font-size: 13px; font-weight: 800; }
.savings.is-positive { color: var(--success); }
.savings.is-negative { color: var(--danger); font-weight: 700; }
.tariff-side .btn { margin-top: 8px; }
.advisor-box { margin: 6px 0 2px; padding: 9px 10px; border: 1px dashed var(--gold); border-radius: var(--radius-sm); background: var(--gold-soft); }
.advisor-kicker { display: block; margin-bottom: 4px; color: var(--gold-ink); font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.advisor-box dl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; }
.advisor-box dt { color: var(--muted); font-size: 11.5px; }
.advisor-box dd { margin: 0; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.advisor-note { margin-top: 6px; color: var(--gold-ink); font-size: 12px; }
/* Schmale Ergebnisspalte (z. B. 1280 px Bildschirmbreite oder Tablet): Kostenblock unter die Tarifangaben */
@container results (max-width: 660px) {
  .tariff-card { grid-template-columns: minmax(0, 1fr); }
  .tariff-side { border-top: 1px solid var(--line); border-left: 0; }
  .tariff-side .btn { max-width: 320px; }
}
.selection-bar {
  position: sticky; bottom: 16px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px 12px 18px; border-radius: var(--radius); background: #202428; color: #fff; box-shadow: var(--shadow-dialog);
}
.selection-bar .btn-ghost { color: #fff; }
.selection-bar .btn-ghost:hover:not(:disabled) { border-color: rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .08); }
.selection-actions { display: flex; gap: 8px; }

/* ------------------------------------------------------------------------------------------------
   Auftrag erfassen und Detail
   ------------------------------------------------------------------------------------------------ */
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; align-items: start; gap: 20px; }
.order-form { display: flex; flex-direction: column; gap: 22px; }
.order-context { position: sticky; top: calc(var(--band-h) + var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: 8px; background: var(--card); }
.order-context h3 { font-size: 18px; font-weight: 750; }
.form-section { display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--hairline); }
.form-section h3 { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 750; }
.step-number { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold-ink); font-size: 13px; font-weight: 800; }
.sub-block { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
.language-row { max-width: 460px; }
/* Platz für die Prüfmeldung ist immer reserviert, damit beim Verlassen des IBAN-Felds nichts springt. */
.iban-status { display: block; min-height: 18px; margin-top: -6px; color: var(--muted); font-size: 12.5px; }
.iban-status.is-ok { color: var(--success); font-weight: 700; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.detail-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--gold); }
.detail-head h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: clamp(22px, 2vw, 28px); font-weight: 750; font-variant-numeric: tabular-nums; }
.detail-head .muted { margin-top: 6px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; align-items: start; }
.detail-card { display: flex; flex-direction: column; gap: 10px; }
.detail-card h3 { font-size: 15px; font-weight: 800; letter-spacing: .01em; }
.detail-lead { font-size: 15px; }
.detail-advisor { border-style: dashed; border-color: var(--gold); background: var(--gold-soft); }
.signature-image { width: 100%; max-width: 420px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; display: flex; gap: 12px; padding: 0 0 14px 2px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; top: 14px; bottom: 0; left: 8px; width: 1px; background: var(--line-strong); }
.timeline li:last-child::before { display: none; }
.timeline-dot { position: relative; z-index: 1; flex: 0 0 auto; width: 13px; height: 13px; margin-top: 4px; border: 2px solid var(--surface); border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 1px var(--line-strong); }
.tone-success .timeline-dot { background: var(--success); }
.tone-info .timeline-dot { background: var(--info); }
.tone-warning .timeline-dot { background: var(--gold); }
.tone-danger .timeline-dot { background: var(--danger); }
.timeline-note { margin-top: 2px; color: var(--muted); font-size: 13px; }

/* Filter */
.filter-bar { display: grid; grid-template-columns: minmax(200px, 1.6fr) repeat(auto-fit, minmax(140px, 1fr)); align-items: end; gap: 12px; padding: 14px 16px; }
.filter-actions { display: flex; align-items: center; min-height: 42px; }

/* ------------------------------------------------------------------------------------------------
   Dialoge
   ------------------------------------------------------------------------------------------------ */
.dialog { width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-dialog); }
.dialog[open] { display: flex; flex-direction: column; }
.dialog::backdrop { background: var(--backdrop); }
.dialog-narrow { width: min(540px, calc(100vw - 32px)); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 21px; font-weight: 750; }
.dialog-head .muted { margin-top: 4px; font-size: 13.5px; }
.dialog-head .eyebrow { margin-bottom: 4px; }
.dialog-body { display: flex; flex-direction: column; gap: 14px; padding: 16px 20px; overflow-y: auto; }
.dialog-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); background: var(--card); }
.dialog-form { display: flex; flex-direction: column; gap: 12px; }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; min-width: 0; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-share { flex: 1 1 120px; }
.btn-whatsapp { border-color: #1f9d55; color: #16743e; }
:root[data-theme="dark"] .btn-whatsapp { color: #7ddc9f; }

/* Unterschrift auf dem Bildschirm: deckender Hintergrund, damit nichts von der Seite (z. B. Beratermodus)
   hinter dem Dialog zu sehen ist. */
.dialog-signature { width: min(780px, calc(100vw - 24px)); }
.dialog-signature::backdrop { background: var(--bg); }
.signature-summary { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
.confirmations { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; border: 0; }
.confirmations legend { margin-bottom: 8px; padding: 0; font-size: 14px; font-weight: 800; }
.signature-field { display: flex; flex-direction: column; gap: 6px; }
.signature-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--text-soft); }
.signature-canvas {
  display: block; width: 100%; height: 210px; border: 2px dashed var(--line-strong); border-radius: var(--radius); cursor: crosshair; touch-action: none;
  background-color: #fff;
  background-image: linear-gradient(to right, transparent 5%, #cdbf8f 5%, #cdbf8f 95%, transparent 95%);
  background-size: 100% 1px; background-position: 0 76%; background-repeat: no-repeat;
}

/* ------------------------------------------------------------------------------------------------
   Angebot: A4-Ansicht (Bildschirm) – das Blatt bleibt in beiden Designs „Papier“
   ------------------------------------------------------------------------------------------------ */
.print-page { display: flex; flex-direction: column; gap: 14px; }
.print-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.print-toolbar-info { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.sheet-desk { padding: 28px; border-radius: var(--radius); background: var(--desk); overflow-x: auto; }
.a4-sheet {
  --sheet-gold: #d6b345; --sheet-ink: #202428; --sheet-muted: #50555a; --sheet-card: #faf8f2; --sheet-line: #e8dfc2;
  width: 210mm; min-height: 297mm; margin: 0 auto; padding: 15mm 16mm 14mm; background: #fff; color: var(--sheet-ink);
  box-shadow: 0 20px 50px -30px rgba(0, 0, 0, .45); font-size: 10.5pt; line-height: 1.45;
  display: flex; flex-direction: column; gap: 5mm;
}
.a4-sheet a { color: inherit; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8mm; padding-bottom: 4mm; border-bottom: 2px solid var(--sheet-gold); }
.sheet-brand { display: flex; align-items: center; gap: 4mm; }
.sheet-brand img { width: 15mm; height: 15mm; }
.sheet-brand .brand-name { color: var(--sheet-ink); font-size: 20pt; }
.sheet-brand small { color: #7e6010; }
.sheet-brand-sub { display: block; margin-top: 1.5mm; color: var(--sheet-muted); font-size: 8.5pt; }
.sheet-meta { display: grid; grid-template-columns: auto auto; gap: 1mm 5mm; margin: 0; font-size: 9pt; }
.sheet-meta div { display: contents; }
.sheet-meta dt { color: var(--sheet-muted); }
.sheet-meta dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.sheet-test { display: flex; align-items: center; gap: 2mm; padding: 2mm 3mm; border: 1px solid #c9a800; background: #fff3b8; color: #2b2200; font-weight: 800; }
.sheet-title { font-size: 20pt; font-weight: 750; letter-spacing: -.02em; }
.sheet-lead { margin-top: -3mm; color: var(--sheet-muted); font-size: 12pt; }
.sheet-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2mm 8mm; margin: 0; padding: 3mm 4mm; border: 1px solid var(--sheet-line); background: var(--sheet-card); }
.sheet-facts div { display: flex; flex-direction: column; }
.sheet-facts dt { color: var(--sheet-muted); font-size: 8.5pt; }
.sheet-facts dd { margin: 0; font-weight: 700; }
.compare-wrap { position: relative; max-width: 100%; overflow-x: auto; }
.compare-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 9.8pt; }
.compare-table th, .compare-table td { padding: 2mm 2.5mm; border-bottom: 1px solid var(--sheet-line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.compare-table thead th { border-bottom: 2px solid var(--sheet-gold); font-size: 8.5pt; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--sheet-muted); }
.compare-table tbody th { width: 30%; color: var(--sheet-muted); font-weight: 600; }
.compare-table .is-best { background: var(--sheet-card); }
.compare-table thead .is-best { box-shadow: inset 0 3px 0 var(--sheet-gold); }
.compare-index { display: block; }
.compare-table .best-label { display: block; margin-top: 1mm; color: #7e6010; font-size: 7.5pt; }
.compare-table .row-cost td, .compare-table .row-cost th { padding-top: 2.6mm; padding-bottom: 2.6mm; }
.sheet-cost { font-size: 12.5pt; font-weight: 800; }
.compare-table .row-savings td { color: #226b50; font-weight: 700; }
.compare-actions td, .compare-actions th { border-bottom: 0; padding-top: 3mm; }
.compare-table .chip-test { font-size: 7pt; min-height: 0; padding: 0 1.5mm; }
.sheet-price-note { color: var(--sheet-muted); font-size: 9pt; }
.sheet-summary { display: flex; flex-direction: column; gap: 1.6mm; padding: 4mm 5mm; border: 1px solid var(--sheet-line); border-left: 3px solid var(--sheet-gold); background: var(--sheet-card); font-size: 10pt; }
.sheet-summary.is-rtl { border-left: 1px solid var(--sheet-line); border-right: 3px solid var(--sheet-gold); font-family: var(--font-fa); font-size: 10.5pt; line-height: 1.9; }
.sheet-summary h2 { font-size: 12pt; font-weight: 800; }
.sheet-summary ul { margin: 0; padding-inline-start: 5mm; }
.sheet-summary li.is-best { font-weight: 700; }
.sheet-summary bdi.value { font-weight: 700; }
.sheet-small { color: var(--sheet-muted); font-size: 8.8pt; }
.sheet-contact { display: flex; flex-direction: column; gap: 1mm; padding-top: 3mm; border-top: 1px solid var(--sheet-line); }
.sheet-contact h2 { margin-bottom: 1mm; color: var(--sheet-muted); font-size: 8.5pt; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.sheet-foot { display: flex; flex-direction: column; gap: 1.5mm; margin-top: auto; padding-top: 3mm; border-top: 2px solid var(--sheet-gold); color: var(--sheet-muted); font-size: 8pt; }
.sheet-foot-brand { color: #7e6010; font-weight: 700; }

/* ------------------------------------------------------------------------------------------------
   Unterschriftsseite für Kunden (ohne Anmeldung, zuerst für das Handy)
   ------------------------------------------------------------------------------------------------ */
.sign-page { background: var(--card); }
.sign-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.sign-brand { display: flex; align-items: center; gap: 10px; }
.sign-brand .brand-name { font-size: 19px; }
.sign-languages { display: flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); }
.sign-languages button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
.sign-languages button[lang="fa"] { font-family: var(--font-fa); }
.sign-languages button.is-active { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--gold); }
.sign-main { width: 100%; max-width: 680px; margin: 0 auto; padding: 18px 16px 40px; }
.sign-main:focus { outline: none; }
.sign-content, .sign-form { display: flex; flex-direction: column; gap: 14px; }
.sign-intro { display: flex; flex-direction: column; gap: 6px; padding: 4px 2px; }
.sign-intro h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.sign-intro p:last-child { color: var(--text-soft); }
.sign-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.sign-card h2 { font-size: 17px; font-weight: 800; }
.sign-summary { margin: 0; }
.sign-row { display: grid; grid-template-columns: minmax(110px, 44%) 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hairline); font-size: 14.5px; }
.sign-row:last-child { border-bottom: 0; }
.sign-row dt { color: var(--muted); }
.sign-row dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.sign-reference { border-style: dashed; background: var(--card); }
.sign-reference .sign-row { font-size: 13px; }
.check-de { font-family: var(--font); }
[dir="rtl"] .check-de { text-align: left; }
.sign-thanks, .sign-problem { align-items: center; gap: 14px; padding: 32px 20px; text-align: center; }
.thanks-icon { width: 54px; height: 54px; color: var(--success); }
.problem-icon { width: 46px; height: 46px; color: var(--gold-ink); }
.sign-thanks h1 { font-size: 24px; font-weight: 800; }
.problem-block { width: 100%; padding: 12px 0; border-top: 1px solid var(--hairline); }
.problem-block:first-of-type { border-top: 0; }
.problem-block h1 { font-size: 18px; font-weight: 800; }
.problem-block p { margin-top: 6px; color: var(--text-soft); }
.sign-footer { padding: 18px 16px 28px; color: var(--muted); font-size: 12px; text-align: center; }
[dir="rtl"] .sign-page, [dir="rtl"] body.sign-page { font-family: var(--font-fa); }
[dir="rtl"] .sign-row dd bdi, [dir="rtl"] .value { unicode-bidi: isolate; }
[dir="rtl"] .eyebrow { letter-spacing: .04em; }

/* ------------------------------------------------------------------------------------------------
   Demo-Rollenwechsel (nur lokal mit ?demo=1)
   ------------------------------------------------------------------------------------------------ */
.demo-switcher { position: fixed; z-index: 1500; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: calc(100vw - 24px); padding: 6px 8px; border: 1px dashed var(--gold); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); font-size: 12px; }
.demo-switcher strong { color: var(--gold-ink); letter-spacing: .06em; text-transform: uppercase; }
.demo-switcher button { min-height: 28px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-size: 12px; font-weight: 700; }
.demo-switcher button[aria-pressed="true"] { border-color: var(--gold); background: var(--gold); color: #202428; }

/* ------------------------------------------------------------------------------------------------
   Kleinere Bildschirme
   ------------------------------------------------------------------------------------------------ */
@media (max-width: 1180px) {
  .calc-layout { grid-template-columns: minmax(0, 1fr); }
  .calc-form { position: static; max-height: none; overflow: visible; }
  .order-layout { grid-template-columns: minmax(0, 1fr); }
  .order-context { position: static; order: -1; }
}

@media (max-width: 960px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 80; width: min(300px, 86vw); height: 100vh; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-dialog); }
  .sidebar.is-open { transform: none; }
  .sidebar-close { display: inline-grid; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 6px; }
  .user-text { display: none; }
  .user-chip { padding: 2px; border: 0; }
  .main { padding: 18px 16px 72px; }
  .auth-screen { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .sheet-desk { padding: 0; background: transparent; }
  .a4-sheet { width: 100%; min-height: 0; padding: 20px 16px; box-shadow: none; border: 1px solid var(--line); font-size: 14px; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .test-band { min-height: 32px; padding: 5px 10px; font-size: 12px; }
  .test-band .icon { display: none; }
  /* Listen als Karten statt waagerecht scrollender Tabellen */
  .table-wrap:has(.stack) { overflow: visible; }
  .data-table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .data-table.stack, .data-table.stack tbody { display: block; width: 100%; }
  .data-table.stack tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; padding: 14px; border-bottom: 1px solid var(--line); }
  .data-table.stack tbody tr:last-child { border-bottom: 0; }
  .data-table.stack td { display: block; padding: 0; border: 0; text-align: left; }
  .data-table.stack td::before { content: attr(data-label); display: block; margin-bottom: 1px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
  .data-table.stack td[data-label=""]::before { content: none; }
  .data-table.stack td.num { text-align: left; }
  .data-table.stack td.actions-cell { grid-column: 1 / -1; width: auto; }
  .data-table.stack .row-actions { justify-content: flex-start; }
  .page-title { font-size: 17px; }
  .advisor-switch { padding: 0 8px 0 6px; }
  .advisor-switch .switch-label { font-size: 0; }
  .advisor-switch .switch-label::after { content: "Berater"; font-size: 12px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .tariff-card { grid-template-columns: minmax(0, 1fr); }
  .tariff-side { border-top: 1px solid var(--line); border-left: 0; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .results-head { flex-direction: column; }
  .page-head .btn, .detail-actions .btn { width: 100%; }
  .detail-actions { width: 100%; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .filter-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filter-bar .field:first-child { grid-column: 1 / -1; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { padding-bottom: 0; border-bottom: 0; font-size: 12.5px; }
  .kv dd { padding-top: 2px; }
  .dialog { width: 100vw; max-width: 100vw; max-height: 100%; height: 100%; margin: 0; border-radius: 0; }
  .dialog-narrow { height: auto; max-height: calc(100vh - 24px); margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .copy-row { flex-direction: column; }
  .selection-bar { bottom: 8px; padding: 10px 12px; }
  .selection-actions { width: 100%; }
  .selection-actions .btn-primary { flex: 1; }
  .auth-card { padding: 22px 18px; border-radius: var(--radius); }
  .sheet-head { flex-direction: column; }
  .sheet-facts { grid-template-columns: minmax(0, 1fr); }
  .compare-table { min-width: 540px; font-size: 12px; table-layout: auto; }
  .compare-table tbody th { width: auto; min-width: 124px; overflow-wrap: normal; }
  .sign-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .sign-intro h1 { font-size: 23px; }
  .signature-canvas { height: 190px; }
  .toasts { right: 8px; left: 8px; bottom: 8px; width: auto; }
}

/* ------------------------------------------------------------------------------------------------
   Druck (Angebot als PDF über die Druckfunktion des Browsers)
   ------------------------------------------------------------------------------------------------ */
@page { size: A4; margin: 12mm 13mm; }
@media print {
  :root, :root[data-theme="dark"] {
    color-scheme: light; --bg: #fff; --surface: #fff; --card: #faf8f2; --text: #202428; --muted: #50555a; --line: #e8dfc2; --band-h: 0px;
  }
  html, body { background: #fff !important; color: #202428; }
  body { font-size: 10.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sidebar, .sidebar-backdrop, .topbar, .test-band, .toasts, .no-print, .demo-switcher, .skip-link, .boot, .dialog { display: none !important; }
  .app-shell { display: block; min-height: 0; }
  .main { max-width: none; padding: 0; }
  .sheet-desk { padding: 0; background: none; overflow: visible; }
  .a4-sheet { width: auto; min-height: 0; margin: 0; padding: 0; border: 0; box-shadow: none; font-size: 10.5pt; }
  .compare-wrap { overflow: visible; }
  .compare-table { min-width: 0; font-size: 9.6pt; table-layout: fixed; }
  .compare-table tbody th { width: 30%; min-width: 0; }
  .compare-table tr, .sheet-summary, .sheet-contact, .sheet-foot { break-inside: avoid; }
  .sheet-head { flex-direction: row; }
  .sheet-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  a[href]::after { content: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Verwaltung → Anfragen von der Website */
.link-button { padding: 0; border: 0; background: none; font: inherit; cursor: pointer; text-decoration: underline; }
.nav-count { margin-inline-start: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--gold); color: #1c1405; font-size: 12px; font-weight: 800; text-align: center; }
.inquiry-contact { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.detail-list { display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: 6px 16px; margin: 0 0 16px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.inquiry-message { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.inquiry-message h3 { margin: 0 0 6px; font-size: 14px; }
.inquiry-message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 560px) { .detail-list { grid-template-columns: 1fr; } .detail-list dt { margin-top: 6px; } }
