:root {
  --ink: #1a2421;
  --ink-soft: #56655f;
  --paper: #eef1f0;
  --card: #ffffff;
  --line: #ccd5d1;
  --signal: #1f6f5c;
  --alert: #a8342b;
  --radius: 10px;
  --gap: 20px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.shell {
  max-width: 34rem;
  margin: 0 auto;
  padding: 28px 20px 56px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

h1 { font-size: 1.5rem; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 0.95rem; margin: 0 0 8px; letter-spacing: -0.01em; }
p { margin: 0; }

.masthead { display: flex; flex-direction: column; gap: 8px; }
.mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--ink) url("/icons/icon-192.png") center/cover;
}
.lede { color: var(--ink-soft); max-width: 32rem; }

/* --- gates: hero --- */

.gates {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}

.gate {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}
.gate:first-child { border-top: 0; }

.gate-state {
  flex: 0 0 auto;
  width: 14px; height: 14px;
  margin-top: 4px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: transparent;
  transition: background-color .18s ease, border-color .18s ease;
}
.gate[data-state="pass"] .gate-state { background: var(--signal); border-color: var(--signal); }
.gate[data-state="fail"] .gate-state { border-color: #c2a8a4; }
.gate[data-state="wait"] .gate-state { border-color: var(--signal); border-style: dashed; }

.gate-body { display: flex; flex-direction: column; }
.gate-name { font-weight: 550; }
.gate[data-state="pass"] .gate-name { color: var(--signal); }
.gate-note { color: var(--ink-soft); font-size: 0.85rem; }

/* --- installationsark --- */

.sheet {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
}
.sheet h2 { color: #fff; }
.sheet p { color: #b9c6c1; font-size: 0.92rem; }
.steps {
  margin: 14px 0 0;
  padding-left: 1.1em;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.95rem;
}
.steps b { font-weight: 600; }
.glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  vertical-align: -7px;
  border-radius: 6px;
  background: rgba(255,255,255,.14);
  color: #fff;
}
.sheet-foot { margin-top: 14px; color: #e0b4ae; }

/* --- knapper --- */

.action { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.btn {
  font: inherit;
  font-weight: 550;
  color: #fff;
  background: var(--signal);
  border: 0;
  border-radius: var(--radius);
  padding: 13px 20px;
  min-height: 46px;
  cursor: pointer;
  width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn-quiet { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }

.hint { color: var(--ink-soft); font-size: 0.9rem; }

/* --- readout og log --- */

.readout, .log {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 16px;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.76rem;
  word-break: break-all;
  color: var(--ink-soft);
}
.readout-note { margin-top: 10px; font-size: 0.88rem; color: var(--ink-soft); }
.log ul, ul.mono { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.log li { border-bottom: 1px dotted var(--line); padding-bottom: 4px; }
.log li:last-child { border-bottom: 0; }

/* --- konsol --- */

.console { max-width: 46rem; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.85rem; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  font: inherit;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  width: 100%;
}
.field textarea { resize: vertical; min-height: 74px; }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 18px;
}
.btn-send { background: var(--alert); }
.devices { list-style: none; margin: 0; padding: 0; }
.devices li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 0.9rem;
}
.devices li:first-child { border-top: 0; }
.devices .meta { color: var(--ink-soft); font-size: 0.78rem; text-align: right; }
.empty { color: var(--ink-soft); font-size: 0.9rem; }
.result { margin-top: 14px; font-size: 0.88rem; }
.result .ok { color: var(--signal); }
.result .bad { color: var(--alert); }

@media (min-width: 620px) {
  .btn { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
