/* Светлый интерфейс в стиле супер-приложения. Собственный цвет и логотип, без элементов чужих брендов. */
:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --ink: #1c2430;
  --muted: #7a8494;
  --line: #e7eaf0;
  --brand: #1f5eff;
  --brand-2: #174ad1;
  --brand-soft: #e8efff;
  --ok: #12a150;
  --ok-soft: #e4f6ec;
  --danger: #d93f3f;
  --danger-soft: #fdeceb;
  --warn: #b7791f;
  --warn-soft: #fff6e5;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(28, 36, 48, .06);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 24px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code { background: #f2f4f8; padding: 3px 7px; border-radius: 8px; font-size: 13px; word-break: break-all; display: inline-block; }

/* Красная тема (THEME=red в .env). Оттенок близкий, но логотип круглый и своё название — чтобы не путали с Kaspi. */
[data-theme="red"] {
  --brand: #e5352b;
  --brand-2: #c92a21;
  --brand-soft: #fdeceb;
  --bg: #f2f2f4;
}
[data-theme="red"] .logo-mark { border-radius: 50%; }
[data-theme="red"] .up { color: #e5352b; }
[data-theme="red"] .t-blue { background: #fdeceb; color: #e5352b; }

/* Зелёная тема (THEME=green, по умолчанию) — цвета первой версии: тёмно-зелёное меню и янтарный логотип. */
[data-theme="green"] {
  --brand: #0f5c4a;
  --brand-2: #127a61;
  --brand-soft: #e3f1ec;
  --bg: #f4f3ef;
  --line: #e4e2db;
}
[data-theme="green"] .logo-mark { background: #e8a33d; color: #0f5c4a; }
[data-theme="green"] .t-blue { background: #e3f1ec; color: #0f5c4a; }
[data-theme="green"] .up { color: #127a61; }
[data-theme="green"] .bar i { background: linear-gradient(180deg, #127a61, #0f5c4a); }
@media (min-width: 901px) {
  [data-theme="green"] .side { background: #0f5c4a; }
  [data-theme="green"] .nav a { color: #d4e8e1; }
  [data-theme="green"] .nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  [data-theme="green"] .nav a.on { background: rgba(255, 255, 255, .15); color: #fff; }
  [data-theme="green"] .nav .ico { background: rgba(255, 255, 255, .1); color: #fff; }
}

/* Верхняя панель */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--panel); box-shadow: 0 1px 0 var(--line); }
.topbar-in { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 20px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; color: var(--ink); white-space: nowrap; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 17px; }
.search { flex: 1; max-width: 520px; position: relative; }
.search input { background: #f2f4f8; border: 1px solid transparent; border-radius: 12px; padding: 10px 14px 10px 38px; }
.search input:focus { background: #fff; border-color: var(--brand); outline: none; }
.search::before { content: "⌕"; position: absolute; left: 13px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 18px; }
.topbar .shop-switch select { padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font: inherit; max-width: 220px; }
.user { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }

/* Каркас */
.layout { max-width: 1320px; margin: 0 auto; display: grid; grid-template-columns: 230px 1fr; gap: 20px; padding: 20px; }
.side { position: sticky; top: 74px; align-self: start; background: var(--panel); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; color: var(--ink); font-weight: 500; }
.nav a:hover { background: #f4f6fa; }
.nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav .ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; flex: none; }
.nav .short { display: none; }
.main { min-width: 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* Цвета плиток сервисов */
.t-blue { background: #e8efff; color: #1f5eff; }
.t-orange { background: #fff1e0; color: #e07b00; }
.t-green { background: #e4f6ec; color: #12a150; }
.t-purple { background: #f1eaff; color: #7a3ff2; }
.t-teal { background: #e0f6f6; color: #0f9a9a; }
.t-pink { background: #ffe9f1; color: #d6336c; }
.t-gray { background: #eef0f4; color: #4a5566; }
.t-yellow { background: #fff8db; color: #b58900; }

/* Плитки на главной */
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--panel); border-radius: var(--radius); padding: 16px 10px 14px; text-align: center; color: var(--ink); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; transition: transform .15s; }
.tile:hover { transform: translateY(-2px); }
.tile .ico { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; font-size: 23px; }
.tile small { color: var(--muted); font-weight: 400; font-size: 12px; margin-top: -6px; }

/* Карточки и сетки */
.card { background: var(--panel); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 12px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.stack > * + * { margin-top: 12px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.balance { background: var(--brand); color: #fff; }
.balance .label, .balance .hint { color: rgba(255, 255, 255, .78); }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 12px; border: 0;
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--brand-2); }
.btn.ghost { background: #f2f4f8; color: var(--ink); }
.btn.ghost:hover { background: #e6e9ef; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Метки и сообщения */
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eef0f4; color: var(--muted); }
.pill.on { background: var(--ok-soft); color: var(--ok); }
.pill.off { background: var(--danger-soft); color: var(--danger); }
.pill.test { background: var(--warn-soft); color: var(--warn); }
.banner { padding: 12px 16px; border-radius: 14px; margin-bottom: 14px; background: var(--warn-soft); color: #7b5414; }
.flash { padding: 11px 15px; border-radius: 12px; margin-bottom: 10px; font-size: 14px; }
.flash.ok { background: var(--ok-soft); color: #0d7a3c; }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.flash.warn { background: var(--warn-soft); color: #7b5414; }

/* Формы */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input, select { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--ink); font-size: 14px; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; }

/* Списки в стиле приложения */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list li:last-child { border-bottom: 0; }
.list .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; font-size: 17px; }
.list .grow { flex: 1; min-width: 0; }
.list .title { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.down { color: var(--ok); font-weight: 700; }
.up { color: var(--brand); font-weight: 700; }

/* Таблицы */
.table-wrap { overflow-x: auto; border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
td input.cell { width: 98px; padding: 7px 9px; text-align: right; border-radius: 10px; background: #f6f7fa; border-color: transparent; }
td input.cell:focus { background: #fff; }
td input.cell.saved { border-color: var(--ok); background: var(--ok-soft); }
td input.cell.bad { border-color: var(--danger); background: var(--danger-soft); }
td:first-child { min-width: 220px; }
.name { font-weight: 600; }
.sku { font-size: 12px; color: var(--muted); }
.toggle { position: relative; width: 44px; height: 26px; display: inline-block; margin: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: #d5dae2; border-radius: 99px; cursor: pointer; transition: .2s; }
.toggle span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + span { background: var(--ok); }
.toggle input:checked + span::before { transform: translateX(18px); }

/* График */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar i { display: block; width: 100%; max-width: 30px; background: var(--brand); border-radius: 8px 8px 3px 3px; min-height: 3px; opacity: .9; }
.bar small { font-size: 10px; color: var(--muted); margin-top: 6px; white-space: nowrap; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.drop { border: 2px dashed #cfd6e2; border-radius: var(--radius); padding: 30px; text-align: center; background: #fafbfd; }
details summary { cursor: pointer; font-weight: 600; color: var(--brand); }

/* Подвал с юридической информацией */
.footer { max-width: 1320px; margin: 0 auto; padding: 4px 20px 30px; color: var(--muted); font-size: 12px; }
.footer a { color: var(--muted); text-decoration: underline; }

/* Документы */
.doc { max-width: 860px; margin: 0 auto; }
.doc h1 { margin-bottom: 6px; }
.doc h3 { margin: 22px 0 6px; font-size: 16px; }
.doc p, .doc li { font-size: 15px; }
.doc .card { padding: 26px 30px; }

/* Вход */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 410px; padding: 28px; }

/* Телефон */
@media (max-width: 900px) {
  .topbar-in { padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .logo span.txt, .user .who { display: none; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .topbar .shop-switch { margin-left: auto; }
  .layout { grid-template-columns: 1fr; padding: 12px 12px 92px; gap: 0; }
  .side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; border-radius: 18px 18px 0 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 30; box-shadow: 0 -2px 12px rgba(28, 36, 48, .08); }
  .nav { display: flex; justify-content: space-around; }
  .nav a { flex: 1; min-width: 0; flex-direction: column; gap: 3px; padding: 4px 2px; font-size: 10px; text-align: center; border-radius: 10px; }
  .nav a.on { background: none; }
  .nav .ico { width: 30px; height: 30px; font-size: 15px; }
  .nav .full { display: none; }
  .nav .short { display: block; white-space: nowrap; }
  .tiles { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .tile { padding: 14px 6px 12px; font-size: 13px; }
  .tile .ico { width: 46px; height: 46px; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .g2 { grid-template-columns: 1fr; }
  h1 { font-size: 21px; }
  .stat .value { font-size: 20px; }
  .footer { padding-bottom: 96px; }
  .doc .card { padding: 18px; }
}

/* Переключатель языков */
.langs { display: flex; gap: 2px; background: #f2f4f8; border-radius: 10px; padding: 3px; flex-wrap: wrap; align-items: center; }
.langs-ico { display: inline-grid; place-items: center; padding: 0 4px 0 5px; color: var(--brand); }
.langs a { padding: 4px 8px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.langs a.on { background: #fff; color: var(--brand); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.auth .langs { align-self: flex-start; display: inline-flex; }
@media (max-width: 900px) { .topbar .langs { order: 4; } .langs a { padding: 4px 7px; } }

/* Подписка, админка, лендинг */
.banner.danger { background: var(--danger-soft); color: var(--danger); }
.banner.info { background: var(--brand-soft); color: var(--brand); }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 4px; }
[data-theme="green"] .nav-sep { color: #9cc4b7; }
.pre { white-space: pre-wrap; background: #f6f7fa; border-radius: 12px; padding: 14px; font-size: 14px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 12px; }
.plan { display: flex; flex-direction: column; gap: 10px; }
.plan h3 { margin: 0; font-size: 19px; }
.plan .price { font-size: 28px; font-weight: 800; }
.plan.featured { outline: 2px solid var(--brand); }
.plan form, .plan > a.btn { margin-top: auto; }
.checks { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.checks li { padding: 5px 0 5px 22px; position: relative; }
.checks li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.landing { max-width: 1120px; margin: 0 auto; padding: 20px; }
.hero { text-align: center; padding: 40px 10px 30px; }
.hero h1 { font-size: 36px; max-width: 760px; margin: 0 auto 14px; line-height: 1.15; }
.hero .lead { font-size: 18px; color: var(--muted); max-width: 680px; margin: 0 auto 22px; }
.features { margin: 10px 0 40px; }
.features .tile small { margin-top: 0; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
@media (max-width: 900px) {
  .nav-sep, .nav-admin { display: none !important; }
  .nav-billing, .nav-help { display: none !important; }
  .hero h1 { font-size: 26px; }
  .hero .lead { font-size: 16px; }
  .kv { grid-template-columns: 1fr; }
}
textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; font: inherit; resize: vertical; }
textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
@media (min-width: 901px) { .mobile-links { display: none !important; } }

/* Товары: фото, место, статусы */
.prod { display: flex; gap: 12px; align-items: center; min-width: 260px; }
.prod img, .prod .noimg { width: 48px; height: 48px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line); flex: none; }
.prod .noimg { display: grid; place-items: center; color: var(--muted); }
.prod .name a { color: var(--ink); }
.prod .name a:hover { color: var(--brand); }
.ptable td input.cell { width: 92px; }
.ptable td input.sku-in { width: 150px; text-align: left; margin-top: 4px; border: 1px dashed #e0a43a; background: #fff8e8; }
.posb { display: inline-block; font-weight: 700; font-size: 13px; padding: 4px 10px; border-radius: 8px; border: 1px solid; }
.posb.p1 { color: var(--ok); border-color: #9bd8b4; background: var(--ok-soft); }
.posb.pn { color: #a8660f; border-color: #f0cf8e; background: var(--warn-soft); }
.st { white-space: nowrap; display: inline-block; font-weight: 600; font-size: 12px; padding: 3px 8px; border-radius: 7px; background: #eef0f4; color: var(--muted); }
.st.ok { background: var(--ok-soft); color: var(--ok); }
.st.warn { background: var(--warn-soft); color: #a8660f; }
.empty-big { text-align: center; padding: 50px 24px; }
.empty-big .big-ico { font-size: 54px; }
.empty-big p { max-width: 560px; margin: 10px auto 22px; }
.btn.big { padding: 15px 28px; font-size: 17px; border-radius: 14px; }
.link-box { display: flex; gap: 20px; align-items: center; justify-content: space-between; margin-bottom: 12px; border: 2px solid #f0cf8e; background: #fffaf0; }
@media (max-width: 900px) { .link-box { flex-direction: column; align-items: flex-start; } }

/* Выбор товаров и массовые действия */
.ptable th.chk, .ptable td.chk { width: 34px; text-align: center; padding-left: 10px; padding-right: 0; }
.ptable .chk input[type=checkbox] { width: 18px !important; height: 18px; margin: 0; cursor: pointer; }
.ptable .name-in { width: 100%; font-weight: 600; margin-bottom: 4px; }
.bulkbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--brand-soft); border: 1px solid var(--brand);
  border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; position: sticky; top: 8px; z-index: 5; }
.bulkbar b { font-family: var(--display); }

/* Товары: полное название, компактные колонки, страницы */
.ptable th:nth-child(2), .ptable td:nth-child(2) { width: 40%; min-width: 280px; }
.prod { align-items: flex-start; }
.prod img, .prod .noimg { width: 52px; height: 52px; }
.name-in { width: 100%; font-weight: 600; line-height: 1.35; white-space: normal; word-break: break-word;
  min-height: 1.4em; padding: 5px 7px; border: 1px solid transparent; border-radius: 8px; cursor: text; }
.name-in:hover { border-color: var(--line); }
.name-in:focus { border-color: var(--brand); background: #fff; outline: none; }
.name-in:empty::before { content: attr(data-ph); color: var(--muted); }
.ptable td input.cell { width: 78px; }
.ptable td, .ptable th { padding-left: 9px; padding-right: 9px; }
.pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.pager .per, .pager .pages { display: flex; align-items: center; gap: 6px; }
.prod-img { flex: none; display: block; }
.prod-img img, .prod-img .noimg { display: block; }

/* Поиск, бейдж демпинга, карточка товара, мобильная таблица */
.psearch { display: flex; gap: 8px; align-items: center; }
.psearch input[name=q] { flex: 1; }
.dmp-state { font-size: 11px; font-weight: 700; margin-top: 4px; text-align: center; }
.dmp-state.on { color: var(--ok); }
.dmp-state.off { color: var(--muted); }
.rowact { white-space: nowrap; }
.rowact .det { margin-right: 4px; }

/* перетаскиваемая таблица на телефоне: товар закреплён слева */
@media (max-width: 760px) {
  .ptable th:nth-child(2), .ptable td:nth-child(2) { min-width: 190px; width: auto; }
  .ptable th.chk, .ptable td.chk { position: sticky; left: 0; background: #fff; z-index: 3; }
  .ptable thead th.chk { z-index: 5; }
  .ptable th:nth-child(2), .ptable td:nth-child(2) { position: sticky; left: 26px; background: #fff; z-index: 2;
    box-shadow: 6px 0 8px -6px rgba(0,0,0,.18); }
  .ptable thead th:nth-child(2) { z-index: 4; }
  .ptable .name-in { cursor: pointer; }
  .prod img, .prod .noimg { width: 44px; height: 44px; }
}

/* Выдвижная карточка товара */
.drawer-bg { position: fixed; inset: 0; background: rgba(15, 30, 25, .45); z-index: 80; }
.drawer { position: fixed; z-index: 90; background: #fff; display: flex; flex-direction: column;
  top: 0; right: 0; width: 420px; max-width: 100%; height: 100%; box-shadow: -20px 0 60px -30px rgba(0,0,0,.5);
  animation: drawerIn .22s ease; }
@keyframes drawerIn { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (max-width: 560px) {
  .drawer { top: auto; bottom: 0; right: 0; left: 0; width: 100%; height: auto; max-height: 90vh;
    border-radius: 20px 20px 0 0; animation: sheetIn .24s ease; }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
}
.drawer-head { display: flex; gap: 12px; align-items: flex-start; padding: 18px; border-bottom: 1px solid var(--line); }
.drawer-head img { width: 56px; height: 56px; border-radius: 12px; object-fit: contain; background: #fff; border: 1px solid var(--line); flex: none; }
.drawer-name { font-weight: 700; font-size: 16px; line-height: 1.3; word-break: break-word; padding: 2px 4px; border-radius: 6px; }
.drawer-name:focus { outline: none; background: var(--brand-soft); }
.drawer-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.drow { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); }
.drow b { color: var(--ink); font-family: var(--display); }
.drawer-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drawer-fields label, .dfull { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.drawer-fields input, .dfull input { font-size: 16px; padding: 10px 12px; }
.dtoggle { padding: 10px 0; font-weight: 600; color: var(--ink); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.drawer-foot { margin-top: 6px; }
.drawer[hidden], .drawer-bg[hidden] { display: none; }

/* Выбор городов демпинга */

/* Изменение ширины столбцов (как в Excel) */
.col-resizer { position: absolute; top: 0; right: -3px; width: 8px; height: 100%; cursor: col-resize; z-index: 6; user-select: none; }
.col-resizer:hover { background: linear-gradient(var(--brand), var(--brand)) center/2px 60% no-repeat; }
th { position: relative; }
/* Узкий столбец выбора */
.ptable th.chk, .ptable td.chk { width: 26px; min-width: 26px; padding: 0 2px; text-align: center; }

/* Верхний горизонтальный ползунок таблицы */
.table-scroll-top { overflow-x: auto; overflow-y: hidden; }
.table-scroll-top > div { height: 1px; }

/* Логотип SatuPilot (templates/_logo.html) */
.brand-logo { display: inline-flex; align-items: center; }
.brand-logo img { height: 40px; width: auto; display: block; }
.brand-logo .brand-mark { display: none; }
@media (max-width: 900px) { .brand-logo .brand-full, html[data-mode] .brand-logo .brand-full-d { display: none !important; } .brand-logo .brand-mark { display: block; } }
.auth .brand-logo img { height: 48px; }

/* Товары: время проверки, «Турбо», заметка */
.checked-ago { font-size: 11px; color: var(--ok); margin-top: 2px; white-space: nowrap; }
.turbo-ck { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; margin-top: 4px; cursor: pointer; white-space: nowrap; }
.turbo-ck input { width: 14px !important; height: 14px; margin: 0; }
.st.info { background: #e8efff; color: #1f5eff; }
html[data-mode="dark"] .st.info { background: #1a2a45; color: #7aa7ff; }
.btn.turbo-btn { background: #f08c00; }
td input.cell.note-in { width: 150px; text-align: left; }

.folder-tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); margin: 2px 0; text-decoration: none; }

/* Широкий экран: кабинет на всю ширину, таблица товаров — в одну строку без прокрутки */
@media (min-width: 901px) {
  .layout, .topbar-in, .footer { max-width: 1900px; }
  .layout { grid-template-columns: 210px minmax(0, 1fr); gap: 16px; padding: 16px 20px; }
  .ptable { width: 100%; }
  .ptable th:nth-child(2), .ptable td:nth-child(2) { width: auto; min-width: 190px; }
  .ptable td, .ptable th { padding-left: 5px; padding-right: 5px; }
  .ptable th { white-space: normal; }
  .ptable td input.cell { width: 64px; padding-left: 6px; padding-right: 6px; }
  .ptable td input.cell.note-in { width: 100px; }
  .ptable td input.sku-in { width: 120px; }
  .ptable .st, .ptable .status { white-space: normal; }
  table th:last-child .col-resizer { right: 0; }
}

/* ---------- Товары на телефоне: карточки вместо широкой таблицы ---------- */
.ptable .only-mob { display: none; }
@media (max-width: 900px) {
  .table-scroll-top { display: none !important; }
  .bulkbar { position: static; }
  .table-wrap:has(.ptable) { overflow: visible; background: transparent; box-shadow: none; }
  .ptable, .ptable tbody { display: block; width: 100% !important; min-width: 0 !important; table-layout: auto !important; }
  .ptable .only-mob { display: inline; }
  .ptable .no-mob { display: none; }
  /* шапка: только «Выбрать все» */
  .ptable thead tr { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel);
    border-radius: 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
  .ptable thead th { display: none; border: 0; padding: 0; position: static !important; width: auto !important; }
  .ptable thead th.chk, .ptable thead th:nth-child(2) { display: block; background: transparent; box-shadow: none; min-width: 0; }
  .ptable thead th:nth-child(2) { font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 600; }
  /* строка = карточка */
  .ptable tbody tr { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 10px;
    background: var(--panel); border-radius: 16px; padding: 14px 14px 12px; margin-bottom: 12px; box-shadow: var(--shadow); }
  .ptable tbody td { display: block; border: 0; padding: 0 !important; position: static !important; box-shadow: none !important;
    background: transparent !important; min-width: 0 !important; width: auto !important; text-align: left; }
  .ptable tbody td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
  .ptable tbody td.chk { position: absolute !important; top: 14px; right: 14px; left: auto !important; width: auto !important; }
  .ptable tbody td.chk input { width: 22px !important; height: 22px; }
  .ptable tbody td:nth-child(2) { grid-column: 1 / -1; padding-right: 34px !important; }
  .ptable .name-in { cursor: text; font-size: 15px; padding: 2px 0; }
  .ptable tbody td input.cell, .ptable tbody td input.cell.note-in { width: 100%; font-size: 16px; padding: 10px 10px; text-align: left; }
  .ptable tbody td input.sku-in { width: 100%; max-width: 220px; }
  .ptable .c-price { order: 1; } .ptable .c-min { order: 2; } .ptable .c-max { order: 3; }
  .ptable .c-dump { order: 4; display: flex !important; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
  .ptable .c-dump::before { flex-basis: 100%; margin-bottom: 0 !important; }
  .ptable .c-dump .dmp-state { margin: 0; }
  .ptable .c-pos { order: 5; } .ptable .c-step { order: 4; }
  .ptable .c-st { order: 6; }
  .ptable .c-cost { order: 7; } .ptable .c-pack { order: 8; }
  .ptable .c-act { order: 9; display: flex !important; gap: 6px; align-items: flex-end; justify-content: flex-end; }
  .ptable .c-note { order: 10; grid-column: 1 / -1; }
  .ptable .turbo-ck { font-size: 14px; }
  .ptable .toggle { transform: scale(1.1); transform-origin: left center; }
}

/* Аккаунт на телефоне: тап по аватару — меню с почтой и «Выйти» */
button.avatar { border: 0; cursor: pointer; font: inherit; padding: 0; }
@media (max-width: 900px) {
  .user { position: relative; }
  .user.open .who { display: block; position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; background: var(--panel);
    border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: 0 12px 30px -12px rgba(0,0,0,.35);
    min-width: 200px; white-space: nowrap; line-height: 1.5; }
  .user.open .who .linkbtn { display: block; width: 100%; margin-top: 8px; padding: 10px 12px; border-radius: 10px;
    background: var(--danger-soft, #fdecec); color: var(--danger, #d64545); font-weight: 700; font-size: 15px; text-align: center; }
}

/* Демпинг: главный рубильник и ссылка на прайс */
.dsw { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border: 2px solid var(--line); }
.dsw.is-on { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 6%, var(--card, #fff)); }
.dsw.is-off { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.dsw-main { display: flex; align-items: center; gap: 16px; }
.dsw-title { font-size: 20px; font-weight: 700; }
.dsw.is-on .dsw-title { color: var(--ok); }
.toggle.big { width: 64px; height: 36px; flex: none; }
.toggle.big span::before { width: 30px; height: 30px; }
.toggle.big input:checked + span::before { transform: translateX(28px); }
.feedbox summary { cursor: pointer; list-style: none; }
.feedbox summary::-webkit-details-marker { display: none; }
.feedbox summary::after { content: " ▾"; color: var(--muted, #888); }
.feedbox[open] summary::after { content: " ▴"; }
.feed-row { display: flex; gap: 8px; margin: 10px 0 6px; }
.feed-url { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.feed-steps { margin: 6px 0 8px 18px; padding: 0; }
@media (max-width: 900px) { .dsw form:last-child, .dsw form:last-child .btn { width: 100%; } .g3 { grid-template-columns: 1fr 1fr; } .g3 > :last-child { grid-column: 1 / -1; } }

.hot-b { display: inline-block; margin-top: 3px; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 700; background: #fff0e6; color: #d9480f; white-space: nowrap; }
[data-mode="dark"] .hot-b { background: rgba(255,120,40,.18); color: #ffa94d; }

a.name { color: var(--ink); display: inline; }
a.name:hover { color: var(--brand); text-decoration: underline; }
.sku a { color: inherit; }
.sku a:hover { color: var(--brand); text-decoration: underline; }

/* Телефон: таблицы карточками (кроме таблицы товаров — у неё своя разметка) */
@media (max-width: 900px) {
  .table-wrap:has(> table.mcards) { background: transparent; box-shadow: none; overflow: visible; padding: 0; border: 0; }
  .table-scroll-top:has(+ .table-wrap > table.mcards) { display: none !important; }
  table.mcards, table.mcards tbody { display: block; width: 100% !important; min-width: 0 !important; table-layout: auto !important; }
  table.mcards thead { display: none; }
  table.mcards tr { display: flex; flex-direction: column; background: var(--panel); border-radius: var(--radius);
                    box-shadow: var(--shadow); padding: 4px 14px; margin-bottom: 10px; }
  table.mcards td { display: grid; grid-template-columns: minmax(84px, 34%) 1fr; gap: 10px; align-items: baseline;
                    padding: 7px 0 !important; border: 0 !important; border-bottom: 1px solid var(--line) !important;
                    text-align: left !important; white-space: normal !important; width: auto !important; position: static !important; }
  table.mcards td.mc-last { border-bottom: 0 !important; }
  table.mcards td.mc-empty { display: none !important; }
  table.mcards td::before { content: attr(data-l); color: var(--muted); font-size: 12.5px; }
  table.mcards td[data-l=""] { display: block; }
  table.mcards td[data-l=""]::before { display: none; }
  table.mcards td[data-l=""]:empty, table.mcards td[data-l=""] > .mc-v:empty { display: none; }
  table.mcards td .mc-v { min-width: 0; overflow-wrap: anywhere; }
  table.mcards td.mc-title { order: -1; display: block; font-size: 15px; padding-top: 10px !important; }
  table.mcards td.mc-title::before { display: none; }
  table.mcards td input, table.mcards td select { font-size: 16px; max-width: 100%; }
}

/* Телефон: нижнее меню — 5 крупных вкладок + «Ещё» */
.mtabs, .msheet, .msheet-bg { display: none; }
@media (max-width: 900px) {
  .side { display: none !important; }
  .mtabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--panel);
           border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.08);
           padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .mtabs a, .mtabs button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
           gap: 2px; min-height: 58px; padding: 4px 2px; border: 0; background: none; border-radius: 14px;
           color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .mtabs .mi { font-size: 25px; line-height: 1.1; height: 30px; display: grid; place-items: center; }
  .mtabs .on { color: var(--brand); background: var(--brand-soft); }
  .msheet-bg { position: fixed; inset: 0; z-index: 41; background: rgba(0,0,0,.35); }
  .msheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 42; background: var(--panel); border-radius: 22px 22px 0 0;
            padding: 8px 14px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.2);
            max-height: 80vh; overflow-y: auto; }
  body.more-open .msheet, body.more-open .msheet-bg { display: block; }
  .msheet-grip { width: 42px; height: 5px; border-radius: 9px; background: var(--line); margin: 2px auto 12px; }
  .msheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .msheet-grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 16px;
                   color: var(--ink); font-size: 13.5px; font-weight: 600; text-align: center; background: var(--bg, rgba(127,127,127,.06)); }
  .msheet-grid a.on { outline: 2px solid var(--brand); color: var(--brand); }
  .msheet-grid .ico { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-size: 24px; }
  .msheet-out { width: 100%; margin-top: 14px; color: var(--danger); }
  .layout { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 900px) {
  .mtabs a:not(.on), .mtabs button:not(.on) { color: var(--ink) !important; }
  .mtabs .on { color: var(--brand) !important; }
}
@media (max-width: 900px) {
  .mtabs { z-index: 43; }
  .msheet { bottom: calc(66px + env(safe-area-inset-bottom)); border-radius: 22px; left: 8px; right: 8px; max-height: calc(100vh - 140px); padding-bottom: 14px; }
  .msheet-grid a:not(.on) { color: var(--ink); }
  .msheet-out { color: var(--danger) !important; }
}

/* Здоровье сервиса */
.hlanes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.hlane { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); }
.hlane.warn { border-color: #f0a020; }
.hlane.bad { border-color: var(--danger); background: var(--danger-soft); }
.hissue { font-size: 13px; line-height: 1.35; margin: 2px 0; }
.hissue.bad { color: var(--danger); font-weight: 600; }
.hissue.warn { color: #b26a00; }
[data-mode="dark"] .hissue.warn { color: #ffc35a; }
.hdot { margin-right: 4px; }
.hrow.lv2 td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.hrow.lv1 td:first-child { box-shadow: inset 3px 0 0 #f0a020; }
@media (max-width: 900px) {
  table.mcards tr.hrow.lv2 { box-shadow: inset 4px 0 0 var(--danger), var(--shadow); }
  table.mcards tr.hrow.lv1 { box-shadow: inset 4px 0 0 #f0a020, var(--shadow); }
  .hrow td:first-child { box-shadow: none !important; }
}

/* Демпинг: товары с последним изменением и раскрываемой историей */
.dlist { display: grid; gap: 10px; }
.ditem { padding: 0; }
.ditem > summary { list-style: none; cursor: pointer; padding: 14px 16px; display: grid; gap: 8px;
                   grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1.6fr) auto; align-items: center; }
.ditem > summary::-webkit-details-marker { display: none; }
.ditem-top { display: flex; gap: 10px; align-items: center; min-width: 0; }
.ditem-img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; background: #f2f4f8; display: grid; place-items: center; color: var(--muted); }
.ditem-name { min-width: 0; }
.ditem-name .name { font-weight: 600; line-height: 1.3; }
.ditem-facts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; white-space: nowrap; }
.ditem-last { font-size: 14px; min-width: 0; }
.ditem-more { justify-self: end; font-size: 13px; font-weight: 600; color: var(--brand); white-space: nowrap; padding: 6px 10px; border-radius: 10px; background: var(--brand-soft); }
.ditem[open] .chev { display: inline-block; transform: rotate(180deg); }
.dhist { list-style: none; margin: 0; padding: 4px 16px 12px; border-top: 1px solid var(--line); }
.dhist li { display: grid; grid-template-columns: 140px 220px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: baseline; }
.dhist li:last-child { border-bottom: 0; }
@media (max-width: 900px) {
  .ditem > summary { grid-template-columns: 1fr; gap: 8px; padding: 12px 14px; }
  .ditem-more { justify-self: stretch; text-align: center; padding: 10px; font-size: 14px; }
  .ditem-last { font-size: 14.5px; }
  .dhist { padding: 0 14px 10px; }
  .dhist li { grid-template-columns: 1fr auto; gap: 2px 10px; }
  .dhist .dh-time { font-size: 13px; color: var(--muted); }
  .dhist .dh-price { text-align: right; white-space: nowrap; }
  .dhist .dh-why { grid-column: 1 / -1; font-size: 13px; }
}

.hbal { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.hbal-low { color: var(--danger); }
.hbal-ok { color: var(--ok); }
.hbal-form { display: flex; gap: 6px; margin-top: 4px; }
.hbal-form input { flex: 1; min-width: 0; padding: 7px 10px; font-size: 16px; }
.hlanes { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
