/* ============================================================
   Фирменный стиль «Медведь — студия автозвука»
   Палитра взята из логотипа: графит, тёплые оттенки коричневого, мех.
   ============================================================ */
:root {
  --ink: #1e1c1a;            /* графит — текст логотипа */
  --ink-2: #2b2521;
  --brown-900: #3a2820;
  --brown-800: #4a2a20;      /* подпись «студия автозвука» */
  --brown-700: #6b4430;
  --brown-600: #7e553b;
  --brown-500: #8d6750;      /* полосы логотипа */
  --brown-400: #a18067;
  --brown-300: #c2a792;
  --fur: #b57c47;            /* мех медведя — акцент */
  --bg: #f6f2ee;
  --surface: #ffffff;
  --surface-2: #faf7f4;
  --line: #e8dfd7;
  --line-strong: #d6c8bb;
  --text: var(--ink);
  --muted: #7a6d63;
  --accent: #8a5a3b;
  --accent-hover: #6d4530;
  --accent-soft: #f3e9e0;
  --ok: #2f7a47;
  --ok-soft: #e7f3ea;
  --warn: #a8620c;
  --warn-soft: #fbf0df;
  --err: #b3362c;
  --err-soft: #fbeae8;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(58, 40, 32, .06), 0 4px 16px rgba(58, 40, 32, .06);
  --shadow-lg: 0 10px 40px rgba(30, 28, 26, .16);
  --bars: linear-gradient(90deg, #5e3b28, #7a5139, #8d6750, #a18067, #b8997f);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
h1 { font-size: 1.75rem; margin: .2rem 0 1.1rem; letter-spacing: -.02em; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0 0 .9rem; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
code { background: var(--accent-soft); color: var(--brown-800); padding: 1px 6px; border-radius: 5px; font-size: .88em; word-break: break-all; }
.container { max-width: 1340px; margin: 0 auto; padding: 26px 20px 48px; width: 100%; }
.narrow { max-width: 660px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.err { color: var(--err); }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }
::selection { background: var(--brown-300); color: var(--ink); }

/* ---------- шапка ---------- */
.topbar { background: var(--surface); position: sticky; top: 0; z-index: 30; box-shadow: 0 1px 0 var(--line), 0 6px 20px rgba(58, 40, 32, .05); }
.topbar-inner { max-width: 1340px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); flex: none; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 56px; width: auto; display: block; }
.brand-mark { display: none; height: 40px; width: 40px; }
.brand-sub { font-size: .72rem; line-height: 1.15; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700;
  border-left: 2px solid var(--line); padding-left: 12px; }
.brand-bars { display: flex; height: 4px; }
.brand-bars i { flex: 1; }
.brand-bars i:nth-child(1) { background: #4e3122; } .brand-bars i:nth-child(2) { background: #5e3b28; }
.brand-bars i:nth-child(3) { background: #6f4832; } .brand-bars i:nth-child(4) { background: #7e553b; }
.brand-bars i:nth-child(5) { background: #8d6750; } .brand-bars i:nth-child(6) { background: #9a775e; }
.brand-bars i:nth-child(7) { background: #a88770; } .brand-bars i:nth-child(8) { background: #b8997f; }
.topsearch { flex: 1; max-width: 520px; position: relative; }
.topsearch input { width: 100%; padding-left: 40px; background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%237a6d63' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center; border-radius: 999px; }
.mainnav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.mainnav > a { color: var(--ink-2); padding: 8px 14px; border-radius: 999px; white-space: nowrap; font-weight: 600; font-size: .95rem; }
.mainnav > a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.mainnav > a.active { background: var(--ink); color: #fff; }
.badge { background: var(--fur); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: .75rem; font-weight: 800; margin-left: 4px; }
.mainnav > a.active .badge { background: var(--fur); }
.usermenu { position: relative; margin-left: 6px; }
.usermenu summary { list-style: none; cursor: pointer; padding: 7px 12px 7px 7px; border-radius: 999px; max-width: 230px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .93rem; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); }
.usermenu summary::before { content: ""; width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--bars); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary::after { content: "▾"; color: var(--muted); font-size: .8rem; }
.usermenu[open] summary { background: var(--surface-2); }
.usermenu-body { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 10px; min-width: 240px; display: grid; gap: 2px; }
.usermenu-body > .muted { padding: 4px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.usermenu-body a, .usermenu-body .linkbtn { padding: 8px 10px; border-radius: 8px; text-align: left; color: var(--ink); display: block; width: 100%; }
.usermenu-body a:hover, .usermenu-body .linkbtn:hover { background: var(--accent-soft); text-decoration: none; }

.footer { background: var(--ink); color: #cbbcaf; margin-top: 30px; font-size: .86rem; }
.footer-inner { max-width: 1340px; margin: 0 auto; padding: 18px 20px; display: flex; align-items: center; gap: 14px; }
.footer-inner span { flex: 1; }
.footer a { color: #e2d3c5; }
.footer a:hover { color: #fff; }

/* ---------- формы ---------- */
input, select, textarea {
  font: inherit; color: inherit; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 12px; min-height: 40px; max-width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--brown-300); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(138, 90, 59, .16); }
input[type=checkbox] { min-height: 0; width: 17px; height: 17px; accent-color: var(--accent); }
input[type=file] { padding: 7px; background: var(--surface-2); }
textarea { resize: vertical; }
.form { display: grid; gap: 15px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.form label input, .form label select, .form label textarea { font-weight: 400; color: var(--ink); }
.form label.check, label.check { display: flex; align-items: center; gap: 9px; font-weight: 500; }
.form-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-top: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 8px; }
legend { font-weight: 700; padding: 0 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 700; cursor: pointer;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink); padding: 9px 18px; border-radius: 10px; min-height: 40px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--brown-300); text-decoration: none; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, #936241, #7a4f33); border-color: #6e4630; color: #fff;
  box-shadow: 0 2px 6px rgba(122, 79, 51, .28), inset 0 1px 0 rgba(255,255,255,.14); }
.btn-primary:hover { background: linear-gradient(180deg, #84563a, #67412b); border-color: #5c3a26; color: #fff; }
.btn-incart { background: var(--ok-soft); border-color: #bddcc6; color: var(--ok); }
.btn-incart:hover { background: #dcefe1; border-color: #a9d2b5; color: var(--ok); }
.btn-ghost { background: transparent; }
.btn-small { padding: 6px 13px; min-height: 34px; font-size: .88rem; border-radius: 9px; }
.btn-lg { padding: 12px 26px; font-size: 1.05rem; min-height: 48px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.linkbtn { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; font-weight: 600; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; color: var(--accent-hover); }
.linkbtn.danger { color: var(--err); }
.iconbtn { background: none; border: 0; font-size: 1.35rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 3px 9px; border-radius: 8px; }
.iconbtn:hover { background: var(--err-soft); color: var(--err); }

.flash { padding: 12px 16px 12px 44px; border-radius: 12px; margin: 0 0 18px; border: 1px solid transparent; position: relative; }
.flash::before { position: absolute; left: 14px; top: 11px; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .8rem; color: #fff; }
.flash ul { margin: 6px 0 0; padding-left: 20px; }
.flash-ok { background: var(--ok-soft); border-color: #c7e3cf; color: #1f5a33; }
.flash-ok::before { content: "✓"; background: var(--ok); }
.flash-error { background: var(--err-soft); border-color: #f1cdc9; color: #86271f; }
.flash-error::before { content: "!"; background: var(--err); }
.flash-info { background: var(--accent-soft); border-color: #e6d4c5; color: var(--brown-800); }
.flash-info::before { content: "i"; background: var(--brown-500); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card > summary { cursor: pointer; font-weight: 700; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.stack { display: grid; gap: 9px; justify-items: start; }

.pill { display: inline-block; border-radius: 999px; padding: 3px 11px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-wait { background: var(--warn-soft); color: var(--warn); }
.pill-err { background: var(--err-soft); color: var(--err); }
.tag { display: inline-block; background: var(--fur); color: #fff; border-radius: 6px; padding: 1px 7px; font-size: .78rem; font-weight: 800; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 18px; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.grid th { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--brown-700); font-weight: 800; background: var(--surface-2); white-space: nowrap; }
.grid tbody tr { transition: background .12s; }
.grid tbody tr:hover { background: #fcf8f4; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); border-bottom: 0; background: var(--surface-2); }
.grid.compact td { padding: 7px 12px; }
.grid .num { text-align: right; white-space: nowrap; }
.grid .total { font-size: 1.15rem; font-weight: 800; }
.row-changed { background: #fbf6ee; }
.row-warn { background: #fff8ee !important; }
.col-img { width: 64px; padding-right: 0 !important; }
.col-img img { width: 48px; height: 48px; object-fit: contain; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); display: block; }
.img-ph { display: block; width: 48px; height: 48px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2) url("/static/mark.png") center / 30px no-repeat; filter: grayscale(1); opacity: .45; }
.pname { color: var(--ink); font-weight: 600; }
.pname:hover { color: var(--accent); }
.price b { font-size: 1.05rem; font-weight: 800; }
.old { color: var(--muted); text-decoration: line-through; font-size: .8rem; }
.stock { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.stock::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.stock-many { color: var(--ok); }
.stock-few { color: var(--warn); }
.stock-none { color: var(--muted); font-weight: 500; }
.col-buy { width: 220px; }
.buy { display: flex; gap: 6px; align-items: center; }
.buy input { width: 76px; text-align: right; }
.buy-lg input { width: 110px; min-height: 48px; font-size: 1.05rem; }
.buy-lg .btn { min-height: 48px; padding: 0 26px; font-size: 1rem; }
.qty-input { width: 96px; text-align: right; }
.actions-cell form { display: flex; gap: 14px; flex-wrap: wrap; }
form.inline { display: inline; }

/* ---------- каталог ---------- */
.catalog { display: grid; grid-template-columns: 260px 1fr; gap: 26px; align-items: start; }
.sidebar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; position: sticky; top: 92px;
  max-height: calc(100vh - 112px); overflow: auto; box-shadow: var(--shadow); }
.side-title { font-weight: 800; margin: 2px 6px 10px; text-transform: uppercase; letter-spacing: .07em; font-size: .76rem; color: var(--brown-700); }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 12px; margin-left: 8px; border-left: 1px solid var(--line); }
.tree a { display: flex; justify-content: space-between; gap: 6px; padding: 7px 10px; border-radius: 9px; color: var(--ink-2); font-size: .93rem; }
.tree a .muted { font-size: .8rem; }
.tree a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.tree a.active { background: var(--ink); color: #fff; font-weight: 700; }
.tree a.active .muted { color: #cbbcaf; }
.side-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.crumbs { color: var(--muted); font-size: .86rem; margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.catalog-main { min-width: 0; }
.catalog-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.catalog-head h1 { margin-bottom: .8rem; }
.catalog-head .muted { background: var(--surface); border: 1px solid var(--line); padding: 2px 10px; border-radius: 999px; font-size: .85rem; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; padding: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); }
.filters input[type=search] { flex: 1; min-width: 200px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 14px 0; }
.pager a, .pager span { padding: 7px 14px; border-radius: 999px; }
.pager a { background: var(--surface); border: 1px solid var(--line); font-weight: 600; }
.pager a:hover { border-color: var(--brown-300); text-decoration: none; }
.pager span { color: var(--muted); }
.sync-note { text-align: right; }
.empty { text-align: center; padding: 60px 16px; }
.empty h2 { font-size: 1.35rem; }
.empty-code { font-size: 4rem; font-weight: 900; background: var(--bars); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; margin-bottom: 10px; }

.toast { position: fixed; right: 22px; bottom: 22px; background: var(--ink); color: #fff; padding: 13px 18px 13px 16px; border-radius: 12px;
  box-shadow: var(--shadow-lg); z-index: 50; max-width: 380px; border-left: 4px solid var(--fur); font-weight: 500; }
.toast.warn { border-left-color: #f0a33a; }

/* ---------- карточка товара ---------- */
.product { display: grid; grid-template-columns: minmax(280px, 440px) 1fr; gap: 32px; margin-bottom: 28px; }
.product-media { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); aspect-ratio: 1; display: flex;
  align-items: center; justify-content: center; overflow: hidden; box-shadow: var(--shadow); padding: 16px; }
.product-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.product > * { min-width: 0; }
.noimg { color: var(--muted); display: grid; justify-items: center; gap: 10px; }
.noimg::before { content: ""; width: 96px; height: 96px; background: url("/static/mark.png") center / contain no-repeat; opacity: .22; filter: grayscale(1); }
.product-info h1 { font-size: 1.9rem; }
.props { display: grid; grid-template-columns: max-content 1fr; gap: 8px 22px; margin: 0 0 18px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; font-weight: 500; }
.buybox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; display: grid; gap: 16px;
  box-shadow: var(--shadow); margin-bottom: 18px; position: relative; overflow: hidden; }
.buybox::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--bars); }
.big { font-size: 2rem; font-weight: 900; letter-spacing: -.03em; }
.stores { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: .9rem; }
.description { white-space: pre-line; color: var(--ink-2); }

/* ---------- корзина ---------- */
.cart-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.checkout { max-width: 920px; position: relative; overflow: hidden; }
.checkout::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--bars); }
.checkout-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-top: 16px; border-top: 1px dashed var(--line-strong); }
.total-big { font-size: 1.3rem; }
.total-big b { font-weight: 900; }
.import { max-width: 920px; }
.import summary { font-weight: 700; }
.import form { margin-top: 12px; }

/* ---------- заказы ---------- */
.order-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.order-head h1 { margin-bottom: .6rem; }
.order-meta { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.order-meta .sub { color: var(--ink-2); font-size: .85rem; }
.order-meta .muted { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.order-meta .wide { grid-column: 1 / -1; }
.actions { margin-bottom: 18px; }

/* ---------- фото товаров ---------- */
.product-media { position: relative; }
.gal-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(255,255,255,.92); font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ink); box-shadow: var(--shadow); }
.gal-nav:hover { background: #fff; border-color: var(--brown-300); }
.gal-prev { left: 10px; } .gal-next { right: 10px; }
.gallery-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { width: 68px; height: 68px; padding: 4px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb:hover { border-color: var(--brown-300); }
.thumb.active { border-color: var(--accent); }
.zoomable { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(18, 15, 14, .94); display: flex; align-items: center; justify-content: center; }
.lb-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 56px 72px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; transition: transform .2s ease; background: #fff; border-radius: 6px;
  user-select: none; -webkit-user-drag: none; }
.lightbox.zoomed .lb-stage img { cursor: zoom-out; transition: transform .2s ease, transform-origin .05s linear; }
.lb-btn { position: absolute; z-index: 2; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(20,16,14,.55); color: #fff; backdrop-filter: blur(4px);
  font-size: 2rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lb-btn:hover { background: rgba(20,16,14,.8); }
.lb-close { top: 14px; right: 16px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-hint { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #cbbcaf; font-size: .85rem; pointer-events: none; }
body.lb-open { overflow: hidden; }
@media (max-width: 860px) { .lb-stage { padding: 56px 8px; } .lb-hint { display: none; } }
.product-left { display: grid; gap: 12px; align-content: start; }
.photo-upload { display: grid; gap: 6px; text-align: center; }
.photo-upload label.btn { cursor: pointer; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 34px 20px; text-align: center; background: var(--surface-2);
  display: grid; justify-items: center; gap: 8px; transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon { width: 64px; height: 64px; background: url("/static/mark.png") center / contain no-repeat; opacity: .85; }
.dz-title { font-weight: 800; font-size: 1.1rem; }
.dz-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.dz-progress { width: 100%; max-width: 420px; display: grid; gap: 6px; margin-top: 8px; }
.dz-bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.dz-bar i { display: block; height: 100%; width: 0; background: var(--bars); transition: width .2s; }
.stats-3 { grid-template-columns: repeat(3, 1fr); }
.spinner { width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- админка ---------- */
.subnav, .tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 22px; padding: 5px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; width: fit-content; max-width: 100%; }
.subnav a, .tabs a { padding: 7px 15px; color: var(--ink-2); border-radius: 999px; font-weight: 600; font-size: .92rem; }
.subnav a:hover, .tabs a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.subnav a.active, .tabs a.active { background: var(--ink); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; left: 18px; bottom: 0; width: 34px; height: 3px; background: var(--fur); border-radius: 3px 3px 0 0; }
.stat-v { font-size: 1.8rem; font-weight: 900; letter-spacing: -.02em; }
.stat-bad .stat-v { color: var(--err); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist li { padding-left: 32px; position: relative; }
.checklist li::before { position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 900; }
.checklist li.ok::before { content: "✓"; background: var(--ok-soft); color: var(--ok); }
.checklist li.todo::before { content: "!"; background: var(--warn-soft); color: var(--warn); }
.errors { margin: 0; padding-left: 18px; font-size: .9rem; }
.ac-list { border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow-lg); max-height: 280px; overflow: auto; }
.ac-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; font: inherit; cursor: pointer; }
.ac-list button:hover, .ac-list button:focus { background: var(--accent-soft); outline: none; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); border: 1px dashed var(--brown-300);
  padding: 11px 13px; border-radius: 10px; margin: 8px 0; word-break: break-all; font-size: .95rem; letter-spacing: .03em; color: var(--brown-800); }
.selectable { user-select: all; }
.steps { padding-left: 20px; display: grid; gap: 12px; }
.policy { white-space: pre-line; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; max-height: 280px; overflow: auto; font-size: .92rem; margin-bottom: 14px; }
.manager { margin-top: 12px; padding: 12px 14px; background: var(--accent-soft); border-radius: 10px; border-left: 3px solid var(--fur); }
.narrow-card { max-width: 540px; }

/* ---------- вход ---------- */
body.auth { background: var(--bg); }
.auth-wrap { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; color: #efe4da; padding: 56px 60px; display: flex; flex-direction: column; gap: 48px;
  background: radial-gradient(1200px 600px at 20% 10%, #3a2a22 0%, transparent 60%), linear-gradient(160deg, #26201c 0%, #1a1715 60%, #120f0e 100%); }
.auth-logo { width: min(440px, 100%); height: auto; }
.auth-hero-text h2 { font-size: 2.3rem; line-height: 1.15; font-weight: 900; letter-spacing: -.02em; color: #fff; margin: 0 0 22px; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; max-width: 460px; }
.auth-points li { padding-left: 34px; position: relative; color: #cbbcaf; }
.auth-points li b { color: #fff; }
.auth-points li::before { content: ""; position: absolute; left: 0; top: 5px; width: 18px; height: 12px; border-radius: 2px;
  background: linear-gradient(90deg, var(--brown-500), var(--brown-400)); transform: skewX(-12deg); }
.auth-bars { position: absolute; left: 60px; right: 60px; bottom: 0; height: 120px; display: flex; align-items: flex-end; gap: 10px; opacity: .9; }
.auth-bars i { flex: 1; border-radius: 4px 4px 0 0; transform: skewX(-8deg); }
.auth-bars i:nth-child(1) { height: 18%; background: #4e3122; } .auth-bars i:nth-child(2) { height: 28%; background: #5e3b28; }
.auth-bars i:nth-child(3) { height: 38%; background: #6f4832; } .auth-bars i:nth-child(4) { height: 48%; background: #7e553b; }
.auth-bars i:nth-child(5) { height: 58%; background: #8d6750; } .auth-bars i:nth-child(6) { height: 70%; background: #9a775e; }
.auth-bars i:nth-child(7) { height: 84%; background: #a88770; } .auth-bars i:nth-child(8) { height: 100%; background: #b8997f; }
.auth-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 34px 36px; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); }
.auth-card-logo { display: none; width: 220px; height: auto; margin: 0 auto 18px; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: .9rem; }
.auth-links { margin: 16px 0 6px; text-align: center; }
.auth-brand, .auth-title { display: none; }

/* ---------- адаптив ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .topsearch { display: none; }
  .brand-sub { display: none; }
}
@media (max-width: 960px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-card-logo { display: block; }
}
@media (max-width: 860px) {
  .catalog, .product, .cols, .form-row { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; max-height: 260px; }
  .filters input[type=search] { min-width: 0; flex-basis: 100%; }
  .container { padding: 16px 12px 32px; }
  .order-meta { grid-template-columns: 1fr 1fr; }
  .topbar-inner { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .brand-logo { display: none; }
  .brand-mark { display: block; }
  .mainnav { margin-left: auto; flex-wrap: wrap; }
  .mainnav > a { padding: 7px 11px; }
  .topbar-inner { flex-wrap: nowrap; }
  .mainnav { flex-wrap: nowrap; gap: 0; }
  .usermenu summary { font-size: 0; gap: 0; padding: 3px; border: 0; }
  .usermenu summary::after { display: none; }
  .usermenu summary::before { width: 32px; height: 32px; }
  .col-buy { width: auto; }
  .stats { grid-template-columns: 1fr 1fr; }
  .subnav, .tabs { border-radius: 14px; }
  .footer-inner { flex-wrap: wrap; }
  h1 { font-size: 1.45rem; }
}

/* ---------- кнопки заказа и печать ---------- */
.order-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.print-head { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { background: #fff; font-size: 11pt; }
  .topbar, .footer, .no-print, .subnav, .crumbs, .flash-ok, #order-new, .usermenu, .toast, .lightbox { display: none !important; }
  .container { max-width: none; padding: 0; }
  .print-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid #7e553b;
    padding-bottom: 6px; margin-bottom: 12px; color: #7a6d63; font-size: 9pt; }
  .print-head img { height: 44px; width: auto; }
  .card, .table-wrap { box-shadow: none !important; border-color: #ccc; break-inside: avoid; }
  .grid th { background: #f3eee9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .grid td, .grid th { padding: 6px 8px; }
  .grid tr { break-inside: avoid; }
  .pill { border: 1px solid #ccc; }
  a { color: inherit; text-decoration: none; }
  h1 { font-size: 18pt; }
}

/* статусы заказов */
.status-tabs .tab-n { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); font-size: .78rem; line-height: 18px; text-align: center; }
.status-tabs a.active .tab-n { background: rgba(255,255,255,.22); color: #fff; }
.status-tabs .tabs-label { align-self: center; padding: 0 8px 0 10px; color: var(--ink-2); font-size: .86rem; }
.sort-link { color: inherit; white-space: nowrap; }
.sort-link:hover { text-decoration: none; color: var(--brand, inherit); }
.sort-link.active { color: var(--ink); }

/* управление фото товара */
.pm { margin-top: 14px; padding: 14px; display: grid; gap: 10px; }
.pm-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pm-staff { margin-left: auto; }
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.pm-item { position: relative; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: #fff; cursor: grab; transition: box-shadow .15s, transform .15s; }
.pm-item img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.pm-item.pm-main { border: 2px solid var(--brand, #7e553b); }
.pm-item.pm-dragging { opacity: .45; transform: scale(.96); }
.pm-item:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.pm-badge { position: absolute; top: 5px; left: 5px; padding: 1px 7px; border-radius: 999px; font-size: .72rem; font-weight: 700;
  background: rgba(30,28,26,.72); color: #fff; }
.pm-main .pm-badge { background: var(--brand, #7e553b); }
.pm-tools { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between;
  background: linear-gradient(transparent, rgba(0,0,0,.55)); padding: 14px 3px 3px; opacity: 0; transition: opacity .15s; }
.pm-item:hover .pm-tools, .pm-item:focus-within .pm-tools { opacity: 1; }
@media (hover: none) { .pm-tools { opacity: 1; } }
.pm-tools button { width: 24px; height: 24px; border: 0; border-radius: 6px; background: rgba(255,255,255,.92); color: var(--ink);
  font-size: .9rem; line-height: 1; cursor: pointer; padding: 0; }
.pm-tools button:disabled { opacity: .35; cursor: default; }
.pm-tools button.pm-del { background: #c0392b; color: #fff; }
.pm-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.pm-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pm-add label.btn { cursor: pointer; }
.pm-add.pm-locked { opacity: .45; pointer-events: none; }
.pm-url { display: flex; gap: 6px; flex: 1 1 220px; min-width: 0; }
.pm-url input { flex: 1; min-width: 0; }
.pm-status:empty { display: none; }
.pm-status.pm-ok { color: #2e7d32; }
.pm-status.pm-err { color: #c0392b; }
.pm.pm-busy { opacity: .75; }

/* редактирование цен (сотрудники) */
.price-edit { margin-top: 28px; padding: 18px; }
.pe-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.pe-head h2 { margin: 0; }
.pe-table th, .pe-table td { white-space: nowrap; }
.pe-table .pe-name { white-space: normal; min-width: 160px; }
.pe-input { width: 118px; text-align: right; font-variant-numeric: tabular-nums; padding: 6px 8px; }
.pe-extra { background: var(--surface-2); }
.pe-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
