:root {
  --bg: #f3f5f8; --card: #fff; --ink: #1b2430; --muted: #66707d; --line: #dfe3e9;
  --brand: #1f4e79; --brand-ink: #fff; --ok: #1e7b45; --warn: #a85d00; --bad: #b3261e;
  --warn-bg: #fff4e0; --ok-bg: #e5f4ea; --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11151b; --card: #1b2129; --ink: #e8ecf1; --muted: #9aa4b1; --line: #2c343f;
    --brand: #5b9bd5; --brand-ink: #0b1520; --ok: #5cc98a; --warn: #f0b35a; --bad: #ff7a70;
    --warn-bg: #3a2c12; --ok-bg: #16301f; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--brand); color: var(--brand-ink); }
.top h1 { font-size: 18px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { background: none; border: 0; color: inherit; font-size: 30px; line-height: 1; padding: 0 8px 4px; cursor: pointer; }
.net { width: 10px; height: 10px; border-radius: 50%; background: #7ee2a0; }
.net.off { background: #ffb4ab; }
.outbox { background: var(--warn-bg); color: var(--warn); padding: 8px 14px; font-size: 14px; }
main { padding: 12px; max-width: 720px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 16px; margin: 0 0 10px; }
.card h3 { font-size: 15px; margin: 14px 0 8px; color: var(--muted); font-weight: 600; }
.list { list-style: none; margin: 0; padding: 0; }
.list a, .list .row { display: flex; gap: 10px; align-items: center; padding: 12px 14px; color: inherit; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
.list .no { font-weight: 700; font-size: 18px; min-width: 64px; font-variant-numeric: tabular-nums; }
.list .grow { flex: 1; min-width: 0; }
.list .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
label.f { display: block; margin: 0 0 10px; }
label.f span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; font-size: 18px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg); color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
textarea { font-size: 15px; min-height: 140px; }
.unit { position: relative; }
.unit input { padding-right: 56px; }
.unit em { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-style: normal; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 16px; }
.check input { width: 24px; height: 24px; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; border: 0; border-radius: 10px;
  padding: 12px 16px; font: inherit; font-weight: 600; background: var(--brand); color: var(--brand-ink); cursor: pointer; text-decoration: none; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); color: #fff; }
.btn:disabled { opacity: .5; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.res { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.kv b { font-variant-numeric: tabular-nums; text-align: right; }
.big { font-size: 22px; }
.warnbox { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 8px 12px; font-size: 14px; margin: 8px 0; }
.okbox { background: var(--ok-bg); color: var(--ok); border-radius: 10px; padding: 8px 12px; font-size: 14px; margin: 8px 0; }
.muted { color: var(--muted); font-size: 14px; }
.sticky-save { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); padding: 8px 0; background: linear-gradient(transparent, var(--bg) 30%); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; }
table.t td.n { text-align: right; white-space: nowrap; }
.scroll { overflow-x: auto; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs a { flex: 1; text-align: center; padding: 14px 0; color: var(--muted); text-decoration: none; font-weight: 600; }
.tabs a.on { color: var(--brand); }
.toast { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg);
  padding: 12px 14px; border-radius: 10px; z-index: 10; text-align: center; }
.fab { position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); border-radius: 99px; padding: 14px 20px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 4; }
.seg { display: flex; gap: 6px; margin-bottom: 12px; }
.seg a { flex: 1; text-align: center; padding: 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.seg a.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.grid2 > b { font-size: 13px; margin: 4px 0 6px; }
.grid2 input { font-size: 17px; padding: 10px 8px; }
.grid2 .unit input { padding-right: 30px; }
.grid2 .unit em { right: 8px; }
