:root {
  color-scheme: light;
  --bg: #f6f4f1; --card: #ffffff; --ink: #0b0b0b; --ink2: #52514e; --muted: #8b8a85;
  --line: #e7e4df; --accent: #2a78d6; --accent-ink: #fff; --good: #1a7f4b; --warn: #b26b00; --bad: #c03636;
  --chip: #f0eee9; --series-1: #2a78d6; --grid: #ebe8e3;
  --r: 18px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #151514; --card: #1f1f1d; --ink: #f0efec; --ink2: #c3c2b7; --muted: #8d8c85;
    --line: #2e2e2b; --accent: #3987e5; --chip: #2a2a27; --series-1: #3987e5; --grid: #2e2e2b;
    --good: #4cc38a; --warn: #e0a030; --bad: #ef6b6b; --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.top { padding: calc(14px + env(safe-area-inset-top)) 20px 6px; display: flex; align-items: baseline; gap: 10px; }
.top h1 { font-size: 28px; margin: 0; letter-spacing: -.02em; }
#sub { color: var(--muted); font-size: 14px; }
main { padding: 6px 16px 20px; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs a { flex: 1; max-width: 112px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; color: var(--muted); text-decoration: none; font-size: 11px; }
.tabs a.on { color: var(--accent); }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin: 0 0 14px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card h2 { font-size: 17px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.card h2 .right { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); } .small { font-size: 13px; } .ink2 { color: var(--ink2); }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.btn { appearance: none; border: 0; border-radius: 14px; padding: 13px 18px; font: inherit; font-weight: 600;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; width: 100%; display: block; text-align: center; text-decoration: none; }
.btn.secondary { background: var(--chip); color: var(--ink); }
.btn.small { width: auto; padding: 8px 14px; font-size: 14px; border-radius: 11px; display: inline-block; }
.btn.danger { background: transparent; color: var(--bad); }
.btn:disabled { opacity: .5; }
.btns { display: flex; gap: 10px; margin-top: 12px; } .btns .btn { flex: 1; }
.step { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.step:first-of-type { border-top: 0; }
.thumb { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; background: #fff; flex: none; border: 1px solid var(--line); }
.pname { font-weight: 600; font-size: 15px; line-height: 1.25; }
.how { font-size: 13.5px; color: var(--ink2); margin-top: 3px; }
.check { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center;
  background: transparent; cursor: pointer; margin-top: 8px; }
.check svg { width: 18px; height: 18px; stroke: transparent; stroke-width: 3; fill: none; }
.check.on { background: var(--good); border-color: var(--good); }
.check.on svg { stroke: #fff; }
.step.done .pname { text-decoration: line-through; color: var(--muted); }
.chip { display: inline-block; padding: 2px 9px; border-radius: 99px; background: var(--chip); font-size: 12px; color: var(--ink2); margin: 4px 4px 0 0; }
.chip.warn { color: var(--warn); } .chip.bad { color: var(--bad); } .chip.good { color: var(--good); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 26px; letter-spacing: -.02em; }
.stat span { font-size: 12px; color: var(--muted); }
.hero { font-size: 56px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.bar { height: 8px; background: var(--chip); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--series-1); }
.metric { display: grid; grid-template-columns: 110px 1fr 34px; gap: 10px; align-items: center; font-size: 14px; padding: 4px 0; }
ul.clean { margin: 6px 0 0; padding-left: 18px; } ul.clean li { margin: 4px 0; }
label.f { display: block; font-size: 13px; color: var(--ink2); margin: 12px 0 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
textarea { min-height: 80px; resize: vertical; }
.switch { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.switch input { width: 50px; height: 30px; appearance: none; background: var(--line); border-radius: 99px; position: relative; padding: 0; border: 0; transition: .2s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked { background: var(--good); } .switch input:checked::after { left: 23px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photos img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; border: 2px solid transparent; }
.photos img.sel { border-color: var(--accent); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.compare img { width: 100%; border-radius: 12px; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; transition: .25s; pointer-events: none; z-index: 30; max-width: 90vw; }
#toast.show { opacity: 1; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet.hidden { display: none; }
.sheet-body { background: var(--bg); width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); }
.sheet-body img.big { width: 100%; max-height: 300px; object-fit: contain; background: #fff; border-radius: 14px; }
.details { white-space: pre-wrap; font-size: 13.5px; color: var(--ink2); max-height: 260px; overflow: auto; }
.chart { position: relative; }
.chart svg { width: 100%; height: 180px; display: block; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; padding: 5px 8px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -120%); display: none; }
.price { font-weight: 600; } .old { text-decoration: line-through; color: var(--muted); font-size: 13px; margin-left: 4px; }
.seg { display: flex; background: var(--chip); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 9px; font: inherit; font-size: 14px; color: var(--ink2); }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.notice { background: color-mix(in srgb, var(--warn) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line)); }
.answer { white-space: pre-wrap; font-size: 14.5px; margin-top: 10px; }
.days { display: flex; gap: 3px; align-items: flex-end; height: 34px; margin-top: 8px; }
.days i { flex: 1; background: var(--chip); border-radius: 3px; min-height: 4px; }
.days i.full { background: var(--good); } .days i.part { background: color-mix(in srgb, var(--good) 45%, var(--chip)); }
