:root {
  --bg: #eef3f1;
  --card: #ffffff;
  --text: #17312a;
  --muted: #5b6f68;
  --line: #d5e0dc;
  --primary: #13684f;
  --primary-text: #ffffff;
  --danger: #b3261e;
  --ok: #1d8a5b;
  --warn: #b7791f;
  --fail: #c0392b;
  --idle: #a9b8b3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1715;
    --card: #18231f;
    --text: #e3eee9;
    --muted: #9db0a9;
    --line: #2b3a35;
    --primary: #2fa37c;
    --primary-text: #06120e;
    --danger: #e5534b;
    --ok: #3ccf8e;
    --warn: #e0a43a;
    --fail: #f06b5f;
    --idle: #4b5c56;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 -apple-system, system-ui, "Segoe UI", Tahoma, sans-serif;
}
main {
  max-width: 34rem;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}
header h1 { font-size: 1.5rem; margin: .5rem 0 0; }
.sub { color: var(--muted); margin: 0 0 1rem; font-size: .92rem; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
h3 { font-size: .95rem; margin: 1rem 0 .3rem; }
h3 small { color: var(--muted); font-weight: normal; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 0 0 12px;
}
.status { font-size: 1.12rem; font-weight: 600; margin: 0; }
.status.ok { color: var(--ok); }
.status.fail { color: var(--fail); }
.status.warn { color: var(--warn); }
.hint { color: var(--muted); font-size: .9rem; margin: .4rem 0 0; }
label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .3rem; }
input {
  width: 100%;
  font: inherit;
  font-size: .85rem;
  padding: .65rem .7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.actions { margin: 0 0 12px; display: grid; gap: 10px; }
.row { display: flex; gap: 10px; margin-top: 10px; }
.actions .row { margin-top: 0; }
.row > button { flex: 1; }
button {
  font: inherit;
  font-weight: 600;
  min-height: 48px;
  padding: .6rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--primary); color: var(--primary-text); border-color: transparent; width: 100%; font-size: 1.1rem; min-height: 56px; }
button.danger { background: var(--danger); color: #fff; border-color: transparent; }
button[aria-pressed="true"] { background: var(--warn); color: #111; border-color: transparent; }
.stages { list-style: none; margin: 0; padding: 0; }
.stages li {
  display: grid;
  grid-template-columns: 14px 1fr;
  column-gap: 10px;
  padding: .45rem 0;
  border-top: 1px solid var(--line);
}
.stages li:first-child { border-top: 0; }
.stages .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--idle); margin-top: .45rem; grid-row: span 2; }
.stages small { color: var(--muted); font-size: .85rem; }
.stages li[data-state="active"] .dot { background: var(--warn); animation: pulse 1.2s infinite; }
.stages li[data-state="ok"] .dot { background: var(--ok); }
.stages li[data-state="fail"] .dot { background: var(--fail); }
.stages li[data-state="fail"] small { color: var(--fail); }
@keyframes pulse { 50% { opacity: .35; } }
details summary { font-weight: 600; cursor: pointer; min-height: 32px; }
dl { margin: 0; }
dl > div { display: flex; justify-content: space-between; gap: 12px; padding: .3rem 0; border-top: 1px dashed var(--line); font-size: .92rem; }
dt { color: var(--muted); }
dd { margin: 0; text-align: left; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .stages li[data-state="active"] .dot { animation: none; } }
