:root {
  --bg: #0b0d11; --panel: #15181e; --panel2: #1c2028; --line: #2c3038; --ink: #ffffff; --ink2: #c3c2b7; --muted: #898781;
  --accent: #e879f9; --accent-ink: #0b0d11;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --series: #3987e5; --grid: #2c2c2a; --axis: #383835; --chart: #1a1a19;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.brand { display: flex; flex-direction: column; line-height: 1; }
.brand { flex-direction: row; align-items: baseline; gap: 8px; }
.brand .wm { font: 700 13px "Times New Roman", "Liberation Serif", Times, serif; letter-spacing: .18em; color: #9aa3ad; }
.brand .app { font: 700 22px "Times New Roman", "Liberation Serif", Times, serif; color: var(--accent); letter-spacing: .06em; }
.who { font-size: 14px; color: var(--ink2); text-align: right; }
.who button { margin-left: 8px; }
main { max-width: 980px; margin: 0 auto; padding: 12px 16px 40px; }
.pad { padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1 { font-size: 22px; margin: 6px 0 12px; }
h2 { font-size: 18px; margin: 18px 0 8px; }
a { color: #7fb2f0; }
button, .btn { text-decoration: none; text-align: center; display: inline-block; font: inherit; border: 1px solid var(--line); background: var(--panel2); color: var(--ink); border-radius: 10px; padding: 10px 14px; min-height: 44px; cursor: pointer; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
button.big { width: 100%; min-height: 56px; font-size: 18px; }
button.link { background: none; border: none; color: #7fb2f0; padding: 4px; min-height: 0; }
button:disabled { opacity: .5; }
input, select, textarea { font: inherit; width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: #0f1217; color: var(--ink); min-height: 48px; }
textarea { min-height: 90px; }
label { display: block; margin: 12px 0 4px; color: var(--ink2); font-size: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.checks label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); min-height: 52px; }
.checks input { width: 24px; height: 24px; min-height: 0; }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; }
.seg button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.login { max-width: 380px; margin: 40px auto; }
.err { color: #ff8a8a; min-height: 1.4em; margin-top: 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.card h3 { margin: 0; font-size: 22px; display: flex; justify-content: space-between; align-items: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; border: 1px solid var(--line); color: var(--ink); background: var(--panel2); white-space: nowrap; }
.pill .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.s-ok .dot { background: var(--good); } .s-watch .dot { background: var(--warning); } .s-check .dot { background: var(--critical); }
.s-learning .dot, .s-no_data .dot, .s-error .dot, .s-unknown .dot { background: var(--muted); }
.s-due_soon .dot { background: var(--warning); } .s-overdue .dot { background: var(--critical); }
.signal { border-left: 4px solid var(--warning); background: var(--panel2); padding: 8px 10px; border-radius: 8px; margin: 8px 0; font-size: 14px; }
.signal.check { border-left-color: var(--critical); }
.signal b { display: block; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions > * { flex: 1 1 auto; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 8px 0 12px; }
.tabs button { flex: 1 0 auto; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.list li .h { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #000; }
.thumbs a.pdf { display: inline-flex; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.preview { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.chartbox { background: var(--chart); border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px 4px; position: relative; }
.chartbox svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink2); margin: 6px 4px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; background: #0b0b0b; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; color: var(--ink); white-space: nowrap; display: none; z-index: 3; }
.tip .v { font-weight: 700; font-size: 15px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 6px; border-bottom: 1px solid var(--line); }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.ev td { color: #ffb4b4; }
tr.ex td { color: var(--muted); }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--ink2); min-height: 32px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #222; border: 1px solid var(--line); padding: 12px 18px; border-radius: 10px; display: none; z-index: 20; max-width: 90vw; }
.back { margin-bottom: 6px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } h1 { font-size: 20px; } }
.tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 1px 6px; border-radius: 4px; background: #3a2f12; color: var(--warning); vertical-align: 1px; }
.how { display: block; font-size: 12px; color: var(--muted); }
table.pm { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
table.pm td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.pm td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.over { color: #ff8a8a; font-weight: 800; }

/* ---------------- v2 (10/7): live status, tiles, quick log, sunlight mode ---------------- */
:root { --good-ink: #5fe35f; --warn-ink: #ffc94d; --bad-ink: #ff8a8a; --off-ink: #c3c2b7; --tile: #1a1e25; --chipbg: #101318; }
:root[data-theme="light"] {
  --bg: #ffffff; --panel: #f4f4f1; --panel2: #e9e9e4; --line: #8d8d86; --ink: #000000; --ink2: #222220; --muted: #4a4a46;
  --accent: #a21caf; --accent-ink: #ffffff; --chart: #ffffff; --grid: #d6d6d0; --axis: #8d8d86; --series: #1d5fb8;
  --good: #0a7d0a; --warning: #9a6a00; --critical: #b3261e; --good-ink: #075e07; --warn-ink: #7a5300; --bad-ink: #a11d17; --off-ink: #333330;
  --tile: #ffffff; --chipbg: #ffffff; color-scheme: light;
  --ta-bg: #ffffff; --ta-ink: #000; --ta-line: #6b6b66; --ta-field: #f4f4f1; --ta-muted: #444; --ta-accent: #a21caf;
}
:root[data-theme="light"] .brand .wm { color: #333; }
:root[data-theme="light"] a { color: #0b4fa8; }
:root[data-theme="light"] input, :root[data-theme="light"] select, :root[data-theme="light"] textarea { background: #fff; color: #000; }
body.noscroll { overflow: hidden; }
main { padding-bottom: 110px; }
.site { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 4px 0 14px; }
.site-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.site-h h1 { margin: 0; }
.upd { font-size: 14px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.upd.late { color: var(--warn-ink); font-weight: 700; }
.site-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.chip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px; border-radius: 12px; border: 3px solid var(--line); background: var(--chipbg); color: var(--ink); text-decoration: none; min-height: 64px; position: relative; padding-left: 38px; }
.chip b { font-size: 18px; } .chip span:last-child { font-size: 13px; font-weight: 800; letter-spacing: .02em; }
.chip .ico, .link .ico { position: absolute; left: 10px; top: 12px; width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 15px; color: #000; }
.t-good { border-color: var(--good) !important; } .t-good .ico { background: var(--good); color: #fff; }
.t-warn { border-color: var(--warning) !important; } .t-warn .ico { background: var(--warning); }
.t-bad { border-color: var(--critical) !important; } .t-bad .ico { background: var(--critical); color: #fff; }
.t-off { border-color: var(--muted) !important; border-style: dashed !important; } .t-off .ico { background: var(--muted); color: #fff; }
.t-none { border-color: var(--line) !important; border-style: dotted !important; } .t-none .ico { background: var(--panel2); color: var(--ink); }
.chip.t-good span:last-child, .link.t-good b { color: var(--good-ink); }
.chip.t-warn span:last-child, .link.t-warn b { color: var(--warn-ink); }
.chip.t-bad span:last-child, .link.t-bad b { color: var(--bad-ink); }
.site-tot { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.site-tot > div { background: var(--tile); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.tl { display: block; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.big-n { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.asof { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }
.tag.stale { background: transparent; color: var(--bad-ink); border: 1px solid var(--bad-ink); }
.banner { border-radius: 12px; padding: 10px 12px; margin: 8px 0; border: 2px solid var(--line); background: var(--panel); }
.banner.warn { border-color: var(--warning); } .banner.bad { border-color: var(--critical); }
.cards { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; }
.card.skid { padding: 14px; }
.ch { display: flex; justify-content: space-between; align-items: baseline; }
.ch h2 { margin: 0 0 8px; font-size: 26px; } .ch h2 a { color: var(--ink); text-decoration: none; }
.link { position: relative; border: 3px solid var(--line); border-radius: 14px; padding: 12px 12px 12px 42px; background: var(--chipbg); font-size: 16px; line-height: 1.35; }
.link b { font-size: 19px; letter-spacing: .02em; }
.link .ld { font-size: 14px; color: var(--ink2); margin-top: 4px; }
.now { margin: 10px 0 2px; padding: 8px 10px; border-radius: 10px; background: var(--panel2); font-size: 15px; }
.now.on b { color: var(--good-ink); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.tile { background: var(--tile); border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; padding: 9px 10px; min-width: 0; }
.tile.t-good { border-left-color: var(--good) !important; border-color: var(--line) !important; border-left-color: var(--good) !important; }
.tile.t-warn { border-color: var(--line) !important; border-left-color: var(--warning) !important; }
.tile.t-bad { border-color: var(--line) !important; border-left-color: var(--critical) !important; }
.tile.t-off, .tile.t-none { border-color: var(--line) !important; border-style: solid !important; border-left-color: var(--muted) !important; }
.tile .tv { font-size: 18px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.tile .ts { font-size: 13px; color: var(--ink2); margin-top: 2px; overflow-wrap: anywhere; }
.tile .tf { font-size: 13px; color: var(--ink2); margin-top: 4px; }
.trend { margin-top: 12px; background: var(--tile); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.spark { position: relative; margin-top: 4px; }
.spark svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.sp-line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sp-dot { fill: var(--series); stroke: var(--tile); stroke-width: 2; }
.sp-lv { font-size: 12px; font-weight: 700; fill: var(--ink); }
.sp-ref { stroke: var(--axis); stroke-width: 1; } .sp-rl { font-size: 10px; fill: var(--muted); }
.sp-x { stroke: var(--muted); stroke-width: 1; }
.sp-tip { font-size: 12px; color: var(--ink2); min-height: 1.2em; }
.sources { margin-top: 18px; }
.skel .sb { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--panel2), var(--line), var(--panel2)); background-size: 200% 100%; animation: sh 1.4s infinite linear; margin: 8px 0; }
.skel .sb.tall { height: 56px; } .skel .sb.w40 { width: 40%; } .skel .sb.w60 { width: 60%; }
@keyframes sh { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel .sb { animation: none; } }
.fab { position: fixed; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 30; min-height: 60px; padding: 0 22px; border-radius: 999px; font-size: 19px; font-weight: 800; background: var(--accent); color: var(--accent-ink); border: none; box-shadow: 0 3px 14px rgba(0,0,0,.45); }
.obx { display: block; width: calc(100% - 32px); max-width: 948px; margin: 8px auto 0; border: 2px solid var(--warning); background: var(--panel); color: var(--warn-ink); font-weight: 800; }
.obx[hidden] { display: none; }
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { width: 100%; max-width: 600px; max-height: 94vh; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 14px 16px calc(24px + env(safe-area-inset-bottom)); }
.sh-h { display: flex; justify-content: space-between; align-items: center; } .sh-h h2 { margin: 0; font-size: 22px; }
.sheet-card .link { all: unset; color: #7fb2f0; font-size: 17px; padding: 10px 4px; cursor: pointer; }
:root[data-theme="light"] .sheet-card .link { color: #0b4fa8; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.type { min-height: 92px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; text-align: left; border: 2px solid var(--line); border-left-width: 8px; border-radius: 14px; background: var(--panel); padding: 12px; }
.type b { font-size: 19px; } .type span { font-size: 13px; color: var(--ink2); }
.type.t-leak, .type.t-broken { border-left-color: var(--critical); } .type.t-oil, .type.t-filter, .type.t-grease { border-left-color: var(--series); }
.type.t-strainer, .type.t-hours { border-left-color: var(--good); } .type.t-note { border-left-color: var(--muted); }
input.huge { font-size: 28px; text-align: center; letter-spacing: .05em; }
.photo { display: block; margin-top: 14px; padding: 16px; border: 2px dashed var(--line); border-radius: 12px; text-align: center; font-weight: 800; color: var(--ink); }
.photo input { display: none; }
.stamp { font-size: 14px; color: var(--ink2); margin: 12px 0 0; }
.saved { font-size: 22px; font-weight: 800; padding: 16px; border-radius: 14px; margin: 14px 0; border: 3px solid var(--line); }
.saved.ok { border-color: var(--good); color: var(--good-ink); } .saved.wait { border-color: var(--warning); color: var(--warn-ink); }
.seg button { min-height: 52px; font-size: 17px; }
@media (max-width: 520px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .site-tot { grid-template-columns: 1fr; }
  .chip { padding: 8px 6px 8px 32px; } .chip .ico { left: 6px; width: 20px; height: 20px; } .chip b { font-size: 16px; } .chip span:last-child { font-size: 11px; }
  .who { font-size: 13px; }
}
@media (max-width: 360px) { .tiles { grid-template-columns: 1fr; } }
/* phone width: nothing may force horizontal scroll */
html, body { max-width: 100%; overflow-x: hidden; }
.top { flex-wrap: wrap; gap: 6px; }
.who { flex: 1 1 auto; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 8px; }
.who button { margin-left: 0; }
.cards > *, .site-chips > *, .tiles > *, .site-tot > * { min-width: 0; }
.link, .now, .trend { overflow-wrap: anywhere; }
a.chip, .ch h2 a { color: var(--ink) !important; }
