/* Werte aus dem Design-Mockup (_claude-output/Main.dc.html) und den Screenshots der Vorgangsübersicht. */
:root {
  --bg: #F2F5F9;
  --text: #2A2A2A;
  --text-2: #3C3C3C;
  --muted: #5E6670;
  --navy: #1E2272;
  --navy-2: #2A3194;
  --night: #11163F;
  --blue: #1478C4;
  --blue-2: #1259A8;
  --line: #DCE3EC;
  --line-2: #E1E7EF;
  --input: #B9C3D0;
  --soft: #F6F8FB;
  --soft-blue: #EAF0FA;
  --chip-blue: #E3EEF9;
  --chip-blue-text: #123E73;
  --red: #B3261E;
  --red-2: #9A1F17;
  --red-bg: #FBE9DF;
  --orange: #E8A02B;
  --orange-text: #A0410D;
  --green: #3F7A1B;
  --green-bg: #E3F1E4;
  --green-text: #1F5E2A;
  --amber-bg: #FFF8EC;
  --amber-line: #A8761C;
  --amber-text: #6B4A0E;
  --yellow-bg: #FFF4C2;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Source Sans 3', 'Source Sans Pro', 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); }
a:hover { color: var(--blue); }
[hidden] { display: none !important; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- Kopf / Fuß */
.topbar { background: var(--night); color: #C9CFEA; font-size: 14px; }
.topbar .in { max-width: 1280px; margin: 0 auto; padding: 8px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; }
.session-user, .session-user form { display: inline-flex; align-items: center; gap: 10px; }
.session-user button { border: 0; padding: 0; background: none; color: #fff; font: inherit; text-decoration: underline; cursor: pointer; }
.login-page { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.login-main { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(17,22,63,.12); padding: 30px; display: flex; flex-direction: column; gap: 20px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-card .btn { width: 100%; min-height: 46px; }
.brandbar { background: linear-gradient(90deg, #0F72C6 0%, #1752AD 45%, #1E2A82 80%, #1E2272 100%); }
.brandbar .in { max-width: 1280px; margin: 0 auto; padding: 0 24px; min-height: 76px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 32px; }
.brandbar.narrow .in { max-width: 1100px; }
.logo { font-weight: 300; font-size: 40px; letter-spacing: 0.02em; line-height: 1; color: #fff; padding: 12px 0; text-decoration: none; }
.logo:hover { color: #fff; }
.brandbar .claim { font-size: 16px; font-weight: 500; color: #E3E8F6; }
.toggle { display: flex; align-items: center; gap: 12px; color: #fff; font-size: 15px; }
.seg { min-height: 36px; padding: 0 14px; border: 1px solid #8C95D6; background: transparent; color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.seg:first-of-type { border-radius: 6px 0 0 6px; }
.seg:last-of-type { border-radius: 0 6px 6px 0; border-left: 0; }
.seg.on { background: #fff; color: var(--night); border-color: #fff; }
footer.foot { background: var(--navy); color: #CBD3EC; }
footer.foot .in { max-width: 1100px; margin: 0 auto; padding: 26px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 32px; font-size: 15px; }
footer.foot a { color: #CBD3EC; }

/* ---------------------------------------------------------------- Grundelemente */
h1 { margin: 0; font-weight: 600; font-size: 32px; line-height: 1.2; }
h2 { margin: 0; font-size: 21px; line-height: 1.25; font-weight: 600; color: var(--navy); }
input, select, textarea {
  font: inherit; font-size: 16px; color: inherit; background: #fff; border: 1px solid var(--input); border-radius: 8px;
  padding: 8px 12px; min-height: 44px; width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--red); }
input:disabled, select:disabled, textarea:disabled { background: #F1F3F6; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--input); background: #fff; color: var(--navy); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #EEF3FA; color: var(--navy); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.danger { color: var(--red-2); border-color: #F0C9B6; }
.btn.danger:hover { background: var(--red-bg); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 14px; }
.btn.icon { width: 36px; min-height: 36px; padding: 0; }
.btn.icon.primary { width: 36px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--blue-2); text-decoration: underline; cursor: pointer; font-weight: 600; }
.linkbtn:hover { color: var(--blue); }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px 26px; display: flex; flex-direction: column; gap: 16px; }
.hint { font-size: 15px; color: var(--muted); margin: 0; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border-radius: 4px; background: var(--amber-text); color: #fff; vertical-align: 2px; margin-left: 6px; }

.notice { padding: 12px 16px; border-radius: 8px; font-weight: 600; }
.notice.ok { background: var(--green-bg); color: var(--green-text); }
.notice.err { background: var(--red-bg); color: var(--red-2); }
.notice.info { background: var(--chip-blue); color: var(--chip-blue-text); }
.notice.warn { background: var(--amber-bg); color: var(--amber-text); border: 1px dashed var(--amber-line); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--night); color: #fff; padding: 12px 18px; border-radius: 8px; font-weight: 600; z-index: 100; box-shadow: 0 6px 24px rgba(17,22,63,.25); max-width: calc(100vw - 32px); }
.toast.err { background: var(--red-2); }

dialog { border: 0; border-radius: 12px; padding: 0; width: min(640px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(17,22,63,.3); }
dialog::backdrop { background: rgba(17,22,63,.45); }
dialog form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ---------------------------------------------------------------- Formular (Hausverwaltung) */
.req { color: #C2410C; font-weight: 700; margin-left: 1px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f > span, fieldset > legend { font-size: 15px; font-weight: 600; color: var(--text); padding: 0; }
.f small, .opt { font-weight: 400; color: var(--muted); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.yn { display: flex; gap: 10px; flex-wrap: wrap; }
.yn label { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px; border: 1px solid var(--input); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 500; }
.yn input, .list input, .checks input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; accent-color: var(--navy); flex: none; }
.yn label:has(input:checked), .list label:has(input:checked), .checks label:has(input:checked) { border-color: var(--navy); background: var(--soft-blue); }
.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.list label, .checks label { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 14px; border: 1px solid var(--input); border-radius: 8px; background: #fff; cursor: pointer; }
.list input { margin-top: 3px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { align-items: center; min-height: 40px; padding: 6px 12px; }
.head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; }
.head h2 { order: 1; flex: 1 1 auto; min-width: 0; }
.head .step { order: 2; margin-left: auto; white-space: nowrap; }
.head .hint { order: 3; flex-basis: 100%; }
.step { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--blue-2); }
.sub { background: var(--soft); border: 1px solid var(--line-2); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.subhead { font-size: 16px; font-weight: 600; color: var(--navy); }
.row { display: flex; gap: 12px; align-items: flex-end; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.rowfields { flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.trash { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.trash:hover, .trash:focus-visible { background: var(--red-bg); border-color: #F0C9B6; color: var(--red-2); }
.badge { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.badge.hi { background: var(--red-bg); color: #8A2F0F; }
.badge.lo { background: var(--chip-blue); color: var(--chip-blue-text); }
.ghost { min-height: 44px; padding: 0 16px; border: 1px solid var(--input); border-radius: 8px; background: #fff; color: var(--navy); font: inherit; font-size: 16px; font-weight: 500; cursor: pointer; }
.ghost:hover { background: #EEF3FA; }
.primary-lg { min-height: 52px; padding: 0 30px; border: 0; border-radius: 8px; background: #fff; color: var(--navy); font: inherit; font-size: 18px; font-weight: 600; letter-spacing: 0.02em; cursor: pointer; }
.primary-lg:hover { background: #EEF3FA; }
.primary-lg:disabled { opacity: .6; cursor: wait; }
.sumgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.sumcard { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.sumcard dt { font-size: 14px; color: var(--muted); margin: 0; }
.sumcard dd { margin: 0; font-size: 16px; font-variant-numeric: tabular-nums; }
.intern { background: var(--amber-bg); border: 1px dashed var(--amber-line); border-radius: 12px; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.cta { background: var(--navy); border-color: var(--navy); color: #fff; }
.cta h2 { color: #fff; }
.cta p { margin: 0; color: #E3E8F6; }
.cta a { color: #fff; }
pre.json { margin: 0; padding: 20px; background: var(--night); color: #E8EDF7; border-radius: 8px; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; line-height: 1.55; overflow-x: auto; white-space: pre; max-height: 600px; }

/* ---------------------------------------------------------------- Interne Seiten */
.page { max-width: 1280px; margin: 0 auto; padding: 28px 24px 64px; display: flex; flex-direction: column; gap: 20px; }
.pagehead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; }
.pagehead p { margin: 4px 0 0; color: var(--text-2); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; text-align: left; font: inherit; cursor: pointer; color: inherit; display: flex; flex-direction: column; gap: 2px; }
.kpi:hover { border-color: var(--blue); }
.kpi.on { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.kpi b { font-size: 26px; font-weight: 600; color: var(--navy); line-height: 1.1; }
.kpi.alarm b { color: var(--red-2); }
.kpi span { color: var(--text-2); font-size: 15px; }

.filters { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.filters .fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.filters .f > span { font-size: 14px; }

.tablewrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table.vg { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 1100px; }
table.vg th { text-align: left; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.vg td { padding: 12px; border-bottom: 1px solid #EDF1F6; vertical-align: top; }
table.vg tr:last-child td { border-bottom: 0; }
table.vg tr:hover td { background: #FAFBFD; }
.objekt a { font-weight: 600; text-decoration: none; color: var(--navy); }
.objekt a:hover { text-decoration: underline; }
.trunc { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.small { font-size: 14px; color: var(--muted); }
.copy { background: none; border: 0; padding: 0 2px; cursor: pointer; color: var(--blue); vertical-align: -2px; }
.actions-cell { display: flex; gap: 8px; }

.bar { display: flex; gap: 3px; align-items: center; height: 16px; }
.bar i { display: block; height: 12px; border-radius: 3px; border: 1px solid #9CC0E6; background: #DCEAF8; }
.bar i.l { width: 22px; }
.bar i.s { width: 11px; }
.bar i.todo { background: #fff; border-color: #C9D3DF; }
.bar i.skip { background: #fff; border: 1px dashed #D3DAE3; }
.bar i.aktiv { background: var(--blue-2); border-color: var(--blue-2); height: 16px; }
.bar i.warn { background: var(--orange); border-color: #D68A12; height: 16px; }
.bar i.fehler { background: #D93A32; border-color: #B3261E; height: 16px; }
.bar i.erfolg { background: var(--green); border-color: var(--green); height: 16px; }
.ftext { font-size: 14px; margin-top: 4px; color: var(--text-2); }
.ftext.alarm { color: var(--orange-text); }
.ftext.handlung::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue-2); margin-right: 7px; vertical-align: 2px; }
.ftext.alarm.handlung::before { background: var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: 5px; font-size: 13px; font-weight: 600; white-space: nowrap; border: 1px solid #B5CDE8; background: var(--chip-blue); color: var(--chip-blue-text); }
.chip.offen { background: #fff; border-color: #C9D3DF; color: var(--text-2); }
.chip.grau { background: #EEF0F3; border-color: #E0E4EA; color: var(--muted); }
.chip.fehler { background: var(--red); border-color: var(--red); color: #fff; }
.chip.warn { background: #FDEBD8; border-color: #F4C9A0; color: var(--orange-text); }
.chip.gewonnen { background: var(--green-bg); border-color: #A9D3AE; color: var(--green-text); }
.statuschip { display: inline-block; padding: 2px 10px; border-radius: 5px; font-size: 13px; font-weight: 600; background: var(--chip-blue); color: var(--chip-blue-text); }
.statuschip.abgeschlossen { background: var(--green-bg); color: var(--green-text); }
.statuschip.abgebrochen { background: #EEF0F3; color: var(--muted); }
.statuschip.alarm { background: var(--red-bg); color: var(--red-2); }

/* Detail */
.back { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; color: var(--blue-2); }
.dhead { display: grid; grid-template-columns: 1fr auto; gap: 12px 24px; }
.dhead h1 { font-size: 30px; font-weight: 500; }
.dmeta { color: var(--muted); }
.dbtns { display: flex; flex-wrap: wrap; gap: 10px; }
.result { background: var(--green-bg); color: var(--green-text); border-radius: 8px; padding: 12px 16px; font-weight: 600; }
.result.grau { background: #EEF0F3; color: var(--text-2); }
.sechead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 15px; }
table.cmp th, table.cmp td { text-align: left; padding: 11px 12px; border-bottom: 1px solid #EDF1F6; vertical-align: top; }
table.cmp thead th { border-bottom: 2px solid var(--navy); vertical-align: bottom; }
table.cmp thead th b { color: var(--navy); font-size: 16px; }
table.cmp td:first-child, table.cmp th:first-child { color: var(--text-2); width: 200px; font-weight: 400; }
table.cmp td.unsicher { background: var(--yellow-bg); }
table.cmp td .abw { display: block; color: var(--orange-text); font-size: 13px; font-weight: 600; }
table.cmp td.fett { font-weight: 700; }
.nicht { background: var(--soft); border: 1px solid var(--line-2); border-radius: 10px; padding: 14px 16px; }
.acards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.acard { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.acard .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.acard .top b { color: var(--navy); }
.acard .err { color: var(--red-2); font-size: 14px; }
.acard .btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.fbgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.fbgrid div { background: var(--soft); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; }
.fbgrid span { display: block; font-size: 14px; color: var(--muted); }
.fbgrid b { font-weight: 600; }
.proto { width: 100%; border-collapse: collapse; font-size: 15px; }
.proto td { padding: 11px 0; border-bottom: 1px solid #EDF1F6; vertical-align: top; }
.proto td:first-child { width: 170px; color: var(--text-2); white-space: nowrap; padding-right: 16px; }
.proto td:nth-child(2) { width: 150px; font-weight: 600; color: var(--navy); padding-right: 16px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

@media (max-width: 760px) {
  .dhead { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .proto td:first-child, .proto td:nth-child(2) { width: auto; }
  .card { padding: 18px 16px; }
  .page { padding: 20px 16px 48px; }
  .logo { font-size: 32px; }
}
