/* Sleep Radar pages on flash.miroslav.diy.
   Tokens and base components mirror the flasher's web/css/style.css so the
   pages read as the same site; kept self-contained so this repo deploys alone. */
:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232c;
  --line: #2a323d;
  --text: #e6edf3;
  --muted: #98a4b3;
  --accent: #ffcc44;
  --ok: #3fb950;
  --err: #f85149;
  --warn: #d29922;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 940px; margin: 0 auto; padding: 0 20px; }
.wrap.wide { max-width: 1180px; }

.topbar {
  background: linear-gradient(180deg, #1a2029, var(--bg));
  border-bottom: 1px solid var(--line);
  padding: 22px 0 26px;
}
.topbar h1 { margin: 6px 0 4px; font-size: 1.9rem; letter-spacing: -0.02em; }
.topbar .sub { margin: 0; color: var(--muted); }
.home { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.home:hover { color: var(--accent); }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px 16px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 18px 0;
  min-width: 0;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card h3 { margin: 18px 0 8px; font-size: 0.98rem; }
.card p { margin: 0 0 10px; }
.card ul, .card ol { margin: 0 0 10px; padding-left: 22px; }
.card li { margin: 3px 0; }
.step {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #10141a;
  font-size: 0.85rem;
  font-weight: 700;
}
.card.warn { border-color: var(--warn); }
.card.doc { color: var(--muted); }
.card.doc h2, .card.doc h3, .card.doc strong { color: var(--text); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; align-items: end; }
.field { display: grid; gap: 5px; font-size: 0.85rem; color: var(--muted); min-width: 0; }
.field em { font-style: normal; opacity: 0.75; }
input[type=text], input[type=password], input[type=number], select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  width: 100%;
  min-width: 0;
}
input:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input[aria-invalid=true] { border-color: var(--err); }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--muted); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 15px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover:not(:disabled) { border-color: #55606f; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #10141a; border-color: var(--accent); font-weight: 600; }
.btn.fix { border-color: var(--ok); color: #8ee79a; }
.btn.danger { border-color: #6d2b28; color: #ff9c95; }
.btn.small { padding: 6px 10px; font-size: 0.88rem; }

.status { margin: 12px 0 0; color: var(--muted); font-size: 0.92rem; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.status.warn { color: var(--warn); }
.status.work { color: var(--accent); }

.log {
  background: #0a0d12;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 0;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #b9c6d4;
}
.log .tx { color: #ffd772; }
.log .rx { color: #8ee79a; }
.log .info { color: var(--muted); }

.hint { color: var(--muted); font-size: 0.87rem; margin: 10px 0 0; }
.hint.accent { color: var(--accent); }
.pill { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: #2a5a34; }
.pill.warn { color: var(--warn); border-color: #5c4614; }
.pill.err { color: var(--err); border-color: #6d2b28; }

code { background: #0a0d12; border-radius: 5px; padding: 1px 5px; font-size: 0.9em; overflow-wrap: anywhere; }
a { color: var(--accent); }
.hidden { display: none !important; }
.foot { color: var(--muted); font-size: 0.85rem; padding-bottom: 40px; }

/* ---------------------------------------------------------------- project page */
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin: 4px 0 14px; }
.flow .node {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  flex: 1 1 150px;
  min-width: 0;
}
.flow .node strong { display: block; }
.flow .node span { color: var(--muted); font-size: 0.85rem; }
.flow .arrow { align-self: center; color: var(--accent); font-weight: 700; }

.fw-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.fw {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  gap: 8px;
  align-content: start;
}
.fw .meta { color: var(--muted); font-size: 0.85rem; }
.fw .btn { justify-self: start; }

.device {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-top: 14px;
}
.mac {
  font: 600 1.45rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.02em;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.mac-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; font-size: 0.9rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.banner {
  border: 1px solid var(--warn);
  background: rgba(210, 153, 34, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 12px;
}
.banner.err { border-color: var(--err); background: rgba(248, 81, 73, 0.08); }
.banner .actions { margin-top: 8px; }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.note { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; margin: 10px 0; color: var(--muted); }
.note strong { color: var(--text); }
.medical { border-left-color: var(--warn); }

/* ---------------------------------------------------------------- wiring page */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tabs button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.tabs button[aria-selected=true] { color: #10141a; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.figure {
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #eceff1;
  cursor: zoom-in;
}
.figure svg { display: block; width: 100%; height: auto; }
.fig-tools { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 10px; font-size: 0.9rem; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 500; background: var(--panel-2); position: sticky; top: 0; }
table.data tr:last-child td { border-bottom: 0; }
table.data code, .flow code { white-space: nowrap; overflow-wrap: normal; }
table.data td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sw { display: inline-block; width: 22px; height: 7px; border-radius: 4px; vertical-align: middle; margin-right: 6px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25); }
.toc { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.92rem; }
.files { display: grid; gap: 6px; }
.file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
}
.file .what { color: var(--muted); grid-column: 1 / -1; font-size: 0.85rem; }

@media (max-width: 620px) {
  .wrap { padding: 0 14px; }
  .topbar h1 { font-size: 1.55rem; }
  .card { padding: 16px 14px; }
  .device { grid-template-columns: minmax(0, 1fr); }
  .mac { font-size: 1.2rem; }
  .flow .arrow { display: none; }
}
