/* IAlreadyBoughtThis
   Layout: the page is one question. A giant "Did I already buy ___?" line you type into,
   a full-bleed verdict block that stamps the answer, then your stuff grouped by the place it lives. */
:root {
  --paper: #ecede6;          /* supermarket shelf-edge paper */
  --paper-2: #e2e4da;
  --card: #f7f7f2;
  --ink: #121310;
  --muted: #62655c;
  --line: #c9cbc0;
  --sticker: #ff5b1f;        /* price-sticker orange: "you have it" */
  --go: #27d17a;             /* go ahead */
  --mark: #e9ff4f;           /* highlighter */
  --on-block: #121310;       /* text on sticker / go / highlighter, both themes */
  --display: "Archivo", "IBM Plex Sans Thai", "Arial Narrow", system-ui, sans-serif;
  --body: "Archivo", "IBM Plex Sans Thai", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(.2, .9, .2, 1);
  color-scheme: light;
}
/* Dark: follows the device unless the person picked light or dark (data-theme on <html>, set by theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f100e; --paper-2: #171815; --card: #1c1d1a; --ink: #f0f1ea; --muted: #9c9f94; --line: #2e302a;
    --mark: #d8f03a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f100e; --paper-2: #171815; --card: #1c1d1a; --ink: #f0f1ea; --muted: #9c9f94; --line: #2e302a;
  --mark: #d8f03a; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 15px; line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.wrap { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
a { color: inherit; }

/* ---------- top bar ---------- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1.5px solid var(--ink); padding-bottom: 10px; }
.logo { font-family: var(--display); font-weight: 800; font-stretch: 75%; font-size: 18px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo i { width: 12px; height: 12px; border-radius: 50%; background: var(--sticker); display: inline-block; }
.top-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tally { display: flex; gap: 14px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.tally b { color: var(--ink); font-weight: 500; }
@media (max-width: 640px) { .tally { display: none; } }
.acct { border: 1.5px solid var(--ink); background: transparent; border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct.ink { background: var(--ink); color: var(--paper); }
.tool { flex: none; height: 32px; min-width: 32px; border: 1.5px solid var(--line); background: transparent; border-radius: 999px; display: inline-grid; place-items: center; padding: 0 8px; font-size: 12px; font-weight: 600; color: var(--ink); }
.tool:hover { border-color: var(--ink); }
.tool svg { display: none; }
.tool[data-mode="auto"] .i-auto, .tool[data-mode="light"] .i-light, .tool[data-mode="dark"] .i-dark { display: block; }
.tool.lang { font-family: var(--body); }
@media (max-width: 480px) {
  .top { gap: 8px; }
  .top-right { gap: 6px; }
  .logo { font-size: 15px; gap: 6px; min-width: 0; }
  .acct { max-width: 120px; padding: 6px 10px; }
}

/* ---------- the question ---------- */
.ask { display: grid; gap: 6px; padding-top: clamp(8px, 4vw, 40px); }
.ask-line {
  font-family: var(--display); font-weight: 800; font-stretch: 70%;
  font-size: clamp(40px, 10.5vw, 128px); line-height: .88; letter-spacing: -.035em; text-transform: uppercase; margin: 0;
}
.ask-line .hl { background: var(--mark); color: var(--on-block); padding: 0 .08em; border-radius: .06em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.ask-field {
  position: relative; display: flex; align-items: center; gap: clamp(10px, 2vw, 20px); margin-top: 10px;
  background: var(--card); border: 2.5px solid var(--ink); border-radius: clamp(16px, 3vw, 28px);
  padding: clamp(8px, 1.6vw, 16px) clamp(12px, 2.4vw, 24px); cursor: text;
  box-shadow: 0 8px 0 -2px var(--ink); transition: box-shadow .2s var(--ease);
}
.ask-field:focus-within { box-shadow: 0 8px 0 -2px var(--sticker); border-color: var(--sticker); }
.ask-field .lens { flex: none; width: clamp(34px, 7vw, 76px); height: auto; color: var(--sticker); }
.ask-field input {
  flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; padding: 2px 0;
  font-family: var(--display); font-weight: 800; font-stretch: 70%; text-transform: uppercase;
  font-size: clamp(32px, 8vw, 96px); line-height: 1; letter-spacing: -.03em; color: var(--ink);
}
.ask-field input::placeholder { color: var(--muted); opacity: .55; }
.ask-field input:focus { outline: none; }
.ask-field input::-webkit-search-cancel-button { display: none; }
.ask-field .clear { flex: none; border: 1.5px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 12px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ask-field .clear:hover { border-color: var(--ink); color: var(--ink); }
.ask-help { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.tries { display: flex; gap: 6px; flex-wrap: wrap; }
.try { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 3px 10px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.try:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- verdict ---------- */
.verdict { border-radius: 22px; padding: clamp(18px, 3.5vw, 34px); display: grid; gap: 22px; color: var(--on-block); position: relative; overflow: hidden; }
.verdict.have { background: var(--sticker); }
.verdict.go { background: var(--go); }
.verdict.idle { background: var(--paper-2); color: var(--ink); border: 1.5px dashed var(--line); }
.v-grid { display: grid; grid-template-columns: auto 1fr; gap: clamp(16px, 4vw, 44px); align-items: end; }
@media (max-width: 640px) { .v-grid { grid-template-columns: 1fr; } }
.big-num {
  font-family: var(--display); font-weight: 900; font-stretch: 62%;
  font-size: clamp(120px, 26vw, 260px); line-height: .78; letter-spacing: -.05em; font-variant-numeric: tabular-nums;
}
.big-num small { font-size: .38em; letter-spacing: 0; vertical-align: top; margin-right: 4px; }
.big-num small.u { vertical-align: baseline; margin: 0 0 0 6px; font-size: .3em; font-stretch: 75%; }
.big-num.amt { font-size: clamp(96px, 20vw, 220px); }
.amt-panel { display: grid; gap: 8px; border-top: 1.5px solid currentColor; padding-top: 14px; }
.amt-panel label { font-weight: 700; font-size: 15px; }
.amt-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.amt-panel .amt-input { background: var(--card); color: var(--ink); border-color: var(--on-block); }
.v-head { font-family: var(--display); font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: clamp(26px, 4.6vw, 52px); line-height: .95; letter-spacing: -.02em; margin: 0; text-wrap: balance; }
.v-name { font-size: 17px; font-weight: 600; margin: 10px 0 0; }
.receipt { font-family: var(--mono); font-size: 13px; display: grid; gap: 4px; margin-top: 14px; max-width: 460px; }
.receipt div { display: flex; gap: 8px; align-items: baseline; }
.receipt div::after { content: ""; order: 1; flex: 1; border-bottom: 1.5px dotted currentColor; opacity: .45; transform: translateY(-3px); }
.receipt span:last-child { order: 2; text-align: right; overflow-wrap: anywhere; }
.v-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { border: 1.5px solid currentColor; background: transparent; border-radius: 999px; padding: 9px 16px; font-weight: 600; font-size: 14px; transition: transform .2s var(--ease); }
.pill:hover { transform: translateY(-2px); }
.pill.solid { background: var(--on-block); color: var(--sticker); border-color: var(--on-block); }
.go .pill.solid { color: var(--go); }
.pill:disabled { opacity: .4; transform: none; cursor: default; }
.stamp {
  display: inline-block; margin-bottom: 12px;
  font-family: var(--mono); font-weight: 500; font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  background: var(--on-block); color: var(--card); border-radius: 8px; padding: 6px 12px; transform: rotate(-3deg);
}
.have .stamp { color: var(--sticker); }
.go .stamp { color: var(--go); }
.others { border-top: 1.5px solid currentColor; padding-top: 12px; display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 14px; align-items: baseline; }
.others button { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.idle-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.idle h3 { font-family: var(--display); font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: 20px; margin: 4px 0 8px; letter-spacing: -.01em; }
.idle ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 14px; }
.idle li { display: flex; justify-content: space-between; gap: 10px; }
.idle li .mono { color: var(--muted); font-size: 12px; white-space: nowrap; }
.miss { color: var(--sticker); }

@media (prefers-reduced-motion: no-preference) {
  .verdict.enter { animation: rise .45s var(--ease); }
  .verdict.enter .big-num { animation: thunk .5s var(--ease); }
  .verdict.enter .stamp { animation: stamp .55s var(--ease) .12s both; }
  @keyframes rise { from { transform: translateY(14px); opacity: .4; } }
  @keyframes thunk { from { transform: translateY(30%) scaleY(.6); opacity: 0; } }
  @keyframes stamp { 0% { transform: rotate(-3deg) scale(2.2); opacity: 0; } 60% { transform: rotate(-3deg) scale(.94); opacity: 1; } 100% { transform: rotate(-3deg) scale(1); } }
}

/* ---------- shelf ---------- */
.shelf { display: grid; gap: 22px; }
.shelf-head { display: flex; justify-content: space-between; align-items: end; gap: 14px; flex-wrap: wrap; border-top: 1.5px solid var(--ink); padding-top: 14px; }
.shelf-head h2 { font-family: var(--display); font-weight: 800; font-stretch: 70%; text-transform: uppercase; font-size: clamp(34px, 6vw, 64px); line-height: .9; letter-spacing: -.03em; margin: 0; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.groups { display: grid; gap: 30px; }
.group-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.group-h h3 { font-family: var(--display); font-weight: 800; font-stretch: 85%; font-size: 22px; letter-spacing: -.01em; margin: 0; }
.group-h .count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.tags { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tag {
  position: relative; text-align: left; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 14px 14px 12px 34px; display: grid; gap: 8px; min-width: 0;
  transition: transform .25s var(--ease), border-color .2s, box-shadow .25s var(--ease);
}
.tag::before { content: ""; position: absolute; left: 12px; top: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--line); }
.tag:hover { transform: translateY(-3px) rotate(-.4deg); border-color: var(--ink); box-shadow: 0 10px 0 -4px var(--line); }
.tag .t-name { font-weight: 600; font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.tag .t-row { display: flex; justify-content: space-between; align-items: end; gap: 8px; }
.tag .t-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); display: grid; gap: 1px; min-width: 0; }
.tag .t-qty { font-family: var(--display); font-weight: 900; font-stretch: 62%; font-size: 38px; line-height: .8; letter-spacing: -.03em; white-space: nowrap; }
.tag .t-qty small { font-size: .42em; margin-left: 2px; letter-spacing: 0; }
.tag.out { opacity: .62; }
.tag.out .t-qty { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 3px; }
.tag .badge { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; background: var(--mark); color: var(--on-block); border-radius: 4px; padding: 1px 5px; justify-self: start; }
.empty { border: 1.5px dashed var(--line); border-radius: 22px; padding: 40px 20px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.empty strong { font-family: var(--display); font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: 26px; }
.empty p { margin: 0; color: var(--muted); max-width: 42ch; }
.btn { border: 1.5px solid var(--ink); background: transparent; border-radius: 999px; padding: 9px 16px; font-weight: 600; font-size: 14px; transition: transform .2s var(--ease); }
.btn:hover { transform: translateY(-2px); }
.btn:disabled { opacity: .5; transform: none; cursor: default; }
.btn.ink { background: var(--ink); color: var(--paper); }
.btn.danger { border-color: var(--sticker); color: var(--sticker); }

footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
footer select { border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 2px 6px; font-family: var(--mono); }
footer nav { display: flex; gap: 14px; }
.notice { font-family: var(--mono); font-size: 12px; border: 1.5px solid var(--ink); border-radius: 10px; padding: 8px 12px; background: var(--mark); color: var(--on-block); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.notice button { border: 1.5px solid var(--on-block); background: var(--on-block); color: var(--mark); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-family: var(--body); font-size: 13px; }

/* ---------- dock ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; justify-content: center; pointer-events: none;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.dock button {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 999px;
  background: var(--ink); color: var(--paper); padding: 14px 22px 14px 16px; font-weight: 700; font-size: 15px;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.45); transition: transform .25s var(--ease);
}
.dock button:hover { transform: translateY(-3px); }
.dock .plus { width: 26px; height: 26px; border-radius: 50%; background: var(--sticker); color: var(--on-block); display: grid; place-items: center; font-size: 20px; line-height: 1; }

/* ---------- sheets ---------- */
dialog { border: 0; padding: 0; background: var(--card); color: var(--ink); width: min(560px, 100vw); max-width: 100vw; max-height: calc(100dvh - 20px); border-radius: 24px; }
dialog::backdrop { background: rgba(10, 11, 9, .55); backdrop-filter: blur(3px); }
@media (max-width: 600px) {
  dialog { margin: auto 0 0; width: 100vw; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
}
@media (prefers-reduced-motion: no-preference) { dialog[open] { animation: sheet .35s var(--ease); } @keyframes sheet { from { transform: translateY(40px); opacity: 0; } } }
.form { display: grid; gap: 14px; padding: 22px max(20px, env(safe-area-inset-left, 0px)) 22px; }
.form-h { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.form-h h3 { font-family: var(--display); font-weight: 800; font-stretch: 70%; text-transform: uppercase; font-size: 34px; line-height: .9; letter-spacing: -.02em; margin: 0; }
.form p { margin: 0; color: var(--muted); }
.x { border: 1.5px solid var(--line); background: transparent; width: 36px; height: 36px; border-radius: 50%; font-size: 18px; line-height: 1; flex: none; }
.big-input { border: 0; border-bottom: 3px solid var(--ink); background: transparent; font-family: var(--display); font-weight: 700; font-stretch: 80%; font-size: 26px; padding: 4px 0 6px; width: 100%; border-radius: 0; }
.big-input:focus { outline: none; border-color: var(--sticker); }
.code-input { letter-spacing: .4em; font-family: var(--mono); font-size: 28px; text-align: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field input, .field select { padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); width: 100%; }
.field input:focus, .field select:focus { outline: none; border-color: var(--ink); }
.stepper { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); overflow: hidden; }
.stepper button { border: 0; background: transparent; width: 42px; height: 42px; font-size: 20px; }
.stepper input { border: 0; background: transparent; text-align: center; font-family: var(--mono); padding: 0; min-width: 0; flex: 1; }
.cats { display: flex; gap: 6px; flex-wrap: wrap; }
.cats button { border: 1.5px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 11px; font-size: 13px; }
.cats button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.track { display: flex; gap: 10px; align-items: start; border: 1.5px dashed var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.track input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--sticker); flex: none; }
.track span { display: grid; gap: 2px; }
.track b { font-weight: 600; font-size: 14px; }
.track small { color: var(--muted); font-size: 12px; }
.amt-input { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); overflow: hidden; min-width: 0; }
.amt-input input, .field .amt-input input { border: 0; border-radius: 0; background: transparent; min-width: 0; width: 100%; flex: 1; font-family: var(--mono); padding: 10px 12px; }
.amt-input select, .field .amt-input select { border: 0; border-left: 1.5px solid var(--line); border-radius: 0; background: transparent; width: auto; padding: 0 8px; flex: none; }
.amt-input input:focus, .amt-input select:focus { outline: none; }
.amt-input:focus-within { border-color: var(--ink); }
.amt-input.sm { border-radius: 8px; background: var(--card); }
.amt-input.sm input { width: 70px; flex: none; padding: 5px 8px; font-size: 13px; }
.amt-input.sm select { padding: 0 6px; font-size: 13px; }
.history { font-family: var(--mono); font-size: 12px; border-top: 1.5px dotted var(--line); padding-top: 10px; display: grid; gap: 4px; color: var(--muted); }
.history div { display: flex; justify-content: space-between; gap: 8px; }
.aliases { border-top: 1.5px dotted var(--line); padding-top: 10px; display: grid; gap: 6px; }
.aliases .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.aliases .chip { font-family: var(--mono); font-size: 12px; display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; overflow-wrap: anywhere; }
.aliases .chip button { border: 0; background: none; font: inherit; font-size: 15px; line-height: 1; min-width: 28px; min-height: 28px; cursor: pointer; color: var(--muted); border-radius: 999px; }
.aliases .chip button:hover { color: var(--ink, inherit); background: var(--line); }
.aliases .hint { margin: 0; font-size: 12px; color: var(--muted); }
.form-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-foot .right { display: flex; gap: 8px; margin-left: auto; }
.confirm { background: var(--sticker); color: var(--on-block); border-radius: 14px; padding: 12px; font-size: 14px; display: grid; gap: 10px; font-weight: 600; }
.confirm .btn { border-color: var(--on-block); }
.confirm .btn.ink { background: var(--on-block); color: var(--sticker); }
.err { color: var(--sticker); font-size: 14px; font-weight: 600; }
.menu { display: grid; gap: 8px; }
.menu .btn { text-align: left; border-radius: 14px; padding: 12px 16px; }
.small { font-size: 13px; color: var(--muted); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); background: var(--mark); color: var(--on-block); border: 1.5px solid var(--on-block); padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 30; max-width: calc(100vw - 32px); text-align: center; }

/* ---------- plain pages (privacy) ---------- */
.doc { max-width: 680px; margin: 0 auto; display: grid; gap: 14px; }
.doc h1 { font-family: var(--display); font-weight: 800; font-stretch: 70%; text-transform: uppercase; font-size: clamp(36px, 8vw, 64px); line-height: .9; margin: 24px 0 8px; }
.doc h2 { font-family: var(--display); font-weight: 800; font-stretch: 85%; font-size: 20px; margin: 16px 0 0; }
.doc p, .doc li { line-height: 1.6; }

/* ---------- dock: two actions ---------- */
.dock { gap: 8px; }
.dock .type { background: var(--card); color: var(--ink); border: 1.5px solid var(--ink); padding: 12px 18px 12px 12px; }
.dock .type .plus { background: var(--paper-2); color: var(--ink); }
.dock .plus svg { display: block; }

/* ---------- why section ---------- */
.why { display: grid; gap: 18px; border-top: 1.5px solid var(--ink); padding-top: 16px; }
.why-head h2 { font-family: var(--display); font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: clamp(26px, 4.4vw, 48px); line-height: .95; letter-spacing: -.02em; margin: 6px 0 0; text-wrap: balance; max-width: 22ch; }
.why-table { display: grid; border: 1.5px solid var(--ink); border-radius: 18px; overflow: hidden; background: var(--card); }
.why-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1.3fr; border-top: 1px dashed var(--line); }
.why-row:first-child { border-top: 0; }
.why-row > span { padding: 12px 14px; font-size: 14px; min-width: 0; }
.why-row [role="rowheader"] { font-weight: 700; }
.why-row [role="cell"] { color: var(--muted); }
.why-row .us { background: var(--mark); color: var(--on-block); font-weight: 600; }
.why-cols > span { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-block: 10px; }
.why-cols .us { color: var(--on-block); }
@media (max-width: 640px) {
  .why-cols { display: none; }
  .why-row { grid-template-columns: 1fr; padding: 10px 0; }
  .why-row > span { padding: 3px 14px; }
  .why-row [role="cell"]:nth-child(2)::before { content: "Notes: "; font-weight: 600; }
  .why-row [role="cell"]:nth-child(3)::before { content: "Photos: "; font-weight: 600; }
  html[lang="th"] .why-row [role="cell"]:nth-child(2)::before { content: "โน้ต: "; }
  html[lang="th"] .why-row [role="cell"]:nth-child(3)::before { content: "รูป: "; }
  .why-row .us { margin: 6px 10px 0; border-radius: 10px; padding: 8px 12px; }
}

/* ---------- scan sheet ---------- */
.scan-reading { position: relative; display: grid; gap: 12px; justify-items: center; text-align: center; }
.scan-reading img { max-height: 260px; max-width: 100%; border-radius: 14px; border: 1.5px solid var(--line); object-fit: contain; background: var(--paper); }
.scan-reading p { max-width: 36ch; }
.scan-line { position: absolute; left: 10%; right: 10%; top: 0; height: 4px; border-radius: 4px; background: var(--sticker); box-shadow: 0 0 18px var(--sticker); }
@media (prefers-reduced-motion: no-preference) {
  .scan-line { animation: sweep 1.6s ease-in-out infinite alternate; }
  @keyframes sweep { from { top: 4px; } to { top: 240px; } }
}
#scanReview { display: grid; gap: 14px; }
#scanReview[hidden] { display: none !important; }
.scan-list { display: grid; gap: 8px; }
.s-row { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: start; border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--paper); }
.s-row.off { opacity: .45; }
.s-row input[type="checkbox"] { width: 20px; height: 20px; margin-top: 8px; accent-color: var(--sticker); }
.s-main { display: grid; gap: 6px; min-width: 0; }
.s-main .s-name { font-weight: 600; border: 0; border-bottom: 1.5px solid var(--line); background: transparent; padding: 4px 0; width: 100%; }
.s-main .s-name:focus { outline: none; border-color: var(--ink); }
.s-from { font-size: 12px; color: var(--muted, #6b6d64); line-height: 1.35; overflow-wrap: anywhere; }
.s-from span { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.s-fields { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.s-fields input, .s-fields select { border: 1.5px solid var(--line); background: var(--card); border-radius: 8px; padding: 5px 8px; font-size: 13px; }
.s-fields .s-qty { width: 64px; }
.s-fields .s-price { width: 90px; }
.s-match { font-size: 12px; font-weight: 600; border-radius: 8px; padding: 6px 8px; background: var(--sticker); color: var(--on-block); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.s-match.out { background: var(--go); }
.s-match.maybe { background: transparent; color: inherit; border: 1.5px dashed var(--line); }
.s-match label { display: flex; gap: 6px; align-items: center; font-weight: 500; }

/* ---------- Thai ---------- */
html[lang="th"] .ask-line, html[lang="th"] .v-head, html[lang="th"] .shelf-head h2, html[lang="th"] .why-head h2,
html[lang="th"] .form-h h3, html[lang="th"] .empty strong, html[lang="th"] .idle h3 { line-height: 1.2; letter-spacing: 0; }
html[lang="th"] .ask-line { font-size: clamp(36px, 9vw, 112px); }
