/* GoldParfum — оптовый прайс.
   Стиль: тихий люкс с типографикой журнального каталога.
   Палитра: тёплая бумага и орех, акцент — оранжевый из логотипа GoldParfum. */

:root {
  --primary: #f58220;
  --primary-hover: #e0741a;
  --on-primary: #2a2622;
  --primary-soft: #fbe7d5;
  --secondary: #2a2622;
  --on-secondary: #f7f3ec;
  --secondary-soft: #ede6da;
  --secondary-text: #2a2622;
  --bg: #f7f3ec;
  --surface: #fffdf8;
  --border: #ddd3c2;
  --ink: #2a2622;
  --muted: #6b6357;
  --link: #9a4f0c;
  --inverse-bg: #2a2622;
  --inverse-ink: #f7f3ec;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6357' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: light;

  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-text: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --w-display: 600;
  --w-text: 400;

  --t-h1: clamp(30px, 6vw, 44px);
  --t-h2: clamp(21px, 3.4vw, 27px);
  --t-h3: 19px;
  --t-lead: clamp(16px, 2.2vw, 19px);
  --t-body: 16px;
  --t-small: 14px;
  --t-micro: 12px;
  --lh-tight: 1.12;
  --lh-body: 1.5;
  --track-display: -0.01em;
  --radius: 0;
  --measure: 64ch;

  --line: calc(var(--t-body) * var(--lh-body));
  --s-1: calc(var(--line) * .25);
  --s-2: calc(var(--line) * .5);
  --s-3: calc(var(--line) * .75);
  --s-4: var(--line);
  --s-5: calc(var(--line) * 1.5);
  --s-6: calc(var(--line) * 2);
  --s-7: calc(var(--line) * 3);
  --s-8: clamp(calc(var(--line) * 3), 8vw, calc(var(--line) * 5));
  --pad-box: var(--s-4);
  --gutter: clamp(var(--s-3), 4vw, var(--s-5));
  --tabbar-h: 62px;
  --topbar-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-weight: var(--w-text);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: var(--w-display); line-height: var(--lh-tight); letter-spacing: var(--track-display); margin: 0; text-wrap: balance; }
h1 { font-size: var(--t-h1); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); line-height: 1.22; letter-spacing: 0; }
p { text-wrap: pretty; margin: 0; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── поля ─────────────────────────────────────────── */
label { display: block; font-size: var(--t-small); color: var(--muted); margin-bottom: var(--s-1); }
input, textarea, select {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  min-height: 46px; padding: 11px 13px; width: 100%; max-width: 100%;
}
textarea { min-height: 84px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #9b9284; opacity: 1; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--ink); }
select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 13px center; background-size: 16px; }
.field { margin-bottom: var(--s-3); }
.form-error { color: #a3271b; font-size: var(--t-small); margin: var(--s-1) 0 0; }

/* ── кнопки ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px; padding: 0 var(--s-4); border: 1px solid transparent; border-radius: var(--radius);
  background: var(--secondary-soft); color: var(--ink); font-size: var(--t-body); font-weight: 600;
  cursor: pointer; text-decoration: none; transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.btn:hover { background: var(--border); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--secondary-soft); }
.btn-quiet { background: transparent; color: var(--muted); padding: 0 var(--s-2); }
.btn-quiet:hover { background: transparent; color: var(--ink); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-block { width: 100%; }
.btn-danger { background: transparent; border-color: #d9bdb7; color: #a3271b; }
.btn-danger:hover { background: #f6e7e4; }

/* ── вход ─────────────────────────────────────────── */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: var(--s-5) var(--gutter); }
.login-card { width: 100%; max-width: 400px; }
.login-logo { height: 40px; width: auto; margin-bottom: var(--s-6); }
.login-title { font-size: var(--t-h1); }
.login-sub { color: var(--muted); font-size: var(--t-lead); margin-top: var(--s-2); max-width: 34ch; }
.login-form { margin-top: var(--s-6); }
.login-form .btn { margin-top: var(--s-4); }
.login-form label + .form-error { margin-top: 0; }
.login-form label { margin-top: var(--s-2); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s-2); }
.form-row label { margin-top: var(--s-2); }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }
.opt { color: #9b9284; font-size: 12px; }
.login-form label:first-of-type { margin-top: 0; }
.login-foot { margin-top: var(--s-5); color: var(--muted); font-size: var(--t-small); }

/* ── шапка ────────────────────────────────────────── */
.app { min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  height: var(--topbar-h); padding: 0 var(--gutter);
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; min-height: 44px; }
.brand img { height: 24px; width: auto; }
.topbar-right { display: flex; align-items: center; gap: var(--s-2); }
.pay-toggle { display: flex; border: 1px solid var(--border); }
.pay-toggle button {
  min-height: 36px; padding: 0 10px; background: transparent; border: 0; cursor: pointer;
  font-size: var(--t-small); color: var(--muted); transition: background .15s, color .15s;
}
.pay-toggle button + button { border-left: 1px solid var(--border); }
.pay-toggle button.is-on { background: var(--secondary); color: var(--on-secondary); }
.cart-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px;
  background: transparent; border: 1px solid var(--border); cursor: pointer;
}
.cart-btn:hover { background: var(--secondary-soft); }
.cart-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 600;
}
.cart-sum { font-size: var(--t-small); font-variant-numeric: tabular-nums; color: var(--muted); }

/* ── нижняя навигация ─────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg); border-top: 1px solid var(--border);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 11px; }
.tab.is-active { color: var(--ink); }
.tab.is-active svg { color: var(--primary); }

/* ── контент ──────────────────────────────────────── */
.main { max-width: 1060px; margin: 0 auto; padding: var(--s-4) var(--gutter) var(--s-7); }
.main:focus { outline: none; }
.page-head { padding: var(--s-3) 0 var(--s-4); border-bottom: 1px solid var(--border); }
.page-head h1 { font-size: var(--t-h1); }
.page-sub { color: var(--muted); font-size: var(--t-small); margin-top: var(--s-2); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.page-sub .dot { color: var(--border); }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; color: var(--muted); font-size: var(--t-small); text-decoration: none; }
.back:hover { color: var(--ink); }

/* каталог: современные карточки разделов */
.tiles {
  display: grid; gap: var(--s-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: var(--s-4);
}
.tile {
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none; color: var(--ink);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(42, 38, 34, .10); border-color: #cbbc9f; }
.tile:hover .tile-title { color: var(--link); }
.tile-img-wrap {
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 10px; padding: var(--s-2);
  min-height: 118px;
}
.tile-img { width: 112px; height: 112px; object-fit: contain; }
.tile-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-title {
  font-family: var(--font-text); font-size: 15px; font-weight: 600; line-height: 1.28;
  letter-spacing: -.005em; transition: color .15s; hyphens: auto;
}
.tile-count { color: var(--muted); font-size: var(--t-micro); }
.tile-price { margin-top: 2px; font-size: var(--t-small); font-weight: 600; font-variant-numeric: tabular-nums; }

@media (min-width: 520px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile-img { width: 124px; height: 124px; }
}
@media (min-width: 860px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
  .tile { padding: var(--s-4); }
  .tile-img-wrap { min-height: 150px; }
  .tile-img { width: 148px; height: 148px; }
  .tile-title { font-size: 16px; }
}
@media (min-width: 1180px) {
  .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* список позиций */
.list-toolbar { position: sticky; top: var(--topbar-h); z-index: 10; background: var(--bg); padding: var(--s-2) 0; border-bottom: 1px solid var(--border); }
.search-field { position: relative; }
.search-field svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-field input { padding-left: 38px; }
.cols { display: none; }

.items { border-top: 1px solid var(--ink); }
.p-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3);
  padding: var(--s-3) 0; border-bottom: 1px solid var(--border);
}
.p-main { flex: 1 1 100%; min-width: 0; }
.p-name { font-size: 15px; line-height: 1.32; }
.p-meta { color: var(--muted); font-size: var(--t-micro); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; }

.price-legend { display: flex; gap: var(--s-5); padding: var(--s-2) 0 var(--s-1); color: var(--muted); font-size: var(--t-small); }
.pl-item b { color: var(--ink); font-size: var(--t-body); font-variant-numeric: tabular-nums; margin-left: 2px; }
.pl-label { color: var(--muted); }

.oq-pair { display: flex; gap: var(--s-3); flex: 1 1 auto; }
.oq { display: flex; align-items: center; gap: 6px; min-width: 0; }
.oq-label { color: var(--muted); font-size: var(--t-micro); }
.oq-price { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.oq-controls { display: inline-flex; align-items: center; border: 1px solid var(--border); background: var(--surface); }
.oq-btn { width: 30px; height: 34px; background: transparent; border: 0; cursor: pointer; font-size: 16px; line-height: 1; color: var(--ink); }
.oq-btn:hover { background: var(--secondary-soft); }
.oq-input {
  width: 44px; height: 34px; min-height: 0; padding: 0; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  text-align: center; font-size: var(--t-small); font-variant-numeric: tabular-nums; background: transparent; border-radius: 0;
}
.oq.is-filled .oq-input { background: var(--primary-soft); font-weight: 600; }
.oq.is-filled .oq-label, .oq.is-filled .oq-price { color: var(--ink); }
.p-open { margin-left: auto; }

@media (min-width: 720px) {
  .p-main { flex: 1 1 40%; }
  .oq-pair { flex: 0 0 auto; }
  .oq-input { width: 54px; }
}

.load-more { margin: var(--s-5) 0; text-align: center; }
.empty { padding: var(--s-7) 0; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: var(--s-2); }

/* ── корзина ──────────────────────────────────────── */
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: var(--s-2) var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.cart-line-name { font-size: 15px; line-height: 1.3; }
.cart-line-meta { color: var(--muted); font-size: var(--t-micro); margin-top: 2px; }
.cart-line-sum { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.cart-line.is-missing .cart-line-name { color: var(--muted); text-decoration: line-through; }
.cart-line.is-missing .cart-line-sum { color: var(--muted); font-weight: 400; }
.cart-line-tools { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-3); }
.oe-item { display: flex; align-items: center; gap: 6px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); }
.stepper button { width: 40px; height: 38px; background: transparent; border: 0; cursor: pointer; font-size: 17px; }
.stepper button:hover { background: var(--secondary-soft); }
.stepper input { width: 52px; height: 38px; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; padding: 0; font-variant-numeric: tabular-nums; }
.totals { margin-top: var(--s-4); border-top: 1px solid var(--ink); padding-top: var(--s-3); }
.totals-row { display: flex; justify-content: space-between; align-items: baseline; padding: 3px 0; color: var(--muted); font-size: var(--t-small); }
.totals-row.grand { color: var(--ink); font-size: var(--t-body); padding-top: var(--s-2); }
.totals-row.grand b { font-family: var(--font-display); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.min-note { margin-top: var(--s-3); padding: var(--s-3); background: var(--primary-soft); border-left: 2px solid var(--primary); font-size: var(--t-small); }
.min-note.ok { background: var(--secondary-soft); border-left-color: var(--secondary); }
.checkout-actions { margin-top: var(--s-4); display: grid; gap: var(--s-2); }

/* ── карточка позиции ─────────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(42, 38, 34, .45); }
.sheet-panel {
  position: relative; width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto;
  background: var(--surface); padding: var(--s-5) var(--gutter) calc(var(--s-5) + env(safe-area-inset-bottom, 0px));
  border-top: 2px solid var(--ink);
  animation: sheet-up .22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-close { position: absolute; top: 8px; right: 10px; width: 40px; height: 40px; background: transparent; border: 0; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; }
.sheet h3 { font-size: var(--t-h2); padding-right: 44px; }
.sheet-cat { color: var(--muted); font-size: var(--t-small); margin-top: var(--s-1); }
.sheet-prices { display: flex; gap: var(--s-4); margin: var(--s-4) 0; }
.sheet-price { display: flex; flex-direction: column; gap: 2px; }
.sheet-price span { color: var(--muted); font-size: var(--t-micro); }
.sheet-price b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sheet-price.is-on b { color: var(--link); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-2) 0 var(--s-4); }
.chip { min-height: 40px; padding: 0 12px; background: transparent; border: 1px solid var(--border); cursor: pointer; font-size: var(--t-small); font-variant-numeric: tabular-nums; }
.chip.is-on { background: var(--secondary); color: var(--on-secondary); border-color: var(--secondary); }
.sheet-actions { display: grid; gap: var(--s-2); margin-top: var(--s-3); }

/* ── заказы ───────────────────────────────────────── */
.order-card { padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.order-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-2); }
.order-num { font-family: var(--font-display); font-size: var(--t-h3); }
.order-sum { font-variant-numeric: tabular-nums; font-weight: 600; }
.order-meta { color: var(--muted); font-size: var(--t-small); margin-top: 2px; }
.badge { display: inline-block; padding: 2px 7px; font-size: var(--t-micro); background: var(--secondary-soft); color: var(--ink); }
.badge.new { background: var(--primary); color: var(--on-primary); }
.order-lines { margin-top: var(--s-3); font-size: var(--t-small); }
.order-lines div { display: flex; justify-content: space-between; gap: var(--s-2); padding: 2px 0; color: var(--muted); }
.order-lines div b { color: var(--ink); font-weight: 400; }

/* ── кабинет ──────────────────────────────────────── */
.card-block { border: 1px solid var(--border); background: var(--surface); padding: var(--pad-box); margin-top: var(--s-4); }
.card-block h2 { font-size: var(--t-h3); font-family: var(--font-display); margin-bottom: var(--s-2); }
.kv { display: flex; justify-content: space-between; gap: var(--s-3); padding: 5px 0; border-bottom: 1px solid var(--border); font-size: var(--t-small); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.success { padding: var(--s-6) 0; text-align: center; }
.success h1 { font-size: var(--t-h2); }
.success p { color: var(--muted); margin-top: var(--s-2); }
.success .num { display: inline-block; margin: var(--s-4) 0; padding: var(--s-2) var(--s-4); border: 1px solid var(--ink); font-family: var(--font-display); font-size: 22px; }

/* ── toast ────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px));
  z-index: 80; max-width: min(92vw, 420px);
  background: var(--inverse-bg); color: var(--inverse-ink);
  padding: 11px 16px; font-size: var(--t-small); text-align: center;
  animation: toast-in .18s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── шире экрана ──────────────────────────────────── */
@media (min-width: 720px) {
  .main { padding-top: var(--s-5); padding-bottom: var(--s-7); }
  .sheet { align-items: center; }
  .sheet-panel { border: 1px solid var(--border); border-top: 2px solid var(--ink); max-height: 80dvh; }
  .cols { display: grid; grid-template-columns: 1fr 88px 88px 44px; gap: var(--s-2); padding: var(--s-2) 0 var(--s-1); color: var(--muted); font-size: var(--t-micro); letter-spacing: .04em; } 
  .cols span:nth-child(2), .cols span:nth-child(3) { text-align: right; }
  .cols .is-on { color: var(--ink); font-weight: 600; }
  .p-row { grid-template-columns: 1fr 88px 88px 44px; gap: var(--s-2); }
  .p-prices { display: contents; }
  .p-price { text-align: right; }
  .p-price .pl { display: none; }
  .p-price.is-on { font-size: var(--t-body); }
  .add-btn { grid-row: 1; grid-column: 4; }
  .toast { bottom: calc(var(--tabbar-h) + 16px); }
}
@media (min-width: 1000px) {
  .topbar { padding: 0 var(--s-6); }
}


/* ── предложение включить уведомления ─────────────────── */
.push-banner {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom, 0px));
  z-index: 70; width: min(94vw, 460px);
  display: flex; align-items: center; gap: var(--s-2);
  padding: 12px 14px; background: var(--inverse-bg); color: var(--inverse-ink);
  border-radius: 12px; box-shadow: 0 12px 28px rgba(42, 38, 34, .25);
}
.push-banner-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; font-size: 13px; line-height: 1.3; }
.push-banner-text span { color: #cfc7ba; font-size: 12px; }
.push-banner .btn { min-height: 38px; padding: 0 14px; font-size: 13px; }
.push-close { background: transparent; border: 0; color: #cfc7ba; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 2px; }


/* объявление о приостановке приёма заказов */
.notice {
  display: flex; flex-direction: column; gap: 3px;
  padding: var(--s-3) var(--s-4); margin: var(--s-3) 0;
  background: var(--primary-soft); border-left: 3px solid var(--primary);
  font-size: var(--t-small); line-height: 1.4;
}
.notice b { font-size: var(--t-body); }
.notice span { color: var(--muted); }


/* инструкция по установке */
.steps { display: flex; gap: var(--s-4); align-items: flex-start; flex-wrap: wrap; }
.ph-figure { width: 180px; height: auto; flex: none; }
.step-list { margin: 0; padding-left: 22px; flex: 1 1 260px; font-size: var(--t-body); line-height: 1.5; }
.step-list li { margin-bottom: var(--s-2); }
.step-list li::marker { color: var(--primary); font-weight: 700; }
@media (max-width: 520px) {
  .steps { gap: var(--s-3); }
  .ph-figure { width: 132px; margin: 0 auto; }
  .step-list { flex: 1 1 100%; }
}
