/* Corporate Design „Hanseatisch“ (Vorschlag A, docs/design): Navy, Dünensand, Messing; Newsreader + Instrument Sans (OFL, selbst ausgeliefert) */
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/newsreader.woff2) format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/newsreader-italic.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/instrument-sans.woff2) format("woff2"); }
:root {
  --bg: #f4efe6; --surface: #fff; --text: #0e2236; --muted: #5e6b78; --line: #e3d9c8;
  --primary: #16324f; --primary-text: #fff; --primary-soft: #e4e9ef; --accent: #a8834a; --accent-light: #c9a56b;
  --head-bg: #16324f; --head-text: #f4efe6;
  --green: #1e6b41; --green-soft: #e6f1e9; --amber: #8a5a00; --amber-soft: #f8eed9; --red: #a8261e; --red-soft: #fae6e4;
  --radius: 4px; --radius-sm: 3px; --shadow: none;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  font-family: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.5; color: var(--text);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c1824; --surface: #13233a; --text: #ece6db; --muted: #a9b3bd; --line: #243a52;
    --primary: #c9a56b; --primary-text: #0e2236; --primary-soft: #22344b; --accent: #c9a56b; --accent-light: #d8b983;
    --head-bg: #0e2236; --head-text: #ece6db;
    --green: #6cc795; --green-soft: #15301f; --amber: #e2ac4c; --amber-soft: #3a2c12; --red: #f08a82; --red-soft: #3c1b1a; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
a { color: var(--primary); }
h1 { font-family: var(--font-serif); font-weight: 500; font-size: 2rem; margin: .2rem 0 .8rem; line-height: 1.15; letter-spacing: -.005em; }
h2 { font-family: var(--font-serif); font-weight: 500; font-size: 1.4rem; margin: 0 0 .8rem; line-height: 1.2; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); } .small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.topbar { background: var(--head-bg); color: var(--head-text); border-bottom: 3px solid var(--accent); margin-bottom: 28px; }
.topbar .muted { color: var(--head-text); opacity: .8; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--head-text); }
.brand-mark { font-family: var(--font-serif); font-size: 1.75rem; line-height: 1; font-weight: 500; }
.brand-dot { color: var(--accent-light); }
.brand-sub { font-size: .66rem; letter-spacing: .42em; text-transform: uppercase; font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; flex-wrap: wrap; }
.mainnav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.mainnav a, .mainnav .link { padding: 8px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--head-text); }
.mainnav a:hover, .mainnav .link:hover { background: rgba(244, 239, 230, .12); }
.mainnav a[aria-current] { box-shadow: inset 0 -2px 0 var(--accent-light); font-weight: 600; }
.topbar button.link { color: var(--head-text); }
.topbar .btn { border-color: var(--accent-light); color: var(--head-text); background: transparent; }
.topbar .btn-primary { background: var(--head-text); color: var(--head-bg); border-color: var(--head-text); }
.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; font: inherit; cursor: pointer; color: var(--muted); }
.footer { padding: 32px 16px; color: var(--muted); font-size: .875rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card.narrow, .login { max-width: 560px; margin-left: auto; margin-right: auto; }
.login { max-width: 400px; margin-top: 8vh; }
.empty { text-align: center; padding: 40px 20px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn[disabled], .btn-disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; }
.alert-success { background: var(--green-soft); border-color: var(--green); }
.alert-info { background: var(--primary-soft); border-color: var(--primary); }
.alert-error { background: var(--red-soft); border-color: var(--red); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; vertical-align: middle; background: var(--line); color: var(--text); }
.badge-active { background: var(--green-soft); color: var(--green); }
.badge-reserved, .badge-notary { background: var(--amber-soft); color: var(--amber); }
.badge-draft, .badge-paused { background: var(--primary-soft); color: var(--primary); }

/* Willkommensseite */
.welcome { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.welcome .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; gap: 8px; }
.count { background: var(--line); border-radius: 999px; padding: 0 8px; font-size: .8rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.cards .card { margin: 0; }
.project { display: flex; flex-direction: column; gap: 12px; }
.project-head { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: start; text-decoration: none; color: inherit; }
.project-meta { display: flex; flex-direction: column; min-width: 0; }
.project-title { font-weight: 700; color: var(--primary); }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); }
.thumb-empty { display: grid; place-items: center; background: var(--primary-soft); font-size: 1.8rem; }
.project-steps { border-top: 1px solid var(--line); padding-top: 8px; }
.project-steps h3 { margin-top: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.project-steps ul, .steps { margin: 0; padding-left: 18px; }
.project-steps li, .steps li { margin: 4px 0; }
.more { margin-top: 16px; }

/* Formulare */
fieldset { border: 0; padding: 0; margin: 0 0 12px; }
legend { font-weight: 600; margin-bottom: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-weight: 600; font-size: .9rem; }
.field input, .field select, .field textarea { font: inherit; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text); width: 100%; }
.field textarea { resize: vertical; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
.field .error { color: var(--red); margin: 0; font-size: .875rem; }
.hint { color: var(--muted); font-size: .875rem; margin: 0 0 8px; }
.field.check { flex-direction: row; align-items: flex-start; gap: 10px; }
.field.check input { width: auto; margin-top: 4px; }
.field.check label { font-weight: 400; }
.req { color: var(--red); }
.grid { display: grid; gap: 0 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-addr { grid-template-columns: 3fr 1fr 1fr 2fr; }
.grid-main { grid-template-columns: 3fr 2fr; gap: 20px; align-items: start; }
details.optional { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
details.optional summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; color: var(--primary); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.form-actions.reverse { flex-direction: row-reverse; justify-content: flex-end; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.radio { display: flex; gap: 6px; align-items: center; }
fieldset.part.is-off { opacity: .45; }
.file-current { margin: 0 0 4px; }
.preview { max-width: 240px; border-radius: var(--radius-sm); display: block; }

/* Stepper */
.stepper { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 20px; flex-wrap: wrap; counter-reset: s; }
.stepper li { flex: 1 1 160px; }
.stepper li > * { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--muted); }
.stepper .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--line); font-size: .8rem; font-weight: 700; color: var(--text); }
.stepper .step-current > * { border-color: var(--primary); color: var(--text); font-weight: 600; }
.stepper .step-current .num { background: var(--primary); color: var(--primary-text); }
.stepper .step-done .num { background: var(--green); color: #fff; }
.stepper .step-done > * { color: var(--text); }

/* Prüflisten / Ampel */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .icon { flex: 0 0 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.check-ok .icon { background: var(--green-soft); color: var(--green); }
.check-block .icon { background: var(--red-soft); color: var(--red); }
.check-review .icon { background: var(--amber-soft); color: var(--amber); }
.commission-result { margin-top: 16px; }
.lamp { border-left: 5px solid; border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 8px; }
.lamp ul { margin: 6px 0 0; padding-left: 18px; }
.lamp-green { border-color: var(--green); background: var(--green-soft); }
.lamp-amber { border-color: var(--amber); background: var(--amber-soft); }
.lamp-red { border-color: var(--red); background: var(--red-soft); }

/* Objektseite */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.property-head { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.property-head h1 { margin: 0; }
.property-head p { margin: 2px 0; }
.thumb-lg { width: 120px; height: 90px; object-fit: cover; border-radius: var(--radius-sm); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }
.status-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.filters a { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--text); background: var(--surface); font-size: .9rem; }
.filters a[aria-current] { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.prose { overflow-wrap: anywhere; }

/* Interessentenprozesse */
.req-table td, .req-table th { padding: 6px 10px; }
.center { text-align: center !important; }
.req-table input[type="checkbox"] { width: 18px; height: 18px; }
.tag { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); vertical-align: middle; }
.field.waiver { background: var(--amber-soft); border-radius: var(--radius-sm); padding: 10px 12px; }
.is-archived { opacity: .6; }
.type-switch { display: inline-flex; gap: 6px; align-items: center; }
.type-switch select { font: inherit; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-addr, .grid-main { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .stepper li { flex-basis: 100%; }
  h1 { font-size: 1.35rem; }
}

/* Vorgänge / Zugangsdaten */
.cred-dialog { position: relative; border: 2px solid var(--primary); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 20px; margin: 0 0 20px; width: 100%; box-shadow: var(--shadow); }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }
.mail-previews { gap: 16px; }
.mail-preview { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; min-width: 0; }
.mail-preview-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.mail-preview-head h3 { margin: 0; }
.mail-preview pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font: inherit; font-size: .9rem; margin: 0; max-width: 100%; }
.deal-steps { padding-left: 20px; margin: 0; }
.deal-steps li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.deal-steps li:last-child { border-bottom: 0; }
.step-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.card-radio { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; align-items: flex-start; cursor: pointer; }
.card-radio input { margin-top: 5px; }

/* Schritt-Editor */
.step-edit { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; }
.step-edit-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.step-edit-head input, .step-edit-head select, .fields-table input, .fields-table select { font: inherit; padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.step-title { flex: 1 1 200px; }
.step-edit-body { margin-top: 8px; }
.step-new summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.check-inline { display: inline-flex; gap: 6px; align-items: center; font-size: .9rem; }
.check-inline.danger { color: var(--red); }
.pos input { width: 3.5em; }
.fields-table td, .fields-table th { padding: 4px 6px; }
.fields-table input:not([type="checkbox"]) { width: 100%; }

/* Interessentenportal */
.portal-main { max-width: 760px; }
.portal-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.portal-head h1 { margin: 0; }
.declaration { border-bottom: 1px solid var(--line); padding: 10px 0; }
.declaration summary { cursor: pointer; color: var(--primary); }
.declaration .prose { max-height: 320px; overflow: auto; background: var(--bg); padding: 10px; border-radius: var(--radius-sm); margin: 8px 0; }
.check-line { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; font-weight: 600; }
.check-line input { margin-top: 4px; width: 18px; height: 18px; flex: 0 0 auto; }
.doc-list { list-style: none; padding: 0; }

/* Rechtstexte / Widerruf */
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.row-actions { display: flex; gap: 6px; margin-left: auto; align-items: flex-start; flex-wrap: wrap; }
.checklist .grow { flex: 1; }
.btn-withdraw { background: var(--surface); border: 2px solid var(--red); color: var(--red); font-weight: 600; }
.btn-withdraw:hover { background: var(--red-soft); }
.badge-withdrawn { background: var(--red-soft); color: var(--red); }
.card-alert { border: 2px solid var(--red); }

/* Rechtlich offene Punkte */
.compliance-box { background: var(--amber-soft); border: 2px solid var(--amber); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 24px; }
.compliance-box h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.compliance-box > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; }
.compliance-box > summary::-webkit-details-marker { display: none; }
.compliance-box > summary .compliance-toggle::after { content: "Einklappen ▲"; color: var(--muted); }
.compliance-box:not([open]) > summary .compliance-toggle::after { content: "Aufklappen ▼"; }
.compliance-box[open] > summary { margin-bottom: 8px; }
.compliance-box:not([open]) { padding-top: 10px; padding-bottom: 10px; }
.compliance-list { list-style: none; padding: 0; margin: 0 0 8px; }
.compliance-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,.08); }
.compliance-list li:last-child { border-bottom: 0; }
.compliance-list .icon { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; background: var(--amber); color: #fff; }
.compliance-list.done .icon { background: var(--green); }
.compliance-list .grow { flex: 1; }
.compliance-ok { margin-bottom: 20px; color: var(--green); }
.compliance-ok summary { cursor: pointer; font-weight: 600; }
.btn-small { padding: 3px 10px; font-size: .85rem; }
.timeline { list-style: none; padding: 0; margin: 0 0 12px; border-left: 2px solid var(--line); }
.timeline li { padding: 4px 0 8px 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.timeline li.tl-auto::before { background: var(--muted); }
.row-form { display: grid; grid-template-columns: 1fr auto minmax(120px, 1fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row-form:has(> input[name="action"][value="offer_status"]) { grid-template-columns: 1fr auto auto; }
@media (max-width: 640px) { .row-form, .row-form:has(> input[name="action"][value="offer_status"]) { grid-template-columns: 1fr; } }
.timeline li.tl-more { display: none; }
.task-list { list-style: none; padding: 0; margin: 0 0 12px; }
.task-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.task-list li.task-due strong { color: var(--red); }
.card-accent { border: 2px solid var(--primary); }
.inline-details { margin-top: 4px; } .inline-details form { margin: 6px 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi-title { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
.kpi-row { display: flex; flex-wrap: wrap; gap: 14px; }
.kpi { display: flex; flex-direction: column; min-width: 70px; }
.kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.kpi-label { font-size: .8rem; color: var(--muted); }
.kpi-alert .kpi-value { color: var(--red); }
.nav-search input { width: 180px; padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid rgba(244, 239, 230, .35); background: rgba(244, 239, 230, .1); color: var(--head-text); font: inherit; }
.nav-search input::placeholder { color: var(--head-text); opacity: .7; }
.funnel { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0 0 12px; }
/* Hanseatisch: Serifen für Kennzahlen und Kartentitel, Messing als feiner Akzent */
.kpi-value, .section-title, .card-title { font-family: var(--font-serif); font-weight: 500; }
.kpi-value { font-size: 1.9rem; }
.card { border-color: var(--line); }
.stepper li[aria-current] > *, .stepper .step-current > * { border-top: 3px solid var(--primary); }
blockquote { margin: 0 0 12px; padding: 8px 14px; border-left: 3px solid var(--accent); color: var(--muted); }

/* Adressvorschläge */
.addr-field { position: relative; }
.addr-list { position: absolute; top: 100%; left: 0; right: 0; min-width: 16rem; z-index: 30; margin: 2px 0 0; padding: 4px 0; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-top: 2px solid var(--accent); border-radius: var(--radius-sm);
  box-shadow: 0 6px 18px rgba(14, 34, 54, .14); max-height: 18rem; overflow-y: auto; }
.addr-list li { padding: 7px 11px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.addr-list li[aria-selected="true"], .addr-list li:hover { background: var(--primary-soft); }
.addr-hint { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.addr-list li.addr-src { cursor: default; font-size: .75rem; color: var(--muted); padding: 4px 11px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.addr-list li.addr-src:hover { background: none; }
