:root {
  --bg: #f6f7f6; --card: #fff; --text: #1c1f1d; --muted: #6b726d; --line: #e2e5e2;
  --brand: #166534; --brand-weak: #dcfce7; --warn: #b45309; --warn-weak: #fef3c7; --bad: #b91c1c; --bad-weak: #fee2e2;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111412; --card: #1b1f1c; --text: #e8ece9; --muted: #9aa39d; --line: #2c322e; --brand: #4ade80; --brand-weak: #14361f; --warn: #fbbf24; --warn-weak: #3a2c0b; --bad: #f87171; --bad-weak: #3b1414; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "PingFang SC", "Noto Sans CJK SC", sans-serif; -webkit-text-size-adjust: 100%; }
body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
a { color: var(--brand); }
h3 { margin: 20px 0 8px; font-size: 15px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--card); border-bottom: 1px solid var(--line); }
main { max-width: 640px; margin: 0 auto; padding: 12px 16px; }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin: 12px 16px 0; padding: 10px 12px; border-radius: var(--radius); background: var(--warn-weak); color: var(--warn); }

label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; margin-top: 4px; }
textarea { min-height: 72px; resize: vertical; }
input[type="checkbox"] { width: auto; margin: 0 6px 0 0; }
.row { display: flex; gap: 8px; align-items: flex-end; margin: 8px 0; }
.row > * { margin: 0; }
.grow { flex: 1; min-width: 0; }
.opts { align-items: center; flex-wrap: wrap; gap: 14px; }
.check { display: flex; align-items: center; margin: 0; color: var(--text); font-size: 14px; }
.qty { display: flex; align-items: center; gap: 6px; margin: 0 0 0 auto; color: var(--text); font-size: 14px; }
.qty input { width: 76px; margin: 0; padding: 6px 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 42px; padding: 0 14px; font: inherit; font-size: 15px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #052e16; } }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 14px; }
.btn.wide { display: flex; width: 100%; margin: 12px 0; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; }

.cam { position: relative; overflow: hidden; border-radius: var(--radius); background: #000; aspect-ratio: 4 / 3; margin: 8px 0; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.guide { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.guide span { width: 78%; height: 34%; border: 3px solid rgba(255,255,255,.9); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0,0,0,.28); }
.cam.hit .guide span { border-color: #4ade80; }
.cam-msg { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 12px; color: #fff; font-size: 13px; background: linear-gradient(transparent, rgba(0,0,0,.6)); text-align: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 12px 0; }
.result { display: grid; grid-template-columns: 72px 1fr; gap: 12px; }
.thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: contain; background: var(--bg); border: 1px solid var(--line); }
.thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.name { font-weight: 600; word-break: break-all; }
.jan { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.chip.good { background: var(--brand-weak); color: var(--brand); border-color: transparent; }
.chip.warn { background: var(--warn-weak); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-weak); color: var(--bad); border-color: transparent; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.list li .thumb { width: 52px; height: 52px; }
.list li .meta { min-width: 0; }
.list li .meta .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.list li .side { text-align: right; font-size: 13px; color: var(--muted); }
.list.plain li { grid-template-columns: 1fr auto; cursor: default; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; height: 56px; font: inherit; font-size: 15px; background: none; border: 0; color: var(--muted); }
.tabs button.on { color: var(--brand); font-weight: 700; }

.sheet { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: var(--card); border-bottom: 1px solid var(--line); }
.sheet-head strong { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px calc(24px + env(safe-area-inset-bottom)); max-width: 640px; width: 100%; margin: 0 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.seg button { flex: 1; min-height: 38px; font: inherit; font-size: 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.seg button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photos figure { margin: 0; position: relative; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--card); }
.photos figcaption { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.photos figcaption button { border: 0; background: none; color: var(--bad); font-size: 12px; padding: 2px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.alts { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.alts button { text-align: left; font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px dashed var(--line); background: var(--card); color: var(--text); }
.credit { font-size: 12px; color: var(--muted); margin-top: 24px; }
.toast { position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; max-width: 90vw; padding: 10px 16px; border-radius: 999px; background: rgba(20,20,20,.88); color: #fff; font-size: 14px; }
.toast.bad { background: rgba(185,28,28,.92); }
.banner.login { flex-direction: column; align-items: stretch; }
.banner.login form { display: flex; flex-direction: column; gap: 8px; }
.banner.login input { margin: 0; }
