/* ============ Витарус · База — стили ============ */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", Inter, -apple-system, system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", Inter, -apple-system, system-ui, sans-serif;
  --mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;

  --bg: #f3f3f6;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(46,107,78,.08), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(120,170,140,.07), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f8f8fa;
  --surface-3: #eeeef2;
  --glass: rgba(255,255,255,.72);
  --text: #15161a;
  --text-2: #3b3d45;
  --muted: #71737e;
  --faint: #a3a5b0;
  --line: rgba(18,20,30,.08);
  --line-2: rgba(18,20,30,.14);
  --accent: #2e6b4e;
  --accent-2: #3d8463;
  --accent-soft: rgba(46,107,78,.11);
  --accent-ink: #ffffff;
  --tender: #b4540a;
  --tender-soft: rgba(230,126,34,.12);
  --design: #0a7d6e;
  --design-soft: rgba(16,170,150,.12);
  --danger: #e5484d;
  --danger-soft: rgba(229,72,77,.1);
  --ok: #1f9d55;
  --shadow-sm: 0 1px 2px rgba(16,18,27,.05), 0 1px 1px rgba(16,18,27,.03);
  --shadow: 0 1px 2px rgba(16,18,27,.04), 0 6px 20px -6px rgba(16,18,27,.1);
  --shadow-lg: 0 2px 6px rgba(16,18,27,.05), 0 24px 60px -12px rgba(16,18,27,.22);
  --r-sm: 8px; --r: 12px; --r-lg: 18px; --r-xl: 24px;
  --ease: cubic-bezier(.22,.8,.24,1);
  --ease-spring: cubic-bezier(.34,1.4,.5,1);
  --side: 272px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0e11; --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(80,170,125,.12), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(80,170,125,.05), transparent 60%);
    --surface: #16171c; --surface-2: #1b1c22; --surface-3: #24252c; --glass: rgba(22,23,28,.72);
    --text: #ececf1; --text-2: #c9cad2; --muted: #8e909b; --faint: #5d5f69;
    --line: rgba(255,255,255,.07); --line-2: rgba(255,255,255,.13);
    --accent: #5cc08f; --accent-2: #74cfa2; --accent-soft: rgba(92,192,143,.15); --accent-ink: #0b1a12;
    --tender: #f0a15a; --tender-soft: rgba(240,161,90,.13); --design: #3fd0bb; --design-soft: rgba(63,208,187,.13);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
    --shadow-lg: 0 24px 70px -12px rgba(0,0,0,.7); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0e11; --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(80,170,125,.12), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(80,170,125,.05), transparent 60%);
  --surface: #16171c; --surface-2: #1b1c22; --surface-3: #24252c; --glass: rgba(22,23,28,.72);
  --text: #ececf1; --text-2: #c9cad2; --muted: #8e909b; --faint: #5d5f69;
  --line: rgba(255,255,255,.07); --line-2: rgba(255,255,255,.13);
  --accent: #5cc08f; --accent-2: #74cfa2; --accent-soft: rgba(92,192,143,.15); --accent-ink: #0b1a12;
  --tender: #f0a15a; --tender-soft: rgba(240,161,90,.13); --design: #3fd0bb; --design-soft: rgba(63,208,187,.13);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 24px 70px -12px rgba(0,0,0,.7); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
::selection { background: var(--accent-soft); }
.svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.svg.sm { width: 15px; height: 15px; }
.svg.lg { width: 22px; height: 22px; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }

/* ---------- загрузка ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot-logo svg { width: 44px; height: 44px; fill: var(--accent); animation: pulse 1.2s var(--ease) infinite; }
@keyframes pulse { 50% { transform: scale(.88); opacity: .6; } }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; height: 100vh; height: 100dvh; }
.side {
  display: flex; flex-direction: column; min-height: 0; padding: 18px 14px 14px; gap: 6px;
  border-right: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(20px) saturate(1.4);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 14px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: #fff; display: grid; place-items: center; box-shadow: 0 4px 12px -4px rgba(46,107,78,.45); overflow: hidden; }
.brand-mark svg { width: 20px; height: 20px; fill: #fff; }
.brand-name { font: 650 15px/1.1 var(--font-display); letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.nav { flex: 1; overflow: auto; margin: 0 -6px; padding: 0 6px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 10px;
  color: var(--text-2); text-align: left; transition: background .18s, color .18s; position: relative;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); font-weight: 560; }
.nav-item.active::before { content: ""; position: absolute; left: -6px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav-item .cnt { margin-left: auto; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.nav-item .chev { transition: transform .25s var(--ease); color: var(--faint); }
.nav-group.open .chev { transform: rotate(90deg); }
.nav-sub { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease); }
.nav-group.open .nav-sub { grid-template-rows: 1fr; }
.nav-sub > div { overflow: hidden; padding-left: 18px; }
.nav-sub .nav-item { padding: 6px 10px; font-size: 13.2px; }
.nav-sub .nav-item.active::before { left: -6px; }
.side-foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 650; color: #fff; background: linear-gradient(135deg, #5d9c7d, #2e6b4e); flex: none; }
.me-name { font-weight: 560; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-sub { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(31,157,85,.18); }
.live-dot.off { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top {
  display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(20px) saturate(1.4); position: relative; z-index: 5;
}
.btn.burger { display: none; }
.search {
  flex: 1; max-width: 560px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; height: 100%; }
.search .svg { color: var(--muted); }
.kbd { font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; background: var(--surface-2); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content { flex: 1; overflow: auto; scroll-behavior: smooth; }
.page { padding: 28px 28px 80px; max-width: 1560px; margin: 0 auto; animation: pageIn .45s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-weight: 560; white-space: nowrap;
  transition: transform .15s var(--ease), background .18s, border-color .18s, box-shadow .18s, color .18s; box-shadow: var(--shadow-sm); user-select: none;
}
.btn:hover { border-color: var(--faint); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 6px 18px -6px rgba(46,107,78,.55); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.sm { height: 32px; padding: 0 11px; border-radius: 9px; font-size: 13px; }
.btn.xs { height: 26px; padding: 0 8px; border-radius: 7px; font-size: 12px; gap: 5px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn.xs.icon { width: 26px; }
.cart-btn { position: relative; }
.badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); transform: scale(0); transition: transform .35s var(--ease-spring);
}
.badge.show { transform: scale(1); }
.badge.bump { animation: bump .5s var(--ease-spring); }
@keyframes bump { 40% { transform: scale(1.35); } }

/* ---------- заголовки страниц ---------- */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--text); }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font: 680 30px/1.12 var(--font-display); letter-spacing: -.025em; margin: 0; }
.page-sub { color: var(--muted); margin-top: 6px; }
.page-head .spacer { flex: 1; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); gap: 2px; position: relative; }
.seg button { border: 0; background: none; height: 30px; padding: 0 12px; border-radius: 8px; color: var(--muted); font-weight: 560; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; transition: color .2s, background .2s, box-shadow .2s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button:hover:not(.on) { color: var(--text); }
.select { height: 32px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 30px 0 10px; font-size: 13px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }

/* ---------- главная: разделы ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-bottom: 30px; }
.hero-card { border-radius: var(--r-xl); padding: 28px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero-card.accent { background: linear-gradient(120deg, #9cc5b0 0%, #5e9478 45%, #2e6b4e 100%); color: #fff; border: 0; }
.hero-card.accent::after { content: ""; position: absolute; right: -80px; top: -80px; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.22), transparent 70%); }
.hero-card h1 { font: 700 30px/1.1 var(--font-display); letter-spacing: -.03em; margin: 0 0 10px; }
.hero-card p { margin: 0 0 20px; opacity: .85; max-width: 520px; }
.hero-card .btn { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.25); backdrop-filter: blur(6px); }
.hero-card .btn:hover { background: rgba(255,255,255,.26); }
.hero-card .btn.white { background: #fff; color: #2e6b4e; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; height: 100%; }
.stat { border-radius: var(--r-lg); padding: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; justify-content: space-between; }
.stat b { font: 700 30px/1 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.section-title { display: flex; align-items: center; gap: 10px; font: 650 18px/1.2 var(--font-display); letter-spacing: -.015em; margin: 8px 0 14px; }
.section-title .cnt { font-size: 13px; color: var(--muted); font-weight: 500; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 18px; margin-bottom: 36px; }
.cat {
  border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 16px;
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms);
}
.cat-head { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.cat-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.cat-icon.alt { background: var(--design-soft); color: var(--design); }
.cat-name { font: 650 17px/1.2 var(--font-display); letter-spacing: -.01em; }
.cat-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.cat-head .svg.go { margin-left: auto; color: var(--faint); transition: transform .25s var(--ease), color .2s; }
.cat-head:hover .svg.go { transform: translateX(4px); color: var(--text); }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent;
  cursor: pointer; transition: background .2s, border-color .2s, transform .2s var(--ease); text-align: left; color: var(--text);
}
.type:hover { background: var(--surface); border-color: var(--line-2); transform: translateY(-1px); }
.type .tn { font-weight: 540; font-size: 13.3px; line-height: 1.25; }
.type .tc { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--surface); border-radius: 20px; padding: 1px 8px; font-variant-numeric: tabular-nums; border: 1px solid var(--line); }
.type .tcode { font: 600 10.5px var(--mono); color: var(--faint); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }

/* ---------- сетка товаров ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 18px; }
.card {
  position: relative; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); overflow: hidden; cursor: pointer;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .3s; animation: rise .5s var(--ease) both; animation-delay: calc(min(var(--i, 0), 16) * 35ms);
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.card-img { aspect-ratio: 4 / 4.2; background: linear-gradient(180deg, var(--surface-2), var(--surface-3)); display: grid; place-items: center; overflow: hidden; position: relative; }
.card-img img { width: 100%; height: 100%; object-fit: contain; padding: 14px; transition: transform .6s var(--ease); }
:root[data-theme="light"] .card-img img, :root[data-theme="light"] .g-main img { mix-blend-mode: multiply; }
.no-anim, .no-anim * { animation: none !important; }
.card:hover .card-img img { transform: scale(1.045); }
.card-img .ph { color: var(--faint); display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; }
.card-img .ph .svg { width: 34px; height: 34px; stroke-width: 1.3; }
.card-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.art { font: 600 11px var(--mono); color: var(--accent); letter-spacing: .02em; background: var(--accent-soft); padding: 2px 7px; border-radius: 6px; align-self: flex-start; }
.card-name { font-weight: 600; font-size: 14.5px; line-height: 1.3; letter-spacing: -.005em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { color: var(--muted); font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.card-add {
  position: absolute; top: 10px; right: 10px; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px);
  display: grid; place-items: center; color: var(--text); opacity: 0; transform: translateY(-4px) scale(.9); transition: all .25s var(--ease); box-shadow: var(--shadow-sm);
}
.card:hover .card-add, .card-add.in { opacity: 1; transform: none; }
.card-add:hover { background: var(--accent); color: #fff; border-color: transparent; }
.card-add.in { background: var(--accent); color: #fff; border-color: transparent; }
.card-photos { position: absolute; left: 10px; bottom: 10px; font-size: 11px; color: var(--muted); background: var(--glass); backdrop-filter: blur(8px); border-radius: 7px; padding: 2px 7px; display: flex; align-items: center; gap: 4px; }
.warn-dot { position: absolute; top: 12px; left: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--tender); box-shadow: 0 0 0 3px var(--tender-soft); }

/* список */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.row { display: grid; grid-template-columns: 56px 110px 1fr 200px 170px 44px; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s; animation: rise .4s var(--ease) both; animation-delay: calc(min(var(--i,0),20) * 20ms); }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row .thumb { width: 56px; height: 56px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.row .thumb img { width: 100%; height: 100%; object-fit: contain; }
.row .nm { font-weight: 580; }
.row .sub { color: var(--muted); font-size: 12.5px; }

.empty { text-align: center; padding: 70px 20px; color: var(--muted); border: 1.5px dashed var(--line-2); border-radius: var(--r-xl); animation: rise .5s var(--ease) both; }
.empty .svg { width: 42px; height: 42px; stroke-width: 1.2; color: var(--faint); margin-bottom: 10px; }
.empty h3 { color: var(--text); font: 620 17px var(--font-display); margin: 0 0 6px; }
.empty p { margin: 0 0 18px; }

/* типы внутри вида */
.subtypes { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--text-2); font-weight: 540; font-size: 13px; transition: all .2s var(--ease); cursor: pointer;
}
.chip:hover { border-color: var(--faint); color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: transparent; }
.chip .c { font-size: 11.5px; opacity: .6; }

/* ---------- оверлеи ---------- */
.ov { position: fixed; inset: 0; z-index: 50; display: flex; }
.ov-back { position: absolute; inset: 0; background: rgba(10,12,20,.38); backdrop-filter: blur(6px); animation: fade .3s var(--ease) both; }
.ov.closing .ov-back { animation: fadeOut .25s var(--ease) both; }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.modal {
  position: relative; margin: auto; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  width: min(1180px, calc(100vw - 40px)); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; overflow: hidden;
  animation: pop .45s var(--ease) both;
}
.modal.sm { width: min(480px, calc(100vw - 32px)); }
.modal.md { width: min(720px, calc(100vw - 32px)); }
.ov.closing .modal { animation: popOut .22s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.975); } }
@keyframes popOut { to { opacity: 0; transform: translateY(10px) scale(.98); } }
.drawer {
  position: relative; margin-left: auto; width: min(520px, 100vw); height: 100%; background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slideIn .45s var(--ease) both; border-left: 1px solid var(--line);
}
.ov.closing .drawer { animation: slideOut .28s var(--ease) both; }
@keyframes slideIn { from { transform: translateX(100%); } }
@keyframes slideOut { to { transform: translateX(100%); } }
.m-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.m-title { font: 650 18px/1.2 var(--font-display); letter-spacing: -.015em; }
.m-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.m-head .close { margin-left: auto; }
.m-body { flex: 1; overflow: auto; padding: 22px; }
.m-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.m-foot .spacer { flex: 1; }

/* карточка позиции */
.detail { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 0; min-height: 0; flex: 1; overflow: hidden; }
.gallery { padding: 22px; border-right: 1px solid var(--line); background: var(--surface-2); overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.g-main { aspect-ratio: 4/5; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; cursor: zoom-in; position: relative; }
.g-main img { width: 100%; height: 100%; object-fit: contain; padding: 16px; animation: fade .35s var(--ease); }
.g-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.g-thumbs button { width: 62px; height: 62px; border-radius: 11px; border: 2px solid transparent; background: var(--surface); padding: 3px; overflow: hidden; transition: border-color .2s; }
.g-thumbs button.on { border-color: var(--accent); }
.g-thumbs img { width: 100%; height: 100%; object-fit: contain; border-radius: 7px; }
.info { overflow: auto; padding: 26px 28px 30px; }
.info-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.info h2 { font: 700 26px/1.15 var(--font-display); letter-spacing: -.025em; margin: 0 0 8px; }
.path { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ktru { font: 560 12px var(--mono); background: var(--surface-3); padding: 3px 8px; border-radius: 7px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border: 0; color: var(--text-2); }
.ktru:hover { background: var(--line-2); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 22px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 11px; height: 38px; background: var(--surface); overflow: hidden; }
.qty button { width: 32px; height: 100%; border: 0; background: none; color: var(--muted); }
.qty button:hover { background: var(--surface-3); color: var(--text); }
.qty input { width: 44px; border: 0; text-align: center; background: none; outline: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.qty.sm { height: 30px; border-radius: 9px; }
.qty.sm input { width: 36px; font-size: 13px; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 22px; }
.meta { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; border: 1px solid var(--line); min-width: 0; }
.meta small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 2px; }
.meta div { font-weight: 540; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desc-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.desc { border-radius: 14px; padding: 14px 16px; border: 1px solid var(--line); background: var(--surface-2); white-space: pre-wrap; font-size: 13.5px; }
.desc h4, .col-h { margin: 0 0 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.t-tender { color: var(--tender); } .t-design { color: var(--design); }
.pill-t, .pill-d { font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 20px; }
.pill-t { background: var(--tender-soft); color: var(--tender); } .pill-d { background: var(--design-soft); color: var(--design); }

.ptable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.4px; }
.ptable th { text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--surface); }
.ptable td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ptable tr:hover td { background: var(--surface-2); }
.ptable td.u { color: var(--muted); white-space: nowrap; }
.ptable td.t { color: var(--tender); font-weight: 540; }
.ptable td.d { color: var(--design); font-weight: 540; }
.ptable td.miss { color: var(--faint); font-style: italic; font-weight: 400; }
.ptable tr.sec td { background: var(--surface-2) !important; font-weight: 650; font-size: 12.5px; color: var(--text-2); padding-top: 12px; }

/* ---------- редактор ---------- */
.editor { width: min(1320px, calc(100vw - 32px)); height: calc(100vh - 32px); height: calc(100dvh - 32px); max-height: none; }
.ed { display: grid; grid-template-columns: 220px 1fr; flex: 1; min-height: 0; }
.ed-nav { border-right: 1px solid var(--line); padding: 18px 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.ed-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text-2); font-weight: 520; transition: background .2s, color .2s; }
.ed-nav a:hover { background: var(--surface-3); color: var(--text); }
.ed-nav a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.ed-nav .step { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); flex: none; transition: all .3s var(--ease); }
.ed-nav .step.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.ed-main { overflow: auto; padding: 8px 32px 60px; scroll-behavior: smooth; }
.ed-sec { padding: 26px 0; border-bottom: 1px solid var(--line); }
.ed-sec:last-child { border-bottom: 0; }
.ed-sec > h3 { font: 650 17px/1.2 var(--font-display); letter-spacing: -.01em; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.ed-sec > p.hint { color: var(--muted); margin: 0 0 16px; font-size: 13px; }
.fields { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.f { display: flex; flex-direction: column; gap: 6px; grid-column: span 6; min-width: 0; }
.f.w12 { grid-column: span 12; } .f.w4 { grid-column: span 4; } .f.w3 { grid-column: span 3; } .f.w8 { grid-column: span 8; } .f.w2 { grid-column: span 2; }
.f > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.f > label .req { color: var(--danger); }
.inp, .ta {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); outline: 0;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.ta { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.inp:focus, .ta:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.inp.err { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
select.inp { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

.pick-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pick { border: 1.5px solid var(--line-2); border-radius: 14px; padding: 12px 14px; background: var(--surface); text-align: left; display: flex; align-items: center; gap: 10px; transition: all .2s var(--ease); }
.pick:hover { border-color: var(--faint); }
.pick.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.pick .radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; transition: all .2s; }
.pick.on .radio { border: 5px solid var(--accent); }
.pick .pn { font-weight: 580; font-size: 13.5px; line-height: 1.25; }
.pick .pc { font: 600 10.5px var(--mono); color: var(--muted); }
.types-pick { margin-top: 12px; }

.drop { display: flex; flex-direction: column; align-items: center;
  border: 1.5px dashed var(--line-2); border-radius: 16px; padding: 22px; text-align: center; color: var(--muted); transition: all .25s var(--ease); background: var(--surface-2); cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.drop .svg { width: 28px; height: 28px; color: var(--accent); margin-bottom: 6px; }
.photos { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.ph-item { width: 128px; height: 128px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); position: relative; overflow: hidden; cursor: grab; transition: transform .25s var(--ease), box-shadow .25s; animation: rise .35s var(--ease) both; }
.ph-item img { width: 100%; height: 100%; object-fit: contain; padding: 6px; pointer-events: none; }
.ph-item .main-b { position: absolute; left: 6px; bottom: 6px; font-size: 10.5px; font-weight: 700; background: var(--accent); color: #fff; border-radius: 6px; padding: 1px 6px; }
.ph-item .del { position: absolute; top: 6px; right: 6px; opacity: 0; transition: opacity .2s; }
.ph-item:hover .del { opacity: 1; }
.ph-item.dragging { opacity: .4; transform: scale(.95); }
.ph-item.pending::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.desc-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.desc-edit .col-h { justify-content: space-between; }

.psec { border: 1px solid var(--line); border-radius: 16px; margin-bottom: 16px; background: var(--surface); overflow: hidden; animation: rise .35s var(--ease) both; }
.psec-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.psec-head input { flex: 1; border: 0; background: none; font-weight: 650; outline: 0; padding: 6px 8px; border-radius: 8px; }
.psec-head input:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent-soft); }
.prow-h, .prow { display: grid; grid-template-columns: 22px minmax(170px, 1.3fr) minmax(130px, 1fr) minmax(150px, 1fr) 110px 28px 28px; gap: 8px; align-items: center; padding: 6px 10px; }
.prow-h { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: 10px; }
.prow { border-bottom: 1px solid var(--line); transition: background .15s; }
.prow:last-of-type { border-bottom: 0; }
.prow:hover { background: var(--surface-2); }
.prow.drag-over { box-shadow: inset 0 2px 0 var(--accent); }
.prow.dragging { opacity: .4; }
.prow .handle { color: var(--faint); cursor: grab; display: grid; place-items: center; }
.prow .inp { height: 34px; border-radius: 9px; font-size: 13.2px; padding: 0 10px; }
.prow .inp.d { border-color: color-mix(in srgb, var(--design) 30%, var(--line-2)); }
.prow .inp.t { border-color: color-mix(in srgb, var(--tender) 30%, var(--line-2)); }
.prow .inp.d:focus { border-color: var(--design); box-shadow: 0 0 0 3px var(--design-soft); }
.prow .inp.t:focus { border-color: var(--tender); box-shadow: 0 0 0 3px var(--tender-soft); }
.tcell { position: relative; display: flex; }
.tcell .inp { padding-right: 34px; }
.tcell .rng { position: absolute; right: 3px; top: 3px; width: 28px; height: 28px; border-radius: 7px; border: 0; background: var(--tender-soft); color: var(--tender); display: grid; place-items: center; transition: transform .15s; }
.tcell .rng:hover { transform: scale(1.08); }
.psec-foot { display: flex; gap: 6px; padding: 10px 12px; }
.prow .x { opacity: .5; } .prow:hover .x { opacity: 1; }

.pop {
  position: fixed; z-index: 80; min-width: 260px; max-width: 360px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 8px; animation: popSm .22s var(--ease) both; transform-origin: top;
}
@keyframes popSm { from { opacity: 0; transform: translateY(-4px) scale(.97); } }
.pop-h { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 8px; }
.pop-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 9px; border: 0; background: none; text-align: left; }
.pop-opt:hover, .pop-opt.hl { background: var(--surface-3); }
.pop-opt b { font-weight: 600; } .pop-opt small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.pop-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.pop-row { display: flex; gap: 6px; align-items: center; padding: 6px 8px; font-size: 12.5px; color: var(--muted); }
.pop-row input { width: 64px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 8px; }
.ac-list { max-height: 280px; overflow: auto; }

/* корзина */
.cart-list { display: flex; flex-direction: column; gap: 10px; }
.cart-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); animation: rise .35s var(--ease) both; transition: opacity .25s, transform .25s; }
.cart-item.out { opacity: 0; transform: translateX(30px); }
.cart-item .thumb { width: 64px; height: 64px; border-radius: 10px; background: var(--surface-2); overflow: hidden; display: grid; place-items: center; }
.cart-item .thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.cart-item .nm { font-weight: 580; font-size: 13.5px; line-height: 1.25; }
.cart-item .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.cart-item .ctrl { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cart-num { font: 700 12px var(--mono); color: var(--faint); margin-right: 2px; }
.export-box { border-radius: 16px; border: 1px solid var(--line); padding: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 12px; }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode { border: 1.5px solid var(--line-2); border-radius: 12px; padding: 10px; background: var(--surface); text-align: left; transition: all .2s var(--ease); }
.mode.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mode b { display: block; font-size: 13px; } .mode small { color: var(--muted); font-size: 11.5px; line-height: 1.3; display: block; margin-top: 2px; }

/* настройки */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 560; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .2s, border-color .2s; display: inline-flex; gap: 8px; align-items: center; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-color: var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 20px; margin-bottom: 16px; animation: rise .4s var(--ease) both; }
.panel h3 { margin: 0 0 4px; font: 650 16px var(--font-display); }
.panel > p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.s-cat { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 14px; background: var(--surface-2); animation: rise .35s var(--ease) both; }
.s-row { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; align-items: center; }
.s-types { margin: 10px 0 0 22px; display: flex; flex-direction: column; gap: 6px; }
.s-types .s-row { grid-template-columns: 1fr 110px 60px auto; }
.s-types .cnt { font-size: 12px; color: var(--muted); text-align: right; }
.s-row .inp { height: 36px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.4px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr { animation: rise .3s var(--ease) both; }
.tbl tr:hover td { background: var(--surface-2); }
.kind { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: var(--surface-3); color: var(--text-2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--line-2); border-radius: 11px; min-height: 40px; background: var(--surface); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 9px; border-radius: 7px; background: var(--surface-3); font-size: 12.5px; }
.tag button { border: 0; background: none; padding: 0 3px; color: var(--muted); }
.tags input { border: 0; outline: 0; background: none; flex: 1; min-width: 100px; }
.dict-row { display: grid; grid-template-columns: 1fr 24px 1.6fr auto; gap: 10px; align-items: center; padding: 6px 0; animation: rise .3s var(--ease) both; }
.dict-row .arrow { color: var(--faint); text-align: center; }
.preview { font: 13px var(--mono); background: var(--surface-2); border-radius: 12px; padding: 12px 14px; border: 1px solid var(--line); }

/* уведомления */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 11px 14px 11px 12px; border-radius: 13px; background: #1a1b21; color: #f1f1f4; box-shadow: var(--shadow-lg);
  font-size: 13.4px; max-width: 420px; animation: toastIn .45s var(--ease-spring) both;
}
.toast.out { animation: toastOut .3s var(--ease) both; }
.toast .ic { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.1); flex: none; }
.toast.ok .ic { background: rgba(31,157,85,.25); color: #5ee49a; }
.toast.err .ic { background: rgba(229,72,77,.25); color: #ff8d90; }
.toast.info .ic { background: rgba(92,192,143,.25); color: #8fe0b8; }
.toast .act { margin-left: 8px; color: #8fe0b8; font-weight: 600; background: none; border: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }

.flyer { position: fixed; z-index: 120; border-radius: 12px; pointer-events: none; object-fit: contain; background: var(--surface); box-shadow: var(--shadow-lg); }

.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(8,9,14,.9); display: grid; place-items: center; animation: fade .25s both; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 94vh; object-fit: contain; animation: pop .35s var(--ease) both; border-radius: 8px; background: #fff; }

.muted { color: var(--muted); }
.row-flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hide { display: none !important; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--text-2); font-size: 13px; }
.note .svg { color: var(--accent); margin-top: 1px; }
.note.warn { background: var(--tender-soft); } .note.warn .svg { color: var(--tender); }
.code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- адаптив ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; }
  .cats { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; overflow: auto; }
  .gallery { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .g-main { aspect-ratio: 16/11; }
  .info { overflow: visible; }
  .ed { grid-template-columns: 1fr; }
  .ed-nav { display: none; }
  .prow-h { display: none; }
  .prow { grid-template-columns: 22px 1fr 1fr 30px; }
  .prow > :nth-child(2) { grid-column: 2 / 4; }
  .prow > :nth-child(3) { grid-column: 2 / 3; } .prow > :nth-child(4) { grid-column: 3 / 4; }
  .prow > :nth-child(5) { grid-column: 2 / 4; } .prow > :nth-child(6) { grid-column: 4; grid-row: 2; } .prow > :nth-child(7) { grid-column: 4; grid-row: 1; }
  .row { grid-template-columns: 56px 1fr 44px; } .row > .hide-sm { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 290px; transform: translateX(-105%); transition: transform .4s var(--ease); background: var(--surface); box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .side-back { position: fixed; inset: 0; z-index: 39; background: rgba(10,12,20,.35); animation: fade .3s both; }
  .btn.burger { display: inline-flex; }
  .top { padding: 10px 16px; }
  .page { padding: 20px 16px 80px; }
  .page-title { font-size: 24px; }
  .types { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .desc-pair, .desc-edit { grid-template-columns: 1fr; }
  .f, .f.w4, .f.w3, .f.w8, .f.w2 { grid-column: span 12; }
  .ed-main { padding: 0 16px 40px; }
  .modal, .editor { width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .mode-cards { grid-template-columns: 1fr; }
  .kbd, .hide-xs { display: none; }
  .s-row, .s-types .s-row { grid-template-columns: 1fr auto; } .s-row .code-inp, .s-types .cnt { display: none; }
  .dict-row { grid-template-columns: 1fr auto; } .dict-row .arrow { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---- выгрузка: выбор формы ---- */
.mode-cards.two { grid-template-columns: 1fr 1fr; }
.mode b { display: flex; align-items: center; gap: 6px; }
.opts { gap: 16px; margin-top: 2px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.check.dim { opacity: .45; }
.export-opts { display: flex; flex-direction: column; gap: 10px; }
.est { color: var(--tender) !important; font-style: italic; }
.est-mark { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--tender); margin-left: 5px; vertical-align: middle; }
.inp.est-in { border-style: dashed; }
.f1-preview { white-space: pre-wrap; font-size: 13.4px; line-height: 1.55; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.src-list { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.ptable td.ins { font-size: 12px; color: var(--muted); max-width: 240px; }
@media (max-width: 860px) { .mode-cards.two { grid-template-columns: 1fr; } }

.x.on-ir { color: var(--accent); opacity: 1; }

/* ================= Витарус · База — новые блоки ================= */
.f.w5 { grid-column: span 5; } .f.w6 { grid-column: span 6; } .f.w7 { grid-column: span 7; } .f.w9 { grid-column: span 9; }
.spacer { flex: 1; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th.num { text-align: right; }
.neg-t { color: var(--danger) !important; }

/* вход */
.login-wrap { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; }
.login { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 28px; display: flex; flex-direction: column; gap: 14px; animation: rise .45s var(--ease) both; }
.login .f { display: flex; flex-direction: column; gap: 6px; }
.login label { font-size: 12.5px; color: var(--muted); font-weight: 560; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-brand img { height: 48px; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; }

/* карточки каталога: цена */
.card-price { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.card-price b { font-size: 15px; font-weight: 680; letter-spacing: -.01em; }
.card-price small { color: var(--muted); font-size: 11.5px; }
.kind-b { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 650; background: var(--tender-soft); color: var(--tender); }
.kind-b.k-own { background: var(--accent-soft); color: var(--accent); }
.kind-b.k-sub { background: var(--design-soft); color: var(--design); }
.price-box { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 14px; }
.price-box > div { display: flex; flex-direction: column; }
.price-box small { font-size: 11.5px; color: var(--muted); }
.price-box .pb-main b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--accent); }
.price-box .pb-cell span { font-weight: 600; margin-top: 4px; }
.logi { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 18px; margin: 0 0 14px; font-size: 13px; }
.logi small { display: block; font-size: 11.5px; color: var(--muted); }
.cart-sum { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.cart-sum b { font-size: 19px; }

/* этапы, маржа */
.stage { display: inline-flex; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 620; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.stage.st-kp { background: rgba(120,140,255,.14); color: #5463d6; }
.stage.st-preblank { background: rgba(230,160,40,.15); color: #b07510; }
.stage.st-contract { background: rgba(30,150,180,.14); color: #157f99; }
.stage.st-blank { background: var(--accent-soft); color: var(--accent); }
.stage.st-done { background: rgba(31,157,85,.14); color: var(--ok); }
.stage.st-lost { background: var(--danger-soft); color: var(--danger); }
.mg { display: inline-block; padding: 1px 7px; border-radius: 6px; font-weight: 650; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.mg.good { background: rgba(31,157,85,.12); color: var(--ok); }
.mg.low { background: var(--tender-soft); color: var(--tender); }
.mg.neg { background: var(--danger-soft); color: var(--danger); }
.mg.big { font-size: 20px; padding: 0 8px; }
.warn-i { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--tender-soft); color: var(--tender); font-size: 11px; font-weight: 800; margin-left: 6px; }
.otbl td { vertical-align: top; }
.otbl tfoot td, .ltbl tfoot td { border-top: 1px solid var(--line-2); padding: 11px 10px; background: var(--surface-2); }
.save-st { font-size: 12px; color: var(--muted); }
.crumbs .spacer { flex: 1; }
.page.wide { max-width: 1680px; }

/* заказ: шапка */
.o-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.o-title { display: flex; gap: 10px; flex: 1; min-width: 300px; }
.o-title .inp { height: 44px; font-size: 18px; font-weight: 650; border-color: transparent; background: transparent; }
.o-title .inp:hover { border-color: var(--line-2); background: var(--surface); }
.o-title .inp:focus { border-color: var(--accent); background: var(--surface); }
.o-num { width: 150px; flex: none; }
.o-name { flex: 1; }
.stepper { display: flex; align-items: center; gap: 0; margin-bottom: 18px; overflow-x: auto; padding: 2px; }
.step-b { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; transition: all .2s var(--ease); }
.step-b .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; }
.step-b.done { color: var(--text-2); }
.step-b.done .dot { background: var(--accent-soft); color: var(--accent); }
.step-b.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 6px 18px -8px rgba(46,107,78,.7); }
.step-b.on .dot { background: rgba(255,255,255,.22); color: inherit; }
.step-b.lost { margin-left: 14px; }
.step-b.lost.on { background: var(--danger); }
.step-line { width: 22px; height: 2px; background: var(--line-2); flex: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi small { font-size: 11.5px; color: var(--muted); font-weight: 560; }
.kpi b { font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--muted); }
.kpi.main { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border: 0; }
.kpi.main small, .kpi.main span { color: inherit; opacity: .8; }

/* заказ: позиции */
.ltbl { width: 100%; border-collapse: collapse; font-size: 13.4px; min-width: 980px; table-layout: fixed; }
.ltbl th { text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.ltbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ltbl tr.ln:hover td { background: var(--surface-2); }
.ltbl tr.ln.open td { background: var(--surface-2); border-bottom-color: transparent; }
.ltbl tr.ln-more td { background: var(--surface-2); padding: 4px 8px 16px; }
.ltbl td.n { color: var(--muted); padding-top: 15px; }
.ltbl td.th { padding-left: 0; }
.ltbl td.th img, .ltbl td.th .ph { width: 50px; height: 50px; border-radius: 8px; object-fit: cover; display: grid; place-items: center; background: var(--surface-3); color: var(--faint); }
.ltbl td.acts { white-space: nowrap; padding-top: 12px; }
.cell-in { width: 100%; height: 34px; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 0 8px; outline: none; transition: border-color .15s, background .15s; }
.cell-in:hover { border-color: var(--line-2); background: var(--surface); }
.cell-in:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.cell-in.num { text-align: right; }
.cell-in.nm { font-weight: 600; }
.cell-in.strong { font-weight: 650; }
.cell-in.muted-in { color: var(--muted); }
.ln-sub { display: flex; gap: 6px; align-items: center; font-size: 12px; padding: 2px 8px 0; color: var(--muted); flex-wrap: wrap; }
.ln-sub.num { justify-content: flex-end; }
.ln-fields { padding: 6px 0 2px; }
.ln-fields .f label { font-size: 11.5px; }

/* выбор позиций */
.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick-item, .pick-row { display: grid; grid-template-columns: 48px 1fr auto auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; text-align: left; }
.pick-row { grid-template-columns: 1fr auto; width: 100%; }
.pick-item:hover, .pick-row:hover { border-color: var(--line-2); background: var(--surface-2); }
.pick-item.on { border-color: var(--accent); background: var(--accent-soft); }
.pick-item .thumb { width: 48px; height: 48px; border-radius: 8px; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; color: var(--faint); }
.pick-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.pick-item .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-item .sub { font-size: 12px; color: var(--muted); }
.qty.sm { height: 32px; }
.qty.sm input { width: 38px; }
.modal.wide-md { width: min(860px, 96vw); }

/* аналитика */
.an-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.an-grid > .panel { margin-bottom: 0; }
.an-grid + .panel, .an-grid { margin-bottom: 16px; }
.stack { display: flex; height: 18px; border-radius: 9px; overflow: hidden; margin: 6px 0 14px; background: var(--surface-3); }
.stack > div { height: 100%; transition: width .4s var(--ease); }
.an-tbl td { padding: 7px 8px; }
.an-tbl tr.tot td { font-weight: 700; border-top: 1px solid var(--line-2); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.hbar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; min-width: 80px; }
.hbar > div { height: 100%; background: var(--accent); border-radius: 4px; }
input[type=range] { accent-color: var(--accent); }

/* документы */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 16px; }
.doc-card { display: flex; gap: 14px; padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); animation: rise .4s var(--ease) both; }
.doc-card h4 { margin: 0 0 4px; font-size: 15px; }
.doc-card p { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.doc-card .dc-b { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dc-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.dc-ic.w { background: rgba(43,87,154,.12); color: #2b579a; }
.dc-ic.x { background: rgba(33,115,70,.12); color: #217346; }
.hist { display: flex; flex-direction: column; }
.hist > div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.sec-r td { background: var(--surface-2); }

@media (max-width: 860px) {
  .f.w5, .f.w6, .f.w7, .f.w9 { grid-column: span 12; }
  .an-grid { grid-template-columns: 1fr; }
  .o-head { flex-direction: column; align-items: stretch; }
  .o-title { flex-direction: column; min-width: 0; width: 100%; flex: none; }
  .o-num, .o-name { width: 100%; flex: none; }
  .hist > div { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dc-ic.w { color: #7fa7e6; } :root:not([data-theme="light"]) .dc-ic.x { color: #6cc495; }
  :root:not([data-theme="light"]) .stage.st-kp { color: #9aa6ff; } :root:not([data-theme="light"]) .stage.st-preblank { color: #f0b85a; } :root:not([data-theme="light"]) .stage.st-contract { color: #6cc7dd; }
}
:root[data-theme="dark"] .dc-ic.w { color: #7fa7e6; } :root[data-theme="dark"] .dc-ic.x { color: #6cc495; }
:root[data-theme="dark"] .stage.st-kp { color: #9aa6ff; } :root[data-theme="dark"] .stage.st-preblank { color: #f0b85a; } :root[data-theme="dark"] .stage.st-contract { color: #6cc7dd; }

/* поставщики, контрагенты */
.o-nonum { display: inline-flex; align-items: center; height: 44px; padding: 0 12px; border-radius: 10px; border: 1px dashed var(--line-2); color: var(--muted); font-size: 13px; white-space: nowrap; }
.cust-link { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 4px 0 14px; border-radius: 10px; background: var(--surface-2); font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.cust-link .svg { color: var(--accent); }
.sup-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; }
.sup-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.sup-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.sup-card.dis { opacity: .55; }
.sup-card img { display: block; width: 100%; aspect-ratio: 2013 / 232; object-fit: cover; background: #fff; }
.sup-b { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; }
@media (max-width: 860px) { .sup-list { grid-template-columns: 1fr; } }

/* ============ права: скрытие себестоимости ============ */
body.no-cost .c-cost { display: none !important; }
.acc-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 20px; background: var(--tender-soft); color: var(--tender); vertical-align: 1px; }
.acc-chip .svg { width: 12px; height: 12px; }
#orderPage.ro #oBody .btn:not([data-ro]):not([data-ro] .btn) { display: none; }
#orderPage.ro #oBody [data-ro] .btn { display: inline-flex; }
#orderPage.ro .stepper .step-b { cursor: default; }
#orderPage.ro #oBody [data-lx="open"] { display: inline-flex; }
.chat-btn { position: relative; }
.chat-btn .badge { background: var(--danger); }
.nav-item .cnt.unread:not(:empty) { background: var(--danger); color: #fff; font-weight: 700; padding: 0 6px; border-radius: 9px; min-width: 18px; text-align: center; line-height: 18px; }

/* ============ доступы ============ */
.g-st { font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.g-st.on { background: rgba(31,157,85,.12); color: var(--ok); }
.g-st.wait { background: var(--accent-soft); color: var(--accent); }
.g-st.old, .g-st.revoked { background: var(--surface-3); color: var(--muted); }
.perm-tbl td.c, .perm-tbl th.c { text-align: center; width: 150px; }
.perm-tbl input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.perm-tbl tr.grp td { background: var(--surface-2); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.perm-ov { display: inline-block; padding: 1px 7px; border-radius: 6px; margin: 1px 0; }
.perm-ov.y { background: rgba(31,157,85,.12); color: var(--ok); }
.perm-ov.n { background: var(--danger-soft); color: var(--danger); }
.perm-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.perm-row .pl { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.perm-row .pl b { font-weight: 540; font-size: 13.5px; }
.perm-row .pl small { color: var(--muted); font-size: 12px; }
.perm-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.perm-dot.y { background: var(--ok); } .perm-dot.n { background: var(--line-2); }
.seg.sm button { height: 26px; padding: 0 9px; font-size: 12px; }
.pick-btn { text-align: left; cursor: pointer; display: flex; align-items: center; gap: 4px; overflow: hidden; white-space: nowrap; }

/* ============ прайс-лист ============ */
.pl-tree { max-height: 34vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--surface-2); }
.pl-cat { padding: 6px 0; border-bottom: 1px solid var(--line); }
.pl-cat:last-child { border-bottom: 0; }
.pl-types { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 6px 0 2px 24px; }
.pl-types .check { font-size: 12.5px; }

/* ============ чат ============ */
.page.chat-page { padding: 0; max-width: none; height: 100%; animation: none; }
.content:has(.chat-page) { overflow: hidden; }
.chat { display: grid; grid-template-columns: 340px 1fr; height: 100%; min-height: 0; }
.chat-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.chat-side-head { display: flex; align-items: center; gap: 6px; padding: 16px 14px 10px 18px; }
.chat-side-head h2 { margin: 0; font: 680 22px var(--font-display); letter-spacing: -.02em; }
.chat-side-head .spacer { flex: 1; }
.chat-search { margin: 0 12px 8px; max-width: none; height: 36px; flex: none; }
.chat-tip { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; padding: 9px 10px; border-radius: 10px; background: var(--accent-soft); font-size: 12.5px; color: var(--text-2); }
.chat-tip span { flex: 1; }
.chat-tip.warn { background: var(--tender-soft); }
.chat-list { flex: 1; overflow: auto; padding: 2px 8px 12px; }
.chat-sep { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 10px 4px; }
.chat-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 12px; text-align: left; cursor: pointer; transition: background .15s; color: var(--text); }
.chat-item:hover { background: var(--surface-3); }
.chat-item.on { background: var(--accent-soft); }
.ci-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ci-top, .ci-bot { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ci-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.ci-time { font-size: 11.5px; color: var(--faint); flex: none; }
.ci-tag { font-size: 10.5px; color: var(--muted); background: var(--surface-3); padding: 0 6px; border-radius: 6px; flex: none; }
.ci-last { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.ci-last b { font-weight: 600; color: var(--text-2); }
.ci-last mark { background: rgba(240,190,60,.35); color: inherit; border-radius: 3px; }
.chat-item.unread .ci-name { font-weight: 720; }
.chat-item.unread .ci-last { color: var(--text-2); }
.ci-unread { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.typing-t { color: var(--accent); font-style: normal; }
.av { --s: 36px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 650; font-size: calc(var(--s) * .38); position: relative; letter-spacing: .02em; }
.av.grp { border-radius: 30%; }
.av .on { position: absolute; right: -1px; bottom: -1px; width: calc(var(--s) * .3); height: calc(var(--s) * .3); min-width: 9px; min-height: 9px; border-radius: 50%; background: #2fbf6c; border: 2px solid var(--surface); }
.on-t { color: var(--ok); }

.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; background: var(--bg); }
.chat-empty { margin: auto; text-align: center; color: var(--muted); max-width: 360px; padding: 20px; }
.chat-empty .svg { width: 48px; height: 48px; color: var(--faint); stroke-width: 1.2; }
.chat-empty h3 { color: var(--text); margin: 10px 0 6px; font: 620 18px var(--font-display); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(16px); min-height: 62px; }
.chat-head .spacer { flex: 1; }
.ch-title { display: flex; flex-direction: column; min-width: 0; }
.ch-title b { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-title small { color: var(--muted); font-size: 12.5px; }
.chat-back { display: none; }
.svg.flip { transform: rotate(180deg); }
.chat-scroll { flex: 1; overflow: auto; padding: 12px 18px 6px; scroll-behavior: auto; }
.chat-msgs { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 2px; }
.chat-more { text-align: center; padding: 4px 0 10px; }
.chat-start { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); padding: 50px 0 30px; }
.chat-start b { color: var(--text); font-size: 16px; }
.day-sep { text-align: center; margin: 14px 0 8px; position: sticky; top: 0; z-index: 2; }
.day-sep span { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--glass); backdrop-filter: blur(10px); padding: 3px 12px; border-radius: 20px; box-shadow: var(--shadow-sm); }
.msg-sys { text-align: center; margin: 6px 0; }
.msg-sys span { font-size: 12px; color: var(--muted); background: var(--surface-3); padding: 3px 12px; border-radius: 20px; }
.msg { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; position: relative; max-width: 100%; }
.msg.cont { margin-top: 2px; }
.msg.mine { flex-direction: row-reverse; }
.msg.new { animation: msgIn .32s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.msg.flash .bubble { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(240,190,60,.7); } }
.av-sp { width: 32px; flex: none; }
.bubble { max-width: min(560px, 78%); background: var(--surface); border-radius: 16px; padding: 7px 11px 6px; box-shadow: var(--shadow-sm); position: relative; min-width: 60px; overflow-wrap: anywhere; }
.msg:not(.cont):not(.mine) .bubble { border-bottom-left-radius: 6px; }
.msg.mine .bubble { background: var(--accent); color: var(--accent-ink); }
.msg.mine:not(.cont) .bubble { border-bottom-right-radius: 6px; }
.msg.mine .bubble a { color: inherit; }
.m-from { font-size: 12.5px; font-weight: 650; margin-bottom: 2px; }
.m-text { font-size: 14px; line-height: 1.45; white-space: normal; }
.m-text a { text-decoration: underline; }
.m-meta { float: right; font-size: 11px; opacity: .65; margin: 6px 0 -2px 10px; white-space: nowrap; display: inline-flex; gap: 3px; align-items: center; }
.tick b { font-weight: 600; letter-spacing: -3px; padding-right: 3px; }
.tick b.rd { color: #b9f5d3; opacity: 1; }
:root[data-theme="dark"] .tick b.rd { color: #0b3a22; }
.m-del { font-style: italic; opacity: .7; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.m-quote { display: flex; flex-direction: column; text-align: left; width: 100%; border: 0; border-left: 3px solid currentColor; background: rgba(127,127,127,.12); border-radius: 6px; padding: 4px 8px; margin: 2px 0 6px; color: inherit; cursor: pointer; font-size: 12.5px; }
.m-quote b { font-weight: 650; }
.m-quote span { opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-imgs { display: grid; gap: 3px; margin: 2px -7px 6px; border-radius: 12px; overflow: hidden; }
.m-imgs.n2, .m-imgs.n4 { grid-template-columns: 1fr 1fr; }
.m-imgs.n3 { grid-template-columns: 1fr 1fr 1fr; }
.m-img { display: block; background: var(--surface-3); }
.m-imgs.n1 { justify-items: start; }
.m-imgs.n1 .m-img { aspect-ratio: var(--ar); max-height: 340px; width: min(var(--w), 420px); max-width: 100%; }
.m-imgs:not(.n1) .m-img { aspect-ratio: 1; }
.m-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 2px 0 4px; border-radius: 11px; background: rgba(127,127,127,.1); color: inherit; text-decoration: none; min-width: 230px; }
.m-file:hover { background: rgba(127,127,127,.18); }
.m-file .fi { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 750; flex: none; }
.m-file .fn { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-file .fn b { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-file .fn small { opacity: .7; font-size: 11.5px; }
.m-ref { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; margin: 2px 0 4px; border-radius: 11px; border: 1px solid rgba(127,127,127,.25); background: rgba(127,127,127,.07); color: inherit; cursor: pointer; min-width: 230px; }
.m-ref:hover { background: rgba(127,127,127,.15); }
.m-ref > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-ref small { font-size: 11px; opacity: .7; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.m-ref b { font-weight: 620; font-size: 13.5px; }
.m-ref i { font-style: normal; font-size: 12px; opacity: .75; }
.m-acts { position: absolute; top: -14px; display: flex; gap: 1px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); padding: 2px; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 3; }
.msg:not(.mine) .m-acts { left: calc(min(560px, 78%) - 60px); }
.msg.mine .m-acts { right: 40px; }
.msg:hover .m-acts { opacity: 1; pointer-events: auto; }
.m-acts button { width: 28px; height: 26px; border: 0; background: none; border-radius: 7px; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.m-acts button:hover { background: var(--surface-3); color: var(--text); }
.chat-typing { min-height: 22px; padding: 0 22px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; max-width: 900px; width: 100%; margin: 0 auto; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.composer { padding: 6px 18px 16px; max-width: 900px; width: 100%; margin: 0 auto; }
.composer.ro { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 16px; }
.comp-row { display: flex; align-items: flex-end; gap: 6px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 6px; box-shadow: var(--shadow); }
.comp-row:focus-within { border-color: var(--accent); }
.comp-row textarea { flex: 1; border: 0; outline: 0; resize: none; background: none; font: inherit; font-size: 14px; line-height: 1.45; padding: 8px 4px; max-height: 200px; color: var(--text); min-height: 38px; }
.comp-row .btn.icon { border-radius: 12px; }
.pend-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 6px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 8px; font-size: 12.5px; }
.pend-bar span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.pend-bar b { color: var(--accent); font-weight: 650; }
.pend-items { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.pend { display: inline-flex; align-items: center; gap: 8px; padding: 4px 4px 4px 6px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; max-width: 260px; }
.pend img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.pend > span { display: flex; flex-direction: column; min-width: 0; }
.pend > span, .pend > span small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pend small { color: var(--muted); font-size: 11px; }
.pend button { border: 0; background: none; width: 24px; height: 24px; border-radius: 6px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pend button:hover { background: var(--surface-3); }
.pend.ref { border-color: var(--accent); }
.upl { position: relative; height: 26px; border-radius: 8px; background: var(--surface-3); overflow: hidden; margin-bottom: 6px; font-size: 12px; }
.upl i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent-soft); transition: width .2s; }
.upl span { position: relative; line-height: 26px; padding: 0 10px; color: var(--text-2); }
.drop-hint { position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 18px; background: color-mix(in srgb, var(--surface) 86%, transparent); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--accent); z-index: 5; pointer-events: none; }
.chat-main.drag .drop-hint { display: flex; }
.new-below { position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%); box-shadow: var(--shadow-lg); z-index: 4; border-radius: 20px; }
.spin { width: 28px; height: 28px; border: 3px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.user-pick { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; }
.up-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; border: 0; background: none; width: 100%; text-align: left; color: var(--text); cursor: pointer; }
button.up-row:hover { background: var(--surface-3); }
.up-row > span:not(.av):not(.chk) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.up-row b { font-weight: 580; font-size: 13.5px; }
.up-row small { color: var(--muted); font-size: 12px; }
.up-row .chk { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: transparent; flex: none; }
.up-row.on .chk { background: var(--accent); border-color: var(--accent); color: #fff; }
.up-row > .svg { color: var(--accent); }
@media (max-width: 860px) {
  .chat { grid-template-columns: 1fr; }
  .chat.has-active .chat-side { display: none; }
  .chat:not(.has-active) .chat-main { display: none; }
  .chat-back { display: inline-flex; }
  .chat-scroll { padding: 10px 10px 4px; }
  .composer { padding: 4px 8px 10px; }
  .bubble { max-width: 86%; }
  .m-acts { display: none; }
  .msg:active .m-acts { display: flex; opacity: 1; pointer-events: auto; }
}

/* ============ цены скрыты ============ */
body.no-price .c-price { display: none !important; }
.tab-n { margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.cnt-chip { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); vertical-align: 1px; }
.cnt-chip .svg { width: 12px; height: 12px; }
.lx-btn { gap: 2px; color: var(--faint); }
.lx-btn.has { color: var(--accent); font-weight: 650; }
.lx-btn span { font-size: 11px; }

/* ============ согласование ============ */
.ap-chip { display: inline-flex; align-items: center; font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 20px; background: var(--surface-3); color: var(--muted); white-space: nowrap; margin-left: 6px; vertical-align: 2px; }
.ap-chip.pend { background: rgba(46,107,200,.12); color: #2c63c9; }
.ap-chip.ok { background: rgba(31,157,85,.13); color: var(--ok); }
.ap-chip.bad { background: var(--danger-soft); color: var(--danger); }
.ap-chip.warn { background: var(--tender-soft); color: var(--tender); }
.ap-dot { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 5px; font-size: 10px; font-weight: 750; margin-left: 4px; vertical-align: 1px; background: var(--surface-3); color: var(--muted); }
.ap-dot.pend { background: rgba(46,107,200,.15); color: #2c63c9; } .ap-dot.ok { background: rgba(31,157,85,.15); color: var(--ok); }
.ap-dot.bad { background: var(--danger-soft); color: var(--danger); } .ap-dot.warn { background: var(--tender-soft); color: var(--tender); }
.ap-card { border-left: 4px solid var(--line-2); }
.ap-card.pend { border-left-color: #2c63c9; } .ap-card.ok { border-left-color: var(--ok); } .ap-card.bad { border-left-color: var(--danger); } .ap-card.warn { border-left-color: var(--tender); }
.ap-card h3 { font-size: 16px; }
.route { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.r-step { display: flex; flex-direction: column; gap: 4px; padding: 5px; border-radius: 12px; border: 1.5px dashed transparent; }
.r-step.par { border-color: var(--line-2); }
.r-step.cur { background: rgba(46,107,200,.06); border-color: rgba(46,107,200,.35); border-style: solid; }
.r-arrow { align-self: center; color: var(--faint); }
.r-role { display: flex; flex-direction: column; min-width: 92px; padding: 6px 10px 6px 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); position: relative; }
.r-role b { font-size: 12.5px; font-weight: 650; }
.r-role small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.r-role > .svg { position: absolute; right: 6px; top: 6px; width: 13px; height: 13px; }
.r-role.ok { background: rgba(31,157,85,.1); border-color: rgba(31,157,85,.35); } .r-role.ok > .svg { color: var(--ok); }
.r-role.bad { background: var(--danger-soft); border-color: rgba(229,72,77,.4); } .r-role.bad > .svg { color: var(--danger); }
.r-role.wait { background: rgba(46,107,200,.1); border-color: rgba(46,107,200,.35); } .r-role.wait small { color: #2c63c9; font-weight: 600; }
.r-role.opt { opacity: .7; }
.ap-log { margin-top: 12px; font-size: 12.5px; }
.ap-log summary { cursor: pointer; color: var(--muted); }
.ap-log div { padding: 3px 0; border-bottom: 1px solid var(--line); }
tr.ap-mine td { background: rgba(46,107,200,.05); }

/* просмотр документа */
.modal.dp { width: min(1280px, 97vw); }
.dp-body { background: var(--surface-3); padding: 18px; }
.dp-sheet { background: #fff; color: #1b1b1b; border-radius: 6px; box-shadow: var(--shadow); padding: 18px 20px 24px; max-width: 1200px; margin: 0 auto; font-size: 12px; }
.dp-banner { width: 100%; display: block; border-radius: 3px; }
.dp-title { color: #1f4d38; font: 700 17px var(--font-display); margin: 14px 0 10px; }
.dp-sec { background: #2e6b4e; color: #fff; font-weight: 700; padding: 4px 8px; margin: 14px 0 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.dp-kv, .dp-spec { width: 100%; border-collapse: collapse; margin-top: 0; }
.dp-kv th, .dp-kv td, .dp-spec th, .dp-spec td { border: 1px solid #cfd6d2; padding: 5px 7px; text-align: left; vertical-align: top; }
.dp-kv th { background: #e8f0eb; font-weight: 600; width: 14%; color: #2b3a32; }
.dp-spec th { background: #4e795f; color: #fff; font-weight: 600; font-size: 11px; text-align: center; }
.dp-spec td.pre { white-space: pre-wrap; font-size: 11px; max-width: 360px; }
.dp-spec td.num { text-align: right; white-space: nowrap; }
.dp-spec td img { width: 74px; height: 60px; object-fit: contain; }
.dp-spec tr.tot td { font-weight: 700; background: #e8f0eb; }
.dp-sheet .route { margin-top: 10px; }
.dp-sheet .r-role { background: #f6f8f7; } .dp-sheet .r-role.ok { background: #e6f4ea; }
.dp-act { gap: 8px; }
.dp-act textarea { flex: 1; min-height: 38px; }
.dp-act .btn.danger { border: 1px solid rgba(229,72,77,.35); }

/* файлы и обсуждение */
.files-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.files-grid > .panel { margin-bottom: 0; }
.drop-zone { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1.5px dashed var(--line-2); border-radius: 14px; color: var(--muted); font-size: 13px; cursor: pointer; transition: border-color .2s, background .2s; }
.drop-zone small { font-size: 11.5px; color: var(--faint); }
.drop-zone:hover, .drag .drop-zone { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.drop-zone.sm { padding: 10px 12px; font-size: 12.5px; margin-bottom: 8px; }
#fUp .upl { margin-top: 8px; }
.ofiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.ofiles.one { grid-template-columns: 1fr; }
.ofile { display: flex; align-items: center; gap: 10px; padding: 7px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); min-width: 0; }
.of-img, .of-ic { width: 52px; height: 52px; border-radius: 9px; overflow: hidden; flex: none; display: grid; place-items: center; }
.of-img img { width: 100%; height: 100%; object-fit: cover; }
.of-ic { color: #fff; font-size: 11px; font-weight: 750; text-decoration: none; }
.of-b { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.of-n { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); text-decoration: none; }
.of-n:hover { color: var(--accent); }
.of-b small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ocm-panel { display: flex; flex-direction: column; max-height: calc(100vh - 260px); }
.ocms { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; min-height: 80px; }
.ocm { display: flex; gap: 9px; align-items: flex-start; }
.ocm-b { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 7px 10px; }
.ocm.mine .ocm-b { background: var(--accent-soft); border-color: transparent; }
.ocm-h { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.ocm-h b { font-weight: 650; }
.ocm-h span { color: var(--muted); flex: 1; }
.ocm-h .btn { opacity: 0; } .ocm:hover .ocm-h .btn { opacity: 1; }
.ocm-t { font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
.ocm-new { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.ocm-new textarea { flex: 1; }
.pop-opt.on { font-weight: 650; }

/* ползунок скидка / наценка */
.adj-wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.adj-l, .adj-r { font-size: 12px; font-weight: 650; text-align: center; line-height: 1.2; }
.adj-l { color: var(--danger); } .adj-r { color: var(--ok); }
.adj-l small, .adj-r small { font-weight: 400; color: var(--muted); }
.adj-track { flex: 1; min-width: 220px; }
.adj-track input { width: 100%; accent-color: var(--accent); }
.adj-ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--faint); padding: 0 2px; }
.adj-ticks span { cursor: pointer; } .adj-ticks span:hover { color: var(--accent); }
.adj-v { min-width: 150px; text-align: right; font-size: 15px; }
.adj-v.up { color: var(--ok); } .adj-v.down { color: var(--danger); }

/* права: широкая матрица */
.perm-tbl .pt-name { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 260px; }
.perm-tbl tr.grp .pt-name { background: var(--surface-2); }
.perm-tbl td.c, .perm-tbl th.c { width: 86px; min-width: 70px; }

/* уведомления */
.bell-btn { position: relative; }
.bell-btn .badge { background: var(--danger); }
.nt-pop { padding: 0 !important; overflow: hidden; }
.nt-head { display: flex; align-items: center; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.nt-head .spacer { flex: 1; }
.nt-list { max-height: 60vh; overflow: auto; }
.nt-item { display: flex; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; color: var(--text); }
.nt-item:hover { background: var(--surface-3); }
.nt-item.unread { background: var(--accent-soft); }
.nt-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); flex: none; color: var(--text-2); }
.nt-item.k-approve .nt-ic { background: rgba(46,107,200,.14); color: #2c63c9; }
.nt-item.k-accepted .nt-ic, .nt-item.k-approved .nt-ic { background: rgba(31,157,85,.14); color: var(--ok); }
.nt-item.k-rejected .nt-ic { background: var(--danger-soft); color: var(--danger); }
.nt-item.k-reset .nt-ic { background: var(--tender-soft); color: var(--tender); }
.nt-b { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nt-b b { font-size: 13px; font-weight: 600; }
.nt-b span { font-size: 12.5px; color: var(--text-2); }
.nt-b small { font-size: 11px; color: var(--muted); }
.nt-foot { padding: 8px 12px; }
@media (max-width: 1100px) { .files-grid { grid-template-columns: 1fr; } .ocm-panel { max-height: none; } }

/* регистрация, аватары, роли */
.login.reg { width: min(520px, 94vw); }
.login.reg .fields { margin: 4px 0 0; }
.login-alt { text-align: center; font-size: 13px; color: var(--muted); }
.login-alt a { color: var(--accent); font-weight: 600; }
.avatar img, .av img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.avatar { overflow: hidden; }
.av { overflow: visible; }
.av img { border-radius: 50%; }
.av.grp img { border-radius: 30%; }
.avatar.xl { width: 72px; height: 72px; font-size: 26px; flex: none; }
.pf-av { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.u-cell { display: flex; align-items: center; gap: 10px; }
.rl-appr { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }

/* смайлы */
img.smile { vertical-align: -6px; max-height: 32px; margin: 0 1px; }
.m-text.big-sm img.smile { max-height: none; vertical-align: middle; transform-origin: left center; }
.m-text.big-sm { padding: 2px 0; }
.sm-pop { padding: 8px !important; }
.sm-pick { max-height: 320px; overflow-y: auto; }
.sm-h { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 4px 6px; }
.sm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 2px; margin-bottom: 6px; }
.sm-cell { height: 42px; border: 0; background: none; border-radius: 8px; cursor: pointer; display: grid; place-items: center; padding: 2px; }
.sm-cell:hover { background: var(--hover, rgba(0,0,0,.06)); }
.sm-cell img { max-width: 38px; max-height: 38px; }

.pend-list { display: flex; flex-direction: column; }
.pend-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.pend-row:first-child { border-top: 0; }
.pend-btns { display: flex; gap: 6px; margin-left: auto; }
@media (max-width: 640px) { .pend-row select { width: 100% !important; } .pend-btns { width: 100%; } .pend-btns .btn { flex: 1; justify-content: center; } }

/* ============ телефон ============ */
.tabbar { display: none; }
.tb-badge { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-rows: 1fr auto; }
  .tabbar { display: flex; grid-column: 1; position: relative; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tb-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 10.5px; font-weight: 560; position: relative; border-radius: 10px; -webkit-tap-highlight-color: transparent; }
  .tb-item .svg { width: 22px; height: 22px; }
  .tb-item.on { color: var(--accent); }
  .tb-item:active { background: var(--surface-2); }
  .tb-badge.show { display: block; position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-style: normal; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; }
  .top .chat-btn, .top .burger { display: none !important; }
  .top { gap: 8px; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); }
  .top .search { flex: 1; min-width: 0; }
  .top-actions { gap: 6px; }
  .page { padding-bottom: 32px; }
  #toasts { bottom: calc(80px + env(safe-area-inset-bottom)); width: calc(100vw - 24px); }
}
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .page { padding: 16px 12px 28px; }
  .page-title { font-size: 22px; }
  .page-head { flex-wrap: wrap; gap: 10px; }
  .page-head .spacer { display: none; }
  .page-head > .btn { flex: 1 1 auto; justify-content: center; }
  input.inp, select.inp, textarea, .select, .search input, .comp-row textarea { font-size: 16px; } /* iOS не увеличивает страницу при вводе */
  .btn { min-height: 40px; }
  .btn.xs, .btn.sm { min-height: 34px; }
  .tabs { margin-bottom: 16px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .role-sel { min-width: 170px; }
  .tbl.mcard thead { display: none; }
  .tbl.mcard, .tbl.mcard tbody, .tbl.mcard tfoot { display: block; }
  .tbl.mcard tr { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: relative; }
  .tbl.mcard tr:hover td { background: none; }
  .tbl.mcard td { display: block; border: 0; padding: 0; min-width: 0; text-align: left !important; }
  .tbl.mcard td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); opacity: .8; margin-bottom: 1px; }
  .tbl.mcard td:first-child { flex: 1 1 100%; padding-right: 36px; }
  .tbl.mcard td:first-child::before { display: none; }
  .tbl.mcard td:last-child:empty { display: none; }
  .tbl.mcard tfoot td { flex: 1 1 auto; }
  .tbl.mcard td:last-child > .btn.icon:only-child { position: absolute; right: 8px; top: 8px; }
  .otbl.mcard td:first-child { flex: 0 0 auto; padding-right: 0; }
  .otbl.mcard td:nth-child(2) { flex: 1 1 60%; }
  .otbl.mcard td:nth-child(2)::before { display: none; }
  .subtypes { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .subtypes::-webkit-scrollbar { display: none; }
  .subtypes .chip { flex: none; }
  .pop { max-width: calc(100vw - 16px); }
  .sm-pop { width: calc(100vw - 16px) !important; left: 8px !important; }
}

@media (max-width: 640px) {
  .ltbl.lcard { min-width: 0; table-layout: auto; display: block; }
  .ltbl.lcard colgroup, .ltbl.lcard thead { display: none; }
  .ltbl.lcard tbody, .ltbl.lcard tfoot { display: block; }
  .ltbl.lcard tr.ln { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px 10px; padding: 12px; position: relative; border-bottom: 1px solid var(--line); }
  .ltbl.lcard tr.ln td { display: block; padding: 0; border: 0; min-width: 0; background: none; }
  .ltbl.lcard tr.ln td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
  .ltbl.lcard td.n { position: absolute; left: 12px; top: 64px; padding: 0; font-size: 11px; width: 50px; text-align: center; }
  .ltbl.lcard td.n::before { display: none !important; }
  .ltbl.lcard td.th { position: absolute; left: 12px; top: 12px; }
  .ltbl.lcard tr.ln td:nth-child(3) { grid-column: 1 / -1; padding-left: 60px; min-height: 66px; }
  .ltbl.lcard tr.ln td:nth-child(3)::before { display: none; }
  .ltbl.lcard tr.ln td:nth-child(4) { grid-column: 1 / -1; }
  .ltbl.lcard td.acts { grid-column: 1 / -1; display: flex !important; justify-content: flex-end; gap: 4px; padding-top: 0; }
  .ltbl.lcard td.acts::before { display: none !important; }
  .ltbl.lcard .cell-in { border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 9px; width: 100%; background: var(--surface); font-size: 16px; }
  .ltbl.lcard .cell-in.nm { font-weight: 600; }
  .ltbl.lcard td.num, .ltbl.lcard .num { text-align: left; }
  .ltbl.lcard tr.ln-more { display: block; }
  .ltbl.lcard tr.ln-more td { display: block; padding: 0 12px 14px; }
  .ltbl.lcard tr.ln-more td:first-child { display: none; }
  .ltbl.lcard tfoot tr { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 12px; background: var(--surface-2); }
  .ltbl.lcard tfoot td { display: block; border: 0; padding: 0; background: none; }
  .ltbl.lcard tfoot td:empty { display: none; }
  .o-head select, .o-head .select, .o-head .inp { max-width: 100%; }
  .page-head .search { width: 100% !important; flex: 1 1 100%; }
  .page-head > .select { flex: 1 1 40%; }
}
@media (max-width: 640px) { .o-head .select, .o-title .select, select.select { max-width: 100%; min-width: 0; } }
@media (max-width: 640px) { .o-head .row-flex { flex-wrap: wrap; width: 100%; } .o-head .row-flex > select { flex: 1 1 100%; width: 100%; } }
@media (max-width: 640px) {
  .m-foot { flex-wrap: wrap; gap: 8px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .m-foot > .spacer { display: none; }
  .m-foot > .btn { flex: 1 1 auto; justify-content: center; }
  .m-foot > .btn.primary { flex-basis: 100%; order: 9; }
}
