/* CALK · Gestaltung
   Leitidee: technisches Zeichenblatt. Papiertöne, Tusche, blaue Maßlinien, gelber Markierstift.
   Schmale Versalien-Schrift für Überschriften (wie Normschrift), Monoschrift für Zahlen. */

@font-face { font-family: 'CALK Cond'; src: url('../fonts/heros-cn-bold.otf') format('opentype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'CALK Cond'; src: url('../fonts/heros-cn-regular.otf') format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'CALK Display'; src: url('../fonts/poppins-bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'CALK Display'; src: url('../fonts/poppins-medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'CALK Mono'; src: url('../fonts/dejavu-mono.ttf') format('truetype'); font-weight: 400; font-display: swap; }

:root {
  --paper: #F2F3EF; --sheet: #FBFBF8; --sheet-2: #F6F7F3; --ink: #182024; --muted: #59646A; --line: #D3D8D2; --line-soft: #E4E7E2;
  --dim: #2B46A3; --dim-hover: #233B8C; --on-dim: #FFFFFF; --mark: #F2C230; --mark-soft: rgba(242, 194, 48, .38);
  --warn: #A9461A; --warn-bg: #FBEFE6; --bad: #B3261E; --bad-bg: #FBEAE8; --good: #2D7A4D; --good-bg: #E8F3EC;
  --fill: rgba(43, 70, 163, .07); --shadow: 0 10px 30px rgba(24, 32, 36, .14);
  --d-ink: #182024; --d-muted: #59646A; --d-dim: #2B46A3; --d-line: #C4CBC4; --d-fill: rgba(43, 70, 163, .09); --d-paper: #FBFBF8;
  --d-accent: #F2C230; --d-warn: #A9461A; --d-b1: #2B46A3; --d-b2: #7D8FD0; --d-b3: #B04A16; --d-b4: #DE9A6A; --d-b5: #59646A; --d-b6: #C4CBC4;
  --d-good: #2D7A4D; --d-yel: #B5870A; --d-bad: #C0392B; --d-gfill: rgba(45, 122, 77, .14); --d-yfill: rgba(217, 164, 0, .20); --d-rfill: rgba(192, 57, 43, .15);
  --display: 'CALK Display', 'Segoe UI', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono-family: 'CALK Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --r: 4px; --gutter-l: max(16px, env(safe-area-inset-left, 0px)); --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --tabbar-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #111517; --sheet: #182024; --sheet-2: #1C2529; --ink: #E3E8E5; --muted: #9AA6A9; --line: #2E393D; --line-soft: #253034;
  --dim: #8FA5F4; --dim-hover: #A8B9F7; --on-dim: #0F1630; --mark: #E0B428; --mark-soft: rgba(224, 180, 40, .30);
  --warn: #F0A06C; --warn-bg: #3A2519; --bad: #FF8F86; --bad-bg: #3B1E1C; --good: #7FCC9C; --good-bg: #17301F;
  --fill: rgba(143, 165, 244, .10); --shadow: 0 12px 34px rgba(0, 0, 0, .45);
  --d-ink: #E3E8E5; --d-muted: #9AA6A9; --d-dim: #8FA5F4; --d-line: #3A464A; --d-fill: rgba(143, 165, 244, .13); --d-paper: #182024;
  --d-accent: #E0B428; --d-warn: #F0A06C; --d-b1: #8FA5F4; --d-b2: #4F64B5; --d-b3: #E07F45; --d-b4: #A86A43; --d-b5: #9AA6A9; --d-b6: #3A464A; --d-good: #7FCC9C; --d-yel: #E8C547; --d-bad: #FF8F86; --d-gfill: rgba(127, 204, 156, .16); --d-yfill: rgba(232, 197, 71, .18); --d-rfill: rgba(255, 143, 134, .16);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --paper: #111517; --sheet: #182024; --sheet-2: #1C2529; --ink: #E3E8E5; --muted: #9AA6A9; --line: #2E393D; --line-soft: #253034;
  --dim: #8FA5F4; --dim-hover: #A8B9F7; --on-dim: #0F1630; --mark: #E0B428; --mark-soft: rgba(224, 180, 40, .30);
  --warn: #F0A06C; --warn-bg: #3A2519; --bad: #FF8F86; --bad-bg: #3B1E1C; --good: #7FCC9C; --good-bg: #17301F;
  --fill: rgba(143, 165, 244, .10); --shadow: 0 12px 34px rgba(0, 0, 0, .45);
  --d-ink: #E3E8E5; --d-muted: #9AA6A9; --d-dim: #8FA5F4; --d-line: #3A464A; --d-fill: rgba(143, 165, 244, .13); --d-paper: #182024;
  --d-accent: #E0B428; --d-warn: #F0A06C; --d-b1: #8FA5F4; --d-b2: #4F64B5; --d-b3: #E07F45; --d-b4: #A86A43; --d-b5: #9AA6A9; --d-b6: #3A464A; --d-good: #7FCC9C; --d-yel: #E8C547; --d-bad: #FF8F86; --d-gfill: rgba(127, 204, 156, .16); --d-yfill: rgba(232, 197, 71, .18); --d-rfill: rgba(255, 143, 134, .16);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; padding-top: env(safe-area-inset-top, 0px); }
body.sheet-open { overflow: hidden; }
[hidden] { display: none !important; }
a { color: var(--dim); text-underline-offset: 3px; }
img, svg { max-width: 100%; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--dim); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; display: block; }

.display { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .01em; line-height: 1; font-size: clamp(1.9rem, 5vw, 2.7rem); }
.eyebrow { font-family: var(--display); font-weight: 700; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.lead { color: var(--muted); max-width: 62ch; margin-top: 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hint { color: var(--muted); font-size: .86rem; line-height: 1.45; }
.hint.strong { color: var(--ink); }
.empty { color: var(--muted); padding: 8px 0; }

/* ---------- Boot ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark { display: grid; justify-items: center; gap: 10px; font-family: var(--display); font-weight: 700; letter-spacing: .2em; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) { .boot-mark img { animation: pulse 1.4s ease-in-out infinite; } }
@keyframes pulse { 50% { opacity: .55; transform: scale(.96); } }

/* ---------- Rahmen ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 24px; padding: 10px var(--gutter-r) 10px var(--gutter-l); background: var(--paper); border-bottom: 1.5px solid var(--ink); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--paper); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-word { font-family: var(--display); font-weight: 700; font-size: 1.45rem; letter-spacing: .12em; }
.topnav { display: none; gap: 4px; }
.topnav a { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .95rem; color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: var(--r); }
.topnav a:hover { color: var(--ink); background: var(--sheet-2); }
.topnav a.active { color: var(--ink); background: linear-gradient(transparent 62%, var(--mark-soft) 62%); }
.top-user { margin-left: auto; color: var(--muted); font-size: .9rem; display: none; }
.main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 22px var(--gutter-r) calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); display: grid; gap: 22px; align-content: start; }
.main.wide { max-width: 1440px; }
.tabbar { position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--sheet); border-top: 1.5px solid var(--ink); padding: 0 var(--gutter-r) env(safe-area-inset-bottom, 0px) var(--gutter-l); }
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 9px 0 8px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; letter-spacing: .02em; }
.tabbar a .ic { width: 22px; height: 22px; }
.tabbar a.active { color: var(--dim); }
.tabbar a.active .ic { stroke-width: 2.1; }
@media (min-width: 900px) {
  .topnav, .top-user { display: flex; }
  .tabbar { display: none; }
  .main { padding-bottom: 48px; }
}
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.page-head .eyebrow { margin-bottom: 6px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Bedienelemente ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 16px; border: 1.5px solid var(--ink); border-radius: var(--r); background: var(--sheet); color: var(--ink); font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .92rem; cursor: pointer; text-decoration: none; transition: background .15s, color .15s, transform .05s; }
.btn:hover { background: var(--ink); color: var(--sheet); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn.primary { background: var(--dim); border-color: var(--dim); color: var(--on-dim); }
.btn.primary:hover { background: var(--dim-hover); border-color: var(--dim-hover); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: var(--sheet-2); color: var(--ink); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--bad); border-color: transparent; }
.btn.danger.ghost:hover { background: var(--bad-bg); }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: .8rem; }
.btn.wide { width: 100%; }
.btn .ic { width: 18px; height: 18px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; background: transparent; color: var(--muted); border-radius: var(--r); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--sheet-2); color: var(--ink); }
.q-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; margin: -5px 0; border: 0; border-radius: 50%; background: transparent; color: var(--dim); cursor: pointer; flex: none; }
.q-btn .ic { width: 20px; height: 20px; }
.q-btn:hover { background: var(--fill); }
.chip-btn { border: 0; border-left: 1px solid var(--line); background: var(--sheet-2); padding: 0 12px; font-size: .82rem; font-weight: 600; color: var(--dim); cursor: pointer; white-space: nowrap; }
.chip-btn:hover { background: var(--fill); }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field-top label { font-weight: 600; font-size: .95rem; }
.field-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mini { font-size: .84rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), textarea, select {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--sheet); outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--dim); box-shadow: 0 0 0 3px var(--fill); }
textarea { resize: vertical; min-height: 90px; }
.select { position: relative; }
.select select { appearance: none; -webkit-appearance: none; padding-right: 36px; }
.select::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.num { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--sheet); overflow: hidden; }
.num:focus-within { border-color: var(--dim); box-shadow: 0 0 0 3px var(--fill); }
.num input { border: 0; box-shadow: none !important; min-width: 0; flex: 1; font-family: var(--mono-family); font-size: 1.02rem; font-variant-numeric: tabular-nums; background: transparent; }
.num input.invalid { color: var(--bad); }
.num .unit { display: flex; align-items: center; padding: 0 12px; font-family: var(--mono-family); font-size: .85rem; color: var(--muted); border-left: 1px solid var(--line-soft); background: var(--sheet-2); white-space: nowrap; }
.num.small input { min-height: 38px; padding: 6px 8px; }
.stack { display: grid; gap: 8px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1.5px solid var(--ink); border-radius: var(--r); overflow: hidden; }
.seg > button, .seg > a { border: 0; background: transparent; padding: 9px 14px; font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .88rem; cursor: pointer; color: var(--ink); text-decoration: none; text-align: center; }
.seg > * + * { border-left: 1.5px solid var(--ink) !important; }
.seg > [aria-pressed="true"] { background: var(--ink); color: var(--sheet); }
.seg.tabs { justify-self: start; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: .95rem; }
.switch input { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 12px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--sheet); box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked { background: var(--dim); }
.switch input:checked::after { transform: translateX(18px); }
.row-check { display: flex; gap: 8px; align-items: center; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.alert { padding: 12px 14px; border-radius: var(--r); border-left: 4px solid; }
.alert.ok { background: var(--good-bg); border-color: var(--good); }
.alert.bad { background: var(--bad-bg); border-color: var(--bad); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.form-error { color: var(--bad); font-size: .9rem; min-height: 0; }
.form-error:empty { display: none; }

.card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 14px; min-width: 0; }
.card h2 { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: 1.15rem; }
.cols { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .cols { grid-template-columns: 1fr 1fr; } }
.sec-head { display: flex; align-items: center; gap: 8px; }
.sec-head h2 { flex: 1; font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: 1.2rem; }
.link-more { font-size: .9rem; font-weight: 600; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: var(--fill); color: var(--dim); }
.pill.off { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- Anmeldung ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px var(--gutter-r) 24px var(--gutter-l);
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px); background-size: 24px 24px; background-position: -1px -1px; }
.auth-wrap { width: 100%; max-width: 440px; display: grid; gap: 18px; }
.auth-brand { display: grid; justify-items: start; gap: 4px; }
.auth-word { font-family: var(--display); font-weight: 700; font-size: 3.2rem; letter-spacing: .14em; line-height: 1; margin-top: 8px; }
.auth-tag { color: var(--muted); }
.auth-card { background: var(--sheet); border: 1.5px solid var(--ink); border-radius: var(--r); padding: 22px; box-shadow: 6px 6px 0 var(--mark); }
.auth-card .display { font-size: 1.6rem; }
.auth-foot { color: var(--muted); font-size: .8rem; }

/* ---------- Start ---------- */
.mod-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .mod-grid { grid-template-columns: 1fr 1fr; } }
.mod-card { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; gap: 6px 16px; padding: 18px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--sheet); text-decoration: none; color: var(--ink); min-width: 0; }
.mod-card.active { border-color: var(--ink); }
.mod-card.active:hover { box-shadow: 5px 5px 0 var(--mark); transform: translate(-2px, -2px); }
@media (prefers-reduced-motion: no-preference) { .mod-card { transition: transform .15s, box-shadow .15s; } }
.mod-card.soon { color: var(--muted); background: var(--sheet-2); border-style: dashed; }
.mod-icon { grid-row: span 2; width: 48px; height: 48px; display: grid; place-items: center; border: 1.5px solid currentColor; border-radius: var(--r); }
.mod-card.active .mod-icon { color: var(--dim); }
.mod-icon .ic { width: 28px; height: 28px; }
.mod-text h2 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 1.3rem; letter-spacing: .03em; }
.mod-text p { font-size: .92rem; color: var(--muted); margin-top: 4px; }
.mod-state { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; color: var(--dim); }
.mod-card.soon .mod-state { color: var(--muted); }

/* ---------- Listen ---------- */
.calc-list, .user-list { list-style: none; margin: 0; padding: 0; display: grid; }
.calc-row, .user-row { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line-soft); }
.calc-row:first-child, .user-row:first-child { border-top: 0; }
.calc-link { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; padding: 12px 4px; color: var(--ink); text-decoration: none; }
.calc-link:hover b { text-decoration: underline; text-decoration-color: var(--mark); text-decoration-thickness: 3px; }
.calc-no { grid-row: span 2; align-self: start; font-family: var(--mono-family); font-size: .8rem; color: var(--dim); padding-top: 3px; min-width: 52px; }
.calc-main { display: grid; min-width: 0; }
.calc-main b { font-weight: 650; overflow-wrap: anywhere; }
.calc-main small { color: var(--muted); }
.calc-sum { grid-column: 2; font-family: var(--mono-family); font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.calc-acts { display: flex; }
.filters { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .filters { grid-template-columns: 200px 220px 1fr; } }
.search { position: relative; }
.search .ic { position: absolute; left: 12px; top: 12px; color: var(--muted); width: 19px; height: 19px; }
.search input { padding-left: 40px; }
.count { color: var(--muted); font-size: .85rem; }
.list-card { gap: 6px; }
.user-row { padding: 10px 0; }
.user-main { flex: 1; min-width: 0; display: grid; }
.user-main small { color: var(--muted); overflow-wrap: anywhere; }
.user-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: end; }
.user-row.inactive .user-main b { color: var(--muted); text-decoration: line-through; }
.proj-list { display: grid; gap: 8px; }
.proj-row { display: flex; align-items: center; gap: 6px; }
.proj-row input { flex: 1; min-width: 0; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-family: var(--mono-family); font-size: .9rem; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.creds { font-family: var(--mono-family); background: var(--sheet-2); border: 1px solid var(--line); padding: 12px; border-radius: var(--r); white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; margin: 0; }

/* ---------- Rechner ---------- */
.calc { display: grid; gap: 16px; }
.calc-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; justify-content: space-between; padding-bottom: 12px; border-bottom: 1.5px solid var(--ink); }
.calc-titles { min-width: 0; }
.calc-title { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(1.5rem, 4vw, 2.2rem); line-height: 1.05; overflow-wrap: anywhere; }
.calc-meta { color: var(--muted); font-size: .88rem; margin-top: 4px; }
.calc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mob-seg { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--ink); border-radius: var(--r); overflow: hidden; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 59px); z-index: 15; background: var(--sheet); }
.mob-seg button { border: 0; background: transparent; padding: 10px; font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
.mob-seg button + button { border-left: 1.5px solid var(--ink); }
.mob-seg [aria-selected="true"] { background: var(--ink); color: var(--sheet); }
.calc-layout { display: grid; gap: 20px; }
.calc-layout.show-in .pane-out, .calc-layout.show-out .pane-in { display: none; }
.pane { min-width: 0; }
@media (min-width: 1000px) {
  .mob-seg { display: none; }
  .calc-layout, .calc-layout.show-in, .calc-layout.show-out { grid-template-columns: 380px minmax(0, 1fr); align-items: start; }
  .calc-layout .pane-in, .calc-layout .pane-out { display: block !important; }
  .pane-in { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 72px); max-height: calc(100vh - 88px); overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
}
.inputs { display: grid; gap: 10px; }
.group { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); }
.group summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; }
.group summary::-webkit-details-marker { display: none; }
.g-num { display: grid; place-items: center; width: 24px; height: 24px; border: 1.5px solid var(--ink); border-radius: 50%; font-family: var(--display); font-weight: 700; font-size: .85rem; }
.g-title { flex: 1; font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 1.02rem; }
.g-chev { color: var(--muted); transition: transform .15s; }
.group[open] .g-chev { transform: rotate(90deg); }
.group-body { display: grid; gap: 18px; padding: 4px 14px 18px; border-top: 1px dashed var(--line); padding-top: 14px; }
.hint-inline { font-family: var(--mono-family); font-size: .8rem; }
.slider { display: grid; gap: 2px; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row input[type=range] { flex: 1; accent-color: var(--dim); min-width: 0; height: 30px; }
.slider-val { font-family: var(--mono-family); font-size: 1.02rem; min-width: 52px; text-align: right; padding: 2px 6px; background: linear-gradient(transparent 55%, var(--mark-soft) 55%); }
.ticks { display: flex; justify-content: space-between; font-size: .74rem; color: var(--muted); font-family: var(--mono-family); }
.bends { display: grid; gap: 8px; }
.bend-row { display: grid; grid-template-columns: 22px 1fr 1.2fr 40px; gap: 6px; align-items: center; }
.bend-no { font-family: var(--mono-family); font-size: .8rem; color: var(--muted); }
.bends .btn { justify-self: start; }
.device-box { display: grid; gap: 6px; padding: 10px; border-left: 3px solid var(--line); }

.jump { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 105px); z-index: 10; display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; margin-bottom: 6px; background: var(--paper); scrollbar-width: none; }
.jump::-webkit-scrollbar { display: none; }
.jump a { flex: none; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--sheet); font-size: .85rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.jump a:hover { border-color: var(--ink); }
@media (min-width: 1000px) { .jump { top: calc(env(safe-area-inset-top, 0px) + 56px); } }
.results { display: grid; gap: 18px; }
.results > * { scroll-margin-top: 130px; }

.verdict { position: relative; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: var(--r); padding: 18px 18px 18px 22px; display: grid; gap: 14px; overflow: hidden; }
.verdict::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--good); }
.verdict.tone-mid::before { background: var(--mark); }
.verdict.tone-bad::before { background: var(--warn); }
.verdict-head { font-size: clamp(1.15rem, 2.6vw, 1.4rem); font-weight: 650; line-height: 1.3; max-width: 60ch; }
.verdict h3 { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .9rem; margin-bottom: 6px; }
.verdict-cols { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .verdict-cols { grid-template-columns: 1fr 1fr; } }
.list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.list li { position: relative; padding-left: 20px; font-size: .95rem; line-height: 1.45; }
.list li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 9px; height: 9px; border-radius: 2px; background: var(--muted); }
.list.can li::before { background: var(--good); }
.list.cannot li::before { background: var(--warn); }
.list.tip li::before { background: var(--dim); }
.list.numbered { counter-reset: n; }
.list.numbered li { counter-increment: n; padding-left: 28px; }
.list.numbered li::before { content: counter(n); background: none; width: auto; height: auto; top: 0; font-family: var(--display); font-weight: 700; color: var(--dim); }

.tiles { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 12px 10px; display: grid; gap: 2px; align-content: start; min-width: 0; }
.tile-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.tile-label { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; color: var(--muted); }
.tile-val { display: flex; align-items: baseline; gap: 6px; font-family: var(--mono-family); font-variant-numeric: tabular-nums; }
.tile-val b { font-weight: 400; font-size: clamp(1.25rem, 3vw, 1.6rem); letter-spacing: -.02em; }
.tile-val span { color: var(--muted); font-size: .85rem; }
.tile-sub { font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.tile.key { border-color: var(--ink); }
.tile.key .tile-val b { background: linear-gradient(transparent 58%, var(--mark-soft) 58%); }

.sheetish { position: relative; }
.sheetish::before, .sheetish::after { content: ""; position: absolute; width: 14px; height: 14px; border: solid var(--ink); }
.sheetish::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.sheetish::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
.view-cap { font-family: var(--display); font-weight: 700; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.view-cap-row { display: flex; align-items: center; gap: 6px; }
.drawing { width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.drawing svg { display: block; width: 100%; height: auto; }
#dw-plan svg, #dw-side svg { min-width: 620px; }
.swipe-hint { font-size: .8rem; color: var(--muted); }
@media (min-width: 700px) { .swipe-hint { display: none; } }
.drawing.small { max-width: 520px; }
.subsec { display: grid; gap: 10px; padding-top: 6px; }
.subsec + .subsec { border-top: 1px dashed var(--line); padding-top: 16px; }
.subsec-head { display: flex; align-items: center; gap: 8px; }
.subsec-head h3 { font-size: 1.02rem; font-weight: 650; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r); }
table.data { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.data th { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .74rem; color: var(--muted); text-align: right; padding: 8px 10px; border-bottom: 1.5px solid var(--ink); vertical-align: bottom; line-height: 1.2; background: var(--sheet); }
table.data td { font-family: var(--mono-family); font-size: .86rem; text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data tr.interp td { color: var(--muted); }
table.data tbody tr:hover td { background: var(--fill); }
table.data.kv td { white-space: normal; text-align: left; font-family: var(--body); font-size: .9rem; }
table.data.kv td:first-child { font-weight: 600; width: 38%; }
table.data.kv td:last-child { font-family: var(--mono-family); font-size: .85rem; }
.budget svg { display: block; border-radius: 3px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.legend li { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 10px; align-items: center; font-size: .92rem; }
.legend b { font-family: var(--mono-family); font-weight: 400; }
.legend small { font-family: var(--mono-family); color: var(--muted); min-width: 64px; text-align: right; }
.sw { width: 14px; height: 14px; border-radius: 3px; display: block; }
.sw-b1 { background: var(--d-b1); } .sw-b2 { background: var(--d-b2); } .sw-b3 { background: var(--d-b3); } .sw-b4 { background: var(--d-b4); } .sw-b5 { background: var(--d-b5); } .sw-b6 { background: var(--d-b6); }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.notes li { display: flex; gap: 10px; align-items: start; padding: 10px 12px; border-radius: var(--r); background: var(--fill); font-size: .93rem; }
.notes li .ic { color: var(--dim); margin-top: 1px; }
.notes li.note-warn { background: var(--warn-bg); } .notes li.note-warn .ic { color: var(--warn); }
.notes li.note-bad { background: var(--bad-bg); } .notes li.note-bad .ic { color: var(--bad); }
.ok-line { display: flex; gap: 8px; align-items: center; color: var(--good); }
.copy-fallback { width: 100%; min-height: 200px; font-family: var(--mono-family); font-size: .8rem; }

/* ---------- Hilfe ---------- */
.help { display: grid; gap: 10px; }
.help p { line-height: 1.6; }
.help-h { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; font-size: .9rem; color: var(--dim); margin-top: 8px; }
.terms { margin: 0; display: grid; gap: 4px; }
.terms dt { font-weight: 650; margin-top: 6px; }
.terms dd { margin: 0; color: var(--muted); line-height: 1.55; }
.help-more { margin-top: 8px; font-size: .92rem; }

/* ---------- Sheet (Dialog) ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 50; background: rgba(17, 21, 23, .45); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; }
.sheet-back.open { opacity: 1; }
.sheet { width: 100%; max-height: calc(92vh - env(safe-area-inset-top, 0px)); overflow-y: auto; background: var(--sheet); border-top: 2px solid var(--ink); border-radius: 12px 12px 0 0; padding: 0 var(--gutter-r) calc(16px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); transform: translateY(24px); transition: transform .2s; outline: none; }
.sheet-back.open .sheet { transform: none; }
@media (min-width: 700px) {
  .sheet-back { align-items: center; padding: 24px; }
  .sheet { max-width: 620px; border: 1.5px solid var(--ink); border-radius: var(--r); padding: 0 24px 22px; box-shadow: var(--shadow); }
  .sheet.wide { max-width: 860px; }
}
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-back { transition: none; } }
.sheet-head { position: sticky; top: 0; z-index: 1; background: var(--sheet); display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 16px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.sheet-head .eyebrow { grid-column: 1; }
.sheet-title { grid-column: 1; font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 1.4rem; letter-spacing: .02em; }
.sheet-close { grid-column: 2; grid-row: 1 / span 2; }
.sheet-body { display: grid; gap: 12px; }
.sheet-actions { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom, 0px)); display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 14px 0 0; margin-top: 16px; border-top: 1px solid var(--line); background: var(--sheet); }

/* ---------- Toast ---------- */
#toast { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); max-width: min(92vw, 520px); padding: 12px 16px; border-radius: var(--r); background: var(--ink); color: var(--sheet); font-size: .93rem; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }
@media (min-width: 900px) { #toast { bottom: 24px; } }

/* ---------- Wissen ---------- */
.guide-layout { display: grid; gap: 24px; }
@media (min-width: 1000px) { .guide-layout { grid-template-columns: 260px minmax(0, 1fr); align-items: start; } .toc { position: sticky; top: 84px; } }
.toc ol { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 4px; font-size: .92rem; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--dim); text-decoration: underline; }
.guide { display: grid; gap: 28px; max-width: 760px; }
.chapter { display: grid; gap: 14px; scroll-margin-top: 80px; }
.chapter h2 { display: flex; gap: 12px; align-items: baseline; font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(1.35rem, 3.2vw, 1.75rem); letter-spacing: .02em; padding-bottom: 8px; border-bottom: 1.5px solid var(--ink); }
.ch-no { font-family: var(--mono-family); font-weight: 400; font-size: .9rem; color: var(--dim); }
.chapter h3 { font-weight: 650; font-size: 1.05rem; margin-top: 6px; }
.chapter p { line-height: 1.68; max-width: 66ch; }
.parts { margin: 0; display: grid; gap: 6px; }
.parts dt { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-top: 8px; }
.parts dd { margin: 0; line-height: 1.6; }
.fig { margin: 4px 0; display: grid; gap: 8px; }
.fig-art { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; overflow: hidden; }
.fig-art svg { display: block; width: 100%; height: auto; }
.fig figcaption { font-size: .86rem; color: var(--muted); }
.sources { margin: 0; padding-left: 22px; display: grid; gap: 6px; font-size: .9rem; }
.glossary { display: grid; gap: 4px; }
.glossary dt { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-top: 12px; }
.glossary dt:first-child { margin-top: 0; }
.glossary dd { margin: 0; line-height: 1.6; max-width: 70ch; }
/* Abbildungen */
.il-t { font-family: var(--body); font-size: 15px; fill: var(--ink); }
.il-t-b { font-weight: 650; }
.il-small { font-size: 12px; fill: var(--muted); }
.il-dim-t { fill: var(--dim); }
.il-warn-t { fill: var(--warn); }
.il-good-t { fill: var(--good); }
.il-muted-s path, .il-muted-s { stroke: var(--muted); stroke-width: 1.6; fill: none; }
.il-dim-s { stroke: var(--dim); stroke-width: 1.6; fill: none; }
.il-ink-s { stroke: var(--ink); stroke-width: 1.6; }
.il-accent-s path, .il-accent-s { stroke: var(--mark); stroke-width: 2.6; fill: none; }
.il-warn-s { stroke: var(--warn); stroke-width: 1.4; }
.il-thick { stroke-width: 2.6; }
.il-fill { fill: var(--fill); }
.il-hatch { fill: var(--line); }
.il-ink-f { fill: var(--ink); }
.il-accent-f { fill: var(--mark-soft); }
.il-dim-f { fill: var(--dim); }
.il-paper { fill: var(--sheet); }
.il-grid { stroke: var(--line); stroke-width: 1; }
.il-arrowhead { fill: var(--muted); }
.il-arrowhead-dim { fill: var(--dim); }
.il-good circle { fill: var(--good); stroke: var(--sheet); stroke-width: 2.5; }
.il-mid circle { fill: var(--mark); stroke: var(--sheet); stroke-width: 2.5; }
.il-bad circle { fill: var(--warn); stroke: var(--sheet); stroke-width: 2.5; }

/* ---------- Einrichtung ---------- */
.install { background: var(--paper); }
.install-wrap { max-width: 760px; margin: 0 auto; padding: 32px var(--gutter-r) 64px var(--gutter-l); display: grid; gap: 18px; }
.install-head { display: flex; gap: 14px; align-items: center; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checks li span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: .8rem; font-weight: 700; margin-right: 6px; }
.checks li.ok span { background: var(--good-bg); color: var(--good); }
.checks li.bad span { background: var(--bad-bg); color: var(--bad); }
.checks small { color: var(--muted); margin-left: 34px; }

/* ---------- Schrift: kräftig (Standard) oder schmal-technisch (wählbar im Konto) ---------- */
html[data-font="cond"] { --display: 'CALK Cond', 'Arial Narrow', 'Roboto Condensed', sans-serif; }
html:not([data-font="cond"]) .display, html:not([data-font="cond"]) .calc-title, html:not([data-font="cond"]) .sheet-title,
html:not([data-font="cond"]) .chapter h2, html:not([data-font="cond"]) .card h2, html:not([data-font="cond"]) .sec-head h2,
html:not([data-font="cond"]) .mod-text h2, html:not([data-font="cond"]) .g-title { text-transform: none; letter-spacing: -0.01em; }
html:not([data-font="cond"]) .display { font-size: clamp(1.75rem, 4.6vw, 2.5rem); line-height: 1.1; }
html:not([data-font="cond"]) .calc-title { font-size: clamp(1.4rem, 3.6vw, 2rem); }
html:not([data-font="cond"]) .eyebrow, html:not([data-font="cond"]) .view-cap { font-weight: 500; letter-spacing: .1em; }
html:not([data-font="cond"]) .tile-label { font-weight: 500; letter-spacing: .03em; font-size: .72rem; }
html:not([data-font="cond"]) .btn, html:not([data-font="cond"]) .seg > button, html:not([data-font="cond"]) .seg > a, html:not([data-font="cond"]) .mob-seg button { text-transform: none; letter-spacing: 0; font-weight: 500; }
html:not([data-font="cond"]) .topnav a { text-transform: none; letter-spacing: 0; font-weight: 500; }
html:not([data-font="cond"]) table.data th { font-weight: 500; letter-spacing: .04em; }
html:not([data-font="cond"]) .g-title { font-size: 1rem; }

/* ---------- Hell/Dunkel-Schalter ---------- */
.theme-btn { margin-left: auto; }
@media (min-width: 900px) { .theme-btn { margin-left: 0; } }

/* ---------- Strömungsbild ---------- */
.flow-key { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .85rem; }
.fk { display: inline-flex; align-items: center; gap: 8px; }
.fk::before { content: ""; width: 22px; height: 4px; border-radius: 2px; background: var(--d-good); }
.fk.y::before { background: var(--d-yel); } .fk.r::before { background: var(--d-bad); }
.zones { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .zones { grid-template-columns: 1fr 1fr; } }
.zones li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); }
.zones li i { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; background: var(--d-good); }
.zones li.zone-y i { background: var(--d-yel); } .zones li.zone-r i { background: var(--d-bad); }
.zones li.zone-y { background: var(--d-yfill); } .zones li.zone-r { background: var(--d-rfill); }
.zones b { display: block; font-size: .95rem; }
.zones span { font-size: .9rem; color: var(--muted); line-height: 1.45; }
#dw-flow-side svg, #dw-flow-plan svg { min-width: 620px; }

/* ---------- Bemaßte Punkte ---------- */
.step-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.step-seg > button { padding: 7px 10px; font-size: .84rem; }
.drawing.ord { border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--sheet); }
.drawing.ord svg { width: auto; max-width: none; }
table.data.compact td { padding: 4px 10px; font-size: .82rem; }
table.data tr.mark td { background: var(--mark-soft); }
.table-wrap:has(table.compact) { max-height: 360px; overflow-y: auto; }
.table-wrap:has(table.compact) th { position: sticky; top: 0; }

.tile-top { min-width: 0; }
.tile-label { min-width: 0; overflow-wrap: anywhere; }
