:root {
  --bg: #f4f6f9; --flaeche: #ffffff; --rand: #d5dbe3; --text: #1b2430; --leise: #5d6b7c;
  --akzent: #1f6feb; --akzent-text: #ffffff; --plan-bg: #ffffff; --plan-strich: #0b57d0;
  --raum: rgba(31, 111, 235, 0.07); --raum-rand: #1f6feb; --wahl: #e8590c;
  --gruen: #2f9e44; --gelb: #e0a800; --rot: #d9480f; --grau: #adb5bd; --umgebung: #e9edf2; --tableau: #ffffff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161c; --flaeche: #1b2129; --rand: #2d3742; --text: #e6edf3; --leise: #9aa7b4;
    --akzent: #4c8dff; --plan-bg: #f7f7f7; --raum: rgba(76, 141, 255, 0.10); --umgebung: #0b0f14; --tableau: #f4f6f9;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161c; --flaeche: #1b2129; --rand: #2d3742; --text: #e6edf3; --leise: #9aa7b4;
  --akzent: #4c8dff; --plan-bg: #f7f7f7; --raum: rgba(76, 141, 255, 0.10); --umgebung: #0b0f14; --tableau: #f4f6f9;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, "Segoe UI", Arial, sans-serif; display: flex; flex-direction: column; }
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; background: var(--flaeche); border-bottom: 1px solid var(--rand); flex-wrap: wrap; }
.marke { font-size: 17px; }
.demo-schild { font-size: 12px; background: #e8590c; color: #fff; border-radius: 6px; padding: 2px 8px; vertical-align: middle; }
.demo-schild.voll { background: var(--gruen); }
.knoepfe { display: flex; gap: 6px; flex-wrap: wrap; }
.btn, .modi button, .reiter button { font: inherit; color: var(--text); background: var(--flaeche); border: 1px solid var(--rand); border-radius: 7px; padding: 6px 11px; cursor: pointer; }
.btn:hover, .modi button:hover { border-color: var(--akzent); }
.btn.primaer, .modi button.aktiv { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.arbeit { flex: 1; display: grid; grid-template-columns: 190px 1fr 320px; min-height: 0; }
.werkzeuge, .eigenschaften { background: var(--flaeche); overflow-y: auto; padding: 10px 12px; }
.werkzeuge { border-right: 1px solid var(--rand); }
.eigenschaften { border-left: 1px solid var(--rand); padding-top: 0; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); margin: 12px 0 6px; }
.modi { display: grid; gap: 5px; }
.modi button { text-align: left; }
.palette { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.palette button { background: var(--plan-bg); border: 1px solid var(--rand); border-radius: 6px; padding: 2px; cursor: pointer; }
.palette button.aktiv { outline: 2px solid var(--wahl); }
.planbereich { position: relative; min-width: 0; min-height: 0; background: var(--umgebung); }
#plan { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
#plan.auswahl { cursor: default; }
.status { position: absolute; left: 10px; bottom: 10px; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 7px; padding: 6px 10px; max-width: calc(100% - 20px); }
.eingabe { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: var(--flaeche); border: 1px solid var(--akzent); border-radius: 8px; padding: 10px 12px; display: flex; gap: 8px; align-items: center; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.eingabe input { width: 80px; }
.reiter { display: flex; flex-wrap: wrap; gap: 4px; position: sticky; top: 0; background: var(--flaeche); padding: 10px 0 8px; z-index: 1; }
.reiter button { flex: 1; padding: 5px 6px; }
.reiter button.aktiv { border-color: var(--akzent); color: var(--akzent); font-weight: 600; }
.feld { display: grid; gap: 3px; margin: 8px 0; }
.feld label { font-size: 12px; color: var(--leise); }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--rand); border-radius: 6px; padding: 5px 7px; width: 100%; }
.zeile { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.zeile .btn { flex: 1; }
.check { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.check input { width: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 4px 5px; border-bottom: 1px solid var(--rand); vertical-align: top; }
th { color: var(--leise); font-weight: 600; }
.punkt { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
.gruen { background: var(--gruen); } .gelb { background: var(--gelb); } .rot { background: var(--rot); } .grau { background: var(--grau); }
.raumliste tr { cursor: pointer; }
.raumliste tr:hover td { background: var(--bg); }
.hinweis { font-size: 12px; color: var(--leise); }
.zweispaltig { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.feld.halb { margin: 4px 0; } .feld.halb label { font-size: 11px; }
.pruef, .checkliste { padding-left: 0; margin: 4px 0; font-size: 12.5px; display: grid; gap: 4px; }
.pruef { list-style: none; } .checkliste { padding-left: 18px; }
.pruef li.fehler { color: var(--rot); font-weight: 600; } .pruef li.warnung { color: #b45309; } .pruef li.ok { color: var(--gruen); }
.tableau { background: var(--tableau); color: #1b2430; border: 1px solid var(--rand); border-radius: 8px; padding: 6px; overflow-x: auto; }
.verantwortung { border-top: 1px solid var(--rand); padding-top: 8px; margin-top: 10px; }
.nass { border: 1px solid var(--rot); background: rgba(217, 72, 15, .08); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 13px; }
.nass.ok { border-color: var(--gruen); background: rgba(47, 158, 68, .08); }
.plankopf { margin: 6px 0; } .plankopf summary { cursor: pointer; color: var(--akzent); font-size: 13px; }
.schritte { list-style: none; padding: 0; margin: 0 0 6px; font-size: 13px; display: grid; gap: 4px; }
.schritte li { color: var(--text); } .schritte li.erledigt { color: var(--gruen); }
.leer { color: var(--leise); padding: 12px 0; }
.nass a { color: var(--akzent); display: inline-block; margin-top: 4px; }
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-inhalt { background: var(--flaeche); color: var(--text); border-radius: 12px; padding: 16px 18px; max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.modal-inhalt h3 { margin-top: 0; }
.seiten-wahl { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 10px 0; }
.seite-karte { display: flex; flex-direction: column; gap: 6px; align-items: stretch; padding: 8px; border: 1px solid var(--linie, #94a3b8); border-radius: 10px; background: var(--flaeche); color: var(--text); cursor: pointer; font: inherit; text-align: left; }
.seite-karte:hover, .seite-karte:focus { border-color: var(--akzent, #2563eb); outline: 2px solid var(--akzent, #2563eb); }
.seite-karte img { width: 100%; height: auto; background: #fff; border-radius: 6px; }
table.schutz td:first-child { font-weight: 700; text-align: center; }
@media (max-width: 900px) {
  .arbeit { grid-template-columns: 1fr; grid-template-rows: auto 60vh auto; }
  .werkzeuge { border-right: 0; border-bottom: 1px solid var(--rand); }
  .modi { grid-template-columns: repeat(3, 1fr); }
  .palette { grid-template-columns: repeat(8, 1fr); }
}
@media print {
  .kopf, .werkzeuge, .eigenschaften, .status, .eingabe { display: none !important; }
  .arbeit { display: block; } .planbereich { background: #fff; height: 100vh; }
}
