/* immoz.ch – Basis-Stylesheet
   Keine externen Schriften (nDSG: keine Datenübermittlung an Dritte) */

:root {
  --paper: #F3F5F6;
  --surface: #FFFFFF;
  --ink: #17212B;
  --muted: #5B6875;
  --line: #D6DDE2;
  --line-strong: #B9C3CB;
  --red: #C9302C;
  --red-dark: #A52622;
  --lake: #1F5673;
  --lake-soft: #E6EEF3;
  --ok: #2E7D4F;
  --ok-bg: #E7F3EC;
  --warn: #7A5000;
  --warn-bg: #FBF1DC;
  --err: #B3261E;
  --err-bg: #FBE9E7;
  --radius-s: 6px;
  --radius-m: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --step: 1.25;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
img { max-width: 100%; height: auto; }
a { color: var(--lake); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--lake); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 .6em; }
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.4rem; font-weight: 650; }
h3 { font-size: 1.1rem; font-weight: 650; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 460px; }

/* ---------- Kopfzeile ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: center; gap: 24px; min-height: 64px; flex-wrap: wrap; }
.logo { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; color: var(--ink); text-decoration: none; }
.logo::after { content: ""; display: inline-block; width: .32em; height: .32em; background: var(--red); margin-left: .08em; }
.main-nav { display: flex; gap: 20px; flex: 1; }
.main-nav a, .user-nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.main-nav a:hover, .user-nav a:hover { color: var(--red); }
.user-nav { display: flex; align-items: center; gap: 16px; }
.user-nav form { margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; font-weight: 500; color: var(--ink); cursor: pointer; }
.link-button:hover { color: var(--red); }
.lang-switch { display: flex; gap: 2px; }
.lang-switch a { font-size: .8rem; font-weight: 600; color: var(--muted); text-decoration: none; padding: 4px 6px; border-radius: 4px; }
.lang-switch a[aria-current="true"] { color: var(--ink); background: var(--paper); }

@media (max-width: 760px) {
  .site-header .container { padding-top: 10px; padding-bottom: 10px; gap: 10px 16px; }
  .main-nav { order: 3; flex-basis: 100%; }
}

/* ---------- Buttons & Formulare ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-s); border: 1px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink); color: var(--ink); }
.btn-quiet { background: transparent; color: var(--lake); padding-left: 0; padding-right: 0; }
.btn-small { padding: 6px 12px; font-size: .875rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.field { margin-bottom: 18px; }
.field label, .label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.field .hint { font-size: .85rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-s);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lake); box-shadow: 0 0 0 3px var(--lake-soft); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .row, .row-3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; font-weight: 400; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; accent-color: var(--red); }
.choice-group { display: grid; gap: 8px; margin-bottom: 18px; }
.choice { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); cursor: pointer; font-weight: 500; }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice input { accent-color: var(--red); width: 18px; height: 18px; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }

/* ---------- Meldungen ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-s); margin-bottom: 16px; border-left: 4px solid; }
.alert p:last-child { margin: 0; }
.alert-success { background: var(--ok-bg); border-color: var(--ok); }
.alert-error { background: var(--err-bg); border-color: var(--err); }
.alert-info { background: var(--lake-soft); border-color: var(--lake); }
.alert-warn { background: var(--warn-bg); border-color: var(--warn); }

/* ---------- Seiteninhalt ---------- */
main { padding: 40px 0 64px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 28px; }
.auth-panel { margin: 20px auto 0; }
.auth-panel h1 { font-size: 1.6rem; }
.below-form { margin-top: 20px; font-size: .95rem; }

/* Startseite */
.hero { padding: 32px 0 40px; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 750; letter-spacing: -0.025em; max-width: 17ch; margin-bottom: .4em; }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 58ch; margin-bottom: 28px; }
.search-bar { display: flex; gap: 10px; max-width: 620px; background: var(--surface); padding: 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-m); }
.search-bar input { border: 0; box-shadow: none; }
.search-bar input:focus { box-shadow: none; }
.search-bar:focus-within { border-color: var(--lake); box-shadow: 0 0 0 3px var(--lake-soft); }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.steps li { counter-increment: step; border-top: 2px solid var(--ink); padding-top: 16px; }
.steps li::before { content: counter(step); display: block; font-size: 2.4rem; font-weight: 750; line-height: 1; color: var(--red); margin-bottom: 12px; }
.steps p { color: var(--muted); margin: 0; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; gap: 24px; } }

.section { padding: 48px 0 0; }
.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.listing-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px; }
.listing-card .price { font-size: 1.2rem; font-weight: 700; }
.empty { padding: 28px; border: 1px dashed var(--line-strong); border-radius: var(--radius-m); color: var(--muted); }

.landlord-band { margin-top: 56px; background: var(--ink); color: #fff; border-radius: var(--radius-m); padding: 36px; display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.landlord-band p { color: #C8D1D8; margin: 0; max-width: 60ch; }
.landlord-band h2 { color: #fff; }

.prose { max-width: 72ch; }
.prose h2 { margin-top: 1.4em; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0 0 20px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; font-weight: 500; }

/* ---------- Fusszeile ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 28px 0; font-size: .9rem; color: var(--muted); }
.site-footer .container { display: flex; gap: 20px; justify-content: space-between; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

/* ---------- Admin ---------- */
.admin { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.admin-side { background: var(--ink); color: #fff; padding: 24px 16px; }
.admin-side .logo { color: #fff; display: block; margin: 0 8px 28px; }
.admin-side nav a { display: block; color: #C8D1D8; text-decoration: none; padding: 9px 12px; border-radius: var(--radius-s); font-weight: 500; }
.admin-side nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.admin-side nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.12); }
.admin-side .side-foot { margin-top: 32px; padding: 0 12px; font-size: .85rem; color: #93A1AD; }
.admin-side .side-foot a { color: #C8D1D8; }
.admin-main { padding: 32px 40px 64px; min-width: 0; }
.admin-main h1 { font-size: 1.6rem; }
@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .admin-side nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .admin-main { padding: 24px 18px; }
}
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; }
.stat strong { display: block; font-size: 1.8rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .9rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; background: #F8FAFB; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td textarea { min-height: 60px; font-size: .9rem; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--paper); color: var(--muted); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: end; }
.toolbar input, .toolbar select { width: auto; min-width: 200px; }
.form-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 24px; margin-bottom: 20px; max-width: 820px; }
.form-section h2 { font-size: 1.15rem; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-selected="true"] { color: var(--ink); border-color: var(--red); }
.lang-block { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.lang-block:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }

/* ---------- Installer ---------- */
.setup { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.setup-side { background: var(--surface); border-right: 1px solid var(--line); padding: 32px 24px; }
.setup-side .logo { display: block; margin-bottom: 6px; }
.setup-side .sub { color: var(--muted); font-size: .9rem; margin-bottom: 32px; }
.setup-steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.setup-steps li { counter-increment: s; position: relative; padding: 0 0 22px 40px; color: var(--muted); }
.setup-steps li::before {
  content: counter(s); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: .8rem; font-weight: 700; border: 1.5px solid var(--line-strong); background: var(--surface);
}
.setup-steps li:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 28px; bottom: 2px; width: 1.5px; background: var(--line); }
.setup-steps li.done { color: var(--ink); }
.setup-steps li.done::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: #fff; }
.setup-steps li.current { color: var(--ink); font-weight: 650; }
.setup-steps li.current::before { background: var(--red); border-color: var(--red); color: #fff; }
.setup-steps a { color: inherit; text-decoration: none; }
.setup-steps a:hover { text-decoration: underline; }
.setup-main { padding: 48px 56px; max-width: 820px; }
.setup-main h1 { font-size: 1.8rem; }
.setup-main .intro { color: var(--muted); max-width: 62ch; margin-bottom: 28px; }
.checklist { list-style: none; padding: 0; margin: 0 0 24px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.checklist li { display: grid; grid-template-columns: 28px 1fr; gap: 4px 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .icon { font-weight: 800; text-align: center; }
.checklist .ok .icon { color: var(--ok); }
.checklist .fail .icon { color: var(--err); }
.checklist .warn .icon { color: var(--warn); }
.checklist .detail { grid-column: 2; font-size: .86rem; color: var(--muted); }
.keybox { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.1rem; letter-spacing: .08em; }
.summary { display: grid; grid-template-columns: max-content 1fr; gap: 6px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px; margin-bottom: 24px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.summary h3 { grid-column: 1 / -1; margin: 12px 0 2px; font-size: 1rem; }
.summary h3:first-child { margin-top: 0; }
.log { list-style: none; padding: 0; margin: 0 0 24px; }
.log li { padding: 6px 0 6px 28px; position: relative; }
.log li::before { content: "✓"; position: absolute; left: 4px; color: var(--ok); font-weight: 800; }
@media (max-width: 860px) {
  .setup { grid-template-columns: 1fr; }
  .setup-side { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px; }
  .setup-steps { display: none; }
  .setup-side .sub { margin-bottom: 0; }
  .setup-main { padding: 28px 20px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
