:root {
  --bg: #f4f6f9; --card: #fff; --ink: #0f1b2d; --ink-2: #334155; --muted: #6b7a90; --line: #e3e8ef; --line-2: #d3dae4;
  --brand: #1f5fa8; --brand-2: #174a85; --brand-soft: #eaf1fb; --brand-softer: #f4f8fd;
  --heat: #e8811c; --heat-soft: #fff3e6;
  --ok: #15803d; --ok-soft: #e8f6ee; --warn: #b45309; --warn-soft: #fff6e5; --bad: #c2312a; --bad-soft: #fdeceb;
  --r: 14px; --r-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 2px 8px rgba(15, 27, 45, .04);
  --shadow-lg: 0 10px 30px rgba(15, 27, 45, .10);
}
* { 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; -webkit-font-smoothing: antialiased; }
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; }
.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 110px 104px; }
.r-k { grid-template-columns: 190px minmax(0, 1fr) 72px 72px 120px 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: 320px; 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; padding: 3px 0; color: var(--ink-2); }
.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) { 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: 70px 76px minmax(0, 1fr) minmax(0, 1fr) auto; }
  .r-p > textarea { grid-column: 1 / -1; }
  .r-k:not(.head) { grid-template-columns: 70px 76px minmax(0, 1fr) 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 > .f { grid-column: span 12; }
  .docs-btns, .send-btns { grid-template-columns: 1fr; }
}
@container main (max-width: 820px) {
  .two { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
}

/* 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, .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: minmax(0, 1fr) minmax(0, 1fr) 70px; }
  .r-el > select:nth-child(1) { grid-column: 1 / 3; }
  .r-hk:not(.head) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 70px; }
  .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; } }
