:root {
  --bg: #f4f3ef;
  --panel: #ffffff;
  --ink: #17171c;
  --ink-2: #4a4a55;
  --muted: #8a8a96;
  --line: #e6e4de;
  --line-2: #efeee9;
  --side: #141418;
  --side-ink: #b9b9c4;
  --accent: #5b4cf0;
  --accent-ink: #ffffff;
  --accent-soft: #eeecff;
  --ok: #1f9d55;
  --ok-soft: #e4f6ea;
  --warn: #c27803;
  --warn-soft: #fdf3dc;
  --bad: #d4343b;
  --bad-soft: #fde8e8;
  --info: #2563eb;
  --info-soft: #e5edff;
  --r: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 4px 16px rgba(20, 20, 30, .05);
  --shadow-lg: 0 12px 48px rgba(20, 20, 30, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bar-soft: #dcd8ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
a, button, label, select, .chip, .q-item, tr.click { touch-action: manipulation; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #7c6cff, #5b4cf0 55%, #3d2fd1); display: grid; place-items: center; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--side-ink); opacity: .7; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--side-ink); font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(124,108,255,.18); color: #fff; }
.nav a.active svg { color: #a99fff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #2a2a33; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.side-foot .who { min-width: 0; flex: 1; color: #fff; font-size: 13px; }
.side-foot .who small { display: block; color: var(--side-ink); font-size: 11px; }
.icon-btn { border: 0; background: transparent; color: inherit; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: rgba(127,127,140,.14); }
.icon-btn svg { width: 18px; height: 18px; }

.main { min-width: 0; padding: 26px 32px 60px; }
.top { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; min-height: 40px; }
.top h1 { font-size: 24px; letter-spacing: -.02em; }
.top .crumbs { color: var(--muted); font-size: 13px; margin-bottom: 3px; }
.top .crumbs a { color: var(--muted); }
.top .crumbs a:hover { color: var(--ink); }
.top-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mobile-bar { display: none; }
.tabbar, a.btn.back-queue { display: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; }
.btn:hover { border-color: #d3d1ca; background: #fbfbf9; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 2px 6px rgba(91,76,240,.3); }
.btn.primary:hover { background: #4f40e4; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { background: #198a4a; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #f5c4c4; }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.04); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 11px; }
.btn kbd { font: 600 11px var(--mono); padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,.2); }
.btn:not(.primary):not(.ok) kbd { background: var(--line-2); color: var(--muted); }

.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,76,240,.14); }
.input.invalid { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(212,52,59,.1); }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238a8a96' stroke-width='2'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 34px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
label.field .err { font-weight: 500; color: var(--bad); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 500; }
.switch input { display: none; }
.switch .track { width: 38px; height: 22px; border-radius: 22px; background: #d9d7d0; position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:disabled + .track { opacity: .5; }

.tabs { display: inline-flex; gap: 2px; padding: 3px; background: #e9e7e1; border-radius: 10px; }
.tabs button, .tabs a { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tabs .on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tabs .count { margin-left: 5px; color: var(--muted); font-weight: 500; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 999px; font-weight: 500; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { flex: 1; min-width: 200px; max-width: 380px; }
.toolbar select.input { width: auto; min-width: 150px; }

/* ---------- surfaces ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-h h3 { font-size: 15px; }
.card-b { padding: 16px 18px 18px; }
.grid { display: grid; gap: 16px; }
.grid > *, .stack > * { min-width: 0; }
.grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.side-r { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi .label { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 30px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--ink-2); font-size: 12.5px; display: flex; gap: 10px; flex-wrap: wrap; }
.kpi.accent { background: linear-gradient(140deg, #5b4cf0, #3d2fd1); color: #fff; border-color: transparent; }
.kpi.accent .label, .kpi.accent .sub { color: rgba(255,255,255,.75); }
.kpi.accent .btn { margin-top: 4px; align-self: flex-start; background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.2); color: #fff; }
.kpi.accent .btn:hover { background: rgba(255,255,255,.26); }
a.kpi { color: inherit; transition: box-shadow .15s, transform .15s; }
a.kpi:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.solid { background: var(--accent); color: #fff; }
.nav .badge.solid { background: #ff5b5b; }

.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fcfcfa; }
.t th:first-child { border-top-left-radius: var(--r); }
.t th:last-child { border-top-right-radius: var(--r); }
.t td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr.click { cursor: pointer; transition: background .1s; }
.t tbody tr.click:hover { background: #faf9f6; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.t .actions { text-align: right; white-space: nowrap; }
.t .actions .icon-btn { display: inline-grid; vertical-align: middle; }
.t .title { font-weight: 600; }
.t .title small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty svg { width: 40px; height: 40px; color: #c9c7c0; }
.empty b { color: var(--ink); font-size: 15px; }
.empty .btn svg { width: 16px; height: 16px; color: inherit; }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 13px; }

/* ---------- check view ---------- */
.check { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.queue { position: sticky; top: 16px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; overflow: hidden; }
.queue-h { padding: 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.queue-list { overflow-y: auto; flex: 1; }
.q-item { display: block; padding: 11px 14px; border-bottom: 1px solid var(--line-2); color: inherit; cursor: pointer; border-left: 3px solid transparent; }
.q-item:hover { background: #faf9f6; }
.q-item.on { background: var(--accent-soft); border-left-color: var(--accent); }
.q-item .l1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.q-item .l2 { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.seg { display: flex; gap: 2px; padding: 3px; background: #e9e7e1; border-radius: 10px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 1 auto; border: 0; background: transparent; padding: 6px 8px; border-radius: 8px; font-weight: 600; font-size: 12.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg .count { margin-left: 4px; color: var(--muted); font-weight: 500; }
.queue-h .row select { min-width: 0; }
.q-item .new-dot { width: 7px; height: 7px; background: var(--accent); margin-right: 6px; vertical-align: 2px; }
.q-item.unseen .l1 > span:first-child { color: var(--ink); }
.q-item:not(.unseen) .l1 > span:first-child { font-weight: 500; color: var(--ink-2); }
.decide .nav-btn { padding: 0 12px; }
.sale-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.sale-head h2 { font-size: 20px; letter-spacing: -.01em; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 18px; }
.fact .k { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.fact .v { font-weight: 500; word-break: break-word; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo { border-radius: 10px; overflow: hidden; background: #ecebe6; aspect-ratio: 3 / 4; position: relative; cursor: zoom-in; border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.photo:hover img { transform: scale(1.03); }
.photo span { position: absolute; left: 8px; bottom: 8px; background: rgba(20,20,24,.72); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; backdrop-filter: blur(4px); }
.photo.loading::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.review-box { background: #fbfaf7; border: 1px dashed #d8d5cc; border-radius: 10px; padding: 14px 16px; white-space: pre-wrap; line-height: 1.55; position: relative; }
.decide { position: sticky; bottom: 0; background: rgba(244,243,239,.92); backdrop-filter: blur(8px); padding: 12px 0 4px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; z-index: 5; }
.reasons { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- offers ---------- */
.offer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.offer-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; color: inherit; transition: box-shadow .15s, transform .15s, border-color .15s; }
.offer-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); border-color: #d9d6ff; }
.offer-card.off { opacity: .62; }
.offer-card h3 { font-size: 15px; line-height: 1.3; }
.offer-card .desc { color: var(--ink-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.offer-card .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.offer-card .foot { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--line-2); padding-top: 10px; margin-top: auto; }
.meter { height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 6px; background: var(--ok); }
.meter i.warn { background: var(--warn); }
.meter i.bad { background: var(--bad); }

.fields-editor { display: flex; flex-direction: column; gap: 8px; }
.f-row { display: grid; grid-template-columns: 28px 140px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fcfcfa; }
.f-row .handle { display: flex; flex-direction: column; }
.f-row .handle button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; height: 15px; line-height: 1; }
.f-row .handle button:hover { color: var(--ink); }
.f-row .handle button:disabled { opacity: .25; cursor: default; }

.rev { padding: 14px 16px; border-bottom: 1px solid var(--line-2); display: flex; gap: 14px; align-items: flex-start; }
.rev:last-child { border-bottom: 0; }
.rev .txt { flex: 1; min-width: 0; white-space: pre-wrap; line-height: 1.5; }
.rev .txt.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.rev .side-info { width: 170px; flex: none; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; align-items: flex-end; text-align: right; }
.drop { border: 2px dashed #cfccc3; border-radius: 12px; padding: 26px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.drop svg { width: 30px; height: 30px; margin-bottom: 6px; }

.bulk-row { display: flex; gap: 8px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fcfcfa; }
.bulk-main { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.bulk-meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 12.5px; min-width: 0; }
.bulk-status { text-align: right; }
@media (max-width: 900px) { .bulk-main { grid-template-columns: 1fr; } .bulk-meta { flex-wrap: wrap; } }

/* ---------- charts ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .col { width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px; background: var(--bar-soft); position: relative; min-height: 2px; transition: background .15s; }
.bars .col i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); border-radius: 6px 6px 3px 3px; }
.bars .b:hover .col { background: #cbc5ff; }
.bars .d { font-size: 11px; color: var(--muted); white-space: nowrap; }
.bars .n { font-size: 11px; font-weight: 700; color: var(--ink-2); min-height: 14px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 60px; gap: 4px 12px; align-items: center; }
.hbar .track { height: 8px; background: var(--line-2); border-radius: 8px; overflow: hidden; grid-column: 1 / -1; }
.hbar .track i { display: block; height: 100%; background: var(--accent); border-radius: 8px; }
.rank { width: 24px; height: 24px; border-radius: 7px; background: var(--line-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-2); flex: none; }
.rank.r1 { background: #ffe9a8; color: #8a5a00; }
.rank.r2 { background: #e7e7ee; color: #4a4a5a; }
.rank.r3 { background: #f6dcc6; color: #8a4a1a; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(18,18,24,.45); backdrop-filter: blur(2px); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .18s cubic-bezier(.2,.9,.3,1.2); }
.modal.wide { max-width: 780px; }
.modal-h { padding: 18px 20px 0; display: flex; align-items: center; gap: 10px; }
.modal-h h3 { font-size: 17px; flex: 1; }
.modal-b { padding: 16px 20px; overflow-y: auto; }
.modal-f { padding: 14px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line-2); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--bg); z-index: 50; box-shadow: var(--shadow-lg); overflow-y: auto; animation: slide .2s ease-out; padding: 22px 26px; }
.drawer-bg { position: fixed; inset: 0; background: rgba(18,18,24,.35); z-index: 49; animation: fade .15s; }
.lightbox { position: fixed; inset: 0; background: rgba(10,10,14,.92); z-index: 60; display: flex; align-items: center; justify-content: center; animation: fade .15s; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox .lb-bar { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; align-items: center; gap: 10px; color: #fff; }
.lightbox .icon-btn { color: #fff; background: rgba(255,255,255,.1); width: 40px; height: 40px; }
.lightbox .nav-l, .lightbox .nav-r { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox .nav-l { left: 16px; }
.lightbox .nav-r { right: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1d1d23; color: #fff; padding: 11px 16px; border-radius: 11px; box-shadow: var(--shadow-lg); font-weight: 500; display: flex; align-items: center; gap: 9px; animation: pop .2s; pointer-events: auto; max-width: 90vw; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.ok svg { color: #4ade80; }
.toast.bad svg { color: #f87171; }

.spinner { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page { display: grid; place-items: center; padding: 80px 0; }
.skeleton { background: linear-gradient(90deg, #ebe9e3 25%, #f3f2ee 50%, #ebe9e3 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: radial-gradient(circle at 20% 20%, #7c6cff 0, transparent 40%), radial-gradient(circle at 80% 70%, #3d2fd1 0, transparent 45%), #141418; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h2 { font-size: 40px; letter-spacing: -.03em; line-height: 1.08; max-width: 440px; }
.login-art p { color: rgba(255,255,255,.7); max-width: 420px; font-size: 15px; }
.login-art ul { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 12px; }
.login-art li { display: flex; gap: 10px; align-items: center; color: rgba(255,255,255,.85); }
.login-art li svg { width: 18px; height: 18px; color: #a99fff; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.login-box h1 { font-size: 26px; letter-spacing: -.02em; }
.code-inputs { display: flex; gap: 8px; }
.code-inputs input { width: 100%; height: 54px; text-align: center; font: 700 22px var(--mono); border-radius: 11px; border: 1px solid var(--line); background: #fff; outline: none; }
.code-inputs input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,76,240,.14); }
.alert { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; display: flex; gap: 9px; align-items: flex-start; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert.bad { background: var(--bad-soft); color: #9b1c22; }
.alert.warn { background: var(--warn-soft); color: #7a4b00; }
.alert.info { background: var(--info-soft); color: #1e40af; }
.alert.ok { background: var(--ok-soft); color: #14653a; }

.copy-line { display: flex; gap: 6px; align-items: center; background: #f7f6f2; border: 1px solid var(--line); border-radius: 9px; padding: 4px 4px 4px 12px; }
.copy-line code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12.5px var(--mono); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 4px 0 10px; }
hr.sep { border: 0; border-top: 1px solid var(--line-2); margin: 16px 0; }
.kbd-help { font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.kbd-help kbd { font: 600 11px var(--mono); padding: 1px 5px; border-radius: 4px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side-r { grid-template-columns: 1fr; }
  .check { grid-template-columns: 290px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .shell > div { min-width: 0; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.menu-open .side { transform: none; box-shadow: var(--shadow-lg); }
  .shell.menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 39; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); background: var(--side); color: #fff; position: sticky; top: 0; z-index: 30; min-height: 52px; }
  .mobile-bar .badge { margin-left: auto; }
  .mobile-bar .badge.hidden + [data-theme-toggle] { margin-left: auto; }
  .main { padding: 16px 12px calc(96px + env(safe-area-inset-bottom)); }
  .top { flex-wrap: wrap; }
  .top h1 { font-size: 20px; }
  .top-actions { margin-left: 0; width: 100%; justify-content: flex-start; }
  .check { grid-template-columns: 1fr; }
  .queue { position: static; max-height: none; overflow: visible; }
  .queue-list { overflow: visible; }
  .grid.k2 { grid-template-columns: 1fr; }
  .grid.k3 { gap: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .f-row { grid-template-columns: 32px minmax(0, 1fr) auto auto; }
  .f-row .handle { grid-row: span 2; }
  .f-row .f-label { grid-column: 2 / -1; grid-row: 2; }
  .rev { flex-direction: column; }
  .rev .side-info { width: auto; align-items: flex-start; text-align: left; flex-direction: row; flex-wrap: wrap; }
  .drawer { padding: 16px; }
}
@media (max-width: 520px) {
  .grid.k4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .value { font-size: 24px; }
  .t th, .t td { padding: 10px; }
  .hide-sm { display: none; }
}

/* ---------- телефон: навигация, касания, карточки ---------- */
@media (max-width: 900px) {
  html, body { overflow-x: clip; }
  .side { width: min(300px, 86vw); padding-bottom: calc(74px + env(safe-area-inset-bottom)); overflow-y: auto; }
  .side .nav { margin-top: auto; } /* пункты ближе к большому пальцу */
  .side-foot { margin-top: 8px; }
  .nav a { min-height: 48px; font-size: 15px; }
  .mobile-bar .icon-btn { width: 44px; height: 44px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: rgba(20, 20, 24, .97); backdrop-filter: blur(10px); border-top: 1px solid rgba(255,255,255,.08); padding: 4px 4px max(4px, env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; border: 0; background: none; border-radius: 12px;
    color: var(--side-ink); font: 600 11px/1.1 var(--font); cursor: pointer; padding: 4px 2px; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .active { color: #fff; background: rgba(124,108,255,.2); }
  .tabbar .active svg { color: #b3aaff; }
  .tabbar .badge { position: absolute; top: 3px; left: 50%; margin-left: 6px; padding: 1px 6px; font-size: 10.5px; background: #ff5b5b; }
  .shell.menu-open .tabbar { z-index: 41; }

  /* крупные цели для пальца, 16px в полях — без автозума iOS */
  .btn { height: auto; min-height: 44px; padding: 0 16px; font-size: 14.5px; }
  .btn.sm { min-height: 40px; padding: 0 12px; font-size: 13.5px; }
  .btn.lg { min-height: 50px; }
  .btn kbd, .kbd-help { display: none; }
  .icon-btn { width: 44px; height: 44px; }
  .input, select.input { height: 46px; font-size: 16px; }
  textarea.input { font-size: 16px; }
  .chip { min-height: 40px; padding: 8px 14px; font-size: 14px; }
  .switch { min-height: 44px; }
  .switch .track { width: 46px; height: 28px; }
  .switch .track::after { width: 22px; height: 22px; }
  .switch input:checked + .track::after { transform: translateX(18px); }
  .copy-line { padding: 4px 4px 4px 12px; }
  .q-item { padding: 13px 14px; }
  .list-item { min-height: 48px; }
  label.list-item.switch { padding: 6px 0; }

  /* шапка страницы: действия на всю ширину, главное — крупно */
  .top { margin-bottom: 16px; gap: 10px; }
  .top h1 { font-size: 22px; word-break: break-word; }
  .top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
  .top-actions > .btn { flex: 1 1 auto; }
  .top-actions > .btn.danger:only-of-type:last-child { flex: 0 0 auto; }

  /* вкладки и фильтры */
  .toolbar { gap: 8px; margin-bottom: 12px; }
  .toolbar .search { flex: 1 1 100%; max-width: none; min-width: 0; }
  .toolbar select.input { flex: 1 1 140px; min-width: 0; width: auto; }
  .toolbar > .grow { display: none; }
  .tabs { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
  .tabs::-webkit-scrollbar { display: none; }
  .toolbar > .tabs:first-child { flex: 1 1 100%; }
  .tabs button, .tabs a { min-height: 40px; padding: 8px 14px; font-size: 14px; flex: none; scroll-snap-align: start; }
  .tabs button svg { width: 18px !important; height: 18px !important; }

  /* таблицы → карточки */
  .table-wrap { overflow: visible; }
  .t:not(.t-keep), .t:not(.t-keep) tbody { display: block; width: 100%; }
  .t:not(.t-keep) thead { display: none; }
  .t:not(.t-keep) tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  .t:not(.t-keep) tr:last-child { border-bottom: 0; }
  .t:not(.t-keep) td { display: block; padding: 0; border: 0; min-width: 0; }
  .t:not(.t-keep) td.title { order: -1; flex: 1 1 100%; font-size: 15px; }
  .t:not(.t-keep) td.title + td.actions, .t:not(.t-keep) td.actions { margin-left: auto; text-align: right; white-space: normal; }
  .t:not(.t-keep) td.num { text-align: left; }
  .t:not(.t-keep) td.num[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: 12px; font-weight: 500; }
  .t:not(.t-keep) td.mono, .t:not(.t-keep) td.nowrap { color: var(--muted); font-size: 13px; }
  .t:not(.t-keep) td.mono[data-label="№"]::before { content: "№ "; }
  .t .title small.ellipsis { max-width: 100% !important; }
  .t .actions .icon-btn { width: 44px; height: 44px; }
  .t-keep th, .t-keep td { padding: 10px 8px; }

  /* проверка: список → продажа, кнопки решения внизу над панелью */
  .check:not(.has-sale) #sale { display: none; }
  .check.has-sale .queue { display: none; }
  .check.has-sale { gap: 0; }
  a.btn.back-queue { display: inline-flex; margin-bottom: 12px; }
  .queue-h .row { flex-wrap: wrap; }
  .queue-h .row select { flex: 1 1 140px; min-width: 0; }
  .sale-head { gap: 10px; }
  .sale-head .row .btn.sm { width: 44px; min-height: 44px; padding: 0; }
  .decide { position: fixed; left: 0; right: 0; bottom: calc(62px + env(safe-area-inset-bottom)); z-index: 34; padding: 10px 12px; display: grid; grid-template-columns: 48px 1fr 1fr 48px; gap: 8px;
    background: rgba(244,243,239,.96); border-top: 1px solid var(--line); }
  .decide .btn { width: 100%; padding: 0 8px; }
  .decide .nav-btn { padding: 0; }
  .seg button { min-height: 40px; font-size: 13.5px; }
  .decide #b-seen { grid-column: 1 / -1; min-height: 44px; }
  .check.has-sale #sale { padding-bottom: 140px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

  /* карточки, графики */
  .card-h { padding: 14px 14px 0; flex-wrap: wrap; }
  .card-b { padding: 14px; }
  .offer-grid { grid-template-columns: 1fr; gap: 10px; }
  .offer-card:hover, a.kpi:hover { transform: none; }
  .bars { gap: 3px; }
  .bars .d { font-size: 10px; }
  .bars .b:nth-child(even) .d { visibility: hidden; }
  .bars:has(.b:nth-child(15)) .b .d, .bars:has(.b:nth-child(15)) .b .n { visibility: hidden; }
  .bars:has(.b:nth-child(15)) .b:nth-child(5n+1) .d { visibility: visible; }
  .rev { padding: 12px 14px; gap: 8px; }
  .rev .side-info { align-items: center; gap: 4px 10px; }
  .rev .side-info .row { margin-left: auto; }
  #of.grid > .stack { position: static !important; }
  .fact .icon-btn { width: 40px !important; height: 40px !important; }
  .f-row { padding: 8px 8px 8px 4px; }
  .f-row .handle button { width: 32px; height: 40px; display: grid; place-items: center; }
  .f-row .handle button svg { width: 18px !important; height: 18px !important; }

  /* окна снизу, как в мобильных приложениях */
  .overlay { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { max-width: none; border-radius: 18px 18px 0 0; max-height: 92vh; max-height: 92dvh; animation: sheet .22s ease-out; }
  .modal-h { padding: 16px 16px 0; }
  .modal-b { padding: 14px 16px; }
  .modal-f { padding: 12px 16px max(14px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal-f .btn { flex: 1 1 120px; }
  .drawer { width: 100vw; padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
  .drawer > .row:first-child { position: sticky; top: -12px; z-index: 2; margin: -12px -12px 14px !important; padding: 10px 12px; background: rgba(244,243,239,.96); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
  .drawer > .row:first-child > .grow { display: none; }
  .drawer > .row:first-child > .btn { flex: 1 1 0; }
  .drawer > .row:first-child > [data-x] { flex: 0 0 44px; padding: 0; font-size: 0; gap: 0; }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); width: calc(100% - 24px); }
  .lightbox img { max-width: 100vw; border-radius: 0; }
  .lightbox .nav-l, .lightbox .nav-r { top: auto; bottom: max(20px, env(safe-area-inset-bottom)); transform: none; width: 52px; height: 52px; }

  .login-form { padding: 24px 16px; align-items: flex-start; padding-top: 12vh; }
  .code-inputs { gap: 6px; }
}
@media (max-width: 520px) {
  .grid.k4 { gap: 8px; }
  .kpi { padding: 14px; }
  .kpi .label { font-size: 11px; }
  .grid.k3 { gap: 8px; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }

/* ---------- мобильное меню (шторка) ---------- */
.msheet, .msheet-bg { display: none; }
@media (max-width: 900px) {
  .side { display: none; }
  .shell.menu-open::after { content: none; }
  .msheet-bg { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(12,12,18,.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    opacity: 0; pointer-events: none; transition: opacity .2s; }
  .menu-open .msheet-bg { opacity: 1; pointer-events: auto; }
  .msheet { display: flex; flex-direction: column; gap: 14px; position: fixed; left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 40;
    max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); overflow-y: auto; overscroll-behavior: contain;
    background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 8px 14px 14px; box-shadow: 0 -10px 50px rgba(10,10,25,.28);
    opacity: 0; visibility: hidden; transform: translateY(28px) scale(.97); transform-origin: 50% 100%;
    transition: transform .26s cubic-bezier(.2,.9,.3,1.12), opacity .18s, visibility 0s .26s; }
  .menu-open .msheet { opacity: 1; visibility: visible; transform: none; transition: transform .26s cubic-bezier(.2,.9,.3,1.12), opacity .18s; }
  .msheet-grip { width: 40px; height: 5px; border-radius: 5px; background: var(--line); margin: 2px auto -4px; flex: none; }
  .msheet-me { display: flex; align-items: center; gap: 12px; padding: 4px 2px 12px; border-bottom: 1px solid var(--line-2); }
  .msheet-me .avatar { width: 46px; height: 46px; font-size: 15px; background: linear-gradient(135deg, #8b7dff, #5b4cf0 60%, #3d2fd1); box-shadow: 0 4px 14px rgba(91,76,240,.35); }
  .msheet-me b { font-size: 16px; }
  .msheet-me small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
  .msheet-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .msheet-grid a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 2px 10px; border-radius: 18px;
    background: var(--bg); border: 1.5px solid transparent; color: var(--ink-2); font-weight: 600; font-size: 11px; letter-spacing: -.01em; text-align: center; transition: transform .12s, background .15s; }
  .msheet-grid a:active { transform: scale(.95); }
  .msheet-grid .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--c); background: var(--accent-soft);
    background: color-mix(in srgb, var(--c) 15%, transparent); transition: background .15s, color .15s; }
  .msheet-grid .ic svg { width: 22px; height: 22px; }
  .msheet-grid .lb { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .msheet-grid a.active { border-color: var(--c); color: var(--ink); background: var(--panel); background: color-mix(in srgb, var(--c) 8%, var(--panel)); }
  .msheet-grid a.active .ic { background: var(--c); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--c) 40%, transparent); }
  .msheet-grid .badge { position: absolute; top: 6px; right: 6px; padding: 1px 6px; font-size: 10.5px; background: #ff5b5b; }
  .msheet-theme { width: 100%; }
  .msheet-theme button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 1 1 0; }
  .msheet-theme svg { width: 17px; height: 17px; }
  .msheet-out { width: 100%; }
  .tabbar #more[aria-expanded="true"] { color: #fff; background: rgba(124,108,255,.2); }
}
@media (prefers-reduced-motion: reduce) {
  .msheet, .menu-open .msheet, .msheet-bg { transition: none; }
}

/* ---------- тёмная тема ---------- */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111114;
  --panel: #1b1b21;
  --ink: #ececf1;
  --ink-2: #b6b6c2;
  --muted: #80808e;
  --line: #2d2d36;
  --line-2: #25252d;
  --side: #0b0b0e;
  --accent: #7b6dff;
  --accent-soft: #27234d;
  --ok: #34c27a;
  --ok-soft: #13301f;
  --warn: #e3a336;
  --warn-soft: #33270f;
  --bad: #f2626a;
  --bad-soft: #3a1b1e;
  --info: #6b98ff;
  --info-soft: #182647;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.55);
  --bar-soft: #3a3468;
}
[data-theme="dark"] .btn:hover { border-color: #3c3c47; background: #23232b; }
[data-theme="dark"] .btn.primary:hover { background: #6a5cf5; }
[data-theme="dark"] .btn.ok:hover { background: #2bb06c; }
[data-theme="dark"] .btn.ok { background: #239a5b; border-color: #239a5b; }
[data-theme="dark"] .btn.danger:hover { border-color: #5c2a2f; background: var(--bad-soft); }
[data-theme="dark"] .btn.danger.solid { background: #d8444c; border-color: #d8444c; }
[data-theme="dark"] .btn.ghost:hover { background: rgba(255,255,255,.06); }
[data-theme="dark"] .btn:not(.primary):not(.ok) kbd { background: #2c2c35; }
[data-theme="dark"] .input, [data-theme="dark"] select.input, [data-theme="dark"] textarea.input, [data-theme="dark"] .code-inputs input { background-color: #15151a; }
[data-theme="dark"] .switch .track { background: #3a3a45; }
[data-theme="dark"] .tabs, [data-theme="dark"] .seg { background: #24242c; }
[data-theme="dark"] .tabs .on, [data-theme="dark"] .seg button.on { background: #383843; box-shadow: none; }
[data-theme="dark"] .chip { background: var(--panel); }
[data-theme="dark"] .t th { background: #1f1f26; }
[data-theme="dark"] .t tbody tr.click:hover, [data-theme="dark"] .q-item:hover { background: #212129; }
[data-theme="dark"] .q-item.on { background: var(--accent-soft); }
[data-theme="dark"] .empty svg { color: #4a4a56; }
[data-theme="dark"] .photo { background: #24242c; }
[data-theme="dark"] .review-box { background: #17171c; border-color: #3a3a45; }
[data-theme="dark"] .decide, [data-theme="dark"] .drawer > .row:first-child { background: rgba(17,17,20,.94); }
[data-theme="dark"] .offer-card:hover { border-color: #3d3775; }
[data-theme="dark"] .f-row, [data-theme="dark"] .bulk-row { background: #17171c; }
[data-theme="dark"] .drop { border-color: #3a3a45; }
[data-theme="dark"] .bars .b:hover .col { background: #474083; }
[data-theme="dark"] .rank.r1 { background: #4a3a0c; color: #ffd666; }
[data-theme="dark"] .rank.r2 { background: #34343e; color: #d6d6e2; }
[data-theme="dark"] .rank.r3 { background: #4a2f1c; color: #f2bd8f; }
[data-theme="dark"] .modal { background: var(--panel); }
[data-theme="dark"] .msheet { background: #19191f; box-shadow: 0 -10px 50px rgba(0,0,0,.6); }
[data-theme="dark"] .msheet-grid a { background: #22222a; }
[data-theme="dark"] .msheet-grid .ic { background: color-mix(in srgb, var(--c) 22%, transparent); }
[data-theme="dark"] .overlay { background: rgba(0,0,0,.6); }
[data-theme="dark"] .skeleton { background: linear-gradient(90deg, #202027 25%, #2a2a32 50%, #202027 75%); background-size: 200% 100%; }
[data-theme="dark"] .alert.bad { color: #ffb4b9; }
[data-theme="dark"] .alert.warn { color: #f3d08a; }
[data-theme="dark"] .alert.info { color: #b0c6ff; }
[data-theme="dark"] .alert.ok { color: #93e2b3; }
[data-theme="dark"] .copy-line { background: #15151a; }
[data-theme="dark"] .kbd-help kbd { background: var(--panel); }
[data-theme="dark"] .toast { background: #2a2a33; }
[data-theme="dark"] .brand-mark, [data-theme="dark"] .kpi.accent { filter: saturate(.95); }
@media (max-width: 900px) {
  [data-theme="dark"] .decide { background: rgba(17,17,20,.96); }
  [data-theme="dark"] .tabbar { background: rgba(11,11,14,.97); }
}

/* ---------- проверка: компактнее ---------- */
.cbar { gap: 6px; }
.cbar #ccount { font-size: 12.5px; }
.cfx { display: flex; flex-direction: column; gap: 8px; }
#cfxbtn svg { width: 14px; height: 14px; }
#cfxbtn .badge { padding: 0 6px; margin-left: -2px; }
.back-row { display: none; }

/* ---------- телефон: чуть мельче масштаб ---------- */
@media (max-width: 900px) {
  .main { padding: 12px 10px calc(88px + env(safe-area-inset-bottom)); }
  .mobile-bar { min-height: 48px; }
  .mobile-bar b { font-size: 15px; }
  .top { margin-bottom: 12px; }
  .top h1 { font-size: 20px; }
  .btn { min-height: 42px; font-size: 14px; padding: 0 14px; }
  .btn.sm { min-height: 40px; font-size: 13px; }
  .btn.lg { min-height: 46px; font-size: 14.5px; }
  .input, select.input { height: 42px; }
  .card-h { padding: 12px 12px 0; }
  .card-b { padding: 12px; }
  .card-h h3 { font-size: 14.5px; }
  .kpi { padding: 12px; }
  .kpi .value { font-size: 22px; }
  .tabbar a, .tabbar button { min-height: 50px; font-size: 10.5px; }
  .tabbar svg { width: 21px; height: 21px; }
  .seg button { min-height: 38px; font-size: 13px; }
  .t:not(.t-keep) tr { padding: 10px 12px; }
  .t:not(.t-keep) td.title { font-size: 14.5px; }

  /* очередь */
  .check { grid-template-columns: minmax(0, 1fr); }
  .check > * { min-width: 0; }
  .seg button { padding: 6px 6px; flex: 1 1 auto; }
  .queue-h { padding: 10px; gap: 8px; }
  .q-item { padding: 10px 12px; }
  .q-item .l1 { font-size: 13.5px; }
  .q-item .l2 { font-size: 12px; }

  /* открытая продажа: без дублей, плотнее */
  #view:has(.check.has-sale) > .top { display: none; }
  .back-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
  a.btn.back-queue { margin-bottom: 0; }
  .check .sale-head > .row { display: none; }
  .check .sale-head h2 { font-size: 18px; }
  .check #sale > .stack { gap: 8px !important; }
  .check #sale .card-b.stack { gap: 10px; }
  .facts { gap: 8px 12px; }
  .fact .k { font-size: 10.5px; margin-bottom: 1px; }
  .fact .v { font-size: 13.5px; }
  .photos { gap: 6px; }
  .review-box { padding: 10px 12px; font-size: 13.5px; }
  .decide { padding: 8px 10px; gap: 6px; grid-template-columns: 44px 1fr 1fr 44px; bottom: calc(58px + env(safe-area-inset-bottom)); }
  .decide .btn { min-height: 44px; }
  .decide #b-seen { min-height: 40px; }
  .check.has-sale #sale { padding-bottom: 124px; }
  .msheet { bottom: calc(66px + env(safe-area-inset-bottom)); }
}
