:root {
  --bg: #f3f2ee;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --ink: #1c2220;
  --muted: #69716d;
  --line: #e2e0da;
  --accent: #1b3662;          /* тёмно-синий из логотипа ГРС */
  --accent-ink: #ffffff;
  --accent-soft: #e5eaf3;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --ok: #2c6e49;
  --ok-soft: #e3f1e8;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 16px rgba(20, 30, 25, .05);
  --tabbar: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111413;
    --surface: #1a1e1d;
    --surface-2: #151918;
    --ink: #e7eae8;
    --muted: #9aa29e;
    --line: #2b3130;
    --accent: #9db8e8;
    --accent-ink: #0d1626;
    --accent-soft: #1d2840;
    --danger: #f2a49c;
    --danger-soft: #3a1f1c;
    --ok: #8fd0a8;
    --ok-soft: #1c3127;
    --warn: #e8c271;
    --warn-soft: #362b14;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #111413;
  --surface: #1a1e1d;
  --surface-2: #151918;
  --ink: #e7eae8;
  --muted: #9aa29e;
  --line: #2b3130;
  --accent: #9db8e8;
  --accent-ink: #0d1626;
  --accent-soft: #1d2840;
  --danger: #f2a49c;
  --danger-soft: #3a1f1c;
  --ok: #8fd0a8;
  --ok-soft: #1c3127;
  --warn: #e8c271;
  --warn-soft: #362b14;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--accent); }

svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- каркас */

.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-in {
  max-width: 1100px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 11px; font-weight: 800; letter-spacing: .02em;
}
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; line-height: 1.2; }
.top .who { margin-left: auto; text-align: right; font-size: 13px; line-height: 1.25; }
.top .who b { display: block; font-weight: 600; }
.top .who span { color: var(--muted); }

main {
  max-width: 760px; margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar) + 96px + env(safe-area-inset-bottom));
}
main.wide { max-width: 1100px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-in { max-width: 760px; margin: 0 auto; display: flex; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 4px 8px; min-height: var(--tabbar);
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 500; position: relative;
}
.tab[aria-current="page"] { color: var(--accent); }
.tab .count {
  position: absolute; top: 5px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}

/* ---------- типографика и блоки */

h1 { font-size: 24px; line-height: 1.2; margin: 4px 0 14px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 22px 0 10px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card.pad { padding: 16px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.empty {
  text-align: center; color: var(--muted); padding: 40px 16px;
  border: 1px dashed var(--line); border-radius: var(--radius);
}

.notice { padding: 12px 14px; border-radius: 12px; font-size: 14px; background: var(--accent-soft); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.err { background: var(--danger-soft); color: var(--danger); }

/* ---------- кнопки */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible, .tab:focus-visible, .chip:focus-visible, .input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; padding: 0; color: var(--ink);
}
.icon-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- поля */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 14px; font-weight: 600; }
.field .req { color: var(--danger); }
.field .hint { font-size: 13px; color: var(--muted); }
.field .err { font-size: 13px; color: var(--danger); }
.input {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); font-size: 16px;
}
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field.has-err .input { border-color: var(--danger); }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.search { position: relative; }
.search .i { position: absolute; left: 12px; top: 13px; color: var(--muted); }
.search .input { padding-left: 40px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin: 12px -16px 6px; padding-inline: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label {
  flex: 1 1 140px; display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 15px;
}
.seg input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- каталог */

.cat-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 2px 8px; font-weight: 600; }
.product { display: flex; align-items: center; gap: 12px; padding: 14px; }
.product .name { font-weight: 600; line-height: 1.3; }
.product .descr { font-size: 13px; color: var(--muted); margin-top: 2px; }
.product .price { font-size: 15px; margin-top: 4px; font-weight: 600; }
.product .price span { color: var(--muted); font-weight: 400; font-size: 13px; }

.stepper { display: flex; align-items: center; gap: 6px; }
.stepper .qty { min-width: 28px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.cartbar {
  position: fixed; left: 0; right: 0; z-index: 25;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding: 10px 16px; pointer-events: none;
}
.cartbar .btn {
  pointer-events: auto; max-width: 728px; margin: 0 auto; display: flex; width: 100%;
  min-height: 52px; box-shadow: 0 6px 20px rgba(20, 40, 32, .25); justify-content: space-between;
}

/* ---------- корзина, заказ */

.line { display: flex; gap: 12px; padding: 14px; align-items: center; }
.line + .line { border-top: 1px solid var(--line); }
.totals { display: flex; justify-content: space-between; align-items: baseline; padding: 14px; border-top: 1px solid var(--line); font-weight: 700; font-size: 18px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.badge.new { background: var(--accent-soft); color: var(--accent); }
.badge.work { background: var(--warn-soft); color: var(--warn); }
.badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.cancel, .badge.error { background: var(--danger-soft); color: var(--danger); }
.badge.muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

.order-card { display: block; padding: 14px; text-decoration: none; color: inherit; }
.order-card:hover { border-color: var(--accent); }
.order-card .title { font-weight: 600; }

.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 0; }
.kv > div { padding: 10px 14px; border-top: 1px solid var(--line); font-size: 15px; }
.kv > div:nth-child(-n+2) { border-top: 0; }
.kv .k { color: var(--muted); font-size: 14px; }
.kv .v { word-break: break-word; white-space: pre-wrap; }

.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 15px; margin-bottom: 4px; }

/* ---------- админка */

.subnav { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px 2px; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }

.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; }
.table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.table tr.off td { color: var(--muted); }
.table-wrap { overflow-x: auto; }

code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
pre.json {
  margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--line); overflow-x: auto; font-size: 12px; line-height: 1.5; max-height: 360px;
}
details.log { border-top: 1px solid var(--line); padding: 10px 14px; }
details.log summary { cursor: pointer; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }

.ref-list { max-height: 280px; overflow: auto; font-size: 14px; }
.ref-list div { padding: 6px 14px; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.ref-list div:first-child { border-top: 0; }
.ref-list code { color: var(--accent); flex: none; }

/* ---------- модалка и тост */

dialog {
  border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 24px));
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  max-height: calc(100dvh - 24px);
}
dialog::backdrop { background: rgba(15, 20, 18, .45); }
dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
dialog .head { padding: 18px 18px 6px; font-size: 18px; font-weight: 700; }
dialog .body { padding: 10px 18px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
dialog .foot { padding: 12px 18px 18px; display: flex; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); }
dialog .foot .spacer { flex: 1; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 100;
  bottom: calc(var(--tabbar) + 80px + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- вход */

.login { max-width: 400px; margin: 8vh auto 0; }
.login-logo { display: block; width: 220px; max-width: 70%; margin-bottom: 22px; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 900px) {
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
}
.show-sm { display: none; }
@media (max-width: 520px) {
  .kv { grid-template-columns: 1fr; }
  .kv > div.k { border-top: 1px solid var(--line); padding-bottom: 0; }
  .kv > div.v { border-top: 0; padding-top: 2px; }
  .kv > div:first-child { border-top: 0; }
  .hide-sm { display: none; }
  .show-sm { display: block; }
}

/* ---------- утилиты */

.mt { margin-top: 14px; }
.mt-lg { margin-top: 22px; }
.pad { padding: 16px; }
.right { text-align: right; }
h2.flat { margin: 0 0 8px; }
.req { color: var(--danger); }
.chip[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
a.chip { color: var(--ink); text-decoration: none; }
.order-card .row + .row, .order-card .row + div { margin-top: 4px; }
.card.pad > :first-child { margin-top: 0; }
.card.pad > :last-child { margin-bottom: 0; }
.row > h1 { margin-bottom: 4px; }
.hint { font-size: 13px; color: var(--muted); }
.stack > p, .stack > h3 { margin: 0; }
.icon-btn.danger { color: var(--danger); }
dialog .foot { flex-wrap: nowrap; align-items: center; }
dialog .foot .icon-btn { width: 44px; height: 44px; }

/* ---------- каталог с фото */

.product { align-items: flex-start; }
.thumb {
  flex: none; width: 72px; height: 72px; padding: 0; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2); cursor: zoom-in;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.none { cursor: default; }
.product .bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.product .price { margin-top: 0; }
.sku { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); margin-top: 2px; }
.chip-title { margin: 28px 2px 6px; font-size: 19px; }
.chip-title:first-child { margin-top: 6px; }
.chips[hidden] { display: none; }

dialog.photo { width: min(720px, calc(100vw - 24px)); overflow: hidden; }
.photo-cap { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }

/* ---------- админка: дерево разделов */

.acat { margin: 6px 0 0 calc(var(--depth, 0) * 18px); }
.acat > summary, .acat.folder {
  display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-weight: 600; list-style: none; cursor: pointer;
}
.acat > summary::-webkit-details-marker { display: none; }
.acat > summary::before, .acat.folder::before { content: "▸"; width: 14px; color: var(--muted); flex: none; }
.acat[open] > summary::before { content: "▾"; }
.acat.folder { cursor: default; }
.acat.folder::before { content: "▫"; }
.acat.off > summary, .acat.folder.off { color: var(--muted); }
.acat > .card { margin: 4px 0 10px; }
.table td.thumb-td { width: 52px; padding-right: 0; }
.mini { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; display: block; background: var(--surface-2); }
.notice ul { margin: 8px 0 10px; padding-left: 20px; }
.notice li + li { margin-top: 4px; }
.notice img.preview { display: block; max-height: 180px; max-width: 100%; margin: 0 auto; border-radius: 8px; }
.notice + .search { margin-top: 12px; }
.dt { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 8px; }

/* ---------- каталог: вкладки, плитки разделов, карточки товаров */

.segtabs {
  display: inline-flex; gap: 4px; padding: 4px; margin-top: 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
}
.segtabs button {
  border: 0; background: transparent; padding: 8px 20px; border-radius: 999px;
  font-weight: 600; color: var(--muted); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.segtabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.tile {
  display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--accent); }
.tile:active { transform: scale(.98); }
.tile-img { position: relative; aspect-ratio: 4 / 3; background: #fff; display: grid; place-items: center; overflow: hidden; }
.tile-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 8px; display: block; }
.tile-img.none { background: var(--accent-soft); color: var(--accent); font-size: 30px; font-weight: 700; }
.tile-body { padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.tile-name { font-weight: 600; line-height: 1.25; }
.tile-count { font-size: 12px; color: var(--muted); margin-top: 3px; }

.pgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.pcard {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
/* Квадрат фиксирован: высокое фото не должно растягивать карточку. */
.pcard-img { position: relative; flex: none; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0;
  background: #fff; cursor: zoom-in; overflow: hidden; }
.pcard-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.pcard-img.none { background: var(--surface-2); cursor: default; }
.pcard-body { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.pcard-name {
  font-size: 14px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.pcard-price { margin-top: auto; padding-top: 4px; font-size: 17px; font-weight: 700; }
.pcard-price span { font-size: 13px; font-weight: 400; color: var(--muted); }
.pcard .ctl { margin-top: 6px; }
.pcard .ctl > .btn { width: 100%; }
.pcard .stepper { justify-content: space-between; }

@media (min-width: 600px) {
  .tiles, .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- фото товара: галерея в админке, просмотр у агента */

.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.gimg { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 10px; border: 2px solid var(--line); background: #fff; }
.gimg.cover { border-color: var(--accent); }
.gimg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.gload { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: #69716d; }
.gbadge {
  position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700;
}
.gbtn {
  position: absolute; left: 6px; right: 6px; bottom: 6px; padding: 5px 4px; border: 0; border-radius: 8px;
  background: rgba(255, 255, 255, .94); color: #1c2220; font-size: 11px; font-weight: 600; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
.gdel {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px;
  display: grid; place-items: center; background: rgba(255, 255, 255, .94); color: #b3261e; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
.gdel .i { width: 16px; height: 16px; }
.gadd { margin-top: 10px; align-self: flex-start; cursor: pointer; }
.gadd.busy { pointer-events: none; opacity: .7; }
.gerr:empty { display: none; }

.vis-td { width: 52px; padding-left: 0 !important; vertical-align: middle !important; }
.vis-td .icon-btn { width: 36px; height: 36px; color: var(--muted); }
.table tr.off .vis-td .icon-btn { color: var(--danger); }

.pcount {
  position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px;
  background: rgba(28, 34, 32, .72); color: #fff; font-size: 11px; font-weight: 600;
}
dialog.photo .photo-main { display: block; width: 100%; max-height: 62dvh; object-fit: contain; background: #fff; }
.photo-thumbs { display: flex; gap: 8px; padding: 10px 16px 0; overflow-x: auto; }
.photo-thumbs button {
  flex: none; width: 56px; height: 56px; padding: 0; overflow: hidden; border-radius: 8px;
  border: 2px solid var(--line); background: #fff; cursor: pointer;
}
.photo-thumbs button[aria-current] { border-color: var(--accent); }
.photo-thumbs img { width: 100%; height: 100%; object-fit: contain; }


/* ---------- модификаторы */

.incart { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 4px; }
.opts { color: var(--accent); }
dialog.chooser .head .small { font-weight: 400; margin-top: 2px; }
.mgroup { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 6px; margin: 0; }
.mgroup legend { padding: 0 6px; font-weight: 700; }
.mgroup.has-err { border-color: var(--danger); }
.mgroup .err { font-size: 13px; color: var(--danger); min-height: 0; }
.mopt { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.mopt:first-of-type { border-top: 0; }
.mopt input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; flex: none; }
.mopt[hidden] { display: none; }
.picker { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 0 10px; margin-top: 8px; }
.gp-new { display: grid; grid-template-columns: minmax(0, 1fr) 100px auto; gap: 8px; margin-top: 8px; }
.gp-err:empty, .perr:empty { display: none; }
.pm-list { display: flex; flex-direction: column; gap: 8px; }
.pm-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.pm-num { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.pm-num .input { width: 56px; min-height: 38px; padding: 6px 8px; text-align: center; }
.pm-add { margin-top: 8px; }
dialog .foot .btn { white-space: nowrap; }
dialog.chooser .foot { flex-wrap: wrap; justify-content: flex-end; }
dialog.chooser .foot .primary { flex: 1 1 auto; }
.pm-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.pm-actions .pm-add { margin-top: 0; flex: 1 1 200px; }
.pm-row { flex-wrap: wrap; }
.pm-row > .grow { flex: 1 1 160px; }
.pm-ctl { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.picker[data-multi] { max-height: 220px; }

/* ---------- остаток */

.stock { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stock.none { color: var(--danger); font-weight: 600; }
.pcard.out .pcard-img img { opacity: .45; filter: grayscale(1); }
.pcard.out .pcard-price { color: var(--muted); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.table tr.sep td {
  padding: 8px 14px; background: var(--surface-2); color: var(--muted);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}

/* ---------- карточка товара (шторка) */

dialog.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; margin: auto auto 0; padding: 0;
  border-radius: 20px 20px 0 0; overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; }
@media (min-width: 600px) { dialog.sheet { margin: auto; border-radius: 20px; } }
.sheet-body { flex: 1; overflow: auto; }
.sheet-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0; }
.sheet-photo { background: #fff; margin-top: 8px; }
.sheet-photo .photo-main { display: block; width: 100%; max-height: 46dvh; object-fit: contain; }
.sheet-info { padding: 14px 18px 18px; }
.sheet-name { font-size: 19px; line-height: 1.3; margin: 0; }
.sheet-price { font-size: 22px; font-weight: 700; margin-top: 8px; }
.sheet-price span { font-size: 14px; font-weight: 400; color: var(--muted); }
.sheet-h {
  display: inline-block; margin: 16px 0 8px; padding: 5px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600;
}
.sheet-descr { white-space: pre-line; color: var(--ink); font-size: 15px; line-height: 1.5; }
.sheet-foot {
  display: flex; align-items: flex-end; gap: 10px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
}
.sheet-ctl { display: flex; flex-direction: column; gap: 6px; }
.pcard-name[data-act] { cursor: pointer; }
.pcard-img.none { cursor: pointer; }
.sheet-ctl .btn { white-space: nowrap; }
.cat-cover { aspect-ratio: 4 / 3; max-width: 260px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  display: grid; place-items: center; overflow: hidden; padding: 8px; text-align: center; }
.cat-cover img { width: 100%; height: 100%; object-fit: contain; }
.cat-actions { margin-top: 10px; }
.cat-pick { margin-top: 10px; max-height: 300px; overflow: auto; }
button.gimg { padding: 0; cursor: pointer; }
/* поле количества в «− N +»: без стрелок, вписывается как число */
.stepper .qty {
  width: 52px; min-width: 0; height: 40px; padding: 0 4px; text-align: center;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font: inherit; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink);
  -moz-appearance: textfield; appearance: textfield;
}
.stepper .qty::-webkit-outer-spin-button, .stepper .qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper .qty:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- задачи агента */

.tab .count.warn { background: var(--warn); color: #fff; left: calc(50% - 26px); }
.task-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: inherit; border-left: 4px solid var(--warn); }
.task-card.late, .card.late { border-left: 4px solid var(--danger); }
.task-card .grow { display: flex; flex-direction: column; gap: 2px; }
.task-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); display: grid; place-items: center; flex: none; }
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.fthumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #fff; flex: none; }
.fthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fpdf { display: grid; place-items: center; width: 100%; height: 100%; font-size: 12px; font-weight: 700; color: var(--accent); text-decoration: none; }
.fdel { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border: 0; border-radius: 8px; padding: 0;
  background: rgba(255, 255, 255, .94); color: #b3261e; display: grid; place-items: center; cursor: pointer; }
.fdel .i { width: 15px; height: 15px; }
.fadd { align-self: flex-start; cursor: pointer; }
.fadd.busy { pointer-events: none; opacity: .7; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
details.memo summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details.memo ul { margin: 8px 0 0; padding-left: 20px; font-size: 14px; color: var(--muted); }
details.memo li + li { margin-top: 4px; }
h2 .i { vertical-align: -3px; color: var(--accent); }

/* ---------------------------------------------------------------- каталог для заказчиков */
.top-right { margin-left: auto; }
.contact-card { text-align: center; padding-block: 24px; }
.contact-phone { display: block; font-size: 26px; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.contact-note { color: var(--muted); white-space: pre-line; margin: 0; }
.contact-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.contact-btns .btn { flex: 1 1 130px; justify-content: center; }
.mods-info { font-size: 14px; line-height: 1.45; margin-top: 4px; }

/* ---------------------------------------------------------------- логотип ГРС */
img.brand-mark { object-fit: cover; background: #fff; }
.brand-logo { display: block; height: 38px; width: auto; }
:root[data-theme="dark"] .brand-logo, :root[data-theme="dark"] .login-logo { background: #fff; border-radius: 8px; padding: 3px 6px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo, :root:not([data-theme="light"]) .login-logo { background: #fff; border-radius: 8px; padding: 3px 6px; }
}
