:root {
  /* ── Avrora brand palette ── */
  --bg:        #F4F4F1;
  --surface:   #FFFFFF;
  --surface-2: #F3F2EF;
  --ink:       #1C1C1E;
  --ink-2:     #5E5E64;
  --ink-3:     #9C9CA4;
  --line:      rgba(20,20,30,0.08);
  --line-2:    rgba(20,20,30,0.045);

  --yellow:      #FFD400;
  --yellow-deep: #FFC400;
  --yellow-soft: #FFF3C9;
  --red:      #E51B22;
  --red-deep: #C9131A;
  --red-soft: rgba(229,27,34,0.10);

  /* legacy aliases kept so existing rules resolve to the brand */
  --accent:    var(--yellow);
  --accent-ink:#1C1C1E;
  --accent-bg: var(--yellow-soft);

  --ok:    #1E9E57;  --ok-bg:   rgba(30,158,87,0.14);
  --bad:   #E51B22;  --bad-bg:  rgba(229,27,34,0.10);
  --warn:  #E08600;  --warn-bg: rgba(224,134,0,0.15);

  /* soft pastel tints for category-style accents (à la Avrora tiles) */
  --pink:   #FFDDE6; --mint: #D2F0E7; --sky: #D6E9FA; --peach: #FCE6C8; --lilac: #E9E1F8;

  --r-lg: 22px; --r: 16px; --r-sm: 13px;
  --shadow-sm: 0 2px 8px rgba(30,30,45,0.05);
  --shadow-md: 0 8px 24px rgba(30,30,45,0.08);
  --shadow-lg: 0 22px 54px rgba(30,30,45,0.16), 0 6px 16px rgba(30,30,45,0.08);
  --shadow-yellow: 0 8px 20px rgba(255,200,0,0.45);

  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.5;
}
::selection { background: var(--yellow); color: var(--ink); }
.num, .mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ───────────────────────── App shell ───────────────────────── */
.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px;
  background: #FFFFFF;
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; color: var(--red); font-weight: 900; font-size: 20px;
  background: var(--yellow);
  box-shadow: var(--shadow-yellow);
  animation: bob 4.5s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-2px) rotate(-3deg); } }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 12px; border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 14.5px; font-weight: 700; color: var(--ink-2);
  border-radius: 13px; transition: background 0.16s, color 0.16s, transform 0.1s;
}
.nav-item .ic { width: 19px; height: 19px; transition: transform 0.16s; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item:active { transform: scale(0.98); }
.nav-item.active { background: var(--yellow-soft); color: var(--ink); }
.nav-item.active .ic { color: var(--red); transform: scale(1.08); }

.side-foot { margin-top: auto; padding: 6px 4px 0; }

.ic { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 999px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.status-pill.ok::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; box-shadow: 0 0 0 3px var(--ok-bg); }

/* ───────────────────────── Content ───────────────────────── */
.content { margin-left: var(--sidebar-w); min-height: 100vh; padding: 40px clamp(20px, 5vw, 64px) 80px; max-width: 1180px; }
.mobilebar { display: none; }

.view { display: none; }
.view.active { display: block; animation: rise 0.34s cubic-bezier(0.22,1,0.36,1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.view-head { margin-bottom: 22px; }
.view-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; margin: 0; }
.lead { color: var(--ink-2); font-size: 15px; margin: 7px 0 0; max-width: 60ch; }

/* ───────────────────────── Panels & fields ───────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.panel.narrow { max-width: 420px; }
.panel-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin: 0 0 16px; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); letter-spacing: 0.01em; }
.field-label em { font-weight: 500; color: var(--ink-3); font-style: normal; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row > .field { flex: 1; min-width: 160px; margin-bottom: 16px; }

input, select {
  font-family: inherit; font-size: 15px; color: var(--ink);
  padding: 13px 15px; border: 1.5px solid transparent; border-radius: var(--r-sm);
  background: var(--surface-2); transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  width: 100%; min-width: 0; max-width: 100%;
}
/* WebKit date inputs ignore width:100% and keep an intrinsic min-width → overflow on
   narrow screens. Force them to shrink to the field. */
input[type="date"] { -webkit-appearance: none; appearance: none; }
input::placeholder { color: var(--ink-3); }
input:focus, select:focus { outline: none; border-color: var(--yellow-deep); background: #fff; box-shadow: 0 0 0 4px var(--yellow-soft); }
input[type="date"] { min-height: 49px; }
input[type="file"] { padding: 10px; font-size: 13.5px; }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239596A0' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}

/* ───────────────────────── Buttons ───────────────────────── */
.btn-primary {
  font-family: inherit; font-size: 15px; font-weight: 800; color: var(--ink); cursor: pointer;
  background: var(--yellow); border: none; border-radius: 14px;
  padding: 13px 24px; box-shadow: var(--shadow-yellow);
  transition: transform 0.08s cubic-bezier(.2,1.4,.4,1), box-shadow 0.18s, background 0.15s, opacity 0.15s; white-space: nowrap;
}
.btn-primary:hover { background: var(--yellow-deep); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(255,200,0,0.5); }
.btn-primary:active { transform: translateY(1px) scale(0.985); }
.btn-primary.block { display: block; width: 100%; padding: 16px; font-size: 16px; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; background: var(--surface-2); color: var(--ink-3); }

.btn-cam {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: inherit; font-size: 15px; font-weight: 800; color: var(--ink); cursor: pointer;
  background: var(--yellow); border: none; border-radius: 14px; padding: 13px 22px;
  box-shadow: var(--shadow-yellow); transition: transform 0.08s, box-shadow 0.18s, background 0.15s;
}
.btn-cam .ic { width: 19px; height: 19px; stroke: var(--ink); }
.btn-cam:hover { background: var(--yellow-deep); }
.btn-cam:active { transform: translateY(1px) scale(0.985); }
.btn-soft {
  font-family: inherit; font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer;
  background: var(--surface-2); border: 1.5px solid transparent; border-radius: 14px; padding: 13px 20px;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
.btn-soft:hover { background: #fff; border-color: var(--line); }
.btn-soft:active { transform: scale(0.985); }
.btn-link { font-family: inherit; font-size: 14px; font-weight: 700; color: var(--red); background: none; border: none; cursor: pointer; padding: 6px 8px; border-radius: 8px; transition: background 0.15s; }
.btn-link:hover { background: var(--red-soft); }

/* ───────────────────────── Uploader ───────────────────────── */
.uploader {
  position: relative; overflow: hidden; text-align: center; cursor: pointer;
  border: 2px dashed rgba(255,196,0,0.55); border-radius: var(--r);
  background: radial-gradient(120% 100% at 50% 0%, var(--yellow-soft), transparent 70%), var(--surface-2);
  padding: 32px 20px 28px; margin: 4px 0 6px; transition: border-color 0.18s, background 0.18s, transform 0.12s;
}
.uploader:hover { border-color: var(--yellow-deep); }
.uploader.drag { border-color: var(--yellow-deep); background: var(--yellow-soft); transform: scale(1.008); }
.up-glow { position: absolute; inset: -40% 30% auto 30%; height: 120px; background: radial-gradient(closest-side, rgba(255,200,0,0.35), transparent); filter: blur(22px); pointer-events: none; }
.up-icon { width: 42px; height: 42px; stroke: var(--ink); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; position: relative; animation: float 3.5s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.uploader:hover .up-icon { stroke: var(--red); }
.up-title { font-weight: 800; font-size: 16px; margin: 12px 0 16px; }
.up-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; position: relative; }
.up-hint { font-size: 12.5px; color: var(--ink-3); margin: 16px 0 0; }

.thumbs { display: flex; flex-wrap: wrap; gap: 11px; margin: 16px 0 4px; }
.thumb { position: relative; width: 92px; height: 92px; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--line); animation: pop 0.28s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: none; } }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .rm { position: absolute; top: 5px; right: 5px; width: 23px; height: 23px; border: none; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer; font-size: 14px; line-height: 1; backdrop-filter: blur(4px); transition: background 0.15s, transform 0.1s; }
.thumb .rm:hover { background: var(--red); }
.thumb .rm:active { transform: scale(0.9); }

/* ───────────────────────── Segmented (reports mode) ───────────────────────── */
.seg { position: relative; display: inline-flex; gap: 2px; padding: 4px; background: var(--surface-2); border-radius: 14px; margin-bottom: 18px; }
.seg-btn { position: relative; z-index: 1; border: none; background: transparent; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 700; color: var(--ink-2); padding: 10px 24px; border-radius: 11px; transition: color 0.18s; }
.seg-btn.active { color: var(--ink); }
.seg-glider { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); background: var(--yellow); border-radius: 11px; box-shadow: 0 2px 8px rgba(255,200,0,0.5); transition: transform 0.3s cubic-bezier(0.34,1.56,0.5,1); }
.seg[data-active="cross"] .seg-glider { transform: translateX(100%); }

.filters { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.filters[hidden] { display: none; }
.filters .field { margin-bottom: 0; flex: 0 1 auto; }
.filters .field.grow { flex: 1 1 240px; }
.filters .field.date { width: 168px; flex: 0 0 auto; }

/* ───────────────────────── Results: KPI + tables ───────────────────────── */
.results { margin-top: 4px; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 2px 14px; flex-wrap: wrap; }
.export-btn { padding: 9px 16px; font-size: 13px; white-space: nowrap; flex: 0 0 auto; }

/* expandable report rows (cross-report drill-down) */
.xrow { cursor: pointer; }
.xrow td:first-child { display: flex; align-items: center; gap: 6px; }
.xchev { color: var(--ink-3); font-size: 11px; transition: transform 0.18s; flex: 0 0 auto; }
.xrow.open .xchev { transform: rotate(90deg); }
.xrow.open { background: var(--yellow-soft); }
.xdetail > td { background: var(--surface-2); padding: 0 !important; border-bottom: 1px solid var(--line); }
.xbox { padding: 12px 14px; }
.xbox .spinner { margin: 6px; }
.subtable { font-size: 13px; background: transparent; }
.subtable thead th { background: transparent; padding: 8px 10px; }
.subtable tbody td { padding: 9px 10px; }
.subtable tbody tr:hover { background: rgba(255,255,255,0.5); }
.section-cap { font-size: 13px; font-weight: 700; color: var(--ink-2); letter-spacing: 0.01em; }
.section-cap b { color: var(--ink); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 13px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow-sm); position: relative; animation: rise 0.4s cubic-bezier(0.22,1,0.36,1) backwards; }
.kpi .v { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.kpi .k { font-size: 12px; font-weight: 700; color: var(--ink-3); margin-top: 8px; }
.kpi.ok   { background: var(--mint);  border-color: transparent; } .kpi.ok .v   { color: var(--ok); }
.kpi.bad  { background: var(--red-soft); border-color: transparent; } .kpi.bad .v  { color: var(--bad); }
.kpi.warn { background: var(--peach); border-color: transparent; } .kpi.warn .v { color: var(--warn); }
.kpi.accent { background: var(--yellow); border-color: transparent; box-shadow: var(--shadow-yellow); }
.kpi.accent .v { color: var(--ink); } .kpi.accent .k { color: rgba(0,0,0,0.6); }

.tablecard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); text-align: left; padding: 14px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.col-code { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.col-price { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.tag-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 11px; display: block; box-shadow: var(--shadow-sm); border: 1px solid var(--line); cursor: zoom-in; transition: transform 0.14s; }
.tag-thumb:hover { transform: scale(1.08); }

.badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 5px 11px; border-radius: 999px; white-space: nowrap; letter-spacing: 0.01em; }
.badge.OK { background: var(--ok-bg); color: var(--ok); }
.badge.MISMATCH { background: var(--bad-bg); color: var(--bad); }
.badge.NOT_FOUND { background: rgba(20,20,30,0.07); color: var(--ink-2); }
.badge.UNREADABLE { background: var(--warn-bg); color: var(--warn); }
.chip-name-only { display: inline-block; font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 7px; background: var(--warn-bg); color: var(--warn); white-space: nowrap; vertical-align: middle; margin-left: 2px; }
.delta-bad { color: var(--bad); font-weight: 800; }

/* ───────────────────────── Scan results cards ───────────────────────── */
.photo-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 16px; animation: rise 0.35s cubic-bezier(0.22,1,0.36,1) backwards; }
.photo-head { display: flex; gap: 14px; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.photo-head img { width: 60px; height: 60px; object-fit: cover; border-radius: 13px; box-shadow: var(--shadow-sm); }
.photo-head .meta { font-size: 13.5px; color: var(--ink-2); font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag-row { display: flex; align-items: center; gap: 13px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.tag-row:last-child { border-bottom: none; }
.tag-main { flex: 1; min-width: 0; }
.tag-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-sub { font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.tag-price { text-align: right; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.tag-price .big { font-family: var(--mono); font-size: 17px; font-weight: 800; color: var(--ink); }
.warns { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.warn-chip { font-size: 10px; padding: 2px 8px; border-radius: 7px; background: var(--warn-bg); color: var(--warn); font-weight: 800; }

/* ───────────────────────── Score seal (Avrora-style stamp) ───────────────────────── */
.seal {
  position: relative; display: grid; place-items: center; flex: 0 0 auto;
  width: 78px; height: 78px; --seal-bg: var(--red);
  background: var(--seal-bg); border-radius: 19px; transform: rotate(14deg);
  filter: drop-shadow(0 7px 14px rgba(0,0,0,0.20));
  animation: stampIn 0.55s cubic-bezier(0.2,1.5,0.45,1) backwards;
}
.seal.good { --seal-bg: var(--ok); }
.seal::before, .seal::after { content: ""; position: absolute; inset: 0; background: var(--seal-bg); border-radius: 19px; }
.seal::before { transform: rotate(30deg); }
.seal::after  { transform: rotate(60deg); }
.seal > span { position: relative; z-index: 1; transform: rotate(-14deg); color: #fff; font-weight: 800; font-size: 19px; line-height: 1; text-align: center; }
.seal > span small { display: block; font-size: 8.5px; font-weight: 800; opacity: 0.9; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.05em; }
@keyframes stampIn { 0% { opacity: 0; transform: rotate(14deg) scale(1.8); } 60% { opacity: 1; } 100% { opacity: 1; transform: rotate(14deg) scale(1); } }

/* ───────────────────────── Admin extras ───────────────────────── */
.admin-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.admin-mode { font-size: 13px; font-weight: 800; color: var(--ink-2); }
.lock-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--yellow-soft); margin: 4px auto 14px; }
.lock-icon svg { width: 24px; height: 24px; fill: none; stroke: var(--red); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.panel.narrow .panel-title { text-align: center; }
.db-status { font-size: 14px; color: var(--ink-2); margin-bottom: 16px; }
.db-status b { color: var(--ink); }
.hint { font-size: 12.5px; color: var(--ink-3); margin: 10px 0 14px; }
.cost-banner { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; background: var(--yellow-soft); border: 1px solid rgba(255,196,0,0.4); border-radius: var(--r); padding: 15px 17px; margin: 4px 0 16px; }
.cost-banner .lbl { font-size: 14px; font-weight: 700; }
.cost-banner .sub { font-size: 12.5px; color: var(--ink-2); }
.cost-banner .big { font-family: var(--mono); font-size: 22px; font-weight: 800; color: var(--red); }
.key-ok { color: var(--ok); font-weight: 800; } .key-no { color: var(--warn); font-weight: 800; }

/* ───────────────────────── Multiselect ───────────────────────── */
.multiselect { position: relative; }
.ms-toggle { width: 100%; text-align: left; font-family: inherit; font-size: 15px; padding: 13px 15px; cursor: pointer; border: 1.5px solid transparent; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink); font-weight: 600; }
.ms-toggle::after { content: "▾"; float: right; color: var(--ink-3); }
.ms-toggle:focus { outline: none; border-color: var(--yellow-deep); box-shadow: 0 0 0 4px var(--yellow-soft); }
.ms-panel { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 10px; max-height: 320px; display: flex; flex-direction: column; animation: pop 0.18s ease-out; }
.ms-panel[hidden] { display: none; }
.ms-search { margin-bottom: 8px; }
.ms-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.ms-act { flex: 1; font-family: inherit; font-size: 13px; font-weight: 700; padding: 9px; border: none; border-radius: 10px; cursor: pointer; background: var(--yellow-soft); color: var(--ink); transition: background 0.15s; }
.ms-act:hover { background: var(--yellow); }
.ms-list { overflow-y: auto; }
.ms-item { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.ms-item:hover { background: var(--surface-2); }
.ms-item input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--red); }
.ms-item .city { color: var(--ink-3); font-size: 13px; margin-left: auto; }

/* single-store autocomplete dropdown */
.combo { position: relative; }
.combo-panel { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; max-height: 280px; overflow-y: auto; -webkit-overflow-scrolling: touch; animation: pop 0.16s ease-out; }
.combo-panel[hidden] { display: none; }
.combo-item { display: flex; align-items: center; gap: 10px; padding: 12px 10px; border-radius: 11px; cursor: pointer; font-size: 14px; font-weight: 700; }
.combo-item:hover, .combo-item.active { background: var(--yellow-soft); }
.combo-item .city { color: var(--ink-3); font-size: 13px; font-weight: 600; margin-left: auto; }

.empty { text-align: center; color: var(--ink-3); padding: 30px; font-size: 14px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2.5px solid rgba(20,20,30,0.18); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -3px; margin-right: 6px; }
.spinner.ink { border-color: rgba(20,20,40,0.15); border-top-color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────────────────── Toast ───────────────────────── */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(90px); background: #1C1C1E; color: #fff; padding: 14px 22px; border-radius: 16px; font-size: 14px; font-weight: 700; box-shadow: var(--shadow-lg); opacity: 0; transition: all 0.34s cubic-bezier(0.34,1.56,0.5,1); z-index: 80; max-width: 90%; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.err { background: var(--red); }

.tabbar { display: none; }

/* ───────────────────────── Mobile ───────────────────────── */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 0 16px calc(80px + env(safe-area-inset-bottom)); max-width: none; }
  .mobilebar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 20; margin: 0 -16px 16px; padding: 12px 16px;
    background: rgba(255,255,255,0.85); backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid var(--line);
  }
  .mobilebar .brand { padding: 0; }
  .mobilebar .brand-name { font-size: 17px; }
  .mobilebar { gap: 8px; }
  .mobilebar .brand { flex: 0 0 auto; }
  .mobilebar-right { min-width: 0; flex: 0 1 auto; }
  .mobilebar .status-pill { display: none; }   /* provider/product-count not needed on mobile */

  .view-head h1 { font-size: 24px; }
  .lead { font-size: 14px; }
  .panel { padding: 18px; border-radius: var(--r); }
  .field-row { gap: 12px; }
  .field-row > .field { min-width: 100%; }
  .filters { gap: 12px; }
  .filters .field, .filters .field.date, .filters .field.grow { flex: 1 1 100%; width: 100%; }
  .filters .btn-primary { width: 100%; }
  .seg { display: flex; width: 100%; }
  .seg-btn { flex: 1; }
  input, select, .ms-toggle { font-size: 16px; }   /* avoid iOS zoom */

  .kpis { grid-template-columns: repeat(2, 1fr); gap: 11px; }
  .kpi .v { font-size: 26px; }
  .table-wrap { margin: 0; }
  table { font-size: 13px; min-width: 540px; }

  .up-actions { flex-direction: column; }
  .btn-cam, .btn-soft { width: 100%; justify-content: center; }

  .toast { left: 16px; right: 16px; transform: translateY(90px); max-width: none; }
  .toast.show { transform: translateY(0); }

  /* bottom tab bar — Avrora style: active = bold dark */
  .tabbar {
    display: flex; position: fixed; inset: auto 0 0 0; z-index: 50;
    background: rgba(255,255,255,0.92); backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .tab { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: none; cursor: pointer; font-family: inherit; font-size: 10px; font-weight: 700; color: var(--ink-3); padding: 5px 2px; border-radius: 12px; transition: color 0.15s, transform 0.1s; }
  .tab .ic { width: 22px; height: 22px; }
  .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar { padding: 7px 4px calc(7px + env(safe-area-inset-bottom)); }
  .tab.active { color: var(--ink); }
  .tab.active .ic { transform: scale(1.06); }
  .tab:active { transform: scale(0.94); }
}

/* ───────── async pipeline: statuses, progress, admin panels ───────── */
.badge.queued     { background: rgba(20,20,30,0.07); color: var(--ink-2); }
.badge.processing { background: var(--yellow-soft);  color: var(--red-deep); animation: pulse 1.6s ease-in-out infinite; }
.badge.done       { background: var(--ok-bg);        color: var(--ok); }
.badge.error      { background: var(--bad-bg);       color: var(--bad); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

.ph-skeleton { width: 60px; height: 60px; border-radius: 13px; background: linear-gradient(90deg, var(--surface-2) 25%, #ececec 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.proc-banner { background: var(--yellow-soft); border: 1px solid rgba(255,196,0,0.35); border-radius: var(--r); padding: 15px 17px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.proc-row { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 11px; }
.proc-count { margin-left: auto; color: var(--ink-2); font-weight: 800; }

.progress { height: 8px; background: rgba(20,20,30,0.08); border-radius: 999px; overflow: hidden; }
.progress-bar { position: relative; height: 100%; background: var(--yellow); border-radius: 999px; transition: width 0.45s cubic-bezier(0.34,1.4,0.5,1); overflow: hidden; }
.progress-bar::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.75), transparent); animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.panel-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface-2); border-radius: var(--r); padding: 15px 16px; }
.stat .sv { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.stat .sk { font-size: 12px; color: var(--ink-3); margin-top: 6px; font-weight: 700; }

.sub-cap { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); margin: 20px 2px 10px; display: flex; align-items: center; gap: 12px; }

.storage-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); margin: 12px 0; }
.storage-line b { color: var(--ink); }
.storage-line .progress { flex: 1; min-width: 140px; max-width: 300px; }
.storage-line .progress-bar::after { display: none; }

.q-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-2); font-size: 13.5px; color: var(--ink-2); }
.q-row .q-sub { color: var(--ink-3); font-size: 12px; margin-left: auto; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-row .btn-link { padding: 4px 6px; }

/* ───────────────────────── Custom file picker ───────────────────────── */
.file-pick { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 10px; }
.file-native { display: none; }
.file-btn { padding: 9px 16px; font-size: 14px; flex: 0 0 auto; }
.file-name { font-size: 13px; color: var(--ink-3); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ───────────────────────── Language switch ───────────────────────── */
.lang-switch { display: inline-flex; gap: 2px; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.side-foot .lang-switch { margin-bottom: 10px; }
.lang-switch button { border: none; background: transparent; font-family: inherit; font-size: 11px; font-weight: 800; color: var(--ink-3); padding: 5px 9px; border-radius: 8px; cursor: pointer; transition: background 0.15s, color 0.15s; }
.lang-switch button.active { background: var(--yellow); color: var(--ink); }
.mobilebar-right { display: flex; align-items: center; gap: 8px; }

/* ───────────────────────── Collapsible sidebar (desktop) ───────────────────────── */
.sidebar { transition: width 0.22s ease, padding 0.22s ease; }
.content { transition: margin-left 0.22s ease; }
.collapse-btn { display: flex; align-items: center; gap: 10px; width: 100%; background: transparent; border: none; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 700; color: var(--ink-3); padding: 10px 12px; border-radius: 11px; transition: background 0.15s, color 0.15s; }
.collapse-btn:hover { background: var(--surface-2); color: var(--ink); }
.collapse-btn .ic { width: 18px; height: 18px; flex: 0 0 auto; transition: transform 0.22s; }
body.sidebar-collapsed { --sidebar-w: 78px; }
body.sidebar-collapsed .brand-name,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .lang-switch,
body.sidebar-collapsed .collapse-btn span { display: none; }
body.sidebar-collapsed .sidebar { padding: 22px 14px; }
body.sidebar-collapsed .brand { justify-content: center; padding: 6px 0 18px; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 12px; }
body.sidebar-collapsed .collapse-btn { justify-content: center; padding: 12px; }
body.sidebar-collapsed .collapse-btn .ic { transform: rotate(180deg); }

/* ───────────────────────── Metric note + dynamics chart ───────────────────────── */
.metric-note { font-size: 12px; color: var(--ink-3); margin: -8px 2px 16px; line-height: 1.5; }
.metric-note b { color: var(--ink-2); font-weight: 700; }

.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 16px 18px; margin-bottom: 18px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-title { font-size: 13px; font-weight: 800; color: var(--ink-2); }
.chart-legend { font-size: 11.5px; color: var(--ink-3); font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chart-legend .lg { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart-legend .lg-bar { background: var(--yellow); }
.chart-legend .lg-line { background: var(--red); border-radius: 50%; width: 10px; height: 10px; }
.trend-svg { width: 100%; height: auto; display: block; }
.trend-svg .cx, .trend-svg .cy { fill: var(--ink-3); font-size: 10px; font-weight: 600; }

/* ───────────────────────── ShelfCheck tasks ───────────────────────── */
.btn-soft.block { display: block; width: 100%; text-align: center; }
.sk-back { margin-top: 14px; }
.sk-userbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ink-2); margin: 0 2px 12px; }
.sk-userbar a { color: var(--red); font-weight: 700; text-decoration: none; }
.sk-userbar a:hover { text-decoration: underline; }

.sk-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.sk-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 12px; cursor: pointer; font-family: inherit; transition: background .15s, border-color .15s, transform .08s; animation: rise .3s cubic-bezier(.22,1,.36,1) backwards; }
.sk-item:hover { background: #fff; border-color: var(--line); }
.sk-item:active { transform: scale(.99); }
.sk-item-thumb { width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; }
.sk-item-thumb .tag-thumb { width: 46px; height: 46px; cursor: pointer; }
.sk-ph { width: 46px; height: 46px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 800; color: var(--ink-3); }
.sk-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sk-item-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-item-sub { font-family: var(--mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge.sk-pending { background: rgba(20,20,30,0.07); color: var(--ink-2); }
.badge.sk-processing { background: var(--yellow-soft); color: var(--red-deep); animation: pulse 1.6s ease-in-out infinite; }
.badge.sk-ok { background: var(--ok-bg); color: var(--ok); }
.badge.sk-price_mismatch { background: var(--bad-bg); color: var(--bad); }
.badge.sk-missing { background: rgba(20,20,30,0.14); color: var(--ink); }
.badge.sk-unclear { background: var(--warn-bg); color: var(--warn); }
.badge.sk-timeout { background: rgba(142,142,147,0.20); color: #6c6c72; }

/* focused product card */
.sk-card { max-width: 520px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-md); overflow: hidden; animation: rise .32s cubic-bezier(.22,1,.36,1); }
.sk-card-top { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.sk-card-close { width: 32px; height: 32px; border: none; background: var(--surface-2); border-radius: 50%; cursor: pointer; font-size: 14px; color: var(--ink-2); flex: 0 0 auto; transition: background .15s, color .15s; }
.sk-card-close:hover { background: var(--bad-bg); color: var(--bad); }
.sk-card-count { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.sk-timer { margin-left: auto; font-family: var(--mono); font-weight: 800; font-size: 18px; color: var(--ink); background: var(--surface-2); padding: 5px 12px; border-radius: 999px; min-width: 66px; text-align: center; transition: background .2s, color .2s; }
.sk-timer.urgent { color: #fff; background: var(--red); animation: pulse 1s ease-in-out infinite; }
.sk-card-photo { aspect-ratio: 16 / 10; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.sk-card-photo img { width: 100%; height: 100%; object-fit: contain; }
.sk-card-ph { color: var(--ink-3); } .sk-card-ph .ic { width: 54px; height: 54px; stroke-width: 1.4; }
.sk-card-body { padding: 18px; }
.sk-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sk-type { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--red); background: var(--red-soft); padding: 4px 10px; border-radius: 999px; }
.sk-note { font-size: 11.5px; color: var(--ink-3); }
.sk-card-name { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 8px; line-height: 1.25; }
.sk-card-sku { font-family: var(--mono); font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
.sk-card-sku b { color: var(--ink); }
.sk-card-price { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; background: var(--yellow-soft); border-radius: var(--r); padding: 14px 16px; }
.sk-price-label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.sk-price-val { font-family: var(--mono); font-size: 26px; font-weight: 800; color: var(--ink); }
.sk-price-val small { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.sk-card-actions { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 10px; }

/* camera overlay (manual capture) */
.cam-overlay { position: fixed; inset: 0; z-index: 90; background: #000; }
.cam-overlay[hidden] { display: none; }
.cam-overlay video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-frame { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.cam-frame::before { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -58%); width: min(82vw, 420px); height: min(50vh, 360px); border: 2.5px dashed rgba(255,212,0,.9); border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0,0,0,.34); }
.cam-guide { position: relative; margin-bottom: 142px; color: #fff; font-size: 13.5px; font-weight: 700; text-align: center; background: rgba(0,0,0,.45); padding: 8px 14px; border-radius: 999px; max-width: 80%; }
.cam-denied { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #fff; background: rgba(0,0,0,.65); padding: 14px 18px; border-radius: 14px; font-weight: 700; font-size: 14px; text-align: center; max-width: 80%; }
.cam-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; padding: 18px 26px calc(28px + env(safe-area-inset-bottom)); }
.cam-btn { background: rgba(255,255,255,.16); color: #fff; border: none; border-radius: 999px; padding: 11px 18px; font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: transform .1s; }
.cam-btn:active { transform: scale(.96); }
.cam-shutter { width: 74px; height: 74px; border-radius: 50%; background: #fff; border: 5px solid rgba(255,255,255,.45); cursor: pointer; flex: 0 0 auto; transition: transform .1s; }
.cam-shutter:active { transform: scale(.92); }

/* result */
.sk-result { text-align: center; max-width: 520px; margin: 0 auto; }
.sk-result-seal { display: flex; justify-content: center; margin: 6px 0 14px; }
.sk-result-seal .seal { width: 96px; height: 96px; }
.sk-result-seal .seal > span { font-size: 24px; }
.sk-result-title { font-size: 22px; font-weight: 800; margin: 0 0 4px; }
.sk-result-sub { font-size: 13px; color: var(--ink-2); margin-bottom: 18px; }
.sk-msg { margin: 2px 0 18px; padding: 13px 16px; border-radius: 14px; font-weight: 800; font-size: 15px; line-height: 1.4; }
.sk-msg.good { background: var(--ok-bg); color: var(--ok); }
.sk-msg.low { background: var(--yellow-soft); color: var(--red-deep); }
.sk-msg.none { background: var(--surface-2); color: var(--ink-3); font-weight: 700; font-size: 14px; }

/* admin: dispatched campaigns list */
.sc-campaigns { margin-top: 10px; }
.sc-camp { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 11px 13px; background: var(--surface-2); border-radius: 12px; margin-top: 8px; cursor: pointer; transition: background .15s; }
.sc-camp:hover { background: #fff; }
.sc-camp.open { background: var(--yellow-soft); }
.sc-camp-chev { color: var(--ink-3); font-size: 11px; flex: 0 0 auto; transition: transform .18s; }
.sc-camp.open .sc-camp-chev { transform: rotate(90deg); }
.sc-camp-main { flex: 1; min-width: 120px; }
.sc-camp-main b { font-size: 13.5px; }
.sc-camp-sub { font-size: 12px; color: var(--ink-3); margin-left: 8px; }
.sc-camp-prog { font-size: 12.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.sc-camp-del { flex: 0 0 auto; padding: 4px 8px; }
.sc-camp-detail { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin: 4px 0 8px; padding: 8px; overflow: hidden; animation: pop .18s ease-out; }
.sc-camp-detail .spinner { margin: 8px; }

.sk-card-hint { margin: 0 18px 14px; padding: 10px 13px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: 13px; font-weight: 700; line-height: 1.4; }

/* ───────────────────────── Mobile compaction (fit core without scroll) ───────────────────────── */
@media (max-width: 860px) {
  .view-head { margin-bottom: 12px; }
  .view-head h1 { font-size: 21px; }
  .lead { display: none; }                       /* descriptive subtitle — drop on phones */
  .panel { padding: 14px; margin-bottom: 12px; }

  .proc-banner { padding: 11px 13px; margin-bottom: 12px; }
  .proc-row { margin-bottom: 8px; font-size: 13px; }
  .btn-primary.block { padding: 13px; font-size: 15px; }

  /* task list */
  .sk-panel .hint { margin: 8px 0; }
  .sk-list { gap: 6px; margin-top: 6px; }
  .sk-item { padding: 7px 10px; }
  .sk-item-thumb, .sk-item-thumb .tag-thumb, .sk-ph { width: 40px; height: 40px; }
  .sk-back { margin-top: 10px; }

  /* product card */
  .sk-card-top { padding: 10px 14px; }
  .sk-card-photo { max-height: 26vh; }
  .sk-card-body { padding: 14px; }
  .sk-badges { margin-bottom: 8px; }
  .sk-card-name { font-size: 19px; margin-bottom: 6px; }
  .sk-card-sku { margin-bottom: 10px; }
  .sk-card-price { padding: 11px 14px; }
  .sk-price-val { font-size: 23px; }
  .sk-card-actions { padding: 0 14px 14px; gap: 8px; }
  .sk-card-hint { margin: 0 14px 12px; padding: 9px 12px; }

  /* result + kpis */
  .sk-result-seal .seal { width: 84px; height: 84px; }
  .kpis { gap: 9px; }
  .kpi { padding: 14px; }
}

/* ───────────────────────── Reduced motion ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
