:root {
  --bg: #f8f4f1;
  --surface: #ffffff;
  --surface-2: #f3ece8;
  --ink: #2a1f26;
  --muted: #7a6a72;
  --line: #e7ddd8;
  --accent: #6d2a48;
  --accent-ink: #ffffff;
  --accent-soft: #f3e4ea;
  --good: #2f7a52;
  --good-soft: #e3f2e9;
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(42, 31, 38, .06), 0 4px 14px rgba(42, 31, 38, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }

/* ---------- Buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 12px;
  font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #5a2139; }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-good { background: var(--good); color: #fff; }
.btn-danger { background: transparent; color: var(--danger); border-color: #efc9c6; }
.btn-block { width: 100%; }
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 12px; background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, .12); }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 6px 2px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span, .field-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); font-size: 13px; }
input:not([type=file]):not([type=checkbox]), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-error { color: var(--danger) !important; font-weight: 600; font-size: 14px !important; }
.field.invalid > span, .field.invalid .field-label { color: var(--danger); }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); box-shadow: 0 0 0 3px #fbe3e1; }
.field.invalid .pills { background: #fdecea; outline: 2px solid var(--danger); outline-offset: 0; border-radius: 14px; padding: 8px; }
.field.invalid .pill:not(.pill-add) { border-color: #e9a9a4; }
.shake { animation: shake .4s ease-in-out; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.form-error { color: var(--danger); background: #fdecea; padding: 10px 12px; border-radius: 10px; margin: 0 0 14px; font-size: 14px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  padding: 28px 22px; border-radius: 20px; box-shadow: var(--shadow); text-align: center;
}
.login-card .field { text-align: left; }
.login-logo { width: 64px; height: 64px; margin: 0 auto 12px; }
.login-card h1 { font-size: 26px; }
.login-card p.muted { margin: 6px 0 22px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--accent); color: #fff;
  padding-top: env(safe-area-inset-top);
}
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; }
.brand img { width: 32px; height: 32px; border-radius: 8px; box-shadow: 0 0 0 1.5px rgba(255,255,255,.4); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 16px 16px 110px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  background: var(--surface); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.stat-main { background: var(--accent); color: #fff; }
.stat-main .stat-label, .stat-main .stat-sub { color: rgba(255,255,255,.78); }
.stat-value-box { background: #1d6b73; }   /* Total value: teal */
.stat-profit-box { background: #2e7d4f; }  /* Profit: green */
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-sub { font-size: 13px; color: var(--muted); }
@media (min-width: 760px) {
  .stats { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .stat-value { font-size: 30px; }
}

/* ---------- Sections ---------- */
.block { margin-top: 24px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.block-head h2 { font-size: 18px; }

/* ---------- Category groups (main category + subcategory boxes) ---------- */
.cats { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .cats { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; } }
.cat-group { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; }
/* Box tinted with the colour of the category's storage tub, with a solid band of the exact colour on top. */
.cat-group.has-tub {
  background: color-mix(in srgb, var(--tub) 32%, #ffffff);
  border-top: 7px solid var(--tub);
  padding-top: 4px;
}
.cat-group.has-tub .cat:hover { background: rgba(255, 255, 255, .35); }
.cat-group.has-tub .subcat { background: rgba(255, 255, 255, .72); }
.cat, .subcat {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1.5px solid transparent; cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s;
}
.cat { padding: 10px 10px; min-height: 48px; border-radius: 10px; background: transparent; }
.cat:hover { background: var(--surface-2); }
.cat .cat-name { font-weight: 700; font-size: 17px; }
.cat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count { font-weight: 750; font-size: 18px; color: var(--accent); font-variant-numeric: tabular-nums; }
.subcats { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; padding: 2px 4px 4px; }
.subcat { padding: 8px 10px; min-height: 42px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.subcat .cat-name { font-weight: 600; }
.subcat .cat-count { font-size: 15px; }
.subcat:hover { border-color: #d8c7cf; }
.cat[aria-pressed="true"], .subcat[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.cat[aria-pressed="true"] .cat-name, .subcat[aria-pressed="true"] .cat-name { color: #fff; }

/* Stock level colours: more than 20 green, 10–20 orange, under 10 red */
.stock-high { --stock: #237a49; --stock-soft: #dcf1e4; }
.stock-mid  { --stock: #b4530a; --stock-soft: #fdebd7; }
.stock-low  { --stock: #b3261e; --stock-soft: #fbe3e1; }
.cat .cat-count, .subcat .cat-count {
  color: var(--stock); background: var(--stock-soft);
  min-width: 38px; padding: 2px 10px; border-radius: 999px; text-align: center;
}
.cat { border-left: 5px solid var(--stock); }
.subcat { border-left: 4px solid var(--stock); }
.cat[aria-pressed="true"], .subcat[aria-pressed="true"] { border-left-color: var(--stock); }
.stock-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: -2px 0 10px; font-size: 13px; color: var(--muted); }
.stock-legend span { display: inline-flex; align-items: center; gap: 6px; }
.stock-legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--stock); }

/* ---------- Pills (add-item form) ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  min-height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s;
}
.pill:hover { border-color: #d3bfc7; }
.pill[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill-add { border-style: dashed; color: var(--accent); }
.pill-add[aria-expanded="true"] { background: var(--accent-soft); }
.sub-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.sub-suggest:empty { display: none; }
.sub-chip {
  min-height: 34px; padding: 0 12px; border-radius: 999px; border: 0;
  background: var(--surface-2); font-size: 14px; font-weight: 600; cursor: pointer;
}
.sub-chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.empty-note { color: var(--muted); background: var(--surface); border: 1.5px dashed var(--line); border-radius: 12px; padding: 14px; margin: 0; }

/* ---------- Search & filters ---------- */
.search-row { display: flex; gap: 8px; }
.search-box { position: relative; flex: 1; min-width: 0; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 40px !important; }
.search-row select { width: auto; flex: 0 0 auto; max-width: 42%; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.tabs { display: inline-flex; background: var(--surface-2); border-radius: 11px; padding: 3px; }
.tabs button {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 9px;
  font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px;
}
.chip button { border: 0; background: rgba(109,42,72,.12); color: inherit; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; line-height: 1; }
.price-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 10px; }
.price-label { font-size: 14px; font-weight: 600; color: var(--muted); flex: 0 0 auto; line-height: 36px; }
.price-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.price-chip {
  flex: 0 0 auto; min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; cursor: pointer;
}
.price-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.size-hint { color: var(--good) !important; font-weight: 600; min-height: 1.2em; }
.size-hint.is-none { color: var(--muted) !important; font-weight: 400; }
.result-count { margin: 12px 0 10px; color: var(--muted); font-size: 14px; }

/* ---------- Item grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
.card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; border: 0; padding: 0; text-align: left;
  display: flex; flex-direction: column; transition: transform .12s;
}
.card:hover { transform: translateY(-2px); }
.card-photo { position: relative; aspect-ratio: 3 / 4; background: var(--surface-2); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.no-photo { width: 100%; height: 100%; display: grid; place-items: center; color: #c5b4bb; }
.price-tag {
  position: absolute; left: 8px; bottom: 8px; background: rgba(255,255,255,.95);
  padding: 3px 9px; border-radius: 8px; font-weight: 750; font-size: 15px; font-variant-numeric: tabular-nums;
}
.sold-badge {
  position: absolute; top: 8px; right: 8px; background: var(--good); color: #fff;
  font-size: 12px; font-weight: 750; letter-spacing: .05em; padding: 3px 8px; border-radius: 6px;
}
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.card-desc { font-weight: 600; font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

/* ---------- Floating add button ---------- */
.fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20;
  display: inline-flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 22px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 6px 20px rgba(109, 42, 72, .4); cursor: pointer;
}
.fab:active { transform: scale(.97); }
@media (min-width: 1140px) { .fab { right: calc(50% - 550px); } }

/* ---------- Modal (bottom sheet on phones) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(30, 18, 24, .5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease-out;
}
.modal {
  width: 100%; max-height: 94vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  animation: slide-up .2s ease-out;
}
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { max-width: 520px; border-radius: 20px; padding: 24px; }
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 8px; }
.modal-head h2 { font-size: 20px; }
.modal-head .icon-btn:hover { background: var(--surface-2); }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-up { from { transform: translateY(30px); opacity: .6; } }

/* Photo picker */
.photo-pick { margin-bottom: 16px; }
.photo-preview {
  position: relative; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden;
  background: var(--surface-2); border: 1.5px dashed #d8c7cf;
  display: grid; place-items: center; color: var(--muted); text-align: center; cursor: pointer;
}
.photo-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.photo-preview .remove-photo {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 18px; cursor: pointer;
}
.photo-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.photo-btns label { cursor: pointer; }

.new-cat { display: flex; gap: 8px; margin: -6px 0 14px; }
.new-cat input { flex: 1; }
.new-cat .btn { min-height: 46px; padding: 0 14px; }
details.more { margin: 2px 0 14px; border-top: 1px solid var(--line); padding-top: 12px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--accent); margin-bottom: 12px; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+ "; }
details.more[open] summary::before { content: "− "; }

/* Item detail */
.detail-photo { border-radius: 14px; overflow: hidden; background: var(--surface-2); margin-bottom: 14px; }
.detail-photo img { width: 100%; max-height: 52vh; object-fit: contain; background: #fff; }
.detail-price { font-size: 28px; font-weight: 750; font-variant-numeric: tabular-nums; }
.detail-desc { font-size: 17px; margin: 4px 0 14px; }
.detail-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 18px; font-size: 15px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 600; }
.status-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.status-pill.available { background: var(--accent-soft); color: var(--accent); }
.status-pill.sold { background: var(--good-soft); color: var(--good); }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-actions .wide { grid-column: 1 / -1; }

/* Menu & category manager */
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-list button {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 0 8px;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font-weight: 600; cursor: pointer;
}
.menu-list li:last-child button { border-bottom: 0; }
.menu-list button:hover { background: var(--surface-2); }
.menu-list .danger { color: var(--danger); }
.menu-user { color: var(--muted); font-size: 14px; margin: -8px 0 8px; }
.cat-rows { list-style: none; margin: 0 0 16px; padding: 0; }
.cat-rows li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cat-rows .cat-row-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.cat-rows .cat-row-count { color: var(--muted); font-size: 14px; white-space: nowrap; }
.cat-rows .btn { min-height: 38px; padding: 0 12px; font-size: 14px; }
.cat-rows .is-main { padding-top: 14px; }
.cat-rows .is-main .cat-row-name { font-size: 17px; }
.cat-rows .is-sub { padding-left: 18px; border-bottom-style: dashed; }
.cat-rows .is-sub .cat-row-name { font-weight: 500; }
.cat-rows .is-sub .cat-row-name::before { content: "↳ "; color: var(--muted); }
.cat-rows .is-add { border-bottom: 1px solid var(--line); }

/* Card footer: item number + quick Sold button */
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; min-height: 32px; }
.item-no { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.quick-sold {
  min-height: 32px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--good);
  background: var(--good-soft); color: var(--good); font-weight: 700; font-size: 13px; cursor: pointer;
}
.quick-sold:hover { background: var(--good); color: #fff; }

/* Favourites */
.fav-btn {
  position: absolute; top: 6px; left: 6px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.92); color: #8a7880; display: grid; place-items: center;
  cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.15); transition: transform .12s, color .12s;
}
.fav-btn svg, .fav-toggle svg { fill: none; }
.fav-btn[aria-pressed="true"], .fav-toggle[aria-pressed="true"] { color: #e0245e; }
.fav-btn[aria-pressed="true"] svg, .fav-toggle[aria-pressed="true"] svg { fill: currentColor; }
.fav-btn:active { transform: scale(.88); }
.fav-btn-inline { position: static; display: inline-grid; vertical-align: middle; margin-left: 6px; box-shadow: none; background: var(--surface-2); }
.fav-toggle {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; margin: -4px 0 14px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 600; color: var(--muted); cursor: pointer;
}
.fav-toggle[aria-pressed="true"] { border-color: #f5b5c8; background: #fdecf1; }
.quick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.quick-btn { padding: 0 10px; font-size: 15px; }
.fav-filter-btn { background: #fdecf1; color: #c2185b; }
.fav-filter-btn[aria-pressed="true"] { background: #e0245e; color: #fff; }
.quick-count { background: rgba(255,255,255,.7); color: #c2185b; border-radius: 999px; padding: 0 8px; font-size: 13px; min-width: 24px; }
.fav-filter-btn[aria-pressed="true"] .quick-count { background: #fff; }
.chip-fav { background: #fdecf1; color: #c2185b; }
.chip + .chip { margin-left: 6px; }

/* Storage tubs */
.tub-swatch {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto;
  vertical-align: -2px; margin-right: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18);
}
.tub-swatch.no-color { background: transparent; box-shadow: none; border: 1.5px dashed #b9a8b0; }
.tub-pill { display: inline-flex; align-items: center; }
.tub-pill[aria-checked="true"] .tub-swatch { box-shadow: 0 0 0 2px #fff; }
.cat-rows li > .tub-swatch { width: 22px; height: 22px; margin: 0; }
.colour-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.colour-opt {
  height: 44px; border-radius: 12px; border: 2px solid transparent; background: var(--surface-2);
  padding: 4px; cursor: pointer; display: grid; place-items: center;
}
.colour-opt span { width: 100%; height: 100%; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.colour-opt[aria-checked="true"] { border-color: var(--ink); }
.colour-custom { position: relative; font-size: 11px; font-weight: 700; color: var(--muted); }
.colour-custom span { box-shadow: none; display: grid; place-items: center; }
.colour-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* Match sold photos */
.center { text-align: center; }
.ms-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 15px; }
.ms-progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 8px 0 12px; }
.ms-progress span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.ms-sold-photo { border-radius: 14px; overflow: hidden; background: #fff; border: 1px solid var(--line); margin-bottom: 12px; }
.ms-sold-photo img { width: 100%; max-height: 32vh; object-fit: contain; }
.ms-label { font-weight: 700; margin: 4px 0 8px; }
.ms-matches { display: flex; flex-direction: column; gap: 8px; }
.ms-match { border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.ms-match.selected { border-color: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.ms-match-main { width: 100%; display: flex; gap: 12px; padding: 8px; border: 0; background: none; text-align: left; cursor: pointer; }
.ms-thumb { flex: 0 0 76px; height: 100px; border-radius: 10px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: #c5b4bb; }
.ms-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ms-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ms-desc { font-weight: 700; }
.ms-meta { font-size: 13px; color: var(--muted); }
.ms-reason { font-size: 13px; color: var(--ink); }
.ms-conf { align-self: flex-start; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.conf-high { background: var(--good-soft); color: var(--good); }
.conf-mid { background: #fdebd7; color: #b4530a; }
.conf-low { background: var(--surface-2); color: var(--muted); }
.ms-confirm { display: flex; align-items: flex-end; gap: 8px; padding: 0 8px 10px; }
.ms-confirm .field { flex: 1; }
.ms-search { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.ms-summary { text-align: center; padding: 10px 0 4px; }
.ms-big { font-size: 56px; font-weight: 800; color: var(--good); line-height: 1; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 90%; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-weight: 600; max-width: calc(100% - 32px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.has-action { display: flex; align-items: center; gap: 14px; pointer-events: auto; padding-right: 8px; }
.toast-action { border: 0; background: rgba(255,255,255,.16); color: #fff; font-weight: 700; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.toast.error { background: var(--danger); }

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