:root {
  --bg: #f6f5f2; --card: #ffffff; --fg: #1d1c1a; --muted: #6b6862; --line: #e4e1da; --accent: #0f766e; --accent-fg: #ffffff;
  --accent-soft: #d9f0ec; --warn: #b45309; --warn-soft: #fdf1df; --bad: #b91c1c; --bad-soft: #fde7e7; --ok: #15803d; --ok-soft: #e3f4e8;
  --chip: #efece6; --nav-h: 64px; --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211; --card: #1c1c1a; --fg: #f1efea; --muted: #a29f98; --line: #2e2d2a; --accent: #2dd4bf; --accent-fg: #062b27;
    --accent-soft: #10302c; --warn: #f59e0b; --warn-soft: #33270f; --bad: #f87171; --bad-soft: #3a1717; --ok: #4ade80; --ok-soft: #12301c;
    --chip: #2a2926; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121211; --card: #1c1c1a; --fg: #f1efea; --muted: #a29f98; --line: #2e2d2a; --accent: #2dd4bf; --accent-fg: #062b27;
  --accent-soft: #10302c; --warn: #f59e0b; --warn-soft: #33270f; --bad: #f87171; --bad-soft: #3a1717; --ok: #4ade80; --ok-soft: #12301c;
  --chip: #2a2926; color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); overflow-x: hidden; }
body { font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
#root { min-height: 100vh; min-height: 100dvh; }
.page { padding: calc(env(safe-area-inset-top) + 8px) 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); max-width: 720px; margin: 0 auto; }
.top { display: flex; align-items: center; gap: 8px; min-height: 48px; margin-bottom: 8px; }
.top h1 { font-size: 22px; margin: 0; flex: 1; line-height: 1.25; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.back { min-width: 44px; height: 44px; border: 0; background: var(--chip); color: var(--fg); border-radius: 22px; font-size: 20px; }
h2 { font-size: 17px; margin: 20px 0 8px; }
h3 { font-size: 15px; margin: 14px 0 6px; color: var(--muted); font-weight: 600; }
p { margin: 6px 0; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; overflow-wrap: anywhere; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 8px; }
button, .btn { font: inherit; border: 0; border-radius: 12px; min-height: 48px; padding: 10px 16px; background: var(--chip); color: var(--fg);
  font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button:disabled { opacity: .45; }
.primary { background: var(--accent); color: var(--accent-fg); }
.danger { background: var(--bad-soft); color: var(--bad); }
.block { width: 100%; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.btns.one { grid-template-columns: 1fr; }
input, textarea, select { font: inherit; font-size: 16px; width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); min-height: 48px; }
textarea { min-height: 160px; line-height: 1.5; resize: vertical; }
label.f { display: block; margin: 10px 0; }
label.f > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border-radius: 999px; min-height: 38px; padding: 6px 14px; background: var(--chip); font-weight: 500; font-size: 15px; }
.chip.on { background: var(--accent); color: var(--accent-fg); }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.acc { background: var(--accent-soft); color: var(--accent); }
.note { border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: 15px; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.info { background: var(--accent-soft); color: var(--accent); }
.list-item { display: flex; gap: 12px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  margin: 8px 0; color: inherit; text-decoration: none; align-items: center; min-height: 84px; }
.thumb { width: 72px; height: 72px; flex: none; border-radius: 10px; background: var(--chip); object-fit: cover; display: block; }
.li-title { font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.li-sub { color: var(--muted); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.price { font-weight: 700; color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.cell { position: relative; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; background: var(--chip); border: 0; padding: 0; min-height: 0; }
.cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cell .sel { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 14px; background: rgba(0,0,0,.35);
  color: #fff; border: 2px solid #fff; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.cell.on { outline: 3px solid var(--accent); outline-offset: -3px; }
.cell.on .sel { background: var(--accent); color: var(--accent-fg); }
.hero { width: 100%; max-height: 62vh; object-fit: contain; background: var(--chip); border-radius: var(--radius); display: block; }
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0; }
.strip img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; flex: none; }
.kv { display: grid; grid-template-columns: minmax(96px, 34%) 1fr; gap: 6px 10px; font-size: 15px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.src { white-space: pre-wrap; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.progress { height: 12px; background: var(--chip); border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width .2s; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; color: inherit; text-decoration: none; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 13px; color: var(--muted); }
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); z-index: 10; }
nav.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; min-height: 48px; }
nav.tabs a.on { color: var(--accent); }
nav.tabs svg { width: 24px; height: 24px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.check input { width: 24px; height: 24px; min-height: 24px; flex: none; margin-top: 2px; accent-color: var(--accent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { min-height: 44px; }
.seg button.on { background: var(--accent); color: var(--accent-fg); }
.empty { text-align: center; padding: 32px 12px; color: var(--muted); }
.order { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.order img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.order button { min-height: 40px; min-width: 44px; padding: 6px 10px; }
.sticky-actions { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); z-index: 5; }
a.chip { text-decoration: none; color: var(--fg); display: inline-flex; align-items: center; }
