/* Kundenportal wegweisend.digital. Kein Framework, keine Skripte.
   Farb-Tokens aus dem Cockpit (Marke): Akzent #6E6252, Taupe #9C8F7C nur für Flächen und Rahmen. */

:root {
  --bg: #f6f4f0;
  --surface: #ffffff;
  --border: #e3ded5;
  --border-strong: #cfc8bb;
  --text: #1a1a1a;
  --muted: #62594d;
  --accent: #6e6252;
  --accent-hover: #5a4f41;
  --accent-soft: #f3efe9;
  --accent-ink: #ffffff;
  --marke-wwd: #9c8f7c;
  --ok: #187a46;
  --ok-soft: #e2f4e9;
  --err: #b3263d;
  --err-soft: #fde8ec;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --surface: #211f1c;
    --border: #35312b;
    --border-strong: #4a443b;
    --text: #efece6;
    --muted: #b3aa9b;
    --accent: #cbbfa9;
    --accent-hover: #ddd2bd;
    --accent-soft: #2c2924;
    --accent-ink: #1a1a1a;
    --ok: #62c58d;
    --ok-soft: #1c2e24;
    --err: #ff8da0;
    --err-soft: #3a1f26;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-wrap: anywhere;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--marke-wwd); outline-offset: 2px; }

.kopf {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 0;
}
.kopf-zeile {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 12px;
}
.logo { height: 28px; width: auto; display: block; max-width: 100%; }
.projektname { font-weight: 600; color: var(--muted); }
.wechsel { font-size: 0.9rem; }
.projektliste { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.projektliste .karte { margin: 0; }
.projektliste h2 { margin: 0 0 4px; }
.app-link { margin: 0 0 16px; }
.app-link .knopf { font-size: 1.05rem; padding: 12px 20px; }

.nav {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-items: center;
}
.nav a, .link-knopf {
  display: inline-block;
  padding: 10px 2px;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  background: none;
  border-top: 0; border-left: 0; border-right: 0;
  font: inherit;
  cursor: pointer;
}
.nav a:hover, .link-knopf:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--marke-wwd); font-weight: 600; }
.nav-form { margin: 0 0 0 auto; }

.inhalt {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  flex: 1;
}
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 16px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }

.karte {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 0 16px;
}
.schmal { max-width: 460px; }
.leer, .hinweis, .meta { color: var(--muted); margin: 0 0 8px; font-size: 0.95rem; }
.stand { margin: 12px 0 0; }

.formular { display: flex; flex-direction: column; gap: 8px; }
.formular label { font-weight: 600; margin-top: 8px; }
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
  min-height: 44px;
}
textarea { resize: vertical; }

.knopf {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 8px;
  padding: 11px 18px;
  min-height: 44px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  margin-top: 8px;
}
.knopf:hover { background: var(--accent-hover); color: var(--accent-ink); }

.meldung { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; font-weight: 600; }
.meldung.ok { background: var(--ok-soft); color: var(--ok); }
.meldung.fehler { background: var(--err-soft); color: var(--err); }

/* Phasen-Leiste */
.phasen { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.phase { text-align: center; padding: 8px 2px; border-top: 4px solid var(--border-strong); font-size: 0.8rem; color: var(--muted); }
.phase-nr { display: block; font-weight: 700; }
.phase-erledigt { border-top-color: var(--marke-wwd); }
.phase-aktuell { border-top-color: var(--accent); color: var(--text); font-weight: 700; background: var(--accent-soft); border-radius: 0 0 6px 6px; }
@media (max-width: 560px) {
  .phasen { grid-auto-flow: row; grid-auto-columns: auto; gap: 0; }
  .phase { display: flex; gap: 10px; text-align: left; border-top: 0; border-left: 4px solid var(--border-strong); padding: 6px 10px; font-size: 0.95rem; }
  .phase-erledigt { border-left-color: var(--marke-wwd); }
  .phase-aktuell { border-left-color: var(--accent); border-radius: 0 6px 6px 0; }
  .phase-nr { display: inline; min-width: 1.2em; }
}

.checkliste, .links, .kontakte, .kurzliste { list-style: none; margin: 0; padding: 0; }
.checkliste li { display: flex; gap: 10px; padding: 6px 0; align-items: baseline; }
.checkliste .ok { color: var(--muted); }
.checkliste .ok span:nth-child(2) { text-decoration: line-through; }
.haken { width: 1.2em; flex: none; color: var(--accent); font-weight: 700; }
.nur-leser { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.links li, .kontakte li, .kurzliste li { padding: 6px 0; }
.rolle { color: var(--muted); }

.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; background: var(--accent-soft); border: 1px solid var(--border-strong); }
.herkunft { display: inline-block; margin-left: 6px; padding: 0 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.status-erledigt { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.status-abgelehnt { background: var(--err-soft); color: var(--err); border-color: transparent; }
.status-rueckfrage, .status-pruefen { border-color: var(--accent); }

.ticket-kopf { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.ticket-kopf h2 { margin: 0; }
.text { white-space: pre-wrap; margin: 8px 0; }
.antwort { border-left: 4px solid var(--marke-wwd); padding: 4px 0 4px 12px; margin: 12px 0 0; background: var(--accent-soft); border-radius: 0 8px 8px 0; }

/* Lastenheft (Markdown) */
.markdown h1 { font-size: 1.4rem; }
.markdown h2 { font-size: 1.2rem; margin-top: 20px; }
.markdown h3 { font-size: 1.05rem; margin-top: 16px; }
.markdown p, .markdown li { margin: 0 0 10px; }
.markdown code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.tabelle { overflow-x: auto; margin: 0 0 12px; }
.markdown table { border-collapse: collapse; min-width: 100%; }
.markdown th, .markdown td { border: 1px solid var(--border-strong); padding: 6px 10px; text-align: left; vertical-align: top; }
.markdown th { background: var(--accent-soft); }

/* Kernaussage, Hilfe, Dateien, Auswahlfelder */
.kernaussage { background: var(--accent-soft); border-left: 4px solid var(--marke-wwd); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 0 0 16px; }
.hilfe h2 { margin-top: 18px; }
.hilfe h2:first-child { margin-top: 0; }
.hilfe ul { padding-left: 20px; margin: 0 0 8px; }
.dateiliste { list-style: none; margin: 8px 0 0; padding: 0; }
.dateiliste li { padding: 6px 0; border-top: 1px solid var(--border); }
.folge { border-left: 4px solid var(--border-strong); padding: 4px 0 4px 12px; margin: 12px 0 0; }
.auswahl { border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.auswahl legend { font-weight: 600; padding: 0 6px; }
.auswahl label { display: inline-flex; align-items: center; gap: 6px; margin: 0 16px 0 0; font-weight: 400; min-height: 44px; }
.auswahl input { width: auto; min-height: 0; }
.knopf.zweit { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.knopf.zweit:hover { background: var(--accent-soft); color: var(--accent-hover); }
input[type="file"] { padding: 8px; }

/* Anmeldung und Fehlerseiten: Karte waagerecht mittig */
.zentriert { margin-left: auto; margin-right: auto; margin-top: 32px; }

.fuss { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 16px; border-top: 1px solid var(--border); }

/* Zurück und Weiter nebeneinander (Onboarding) */
.knopfzeile { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ===== Lastenhefte ===== */
.status-lh-pruefung { border-color: var(--accent); }
.status-lh-freigegeben { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.status-lh-ersetzt { color: var(--muted); }
.fassungsliste { list-style: none; margin: 8px 0 0; padding: 0; }
.fassungsliste li { padding: 8px 0; border-top: 1px solid var(--border); }
.fassungsliste.kompakt li { padding: 4px 0; }
.hinweis-ersetzt { background: var(--accent-soft); color: var(--text); font-weight: 400; border-left: 4px solid var(--marke-wwd); border-radius: 0 8px 8px 0; }
.haken-zeile { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; margin-top: 12px; }
.haken-zeile input { width: auto; min-height: 0; margin-top: 4px; flex: none; }

/* Dokumentansicht im Stil des Lastenheft-PDFs (am Bildschirm als Blatt, im Druck als A4-Seite) */
.lh-papier {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px 20px;
  margin: 0 0 16px;
  line-height: 1.5;
  overflow-wrap: break-word;
}
.lh-logo { display: none; }
.lh-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 24px;
  row-gap: 2px;
  margin: 0 0 24px;
  font-size: 0.9rem;
}
.lh-meta dt { color: var(--muted); }
.lh-meta dd { margin: 0; color: var(--text); }
.lh-titel { font-size: 1.7rem; margin: 0 0 6px; font-weight: 700; }
.lh-untertitel { color: var(--muted); margin: 0 0 28px; }
.lh-text h2 {
  font-size: 1.2rem;
  margin: 26px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  break-after: avoid;
}
.lh-text h3 { font-size: 1.02rem; margin: 20px 0 6px; break-after: avoid; }
.lh-text h4 { font-size: 0.95rem; font-weight: 700; margin: 14px 0 4px; break-after: avoid; }
.lh-text p { margin: 0 0 10px; }
.lh-text ul, .lh-text ol { margin: 0 0 10px; padding-left: 22px; }
.lh-text li { margin: 3px 0; }
.lh-text p.fertig { margin: 8px 0 16px; }
.lh-text .tabelle { margin: 8px 0 12px; }
.lh-text table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 0; }
.lh-text th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--text);
  padding: 6px 6px;
}
.lh-text td { border: 0; border-bottom: 1px solid var(--border); padding: 6px 6px; vertical-align: top; text-align: left; }
.lh-text th.r, .lh-text td.r { text-align: right; }
.lh-text th.z, .lh-text td.z { text-align: center; }
.lh-text tr { break-inside: avoid; }
.lh-text thead { display: table-header-group; }
.lh-festpreis {
  margin: 24px 0 8px;
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--marke-wwd);
  border-radius: 6px;
  font-size: 1.05rem;
  break-inside: avoid;
}
.lh-festpreis-label { color: var(--muted); }
.lh-vermerk { margin: 12px 0 0; font-size: 0.9rem; color: var(--muted); }
.lh-vermerk strong { color: var(--text); }

/* Neuigkeiten: natives <dialog open> ohne Skript. Der Hintergrund ist ein festes Overlay-Element hinter dem Dialog,
   der Dialog sitzt mittig und scrollt bei langem Inhalt selbst. */
.neuigkeiten-hintergrund { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 900; }
dialog.neuigkeiten-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  width: min(34rem, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  margin: 0;
  padding: 20px 22px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
dialog.neuigkeiten-dialog h2 { margin-top: 0; }
dialog.neuigkeiten-dialog h3 { margin: 16px 0 2px; font-size: 1.05rem; }
dialog.neuigkeiten-dialog .neuigkeit-eintrag + .neuigkeit-eintrag { border-top: 1px solid var(--border); margin-top: 14px; }
.neuigkeiten-liste .neuigkeit-eintrag { margin-bottom: 18px; }
.einleitung { margin: 0 0 14px; }

@media print {
  @page { size: A4; margin: 16mm 18mm 24mm 18mm; }
  :root { --bg: #fff; --surface: #fff; --border: #d9d3c9; --border-strong: #bdb6a9; --text: #1a1a1a; --muted: #6b665f; --accent: #1a1a1a; --accent-soft: #fff; }
  html, body { background: #fff; color: #1a1a1a; }
  body {
    display: block;
    min-height: 0;
    font-family: 'TeX Gyre Heros', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 10pt;
    line-height: 1.45;
  }
  .kopf, .fuss, .bedienung, .zurueck, .meldung, .nav, .neuigkeiten-hintergrund, .neuigkeiten-dialog { display: none !important; }
  .inhalt { max-width: none; padding: 0; margin: 0; }
  a { color: inherit; text-decoration: none; }
  .lh-papier { border: 0; border-radius: 0; padding: 0; margin: 0; background: #fff; }
  .lh-logo { display: flex; justify-content: flex-end; margin: 0 0 8mm; }
  .lh-logo img { width: 35mm; height: auto; }
  .lh-meta { justify-content: end; grid-template-columns: auto auto; column-gap: 6mm; row-gap: 1mm; font-size: 9pt; margin: 0 0 12mm; }
  .lh-titel { font-size: 17pt; margin: 0 0 2mm; }
  .lh-untertitel { margin: 0 0 8mm; }
  .lh-text h2 { font-size: 12pt; margin: 6mm 0 2mm; padding-bottom: 1mm; border-bottom: 0.5pt solid #d9d3c9; break-after: avoid; page-break-after: avoid; }
  .lh-text h3 { font-size: 10pt; margin: 4mm 0 1mm; break-after: avoid; page-break-after: avoid; }
  .lh-text h4 { font-size: 9.5pt; margin: 3mm 0 1mm; break-after: avoid; page-break-after: avoid; }
  .lh-text p { margin: 0 0 3mm; orphans: 3; widows: 3; }
  .lh-text ul, .lh-text ol { margin: 0 0 2mm; padding-left: 5mm; }
  .lh-text li { margin: 0.8mm 0; }
  .lh-text p.fertig { margin: 1.5mm 0 3mm; font-size: 9.4pt; }
  .lh-text table { font-size: 8.6pt; margin: 1.5mm 0 2mm; }
  .lh-text th { font-size: 8pt; border-bottom: 1pt solid #1a1a1a; padding: 1.3mm 1.5mm; }
  .lh-text td { border-bottom: 0.5pt solid #e0dbd2; padding: 1.1mm 1.5mm; }
  .lh-text tr, .lh-text li { break-inside: avoid; page-break-inside: avoid; }
  .lh-text .tabelle { overflow: visible; }
  .lh-festpreis { margin: 6mm 0 2mm; padding: 3mm 4mm; border: 0.5pt solid #bdb6a9; border-left: 1.2mm solid #9c8f7c; font-size: 11pt; }
  .lh-vermerk { margin: 3mm 0 0; font-size: 9pt; }
  /* Seitenfuß in jeder Seite über die Seitenrandbox des Drucks (Chrome, Edge). position: fixed ist im Druck
     unbrauchbar: mit negativem Abstand landet der Fuß oben auf der Folgeseite, mit bottom: 0 überdeckt er Inhalt. */
  @page {
    @bottom-center {
      content: "wegweisend.digital · Markt 4 · 14828 Görzke · kontakt@wegweisend.digital · 0172 321 35 09";
      font-family: 'TeX Gyre Heros', 'Helvetica Neue', Helvetica, Arial, sans-serif;
      font-size: 7pt;
      color: #8a847b;
      border-top: 0.5pt solid #e0dbd2;
      padding-top: 2mm;
      width: 100%;
      vertical-align: top;
    }
  }
}
