/* ESA Designmanual 2.0: Dunkelblau #001f32, Türkisblau #009baf, Gelb #fcc45f, Orange #dd8a4e, Silber RAL 7001.
   Lesetext IBM Plex Sans, Titel ESA Display Fat 800, große Zahlen ESA Display Light 300.
   Auf Türkis steht Dunkelblau, nicht Weiß. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 300; font-display: swap; src: url(fonts/ibm-plex-sans-latin-300-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "ESA Display"; font-weight: 300; font-display: swap; src: url(fonts/esaplay-light.woff2) format("woff2"); }
@font-face { font-family: "ESA Display"; font-weight: 800; font-display: swap; src: url(fonts/esaplay-fat.woff2) format("woff2"); }

:root {
  --bg: #eef1f3; --panel: #fff; --ink: #001f32; --muted: #4b5d6a; --line: #c9d1d6; --grid: #e4e9ec;
  --accent: #009baf; --on-accent: #001f32; --chrome: #001f32; --menu: #143e5a; --bar: #e8ecef; --tint: #e6f5f7;
  --yellow: #fcc45f; --orange: #dd8a4e; --silver: #8f999f;
  --warn-bg: #feedc8; --bad-bg: #f6dcca; --bad-ink: #6b2c05; --good: #0b7a4b;
  --text: "IBM Plex Sans", "Segoe UI", Roboto, Arial, sans-serif;
  --display: "ESA Display", "IBM Plex Sans", "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--text); font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: .01em; margin: 0; }
h1 { font-size: clamp(22px, 2.8vw, 30px); line-height: 1.15; }
h2 { font-size: 18px; margin-bottom: 10px; }
h3 { font-size: 15px; margin: 0 0 8px; }
a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 2px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
small { font-size: 13px; }

/* Kopf */
.brand { background: var(--chrome); color: #fff; display: flex; align-items: center; gap: 14px; padding: 10px 18px; }
.brand a { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; }
.brand img { height: 22px; width: auto; display: block; }
.brand .product { white-space: nowrap; font-family: var(--display); font-weight: 800; color: var(--accent); font-size: 26px; line-height: 22px; letter-spacing: .03em; position: relative; top: -1px; }
.brand .who { margin-left: auto; font-size: 13px; color: #d5dde2; display: flex; gap: 14px; align-items: center; }
.brand .who a { color: #fff; }
.menubar { background: var(--menu); display: flex; gap: 2px; padding: 0 10px; overflow-x: auto; }
.menubar a { color: #fff; text-decoration: none; padding: 8px 12px 7px; font-size: 14px; white-space: nowrap; border-bottom: 3px solid transparent; }
.menubar a:hover { background: rgba(255,255,255,.12); }
.menubar a.on { border-bottom-color: var(--accent); font-weight: 600; }
.menubar .sep { margin-left: auto; }

main { max-width: 1240px; margin: 0 auto; padding: 18px 18px 60px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Flächen */
.panel { background: var(--panel); border: 1px solid var(--line); padding: 16px 18px; margin-bottom: 12px; }
.panel > h2:first-child { margin-top: 0; }
.panel-head { margin: -16px -18px 14px; padding: 8px 18px; background: var(--bar); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.panel-head h2 { margin: 0; font-size: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.grid2 > * { min-width: 0; }

/* Kennzahlen */
.strip { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--accent); margin-bottom: 12px; }
.strip div { padding: 8px 14px 10px; border-left: 1px solid var(--line); }
.strip div:first-child { border-left: 0; }
.strip dt { color: var(--muted); font-size: 13px; }
.strip dd { margin: 0; font-family: var(--display); font-weight: 300; font-size: 32px; line-height: 1.15; }

/* Schaltflächen */
button, .button { font: inherit; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 3px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); cursor: pointer; text-decoration: none; line-height: 1.3; }
button:hover:not(:disabled), .button:hover { background: var(--chrome); border-color: var(--chrome); color: #fff; }
button.ghost, .button.ghost { background: #fff; color: var(--ink); font-weight: 400; }
button.ghost:hover:not(:disabled), .button.ghost:hover { background: var(--tint); color: var(--ink); border-color: var(--accent); }
button.danger { background: #fff; color: var(--bad-ink); border-color: var(--orange); font-weight: 400; }
button.danger:hover:not(:disabled) { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--orange); }
button.small, .button.small { padding: 3px 9px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
form.inline { display: inline; }

/* Formulare */
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--silver); border-radius: 3px; padding: 7px 9px; width: 100%; max-width: 100%; }
textarea { min-height: 76px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 19px; height: 19px; accent-color: var(--accent); margin: 0; flex: none; }
input:disabled, select:disabled, textarea:disabled { background: var(--bar); color: var(--ink); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 18px; }
.field label.l { display: block; color: var(--muted); font-size: 13px; margin-bottom: 3px; }
.field .unit { display: flex; align-items: center; }
.field .unit input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.field .unit span { border: 1px solid var(--silver); border-left: 0; background: var(--bar); padding: 7px 9px; border-radius: 0 3px 3px 0; color: var(--muted); white-space: nowrap; }
.field small { display: block; color: var(--muted); margin-top: 3px; line-height: 1.3; }
.field.wide { grid-column: 1 / -1; }
.field .req { color: var(--orange); }
.check { display: flex; gap: 9px; align-items: center; grid-column: 1 / -1; padding: 2px 0; }
.check label { cursor: pointer; }
.seg { display: inline-flex; flex-wrap: wrap; }
.seg label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); margin: 0 -1px -1px 0; padding: 6px 9px; background: #fff; cursor: pointer; font-size: 13px; white-space: nowrap; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; position: relative; z-index: 1; }
.seg label:has(input:checked.bad) { background: var(--orange); border-color: var(--orange); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 1px; }
.choices { display: flex; flex-direction: column; gap: 6px; }
.choices label { display: flex; gap: 9px; align-items: center; cursor: pointer; }
section.part { border-top: 1px solid var(--line); padding: 14px 0 16px; }
section.part:first-of-type { border-top: 0; padding-top: 4px; }
section.part > p.intro { color: var(--muted); margin: -4px 0 12px; max-width: 60em; }
[hidden] { display: none !important; }

/* Listen (Wechselrichter, Strings …) */
.items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.item { border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 10px 14px 14px; background: #fbfcfc; }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.item-head b { font-weight: 600; }
.item .calc { color: var(--muted); font-size: 13px; margin-top: 8px; }
.item .calc.bad { color: var(--bad-ink); font-weight: 600; }

/* Befund-Arbeitsbereich */
.wizard { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 12px; align-items: start; }
.steps { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); position: sticky; top: 8px; }
.steps a { display: grid; grid-template-columns: 24px 1fr auto; gap: 6px; padding: 8px 12px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--grid); font-size: 14px; }
.steps a:hover { background: var(--tint); }
.steps a.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.steps .n { color: var(--muted); }
.steps a.on .n { color: var(--on-accent); }
.steps .p { font-size: 12px; color: var(--muted); }
.steps .p.full { color: var(--good); font-weight: 600; }
.steps a.on .p { color: var(--on-accent); }
.save-bar { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 10px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; z-index: 5; margin-top: 4px; }
.save-bar .right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.card { display: block; background: #fff; border: 1px solid var(--line); border-top: 2px solid var(--accent); padding: 10px 14px 12px; text-decoration: none; color: var(--ink); }
.card:hover { background: var(--tint); }
.card .k { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.card .t { font-family: var(--display); font-weight: 800; font-size: 16px; margin: 2px 0 2px; }
.card .s { color: var(--muted); font-size: 13px; min-height: 2.6em; }
.bar { height: 6px; background: var(--grid); margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.full { background: var(--good); }

.progress-big { display: flex; align-items: baseline; gap: 10px; }
.progress-big b { font-family: var(--display); font-weight: 300; font-size: 44px; line-height: 1; }

/* Tabellen */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
th { font-weight: 600; background: var(--bar); border-bottom: 1px solid var(--line); white-space: nowrap; }
td.n, th.n { text-align: right; }
tbody tr:hover { background: var(--tint); }
tr.link { cursor: pointer; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); }

.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--bar); white-space: nowrap; }
.badge.ok { background: var(--tint); border-color: var(--accent); }
.badge.draft { background: var(--warn-bg); border-color: var(--yellow); }
.badge.bad { background: var(--bad-bg); border-color: var(--orange); color: var(--bad-ink); }

.flash { padding: 9px 14px; margin: 0 0 14px; border-left: 3px solid var(--accent); background: var(--tint); }
.flash.bad { border-left-color: var(--orange); background: var(--bad-bg); color: var(--bad-ink); }
.note { padding: 9px 14px; background: var(--warn-bg); border-left: 3px solid var(--yellow); margin: 0 0 12px; }
.note ul { margin: 6px 0 0; padding-left: 18px; }
.released { padding: 9px 14px; background: var(--tint); border-left: 3px solid var(--accent); margin: 0 0 12px; }

.search { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search input { max-width: 320px; }
.search select { max-width: 200px; }

.sld-box { background: #fff; border: 1px solid var(--line); padding: 10px; overflow-x: auto; }
.sld-box svg { width: 100%; min-width: 640px; height: auto; display: block; }

.sig { border: 1px solid var(--silver); background: #fff; border-radius: 3px; position: relative; max-width: 520px; }
.sig canvas { display: block; width: 100%; height: 160px; touch-action: none; cursor: crosshair; }
.sig img { display: block; max-width: 100%; height: 160px; object-fit: contain; }
.sig .sig-line { position: absolute; left: 16px; right: 16px; bottom: 34px; border-bottom: 1px dashed var(--silver); pointer-events: none; }
.sig-tools { display: flex; gap: 8px; margin-top: 6px; }

.gate { max-width: 420px; margin: 9vh auto 0; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--accent); padding: 26px 28px; }
.gate h1 { margin-bottom: 4px; }
.gate .field { margin-bottom: 12px; }
.log { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.log li { padding: 4px 0; border-top: 1px solid var(--grid); display: grid; grid-template-columns: 112px 1fr; gap: 8px; }
.log time { color: var(--muted); }
.pw { font-size: 20px; font-weight: 600; letter-spacing: .08em; background: var(--tint); padding: 6px 12px; display: inline-block; }
footer.app { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 0 30px; }

@media (max-width: 900px) {
  .wizard, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .steps { position: static; display: flex; overflow-x: auto; scroll-snap-type: x proximity; }
  .steps li { flex: none; scroll-snap-align: start; }
  .steps a { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 0; border-right: 1px solid var(--grid); white-space: nowrap; }
  .save-bar .t { display: none; }
  .strip { grid-template-columns: repeat(2, 1fr); }
  .strip div:nth-child(3) { border-left: 0; }
  .brand .who span { display: none; }
  .brand .product { font-size: 20px; }
  .brand { padding: 10px 12px; }
}
@media print { .brand, .menubar, .save-bar, .steps { display: none; } }
