/* Ýyldyrym Market web shop. Colours, radii and shapes follow the Android
   app's design system (core/designsystem/Color.kt), light and dark. */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface2: #eef3f9;
  --ink: #0e1b33;
  --ink2: #5b6b86;
  --ink3: #9aa8bf;
  --line: #e7edf5;
  --photo: #ffffff;
  --primary: #2563eb;
  --primary2: #1d4ed8;
  --primary-soft: #eaf1fe;
  --accent: #f5b800;
  --accent-soft: #fef4d6;
  --success: #12b981;
  --success-ink: #0b8a60;
  --success-soft: rgba(18, 185, 129, .14);
  --warning: #b98a00;
  --warning-soft: #fef4d6;
  --error: #e5484d;
  --error-soft: rgba(229, 72, 77, .12);
  --alipay: #1677ff;
  --shadow: 0 18px 40px -28px rgba(14, 27, 51, .35);
  --radius: 22px;
  --radius-s: 14px;
  --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1017; --surface: #161c26; --surface2: #202838; --ink: #f1f5f9; --ink2: #94a3b8; --ink3: #64748b;
    --line: #283448; --primary: #3b82f6; --primary2: #2563eb; --primary-soft: #1e293b; --accent: #f59e0b;
    --accent-soft: rgba(245, 158, 11, .16); --success: #10b981; --success-ink: #34d399; --success-soft: rgba(16, 185, 129, .16);
    --warning: #f59e0b; --warning-soft: rgba(245, 158, 11, .16); --error: #ef4444; --error-soft: rgba(239, 68, 68, .16);
    --shadow: 0 18px 40px -28px rgba(0, 0, 0, .8); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1017; --surface: #161c26; --surface2: #202838; --ink: #f1f5f9; --ink2: #94a3b8; --ink3: #64748b;
  --line: #283448; --primary: #3b82f6; --primary2: #2563eb; --primary-soft: #1e293b; --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, .16); --success: #10b981; --success-ink: #34d399; --success-soft: rgba(16, 185, 129, .16);
  --warning: #f59e0b; --warning-soft: rgba(245, 158, 11, .16); --error: #ef4444; --error-soft: rgba(239, 68, 68, .16);
  --shadow: 0 18px 40px -28px rgba(0, 0, 0, .8); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; color: var(--ink); background: var(--bg); font-family: Inter, Roboto, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", Arial, sans-serif; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.2; }
p { margin: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }
svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.shell { width: min(1240px, calc(100% - 32px)); margin: 0 auto; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 300; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; }
.skip-link:focus { top: 12px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }
.center { text-align: center; justify-content: center; }
.prose { color: var(--ink2); white-space: pre-line; }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mobile-only { display: none !important; }

/* ------------------------------------------------------------------ shell */
.topbar { position: sticky; top: 0; z-index: 60; background: color-mix(in srgb, var(--bg) 88%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.topbar-row { min-height: 68px; display: flex; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 850; letter-spacing: -.025em; white-space: nowrap; }
.brand img { border-radius: 11px; }
.top-nav { display: flex; gap: 2px; }
.top-nav a { padding: 8px 12px; border-radius: 12px; color: var(--ink2); font-size: 15px; font-weight: 700; white-space: nowrap; }
.top-nav a:hover { color: var(--ink); background: var(--surface); }
.top-nav a.active { color: var(--primary); background: var(--primary-soft); }
.header-search { flex: 1; max-width: 460px; margin-left: auto; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
@media (min-width: 901px) { .header-search + .top-actions { margin-left: 0; } }
.lang-select select { height: 42px; padding: 0 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 13px; font-weight: 750; }
.icon-button { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); }
.icon-button:hover, .account-button:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.icon-button.active, .account-button.active { color: var(--primary); border-color: var(--primary); }
.account-button { height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); font-weight: 700; max-width: 180px; }
.account-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count-badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 850; line-height: 1; border: 2px solid var(--bg); }
.count-badge.accent { background: var(--accent); color: #1b1300; }
.menu-row .count-badge { position: static; border: 0; }
.view { flex: 1; outline: none; }
.page { width: min(1240px, calc(100% - 32px)); margin: 0 auto; padding: 26px 0 72px; display: flex; flex-direction: column; gap: 18px; }

.footer { padding: 22px 0; border-top: 1px solid var(--line); color: var(--ink2); font-size: 13px; }
.footer-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a:hover { color: var(--primary); }
.footer-copy { margin-left: auto; }

.tabbar { position: fixed; z-index: 70; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink3); font-size: 11.5px; font-weight: 700; }
.tabbar a.active { color: var(--primary); }
.tabbar .tab-icon { position: relative; display: grid; }
.tabbar .count-badge { top: -8px; right: -12px; border-color: var(--surface); }

/* ---------------------------------------------------------------- buttons */
.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 20px; border: 0; border-radius: 16px; background: var(--primary); color: #fff; font-weight: 800; font-size: 15px; text-align: center; transition: background .15s, transform .1s; }
.button:hover { background: var(--primary2); }
.button:active { transform: scale(.985); }
.button[disabled], .button.is-busy { opacity: .5; pointer-events: none; }
.button-ghost { background: var(--primary-soft); color: var(--primary); }
.button-ghost:hover { background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 12%); }
.button-danger { background: var(--error-soft); color: var(--error); }
.button-danger:hover { background: color-mix(in srgb, var(--error-soft) 70%, var(--error) 12%); }
.button-danger-solid { background: var(--error); }
.button-danger-solid:hover { background: color-mix(in srgb, var(--error) 85%, #000); }
.button-small { min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: 14px; }
.button-block { width: 100%; }
.alipay-button { background: var(--alipay); }
.alipay-button:hover { background: #0e5fd8; }
.link-button { padding: 0; border: 0; background: none; color: var(--primary); font-weight: 750; }
.link-button:disabled { color: var(--ink3); cursor: default; }
.link-button.small { font-size: 14px; }
.text-action { display: inline-flex; align-items: center; gap: 5px; padding: 6px 2px; border: 0; background: none; color: var(--ink2); font-size: 13px; font-weight: 700; }
.text-action svg { width: 17px; height: 17px; }
.text-action:hover { color: var(--primary); }
.text-action.danger:hover { color: var(--error); }
.round-button { position: relative; width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); }
.round-button:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.fav-round.active { color: var(--error); }
.is-busy { opacity: .6; pointer-events: none; }

/* ------------------------------------------------------------------- page */
.page-head { display: flex; align-items: center; gap: 12px; min-height: 48px; flex-wrap: wrap; }
.page-title { flex: 1 1 220px; min-width: 0; }
.page-title h1 { font-size: clamp(26px, 3.2vw, 34px); font-weight: 850; overflow-wrap: anywhere; }
.page-title p { margin-top: 2px; color: var(--ink3); font-weight: 600; }
.title-sub { margin-top: 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.title-sub p { margin: 0; }
.page-actions { display: flex; gap: 8px; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 18px; }
.card-title { display: flex; align-items: baseline; gap: 10px; padding: 16px 18px 6px; font-size: 18px; }
.card-title small { color: var(--ink3); font-size: 13px; font-weight: 600; }
.card-title.flat { padding: 0 0 10px; }
.mini-title { margin: 14px 0 4px; font-size: 14px; }
.strong-line { font-weight: 750; }
.section-title { margin: 8px 0 -6px; font-size: 20px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; border-radius: 16px; background: var(--primary-soft); color: var(--ink); font-size: 14px; }
.notice svg { color: var(--primary); width: 20px; height: 20px; margin-top: 1px; }
.notice.warn { background: var(--warning-soft); }
.notice.warn svg { color: var(--warning); }
.notice.error { background: var(--error-soft); }
.notice.success { background: var(--success-soft); }
.notice.success svg { color: var(--success); }
.delivery-notice { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--radius); background: var(--primary-soft); }
.delivery-notice svg { color: var(--primary); width: 28px; height: 28px; }
.delivery-notice strong { display: block; font-size: 15px; }
.delivery-notice span { display: block; margin-top: 3px; color: var(--ink2); font-size: 14px; }
.empty { padding: 56px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--ink2); }
.empty h2 { color: var(--ink); font-size: 21px; }
.empty p { max-width: 420px; }
.empty .button, .empty .form-actions { margin-top: 8px; }
.empty-icon { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 24px; background: var(--primary-soft); color: var(--primary); }
.empty-icon svg { width: 34px; height: 34px; }
.skeleton { background: linear-gradient(90deg, var(--surface2) 25%, var(--surface) 50%, var(--surface2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
.pcard-skeleton { aspect-ratio: 3 / 4.4; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast { position: fixed; z-index: 400; left: 50%; bottom: 28px; max-width: calc(100% - 32px); transform: translate(-50%, 20px); padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); opacity: 0; pointer-events: none; font-size: 14px; font-weight: 700; transition: opacity .2s, transform .2s; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 750; color: var(--ink2); }
.input, .field input, .field textarea, .field select { width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); font-size: 16px; }
.field textarea { resize: vertical; }
.input:focus, .field input:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.field-hint { font-size: 12px; color: var(--ink3); }
.field-error { font-size: 13px; color: var(--error); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.form-actions.center { justify-content: center; }
.address-form { display: flex; flex-direction: column; gap: 6px; }
.phone-input { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.phone-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.phone-input b { display: flex; align-items: center; padding: 0 12px; background: var(--surface2); border-right: 1px solid var(--line); }
.phone-input input { flex: 1; min-width: 0; min-height: 52px; padding: 0 14px; border: 0; outline: none; font-size: 18px; background: transparent; }
.code-input { text-align: center; font-size: 26px !important; font-weight: 800; letter-spacing: .4em; }
.search-field { display: flex; align-items: center; gap: 10px; padding: 0 16px; min-height: 52px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink3); }
.search-field:focus-within { border-color: var(--primary); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--ink); }
.header-search { min-height: 44px; border-radius: 14px; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface2); }
.segmented button { padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink2); font-weight: 700; font-size: 14px; }
.segmented button.active { background: var(--surface); color: var(--primary); box-shadow: 0 2px 8px -4px rgba(0, 0, 0, .3); }
.switch { appearance: none; width: 48px; height: 28px; flex: none; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(20px); }
.settings-block { display: flex; flex-direction: column; gap: 16px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-weight: 700; }
.setting small { display: block; color: var(--ink3); font-weight: 600; }
.group-title { margin: 6px 4px -6px; color: var(--ink3); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.narrow { max-width: 640px; }

/* ------------------------------------------------------------------ chips */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink2); font-weight: 750; font-size: 14.5px; white-space: nowrap; }
.chip svg { width: 16px; height: 16px; }
.chip small { font-size: 11px; opacity: .8; }
.chip:hover { color: var(--ink); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ----------------------------------------------------------- product card */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 16px; }
.pcard { position: relative; display: flex; flex-direction: column; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: box-shadow .2s, transform .2s; }
.pcard:hover { box-shadow: var(--shadow); }
.pcard-photo { position: relative; aspect-ratio: 1; display: grid; place-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--photo); overflow: hidden; }
.pcard-photo img { width: 100%; height: 100%; object-fit: contain; transition: transform .25s; }
.pcard:hover .pcard-photo img { transform: scale(1.04); }
.placeholder { font-size: 40px; font-weight: 900; color: var(--primary); letter-spacing: -.08em; }
.badge { position: absolute; top: 8px; left: 8px; padding: 3px 9px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 800; }
.badge.sale { background: var(--error); }
.fav-button { position: absolute; top: 14px; right: 14px; z-index: 2; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: color-mix(in srgb, #fff 82%, transparent); color: #1c2a44; }
.fav-button svg { width: 20px; height: 20px; }
.fav-button.active { color: var(--error); }
.pcard-name { margin: 10px 6px 0; font-size: 15px; font-weight: 700; line-height: 1.3; min-height: 2.6em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-bottom { margin: 8px 6px 4px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.pcard-price { min-width: 0; display: flex; flex-direction: column; }
.pcard-price strong { font-size: 18px; font-weight: 850; white-space: nowrap; }
.pcard-price s { color: var(--ink3); font-size: 12px; }
.pcard-price span { color: var(--ink3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-square { width: 46px; height: 46px; display: grid; place-items: center; border: 0; border-radius: 15px; background: var(--primary); color: #fff; }
.cart-square:hover { background: var(--primary2); }
.cart-square.is-busy { opacity: .6; }
.stepper { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 15px; background: var(--surface2); }
.stepper button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 12px; background: var(--surface); color: var(--ink); }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper output { min-width: 34px; text-align: center; font-weight: 800; }
.stepper.small { padding: 2px; border-radius: 13px; background: var(--primary-soft); }
.stepper.small button { width: 32px; height: 38px; border-radius: 11px; }
.stepper.small output { min-width: 22px; color: var(--primary); }
.stepper.is-busy { opacity: .6; }

/* ------------------------------------------------------------------- home */
.home-hello { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-hello small { color: var(--ink3); font-size: 16px; font-weight: 600; }
.home-hello h1 { font-size: clamp(26px, 3.4vw, 34px); font-weight: 850; }
.bell-button { position: relative; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.dot-badge { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 5px; display: grid; place-items: center; border-radius: 999px; background: var(--accent); color: #1b1300; font-size: 12px; font-weight: 850; }
.banners { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius); scrollbar-width: none; }
.banners::-webkit-scrollbar { display: none; }
.banner { position: relative; scroll-snap-align: start; aspect-ratio: 21 / 7; border-radius: var(--radius); overflow: hidden; background: var(--surface2); }
.banner img { width: 100%; height: 100%; object-fit: cover; }
.banner-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 22px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .55)); display: flex; flex-direction: column; }
.banner-caption strong { font-size: 22px; }
.active-order { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); }
.active-order:hover { box-shadow: var(--shadow); }
.active-order-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; background: var(--primary-soft); color: var(--primary); }
.active-order small { display: block; color: var(--primary); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.active-order strong { display: block; font-size: 16px; }
.active-order span { display: block; color: var(--ink2); font-size: 13.5px; }
.home-section { display: flex; flex-direction: column; gap: 12px; }
.rails { display: flex; flex-direction: column; gap: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: 22px; font-weight: 850; }
.section-more { border: 0; background: none; color: var(--primary); font-weight: 800; font-size: 15px; }
.rail-actions { display: flex; align-items: center; gap: 8px; }
.rail-actions .round-button { width: 38px; height: 38px; border-radius: 12px; }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 4 * 16px) / 5); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 8px; scrollbar-width: thin; }
.rail > * { scroll-snap-align: start; }
.cat-row { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.cat-row::-webkit-scrollbar { display: none; }
.cat-tile { flex: none; width: 104px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.cat-icon { width: 84px; height: 84px; display: grid; place-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 24px; background: var(--photo); overflow: hidden; transition: border-color .15s; }
.cat-icon img { width: 100%; height: 100%; object-fit: contain; }
.cat-icon b { font-size: 30px; color: var(--primary); }
.cat-tile:hover .cat-icon { border-color: var(--primary); }
.cat-name { font-size: 13.5px; font-weight: 650; color: var(--ink2); line-height: 1.25; }

/* ---------------------------------------------------------------- catalog */
.catalog-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.catalog-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cat-sidebar { position: sticky; top: 88px; display: flex; flex-direction: column; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); max-height: calc(100vh - 110px); overflow-y: auto; }
.cat-sidebar button { padding: 11px 14px; border: 0; border-radius: 12px; background: none; text-align: left; color: var(--ink2); font-weight: 650; font-size: 15px; }
.cat-sidebar button:hover { color: var(--ink); background: var(--surface2); }
.cat-sidebar button.active { color: var(--primary); background: var(--primary-soft); font-weight: 800; }
.load-more { display: flex; justify-content: center; }
.results-count { font-weight: 600; }
.suggestions { margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.suggestions a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; font-weight: 600; }
.suggestions a svg { color: var(--ink3); width: 18px; height: 18px; }
.suggestions a:hover { background: var(--surface2); }

/* ---------------------------------------------------------------- product */
.product-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 34px; align-items: start; }
.product-gallery { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--photo); border: 1px solid var(--line); border-radius: 28px; }
.gallery-tools { position: absolute; z-index: 2; top: 14px; left: 14px; right: 14px; display: flex; gap: 8px; pointer-events: none; }
.gallery-tools > * { pointer-events: auto; }
.gallery-tools .round-button { background: color-mix(in srgb, #fff 85%, transparent); border-color: transparent; color: #1c2a44; }
.gallery-tools .fav-round.active { color: var(--error); }
.gallery-main { aspect-ratio: 1; display: grid; place-items: center; padding: 34px; border: 0; background: transparent; cursor: zoom-in; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.gallery-thumbs { display: flex; gap: 8px; overflow-x: auto; }
.gallery-thumbs button { flex: none; width: 64px; height: 64px; padding: 4px; border: 2px solid #e7edf5; border-radius: 14px; background: #fff; }
.gallery-thumbs button.active { border-color: var(--primary); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: contain; }
.product-tags { display: flex; gap: 8px; align-items: center; }
.product-tags .badge { position: static; font-size: 13px; padding: 5px 12px; border-radius: 11px; }
.tag-stock { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border: 1px solid #e7edf5; border-radius: 11px; color: #0e1b33; font-size: 13px; font-weight: 650; }
.tag-stock::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.product-info { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.product-cat { color: var(--primary); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.product-info h1 { font-size: clamp(24px, 3vw, 34px); font-weight: 850; overflow-wrap: anywhere; }
.price-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.price-line strong { font-size: 30px; font-weight: 850; }
.price-line s { color: var(--ink3); }
.price-line span { color: var(--ink3); font-weight: 600; }
.buy-bar { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); flex-wrap: wrap; }
.buy-total { flex: 1 1 140px; display: flex; flex-direction: column; }
.buy-total strong { font-size: 17px; }
.buy-total span { color: var(--ink3); font-size: 13px; }
.buy-button { min-height: 52px; padding: 0 24px; }
.specs { margin: 0; padding: 4px 18px; }
.specs div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.specs div:last-child { border-bottom: 0; }
.specs dt { color: var(--ink3); }
.specs dd { margin: 0; font-weight: 700; text-align: right; }
.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(5, 10, 20, .94); }
.lightbox::backdrop { background: rgba(5, 10, 20, .94); }
.lightbox-frame { position: absolute; inset: 64px 16px 56px; display: grid; place-items: center; }
.lightbox-frame img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .round-button { position: absolute; z-index: 2; background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }
.lightbox-close { top: 14px; right: 14px; }
.lightbox-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lightbox-count { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: #fff; font-weight: 700; }

/* ------------------------------------------------------------------- cart */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.summary { position: sticky; top: 88px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.summary.static { position: static; }
.summary h2 { font-size: 19px; }
.summary-rows { margin: 0; display: flex; flex-direction: column; gap: 9px; font-size: 15px; }
.summary-rows div { display: flex; justify-content: space-between; gap: 12px; }
.summary-rows dt { color: var(--ink2); }
.summary-rows dd { margin: 0; font-weight: 700; text-align: right; }
.summary-rows .total { padding-top: 11px; border-top: 1px solid var(--line); font-size: 19px; }
.summary-rows .total dt { color: var(--ink); font-weight: 800; }
.summary-rows .total dd { font-weight: 900; }
.threshold { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.threshold-text { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14.5px; }
.threshold-text svg { color: var(--primary); }
.threshold-text span { flex: 1; }
.threshold-text b { color: var(--ink3); font-size: 13px; }
.threshold.done .threshold-text svg { color: var(--success); }
.progress-bar { height: 8px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.progress-bar span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .3s; }
.threshold.done .progress-bar span { background: var(--success); }
.cart-line { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; padding: 14px; }
.line-photo { width: 112px; height: 112px; display: grid; place-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 18px; background: var(--photo); overflow: hidden; }
.line-photo img { width: 100%; height: 100%; object-fit: contain; }
.line-photo .placeholder { font-size: 26px; }
.line-photo.small { width: 60px; height: 60px; padding: 5px; border-radius: 14px; }
.line-photo.small .placeholder { font-size: 18px; }
.line-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.line-name { font-weight: 750; font-size: 16px; }
a.line-name:hover { color: var(--primary); }
.line-meta { color: var(--ink3); font-size: 14px; }
.line-warn { color: var(--warning); font-size: 13px; font-weight: 650; }
.line-controls { margin-top: 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.line-total { font-size: 17px; }
.line-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.coupon-form { display: flex; gap: 8px; }
.coupon-form .input { min-height: 44px; font-size: 15px; }
.sticky-bar { position: fixed; z-index: 65; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.sticky-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 18px; font-weight: 800; }
.sticky-total strong { font-size: 22px; }
.option-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.option { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--line); border-radius: 18px; background: var(--surface); cursor: pointer; }
.option:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary-soft) 60%, var(--surface)); }
.option input { accent-color: var(--primary); width: 20px; height: 20px; flex: none; }
.option strong { display: block; }
.option span { display: block; color: var(--ink2); font-size: 14px; }
.option-icon { width: 40px; height: 40px; display: grid !important; place-items: center; border-radius: 12px; background: var(--surface2); color: var(--ink2); }
.pay-badge { display: inline-block !important; margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--success-soft); color: var(--success-ink) !important; font-size: 11px !important; font-weight: 800; vertical-align: 2px; }
.alipay-mark { width: 40px; height: 40px; flex: none; display: grid !important; place-items: center; border-radius: 12px; background: var(--alipay); color: #fff !important; font-size: 20px !important; font-weight: 800; }
.step h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 18px; }
.step-num { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 14px; font-weight: 850; }

/* ----------------------------------------------------------------- orders */
.order-list { display: flex; flex-direction: column; gap: 12px; }
.order-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; transition: box-shadow .2s; }
.order-card:hover { box-shadow: var(--shadow); }
.order-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.order-card-head strong { display: block; font-size: 17px; }
.order-card-head small { color: var(--ink3); font-size: 14px; }
.order-card-sum { display: flex; justify-content: space-between; font-size: 16px; color: var(--ink2); }
.order-card-sum strong { color: var(--ink); font-size: 17px; }
.order-card-hint { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px; background: var(--surface2); color: var(--ink2); font-size: 14px; }
.order-card-hint svg { width: 18px; height: 18px; color: var(--ink3); }
.order-card-actions { display: flex; justify-content: flex-end; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 800; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.warning { background: var(--warning-soft); color: var(--warning); }
.status.success { background: var(--success-soft); color: var(--success-ink); }
.status.danger { background: var(--error-soft); color: var(--error); }
.address-card .status { margin-left: 8px; vertical-align: 2px; padding: 3px 9px; font-size: 11px; }
.order-hint { font-weight: 600; }
.progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 16px 0 0; padding: 0; list-style: none; }
.progress li { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--ink3); font-weight: 650; }
.progress li::before { content: ""; height: 6px; border-radius: 99px; background: var(--surface2); }
.progress li.done { color: var(--ink); }
.progress li.done::before { background: var(--primary); }
.order-line { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--line); }
.history { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.history li { display: flex; justify-content: space-between; gap: 12px; }
.history time { color: var(--ink3); font-size: 13px; white-space: nowrap; }

/* ------------------------------------------------------------------- pay */
.pay-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; border-color: color-mix(in srgb, var(--alipay) 40%, var(--line)); }
.pay-head { display: flex; align-items: center; gap: 12px; }
.pay-head h2 { font-size: 18px; }
.pay-waiting { color: var(--warning); font-size: 13px; font-weight: 750; }
.copy-rows { display: flex; flex-direction: column; gap: 8px; }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 11px 14px; border: 0; border-radius: 14px; background: var(--surface2); text-align: left; }
.copy-row small { display: block; color: var(--ink3); font-size: 12px; }
.copy-row strong { font-size: 18px; }
.copy-hint { display: inline-flex; align-items: center; gap: 5px; color: var(--primary); font-size: 13px; font-weight: 750; }
.copy-hint svg { width: 16px; height: 16px; }
.pay-exact { color: var(--success-ink); }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.qr-box:empty { display: none; }
.qr-code { width: 220px; height: 220px; padding: 8px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.pay-notice { padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- account */
.notice-group { display: flex; flex-direction: column; gap: 10px; }
.notice-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; }
.notice-row:hover { box-shadow: var(--shadow); }
.notice-row strong { display: block; }
.notice-row span { display: block; color: var(--ink2); font-size: 14px; }
.notice-row time { color: var(--ink3); font-size: 12.5px; white-space: nowrap; }
.notice-row.unread { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.notice-row.unread strong::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--primary); vertical-align: 2px; }
.notice-icon, .menu-icon { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary); }
.menu-icon.tg { background: #e6f4fd; color: #229ed9; }
.menu-icon.wc { background: #e8f8ee; color: #07c160; }
.menu { padding: 6px; display: flex; flex-direction: column; }
.menu-row { width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 10px; border: 0; border-radius: 16px; background: none; text-align: left; font-weight: 700; font-size: 15.5px; }
.menu-row:hover { background: var(--surface2); }
.menu-row small { display: block; color: var(--ink3); font-weight: 600; }
.menu-row.danger, .menu-row.danger .menu-icon { color: var(--error); }
.menu-row.danger .menu-icon { background: var(--error-soft); }
.menu-chevron { color: var(--ink3); width: 18px; height: 18px; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head h2 { font-size: 20px; }
.profile-guest { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 28px 18px; }
.avatar { width: 64px; height: 64px; flex: none; display: grid; place-items: center; border-radius: 22px; background: var(--primary); color: #fff; font-size: 24px; font-weight: 850; }
.avatar svg { width: 30px; height: 30px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; text-align: center; }
.stat strong { font-size: 22px; font-weight: 850; }
.stat span { color: var(--ink3); font-size: 13px; font-weight: 650; }
.stat:hover { border-color: var(--primary); }
.address-card { display: flex; gap: 14px; padding: 16px; }
.address-card .grow { display: flex; flex-direction: column; gap: 3px; }

/* ----------------------------------------------------------------- sheets */
.sheet { width: min(460px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 0; border: 0; border-radius: 26px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); }
.sheet::backdrop { background: rgba(8, 14, 26, .5); backdrop-filter: blur(3px); }
.sheet-close-form { position: absolute; top: 12px; right: 12px; margin: 0; }
.sheet-close-form .round-button { width: 38px; height: 38px; border-radius: 50%; }
.sheet-body { padding: 28px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.sheet-body h2 { font-size: 23px; padding-right: 36px; }
.sheet-body p { color: var(--ink2); }
.sheet-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; background: var(--primary-soft); color: var(--primary); }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }

/* ---------------------------------------------------------------- layouts */
@media (max-width: 1100px) {
  .rail { grid-auto-columns: calc((100% - 3 * 16px) / 4); }
  .two-col { grid-template-columns: minmax(0, 1fr) 330px; }
}
@media (max-width: 900px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: revert !important; }
  .tabbar.mobile-only { display: grid !important; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  body.has-sticky-bar { padding-bottom: calc(var(--tabbar-h) + 150px + env(safe-area-inset-bottom)); }
  .topbar { background: var(--bg); border-bottom: 0; backdrop-filter: none; }
  .topbar-row { min-height: 60px; gap: 10px; }
  .top-actions .icon-button { width: 42px; height: 42px; }
  .page { padding: 10px 0 28px; gap: 16px; }
  .two-col, .product-layout, .catalog-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
  .rail { grid-auto-columns: 46%; gap: 12px; scrollbar-width: none; }
  .rail::-webkit-scrollbar { display: none; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .banner { aspect-ratio: 16 / 9; }
  .product-layout { gap: 18px; }
  .product-gallery { margin: 0 -16px; border-radius: 0 0 28px 28px; border-top: 0; }
  .gallery-main { padding: 46px 20px 10px; }
  /* The app's bottom buy bar: total, quantity, button. */
  .buy-bar { position: fixed; z-index: 65; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); border-radius: 0; border-width: 1px 0 0; padding: 12px 16px; gap: 10px; flex-wrap: nowrap; }
  .buy-total { flex: 1 1 auto; min-width: 0; }
  .buy-total strong { font-size: 14.5px; line-height: 1.25; }
  .buy-button { min-height: 48px; padding: 0 16px; }
  .buy-bar .stepper button { width: 34px; height: 38px; }
  .cart-line { grid-template-columns: 84px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .line-photo { width: 84px; height: 84px; }
  .form-grid { grid-template-columns: 1fr; }
  .sheet { width: 100%; max-width: none; margin: auto 0 0; border-radius: 26px 26px 0 0; max-height: 92%; }
  .sheet-body { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); }
  body.has-sticky-bar .toast { bottom: calc(var(--tabbar-h) + 140px + env(safe-area-inset-bottom)); }
}
@media (max-width: 420px) {
  .brand span { display: none; }
  .pcard { padding: 6px; border-radius: 18px; }
  .pcard-photo { border-radius: 13px; }
  .pcard-name { font-size: 14px; margin: 8px 4px 0; }
  .pcard-bottom { margin: 6px 4px 2px; }
  .pcard-price strong { font-size: 16px; }
  .cart-square { width: 40px; height: 40px; border-radius: 13px; }
  .stepper.small button { width: 28px; height: 34px; }
  .stepper.small output { min-width: 18px; }
  .fav-button { top: 10px; right: 10px; width: 32px; height: 32px; }
  .progress li { font-size: 10.5px; }
  .buy-total span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
