/* ===== Tokens ===== */
:root {
  color-scheme: light dark;
  --bg: #f3f3f4;
  --surface: #ffffff;
  --surface-2: #f7f7f8;
  --fill: #ececee;
  --fill-2: #e1e1e5;
  --line: #e5e5e8;
  --line-2: #d4d4d8;
  --text: #18181b;
  --text-2: #4a4a52;
  --text-3: #6e6e77;
  --text-4: #a1a1aa;
  --accent: #26262a;
  --accent-press: #3f3f46;
  --on-accent: #fafafa;
  --knob: #ffffff;
  --seg-on: #ffffff;
  --danger: #b42318;
  --danger-bg: #fbeceb;
  --ring: rgba(24, 24, 27, 0.13);
  --shadow: 0 1px 2px rgba(16, 16, 20, 0.04), 0 2px 10px rgba(16, 16, 20, 0.035);
  --sheet-shadow: 0 -10px 40px rgba(0, 0, 0, 0.12);
  --backdrop: rgba(9, 9, 11, 0.38);
  --toast: #26262a;
  --sw-ring: rgba(0, 0, 0, 0.16);
  --r: 16px;
  --tab-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --surface: #1b1b1e;
    --surface-2: #212125;
    --fill: #26262b;
    --fill-2: #313137;
    --line: #2a2a30;
    --line-2: #3b3b42;
    --text: #f2f2f3;
    --text-2: #c7c7ce;
    --text-3: #9b9ba4;
    --text-4: #6c6c75;
    --accent: #e9e9ec;
    --accent-press: #d4d4d8;
    --on-accent: #18181b;
    --knob: #d4d4d8;
    --seg-on: #3a3a41;
    --danger: #f2877d;
    --danger-bg: #3a1a17;
    --ring: rgba(255, 255, 255, 0.14);
    --shadow: none;
    --sheet-shadow: 0 -10px 40px rgba(0, 0, 0, 0.55);
    --backdrop: rgba(0, 0, 0, 0.58);
    --toast: #3a3a41;
    --sw-ring: rgba(255, 255, 255, 0.28);
  }
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
@media (hover: hover) and (pointer: fine) { html { scrollbar-gutter: stable; } }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
html.locked, html.locked body { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
a { color: inherit; text-decoration: none; touch-action: manipulation; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--text-3); outline-offset: 2px; }
::selection { background: var(--fill-2); }

.i {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.muted { color: var(--text-3); }
.small { font-size: 13.5px; }
.nowrap { white-space: nowrap; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 12px; }
.mt2 { margin-top: 20px; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.hstack { display: flex; align-items: center; gap: 10px; }

/* ===== Layout ===== */
#app { max-width: 680px; margin: 0 auto; min-height: 100dvh; }
#view { min-height: 100dvh; }
.view { padding: 0 16px calc(var(--tab-h) + var(--safe-b) + 28px); animation: view-in 0.16s ease-out; }
body.no-tabs .view { padding-bottom: calc(var(--safe-b) + 104px); }
.view.has-ab { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 108px); }
body.no-tabs .view.has-ab { padding-bottom: calc(var(--safe-b) + 108px); }
@keyframes view-in { from { opacity: 0; } to { opacity: 1; } }

.top {
  position: sticky; top: 0; z-index: 10;
  margin: 0 -16px; padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: var(--bg);
  transition: box-shadow 0.2s;
}
.top.scrolled { box-shadow: 0 1px 0 var(--line); }
.top-row { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.top h1 { flex: 1; min-width: 0; font-size: 25px; font-weight: 700; letter-spacing: -0.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top.sub h1 { font-size: 18px; font-weight: 650; letter-spacing: -0.005em; }
.top .back { margin-left: -8px; }
.top-sub { color: var(--text-3); font-size: 14px; margin-top: 2px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: inline-grid; place-items: center; color: var(--text);
  transition: background 0.15s;
  position: relative;
}
.icon-btn:active { background: var(--fill); }
.icon-btn:disabled { opacity: 0.4; }

/* ===== Search, chips, segmented ===== */
.search { position: relative; margin-top: 8px; }
.search > .i { position: absolute; left: 12px; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--text-3); pointer-events: none; }
.search input {
  width: 100%; height: 44px; border: 0; border-radius: 12px;
  padding: 0 42px; background: var(--fill); font-size: 16px; appearance: none;
  transition: background 0.15s, box-shadow 0.15s;
}
.search input::placeholder { color: var(--text-3); opacity: 1; }
.search input:focus { background: var(--surface); box-shadow: 0 0 0 1px var(--line-2), 0 0 0 4px var(--ring); }
.search input::-webkit-search-cancel-button, .search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.search .clear { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--text-3); }

.chips {
  display: flex; gap: 8px; overflow-x: auto; margin: 10px -16px 0; padding: 0 16px 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--fill); color: var(--text-2); font-size: 14px; font-weight: 550; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.chip .n { margin-left: 5px; opacity: 0.65; font-variant-numeric: tabular-nums; }

.seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--fill); }
.seg button {
  flex: 1; min-width: 0; height: 36px; padding: 0 6px; border-radius: 9px;
  font-size: 14px; font-weight: 550; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }

/* ===== Catalog cards ===== */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow);
  transition: transform 0.12s var(--ease);
  content-visibility: auto; contain-intrinsic-size: auto 290px;
}
.card:active { transform: scale(0.982); }
.card-img { position: relative; aspect-ratio: 1; background: var(--fill); overflow: hidden; }
.card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-4); }
.ph .i { width: 30px; height: 30px; stroke-width: 1.4; }
.card-body { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; min-width: 0; }
.card-name { font-size: 15px; font-weight: 550; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card-meta { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-price { margin-top: auto; padding-top: 6px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.card-stock { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; min-height: 18px; }
.card.out .card-img img { opacity: 0.45; filter: grayscale(1); }
.card.out .card-price { color: var(--text-3); }
.in-cart {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px;
  display: inline-grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font-size: 12.5px; font-weight: 650;
}
.rows { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.rows .card { flex-direction: row; min-height: 92px; contain-intrinsic-size: auto 96px; }
.rows .card-img { width: 92px; aspect-ratio: auto; flex: none; }
.rows .card-body { padding: 10px 44px 10px 12px; }
.rows .card-price { padding-top: 4px; }
.rows .in-cart { top: 50%; margin-top: -13px; right: 12px; }

.dots { display: flex; align-items: center; gap: 4px; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--c, var(--fill-2)); box-shadow: inset 0 0 0 1px var(--sw-ring); }
.dot.off { opacity: 0.3; }
.dots .more { font-size: 11.5px; color: var(--text-3); margin-left: 2px; }

img.fade { opacity: 0; transition: opacity 0.25s ease; }
img.fade.ld { opacity: 1; }
img.fade.err { visibility: hidden; }

/* ===== Lists ===== */
.list { margin-top: 12px; overflow: hidden; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
.list-title { margin: 22px 4px 0; font-size: 13px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; width: 100%; text-align: left; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--line); }
a.row, button.row { transition: background 0.12s; }
a.row:active, button.row:active { background: var(--surface-2); }
.row .title { font-weight: 550; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .title.wrap { white-space: normal; overflow-wrap: anywhere; }
.row .sub { margin-top: 2px; font-size: 13.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { flex: none; text-align: right; }
.row .chev { color: var(--text-4); width: 18px; height: 18px; flex: none; margin-right: -4px; }
.row.dim .title, .row.dim .thumb { opacity: 0.5; }
.thumb {
  position: relative; flex: none; width: 48px; height: 48px; overflow: hidden;
  border-radius: 11px; background: var(--fill); color: var(--text-4);
  display: grid; place-items: center;
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb .i { width: 20px; height: 20px; stroke-width: 1.5; }
.thumb.lg { width: 64px; height: 64px; border-radius: 12px; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px;
  background: var(--fill); color: var(--text-2); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.pill.new { background: var(--accent); color: var(--on-accent); }
.pill.accepted { background: var(--fill-2); color: var(--text); }
.pill.done { background: transparent; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.pill.cancelled { color: var(--text-3); }
.pill.warn { background: var(--danger-bg); color: var(--danger); }
.pill .i { width: 14px; height: 14px; stroke-width: 2.2; }

/* ===== Panels & forms ===== */
.panel { margin-top: 12px; padding: 16px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
.panel > h2, .panel-h { font-size: 17px; font-weight: 650; letter-spacing: -0.005em; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.panel-h h2 { font-size: 17px; font-weight: 650; flex: 1; }
.panel p { color: var(--text-2); line-height: 1.5; }
.panel p + p { margin-top: 8px; }

.field { display: block; margin-top: 14px; }
.field:first-child, .panel > h2 + .field, .panel-h + .field { margin-top: 0; }
.label { display: block; margin: 0 0 6px 2px; font-size: 13.5px; font-weight: 550; color: var(--text-2); }
.label .opt-mark { font-weight: 400; color: var(--text-3); }
.input {
  width: 100%; height: 48px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface);
  font-size: 16px; appearance: none; -webkit-appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--text-4); opacity: 1; }
.input:focus { border-color: var(--text-3); box-shadow: 0 0 0 4px var(--ring); }
.input:focus-visible, .search input:focus-visible, .stepper input:focus-visible { outline: none; }
.stepper:focus-within { box-shadow: inset 0 0 0 1.5px var(--text-3); }
.input.bad { border-color: var(--danger); }
textarea.input { height: auto; min-height: 104px; padding: 12px 14px; line-height: 1.45; resize: vertical; }
select.input { padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 48px; }
.input-wrap .icon-btn { position: absolute; right: 4px; top: 4px; color: var(--text-3); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }
.hint { margin-top: 6px; font-size: 13px; color: var(--text-3); line-height: 1.45; }
.form-error { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--danger-bg); color: var(--danger); font-size: 14.5px; line-height: 1.4; }
.warn-text { color: var(--danger); font-size: 13.5px; }

.switch { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; cursor: pointer; }
.switch + .switch { border-top: 1px solid var(--line); }
.switch .txt { flex: 1; min-width: 0; }
.switch .txt small { display: block; margin-top: 2px; font-size: 13px; color: var(--text-3); line-height: 1.4; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch .track { position: relative; flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--fill-2); transition: background 0.2s; }
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--knob); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22); transition: transform 0.2s var(--ease), background 0.2s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--on-accent); }
.switch input:focus-visible + .track { outline: 2px solid var(--text-3); outline-offset: 2px; }
.switch input:disabled + .track { opacity: 0.5; }

/* ===== Buttons ===== */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 18px; border-radius: 13px;
  background: var(--fill); color: var(--text); font-size: 16px; font-weight: 600; white-space: nowrap;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  --spin: var(--text);
}
.btn:active { transform: scale(0.98); background: var(--fill-2); }
.btn.primary { background: var(--accent); color: var(--on-accent); --spin: var(--on-accent); }
.btn.primary:active { background: var(--accent-press); }
.btn.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.ghost { background: transparent; }
.btn.ghost:active { background: var(--fill); }
.btn.danger { color: var(--danger); --spin: var(--danger); }
.btn.block { display: flex; width: 100%; }
.btn.sm { height: 38px; padding: 0 14px; border-radius: 11px; font-size: 14.5px; }
.btn .i { width: 20px; height: 20px; }
.btn:disabled { opacity: 0.42; pointer-events: none; }
.btn .sub { font-weight: 500; opacity: 0.75; }
.btn.busy { pointer-events: none; color: transparent !important; }
.btn.busy > * { visibility: hidden; }
.btn.busy::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border-radius: 50%; border: 2px solid var(--spin); border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.two { flex-direction: column; gap: 0; line-height: 1.15; padding-top: 2px; }
.btn.two .sub { font-size: 12.5px; font-weight: 550; opacity: 0.72; font-variant-numeric: tabular-nums; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-row > .btn { flex: 1; }
.link-btn { color: var(--text-2); font-weight: 550; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }

.actionbar {
  position: fixed; left: 0; right: 0; z-index: 15;
  bottom: calc(var(--tab-h) + var(--safe-b));
  padding: 10px 16px; background: var(--bg); border-top: 1px solid var(--line);
}
body.no-tabs .actionbar { bottom: 0; padding-bottom: calc(10px + var(--safe-b)); }
.actionbar-in { max-width: 648px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.actionbar-in > .btn.grow { flex: 1; }

/* ===== Tab bar ===== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding-bottom: var(--safe-b); background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar-in { display: flex; max-width: 680px; height: var(--tab-h); margin: 0 auto; }
.tab {
  position: relative; flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 11px; font-weight: 550; letter-spacing: 0.01em;
  transition: color 0.15s;
}
.tab .i { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] .i { stroke-width: 2.1; }
.tab .badge {
  position: absolute; top: 5px; left: calc(50% + 5px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--surface);
}

/* ===== Sheets ===== */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: var(--backdrop); opacity: 0; transition: opacity 0.24s ease; touch-action: none; }
.sheet {
  position: relative; display: flex; flex-direction: column; width: 100%; max-width: 680px;
  max-height: calc(100dvh - var(--safe-t) - 28px);
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--sheet-shadow);
  transform: translate3d(0, 100%, 0); transition: transform 0.3s var(--ease);
  will-change: transform;
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-wrap.closing .sheet { transition: transform 0.22s cubic-bezier(0.4, 0, 1, 1); }
.sheet-wrap.closing .sheet-backdrop { transition-duration: 0.22s; }
.sheet-grip { position: absolute; top: 7px; left: 50%; z-index: 3; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--line-2); }
.sheet-head { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 14px 10px 4px 18px; flex: none; }
.sheet-head h2 { flex: 1; font-size: 18px; font-weight: 650; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0 18px 18px; }
.sheet-foot { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface); border-radius: 0; }
.sheet-x {
  position: absolute; top: 12px; right: 12px; z-index: 3; width: 36px; height: 36px; border-radius: 18px;
  display: grid; place-items: center; background: var(--surface); color: var(--text);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.14);
}
.sheet-x .i { width: 20px; height: 20px; }
.sheet .text { color: var(--text-2); line-height: 1.5; }
.sheet .btn-col { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
@media (min-width: 720px) {
  .sheet-wrap { align-items: center; padding: 24px; }
  .sheet { border-radius: 20px; max-height: min(88vh, 900px); transform: translate3d(0, 24px, 0); opacity: 0; transition: transform 0.25s var(--ease), opacity 0.2s; }
  .sheet-wrap.open .sheet { opacity: 1; }
  .sheet-wrap.closing .sheet { transition: transform 0.18s ease-in, opacity 0.18s; }
  .sheet-foot { border-radius: 0 0 20px 20px; }
  .sheet-grip { display: none; }
}

/* Product sheet */
.gallery { position: relative; margin: 0 -18px; background: var(--fill); height: min(100vw, 58dvh, 680px); border-radius: 20px 20px 0 0; overflow: hidden; }
@media (min-width: 720px) { .gallery { height: 420px; } }
.gallery-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track > div { position: relative; flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; }
.gallery-track img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.gallery .ph .i { width: 44px; height: 44px; }
.gdots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.gdots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.22); transition: width 0.2s, background 0.2s; }
.gdots i.on { width: 16px; background: rgba(0, 0, 0, 0.58); }
@media (prefers-color-scheme: dark) { .gdots i { background: rgba(255, 255, 255, 0.25); } .gdots i.on { background: rgba(255, 255, 255, 0.75); } }
.p-head { padding-top: 16px; }
.p-name { font-size: 21px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.p-meta { margin-top: 4px; font-size: 14px; color: var(--text-3); }
.p-price { margin-top: 10px; font-size: 24px; font-weight: 750; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
.p-desc { margin-top: 18px; color: var(--text-2); line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.p-avail { margin-top: 16px; display: flex; align-items: center; gap: 8px; min-height: 22px; font-size: 14.5px; color: var(--text-2); }
.p-avail b { color: var(--text); }
.opt-group { margin-top: 18px; }
.opt-label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 14px; color: var(--text-3); }
.opt-label b { color: var(--text); font-weight: 600; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; border-radius: 12px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 15px; font-weight: 550;
  transition: box-shadow 0.15s, background 0.15s, opacity 0.15s;
}
.opt[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--text); }
.opt:disabled { opacity: 0.4; cursor: default; }
.opt:disabled .opt-n { text-decoration: none; }
.opt-n { color: var(--text-3); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.sw { width: 18px; height: 18px; border-radius: 50%; background: var(--c, var(--fill-2)); box-shadow: inset 0 0 0 1px var(--sw-ring); flex: none; }

.stepper { display: inline-flex; align-items: center; flex: none; height: 48px; border-radius: 13px; background: var(--fill); }
.stepper button { width: 44px; height: 100%; display: grid; place-items: center; color: var(--text); border-radius: 13px; }
.stepper button:active { background: var(--fill-2); }
.stepper button:disabled { color: var(--text-4); background: none; }
.stepper input { width: 46px; height: 100%; padding: 0; border: 0; background: transparent; text-align: center; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper.sm { height: 36px; border-radius: 10px; }
.stepper.sm button { width: 36px; border-radius: 10px; }
.stepper.sm button .i { width: 18px; height: 18px; }
.stepper.sm input { width: 40px; font-size: 16px; }

/* ===== Cart ===== */
.cart-line { position: relative; display: flex; gap: 12px; padding: 14px 16px; }
.cart-line + .cart-line::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--line); }
.cart-line .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-right: 26px; }
.cart-line .name { font-weight: 550; line-height: 1.3; overflow-wrap: anywhere; }
.cart-line .var { font-size: 13.5px; color: var(--text-3); }
.cart-line .bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-right: 0; margin-right: -26px; }
.cart-line .sum { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.cart-line .unit { font-size: 12.5px; color: var(--text-3); font-weight: 400; }
.cart-line .rm { position: absolute; top: 8px; right: 6px; width: 36px; height: 36px; color: var(--text-4); }
.cart-line .rm .i { width: 18px; height: 18px; }
.cart-line.bad .name { color: var(--text-3); }
.totals { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 16px; padding: 0 4px; }
.totals .total { font-size: 23px; font-weight: 750; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }

/* ===== Orders ===== */
.order-row .title { display: flex; align-items: center; gap: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 15px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.quote {
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; font-size: 15.5px;
  padding: 12px 14px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 3px 0 0 var(--line-2);
}
.line-item { display: flex; gap: 12px; padding: 12px 0; }
.line-item + .line-item { border-top: 1px solid var(--line); }
.line-item .main { flex: 1; min-width: 0; }
.line-item .name { font-weight: 550; line-height: 1.3; overflow-wrap: anywhere; }
.line-item .var { font-size: 13.5px; color: var(--text-3); margin-top: 2px; }
.line-item .calc-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.line-item .calc { font-size: 13.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.line-item .sum { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.o-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.o-no { font-weight: 650; font-variant-numeric: tabular-nums; }
.o-sum { margin-left: auto; padding-left: 8px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.o-dealer { margin-top: 3px; font-size: 14.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-row .sub { margin-top: 2px; }
.sum-row { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--line); }
.sum-row b { font-size: 20px; font-variant-numeric: tabular-nums; }

/* ===== States ===== */
.empty { padding: 64px 24px; text-align: center; color: var(--text-3); line-height: 1.5; }
.empty .i { display: block; width: 46px; height: 46px; margin: 0 auto 14px; stroke-width: 1.3; color: var(--text-4); }
.empty b { display: block; margin-bottom: 4px; color: var(--text); font-size: 17px; font-weight: 650; }
.empty .btn { margin-top: 18px; }
.sk { background: var(--fill); border-radius: 12px; }
.sk-card { height: 270px; border-radius: var(--r); background: var(--fill); }
.sk-row { height: 64px; border-radius: 12px; background: var(--fill); margin-top: 8px; }
.load-more { display: flex; justify-content: center; margin-top: 16px; }
.boot { display: grid; place-items: center; }

.done-hero { padding: calc(var(--safe-t) + 72px) 12px 12px; text-align: center; }
.done-hero .ok {
  width: 76px; height: 76px; margin: 0 auto 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--on-accent);
  animation: pop 0.38s var(--ease) both;
}
.done-hero .ok .i { width: 38px; height: 38px; stroke-width: 2.4; }
.done-hero h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.done-hero p { margin-top: 8px; color: var(--text-3); line-height: 1.5; }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== Login ===== */
.login { min-height: 100dvh; max-width: 420px; margin: 0 auto; padding: calc(var(--safe-t) + 24px) 20px calc(var(--safe-b) + 24px); display: flex; flex-direction: column; justify-content: center; }
.login .logo { width: 56px; height: 56px; margin-bottom: 22px; border-radius: 16px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.login .logo .i { width: 30px; height: 30px; stroke-width: 1.7; }
.login .logo.brand { width: auto; min-width: 64px; padding: 0 14px; height: 48px; font-size: 20px; font-weight: 800; letter-spacing: 0.06em; }
.seg.sections { margin: 10px 0 2px; }
.login h1 { font-size: 27px; font-weight: 750; letter-spacing: -0.02em; }
.login .lead { margin: 6px 0 26px; color: var(--text-3); line-height: 1.45; }
.login .btn { margin-top: 22px; }
.login .foot { margin-top: 24px; font-size: 13.5px; color: var(--text-3); text-align: center; line-height: 1.5; }

/* ===== Toasts ===== */
.toasts {
  position: fixed; left: 0; right: 0; z-index: 70; bottom: calc(var(--tab-h) + var(--safe-b) + 12px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none;
}
body.no-tabs .toasts { bottom: calc(var(--safe-b) + 90px); }
body:has(.actionbar) .toasts { bottom: calc(var(--tab-h) + var(--safe-b) + 84px); }
body.no-tabs:has(.actionbar) .toasts { bottom: calc(var(--safe-b) + 84px); }
body.sheet-open .toasts { bottom: calc(var(--safe-b) + 92px); }
.toast {
  display: flex; align-items: center; gap: 12px; max-width: 520px; min-height: 48px; padding: 12px 16px;
  border-radius: 14px; background: var(--toast); color: #f6f6f7; font-size: 15px; line-height: 1.35;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22); pointer-events: auto;
  opacity: 0; transform: translate3d(0, 10px, 0); transition: opacity 0.2s, transform 0.22s var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast .i { width: 20px; height: 20px; }
.toast.err .i { color: #ff9b91; }
.toast button { flex: none; margin-left: 4px; color: #fff; font-weight: 650; font-size: 15px; padding: 4px 2px; }

/* ===== Admin ===== */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--fill); display: grid; place-items: center; color: var(--text-3); }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo.add { cursor: pointer; border: 1.5px dashed var(--line-2); background: transparent; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; font-size: 13px; font-weight: 550; }
.photo.add:active { background: var(--fill); }
.photo-main { position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 8px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 11px; font-weight: 600; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--text-3); border-right-color: transparent; animation: spin 0.7s linear infinite; }

.vhead, .vrow { display: grid; grid-template-columns: 40px minmax(0, 1fr) 84px 40px; gap: 8px; align-items: center; }
.vhead { font-size: 12.5px; color: var(--text-3); font-weight: 550; margin-bottom: 2px; }
.vhead span:nth-child(3) { padding-left: 4px; }
.vrow { margin-top: 8px; }
.vrow .icon-btn { color: var(--text-3); }
.vnote { grid-column: 2 / -1; margin-top: -2px; font-size: 13px; color: var(--danger); }
.vnote.inline { margin: 0; white-space: nowrap; }
.input.stock { text-align: center; padding: 0 8px; font-variant-numeric: tabular-nums; }
.swatch-pick { position: relative; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; background: var(--c, transparent); box-shadow: inset 0 0 0 1px var(--line-2); overflow: hidden; }
.swatch-pick::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--sw-ring); pointer-events: none; }
.swatch-pick input { position: absolute; inset: -8px; width: 56px; height: 56px; opacity: 0; cursor: pointer; border: 0; padding: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-flex; align-items: center; gap: 2px; height: 36px; padding: 0 4px 0 12px; border-radius: 10px; background: var(--fill); font-size: 15px; font-weight: 550; }
.tag button { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); }
.tag button .i { width: 16px; height: 16px; }
.tag.ghost { padding: 0 12px 0 8px; background: transparent; box-shadow: inset 0 0 0 1px dashed var(--line-2); border: 1px dashed var(--line-2); color: var(--text-2); }
.tag.ghost .i { width: 16px; height: 16px; }
.matrix { display: flex; flex-direction: column; }
.mrow { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 4px 0; }
.mrow + .mrow { border-top: 1px solid var(--line); }
.mrow .input.stock { width: 96px; flex: none; }

.prices { margin-top: 10px; }
.prow { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 4px 0; }
.prow + .prow { border-top: 1px solid var(--line); }
.prow .title { display: block; font-weight: 550; }
.prow .sub { display: block; font-size: 12.5px; color: var(--text-3); }
.prow.dim .title { color: var(--text-3); }
.input.price { width: 150px; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.price-row { gap: 10px; padding-right: 12px; }
.price-row .title, .price-row .sub { display: block; }
.price-row .input.price { width: 120px; padding: 0 10px; }
.clamp2 { white-space: normal !important; display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

.chats { margin: 4px 0 4px; }
.chat-row { display: flex; align-items: center; gap: 4px; }
.chat-row + .chat-row { border-top: 1px solid var(--line); }
.chat-row .icon-btn { color: var(--text-4); }
.steps { margin: 14px 0 4px; padding-left: 22px; color: var(--text-2); line-height: 1.5; font-size: 14.5px; }
.steps li + li { margin-top: 6px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; padding: 1px 5px; border-radius: 6px; background: var(--fill); }
details.more summary { cursor: pointer; color: var(--text-2); font-size: 14.5px; font-weight: 550; list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+"; font-weight: 600; width: 14px; text-align: center; }
details.more[open] summary::before { content: "–"; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
