:root {
  --bg: #f5f6f8; --card: #fff; --ink: #0b1526; --ink-2: #334155; --muted: #6b778a; --line: #e7eaf0; --line-2: #d6dce5;
  --brand: #1f5fa8; --brand-2: #174a85; --brand-soft: #ebf2fb; --brand-softer: #f5f9fe;
  --heat: #e8811c; --heat-soft: #fff3e6;
  --ok: #15803d; --ok-soft: #e9f7ef; --warn: #b45309; --warn-soft: #fff7e8; --bad: #c2312a; --bad-soft: #fdeeed;
  --r: 18px; --r-sm: 12px;
  --shadow: 0 1px 2px rgba(11, 21, 38, .04);
  --shadow-lg: 0 16px 40px rgba(11, 21, 38, .12);
  --glass: rgba(255, 255, 255, .82);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-feature-settings: "cv11", "ss01", "ss03"; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; text-size-adjust: 100%; }
button, a, label, select { touch-action: manipulation; }
h1, h2, h3 { letter-spacing: -.025em; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
code { background: var(--brand-soft); color: var(--brand-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.mt { margin-top: 16px; }

/* Icons */
.ic { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.ic.lg { width: 26px; height: 26px; stroke-width: 1.6; }
.ic.xl { width: 40px; height: 40px; stroke-width: 1.4; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 22px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand b { color: var(--brand); font-weight: 800; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #2b74c9, #174a85); color: #fff; box-shadow: 0 4px 10px rgba(31, 95, 168, .3); }
.brand-mark .ic { width: 19px; height: 19px; }
.brand-mark.xl { width: 56px; height: 56px; border-radius: 16px; }
.brand-mark.xl .ic { width: 30px; height: 30px; }
.topbar nav { display: flex; gap: 4px; margin-left: 10px; }
.topbar nav a { display: flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 500; }
.topbar nav a .ic { width: 17px; height: 17px; }
.topbar nav a:hover { color: var(--ink); background: #f1f4f8; }
.topbar nav a.active { background: var(--brand-soft); color: var(--brand); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: #fff; padding: 8px 14px; border-radius: 10px; cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; }
.btn:hover { border-color: #b9c4d2; background: #fafbfd; }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 17px; height: 17px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 6px rgba(31, 95, 168, .25); }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: #eef2f7; }
.btn.danger, .btn.ghost.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.lg { padding: 11px 18px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.wa { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn.wa:hover { background: #178a45; }
.btn.disabled { opacity: .45; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; text-decoration: none; transition: background .15s, color .15s; }
.icon-btn:hover { background: #eef2f7; color: var(--ink); }
.icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }
.icon-btn .ic { width: 18px; height: 18px; }

/* Formulare */
.grid { display: grid; gap: 14px 14px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.f { display: flex; flex-direction: column; gap: 6px; grid-column: span 6; min-width: 0; }
.f.s3 { grid-column: span 3; } .f.s4 { grid-column: span 4; } .f.s5 { grid-column: span 5; } .f.s6 { grid-column: span 6; } .f.s7 { grid-column: span 7; } .f.s8 { grid-column: span 8; } .f.s12 { grid-column: span 12; }
.f.end { justify-content: flex-end; align-items: flex-start; }
.lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: block; }
.card-b > .lbl { margin-bottom: 8px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.hint.flush { margin-top: 0; }
.f .hint { margin: 0; }
.inp { position: relative; display: flex; align-items: center; }
.inp > .ic { position: absolute; left: 12px; color: #93a1b5; pointer-events: none; width: 17px; height: 17px; }
.inp.has-ic > input, .inp.has-ic > select { padding-left: 38px; }
.inp > em { position: absolute; right: 12px; font-style: normal; font-size: 13px; color: var(--muted); pointer-events: none; }
.inp.has-unit > input { padding-right: 52px; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=tel], input[type=password], select, textarea {
  width: 100%; min-width: 0; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 12px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
input[type=number] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7a90' stroke-width='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 10px center; padding-right: 34px; cursor: pointer; }
textarea { resize: vertical; min-height: 42px; line-height: 1.45; field-sizing: content; }
input::placeholder, textarea::placeholder { color: #a9b5c5; }
input:hover, select:hover, textarea:hover { border-color: #b9c4d2; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 95, 168, .15); }
fieldset.fs { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { background: #f6f8fa; color: var(--ink-2); }

/* Schalter */
.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .sw { flex: none; position: relative; width: 40px; height: 23px; border-radius: 99px; background: #cfd7e2; transition: background .2s; margin-top: 1px; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.toggle input:checked + .sw { background: var(--brand); }
.toggle input:checked + .sw::after { transform: translateX(17px); }
.toggle input:focus-visible + .sw { box-shadow: 0 0 0 3px rgba(31, 95, 168, .25); }
.tg-t { display: flex; flex-direction: column; }
.tg-t strong { font-weight: 600; }
.tg-t small { color: var(--muted); font-size: 12.5px; }
.toggles { display: grid; gap: 14px; }
.toggle.sm { justify-content: center; align-items: center; padding-top: 9px; }

/* Auswahlkarten */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choice { cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 14px 14px 13px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; transition: all .15s; position: relative; }
.choice > span .ic { color: #8494aa; margin-bottom: 4px; }
.choice strong { font-weight: 600; }
.choice small { color: var(--muted); font-size: 12.5px; }
.choice:hover > span { border-color: #a9b8cc; }
.choice input:checked + span { border-color: var(--brand); background: var(--brand-softer); box-shadow: 0 0 0 3px rgba(31, 95, 168, .12); }
.choice input:checked + span .ic { color: var(--brand); }
.choice input:checked + span::after { content: ""; position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; border-radius: 50%; background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 11px no-repeat; }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px rgba(31, 95, 168, .3); }
.choices.seg { display: inline-flex; gap: 0; background: #eef2f7; padding: 3px; border-radius: 11px; width: max-content; max-width: 100%; }
.choices.seg .choice > span { flex-direction: row; padding: 6px 14px; border: 0; border-radius: 8px; background: transparent; box-shadow: none; }
.choices.seg .choice > span::after { display: none; }
.choices.seg .choice strong { font-weight: 500; color: var(--muted); }
.choices.seg .choice input:checked + span { background: #fff; box-shadow: 0 1px 3px rgba(15, 27, 45, .12); }
.choices.seg .choice input:checked + span strong { color: var(--ink); font-weight: 600; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip > span { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1.5px solid var(--line-2); border-radius: 99px; background: #fff; font-weight: 500; transition: all .15s; }
.chip > span .ic { width: 17px; height: 17px; color: #8494aa; }
.chip .chk { display: none; }
.chip:hover > span { border-color: #a9b8cc; }
.chip input:checked + span { border-color: var(--ok); background: var(--ok-soft); color: #0f5f2f; }
.chip input:checked + span .ic { color: var(--ok); }
.chip input:checked + span .chk { display: block; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(21, 128, 61, .25); }

/* Karten */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 16px; box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 12px; padding: 16px 20px 0; }
.card-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); flex: none; }
.card-ic .ic { width: 18px; height: 18px; }
.card-t { flex: 1; min-width: 0; }
.card-t h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.card-t p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.card-t p .ic { width: 14px; height: 14px; }
.card-b { padding: 16px 20px 20px; }

/* Banner */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid transparent; }
.banner > .ic { margin-top: 1px; }
.banner.info { background: var(--brand-soft); color: #173f6e; border-color: #d4e3f6; }
.banner.ok { background: var(--ok-soft); color: #0f5229; border-color: #cbebd8; }
.banner.warn { background: var(--warn-soft); color: #7a3e06; border-color: #f6e0b5; margin: 14px 0 0; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 10px 4px 8px; border-radius: 99px; background: #eef1f5; color: #546177; white-space: nowrap; }
.pill .ic { width: 14px; height: 14px; }
.pill.versendet { background: var(--warn-soft); color: var(--warn); }
.pill.unterschrieben { background: var(--ok-soft); color: var(--ok); }

/* Übersicht */
.wrap { max-width: 1180px; margin: 0 auto; padding: 30px 22px 70px; }
.page-h { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-h > div { flex: 1; min-width: 240px; }
.page-h h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.page-h p { margin: 4px 0 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { display: flex; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); flex: none; }
.stat.ok .stat-ic { background: var(--ok-soft); color: var(--ok); }
.stat small { display: block; color: var(--muted); font-size: 12.5px; }
.stat strong { font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat em { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); }
.list-tools { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.search { width: 320px; max-width: 100%; }
.seg-tabs { display: inline-flex; background: #e9edf3; padding: 3px; border-radius: 11px; gap: 2px; }
.seg-tabs button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; padding: 6px 13px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13px; }
.seg-tabs button .ic { width: 15px; height: 15px; }
.seg-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 27, 45, .12); }
.olist { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.orow { display: grid; grid-template-columns: 44px minmax(0, 1fr) 190px 140px 120px; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.orow:last-child { border-bottom: 0; }
.orow:hover, .orow:focus-visible { background: #f8fafd; outline: none; }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, #e7effa, #d6e4f6); color: var(--brand); font-weight: 700; font-size: 14px; }
.o-main { min-width: 0; }
.o-main strong { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-main small { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.o-main small .ic { width: 13px; height: 13px; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: #b4bfcd; display: inline-block; margin: 0 3px; }
.o-amt { text-align: right; font-variant-numeric: tabular-nums; }
.o-amt strong { display: block; font-size: 15px; }
.o-amt small { font-size: 12px; }
.o-amt small.pos { color: var(--ok); } .o-amt small.neg { color: var(--bad); }
.o-act { display: flex; align-items: center; justify-content: flex-end; gap: 2px; color: #a3b0c2; }
.o-act .go { margin-left: 4px; }
.empty { text-align: center; padding: 56px 20px; background: #fff; border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--muted); }
.empty .ic { color: #9fb0c7; }
.empty h3 { color: var(--ink); margin: 12px 0 4px; }
.empty p { margin: 0 0 18px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 20% -10%, #dce8f7, transparent), var(--bg); }
.login { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 34px 30px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; text-align: center; align-items: center; }
.login h1 { margin: 6px 0 0; font-size: 21px; letter-spacing: -.01em; }
.login p { margin: 0; color: var(--muted); }
.login .f { width: 100%; }
.login .err { color: var(--bad); min-height: 1em; }

/* Editor */
.ed { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 0; min-height: calc(100vh - 60px); }
.ed.with-pv { grid-template-columns: 260px minmax(0, 1fr) minmax(380px, 40%); }
.ed .pv { display: none; }
.ed.with-pv .pv { display: flex; }
.steps { position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; border-right: 1px solid var(--line); background: #fff; padding: 20px 14px; }
.steps-prog { padding: 4px 10px 18px; }
.steps-prog > div:first-child { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.steps-prog small { color: var(--muted); font-size: 12px; font-weight: 500; }
.steps-prog strong { font-size: 13px; }
.progress { height: 6px; background: #e9edf3; border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #3f8ae0); border-radius: 99px; transition: width .3s; }
.steps-in { display: flex; flex-direction: column; gap: 2px; position: relative; }
.st { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 10px; border-radius: 12px; cursor: pointer; position: relative; }
.st:hover { background: #f3f6fa; }
.st.active { background: var(--brand-soft); }
.st-ic { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: #f0f3f7; color: #7a889c; flex: none; transition: all .15s; }
.st-ic .ic { width: 18px; height: 18px; }
.st-ic i { position: absolute; right: -4px; bottom: -4px; display: none; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--ok); color: #fff; border: 2px solid #fff; }
.st-ic i .ic { width: 10px; height: 10px; stroke-width: 3.5; }
.st.done .st-ic i { display: grid; }
.st.active .st-ic { background: var(--brand); color: #fff; box-shadow: 0 4px 10px rgba(31, 95, 168, .3); }
.st-t { display: flex; flex-direction: column; min-width: 0; }
.st-t small { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.st-t strong { font-weight: 600; font-size: 14px; }
.st-t em { font-style: normal; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st.active .st-t strong { color: var(--brand-2); }

.ed-main { padding: 18px 28px 60px; min-width: 0; max-width: 980px; width: 100%; justify-self: center; }
.ed-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.ed-title { min-width: 0; }
.ed-title small { color: var(--muted); font-size: 12px; font-weight: 500; }
.ed-title h1 { margin: 0; font-size: 19px; letter-spacing: -.01em; line-height: 1.2; }
.save { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ok); margin-right: 6px; }
.peers { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--brand-2); background: var(--brand-softer); padding: 4px 10px; border-radius: 999px; margin-right: 6px; }
.peers .ic { width: 15px; height: 15px; }
.peers[hidden] { display: none; }
.save .ic { width: 15px; height: 15px; }
.save.busy { color: var(--muted); }
.save.busy .ic { animation: spin 1s linear infinite; }
.save.err { color: var(--bad); }
@keyframes spin { to { transform: rotate(360deg); } }
.step-h { display: flex; align-items: center; gap: 14px; margin: 4px 0 18px; }
.step-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(135deg, #2b74c9, #174a85); color: #fff; box-shadow: 0 6px 16px rgba(31, 95, 168, .28); }
.step-ic .ic { width: 24px; height: 24px; }
.step-h small { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.step-h h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; line-height: 1.15; }
.step-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line); }

/* Vorschau */
.pv { position: sticky; top: 60px; height: calc(100vh - 60px); flex-direction: column; border-left: 1px solid var(--line); background: #e9edf2; min-width: 0; }
.pv-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.pv-close { display: none; }
.pv-scroll { flex: 1; overflow: auto; padding: 14px; }
.pv-scroll .doc { zoom: var(--z, .55); box-shadow: 0 4px 18px rgba(15, 27, 45, .14); border-radius: 2px; }
.pv-scroll .doc + .doc { margin-top: 14px; }

/* Zeilen-Tabellen */
.rows { display: flex; flex-direction: column; gap: 8px; }
.row { display: grid; gap: 8px; align-items: start; }
.row.head { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 2px; gap: 8px; }
.row .calc { text-align: right; font-variant-numeric: tabular-nums; padding-top: 10px; white-space: nowrap; font-weight: 600; font-size: 13.5px; }
.row-act { display: flex; gap: 0; padding-top: 2px; justify-content: flex-end; }
.row-act .icon-btn { width: 32px; height: 32px; color: #8a98ab; }
.row-empty { padding: 18px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line-2); border-radius: 12px; }
.r-p { grid-template-columns: minmax(0, 1fr) 72px 72px 120px 64px 110px 104px; }
.r-k { grid-template-columns: 190px minmax(0, 1fr) 72px 72px 120px 64px 100px 36px; }
.r-bt { grid-template-columns: minmax(0, 1fr) 110px 80px 80px 80px 36px; }
.r-kat { grid-template-columns: minmax(0, 1fr) 72px 72px 120px 72px; }
.r-kk { grid-template-columns: 190px minmax(0, 1fr) 72px 72px 120px 64px 36px; }
.row.head > span:nth-last-child(2) { text-align: right; }
.r-kk.head > span:nth-last-child(2), .r-kat.head > span:nth-last-child(2) { text-align: left; }
.inp.art > .ic { color: var(--c); }
.inp.art select { border-left: 3px solid var(--c); }
.add-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.add-row .sel { flex: 1; min-width: 240px; max-width: 420px; }
.totals { margin: 18px 0 0 auto; width: max-content; min-width: 300px; max-width: 100%; font-variant-numeric: tabular-nums; background: var(--brand-softer); border: 1px solid #dbe6f4; border-radius: 12px; padding: 12px 16px; }
.totals div { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; color: var(--ink-2); white-space: nowrap; }
.totals .grand { border-top: 1px solid #c9d8ec; margin-top: 6px; padding-top: 9px; font-weight: 750; font-size: 17px; color: var(--ink); }

/* Kacheln */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tiles.kalk { margin-bottom: 16px; }
.tile { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.card .tile { box-shadow: none; background: #f8fafc; }
.tile > .ic { position: absolute; right: 14px; top: 14px; color: #a3b1c4; }
.tile small { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.tile strong { font-size: 21px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile em { font-style: normal; font-size: 12px; color: var(--muted); }
.tile.hi { background: linear-gradient(135deg, #2b74c9, #174a85) !important; border-color: transparent; }
.tile.hi small, .tile.hi strong, .tile.hi em, .tile.hi > .ic { color: #fff; }
.tile.hi small, .tile.hi em { opacity: .85; }
.tile.hi.neg { background: linear-gradient(135deg, #e0574f, #b42a23) !important; }

/* Heizlast-Hero */
.hero { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 14px; margin-bottom: 16px; }
.hero-main { display: flex; gap: 16px; align-items: center; padding: 20px 22px; border-radius: var(--r); color: #fff; background: radial-gradient(400px 200px at 0% 0%, #f59e3b, transparent), linear-gradient(135deg, #e8811c, #c2410c); box-shadow: 0 8px 22px rgba(232, 129, 28, .3); }
.hero-ic { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: rgba(255,255,255,.18); flex: none; }
.hero-ic .ic { width: 28px; height: 28px; }
.hero-main small { opacity: .9; font-size: 12.5px; font-weight: 500; }
.hero-main strong { display: block; font-size: 34px; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-main em { font-style: normal; font-size: 13px; opacity: .92; }
.hero-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hero-tiles > div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; box-shadow: var(--shadow); }
.hero-tiles small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.hero-tiles strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.hero-tiles em { display: block; font-style: normal; font-size: 12px; color: var(--muted); }
.hero-empty { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; padding: 16px 18px; border-radius: var(--r); background: var(--warn-soft); color: #7a3e06; border: 1px solid #f6e0b5; }
.hero-empty span { flex: 1; }

/* Kostenstruktur */
.sbar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: #eef2f7; gap: 2px; }
.sbar span { display: block; height: 100%; }
.legend { margin-top: 14px; display: flex; flex-direction: column; }
.legend > div { display: grid; grid-template-columns: 10px 20px 1fr auto 110px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid #f0f3f7; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend .ic { width: 16px; height: 16px; color: #8494aa; }
.legend em { font-style: normal; color: var(--muted); font-size: 12.5px; }
.legend strong { text-align: right; font-variant-numeric: tabular-nums; }
.legend .legend-sum { display: flex; justify-content: space-between; border-bottom: 0; padding-top: 10px; font-weight: 650; }

/* Zahlungsplan */
.paybar { display: flex; height: 30px; border-radius: 10px; overflow: hidden; margin-bottom: 14px; gap: 3px; }
.paybar span { display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 600; min-width: 34px; }
.paybar span:nth-child(n+3) { color: #173f6e; }
.pay { display: grid; grid-template-columns: 34px minmax(0, 1fr) 150px; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: #fbfcfe; }
.pay-n { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: 13px; }
.pay-r { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 8px; }
.pay-r strong { font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* Leistungsumfang */
.lu-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lu-ic { color: var(--ok); }
.lu-row input { flex: 1; }

/* Prüfen & Senden */
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.checklist { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: #f8fafc; }
.checklist li.ok .ic { color: var(--ok); }
.checklist li.todo { background: var(--warn-soft); cursor: pointer; }
.checklist li.todo > .ic { color: var(--warn); }
.checklist li span { flex: 1; }
.checklist li em { display: inline-flex; align-items: center; gap: 2px; font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--warn); }
.checklist li em .ic { width: 15px; height: 15px; }
.summary { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; margin: 0; }
.summary dt { color: var(--muted); font-size: 13px; }
.summary dd { margin: 0; font-weight: 500; }
.summary dd small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; }
.summary dd.big { font-size: 22px; font-weight: 750; letter-spacing: -.02em; color: var(--brand-2); }
.linkbox { display: flex; gap: 4px; align-items: center; margin-top: 12px; }
.linkbox .inp { flex: 1; }
.linkbox input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; background: #f8fafc; }
.send-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.docs-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.doc-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border: 1.5px solid var(--line-2); border-radius: 12px; text-decoration: none; color: var(--ink); transition: all .15s; min-width: 0; }
.doc-btn .ic { color: var(--brand); margin-bottom: 4px; }
.doc-btn strong { font-weight: 600; font-size: 13.5px; hyphens: manual; }
.doc-btn small { color: var(--muted); font-size: 12px; }
.doc-btn:hover { border-color: var(--brand); background: var(--brand-softer); }
.signed { display: flex; gap: 14px; align-items: center; padding: 12px; background: var(--ok-soft); border-radius: 12px; }
.signed img { max-height: 64px; max-width: 50%; background: #fff; border-radius: 8px; padding: 6px; border: 1px solid #cbebd8; }
.signed small, .waiting small { display: block; color: var(--muted); font-size: 12.5px; }
.waiting { display: flex; gap: 14px; align-items: center; padding: 14px; background: #f8fafc; border-radius: 12px; }
.waiting .ic { color: var(--warn); }

/* Einstellungen */
.set { display: grid; grid-template-columns: 250px minmax(0, 1fr); max-width: 1240px; margin: 0 auto; gap: 26px; padding: 26px 22px 70px; }
.set-nav { position: sticky; top: 86px; align-self: start; display: flex; flex-direction: column; gap: 2px; }
.set-nav h1 { font-size: 22px; margin: 0 0 12px; letter-spacing: -.02em; }
.set-nav nav { display: flex; flex-direction: column; gap: 2px; }
.set-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.set-nav a:hover { background: #fff; }
.set-nav a .ic { color: #8494aa; }
.set-nav .hint { margin: 16px 12px 8px; }
.set-nav .save { margin-left: 12px; }
.set-main > div { scroll-margin-top: 80px; }
.logo-up { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.logo-up img { max-height: 48px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 100px); display: flex; align-items: center; gap: 10px; background: #0f1b2d; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); transition: transform .25s, opacity .25s; opacity: 0; z-index: 60; font-weight: 500; }
.toast .ic { color: #6ee7a0; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

body.printing { background: #fff; }

/* Schmale Spalten (z. B. mit offener Vorschau): Zeilen als Karten stapeln */
.card-b { container-type: inline-size; }
.ed-main { container: main / inline-size; }
@container (max-width: 760px) {
  .row.head { display: none; }
  .rows > div:not(.row):not(.vat-row) { display: flex; flex-direction: column; gap: 8px; }
  .row:not(.head) { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
  .r-p:not(.head) { grid-template-columns: 64px 70px minmax(0, 1fr) auto minmax(0, 1fr) auto; }
  .r-p > textarea { grid-column: 1 / -1; }
  .r-k:not(.head) { grid-template-columns: 64px 70px minmax(0, 1fr) auto minmax(0, 1fr) auto; }
  .r-k > .art { grid-column: 1 / 3; } .r-k > textarea { grid-column: 3 / -1; }
  .r-bt:not(.head) { grid-template-columns: minmax(0, 1fr) 70px 70px minmax(0, 1fr) auto; }
  .r-bt > input:first-child { grid-column: 1 / -1; }
  .r-kat:not(.head) { grid-template-columns: 70px 76px minmax(0, 1fr) auto; }
  .r-kat > textarea { grid-column: 1 / -1; }
  .r-kk:not(.head) { grid-template-columns: 70px 76px minmax(0, 1fr) auto auto; }
  .r-kk > .art { grid-column: 1 / 3; } .r-kk > textarea { grid-column: 3 / -1; }
  .pay { grid-template-columns: 30px minmax(0, 1fr); }
  .pay-r { grid-column: 1 / -1; flex-direction: row; align-items: center; }
  .legend > div { grid-template-columns: 10px 18px 1fr auto; }
  .legend > div em { display: none; }
}
@container (max-width: 480px) {
  .row:not(.head) { grid-template-columns: minmax(0, .8fr) minmax(0, .8fr) minmax(0, 1.4fr) !important; }
  .row > textarea, .row > .art, .r-bt > input:first-child { grid-column: 1 / -1 !important; }
  .row .calc { grid-column: 1 / 3; text-align: left; padding-top: 6px; }
  .row-act { grid-column: 3; }
  .r-kat .row-act { grid-column: 1 / -1; }
}
@container (max-width: 520px) {
  .grid { gap: 12px 10px; }
  .grid > .f { grid-column: span 12; }
  .grid > .f.s3, .grid > .f.s4, .grid > .f.s5, .grid > .f.s4 + .f.s8 { grid-column: span 6; }
  .f.end .btn { white-space: normal; text-align: left; justify-content: flex-start; }
  .docs-btns, .send-btns { grid-template-columns: 1fr; }
}
@container main (max-width: 820px) {
  .two { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
}

/* Positions- und Kostenzeilen: ab mittlerer Breite als Karten, damit die Bezeichnung lesbar bleibt */
#pos, #kosten { display: flex; flex-direction: column; gap: 8px; }
@container (max-width: 960px) {
  .r-p.head, .r-k.head { display: none; }
  .r-p:not(.head), .r-k:not(.head) { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; grid-template-columns: 64px 70px minmax(0, 1fr) auto minmax(0, 1fr) auto; }
  .r-p > textarea { grid-column: 1 / -1; }
  .r-k > .art { grid-column: 1 / 3; }
  .r-k > textarea { grid-column: 3 / -1; }
  .r-k:not(.head) { grid-template-columns: 104px 70px minmax(0, 1fr) auto minmax(0, 1fr) auto; }
}

/* Responsiv */
@media (max-width: 1360px) {
  .ed.with-pv { grid-template-columns: 236px minmax(0, 1fr) minmax(340px, 36%); }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 1120px) {
  .ed, .ed.with-pv { grid-template-columns: 220px minmax(0, 1fr); }
  .ed.with-pv .pv { position: fixed; right: 0; top: 60px; bottom: 0; width: min(560px, 100vw); height: auto; z-index: 40; box-shadow: -10px 0 40px rgba(15, 27, 45, .2); }
  .pv-close { display: inline-grid; }
  .two { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .r-k { grid-template-columns: 150px minmax(0, 1fr) 64px 64px 110px 64px 90px 36px; }
  .r-kk { grid-template-columns: 150px minmax(0, 1fr) 64px 64px 110px 90px 36px; }
}
@media (max-width: 820px) {
  .ed, .ed.with-pv { grid-template-columns: 1fr; }
  .steps { position: sticky; top: 60px; z-index: 20; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; overflow-x: auto; }
  .steps-prog { display: none; }
  .steps-in { flex-direction: row; gap: 4px; }
  .st { width: auto; flex: none; padding: 6px 8px; }
  .st-t small, .st-t em { display: none; }
  .st:not(.active) .st-t { display: none; }
  .ed-main { padding: 16px 16px 50px; }
  .orow { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .o-st, .o-act { display: none; }
  .set { grid-template-columns: 1fr; }
  .set-nav { position: static; }
  .set-nav nav { flex-direction: row; overflow-x: auto; }
}
@media (max-width: 640px) {
  .f, .f.s3, .f.s4, .f.s5, .f.s6, .f.s7, .f.s8 { grid-column: span 12; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar nav a span, .brand > span:last-child, .hide-s { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 12px; }
  .stat-ic { display: none; }
  .hero-tiles { grid-template-columns: 1fr 1fr; }
  .step-nav .btn span { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
  .legend > div { grid-template-columns: 10px 18px 1fr auto; }
  .legend > div em { display: none; }
}
@media print { .topbar, .toast { display: none; } }

/* ---------- Heizlast-Modul ---------- */
.hlm { max-width: 1440px; margin: 0 auto; padding: 18px 22px 70px; }
.hlm-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.hlm-tabs { margin-bottom: 18px; flex-wrap: wrap; }
.hlm-tabs button { padding: 8px 14px; font-size: 13.5px; }
.hlm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.hlm-aside { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 12px; }
.hero-main.sm { padding: 16px 18px; }
.hero-main.sm strong { font-size: 28px; }
.hero-main.sm .hero-ic { width: 44px; height: 44px; }
.aside-list { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 6px 16px; box-shadow: var(--shadow); }
.aside-list > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f3f7; font-size: 13px; }
.aside-list > div:last-child { border-bottom: 0; }
.aside-list span { color: var(--muted); }
.aside-list strong { font-variant-numeric: tabular-nums; }
.aside-list .hi strong { color: var(--heat); font-size: 15px; }
.aside-warn { background: var(--warn-soft); border: 1px solid #f6e0b5; border-radius: var(--r); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; color: #7a3e06; font-size: 13px; }
.aside-warn > div, .aside-ok { display: flex; gap: 8px; align-items: flex-start; }
.aside-warn .ic { width: 16px; height: 16px; margin-top: 1px; }
.aside-ok { background: var(--ok-soft); color: var(--ok); border-radius: var(--r); padding: 10px 14px; font-weight: 500; }
.tag-warn { display: inline-block; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 11.5px; padding: 0 7px; border-radius: 99px; }
.u-big { text-align: right; margin-right: 6px; }
.u-big small { display: block; font-size: 11px; color: var(--muted); }
.u-big strong { font-size: 20px; color: var(--brand-2); font-variant-numeric: tabular-nums; }
.u-big em { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 3px; }
.r-sch { grid-template-columns: minmax(0, 1fr) 100px 100px 70px 36px; }
.rgrid { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.rlist { position: sticky; top: 76px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 100px); overflow: auto; }
.rlist .add-row { margin: 8px 4px 4px; }
.ritem { display: flex; align-items: center; gap: 8px; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.ritem:hover { background: #f3f6fa; }
.ritem.active { background: var(--brand-soft); }
.ritem-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ritem-t strong { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ritem-t small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ritem-v { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--brand-2); }
.r-el { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.2fr) 74px 90px 90px 56px 84px 70px 36px; }
.r-el .calc small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.el-extra { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 0 2px 6px; }
.el-extra .lbl { white-space: nowrap; font-weight: 500; color: var(--muted); }
.el-extra select, .el-extra .inp { max-width: 420px; }
.r-hk { grid-template-columns: minmax(0, 1fr) 190px 110px 80px 60px 80px 36px; }
.quick { gap: 6px; }
.tile.warn { background: var(--warn-soft) !important; border-color: #f6e0b5; }
.tile.warn strong { color: var(--warn); }
#raumRes { margin-bottom: 16px; }
table.hf { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.hf th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.hf td { padding: 9px 8px; border-bottom: 1px solid #f0f3f7; vertical-align: top; }
table.hf td small { display: block; color: var(--muted); font-size: 11.5px; }
table.hf tr.bad td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
table.hf tr.ok td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
table.hf tr.none td:first-child { box-shadow: inset 3px 0 0 #c8d0db; }
table.hf tfoot td { font-weight: 700; border-bottom: 0; }
table.hf .bar { height: 6px; width: 90px; background: #eef2f7; border-radius: 99px; overflow: hidden; margin: 6px 0 3px; }
table.hf .bar span { display: block; height: 100%; background: var(--ok); }
table.hf tr.bad .bar span { background: var(--bad); }
.rw-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.rw-mini > div { background: #f8fafc; border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; }
.rw-mini span { font-weight: 600; } .rw-mini em { font-style: normal; font-size: 12px; color: var(--muted); }
.rw-mini strong { color: var(--brand-2); font-variant-numeric: tabular-nums; }
@media (max-width: 1180px) { .hlm-grid { grid-template-columns: 1fr; } .hlm-aside { position: static; } }
@container (max-width: 860px) {
  .r-el:not(.head) { grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1fr) 58px minmax(0, 1fr) minmax(0, .8fr) 36px !important; }
  .r-el > select:nth-child(1) { grid-column: 1 / 4 !important; }
  .r-el > select:nth-child(2) { grid-column: 4 / 7 !important; }
  .r-el > .row-act { grid-column: 7 !important; grid-row: 1; }
  .r-el > .calc { grid-column: auto !important; text-align: right; }
  .r-hk:not(.head) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 70px minmax(0, 1fr) 36px !important; }
  .r-hk > input:first-child { grid-column: 1 / 3 !important; }
  .r-hk > select { grid-column: 3 / 5 !important; }
  .r-hk > .row-act { grid-column: 5 !important; grid-row: 1; }
  .r-hk > .calc { grid-column: auto !important; }
  .r-sch:not(.head) { grid-template-columns: minmax(0, 1fr) 90px 90px; }
}
@media (max-width: 820px) { .rgrid { grid-template-columns: 1fr; } .rlist { position: static; max-height: none; } }

/* MwSt.-Position */
.vat-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin-top: 4px; border: 1.5px dashed var(--line-2); border-radius: 12px; background: #fafbfd; transition: all .15s; flex-wrap: wrap; }
.vat-row.on { border-style: solid; border-color: var(--brand); background: var(--brand-softer); }
.vat-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: #eef2f7; color: var(--muted); flex: none; }
.vat-row.on .vat-ic { background: var(--brand); color: #fff; }
.vat-t { flex: 1; min-width: 200px; display: flex; flex-direction: column; }
.vat-t small { color: var(--muted); font-size: 12.5px; }
.vat-row .toggle { align-items: center; }
.vat-rate { width: 90px; }
.vat-amt { min-width: 110px; text-align: right; font-size: 15px; font-variant-numeric: tabular-nums; }
.vat-row.on .vat-amt { color: var(--brand-2); }
.kalk-note { grid-column: 1 / -1; display: flex; gap: 6px; align-items: flex-start; }
.kalk-note .ic { width: 15px; height: 15px; margin-top: 2px; color: var(--muted); }

/* Zahlungspläne */
.plan-letter { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #2b74c9, #174a85); color: #fff; font-weight: 800; font-size: 16px; flex: none; }
.plan-letter.sm { display: inline-grid; width: 24px; height: 24px; border-radius: 7px; font-size: 12px; margin-right: 8px; vertical-align: middle; }
.plan-card .card-h { flex-wrap: wrap; }
.plan-card .card-h .chip > span { padding: 5px 11px; font-size: 13px; }
.plan-name { font-weight: 650; font-size: 15px; border-color: transparent !important; background: transparent !important; padding: 6px 8px !important; margin-left: -8px; }
.plan-name:hover { border-color: var(--line-2) !important; background: #fff !important; }
.plan-name:focus { background: #fff !important; border-color: var(--brand) !important; }
.plan-nl { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 12px 14px; margin: 14px 0; background: #fafbfd; }
.plan-nl.on { border-style: solid; border-color: #b7e2c6; background: var(--ok-soft); }
.plan-nl-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.plan-nl-h > .ic { color: var(--ok); }
.plan-nl-h strong { margin-right: auto; }
.plan-nl .grid { margin-top: 12px; }
.raten { display: flex; flex-direction: column; gap: 8px; }
.rate { display: grid; grid-template-columns: 30px minmax(0, 1.3fr) minmax(0, 1fr) auto 120px 110px 36px; gap: 8px; align-items: center; }
.rate .choices.seg .choice > span { padding: 6px 10px; }
.rate-rest { font-size: 12.5px; color: var(--muted); text-align: center; }
.rate-amt { text-align: right; font-variant-numeric: tabular-nums; font-size: 14.5px; }
.plan-card .paybar { margin: 0 0 12px; }
.plan-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.plan-sum > div { background: #f8fafc; border-radius: 10px; padding: 9px 12px; display: flex; flex-direction: column; }
.plan-sum small { font-size: 12px; color: var(--muted); }
.plan-sum strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.plan-sum .minus strong { color: var(--ok); }
.plan-sum .hi { background: var(--brand); } .plan-sum .hi small, .plan-sum .hi strong { color: #fff; }
.plan-sum .neg strong { color: var(--bad); }
.plan-sum .muted strong { color: #a3afbf; }
table.plan-cmp { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.plan-cmp th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.plan-cmp td { padding: 10px 8px; border-bottom: 1px solid #f0f3f7; vertical-align: middle; }
table.plan-cmp td small { display: block; color: var(--muted); font-size: 12px; }
table.plan-cmp .minus { color: var(--ok); font-weight: 600; }
table.plan-cmp tr:last-child td { border-bottom: 0; }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.radio-dot { cursor: pointer; display: inline-grid; }
.radio-dot input { position: absolute; opacity: 0; }
.radio-dot span { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; }
.radio-dot input:checked + span { border-color: var(--brand); }
.radio-dot input:checked + span::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.plan-add { margin: 0 0 18px; }
.set-sec-h { display: flex; gap: 12px; align-items: flex-start; margin: 8px 0 12px; }
.set-sec-h > .ic { color: var(--brand); margin-top: 4px; }
.set-sec-h h2 { margin: 0; font-size: 17px; }
@container (max-width: 760px) {
  .rate { grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr) 36px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
  .rate > .pay-n { grid-row: 1; }
  .rate > input:nth-of-type(1) { grid-column: 2 / 4; grid-row: 1; }
  .rate > .icon-btn { grid-column: 4; grid-row: 1; }
  .rate > input:nth-of-type(2) { grid-column: 2 / 5; grid-row: 2; }
  .rate > .choices { grid-column: 2 / 3; grid-row: 3; }
  .rate > .inp, .rate > .rate-rest { grid-column: 3 / 5; grid-row: 3; }
  .rate > .rate-amt { grid-column: 2 / 5; grid-row: 4; }
  .plan-sum { grid-template-columns: 1fr 1fr; }
  table.plan-cmp th:nth-child(4), table.plan-cmp td:nth-child(4) { display: none; }
}

/* MwSt. je Position */
.mini-tg { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; padding-top: 4px; }
.mini-tg input { position: absolute; opacity: 0; pointer-events: none; }
.mini-tg .sw { position: relative; width: 32px; height: 18px; border-radius: 99px; background: #cfd7e2; transition: background .2s; }
.mini-tg .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.mini-tg input:checked + .sw { background: var(--brand); }
.mini-tg input:checked + .sw::after { transform: translateX(14px); }
.mini-tg input:focus-visible + .sw { box-shadow: 0 0 0 3px rgba(31, 95, 168, .25); }
.mini-tg em { font-style: normal; font-size: 10.5px; color: var(--muted); }
.mini-tg.off { opacity: .45; }
.plan-card .card-t { flex: 1 1 240px; }

/* Preisnachlass */
.nl-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto 130px 110px 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.nl-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); }
.nl-amt { text-align: right; color: var(--ok); font-variant-numeric: tabular-nums; }
.totals .minus { color: var(--ok); }
.totals .sub { font-weight: 600; color: var(--ink); border-top: 1px solid #c9d8ec; margin-top: 4px; padding-top: 6px; }
.banner.warn .btn { margin-left: auto; align-self: center; }
@container (max-width: 640px) {
  .nl-row { grid-template-columns: 36px minmax(0, 1fr) 36px; }
  .nl-row > input { grid-column: 2; grid-row: 1; }
  .nl-row > .icon-btn { grid-column: 3; grid-row: 1; }
  .nl-row > .choices { grid-column: 2; }
  .nl-row > .inp { grid-column: 2; }
  .nl-row > .nl-amt { grid-column: 2; }
}

/* Einheit: Mehrzahl oben, Einzahl (für „€ / Tag“) darunter */
.unit2 { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.unit2 input { width: 100%; }
.unit2 input + input { height: 28px; font-size: 12px; padding-top: 2px; padding-bottom: 2px; }

/* =====================================================================
   Modernes Feintuning (alle Breiten)
   ===================================================================== */
.topbar { background: var(--glass); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border-bottom-color: rgba(11, 21, 38, .06); }
.brand-mark, .step-ic, .plan-letter, .tile.hi { background: var(--brand); }
.brand-mark { box-shadow: 0 4px 12px rgba(31, 95, 168, .28); }
.step-ic { box-shadow: 0 8px 20px rgba(31, 95, 168, .22); }
.card { border-color: var(--line); }
.card-h { padding: 18px 20px 0; }
.card-t h3 { font-size: 15.5px; font-weight: 650; }
.card-ic { border-radius: 11px; }
.btn { border-radius: 12px; font-weight: 550; }
.btn.primary { box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 4px 12px rgba(31, 95, 168, .22); }
.btn.lg { border-radius: 14px; }
.choice > span, .chip > span { border-width: 1.5px; }
.stat, .olist, .empty, .tile, .hero-tiles > div, .aside-list { box-shadow: var(--shadow); }
.stat strong { font-weight: 700; }
.page-h h1 { font-size: 28px; font-weight: 750; letter-spacing: -.03em; }
.step-h h2 { font-weight: 750; letter-spacing: -.03em; }
.tabbar { display: none; }
::selection { background: rgba(31, 95, 168, .18); }

/* =====================================================================
   Mobil – Tablet & Handy
   ===================================================================== */
@media (max-width: 820px) {
  html, body { font-size: 15px; }

  /* Eingaben: 16px gegen iOS-Auto-Zoom, große Touch-Ziele */
  input[type=text], input[type=number], input[type=date], input[type=email], input[type=tel], input[type=password], select, textarea {
    font-size: 16px; padding: 11px 13px; border-radius: 12px; min-height: 46px;
  }
  textarea { min-height: 46px; }
  .inp.has-ic > input, .inp.has-ic > select { padding-left: 40px; }
  .inp > em { font-size: 14px; }
  .lbl { font-size: 13px; }
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn.small { min-height: 38px; padding: 7px 12px; font-size: 14px; }
  .btn.lg { min-height: 52px; font-size: 16px; }
  .icon-btn { width: 42px; height: 42px; border-radius: 12px; }
  .row-act .icon-btn { width: 38px; height: 38px; }
  .toggle .sw { width: 46px; height: 28px; }
  .toggle .sw::after { width: 22px; height: 22px; }
  .toggle input:checked + .sw::after { transform: translateX(18px); }

  /* Topbar kompakt, Navigation wandert nach unten */
  .topbar { height: calc(56px + var(--sat)); padding: var(--sat) 16px 0; gap: 8px; }
  .topbar nav { display: none; }
  .topbar .brand { font-size: 17px; }
  #logout { min-height: 40px; padding: 0 10px; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
    padding: 6px 20px calc(6px + var(--sab));
    background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid rgba(11, 21, 38, .07);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 4px; text-decoration: none; color: #8a95a6; font-size: 11px; font-weight: 600; letter-spacing: .01em; }
  .tabbar a .ic { width: 23px; height: 23px; stroke-width: 1.8; }
  .tabbar a.active { color: var(--brand); }
  .tb-new { display: grid; place-items: center; width: 56px; height: 56px; margin-top: -26px; border: 4px solid var(--bg); border-radius: 20px; background: var(--brand); color: #fff; cursor: pointer; box-shadow: 0 10px 24px rgba(31, 95, 168, .38); transition: transform .12s; }
  .tb-new:active { transform: scale(.94); }
  .tb-new .ic { width: 24px; height: 24px; stroke-width: 2.4; }

  .toast { bottom: calc(92px + var(--sab)); max-width: calc(100vw - 32px); border-radius: 14px; }

  /* ---------- Übersicht ---------- */
  .wrap { padding: 20px 16px calc(110px + var(--sab)); }
  .page-h { margin-bottom: 16px; }
  .page-h h1 { font-size: 30px; }
  .page-h p { font-size: 14px; }
  .page-h > .btn { display: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
  .stat { padding: 14px; border-radius: 16px; }
  .stat-ic { display: none; }
  .stat small { font-size: 12px; font-weight: 500; }
  .stat strong { font-size: 24px; line-height: 1.2; }
  .stat em { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .list-tools { flex-direction: column; align-items: stretch; gap: 10px; }
  .search { width: 100%; order: -1; }
  .seg-tabs { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .seg-tabs::-webkit-scrollbar { display: none; }
  .seg-tabs button { flex: 1 0 auto; justify-content: center; padding: 8px 12px; font-size: 13.5px; }
  #flt { display: flex; }

  .olist { display: flex; flex-direction: column; gap: 10px; background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .orow {
    grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "av main main" "av st amt";
    gap: 10px 12px; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  }
  .orow:last-child { border-bottom: 1px solid var(--line); }
  .orow:active { transform: scale(.99); background: #fafbfc; }
  .orow .avatar { grid-area: av; align-self: start; width: 44px; height: 44px; border-radius: 14px; }
  .o-main { grid-area: main; }
  .o-main strong { font-size: 16px; }
  .o-st { grid-area: st; display: block !important; align-self: center; }
  .o-amt { grid-area: amt; }
  .o-amt strong { font-size: 16px; }
  .o-act { display: none; }

  /* ---------- Editor ---------- */
  body:has(.ed) .topbar, body:has(.hlm) .topbar { display: none; }
  body:has(.ed) .tabbar, body:has(.hlm) .tabbar { display: none; }
  .ed { min-height: 100vh; }
  .steps {
    top: 0; z-index: 25; padding: calc(10px + var(--sat)) 12px 10px;
    background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(11, 21, 38, .07); scrollbar-width: none; scroll-snap-type: x proximity;
  }
  .steps::-webkit-scrollbar { display: none; }
  .steps-in { gap: 6px; }
  .st { padding: 3px; border-radius: 99px; gap: 8px; scroll-snap-align: center; }
  .st:hover { background: transparent; }
  .st.active { background: var(--brand-soft); padding-right: 14px; }
  .st-ic { width: 36px; height: 36px; border-radius: 50%; background: #eef1f5; }
  .st.done:not(.active) .st-ic { background: var(--ok-soft); color: var(--ok); }
  .st-ic i { width: 16px; height: 16px; right: -3px; bottom: -3px; }
  .st.active .st-t strong { font-size: 14px; white-space: nowrap; }

  .ed-main { padding: 14px 16px calc(104px + var(--sab)); }
  .ed-head { flex-wrap: nowrap; gap: 4px; margin-bottom: 14px; }
  .ed-head > .pill { display: none; }
  .ed-title { flex: 1; min-width: 0; padding-left: 4px; }
  .ed-title h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ed-head .spacer { display: none; }
  .ed-head .save { font-size: 0; gap: 0; margin: 0 4px; }
  .ed-head .save .ic { width: 18px; height: 18px; }
  .step-h { margin: 6px 0 16px; gap: 12px; }
  .step-ic { width: 44px; height: 44px; border-radius: 14px; }
  .step-h h2 { font-size: 26px; }

  .step-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; gap: 10px;
    padding: 10px 16px calc(10px + var(--sab));
    background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid rgba(11, 21, 38, .07);
  }
  .step-nav > span:empty { display: none; }
  .step-nav .btn { min-height: 52px; }
  .step-nav .btn.ghost { flex: none; width: 52px; padding: 0; background: #fff; border-color: var(--line-2); }
  .step-nav .btn.ghost span { display: none; }
  .step-nav .btn.ghost:last-child { flex: 1; width: auto; }
  .step-nav .btn.ghost:last-child span { display: inline; }
  .step-nav .btn.primary { flex: 1; }
  .step-nav .btn span { max-width: none; }

  /* Vorschau als Vollbild-Sheet */
  .ed.with-pv .pv { position: fixed; inset: 0; width: 100vw; height: 100dvh; top: 0; z-index: 60; border: 0; box-shadow: none; animation: sheet-up .25s ease-out; }
  .pv-head { padding: calc(10px + var(--sat)) 12px 10px; }
  .pv-head .seg-tabs button .ic { display: none; }
  .pv-scroll { padding: 12px 12px calc(20px + var(--sab)); }
  body:has(.ed.with-pv) { overflow: hidden; }
  @keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

  /* Karten & Inhalte */
  .card { border-radius: 18px; margin-bottom: 12px; }
  .card-h { padding: 16px 16px 0; gap: 10px; flex-wrap: wrap; }
  .card-h > .btn { margin-left: auto; }
  .card-ic { width: 34px; height: 34px; }
  .card-b { padding: 14px 16px 18px; }
  .banner { border-radius: 14px; padding: 12px 14px; font-size: 14px; }
  .choices:not(.seg) { grid-template-columns: 1fr; gap: 8px; }
  .choice > span:has(> .ic) { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 12px; align-items: center; padding: 14px 44px 14px 14px; }
  .choice > span:has(> .ic) > .ic { grid-row: span 2; margin: 0; }
  .choice > span::after { top: 50% !important; margin-top: -9px; right: 14px !important; }
  .choices.seg .choice > span { padding: 8px 14px; }
  .chips { gap: 8px; }
  .chip > span { padding: 10px 14px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tiles.kalk { grid-template-columns: 1fr; }
  .tile { border-radius: 16px; }
  .tile strong { font-size: 20px; }
  .hero-main { border-radius: 18px; padding: 18px; }
  .hero-main strong { font-size: 32px; }
  .totals { width: 100%; min-width: 0; border-radius: 14px; }
  .add-row { gap: 8px; }
  .add-row .sel { min-width: 0; max-width: none; flex: 1 1 100%; }
  .add-row > .btn { flex: 1 1 auto; }
  .vat-row { gap: 10px; }
  .vat-t { min-width: 0; flex: 1 1 calc(100% - 50px); }
  .vat-amt { margin-left: auto; }
  .row:not(.head) { border-radius: 14px !important; }
  .two { gap: 0; }
  .summary { grid-template-columns: 96px 1fr; }
  .send-btns, .docs-btns { grid-template-columns: 1fr; }
  .doc-btn { flex-direction: row; align-items: center; gap: 12px; }
  .doc-btn .ic { margin: 0; }
  .doc-btn small { margin-left: auto; text-align: right; }
  .checklist li { padding: 12px 14px; border-radius: 12px; }
  .linkbox input { min-height: 44px; }
  table.plan-cmp, table.hf { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  /* ---------- Einstellungen ---------- */
  .set { padding: 18px 16px calc(110px + var(--sab)); gap: 10px; }
  .set-nav { display: contents; }
  .set-nav h1 { font-size: 30px; margin: 0; letter-spacing: -.03em; }
  .set-nav nav { position: sticky; top: calc(56px + var(--sat)); z-index: 20; flex-direction: row; gap: 6px; margin: 0 -16px; padding: 8px 16px; overflow-x: auto; scrollbar-width: none; background: linear-gradient(var(--bg) 80%, transparent); }
  .set-nav nav::-webkit-scrollbar { display: none; }
  .set-nav a { flex: none; padding: 8px 14px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-size: 14px; }
  .set-nav a .ic { width: 16px; height: 16px; }
  .set-nav .hint { margin: 0; }
  .set-nav .save { margin: 0; }
  .set-main > div { scroll-margin-top: calc(120px + var(--sat)); }

  /* ---------- Heizlast-Modul ---------- */
  .hlm { padding: calc(12px + var(--sat)) 16px calc(40px + var(--sab)); }
  .hlm-head { flex-wrap: nowrap; gap: 6px; }
  .hlm-head .ed-title h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hlm-head .ed-title small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hlm-head .spacer { display: none; }
  .hlm-head .save { font-size: 0; gap: 0; }
  .hlm-head > .btn { padding: 0; width: 44px; flex: none; }
  .hlm-head > .btn span { display: none; }
  .hlm-tabs { position: sticky; top: calc(6px + var(--sat)); z-index: 20; display: flex; flex-wrap: nowrap !important; overflow-x: auto; box-shadow: 0 4px 16px rgba(11, 21, 38, .08); }
  .hlm-tabs button { flex: none; }

  /* ---------- Login ---------- */
  .login-wrap { padding: 20px 16px; align-items: center; }
  .login { padding: 32px 22px; border-radius: 24px; }
}

@media (max-width: 400px) {
  .stat strong { font-size: 21px; }
  .step-h h2 { font-size: 23px; }
  .orow { padding: 12px 14px; gap: 8px 10px; grid-template-columns: 40px minmax(0, 1fr) auto; }
  .orow .avatar { width: 40px; height: 40px; }
}

/* Mobil: Positions- und Kostenzeilen als ruhige 3-Zeilen-Karten */
@container (max-width: 480px) {
  .r-p:not(.head), .r-k:not(.head) { grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1.3fr) !important; gap: 8px; align-items: center; }
  .r-p > textarea, .r-k > textarea, .r-k > .art { grid-column: 1 / -1 !important; }
  .r-p > .unit2 { align-self: start; }
  .r-k > input[type=number], .r-p > input[type=number] { text-align: center; }
  .r-p > .mini-tg, .r-k > .mini-tg { grid-column: 1; flex-direction: row; gap: 6px; padding: 0; justify-self: start; }
  .r-p > .calc, .r-k > .calc { grid-column: 2 !important; padding: 0; text-align: left; font-size: 15px; }
  .r-p > .row-act, .r-k > .row-act { grid-column: 3 !important; padding: 0; }
  .banner { flex-wrap: wrap; }
  .banner > div { flex: 1 1 calc(100% - 40px); }
  .banner .btn { margin-left: 0 !important; width: 100%; }
}
@media (max-width: 820px) {
  .brand > span:last-child { display: inline !important; }
  table.plan-cmp { display: table; white-space: normal; }
  table.plan-cmp thead { display: none; }
  table.plan-cmp tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.plan-cmp tr:last-child { border-bottom: 0; }
  table.plan-cmp td { padding: 0; border: 0; }
  table.plan-cmp td:nth-child(1) { grid-column: 1; }
  table.plan-cmp td:nth-child(6) { grid-column: 2; grid-row: 1; }
  table.plan-cmp td:nth-child(2) { grid-column: 1; font-size: 13.5px; }
  table.plan-cmp td:nth-child(2) small { display: inline; margin-left: 6px; }
  table.plan-cmp td:nth-child(3) { grid-column: 2; grid-row: 2; text-align: right; font-size: 16px; }
  table.plan-cmp td:nth-child(4) { display: none; }
  table.plan-cmp td:nth-child(5) { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
  table.plan-cmp td:nth-child(5)::before { content: "Marge netto: "; }
}

/* =====================================================================
   Geführte Heizlast-Aufnahme
   ===================================================================== */
.hlw { display: grid; grid-template-columns: 260px minmax(0, 1fr) 300px; min-height: calc(100vh - 60px); }
.hlw-main { padding: 18px 28px 60px; min-width: 0; max-width: 1000px; width: 100%; justify-self: center; container: main / inline-size; }
.hlw-aside { position: sticky; top: 76px; align-self: start; display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 30px 0; max-height: calc(100vh - 76px); overflow: auto; }
.hlw .hlm-head { margin-bottom: 14px; }
.step-lead { margin: -8px 0 18px; color: var(--ink-2); font-size: 14.5px; max-width: 70ch; }
.hl-mini { display: none; }

/* Anleitung „So misst du“ */
.guide { margin: 0 0 16px; border: 1px solid #f1dfb8; background: linear-gradient(180deg, #fffaf0, #fffdf8); border-radius: 16px; }
.guide summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; font-weight: 650; color: #6b4708; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary > .ic:first-child { color: #d48a0c; }
.guide summary span { flex: 1; }
.gd-chev { transition: transform .2s; color: #b9944f; }
details[open] > summary .gd-chev { transform: rotate(180deg); }
.guide ol { margin: 0; padding: 0 18px 4px 40px; display: flex; flex-direction: column; gap: 8px; color: #4a3a1c; }
.guide li { padding-left: 4px; line-height: 1.5; }
.guide li::marker { font-weight: 700; color: #c47f0a; }
.guide-tip { display: flex; gap: 8px; margin: 10px 16px 14px; padding: 10px 12px; background: #fff; border-radius: 10px; font-size: 13px; color: var(--ink-2); }
.guide-tip .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--brand); }
.guide:not([open]) { background: #fffdf8; }
.card-b > .guide { margin-bottom: 4px; }

/* Prüfliste je Schritt */
.pf-card { border-style: dashed; }
.pf-list { display: flex; flex-direction: column; gap: 6px; }
.pf { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-radius: 10px; background: #f6f8fa; font-size: 13.5px; }
.pf > .ic { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.pf span { flex: 1; }
.pf.ok > .ic { color: var(--ok); }
.pf.todo { background: var(--bad-soft); color: #7f1d1a; }
.pf.todo > .ic { color: var(--bad); }
.pf.warn { background: var(--warn-soft); color: #7a3e06; }
.pf.warn > .ic { color: var(--warn); }
.pf[data-goto], .pf[data-gotok] { cursor: pointer; }
.pf-go { width: 16px !important; height: 16px !important; opacity: .6; }

/* Vorbereitung */
.ablauf { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: ab; }
.ablauf li { display: flex; gap: 12px; align-items: flex-start; }
.ab-ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 11px; background: var(--brand-soft); color: var(--brand); }
.ab-ic .ic { width: 18px; height: 18px; }
.ablauf strong { display: block; }
.ablauf small { color: var(--muted); font-size: 13px; }
.kit { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.kit li { display: flex; gap: 10px; align-items: flex-start; padding: 12px; background: #f8fafc; border-radius: 12px; }
.kit li > .ic { color: var(--brand); margin-top: 2px; }
.kit strong { display: block; font-weight: 600; }
.kit small { color: var(--muted); font-size: 12.5px; }

/* Schnellwahl-Chips */
.qchip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1.5px solid var(--line-2); border-radius: 99px; background: #fff; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.qchip strong { color: var(--ink); }
.qchip:hover { border-color: var(--brand); }
.qchip.on { border-color: var(--brand); background: var(--brand-softer); }

/* Konstruktionen */
.kcard.is-est { border-color: #f1dfb8; }

/* Räume */
.rgrid { grid-template-columns: 220px minmax(0, 1fr); }
.ritem-st { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; background: #eef1f5; color: #a3afbf; }
.ritem-st .ic { width: 12px; height: 12px; stroke-width: 3; }
.ritem-st.ok { background: var(--ok); color: #fff; }
.rmain { min-width: 0; scroll-margin-top: 80px; }
.rsec .card-h { align-items: center; }
.rsec-n { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: 14px; }
.rsec-st { color: var(--ok); }
.rsec-st .ic { width: 22px; height: 22px; }
.fas { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: #fbfcfe; }
.fas-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.fas-h > .ic { color: var(--brand); }
.fas-ori { flex: 1; font-weight: 650; border-color: transparent; background-color: transparent; padding-left: 4px; }
.fas-ori:hover { border-color: var(--line-2); background-color: #fff; }
.oef { margin: 10px 0 0 14px; padding: 10px 0 0 12px; border-left: 3px solid #cfe0f3; }
.fas-add { display: flex; gap: 6px; margin: 10px 0 0 14px; flex-wrap: wrap; }
.el-grid { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; }
.mf { display: flex; flex-direction: column; gap: 4px; flex: 1 1 110px; min-width: 0; max-width: 170px; }
.mf.wide { flex: 2 1 220px; max-width: none; }
.mf.sm { flex: 0 1 80px; }
.mf > span:first-child { font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mf select, .mf input { min-width: 0; }
.el-res { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; min-width: 92px; min-height: 40px; margin-left: auto; font-variant-numeric: tabular-nums; text-align: right; line-height: 1.25; }
.el-res strong { font-size: 14px; }
.el-res small { font-size: 11.5px; color: var(--muted); }
.el-grid > .icon-btn { align-self: flex-end; }
.room-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.room-act { display: flex; gap: 2px; }
#raumRes { margin-top: 4px; }

/* Heizflächen */
.hk-dk { display: flex; flex-direction: column; align-items: flex-end; font-weight: 750; font-size: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hk-dk small { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.hk-dk.ok { color: var(--ok); }
.hk-dk.bad { color: var(--bad); }

/* Live-Spalte */
.aside-todo { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.at-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 2px 4px; }
.at-h .ic { color: var(--brand); width: 17px; height: 17px; }
.at-h small { color: var(--muted); font-size: 12px; margin-left: auto; }
.at-i { display: block; text-align: left; border: 0; border-left: 3px solid var(--bad); background: #fafbfc; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.at-i span { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.at-i.warn { border-left-color: var(--warn); }
.at-i:hover { background: var(--brand-softer); }

@media (max-width: 1240px) {
  .hlw { grid-template-columns: 240px minmax(0, 1fr); }
  .hlw-aside { display: none; }
  .hl-mini { display: block; margin: 0 0 16px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
  .hl-mini summary { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; list-style: none; }
  .hl-mini summary::-webkit-details-marker { display: none; }
  .hm-v { display: flex; align-items: baseline; gap: 8px; flex: 1; }
  .hm-v .ic { color: var(--heat); align-self: center; }
  .hm-v strong { font-size: 18px; font-variant-numeric: tabular-nums; }
  .hm-v small { color: var(--muted); font-size: 12.5px; }
  .hm-o { font-size: 12.5px; font-weight: 650; padding: 3px 10px; border-radius: 99px; background: var(--bad-soft); color: var(--bad); }
  .hm-o.ok { background: var(--ok-soft); color: var(--ok); }
  .hm-b { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }
}
@media (max-width: 820px) {
  .hlw { grid-template-columns: 1fr; min-height: 100vh; }
  body:has(.hlw) .topbar, body:has(.hlw) .tabbar { display: none; }
  .hlw-main { padding: 14px 16px calc(104px + var(--sab)); }
  .hlw .hl-mini { position: sticky; top: calc(66px + var(--sat)); z-index: 22; }
  .hlw .hlm-head .btn span { display: none; }
  .hlw .hlm-head .btn { width: 44px; padding: 0; }
  .rgrid { grid-template-columns: 1fr; gap: 12px; }
  .rlist { flex-direction: row; overflow-x: auto; padding: 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .rlist::-webkit-scrollbar { display: none; }
  .ritem { flex: none; scroll-snap-align: start; border: 1px solid var(--line); background: #fff; padding: 8px 12px 8px 8px; max-width: 220px; }
  .ritem.active { border-color: var(--brand); }
  .rlist .add-row { flex: none; margin: 0; flex-wrap: nowrap; }
  .rlist .add-row .btn { flex: none; }
  .mf { flex: 1 1 calc(50% - 6px); max-width: none; }
  .mf.wide { flex-basis: 100%; }
  .mf.sm { flex: 1 1 70px; }
  .el-res { min-width: 0; flex: 1 1 auto; align-items: flex-start; text-align: left; }
  .oef { margin-left: 4px; }
  .fas-add { margin-left: 4px; }
  .guide ol { padding-left: 34px; }
  .step-lead { font-size: 14px; }
  .room-nav > .btn { flex: 1 1 auto; }
  .kit { grid-template-columns: 1fr; }
}
.hlw-over { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hlw-over a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: #f8fafc; text-decoration: none; color: var(--ink); }
.hlw-over a:hover { background: var(--brand-softer); }
.hlw-over a > .ic { color: #a3afbf; }
.ho-n { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: #e7ebf1; color: var(--muted); font-weight: 700; font-size: 13px; }
.ho-n .ic { width: 15px; height: 15px; stroke-width: 3; }
.hlw-over li.ok .ho-n { background: var(--ok); color: #fff; }
.ho-t { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ho-t small { color: var(--muted); font-size: 12.5px; }
.hlw-over li:not(.ok) .ho-t small { color: var(--bad); }
