/* =========================================================================
   Nayada Doors — стили интерфейса
   ========================================================================= */
@font-face { font-family: "Pragmatica"; src: url("../fonts/pragmatica-light.woff") format("woff"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Pragmatica"; src: url("../fonts/pragmatica-regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pragmatica"; src: url("../fonts/pragmatica-medium.woff") format("woff"); font-weight: 500 700; font-display: swap; }

:root {
  --bg: #f4f3f0;
  --surface: #ffffff;
  --surface-2: #f9f8f6;
  --surface-3: #efede9;
  --ink: #17191e;
  --ink-2: #4b4f58;
  --ink-3: #8a8e97;
  --line: #e5e2dc;
  --line-2: #d6d2ca;
  --brand: #f0582b;
  --brand-ink: #ffffff;
  --brand-soft: #fff0ea;
  --brand-line: #ffc7b3;
  --ok: #1f9d55;
  --ok-soft: #e7f6ee;
  --warn: #b7791f;
  --warn-soft: #fdf4e3;
  --err: #d64545;
  --err-soft: #fdecec;
  --info-soft: #eef3fb;
  --shadow-sm: 0 1px 2px rgba(23, 25, 30, .06);
  --shadow: 0 1px 2px rgba(23, 25, 30, .05), 0 8px 24px -12px rgba(23, 25, 30, .18);
  --shadow-lg: 0 24px 60px -20px rgba(23, 25, 30, .35);
  --r: 12px;
  --r-sm: 8px;
  --r-lg: 18px;
  --font: "Pragmatica", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111215; --surface: #1a1c20; --surface-2: #202227; --surface-3: #292c32;
    --ink: #eef0f3; --ink-2: #b7bcc6; --ink-3: #80858f; --line: #2c2f35; --line-2: #3a3e45;
    --brand: #ff6a3d; --brand-soft: #3a2119; --brand-line: #6d3423;
    --ok: #3fbf7a; --ok-soft: #173024; --warn: #e0a54a; --warn-soft: #33291a; --err: #f07070; --err-soft: #3a1d1d; --info-soft: #1c2533;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111215; --surface: #1a1c20; --surface-2: #202227; --surface-3: #292c32;
  --ink: #eef0f3; --ink-2: #b7bcc6; --ink-3: #80858f; --line: #2c2f35; --line-2: #3a3e45;
  --brand: #ff6a3d; --brand-soft: #3a2119; --brand-line: #6d3423;
  --ok: #3fbf7a; --ok-soft: #173024; --warn: #e0a54a; --warn-soft: #33291a; --err: #f07070; --err-soft: #3a1d1d; --info-soft: #1c2533;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -.01em; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 20px; line-height: 1.3; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Каркас ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1480px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 28px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo img { height: 26px; display: block; }
.logo span { font-size: 12px; color: var(--ink-3); border-left: 1px solid var(--line-2); padding-left: 10px; letter-spacing: .08em; text-transform: uppercase; }
:root[data-theme="dark"] .logo img { background: #fff; border-radius: 6px; padding: 3px 6px; box-sizing: content-box; height: 22px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo img { background: #fff; border-radius: 6px; padding: 3px 6px; box-sizing: content-box; height: 22px; } }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: var(--r-sm); color: var(--ink-2); display: flex; gap: 8px; align-items: center; }
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a.active { background: var(--ink); color: var(--surface); }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 500; font-size: 13px; }
.userbox .who { line-height: 1.2; }
.userbox .who b { display: block; font-weight: 500; font-size: 14px; }
.userbox .who small { color: var(--ink-3); font-size: 12px; }

.page { max-width: 1480px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-3); margin-top: 6px; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--ink-3); font-size: 13px; margin-bottom: 10px; flex-wrap: wrap; }
.crumbs a { text-decoration: none; color: var(--ink-2); }
.crumbs a:hover { color: var(--brand); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 500; font-size: 14px; text-decoration: none; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .opt:focus-visible, .seg button:focus-visible, .step:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); background: var(--err-soft); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Карточки, таблицы ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.card-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.card-b { padding: 20px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table .r { text-align: right; }
.table tr.excluded td { color: var(--ink-3); text-decoration: line-through; }
.table tr.excluded td.act { text-decoration: none; }
/* Кнопка «Исключить / Вернуть» в спецификации: видна сразу (обводка), при наведении — заливка */
.row-toggle { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
  border-radius: 50%; border: 1.5px solid currentColor; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .1s; }
.row-toggle svg { width: 16px; height: 16px; flex: none; }
.row-toggle:active { transform: scale(.94); }
.row-toggle.out { color: var(--err); background: var(--err-soft); }
.row-toggle.back { color: var(--ok); background: var(--ok-soft); }
.row-toggle.out:hover, .row-toggle.out:focus-visible { background: var(--err); border-color: var(--err); color: #fff; box-shadow: 0 4px 12px -4px var(--err); }
.row-toggle.back:hover, .row-toggle.back:focus-visible { background: var(--ok); border-color: var(--ok); color: #fff; box-shadow: 0 4px 12px -4px var(--ok); }
.row-toggle:disabled { opacity: .5; cursor: wait; }
.table tr.noprice td { background: var(--err-soft); }
.table tfoot td { font-weight: 500; background: var(--surface-2); border-top: 1px solid var(--line); }
.table .group td { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 8px 16px; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--info-soft); color: var(--ink-2); font-size: 14px; align-items: flex-start; }
.alert.warn { background: var(--warn-soft); }
.alert.err { background: var(--err-soft); color: var(--err); }
.alert.ok { background: var(--ok-soft); }
.alert svg.i { margin-top: 2px; }

.empty { text-align: center; padding: 56px 24px; color: var(--ink-3); }
.empty .ic { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; background: var(--surface-3); display: grid; place-items: center; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

.stat { padding: 16px 20px; }
.stat .k { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.stat .v { font-size: 24px; font-weight: 500; margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }

/* ---------- Формы ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--ink-3); }
.field .hint.err { color: var(--err); }
.input, .select, textarea.input { height: 42px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; width: 100%; }
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input.bad { border-color: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.input-unit { position: relative; }
.input-unit .input { padding-right: 44px; font-variant-numeric: tabular-nums; font-size: 16px; }
.input-unit span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 13px; pointer-events: none; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.qty button { width: 32px; height: 34px; border: 0; background: transparent; cursor: pointer; color: var(--ink-2); }
.qty button:hover { background: var(--surface-3); }
.qty input { width: 48px; height: 34px; border: 0; text-align: center; background: transparent; outline: none; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; }

.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-3); border-radius: 10px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; height: 36px; padding: 0 16px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg.block { display: flex; }
.seg.block button { flex: 1; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .tr { width: 42px; height: 24px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch .tr::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .tr { background: var(--brand); }
.switch input:checked + .tr::after { transform: translateX(18px); }

/* ---------- Вход ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; background: #1b1d22; color: #fff; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 40px; }
.auth-art::before { content: ""; position: absolute; inset: 0; background: radial-gradient(900px 500px at 20% 110%, rgba(240,88,43,.55), transparent 60%), radial-gradient(700px 400px at 100% 0%, rgba(255,255,255,.08), transparent 60%); }
.auth-art .doors { display: flex; gap: 18px; align-items: flex-end; justify-content: center; opacity: .9; flex: 1; padding: 40px 0; }
.auth-art .doors div { width: 120px; height: 280px; border: 2px solid rgba(255,255,255,.35); border-radius: 4px; position: relative; background: linear-gradient(160deg, rgba(255,255,255,.12), rgba(255,255,255,.02)); }
.auth-art .doors div:nth-child(2) { height: 330px; width: 140px; border-color: rgba(240,88,43,.8); }
.auth-art .doors div::after { content: ""; position: absolute; right: 14px; top: 50%; width: 4px; height: 60px; border-radius: 3px; background: rgba(255,255,255,.6); }
.auth-art > * { position: relative; }
.auth-art h1 { font-size: 40px; font-weight: 400; max-width: 460px; line-height: 1.15; }
.auth-art p { color: rgba(255,255,255,.7); max-width: 420px; margin-top: 14px; }
.auth-art .logo img { background: #fff; border-radius: 8px; padding: 6px 10px; box-sizing: content-box; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.auth-form h2 { font-size: 26px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* ---------- Список заказов/позиций ---------- */
.order-id { font-weight: 500; }
.doors-list { display: flex; flex-direction: column; gap: 12px; }
.door-row { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: 20px; align-items: center; padding: 16px 20px; }
.door-row .t { font-weight: 500; }
.door-row .money { text-align: right; min-width: 120px; }
.door-row .money small { display: block; color: var(--ink-3); font-size: 12px; }
@media (max-width: 800px) { .door-row { grid-template-columns: 1fr 1fr; } }

/* ---------- Конфигуратор ---------- */
.cfg { display: grid; grid-template-columns: 250px minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1280px) { .cfg { grid-template-columns: 220px minmax(0, 1fr); } .cfg-side { grid-column: 1 / -1; } }
@media (max-width: 860px) { .cfg { grid-template-columns: 1fr; } }
.steps { position: sticky; top: 76px; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 860px) { .steps { position: static; flex-direction: row; overflow-x: auto; } .step { flex: none; } }
.step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; cursor: pointer; border: 0; background: transparent; text-align: left; color: var(--ink-2); width: 100%; }
.step:hover { background: var(--surface-3); color: var(--ink); }
.step.on { background: var(--ink); color: var(--surface); }
.step .n { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; font-size: 12px; flex: none; font-variant-numeric: tabular-nums; }
.step.done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.todo .n { border-color: var(--brand); color: var(--brand); }
.step.on .n { border-color: rgba(255,255,255,.4); }
.step.on.done .n { border-color: var(--ok); }
.step .tx { line-height: 1.2; min-width: 0; }
.step .tx b { font-weight: 500; font-size: 14px; display: block; }
.step .tx small { font-size: 12px; color: var(--ink-3); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.step.on .tx small { color: color-mix(in srgb, var(--surface) 70%, transparent); }
.step.disabled { opacity: .45; pointer-events: none; }

.panel { padding: 24px; min-height: 480px; }
.panel-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-h p { color: var(--ink-3); margin-top: 4px; }
.panel-f { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.section { margin-top: 24px; }
.section:first-child { margin-top: 0; }
.section > .label { display: block; margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.opts.lg { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.opts.text { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.opt { position: relative; display: flex; flex-direction: column; text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--r); overflow: hidden; cursor: pointer; padding: 0; transition: border-color .15s, box-shadow .15s, transform .15s; }
.opt:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.opt.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.opt.off { opacity: .45; cursor: not-allowed; }
.opt.off:hover { transform: none; box-shadow: none; }
.opt .img { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
/* миниатюры: одинаковая рамка, картинка вписывается целиком (поля вокруг предмета обрезаются в ui.js) */
.opt .img img { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); object-fit: contain; mix-blend-mode: multiply; }
.opts.lg .opt .img { aspect-ratio: 3 / 4; }
.opt .img .ph { color: var(--ink-3); opacity: .6; }
.opt .img .ph svg.i { width: 40px; height: 40px; stroke-width: 1.2; }
.opt .t { padding: 10px 12px 12px; font-size: 14px; font-weight: 500; line-height: 1.3; }
.opt .t small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; margin-top: 3px; }
.opt .chk { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: none; place-items: center; box-shadow: var(--shadow-sm); }
.opt .chk svg.i { width: 14px; height: 14px; stroke-width: 3; }
.opt.on .chk { display: grid; }
.opt .zoom { position: absolute; top: 8px; left: 8px; width: 28px; height: 28px; border-radius: 8px; background: color-mix(in srgb, var(--surface) 85%, transparent); display: none; place-items: center; color: var(--ink-2); border: 1px solid var(--line); }
.opt:hover .zoom { display: grid; }
.opt .zoom svg.i { width: 15px; height: 15px; }
.opt.row-opt { flex-direction: row; align-items: center; gap: 12px; padding: 14px 16px; }
.opt.row-opt .t { padding: 0; flex: 1; }
.opt.row-opt .chk { position: static; }
.opt.row-opt:not(.on) .chk { display: grid; background: transparent; border: 1.5px solid var(--line-2); }
.opt.row-opt:not(.on) .chk svg { display: none; }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.swatch { border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 8px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 8px; position: relative; transition: border-color .15s, box-shadow .15s; }
.swatch:hover { border-color: var(--line-2); }
.swatch.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.swatch .chip { height: 64px; border-radius: 8px; border: 1px solid rgba(0,0,0,.08); background-size: cover; background-position: center; display: grid; place-items: center; color: var(--ink-3); background-color: var(--surface-3); }
.swatch .nm { font-size: 13px; font-weight: 500; line-height: 1.25; padding: 0 2px 2px; }
.swatch .nm small { display: block; color: var(--ink-3); font-weight: 400; }
.swatch .chk { position: absolute; top: 14px; right: 14px; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; display: none; place-items: center; }
.swatch.on .chk { display: grid; }
.swatch .chk svg.i { width: 13px; height: 13px; stroke-width: 3; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; cursor: pointer; color: var(--ink-3); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brand); }
.tabs .cnt { font-size: 11px; background: var(--surface-3); border-radius: 99px; padding: 1px 7px; color: var(--ink-2); }
.tabs .cnt.sel { background: var(--brand); color: #fff; }

/* Правая колонка — сводка */
.cfg-side { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1280px) { .cfg-side { position: static; } }
.preview { display: grid; grid-template-columns: 1fr 88px; gap: 10px; padding: 12px; }
.preview .main { position: relative; background: var(--surface-2); border-radius: 10px; aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden; cursor: zoom-in; }
.preview .main img { position: absolute; inset: 14px; width: calc(100% - 28px); height: calc(100% - 28px); object-fit: contain; mix-blend-mode: multiply; }
.preview .thumbs { display: flex; flex-direction: column; gap: 10px; }
.preview .thumbs button { position: relative; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface-2); padding: 0; aspect-ratio: 1; overflow: hidden; cursor: pointer; }
.preview .thumbs button.on { border-color: var(--brand); }
.preview .thumbs img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: contain; mix-blend-mode: multiply; }
.summary-h { padding: 14px 16px 0; }
.summary-h .name { font-weight: 500; font-size: 16px; line-height: 1.3; }
.sizes { width: 100%; border-collapse: collapse; font-size: 13px; }
.sizes th, .sizes td { padding: 7px 16px; text-align: right; font-variant-numeric: tabular-nums; }
.sizes th { font-weight: 500; color: var(--ink-3); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.sizes th:first-child, .sizes td:first-child { text-align: left; color: var(--ink-2); }
.sizes tr + tr td { border-top: 1px dashed var(--line); }
.sizes tr.hl td { color: var(--ink); font-weight: 500; }
.kv { display: flex; flex-direction: column; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 16px; font-size: 13px; border-top: 1px solid var(--line); }
.kv dt, .kv span:first-child { color: var(--ink-3); }
.kv b { font-weight: 500; text-align: right; }
.total { padding: 16px; display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); }
.total b { font-size: 22px; font-weight: 500; }
.side-actions { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.dirty-note { margin: 0 16px 12px; }

.fit-sel { display: flex; flex-direction: column; gap: 10px; }
.fit-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.fit-item img { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: var(--surface); padding: 3px; }
.fit-item .t { flex: 1; font-weight: 500; font-size: 14px; }
.fit-item .t small { display: block; color: var(--ink-3); font-weight: 400; }
.char-block { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.char-block + .char-block { margin-top: 14px; }
.char-block h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--line-2); background: var(--surface); padding: 6px 12px 6px 6px; border-radius: 99px; cursor: pointer; font-size: 13px; font-weight: 500; }
.chip-btn:not(:has(img, .cdot)) { padding-left: 12px; }
.chip-btn img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--surface-3); }
.chip-btn .cdot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }
.chip-btn:hover { border-color: var(--ink-3); }
.chip-btn.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

/* ---------- Модалки, тосты ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(15, 16, 20, .55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .18s cubic-bezier(.2, .9, .3, 1.2); }
.modal.wide { max-width: 1000px; }
.modal.img { max-width: 760px; background: var(--surface-2); }
.modal.img img { width: 100%; max-height: 80vh; object-fit: contain; display: block; }
.modal-h { padding: 18px 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.modal-h h2 { font-size: 18px; flex: 1; }
.modal-b { padding: 20px; overflow: auto; }
.modal-f { padding: 14px 20px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast { background: var(--ink); color: var(--surface); padding: 12px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; font-size: 14px; animation: pop .2s; }
.toast.err { background: var(--err); color: #fff; }
.toast.ok svg.i { color: var(--ok); }
.toast .x { margin-left: auto; cursor: pointer; opacity: .6; background: none; border: 0; color: inherit; padding: 0; }

.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.loading-block { display: grid; place-items: center; min-height: 240px; color: var(--ink-3); gap: 12px; }
.loader { width: 28px; height: 28px; border: 3px solid var(--line-2); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.busy-overlay { position: fixed; inset: 0; z-index: 150; background: color-mix(in srgb, var(--bg) 70%, transparent); display: grid; place-items: center; }
.busy-overlay .box { background: var(--surface); padding: 24px 28px; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); display: flex; gap: 16px; align-items: center; }

.hide-sm { }
@media (max-width: 720px) {
  .hide-sm { display: none !important; }
  .topbar-in { padding: 10px 14px; gap: 12px; }
  .page { padding: 18px 14px 60px; }
  .userbox .who { display: none; }
  .nav a span { display: none; }
  .panel { padding: 16px; }
  .opts { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 12px; }
  .stat .k { font-size: 10px; }
  .stat .v { font-size: 16px; }
}
/* тёмная тема: у картинок каталога светлый фон, поэтому подложка остаётся светлой */
:root[data-theme="dark"] .opt .img, :root[data-theme="dark"] .preview .main, :root[data-theme="dark"] .preview .thumbs button { background: #eceae6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .opt .img, :root:not([data-theme="light"]) .preview .main, :root:not([data-theme="light"]) .preview .thumbs button { background: #eceae6; } }

/* Профиль: скидка и менеджер */
.perks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.perk { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.perk-accent { background: var(--brand-soft); border-color: var(--brand-line); }
.perk-l { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.perk-v { font-size: 30px; font-weight: 600; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.perk-accent .perk-v { color: var(--brand); }
.perk-name { font-size: 20px; padding: 5px 0 4px; overflow-wrap: anywhere; }
.perk-h { font-size: 12px; color: var(--ink-3); }
.perks:has(> .perk:only-child) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 640px) { .perks, .perks:has(> .perk:only-child) { grid-template-columns: 1fr; } }
