/* ---------- theme ---------- */
:root {
  --radius: 12px;
  --radius-sm: 8px;
  --card-ratio: 63 / 88;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Hiragino Sans', 'Yu Gothic UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2a2f3b;
  --text: #e9ebf1;
  --muted: #8d95a8;
  --accent: #e5484d;
  --accent-text: #fff;
  --gold: #f2b84b;
  --en: #3b82f6;
  --jp: #e5484d;
  --shadow: 0 10px 30px rgb(0 0 0 / 0.45);
}
[data-theme='light'] {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --border: #dde1e8;
  --text: #161a22;
  --muted: #646d80;
  --accent: #d93a40;
  --accent-text: #fff;
  --gold: #a76b00;
  --en: #2563eb;
  --jp: #d93a40;
  --shadow: 0 10px 30px rgb(20 25 40 / 0.15);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; padding-bottom: var(--safe-bottom); }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.code { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0.01em; }
.spacer { flex: 1; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2);
  font-weight: 600; white-space: nowrap; transition: background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--accent); background: transparent; }
.btn.small { height: 30px; padding: 0 10px; font-size: 0.9em; }
.btn.on { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn .count { background: var(--accent); color: #fff; border-radius: 99px; font-size: 0.75em; padding: 0 6px; line-height: 18px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn.on { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn.ghost { width: 28px; height: 28px; }

.select, input[type='search'], input[type='email'], input[inputmode], textarea {
  height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); padding: 0 10px; outline: none;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; width: 100%; }
.select:focus, input:focus, textarea:focus { border-color: var(--accent); }

.chips { display: flex; gap: 6px; }
.chips.wrap { flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 99px; white-space: nowrap;
  border: 1px solid var(--border); background: transparent; font-size: 0.9em; color: var(--muted);
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }

.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); }

.stepper { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 10px; padding: 1px; }
.stepper-value { min-width: 28px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; padding: 2px 5px; border-radius: 5px; line-height: 1.2; color: #fff; background: #555; }
.badge.lang-en { background: var(--en); }
.badge.lang-jp { background: var(--jp); }
.badge.var { background: rgb(0 0 0 / 0.65); color: var(--gold); }
.badge.last { background: var(--gold); color: #1b1400; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; margin-right: 2px; }
.c-red { background: #e5484d; } .c-green { background: #30a46c; } .c-blue { background: #3b82f6; }
.c-purple { background: #8e4ec6; } .c-black { background: #111; box-shadow: inset 0 0 0 1px #666; } .c-yellow { background: #f5d90a; }

.price { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.price.none { color: var(--muted); font-weight: 400; }
.price .proxy { font-size: 0.6em; margin-left: 2px; color: var(--muted); font-weight: 700; }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 0.8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1em; letter-spacing: -0.01em; }
.demo-pill { font-size: 0.75em; font-weight: 700; color: var(--gold); border: 1px solid var(--gold); border-radius: 99px; padding: 2px 8px; }

.sticky { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 16px; }
.search { position: relative; display: flex; align-items: center; flex: 1 1 220px; min-width: 0; }
.search > svg { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; padding-left: 36px; }
.search .icon-btn { position: absolute; right: 4px; }
.search.grow { flex: 1; }
.view-switch { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }

.filter-panel { padding: 4px 16px 12px; display: grid; gap: 10px; max-height: 55vh; overflow: auto; }
.fgroup-title { font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.fp-actions, .fp-row { display: flex; gap: 8px; justify-content: flex-end; }
.fp-row { justify-content: flex-start; }

.summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 22px; padding: 8px 16px 10px; font-size: 0.9em; }
.stat b { font-size: 1.15em; margin-right: 5px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); }
.stat.value b { color: var(--gold); }
.stat.split { display: flex; gap: 14px; }
.stat.split span { color: var(--text); }

main { padding: 14px 16px 60px; max-width: 2200px; margin: 0 auto; }
.group + .group { margin-top: 26px; }
.group-title { font-size: 1em; margin: 0 0 10px; display: flex; gap: 8px; align-items: baseline; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty.big { color: var(--text); display: grid; gap: 10px; justify-items: center; }
.empty-art { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 18px; background: var(--surface-2); color: var(--muted); }
.empty-art svg { width: 32px; height: 32px; }

/* ---------- card images ---------- */
.card-img { display: block; width: 100%; aspect-ratio: var(--card-ratio); object-fit: cover; border-radius: 4.5% / 3.2%; background: var(--surface-2); }
.card-img.placeholder { display: grid; place-items: center; color: var(--muted); font-family: var(--mono); font-size: 0.8em; border: 1px dashed var(--border); }
.card-img.thumb { width: 40px; flex: none; border-radius: 3px; }

/* ---------- tiles ---------- */
.grid { display: grid; gap: 18px 14px; grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr)); }
.view-large { --tile: 230px; }
.view-medium { --tile: 160px; }
.view-small { --tile: 96px; }
.view-small .grid { gap: 10px 8px; }
.tile { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.tile-img { position: relative; transition: transform 0.15s ease; }
.tile:hover .tile-img, .tile:focus-visible .tile-img { transform: translateY(-3px); }
.tile:focus-visible .card-img { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile .card-img { box-shadow: 0 4px 14px rgb(0 0 0 / 0.35); }
.tile-badges { position: absolute; top: 6px; left: 6px; display: flex; gap: 4px; }
.qty { position: absolute; bottom: 6px; right: 6px; background: rgb(0 0 0 / 0.75); color: #fff; font-weight: 800; font-size: 0.8em; padding: 2px 7px; border-radius: 99px; }
.tile-meta { min-width: 0; padding: 0 2px; }
.tile-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 0.85em; }
.view-large .tile-name { font-size: 1.05em; }
.view-large .tile-sub .price { font-size: 1.1em; }
.view-small .tile-meta { display: none; }
.view-small .tile-badges .var { display: none; }

/* ---------- list ---------- */
.list { display: grid; gap: 2px; }
.list-row { all: unset; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 10px; }
.list-row:hover, .list-row:focus-visible { background: var(--surface); }
.lr-main { flex: 1; min-width: 0; }
.lr-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-sub { color: var(--muted); font-size: 0.85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .price { min-width: 70px; text-align: right; }

/* ---------- details table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.details { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.details th { position: sticky; top: 0; text-align: left; font-weight: 700; font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 10px; background: var(--surface); border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; }
.details th.sortable { cursor: pointer; }
.details th.sortable:hover, .details th.sorted { color: var(--text); }
.details th svg { vertical-align: -2px; margin-left: 2px; }
.details td { padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.details tr:last-child td { border-bottom: 0; }
.details tbody tr { cursor: pointer; }
.details tbody tr:hover { background: var(--surface-2); }
.details td.name { font-weight: 650; white-space: normal; min-width: 140px; }
.details .num { text-align: right; }
.details .c-img { width: 52px; }

/* ---------- modals ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / 0.6); display: grid; place-items: center; padding: 16px; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.modal { position: relative; width: min(980px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 22px; }
.modal-close { position: absolute; top: 10px; right: 10px; z-index: 2; }
.modal h2 { font-size: 1.4em; padding-right: 36px; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; }
.zoom { position: relative; overflow: hidden; border-radius: 14px; cursor: zoom-in; touch-action: manipulation; align-self: start; }
.zoom.zoomed { cursor: zoom-out; }
.zoom-inner { transition: transform 0.2s ease; }
.zoom.zoomed .zoom-inner { transform: scale(2.4); }
.zoom-hint { position: absolute; right: 10px; bottom: 10px; background: rgb(0 0 0 / 0.6); color: #fff; border-radius: 99px; padding: 6px; display: grid; }
.detail-info { display: grid; gap: 16px; align-content: start; }
.name-jp { font-size: 1.05em; margin-top: 2px; }
.detail-head .muted { margin-top: 4px; }
.big-price { font-size: 1.9em; font-weight: 800; color: var(--gold); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.edit { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; align-items: center; }
.edit label { color: var(--muted); }
.edit .segmented, .edit .stepper { justify-self: start; }
.edit textarea { grid-column: 2; }
.edit .btn.danger { grid-column: 1 / -1; justify-self: start; }

.modal.add { display: flex; flex-direction: column; gap: 12px; height: min(860px, calc(100dvh - 32px)); padding-bottom: 0; }
.add-controls { display: flex; gap: 10px; align-items: center; }
.hint { margin: 0; font-size: 0.85em; color: var(--gold); }
.results { flex: 1; overflow: auto; display: grid; gap: 18px; align-content: start; margin: 0 -22px; padding: 4px 22px 12px; }
.rg-head { font-weight: 650; margin-bottom: 8px; }
.variants { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.variant { position: relative; flex: none; width: 128px; display: grid; gap: 3px; text-align: left; border: 2px solid transparent; border-radius: 12px; padding: 5px; background: transparent; }
.variant:hover { background: var(--surface-2); }
.variant.on { border-color: var(--accent); background: var(--surface-2); }
.variant .v-label { font-size: 0.8em; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.variant .v-sub { font-size: 0.75em; color: var(--muted); }
.variant .badge.last { position: absolute; top: 9px; left: 9px; }
.variant .qty { bottom: auto; top: 9px; right: 9px; font-size: 0.7em; }
.add-bar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 -22px; padding: 12px 22px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--border); background: var(--surface); min-height: 62px; }
.ab-card { display: flex; align-items: center; gap: 10px; flex: 1 1 200px; min-width: 0; }
.ab-card b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- menu, toast, login ---------- */
.menu-wrap { position: relative; }
.menu-backdrop { position: fixed; inset: 0; z-index: 30; }
.menu { position: absolute; right: 0; top: 42px; z-index: 31; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.menu-head { padding: 6px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: transparent; border-radius: 8px; text-align: left; }
.menu-item:hover { background: var(--surface-2); }
.menu-item svg { color: var(--muted); }

.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(20px + var(--safe-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); background: var(--text); color: var(--bg); padding: 10px 12px 10px 16px; border-radius: 12px; box-shadow: var(--shadow); animation: rise 0.2s; font-weight: 550; }
.toast .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 40%, transparent); }
@keyframes rise { from { transform: translate(-50%, 10px); opacity: 0; } }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); text-align: center; display: grid; gap: 12px; justify-items: center; }
.login-card form { display: grid; gap: 10px; width: 100%; }
.login-card input { width: 100%; height: 44px; font-size: 1.05em; }
.login-card .btn { height: 44px; }
.error { color: var(--accent); }

/* ---------- sync indicator ---------- */
.sync-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8em; font-weight: 700; color: var(--gold); white-space: nowrap; }
.sync-pill svg { width: 18px; height: 18px; }
.warn { color: var(--gold); font-weight: 600; }

/* ---------- scanner ---------- */
.scanner { position: fixed; inset: 0; z-index: 40; background: #000; color: #fff; overflow: hidden; touch-action: manipulation; }
.scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 0; display: grid; place-items: center; padding: calc(64px + var(--safe-top)) 16px 200px; pointer-events: none; }
.scan-overlay {
  position: relative; aspect-ratio: 63 / 88;
  height: min(100%, calc((100vw - 32px) * 88 / 63)); max-width: 100%;
  border-radius: 4.5% / 3.2%;
  box-shadow: 0 0 0 200vmax rgb(0 0 0 / 0.55);
  outline: 2px solid rgb(255 255 255 / 0.35);
  transition: outline-color 0.2s;
}
.scan-overlay.hit { outline-color: #30a46c; outline-width: 3px; }
.corner { position: absolute; width: 26px; height: 26px; border: 4px solid #fff; }
.corner.tl { top: -3px; left: -3px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.corner.tr { top: -3px; right: -3px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.corner.bl { bottom: -3px; left: -3px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.corner.br { bottom: -3px; right: -3px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.code-zone { position: absolute; right: 5%; bottom: 1.5%; width: 31%; height: 5%; border: 2px dashed var(--gold); border-radius: 4px; font-size: 10px; font-weight: 800; color: var(--gold); display: grid; place-items: center; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.9; }

.scan-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-top)) 12px 10px; background: linear-gradient(rgb(0 0 0 / 0.7), transparent); }
.scan-top-mid { flex: 1; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.scan-btn { color: #fff; background: rgb(0 0 0 / 0.45); width: 42px; height: 42px; border-radius: 50%; }
.scan-btn.on { background: var(--gold); color: #000; }
.scanner .segmented { background: rgb(0 0 0 / 0.5); border-color: rgb(255 255 255 / 0.2); }
.scanner .segmented button { color: rgb(255 255 255 / 0.75); }
.scanner .segmented button.on { background: #fff; color: #000; }
.scan-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9em; font-weight: 600; white-space: nowrap; }
.scan-switch input { width: 18px; height: 18px; accent-color: var(--accent); }

.scan-hud { position: absolute; top: calc(66px + var(--safe-top)); left: 0; right: 0; display: flex; justify-content: center; gap: 10px; align-items: center; pointer-events: none; }
.scan-hud > * { pointer-events: auto; }
.scan-count { background: rgb(0 0 0 / 0.6); border-radius: 99px; padding: 4px 12px; font-size: 0.9em; }
.scan-count b { font-size: 1.15em; margin-right: 3px; }
.scan-undo { background: rgb(0 0 0 / 0.6); color: #fff; border-color: rgb(255 255 255 / 0.3); }

.scan-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 10px; justify-items: center; padding: 14px 12px calc(14px + var(--safe-bottom)); background: linear-gradient(transparent, rgb(0 0 0 / 0.85) 30%); }
.scan-status { text-align: center; font-size: 0.92em; color: rgb(255 255 255 / 0.85); min-height: 1.3em; max-width: 520px; }
.scan-suggest { display: flex; align-items: center; gap: 8px; font-size: 0.9em; }
.scan-suggest .chip { color: #fff; border-color: var(--gold); font-family: var(--mono); }
.scan-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.scanner .btn:not(.primary) { background: rgb(255 255 255 / 0.12); border-color: rgb(255 255 255 / 0.25); color: #fff; }

.scan-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 78dvh; overflow: auto; background: var(--surface); color: var(--text); border-radius: 20px 20px 0 0; padding: 14px 14px calc(14px + var(--safe-bottom)); display: grid; gap: 12px; box-shadow: 0 -10px 40px rgb(0 0 0 / 0.5); animation: rise-sheet 0.18s ease-out; }
@keyframes rise-sheet { from { transform: translateY(30px); opacity: 0; } }
.scan-sheet .btn:not(.primary) { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.scan-sheet .segmented { background: var(--surface-2); border-color: var(--border); }
.scan-sheet .segmented button { color: var(--muted); }
.scan-sheet .segmented button.on { background: var(--surface); color: var(--text); }
.ss-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ss-variants { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.ss-snap { flex: none; width: 104px; margin: 0; padding: 5px; text-align: center; }
.ss-snap img { width: 100%; aspect-ratio: 63 / 88; object-fit: cover; border-radius: 6px; outline: 2px dashed var(--muted); }
.ss-snap figcaption { font-size: 0.75em; color: var(--muted); }
.ss-variants .variant { width: 116px; }
.ss-controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }
.ss-lang { display: flex; align-items: center; gap: 8px; }
.ss-add { height: 52px; font-size: 1.05em; width: 100%; position: sticky; bottom: 0; box-shadow: 0 -8px 16px var(--surface); }

.scan-flash { position: absolute; left: 50%; top: 42%; transform: translateX(-50%); background: #30a46c; color: #fff; font-weight: 700; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); animation: rise 0.2s; max-width: calc(100vw - 40px); text-align: center; }

/* ---------- responsive ---------- */
.show-xs { display: none; }
@media (max-width: 1100px) { .hide-md { display: none; } }
@media (max-width: 760px) {
  .hide-sm { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .zoom { max-width: 420px; justify-self: center; width: 100%; }
  .view-large { --tile: 150px; }
  .view-medium { --tile: 104px; }
  .view-small { --tile: 64px; }
  .view-small .grid { gap: 6px; }
  .view-medium .tile-sub .code { display: none; }
  .view-medium .tile-sub { justify-content: flex-start; }
  .grid { gap: 14px 10px; }
}
@media (max-width: 560px) {
  .hide-xs { display: none; }
  .show-xs { display: flex; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .brand { white-space: nowrap; font-size: 1em; }
  .demo-pill { white-space: nowrap; }
  .sticky { position: static; } /* on phones, don't let the toolbar eat half the screen */
  .toolbar { padding: 8px 12px; }
  .search { flex-basis: 100%; order: -1; }
  .chips { flex: 1; }
  .chip { padding: 0 10px; }
  .view-switch .icon-btn { width: 32px; }
  main { padding: 12px 12px 60px; }
  .summary { padding: 6px 12px 8px; gap: 4px 14px; }
  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal { border-radius: 18px 18px 0 0; max-height: 94dvh; padding: 18px 16px; }
  .modal.add { height: 94dvh; }
  .results, .add-bar { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .variant { width: 112px; }
  .add-bar .btn.primary { flex: 1; height: 44px; }
  .edit { grid-template-columns: 1fr; }
  .edit textarea { grid-column: 1; }
}
