/* Layout: one narrow working column; settings are lists of rows that open into inline forms. */
:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --line: #d5dcd9;
  --fg: #17211e;
  --muted: #5b6965;
  --accent: #0b6b5c;
  --accent-fg: #ffffff;
  --accent-soft: #dcefea;
  --high: #1f9d55;
  --low: #a9b4b0;
  --warn-bg: #fdecea;
  --warn-fg: #8f1d15;
  --ok-bg: #e2f3e8;
  --ok-fg: #14532d;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101614;
    --surface: #18211e;
    --line: #2c3a35;
    --fg: #e6eeeb;
    --muted: #9aaaa5;
    --accent: #4cc4ae;
    --accent-fg: #06231d;
    --accent-soft: #17352f;
    --high: #4ade80;
    --low: #4a5a55;
    --warn-bg: #3a1614;
    --warn-fg: #ffb4ab;
    --ok-bg: #143021;
    --ok-fg: #a7e8bf;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--font);
}
.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
main.wrap { padding-block: 24px 64px; display: flex; flex-direction: column; gap: 20px; }
main > section { display: flex; flex-direction: column; gap: 16px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: 0.01em; color: var(--accent); }
.brand span { color: var(--fg); }
.conn { display: flex; align-items: center; gap: 8px; }
.chip { font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--fg); }

h1 { font-size: 24px; line-height: 1.2; margin: 0; text-wrap: balance; }
h2 { font-size: 16px; margin: 0; }
p { margin: 0; }
.lede { color: var(--muted); max-width: 62ch; }
.hint { color: var(--muted); font-size: 13.5px; max-width: 68ch; }

.btn {
  font: inherit; font-weight: 550; cursor: pointer;
  padding: 7px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--fg);
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--accent); padding-inline: 8px; }
.btn.danger { color: var(--warn-fg); }
.btn:disabled { opacity: 0.55; cursor: default; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.choices { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.choice {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.choice p { color: var(--muted); font-size: 14px; flex: 1; }

.notice { padding: 10px 14px; border-radius: var(--radius); background: var(--ok-bg); color: var(--ok-fg); }
.notice.error { background: var(--warn-bg); color: var(--warn-fg); }
.notice.busy { background: var(--accent-soft); color: var(--fg); }

.node-head { display: flex; flex-direction: column; gap: 2px; }
.block { display: flex; flex-direction: column; gap: 10px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; }

.pins { display: flex; flex-wrap: wrap; gap: 8px; }
.pin {
  display: flex; align-items: center; gap: 6px;
  font: 13px var(--mono); padding: 4px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.pin i { width: 9px; height: 9px; border-radius: 50%; background: var(--low); }
.pin.high i { background: var(--high); }
.pin.used { border-color: var(--accent); }

.list { display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--muted); padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius); }
.item, .panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.item { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.item-text { min-width: 0; flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; }
.item-title { font-weight: 600; overflow-wrap: anywhere; }
.item-sub { color: var(--muted); font-size: 13.5px; }
.tag { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 1px 7px; border-radius: 4px; background: var(--accent-soft); margin-left: 6px; vertical-align: 1px; }

.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 13px; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
.field.inline > span { font-size: inherit; color: var(--fg); }
.field.inline input { width: 90px; }
input, select {
  font: inherit; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; width: 100%; min-width: 0;
}
.count { font-variant-numeric: tabular-nums; }

.console summary { cursor: pointer; color: var(--muted); font-size: 13.5px; }
.console pre {
  font: 12.5px/1.45 var(--mono); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; margin: 8px 0 0; max-height: 240px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
}
