/* Firstblick · Werkstatt
   Schiefer, Kupfer und Patina: die Materialien eines Dachs. Kupfer heisst Geld und Handeln, Patina heisst Antwort und Erfolg.
   Hell und dunkel teilen dieselben Rollen; theme.js setzt data-theme auf <html>. */
:root, :root[data-theme="light"] {
  --bg: #eeeae3; --surface: #fbf9f5; --sunk: #f3efe8; --line: #ddd5c8; --line-strong: #c4baa9;
  --fg: #1d2326; --muted: #5d584f;
  --accent: #2c6b5b; --accent-ink: #235648; --accent-soft: #dcebe4; --on-accent: #ffffff;
  --copper: #a5531b; --copper-hi: #c8773a; --copper-soft: #f5e4d3; --on-copper: #ffffff;
  --hot: #a3333a; --hot-soft: #f6e1e2; --pv: #7c6110; --pv-soft: #f3ebd2;
  --new: #355a86; --new-soft: #e2e9f2; --ok: #2c7a37; --ok-soft: #e1f0e3;
  --tex: rgba(29,35,38,.035); --tex2: rgba(29,35,38,.05);
  --shadow: 0 1px 2px rgba(29,35,38,.06), 0 10px 24px -16px rgba(29,35,38,.25);
  --display: "Archivo Narrow", "Arial Narrow", sans-serif;
  --body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1b2023; --surface: #232a2e; --sunk: #1f2528; --line: #343c41; --line-strong: #464f55;
  --fg: #ece6dc; --muted: #a39c91;
  --accent: #6fae99; --accent-ink: #8cc4b0; --accent-soft: #24372f; --on-accent: #10201b;
  --copper: #d98a4a; --copper-hi: #f0b878; --copper-soft: #3a2a1c; --on-copper: #1b2023;
  --hot: #ef8a8f; --hot-soft: #3a1f22; --pv: #e0c15a; --pv-soft: #332b12;
  --new: #93b3dc; --new-soft: #1f2a39; --ok: #82cf8a; --ok-soft: #1d3221;
  --tex: rgba(255,255,255,.025); --tex2: rgba(0,0,0,.2);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 30px -18px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--fg); font-family: var(--body); font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image: repeating-linear-gradient(0deg, var(--tex) 0 1px, transparent 1px 38px), repeating-linear-gradient(90deg, var(--tex2) 0 1px, transparent 1px 76px); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
svg { flex: none; }
a { color: var(--accent-ink); }
.wrap { max-width: 1200px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
@media (min-width: 900px) { .wrap { padding-left: 32px; padding-right: 32px; } }

/* ---------- Kopfleiste ---------- */
.bar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 32px; height: 32px; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.6rem; line-height: 1; letter-spacing: .005em; }
.brand-firm { font-size: .95rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-actions { display: flex; align-items: center; gap: 2px; }
.icon-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; background: transparent; border: 0; border-radius: 4px; padding: 8px 11px; cursor: pointer; font-size: .97rem; font-weight: 500; color: var(--fg); }
.icon-btn:hover { background: var(--sunk); }
.icon-btn svg { width: 20px; height: 20px; fill: none; }
.count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--copper); color: var(--on-copper); font-size: .78rem; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.count[data-n="0"] { background: var(--line); color: var(--muted); }
@media (max-width: 700px) { .brand-firm, .icon-btn .lbl { display: none; } .icon-btn { padding: 10px; } }

/* ---------- Grundgerüst ---------- */
main.wrap { display: grid; gap: 30px; padding-block: 40px 72px; }
h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2.2rem, 6vw, 4.3rem); line-height: .95; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.lede { margin: 0; color: var(--muted); max-width: 66ch; font-size: 1.05rem; }
.lede strong { color: var(--fg); font-weight: 600; }
.hint { font-size: .9rem; color: var(--muted); margin: 0; }
.sync { display: inline-flex; align-items: center; gap: 9px; font-size: .97rem; color: var(--muted); }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.sync.err i { background: var(--hot); }

/* ---------- Kopf: Begrüssung und Geld ---------- */
.hero { display: flex; flex-wrap: wrap; gap: 28px 40px; align-items: flex-end; justify-content: space-between; }
.hero-text { flex: 1 1 480px; display: grid; gap: 12px; min-width: 0; }
.eyebrow { margin: 0; font-size: .95rem; font-weight: 600; color: var(--accent-ink); }
.geld { flex: 0 1 auto; max-width: 100%; display: grid; gap: 4px; padding-left: 26px; border-left: 3px solid var(--copper); min-width: 0; }
.geld-l { font-size: .85rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.geld b { font-family: var(--display); font-weight: 700; font-size: clamp(2.8rem, 6vw, 4.4rem); line-height: .92; color: var(--copper); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.geld small { max-width: 34ch; font-size: .95rem; color: var(--muted); line-height: 1.4; }
@media (max-width: 700px) { .geld { padding-left: 18px; flex-basis: 100%; } }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; background: var(--line); border: 2px solid var(--line); }
.kpi { background: var(--surface); padding: 16px 20px; display: grid; gap: 1px; align-content: start; min-width: 0; }
.kpi b { font-family: var(--display); font-weight: 700; font-size: 2.7rem; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi span { font-weight: 600; }
.kpi small { font-size: .88rem; color: var(--muted); line-height: 1.35; }
.kpi.patina b { color: var(--accent); }
@media (max-width: 640px) { .kpis { grid-template-columns: minmax(0, 1fr); } .kpi { grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; align-items: baseline; } .kpi small { grid-column: 2; } .kpi b { grid-row: span 2; } }

/* ---------- Posteingang: Rückrufe und Nachfragen ---------- */
.inbox { background: var(--accent-soft); padding: 18px 22px; display: grid; gap: 10px; }
.inbox.nudge { background: var(--surface); border-top: 4px solid var(--copper); }
.inbox h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.7rem; line-height: 1.1; display: flex; align-items: center; gap: 10px; }
.inbox-list { display: grid; gap: 8px; }
.ib { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); }
.inbox.nudge .ib { background: var(--sunk); }
.ib .t { font-weight: 600; font-size: 1.05rem; }
.ib .s { font-size: .93rem; color: var(--muted); overflow-wrap: anywhere; }
.ib .a { display: flex; flex-wrap: wrap; gap: 6px; justify-content: end; align-items: center; }
.ib .wert { display: flex; gap: 6px; align-items: center; }
.ib .wert input { width: 140px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); }
@media (max-width: 700px) { .ib { grid-template-columns: minmax(0, 1fr); } .ib .a { justify-content: start; } }

/* ---------- Knöpfe ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; font-size: .98rem; font-weight: 600; padding: 9px 16px; border-radius: 4px; border: 1px solid var(--line-strong); background: transparent; color: var(--fg); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--fg); }
.btn.primary { background: var(--copper); border-color: var(--copper); color: var(--on-copper); }
.btn.primary:hover { background: var(--copper-hi); border-color: var(--copper-hi); }
.btn svg { width: 18px; height: 18px; fill: none; }
.btn:disabled { opacity: .55; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.linkish { background: none; border: 0; color: var(--accent-ink); cursor: pointer; font-size: .97rem; font-weight: 600; justify-self: start; padding: 10px 0; text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Ansichten ---------- */
.viewtabs { display: flex; flex-wrap: wrap; gap: 4px 30px; border-bottom: 1px solid var(--line); }
.viewtab { display: inline-flex; align-items: center; gap: 10px; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; padding: 6px 0 8px; cursor: pointer; font-family: var(--display); font-weight: 700; font-size: clamp(1.45rem, 3.4vw, 2rem); color: var(--muted); }
.viewtab svg { display: none; }
.viewtab:hover { color: var(--fg); }
.viewtab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--copper); }
.viewtab .count { font-family: var(--body); background: var(--line); color: var(--muted); }
.viewtab[aria-selected="true"] .count { background: var(--copper); color: var(--on-copper); }
.view { display: grid; gap: 24px; }
.intro { display: grid; gap: 8px; }
.view-h { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(1.8rem, 4.2vw, 2.6rem); line-height: 1; text-wrap: balance; }
.stack { display: grid; gap: 16px; }

/* Kennzahlen der Baugesuche als Filter */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; background: var(--line); border: 2px solid var(--line); }
.stat { background: var(--surface); padding: 14px 18px; display: grid; gap: 2px; text-align: left; border: 0; cursor: pointer; color: var(--fg); }
.stat:hover { background: var(--sunk); }
.stat b { font-family: var(--display); font-weight: 700; font-size: 2.3rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .92rem; color: var(--muted); }
.stat.st-fresh b { color: var(--copper); } .stat.hot b { color: var(--hot); } .stat.won b { color: var(--accent); }
@media (max-width: 640px) { .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Filter ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.chips, .seg { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; font-size: .95rem; font-weight: 600; cursor: pointer; border: 1px solid var(--line-strong); background: transparent; color: var(--fg); padding: 6px 14px; border-radius: 4px; }
.chip:hover { border-color: var(--fg); }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--copper); }
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search, .tools .umkreis, .sr-gde select, .sr-controls select, .sr-controls input[type="number"] { font-size: .97rem; padding: 9px 12px; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--surface); min-height: 44px; }
.search-box { position: relative; width: min(100%, 260px); }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search-box .search { width: 100%; padding-left: 38px; }
@media (max-width: 640px) { .tools { width: 100%; } .search-box { flex: 1; width: auto; } }
.seen-all { justify-self: start; font-size: .95rem; background: none; border: 0; color: var(--accent-ink); cursor: pointer; padding: 6px 0; text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Projektliste ---------- */
.list { display: grid; gap: 12px; }
.group-title { font-family: var(--display); font-weight: 700; font-size: 1.6rem; margin: 18px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.group-title:first-child { margin-top: 0; }
.group-title small { font-family: var(--body); font-size: .95rem; font-weight: 400; color: var(--muted); }
.row { position: relative; background: var(--surface); display: grid; grid-template-columns: minmax(0, 1fr); box-shadow: var(--shadow); }
.stripe { height: 4px; background: var(--line-strong); }
.row.hot .stripe { background: var(--hot); } .row.pv .stripe { background: var(--pv); } .row.new .stripe { background: var(--new); }
.row.is-fresh .stripe { background: var(--copper); }
.row.is-done { opacity: .62; }
.row-body { min-width: 0; }
.row-head { width: 100%; text-align: left; background: none; border: 0; padding: 16px 70px 16px 20px; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 20px; align-items: start; color: var(--fg); }
.row-main { display: grid; gap: 6px; min-width: 0; }
.row-top { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.place { font-family: var(--display); font-weight: 700; font-size: 1.65rem; line-height: 1.05; }
.plz { font-size: .92rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pill { font-size: .82rem; font-weight: 600; padding: 2px 9px; border-radius: 3px; background: var(--new-soft); color: var(--new); }
.hot .pill.cat { background: var(--hot-soft); color: var(--hot); }
.pv .pill.cat { background: var(--pv-soft); color: var(--pv); }
.desc { margin: 0; font-size: 1.08rem; }
.meta { display: flex; flex-wrap: wrap; gap: 2px 18px; font-size: .93rem; color: var(--muted); }
.meta b { color: var(--fg); font-weight: 600; }
.row-side { display: grid; justify-items: end; gap: 8px; text-align: right; }
.way { font-size: .93rem; font-weight: 700; color: var(--copper); }
.status { font-size: .82rem; font-weight: 600; padding: 2px 10px; border-radius: 3px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.status[data-s="kontaktiert"], .status[data-s="angeschrieben"], .status[data-s="anfrage"] { background: var(--new-soft); color: var(--new); border-color: transparent; }
.status[data-s="offerte"] { background: var(--pv-soft); color: var(--pv); border-color: transparent; }
.status[data-s="gewonnen"], .status[data-s="auftrag"] { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.status[data-s="vorgemerkt"] { background: var(--copper-soft); color: var(--copper); border-color: transparent; }
.chev { width: 20px; height: 20px; color: var(--muted); transition: transform .2s; }
.row[data-open="true"] .chev { transform: rotate(180deg); }
@media (max-width: 640px) {
  .row-head { grid-template-columns: minmax(0, 1fr); padding: 14px 60px 14px 16px; }
  .row-side { justify-items: start; text-align: left; grid-auto-flow: column; justify-content: start; align-items: center; }
  .place { font-size: 1.45rem; }
}
.fresh { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; padding: 3px 9px; border-radius: 3px; color: var(--on-copper); background: var(--copper); align-self: center; }
.age { font-size: .9rem; color: var(--muted); }

/* Speichern-Lesezeichen */
.save { position: absolute; top: 14px; right: 12px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 4px; border: 0; background: transparent; cursor: pointer; color: var(--fg); }
.save:hover { background: var(--sunk); }
.save svg { width: 24px; height: 24px; fill: none; }
.save[aria-pressed="true"] { color: var(--copper); }
.save[aria-pressed="true"] svg { fill: currentColor; }
@media (prefers-reduced-motion: no-preference) { .save.pop svg { animation: pop .32s ease-out; } }
@keyframes pop { 40% { transform: scale(1.28); } 100% { transform: scale(1); } }

/* ---------- Detail eines Projekts ---------- */
.detail { border-top: 1px solid var(--line); background: var(--sunk); padding: 18px; display: grid; gap: 14px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 760px) { .cols { grid-template-columns: minmax(0, 1fr); } .detail { padding: 12px; } }
.card { background: var(--surface); border: 1px solid var(--line); padding: 16px 18px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.card h3 { margin: 0; font-size: .85rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.who { font-family: var(--display); font-weight: 700; font-size: 1.45rem; line-height: 1.1; }
.why { margin: 0; font-size: .97rem; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 16px; font-size: .97rem; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.phone { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px 18px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 0; cursor: pointer; font-size: 1rem; font-weight: 600; color: var(--muted); margin-bottom: -1px; min-height: 40px; }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--copper); }
.tpl { width: 100%; display: block; white-space: pre-wrap; font-family: var(--body); font-size: 1rem; line-height: 1.6; background: var(--sunk); color: var(--fg); border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px; margin: 0; resize: vertical; field-sizing: content; min-height: 240px; max-height: 75vh; }
.tpl:focus { outline: 2px solid var(--copper); outline-offset: 1px; background: var(--surface); }
.edited { font-size: .78rem; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--copper); }
.track { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.track label, .fields label, .login label, .sr-controls label { display: grid; gap: 5px; font-size: .9rem; color: var(--muted); }
.track select, .track input, .track textarea, .fields input, .login input { padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); font-size: 1rem; min-height: 44px; }
.track .note { grid-column: 1 / -1; }
.track textarea { min-height: 76px; resize: vertical; }
@media (max-width: 640px) { .track { grid-template-columns: minmax(0, 1fr); } }
.empty { color: var(--muted); padding: 28px 0; }

/* ---------- Absenderdaten ---------- */
.settings { background: var(--surface); border-top: 4px solid var(--accent); padding: 20px 22px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.settings h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.7rem; }
.settings p { margin: 0; font-size: .95rem; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.fields input:disabled { opacity: .6; }
@media (max-width: 640px) { .fields { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Gespeichert-Fenster ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10,13,15,.5); z-index: 30; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 31; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -20px 0 40px -24px rgba(0,0,0,.45); display: grid; grid-template-rows: auto minmax(0, 1fr); padding-top: env(safe-area-inset-top, 0px); }
@media (prefers-reduced-motion: no-preference) { .drawer:not([hidden]) { animation: rein .22s ease-out; } }
@keyframes rein { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.8rem; line-height: 1; }
.drawer-list { overflow: auto; padding: 12px; display: grid; gap: 8px; align-content: start; }
.saved { border: 1px solid var(--line); padding: 12px 12px 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; }
.saved .t { font-family: var(--display); font-weight: 700; font-size: 1.25rem; }
.saved .d { grid-column: 1; font-size: .95rem; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.saved .m { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.saved .save { position: static; grid-row: 1 / span 2; grid-column: 2; }
.drawer .empty { padding: 24px 8px; display: grid; gap: 10px; justify-items: start; }
.drawer .empty svg { width: 28px; height: 28px; color: var(--muted); fill: none; }

/* ---------- Dächer bald fällig ---------- */
.sr-bar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.sr-gde { display: flex; align-items: center; gap: 8px; }
.sr-lbl { font-size: .95rem; color: var(--muted); }
.sr-mehrbox { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; background: var(--surface); border: 1px solid var(--line); padding: 16px 18px; }
@media (max-width: 760px) { .sr-mehrbox { grid-template-columns: minmax(0, 1fr); } }
.sr-controls { display: flex; flex-wrap: wrap; gap: 12px 16px; align-content: start; }
.sr-controls input[type="number"] { width: 110px; }
.sr-check { display: flex !important; align-items: center; gap: 8px; color: var(--fg) !important; font-size: 1rem !important; min-height: 44px; }
.sr-check input { width: 20px; height: 20px; accent-color: var(--copper); }
.sr-map svg { width: 100%; height: auto; max-height: 380px; display: block; }
.sr-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 900px) { .sr-list { grid-template-columns: minmax(0, 1fr); } }
.haus { background: var(--surface); display: grid; grid-template-columns: minmax(0, 1fr); box-shadow: var(--shadow); }
.haus .stripe { background: var(--line-strong); }
.haus[data-s="angeschrieben"] .stripe, .haus[data-s="anfrage"] .stripe { background: var(--new); }
.haus[data-s="auftrag"] .stripe { background: var(--accent); }
.haus[data-s="kein_interesse"] { opacity: .55; }
.haus:has(.haus-brief) { grid-column: 1 / -1; }
.haus-body { padding: 16px 18px 18px; display: grid; gap: 12px; min-width: 0; }
.haus-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 14px; align-items: start; }
.haus-nr { font-family: var(--display); font-weight: 700; font-size: 1.9rem; line-height: 1; color: var(--copper); min-width: 1.4em; }
.haus-adr { font-family: var(--display); font-weight: 700; font-size: 1.5rem; line-height: 1.05; }
.haus-ort { font-size: .93rem; color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; gap: 6px; }
.fact { font-size: .88rem; padding: 3px 10px; border-radius: 3px; background: var(--sunk); border: 1px solid var(--line); }
.fact.alt { background: var(--copper-soft); border-color: transparent; color: var(--copper); font-weight: 700; }
.fact.pv { background: var(--pv-soft); border-color: transparent; color: var(--pv); font-weight: 600; }
.haus-act { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.step { min-height: 40px; font-size: .9rem; font-weight: 600; padding: 6px 12px; border-radius: 4px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; color: var(--fg); }
.step:hover { border-color: var(--fg); }
.step[aria-pressed="true"] { background: var(--new); border-color: var(--new); color: var(--surface); }
.step.win[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.step.nein { border-style: dashed; color: var(--muted); }
.step.nein[aria-pressed="true"] { background: var(--line); color: var(--fg); border-color: var(--line); }
.haus-brief { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 10px; }
.haus-brief .tpl { min-height: 420px; }
.sr-more { justify-self: start; }
@media (max-width: 640px) { .haus-head { grid-template-columns: auto minmax(0, 1fr); } .haus-head .status { grid-column: 2; justify-self: start; } }

/* ---------- Hilfe, Fusszeile, Meldung ---------- */
.how { border-top: 1px solid var(--line); padding-top: 18px; display: grid; gap: 10px; }
.how h2 { font-family: var(--display); font-weight: 700; font-size: 1.6rem; margin: 0; }
.how ol { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; max-width: 74ch; color: var(--muted); }
.how ol b { color: var(--fg); }
footer { font-size: .86rem; color: var(--muted); display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 18px; }
footer a { color: var(--accent-ink); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(22px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 11px 20px; border-radius: 4px; font-size: .97rem; font-weight: 600; z-index: 40; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

/* ---------- Anmeldung ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.login { width: min(100%, 460px); display: grid; gap: 18px; }
.login .brand { margin-bottom: 6px; }
.login h1 { font-size: clamp(2.2rem, 8vw, 3.2rem); }
.login form { background: var(--surface); border-top: 4px solid var(--copper); padding: 22px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.login .btn { width: 100%; padding: 12px 14px; font-size: 1.03rem; }

@media (prefers-reduced-motion: no-preference) { .chip, .btn, .tab, .icon-btn, .save, .stat, .step, .viewtab { transition: background .15s, color .15s, border-color .15s; } }

/* ---------- Druck: nur der Brief ---------- */
#druck { display: none; }
@media print {
  @page { size: A4; margin: 22mm 20mm 18mm 25mm; }
  body { background: #fff !important; color: #000; }
  body > *:not(#druck) { display: none !important; }
  #druck { display: block !important; font-family: var(--body); font-size: 11pt; line-height: 1.5; color: #000; }
  #druck .brieftext { white-space: pre-wrap; }
  #druck .qr { margin-top: 10mm; display: flex; gap: 6mm; align-items: center; border-top: .3mm solid #999; padding-top: 5mm; font-size: 9.5pt; }
  #druck .qr svg { width: 26mm; height: 26mm; }
}

/* ---------- Verbindungen ---------- */
.settings h2#verbindungen { margin-top: 18px; }
.verb-list { display: grid; gap: 2px; background: var(--line); border: 2px solid var(--line); }
.verb { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; background: var(--surface); padding: 14px 16px; }
.verb-ic { width: 26px; height: 26px; color: var(--copper); fill: none; }
.verb b { display: block; font-size: 1.05rem; }
.verb span { display: block; font-size: .93rem; color: var(--muted); }
.verb .verb-st { margin-top: 3px; color: var(--fg); }
.verb-a { display: flex; gap: 6px; flex-wrap: wrap; justify-content: end; }
b.ok { display: inline; color: var(--ok); font-size: inherit; }
@media (max-width: 640px) { .verb { grid-template-columns: auto minmax(0, 1fr); } .verb-a { grid-column: 2; justify-content: start; } }

/* ---------- Termine ---------- */
.inbox.termine { background: var(--surface); border-top: 4px solid var(--accent); }
.termin { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 10px 14px; background: var(--sunk); border: 1px solid var(--line); }
.termin.heute { border-left: 4px solid var(--copper); }
.t-datum { display: grid; justify-items: center; min-width: 48px; line-height: 1; }
.t-datum b { font-family: var(--display); font-size: 1.9rem; }
.t-datum span { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.termin .t { font-weight: 600; }
.termin .s { font-size: .93rem; color: var(--muted); }
.termin .a { display: flex; gap: 6px; flex-wrap: wrap; justify-content: end; }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { border-color: var(--line-strong); }
@media (max-width: 640px) { .termin { grid-template-columns: auto minmax(0, 1fr); } .termin .a { grid-column: 1 / -1; justify-content: start; } }

/* ---------- Ausschreibungen ---------- */
.aus-list { display: grid; gap: 14px; }
.aus { background: var(--surface); box-shadow: var(--shadow); display: grid; grid-template-columns: minmax(0, 1fr); }
.aus .stripe { background: var(--new); }
.aus.award .stripe { background: var(--line-strong); }
.aus[data-s="interessiert"] .stripe, .aus[data-s="eingereicht"] .stripe { background: var(--copper); }
.aus[data-s="gewonnen"] .stripe { background: var(--accent); }
.aus[data-s="nein"] { opacity: .55; }
.aus-body { padding: 16px 18px 18px; display: grid; gap: 12px; min-width: 0; }
.aus-kopf { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: start; }
.aus-titel { font-family: var(--display); font-weight: 700; font-size: 1.45rem; line-height: 1.1; overflow-wrap: anywhere; }
.aus-sub { font-size: .95rem; color: var(--muted); margin-top: 4px; }
.frist { display: grid; justify-items: end; font-weight: 700; color: var(--accent-ink); white-space: nowrap; }
.frist small { font-weight: 400; color: var(--muted); font-size: .85rem; }
.frist.knapp { color: var(--hot); }
.zuschlag { margin: 0; }
.aus details summary { cursor: pointer; font-weight: 600; color: var(--accent-ink); }
.aus-text { white-space: pre-wrap; margin: 8px 0 0; color: var(--muted); font-size: .97rem; max-width: 80ch; }
.aus-markt { margin: 0; padding: 12px 16px; background: var(--copper-soft); }
.aus-markt:empty { display: none; }
.wert-inline input { width: 140px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); }
@media (max-width: 640px) { .aus-kopf { grid-template-columns: minmax(0, 1fr); } .frist { justify-items: start; } }

/* ---------- Postfach ---------- */
.mail-list { display: grid; gap: 10px; }
.mail-list[aria-busy="true"] { opacity: .6; }
.post { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); padding: 14px 16px; display: grid; gap: 6px; }
.post.ungelesen { border-left-color: var(--copper); }
.post.ungelesen .post-betreff { font-weight: 700; }
.post.kunde { background: var(--accent-soft); }
.post-kopf { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.post-kopf time { margin-left: auto; font-size: .9rem; color: var(--muted); }
.post-betreff { font-size: 1.05rem; overflow-wrap: anywhere; }
.post-vorschau { margin: 0; color: var(--muted); font-size: .95rem; overflow-wrap: anywhere; }
.pill.lead { background: var(--accent); color: var(--on-accent); }
.card.verbinden { border-top: 4px solid var(--copper); }
.card.verbinden p { margin: 0; max-width: 70ch; }
.mailverlauf { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .93rem; color: var(--muted); }
.mailverlauf li { display: flex; gap: 8px; align-items: center; }
.mailverlauf svg { width: 16px; height: 16px; color: var(--accent); fill: none; }

/* ---------- Dialoge ---------- */
.dlg { border: 0; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); background: var(--surface); color: var(--fg); border-top: 4px solid var(--copper); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
.dlg::backdrop { background: rgba(15, 18, 20, .55); }
.dlg form { display: grid; gap: 12px; padding: 20px 22px 22px; }
.dlg h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.8rem; }
.dlg label { display: grid; gap: 5px; font-size: .9rem; color: var(--muted); }
.dlg input, .dlg select, .dlg textarea:not(.tpl) { padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); font-size: 1rem; min-height: 44px; color: var(--fg); }
.dlg textarea:not(.tpl) { min-height: 70px; resize: vertical; }
.dlg .tpl { min-height: 220px; max-height: 50vh; }
.dlg .sr-check { display: flex; align-items: center; gap: 8px; color: var(--fg); font-size: .97rem; }
.dlg .msg { margin: 0; min-height: 1.2em; color: var(--copper); font-weight: 600; }
.dlg .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dlg-3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .dlg-3 { grid-template-columns: 1fr 1fr; } .dlg-3 label:first-child { grid-column: 1 / -1; } }
