:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #e6e8ec;
  --text: #16181d;
  --muted: #596170;
  --faint: #636b78;
  --accent: #087a55;
  --accent-ink: #ffffff;
  --accent-soft: #e3f6ee;
  --danger: #c42530;
  --danger-soft: #fdecee;
  --warn: #8f5300;
  --warn-soft: #fff3dc;
  --promo: #7c3aed;
  --promo-soft: #f1eafe;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --radius: 16px;
  --radius-sm: 10px;
  --tier-S: #ff7a7a;
  --tier-A: #ffb36b;
  --tier-B: #ffd966;
  --tier-C: #b7e36a;
  --tier-D: #8fd3ff;
  --tier-ink: #1f1f1f;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1d212a;
  --line: #2a2f3a;
  --text: #eef0f4;
  --muted: #a1a8b3;
  --faint: #8b93a0;
  --accent: #2ecc8f;
  --accent-ink: #06231a;
  --accent-soft: #123328;
  --danger: #ff6b73;
  --danger-soft: #3a1c20;
  --warn: #ffb547;
  --warn-soft: #3a2c12;
  --promo: #b18cff;
  --promo-soft: #2a2140;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Rubik", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
code {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 0 5px; font-size: .88em; font-family: inherit; direction: ltr; unicode-bidi: isolate;
}
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, var(--accent), #47c9a0); box-shadow: var(--shadow);
}
.brand-name { font-weight: 800; letter-spacing: -.02em; font-size: 18px; }
.brand-sub { color: var(--muted); font-size: 12.5px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 500;
  max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: border-color .15s, background .15s;
}
.pill:hover { border-color: var(--accent); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.pill .dot.ok { background: var(--accent); }
.pill .dot.demo { background: var(--promo); }
.pill .dot.run { background: var(--warn); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  display: inline-grid; place-items: center; font-size: 16px; transition: border-color .15s;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn.lang { font-weight: 700; font-size: 13px; }

.demo-banner {
  display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap;
  padding: 8px 16px; background: var(--promo-soft); color: var(--promo); font-weight: 500; font-size: 14px;
}
.link { background: none; border: 0; color: inherit; text-decoration: underline; font-weight: 700; padding: 0; }

/* ---------- layout ---------- */
.layout {
  display: grid; grid-template-columns: minmax(330px, 410px) 1fr; gap: 20px;
  padding: 20px 24px 40px; max-width: 1440px; margin: 0 auto; align-items: start;
}
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.list-panel { position: sticky; top: 84px; display: flex; flex-direction: column; max-height: calc(100vh - 104px); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 18px 6px; }
.panel-head h2 { margin: 0; font-size: 18px; }
.count { color: var(--muted); font-size: 13px; }

.composer { padding: 8px 18px 12px; }
.input-wrap { position: relative; }
#itemInput {
  width: 100%; height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2);
  padding: 0 16px; padding-inline-end: 54px; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
#itemInput:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.add-btn {
  position: absolute; inset-inline-end: 7px; top: 7px; width: 36px; height: 36px; border-radius: 10px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-size: 20px; font-weight: 700; line-height: 1;
}
.add-btn:hover { filter: brightness(1.07); }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 8px; line-height: 1.7; }

.suggest {
  position: absolute; inset-inline: 0; top: 56px; z-index: 10; list-style: none; margin: 0; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  max-height: 320px; overflow: auto;
}
.suggest li {
  display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 9px; cursor: pointer;
}
.suggest li.active, .suggest li:hover { background: var(--accent-soft); }
.suggest .s-hint { color: var(--muted); font-size: 13px; }

/* ---------- list items ---------- */
.items { list-style: none; margin: 0; padding: 0 10px; overflow: auto; flex: 1; }
.item {
  border-radius: 12px; padding: 8px; margin-bottom: 4px; transition: background .12s;
  animation: slideIn .18s ease-out;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-4px); } }
.item:hover, .item.open { background: var(--surface-2); }
.item-row { display: flex; align-items: center; gap: 8px; }
.qty {
  display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  flex: none; height: 30px;
}
.qty button { width: 24px; height: 28px; border: 0; background: none; color: var(--muted); font-size: 15px; }
.qty button:hover { color: var(--accent); }
.qty span { min-width: 18px; text-align: center; font-weight: 600; font-size: 14px; }
.item-main { flex: 1; min-width: 0; cursor: pointer; }
.item-text { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-text[contenteditable="true"] {
  white-space: normal; outline: 2px solid var(--accent); border-radius: 6px; padding: 0 4px; cursor: text;
}
.item-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; padding: 1px 8px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.chip.size { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.ok { color: var(--accent); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip.promo { background: var(--promo-soft); color: var(--promo); border-color: transparent; }
.item-actions { display: flex; gap: 2px; opacity: .45; transition: opacity .12s; }
.item:hover .item-actions, .item.open .item-actions { opacity: 1; }
.mini {
  width: 28px; height: 28px; border-radius: 8px; border: 0; background: none; color: var(--muted); font-size: 14px;
  display: grid; place-items: center;
}
.mini:hover { background: var(--surface); color: var(--text); }
.mini.chev { transition: transform .15s; }
.item.open .mini.chev { transform: rotate(180deg); }

.preview { margin: 8px 2px 4px; padding: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.preview h4 { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.pv-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px dashed var(--line); font-size: 13px; }
.pv-row:first-of-type { border-top: 0; }
.pv-name { flex: 1; min-width: 0; }
.pv-name small { color: var(--muted); }
.pv-price { color: var(--muted); white-space: nowrap; font-size: 12.5px; }
.pv-x {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 7px; font-size: 11.5px; padding: 2px 7px;
  color: var(--muted); white-space: nowrap;
}
.pv-x:hover { color: var(--danger); border-color: var(--danger); }
.pv-more { color: var(--muted); font-size: 12px; margin-top: 4px; }
.pv-excluded { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

.empty-list { text-align: center; color: var(--muted); padding: 18px 26px 26px; }
.empty-list .big { font-size: 34px; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.example {
  border: 1px dashed var(--accent); color: var(--accent); background: var(--accent-soft); border-radius: 999px;
  padding: 4px 11px; font-size: 13px;
}
.panel-foot { display: flex; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--line); }
.ghost { background: none; border: 0; color: var(--muted); padding: 6px 8px; border-radius: 8px; font-size: 13.5px; }
.ghost:hover { background: var(--surface-2); color: var(--text); }
.ghost.danger:hover { color: var(--danger); }

/* ---------- results ---------- */
.results { min-width: 0; }
.results-empty {
  display: grid; place-items: center; text-align: center; padding: 90px 20px; color: var(--muted);
  border: 2px dashed var(--line); border-radius: var(--radius);
}
.results-empty .illu { font-size: 54px; }
.results-empty h3 { color: var(--text); margin: 10px 0 4px; font-size: 22px; }

.summary { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.stat { padding: 16px 18px; position: relative; overflow: hidden; }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat .sub { color: var(--muted); font-size: 13px; }
.stat.winner { color: #fff; border: 0; }
.stat.winner .label, .stat.winner .sub { color: rgba(255, 255, 255, .85); }
.stat.winner::after {
  content: "🏆"; position: absolute; inset-inline-end: 14px; bottom: -6px; font-size: 64px; opacity: .22;
}
.stat .value.good { color: var(--accent); }

.tabs { display: flex; gap: 6px; align-items: center; margin-bottom: 12px; }
.tab {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 16px; font-weight: 500;
  color: var(--muted);
}
.tab.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.loading { margin-inline-start: auto; }
.spinner {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--accent); animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* tier list */
.tier-list { display: flex; flex-direction: column; gap: 8px; }
.tier {
  display: grid; grid-template-columns: 92px 1fr; min-height: 112px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.tier-label {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--tier-ink); padding: 8px; text-align: center;
}
.tier-label b { font-size: 34px; font-weight: 800; line-height: 1; }
.tier-label span { font-size: 11.5px; font-weight: 600; opacity: .8; }
.tier-S .tier-label { background: var(--tier-S); }
.tier-A .tier-label { background: var(--tier-A); }
.tier-B .tier-label { background: var(--tier-B); }
.tier-C .tier-label { background: var(--tier-C); }
.tier-D .tier-label { background: var(--tier-D); }
.tier-cards { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px; align-content: flex-start; }
.tier-empty { color: var(--faint); font-size: 13px; align-self: center; padding: 0 8px; }

.card {
  width: 212px; text-align: start; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2);
  padding: 12px; display: flex; flex-direction: column; gap: 6px; transition: transform .12s, box-shadow .12s, border-color .12s;
  position: relative;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: transparent; }
.card-head { display: flex; align-items: center; gap: 9px; }
.badge {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800;
  font-size: 12.5px; flex: none; letter-spacing: -.02em; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
}
.card-name { font-weight: 700; line-height: 1.2; }
.card-branch { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.card-total { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.card-diff { font-size: 12.5px; color: var(--danger); font-weight: 500; }
.card-diff.best { color: var(--accent); }
.card-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.card-id { min-width: 0; flex: 1; }
.rank { align-self: flex-start; font-size: 12px; font-weight: 700; color: var(--faint); }
[dir="ltr"] .qty { flex-direction: row-reverse; }

/* matrix */
.matrix-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 70vh; }
table.matrix { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
.matrix th, .matrix td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: center; }
.matrix thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; font-weight: 600; vertical-align: bottom; }
.matrix th.item-col, .matrix td.item-col {
  position: sticky; inset-inline-start: 0; background: var(--surface); text-align: start; z-index: 1; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; font-weight: 500;
}
.matrix thead th.item-col { z-index: 3; }
.matrix .col-head { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.matrix .col-head .badge { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
.matrix td.best { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.matrix td.miss { color: var(--danger); background: var(--danger-soft); }
.matrix td .promo-dot { color: var(--promo); font-size: 10px; vertical-align: super; }
.matrix tfoot td { font-weight: 800; position: sticky; bottom: 0; background: var(--surface-2); border-top: 2px solid var(--line); }
.matrix td small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; margin: 0 auto; }

.site-foot { text-align: center; color: var(--faint); font-size: 12px; padding: 4px 16px 20px; }
.site-foot a { color: inherit; }
.footnote { color: var(--faint); font-size: 12px; margin-top: 16px; line-height: 1.6; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 12, 16, .38); z-index: 40; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(520px, 100vw); background: var(--surface);
  z-index: 41; box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  transform: translateX(-105%); transition: transform .22s ease;
}
[dir="ltr"] .drawer { transform: translateX(105%); }
.drawer.open { transform: none !important; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.drawer-body { overflow: auto; padding: 8px 18px 24px; }
.dh { display: flex; gap: 12px; align-items: center; }
.dh .badge { width: 44px; height: 44px; font-size: 15px; border-radius: 12px; }
.dh-name { font-weight: 800; font-size: 18px; }
.dh-sub { color: var(--muted); font-size: 13px; }
.receipt { list-style: none; margin: 8px 0; padding: 0; }
.receipt li { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px dashed var(--line); align-items: flex-start; }
.r-main { flex: 1; min-width: 0; }
.r-q { font-size: 12px; color: var(--muted); }
.r-name { font-weight: 500; }
.r-meta { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.r-price { text-align: end; white-space: nowrap; font-weight: 700; }
.r-price small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.r-price s { color: var(--faint); font-weight: 400; font-size: 12px; }
.receipt li.missing .r-name { color: var(--danger); }
.receipt-total { display: flex; justify-content: space-between; font-size: 20px; font-weight: 800; padding: 14px 0; border-top: 2px solid var(--text); }
.branches h4 { margin: 18px 0 6px; font-size: 14px; }
.branches li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.branches ul { list-style: none; padding: 0; margin: 0; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(10, 12, 16, .45); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal {
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); width: min(560px, 100%);
  max-height: calc(100vh - 32px); overflow: auto; padding: 26px; position: relative; animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-x { position: absolute; inset-inline-end: 14px; top: 14px; }
.modal h3 { margin: 0 0 6px; font-size: 21px; }
.modal p.lead { color: var(--muted); margin: 0 0 16px; }
.city-search {
  width: 100%; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2);
  padding: 0 14px; outline: none;
}
.city-search:focus { border-color: var(--accent); }
.city-grid { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; max-height: 240px; overflow: auto; }
.city {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px; font-size: 14px;
}
.city small { color: var(--muted); }
.city.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.city.on small { color: inherit; opacity: .8; }
.btn {
  height: 44px; padding: 0 20px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 15px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.modal-actions { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 16px; }
.or { color: var(--muted); font-size: 13.5px; }

.progress-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.progress-list li {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2);
  font-size: 13.5px; border: 1px solid var(--line);
}
.progress-list .badge { width: 26px; height: 26px; font-size: 10.5px; border-radius: 7px; }
.progress-list .p-name { flex: 1; font-weight: 600; }
.progress-list .p-st { color: var(--muted); font-size: 12px; white-space: nowrap; }
.progress-list .p-st.done { color: var(--accent); }
.progress-list .p-st.error { color: var(--danger); }
.progress-bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.progress-bar div { height: 100%; background: var(--accent); transition: width .4s; }

.settings-section { margin-top: 18px; }
.settings-section h4 { margin: 0 0 8px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.chain-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.toggle {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; font-size: 14px; user-select: none;
}
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.toggle .badge { width: 22px; height: 22px; font-size: 9.5px; border-radius: 6px; }
.toggle small { color: var(--muted); margin-inline-start: auto; }
textarea.paste {
  width: 100%; min-height: 200px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2);
  padding: 12px; outline: none; resize: vertical;
}
textarea.paste:focus { border-color: var(--accent); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; animation: pop .15s;
}
.toast button { margin-inline-start: 10px; background: none; border: 0; color: var(--accent); font-weight: 700; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; padding: 12px; }
  .list-panel { position: static; max-height: none; }
  .items { max-height: none; }
  .summary { grid-template-columns: 1fr 1fr; }
  .summary .winner { grid-column: 1 / -1; }
  .topbar { padding: 10px 12px; }
  .brand-sub { display: none; }
}
@media (max-width: 560px) {
  .card { width: 100%; }
  .tier { grid-template-columns: 64px 1fr; }
  .tier-label b { font-size: 26px; }
  .tier-label span { display: none; }
  .progress-list, .chain-toggles { grid-template-columns: 1fr; }
  #statusLabel { display: none; }
}

/* product photos */
.thumb {
  flex: none; width: 40px; height: 40px; border-radius: 10px; background: #fff; border: 1px solid var(--line);
  display: inline-grid; place-items: center; overflow: hidden; font-size: 20px; position: relative;
}
.thumb.sm { width: 36px; height: 36px; font-size: 18px; }
.thumb.md { width: 52px; height: 52px; font-size: 24px; }
.thumb.ph { background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: contain; transition: transform .15s; }
.thumb:not(.ph):hover { overflow: visible; z-index: 5; }
.thumb:not(.ph):hover img { transform: scale(3.2); background: #fff; border-radius: 8px; box-shadow: var(--shadow-lg); }

.progress-list .p-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.progress-list .p-msg { font-size: 11.5px; color: var(--danger); overflow-wrap: anywhere; }
.progress-list .p-st.no_stores { color: var(--warn); }
textarea.log { font: 11.5px/1.4 ui-monospace, Menlo, Consolas, monospace; min-height: 260px; margin-top: 10px; white-space: pre; }

/* product & branch pickers */
.pv-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.pv-head h4 { margin: 0; }
.pv-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.pick-btn {
  border: 1px solid var(--accent); color: var(--accent); background: var(--accent-soft); border-radius: 8px;
  font-size: 12px; font-weight: 600; padding: 3px 9px; white-space: nowrap;
}
.pick-list { max-height: 52vh; overflow: auto; margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.pick-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer; font-size: 13.5px;
}
.pick-row.on { border-color: var(--accent); background: var(--accent-soft); }
.pick-row input { accent-color: var(--accent); width: 17px; height: 17px; flex: none; }
.pick-row .pv-name small { display: block; color: var(--muted); font-size: 12px; }
.pick-row .badge { width: 30px; height: 30px; font-size: 11px; }
.chain-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.chain-chips .chip { cursor: pointer; font-size: 12.5px; padding: 3px 10px; }
.chain-chips .chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.suggest li.free { font-weight: 600; color: var(--accent); }
.progress-list .p-msg.done, .progress-list .p-msg.no_stores { color: var(--warn); }

/* chain logos */
.badge { position: relative; overflow: hidden; }
.badge img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 3px; opacity: 0; }
.badge.has-logo { background: #fff !important; color: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.badge.has-logo img { opacity: 1; }

/* produce: pieces / kg */
.qty-col { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: none; }
.measure { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.measure button { border: 0; background: var(--surface); color: var(--muted); font-size: 10.5px; padding: 1px 6px; }
.measure button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pill.static { cursor: default; }
.estimate-note { margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2, rgba(127,127,127,.08));
  color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.match-note { margin: 0 0 12px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.card-more { margin-top: 8px; color: var(--muted); font-size: 12px; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: 10px;
  background: var(--text); color: var(--bg); font-weight: 600; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; } }
