:root {
  --bg: #f6f7f9; --card: #ffffff; --ink: #14181f; --muted: #5b6472; --line: #e1e5ea;
  --brand: #0f766e; --brand-ink: #ffffff; --warn: #b45309; --warn-bg: #fef3c7; --bad: #b91c1c; --ok: #15803d;
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1216; --card: #181c22; --ink: #eef1f5; --muted: #9aa4b2; --line: #2a303a; --brand: #2dd4bf; --brand-ink: #06231f; --warn: #fbbf24; --warn-bg: #3a2c08; --bad: #f87171; --ok: #4ade80; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; min-width: 0; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand img { border-radius: 7px; flex: none; }
.net { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; flex: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.dot.off { background: var(--warn); }
main { flex: 1; overflow: auto; padding: 16px; width: 100%; max-width: 760px; margin: 0 auto; }
nav { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav button { background: none; border: 0; padding: 14px 4px; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
nav button.on { color: var(--brand); font-weight: 650; box-shadow: inset 0 2px 0 var(--brand); }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 0 0 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.center { max-width: 420px; margin: 8vh auto 0; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input, textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; margin-bottom: 12px; }
textarea { min-height: 96px; resize: vertical; word-break: break-all; font-size: 13px; }
input:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pin { letter-spacing: 0.4em; font-size: 22px; text-align: center; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; width: 100%; padding: 13px 16px; border-radius: 10px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 650; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.danger { border-color: var(--bad); background: transparent; color: var(--bad); }
.btn:disabled { opacity: 0.55; cursor: default; }
.err { color: var(--bad); margin: 0 0 12px; min-height: 1.4em; }
.note { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--bg); border-radius: 10px; padding: 12px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { border: 1px dashed var(--line); border-radius: 10px; padding: 14px; color: var(--muted); }
.tile b { display: block; color: var(--ink); }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .t { min-width: 0; }
.row .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.row .r { text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; }
.kv span:first-child { color: var(--muted); }
.stack > * + * { margin-top: 10px; }
button.tile { text-align: left; font: inherit; background: var(--card); border: 1px solid var(--brand); color: var(--muted); cursor: pointer; }
.pickrow { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 11px 4px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); font: inherit; cursor: pointer; }
.pickrow:last-child { border-bottom: 0; }
.line { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.line .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.line .top b { min-width: 0; overflow-wrap: anywhere; }
.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 560px) { .fields { grid-template-columns: repeat(5, 1fr); } }
.fields label { margin: 0; font-size: 12px; }
.fields input { margin: 4px 0 0; padding: 9px; text-align: right; font-variant-numeric: tabular-nums; }
.link { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 4px; }
.link.bad { color: var(--bad); }
.total { display: flex; justify-content: space-between; font-size: 20px; font-weight: 700; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 6px; font-variant-numeric: tabular-nums; }
select { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; margin-bottom: 12px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: transparent; color: var(--ok); border: 1px solid var(--ok); }
.pill.bad { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
.acts { display: flex; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.fields.two { grid-template-columns: repeat(2, 1fr); margin-bottom: 12px; }
.fields.two input { text-align: left; }
.seg { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 90px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.seg button.on { border-color: var(--brand); color: var(--brand); font-weight: 650; }
label.tick { display: flex; align-items: center; gap: 8px; color: var(--ink); margin-bottom: 12px; }
input[type="checkbox"] { width: 20px; height: 20px; margin: 0; flex: none; }
