:root {
  --bg: #f6f7f9; --card: #fff; --text: #1d2330; --muted: #6b7385; --border: #dfe3ea;
  --accent: #2f6fde; --ok: #1f8a4c; --okbg: #e3f4ea; --bad: #c0392b; --badbg: #fbe7e5;
  --busy: #b7791f; --busybg: #fdf3dc; --code: #eef1f5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --card: #1d2128; --text: #e4e7ec; --muted: #9098a8; --border: #2e343e;
    --accent: #6b9cf0; --ok: #5fcf8e; --okbg: #1c3326; --bad: #f08074; --badbg: #3a1f1c;
    --busy: #e8b45a; --busybg: #3a2f17; --code: #262b33;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--card); }
.brand { font-weight: 600; color: var(--text); text-decoration: none; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 8px 0 16px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }
h3 { font-size: .95rem; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
a { color: var(--accent); }
code { background: var(--code); padding: 1px 5px; border-radius: 4px; font-size: .88em; }
code.wrap { word-break: break-all; }
pre.devlog { max-height: 420px; overflow-y: auto; white-space: pre-wrap; }
pre { background: var(--code); padding: 10px; border-radius: 6px; overflow-x: auto; font-size: .85em; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.card.narrow { max-width: 360px; margin: 60px auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.big { font-size: 1.2rem; margin: 0 0 4px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.grow { flex: 1 1 220px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9em; color: var(--muted); }
input { font: inherit; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); min-width: 0; }
button { font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
button.small { padding: 3px 9px; font-size: .85em; background: transparent; color: var(--accent); }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.danger.small { background: transparent; color: var(--bad); }
button.link { background: none; border: none; color: var(--accent); padding: 0; }
form.inline { display: inline; }
.flash { background: var(--busybg); color: var(--text); border: 1px solid var(--border); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.warn { color: var(--busy); }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8em; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .82em; background: var(--code); }
.badge.ok { background: var(--okbg); color: var(--ok); }
.badge.bad { background: var(--badbg); color: var(--bad); }
.badge.busy { background: var(--busybg); color: var(--busy); }
.bar { height: 8px; background: var(--code); border-radius: 4px; overflow: hidden; margin: 6px 0 2px; min-width: 120px; }
.bar > div { height: 100%; background: var(--busy); transition: width .4s; }
.bar.complete > div { background: var(--ok); }
.bar.aborted > div { background: var(--bad); }
.bar.small { height: 6px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 10px 0 0; }
dt { color: var(--muted); font-size: .88em; }
dd { margin: 0; min-width: 0; }
.copyrow { display: flex; gap: 6px; align-items: flex-start; }
.fwhead { display: flex; justify-content: space-between; gap: 10px; }
td code { white-space: nowrap; }
.danger-zone { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
@media (max-width: 700px) {
  table.devices thead { display: none; }
  table.devices tr { display: block; border-bottom: 1px solid var(--border); }
  table.devices td { display: block; border: none; padding: 4px 10px; }
  table.devices td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: .75em; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
  table.devices tr { padding: 6px 0; }
  .grid.two { grid-template-columns: 1fr; }
  dl { grid-template-columns: 1fr; }
}
#live { margin-bottom: 16px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--muted); }
.dot.on { background: var(--ok); }
.fwhead .row { margin: 0; flex-wrap: nowrap; }
