:root {
  --graphite: #1C1F22;
  --steel: #3D5A73;
  --volt: #C9F31D;
  --bg: #F2F0EA;
  --card: #FFFFFF;
  --ok: #4B8B3B;
  --watch: #C08A2E;
  --action: #C0492E;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--graphite);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.55;
}

.wrap { max-width: 780px; margin: 0 auto; padding: 20px 16px 80px; }

h1, h2, h3 { font-family: 'Space Grotesk', system-ui, sans-serif; letter-spacing: -0.01em; }
h1 { font-size: 1.65rem; font-weight: 600; margin: 0 0 8px; line-height: 1.2; }
h2 { font-size: 1.2rem; font-weight: 600; margin: 0 0 6px; }
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 4px; }

.mono { font-family: 'IBM Plex Mono', monospace; }
.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 10px;
}
.lead { color: rgba(28,31,34,0.7); margin: 0 0 24px; }
.muted { color: rgba(28,31,34,0.55); }
.small { font-size: 0.82rem; }

/* ---------- Header / Stepper ---------- */

.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px; max-width: 780px; margin: 0 auto;
  font-family: 'Space Grotesk', sans-serif; font-weight: 600;
}
.topbar-brand { color: inherit; text-decoration: none; }
.topbar .dashsep { color: var(--steel); }

.app-footer { border-top: 1px solid rgba(28,31,34,0.1); padding: 24px 0; margin-top: 40px; }
.app-footer .wrap { padding-bottom: 0; }
.app-footer .footer-inner {
  display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem; color: rgba(28,31,34,0.5);
}
@media (min-width: 560px) {
  .app-footer .footer-inner { flex-direction: row; justify-content: space-between; }
}
.app-footer nav { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.app-footer a { color: inherit; text-decoration: none; }
.app-footer a:hover { color: var(--graphite); text-decoration: underline; }

.stepper { display: flex; gap: 6px; margin-bottom: 26px; }
.stepper .step {
  flex: 1; height: 3px; border-radius: 999px; background: rgba(28,31,34,0.12);
}
.stepper .step.done { background: var(--graphite); }
.stepper .step.active { background: var(--volt); }

/* ---------- Cards & Forms ---------- */

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

fieldset { border: 0; padding: 0; margin: 0 0 26px; }
legend { padding: 0; margin-bottom: 10px; font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 1.02rem; }
.hint { font-size: 0.82rem; color: rgba(28,31,34,0.55); margin: -4px 0 12px; }

.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 620px) { .choice-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }

.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: block; padding: 12px 14px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid rgba(28,31,34,0.14); background: var(--card);
  font-size: 0.9rem; transition: border-color .15s, background .15s;
}
.choice span small { display: block; font-size: 0.75rem; color: rgba(28,31,34,0.55); margin-top: 2px; }
.choice input:checked + span { border-color: var(--graphite); background: #fff; box-shadow: inset 0 0 0 1px var(--graphite); }
.choice input:focus-visible + span { outline: 2px solid var(--steel); outline-offset: 2px; }

.field-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 620px) { .field-row.cols-4 { grid-template-columns: repeat(4, 1fr); } }

label.field { display: block; font-size: 0.82rem; color: rgba(28,31,34,0.7); margin-bottom: 12px; }
label.field input, label.field select {
  display: block; width: 100%; margin-top: 4px;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.95rem;
  padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid rgba(28,31,34,0.14); background: var(--card); color: var(--graphite);
}
label.field input:focus, label.field select:focus { outline: none; border-color: var(--steel); }

.checks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 0.92rem;
  background: var(--graphite); color: var(--bg);
  border: none; padding: 13px 22px; border-radius: 999px; cursor: pointer;
  line-height: 1.2; text-align: center;
}
/* Die Datei-Auswahl ist ein <label for>, damit der Dialog nicht doppelt aufgeht */
label.btn { -webkit-user-select: none; user-select: none; }
label.btn:focus-within { outline: 2px solid var(--steel); outline-offset: 2px; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.volt { background: var(--volt); color: var(--graphite); }
.btn.ghost { background: transparent; color: var(--graphite); border: 1.5px solid rgba(28,31,34,0.18); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.btn-row.spread { justify-content: space-between; }

/* ---------- Video / Analyse ---------- */

input[type="file"] { display: none; }

.stage { position: relative; width: 100%; background: var(--graphite); border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 10; }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

.range-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.range-row input[type="range"] { flex: 1; }
.range-row .val { font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem; color: var(--steel); min-width: 58px; text-align: right; }

.progress { height: 6px; border-radius: 999px; background: rgba(28,31,34,0.1); overflow: hidden; margin-top: 14px; }
.progress > div { height: 100%; width: 0; background: var(--volt); transition: width .1s linear; }

.status { font-family: 'IBM Plex Mono', monospace; font-size: 0.75rem; color: var(--steel); display: flex; align-items: center; gap: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #ccc; flex: none; }
.dot.ok { background: var(--volt); }
.dot.err { background: var(--action); }

/* ---------- Report ---------- */

.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
@media (min-width: 620px) { .summary-grid { grid-template-columns: repeat(4, 1fr); } }
.summary-box { background: var(--card); border-radius: 12px; padding: 14px; text-align: center; }
.summary-box .v { font-family: 'IBM Plex Mono', monospace; font-size: 1.35rem; font-weight: 500; }
.summary-box .l { font-size: 0.72rem; color: rgba(28,31,34,0.55); margin-top: 2px; }

.result { border-left: 4px solid rgba(28,31,34,0.15); }
.result.ok { border-left-color: var(--ok); }
.result.watch { border-left-color: var(--watch); }
.result.action { border-left-color: var(--action); }
.result.na { border-left-color: rgba(28,31,34,0.2); }

.result-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.result-head .num { font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem; color: var(--steel); }
.badge {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.66rem; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 999px; text-transform: uppercase; margin-left: auto;
}
.badge.ok { background: rgba(75,139,59,0.12); color: var(--ok); }
.badge.watch { background: rgba(192,138,46,0.14); color: var(--watch); }
.badge.action { background: rgba(192,73,46,0.12); color: var(--action); }
.badge.na { background: rgba(28,31,34,0.08); color: rgba(28,31,34,0.5); }

table.meas { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 0.85rem; }
table.meas td { padding: 8px 0; border-bottom: 1px solid rgba(28,31,34,0.08); vertical-align: top; }
table.meas td:nth-child(2) { font-family: 'IBM Plex Mono', monospace; text-align: right; white-space: nowrap; padding-left: 10px; }
table.meas td:nth-child(3) { font-family: 'IBM Plex Mono', monospace; text-align: right; color: rgba(28,31,34,0.5); white-space: nowrap; padding-left: 14px; font-size: 0.78rem; }
table.meas tr.off td:nth-child(2) { color: var(--action); }

ol.plan { margin: 14px 0 0; padding-left: 20px; }
ol.plan > li { margin-bottom: 16px; }
ol.plan > li::marker { font-family: 'IBM Plex Mono', monospace; font-weight: 500; color: var(--steel); }
.plan-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 0.98rem;
  margin-bottom: 2px;
}
.plan-head .badge { margin-left: 0; }

ul.actions { margin: 10px 0 0; padding-left: 18px; }
ul.actions li { margin-bottom: 7px; font-size: 0.9rem; }
ul.actions strong { background: rgba(201,243,29,0.35); padding: 0 3px; border-radius: 3px; }

.notice {
  background: rgba(61,90,115,0.08); border-radius: 10px; padding: 12px 14px;
  font-size: 0.82rem; margin-top: 14px;
}
.notice.warn { background: rgba(192,138,46,0.12); }

.hidden { display: none !important; }

/* Sprachumschalter in der Kopfzeile */
.topbar { justify-content: space-between; }
.lang-switch {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem; font-weight: 400;
  letter-spacing: 0.06em; color: var(--steel); text-decoration: none;
  border: 1px solid rgba(28,31,34,0.15); border-radius: 999px; padding: 5px 12px;
}
.lang-switch:hover { border-color: var(--steel); }
