:root {
  --bg: #f4f5f7; --panel: #ffffff; --ink: #1d2128; --muted: #667080; --line: rgba(20, 30, 50, 0.09);
  --accent: #1e6fd9; --accent-ink: #ffffff; --go: #12805c; --go-bg: #e3f4ec; --stop: #c62f2f; --stop-bg: #fbe9e9;
  --warn: #9a5b00; --warn-bg: #fff3dc; --chip: #eef0f4; --aid: #9e9e9e; --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --r: 14px; --r-sm: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101317; --panel: #191d23; --ink: #e8ebf0; --muted: #98a2b3; --line: rgba(255, 255, 255, 0.08);
    --accent: #4c95f0; --go: #3fbf8a; --go-bg: #12291f; --stop: #f06a6a; --stop-bg: #2c1717; --warn: #f0b34a;
    --warn-bg: #2b2111; --chip: #232931; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #101317; --panel: #191d23; --ink: #e8ebf0; --muted: #98a2b3; --line: rgba(255, 255, 255, 0.08);
  --accent: #4c95f0; --go: #3fbf8a; --go-bg: #12291f; --stop: #f06a6a; --stop-bg: #2c1717; --warn: #f0b34a;
  --warn-bg: #2b2111; --chip: #232931; --shadow: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; -webkit-text-size-adjust: 100%; }
#app { max-width: 1180px; margin: 0 auto; padding: 0 16px 120px; }
.boot { color: var(--muted); padding: 40px 0; text-align: center; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: 0; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 999px; padding: 9px 16px; background: var(--chip);
  color: var(--ink); font-weight: 600; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-ink); }
button.go { background: var(--go); color: #fff; }
button.nogo { background: var(--stop-bg); color: var(--stop); }
button.small { padding: 5px 12px; font-size: 13px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { min-height: 70px; resize: vertical; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.panel { background: var(--panel); border-radius: var(--r); padding: 14px 16px; margin: 12px 0; box-shadow: var(--shadow); }
.panel > h2 { margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--chip);
  font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip.go { background: var(--go-bg); color: var(--go); }
.chip.stop { background: var(--stop-bg); color: var(--stop); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.info { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--go); } .dot.bad { background: var(--stop); } .dot.mid { background: var(--warn); }
.note { border-radius: var(--r-sm); padding: 10px 12px; margin: 8px 0; font-size: 14px; }
.note.stop { background: var(--stop-bg); color: var(--stop); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.info { background: var(--chip); }
ul.plain { margin: 6px 0; padding-left: 18px; }
ul.plain li { margin: 3px 0; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 10px 0 8px; }
.top .title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top .sub { margin-top: 4px; font-size: 13.5px; color: var(--muted); }
.back { padding: 6px 12px; }
.health { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.health .chip { font-weight: 500; }

/* list */
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; cursor: pointer; }
.list-item + .list-item { border-top: 1px solid var(--line); }
.list-item .main { flex: 1; min-width: 0; }
.list-item .levels { font-size: 13px; color: var(--muted); margin-top: 2px; }
.list-item .right { text-align: right; font-size: 13px; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }
@media (max-width: 640px) {
  .list-item { flex-wrap: wrap; align-items: flex-start; gap: 4px 10px; }
  .list-item .main { order: 3; flex-basis: 100%; }
  .list-item .right { flex: 1; }
  .health .chip { white-space: normal; }
}

/* card */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fact { background: var(--chip); border-radius: var(--r-sm); padding: 8px 10px; }
.fact .k { font-size: 12px; color: var(--muted); }
.fact .v { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.fact .v.stop { color: var(--stop); } .fact .v.go { color: var(--go); } .fact .v.entry { color: var(--accent); }
.fact .s { font-size: 12px; color: var(--muted); }
.qa { display: grid; grid-template-columns: 1fr; gap: 0; }
.qa .q { display: grid; grid-template-columns: 190px 1fr; gap: 12px; padding: 9px 0; }
.qa .q + .q { border-top: 1px solid var(--line); }
.qa .q .k { color: var(--muted); font-size: 13.5px; font-weight: 600; }
@media (max-width: 640px) { .qa .q { grid-template-columns: 1fr; gap: 2px; } }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 8px; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
tbody tr + tr td { border-top: 1px solid var(--line); }
.scroll-x { overflow-x: auto; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.tabs button { padding: 6px 12px; font-size: 13px; }
.tabs button.on { background: var(--ink); color: var(--bg); }

/* charts */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .charts { grid-template-columns: 1fr; } }
.chart-box { background: var(--panel); border-radius: var(--r-sm); border: 1px solid var(--line); overflow: hidden; }
.chart-box .head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; font-size: 13px; }
.chart-box .head b { font-weight: 650; }
.chart-box .cv { height: 240px; position: relative; }
.chart-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.chart-legend span::before { content: ""; display: inline-block; width: 14px; height: 0; border-top: 2px solid currentColor;
  margin-right: 5px; vertical-align: middle; }
.chart-legend .aid::before { border-top-style: dotted; }
.chart-legend .dash::before { border-top-style: dashed; }
ul.checks { list-style: none; padding-left: 0; }

/* edit */
.edit-grid { display: grid; grid-template-columns: 140px 1fr 1fr; gap: 8px 10px; align-items: center; }
.edit-grid .k { font-size: 13.5px; font-weight: 600; }
.edit-grid .sys { font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) { .edit-grid { grid-template-columns: 1fr 1fr; } .edit-grid .k { grid-column: 1 / -1; margin-top: 6px; } }
.tp-row { display: grid; grid-template-columns: 50px 1fr 1fr 90px 30px; gap: 8px; align-items: center; margin: 4px 0; }
.tp-row label { font-size: 13px; display: flex; gap: 4px; align-items: center; }
.tp-row input[type=checkbox] { width: auto; }
.changed { outline: 2px solid var(--warn); outline-offset: -1px; }

/* the GO bar */
.gobar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--panel); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.gobar .in { max-width: 1180px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.gobar .why { flex: 1; font-size: 13px; color: var(--muted); min-width: 0; }
.gobar button { padding: 11px 22px; font-size: 15px; }

/* sheet, zoom, toast */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-end;
  justify-content: center; }
.sheet .box { background: var(--panel); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 18px 18px
  calc(18px + env(safe-area-inset-bottom)); max-height: 90vh; overflow-y: auto; }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet .box { border-radius: 18px; } }
.sheet .box h2 { margin-bottom: 8px; }
.sheet .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.zoom { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; }
.zoom .head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; }
.zoom .cv { flex: 1; position: relative; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 70; background: var(--ink); color: var(--bg);
  border-radius: 12px; padding: 10px 16px; max-width: min(92vw, 560px); font-size: 14px; }
details > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.login { max-width: 380px; margin: 80px auto; }
.foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 24px; }
.ev-pairs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 980px) { .ev-pairs { grid-template-columns: 1fr; } }
.ev-pairs .chart-box .cv { height: 180px; }
