:root {
  --bg: #eef1f8; --panel: #fff; --line: #e6e9f3; --text: #141829; --muted: #7b8298;
  --primary: #4361ee; --primary-d: #3249c9; --accent: #7c5cff;
  --grad: linear-gradient(135deg, #4361ee 0%, #7c5cff 100%);
  --mine: #e4eaff; --mine-text: #141829; --theirs: #fff;
  --green: #10a37f; --red: #e04256; --amber: #c47a08; --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 24, 41, .04), 0 8px 24px -14px rgba(20, 24, 41, .22);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
html.kb-open { --safe-bottom: 0px; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--bg); }
main, .view, .view-host { min-width: 0; max-width: 100%; }
.view { flex: 1; min-height: 0; display: flex; }
.view-host { flex: 1; min-width: 0; min-height: 0; display: flex; position: relative; overflow: hidden; }
.view-host.scroll { overflow: auto; display: block; -webkit-overflow-scrolling: touch; }
.page, .adm-body { max-width: 100%; }
img, video, code { max-width: 100%; }
.track, .tbl, .table-wrap, .chat-layout, .thread, .contacts, .contact { max-width: 100%; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); -webkit-text-size-adjust: 100%; }
/* #app всегда равен ВИДИМОЙ области экрана.
   --vvt / --vvh выставляет app.js из visualViewport (offsetTop / height).
   Когда iOS поднимает клавиатуру и «сдвигает» страницу, #app сдвигается вместе с видимой областью,
   поэтому шапка остаётся у верхнего края, а поле ввода — прямо над клавиатурой. */
#app {
  position: fixed; left: 0; right: 0;
  top: 0;
  /* сдвиг через transform, а не top: не вызывает перерасчёт вёрстки и применяется в том же кадре */
  transform: translate3d(0, var(--vvt, 0px), 0);
  will-change: transform, height;
  height: 100vh; height: 100dvh; height: var(--vvh, 100dvh);
  overflow: hidden; display: flex; flex-direction: column;
  background: var(--bg);
  width: 100%; max-width: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h3 { font-size: 16px; }
mark { background: #ffe58a; color: inherit; border-radius: 3px; padding: 0 1px; }
code { overflow-wrap: anywhere; word-break: break-all; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.gap { gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.warn-text { color: var(--amber); }
.danger-text { color: var(--red) !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #f4f6fa; border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 600; white-space: nowrap; min-height: 40px; transition: background .15s; }
.btn:hover { background: #e9edf5; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: #eef1f6; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; min-height: 32px; }
.btn.block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: transparent; cursor: pointer; font-size: 19px; color: var(--muted); }
.icon-btn:hover { background: #eef1f6; color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; font-size: 14px; }

.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 46px; height: 46px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 18px; }
.avatar.room { border-radius: 16px; font-size: 22px; }
.avatar.sm { width: 34px; height: 34px; font-size: 14px; }
.avatar.room.sm { border-radius: 12px; font-size: 17px; }
.avatar.xs { width: 22px; height: 22px; font-size: 11px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; }
.badge.grey { background: #d7dce6; color: var(--text); }
.tag { font-size: 11px; background: #eef2ff; color: var(--primary); border-radius: 6px; padding: 1px 6px; font-weight: 600; }
.pill { font-size: 11px; border-radius: 6px; padding: 1px 7px; font-weight: 700; white-space: nowrap; }
.pill.red { background: #fde8e8; color: var(--red); }
.pill.amber { background: #fdf1dc; color: var(--amber); }
.pill.green { background: #dff5ec; color: var(--green); }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, #3b6cf6, #7a4cf2); color: #fff; font-weight: 800; font-size: 12px; flex: none; }
.logo.big { width: 64px; height: 64px; font-size: 20px; border-radius: 18px; margin: 0 auto 6px; }

/* Поля */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: 6px; }
.field input, .field select, .field textarea, .search input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: #fff; font-size: 16px; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus { outline: 2px solid #c9d7ff; border-color: var(--primary); }
.search { display: block; }
.search.wide { max-width: 520px; }
.form-error { background: #fde8e8; color: var(--red); border-radius: 10px; padding: 9px 12px; font-size: 14px; }
.mini-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.mini-field input { width: 96px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 15px; }

/* Вход */
.login-wrap { flex: 1; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #e7edff, #f5f0ff); overflow: auto; }

.login-card { width: 100%; max-width: 380px; background: var(--panel); border-radius: 20px; box-shadow: var(--shadow); padding: 28px 22px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 22px; text-align: center; }
.demo-box { border: 1px dashed #c9d1e0; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }

/* Навигация */
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; }
.nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.nav-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 8px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--muted); }
.nav-btn:hover { background: #f1f3f8; }
.nav-btn.active { background: #eaf0ff; color: var(--primary); }
.nav-ico { position: relative; display: inline-flex; }
.badge.dot { position: absolute; top: -8px; right: -12px; min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; border: 2px solid #fff; }
.me { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.switch select { border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; font-size: 13px; max-width: 140px; }
.bottom-nav { display: none; }

/* ==================================================================
   МЕССЕНДЖЕР
   ================================================================== */
.chat-layout { position: absolute; inset: 0; display: flex; min-height: 0; overflow: hidden; }

.contacts { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: hidden; flex: 0 0 340px; }
.contacts-head { padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 12px; flex: none; }
.contacts-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; padding: 0 4px; }
.contacts-head .search input { border-radius: 14px; background: #f0f2f7; border-color: transparent; padding: 11px 16px; font-size: 15px; }
.contact-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 8px 12px; -webkit-overflow-scrolling: touch; }
.list-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 14px 12px 6px; }
.contact { width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: 14px; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; position: relative; transition: background .12s; }
.contact:hover { background: #f3f5fa; }
.contact.active { background: #eaf0ff; }
.contact .avatar { width: 52px; height: 52px; font-size: 20px; }
.contact .avatar.room { border-radius: 18px; font-size: 24px; }
.contact-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.contact-top, .contact-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.contact-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15.5px; font-weight: 700; }
.contact-time { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.contact-last { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 14px; line-height: 1.35; }
.contact-bottom .badge { min-width: 22px; height: 22px; font-size: 12px; padding: 0 7px; border-radius: 11px; }
.contact.result .contact-last { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.thread { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; min-width: 0; overflow: hidden; background: linear-gradient(180deg, #f2f3f7 0%, #eef0f5 100%); }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); height: 64px; flex: 0 0 64px; z-index: 20; }
.thread-head .avatar { width: 42px; height: 42px; font-size: 17px; }
.thread-head .avatar.room { border-radius: 12px; }
.thread-title { flex: 1; min-width: 0; }
.thread-title b { font-size: 16px; font-weight: 700; display: block; }
.thread-title .muted { font-size: 12.5px; }
.back { display: none; }
.thread-search { display: flex; align-items: center; gap: 4px; padding: 8px 12px; background: #fffbea; border-bottom: 1px solid #f0e4b0; flex: none; }
.thread-search input { padding: 8px 14px; border-radius: 20px; }
.hits { min-width: 62px; text-align: center; }

.messages-wrap { position: relative; flex: 1 1 auto; min-height: 0; display: flex; overflow: hidden; }
.messages {
  flex: 1 1 auto; min-width: 0; min-height: 0;
  overflow-y: auto; overflow-x: hidden; overflow-anchor: none;
  padding: 16px clamp(10px, 3vw, 40px);
  display: flex; flex-direction: column-reverse; gap: 4px;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.scroll-down { position: absolute; right: 16px; bottom: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--panel); color: var(--primary); font-size: 20px; box-shadow: 0 4px 16px rgba(20,30,60,.2); cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 5; }
.scroll-down.show { opacity: 1; pointer-events: auto; }
.ava-wrap { position: relative; flex: none; }
.dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--panel); }
.dot.on { background: #22c55e; }
.dot.off { background: #cbd5e1; }
.empty { margin: auto; color: var(--muted); text-align: center; padding: 20px; }
.empty.big { font-size: 17px; line-height: 2; }
.day { display: flex; justify-content: center; margin: 12px 0 6px; }
.day span, .sys span { background: rgba(255, 255, 255, .8); border-radius: 12px; padding: 4px 12px; font-size: 12px; color: var(--muted); box-shadow: 0 1px 1px rgba(0, 0, 0, .03); font-weight: 600; }
.sys { display: flex; justify-content: center; margin: 6px 0; text-align: center; }
.sys span { color: var(--text); max-width: 92%; font-weight: 500; }
.sys small { color: var(--muted); margin-left: 4px; }
.msg { display: flex; align-items: flex-end; gap: 6px; max-width: 100%; margin-bottom: 2px; }
.msg.mine { justify-content: flex-end; }
.msg-ava { margin-bottom: 2px; }
.bubble { max-width: min(560px, 78%); min-width: 0; background: var(--theirs); border-radius: 18px 18px 18px 4px; padding: 8px 12px 6px; box-shadow: 0 1px 1px rgba(0, 0, 0, .04); overflow-wrap: anywhere; word-break: break-word; font-size: 15.5px; line-height: 1.35; }
/* Свои сообщения — светлый индиго с тёмным текстом: читается и в обычных сообщениях, и в карточках заказов */
.msg.mine .bubble { background: linear-gradient(180deg, #eaeeff, #e1e8ff); color: var(--mine-text); border: 1px solid #d3dcff; border-radius: 18px 18px 4px 18px; }
.msg.mine .bubble .meta { color: #7e88b3; }
.msg.mine .bubble .ticks { color: #8f99c4; }
.msg.mine .bubble .ticks.read { color: #2f6df6; }
.msg.is-card .bubble { width: min(440px, 90%); max-width: none; }
.msg.hit .bubble, .sys.hit span { box-shadow: 0 0 0 3px #ffd54a; }
.author { font-size: 12.5px; font-weight: 700; margin-bottom: 3px; }
.deleted { color: var(--muted); font-style: italic; }
.meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.ticks { letter-spacing: -3px; font-weight: 700; padding-right: 3px; cursor: help; }
.ticks.read { color: #1d9bf0; }
.msg-actions { display: flex; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
@media (hover: none) { .msg-actions { opacity: .75; } }
.album { display: grid; gap: 3px; border-radius: 12px; overflow: hidden; margin-bottom: 4px; }
.album.n1 { grid-template-columns: 1fr; }
.album.n2, .album.n3, .album.n4 { grid-template-columns: 1fr 1fr; }
.album.n3 .ph:first-child { grid-column: span 2; }
.ph { border: 0; padding: 0; background: #ccd3df; cursor: zoom-in; display: block; }
.ph img { display: block; width: 100%; height: 100%; max-height: 320px; object-fit: cover; }
.album:not(.n1) .ph img { aspect-ratio: 1; }
.vid { display: block; width: 100%; max-height: 320px; border-radius: 10px; background: #000; margin-bottom: 4px; }
.voice { display: flex; align-items: center; gap: 6px; }
.voice audio { height: 38px; max-width: 250px; min-width: 0; flex: 1; }
.file-name { font-size: 12px; color: var(--muted); }
.lightbox { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; border-radius: 10px; }

/* Карточка заказа */
.order-card, .receipt { display: flex; flex-direction: column; gap: 9px; padding: 2px 0; }
.oc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.oc-meta { font-size: 12px; color: var(--muted); }
.oc-track .track { width: 100%; padding: 8px 10px; border-radius: 10px; }
.oc-track .track code { font-size: 17px; }
.oc-track .cdek { width: 48px; height: 16px; }
.oc-client { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.oc-ava { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.oc-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.oc-items li { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px dashed rgba(0,0,0,.09); }
.oc-items li:last-child { border-bottom: 0; }
.oc-iname { flex: 1; min-width: 0; }
.oc-iquant { font-size: 13.5px; font-weight: 600; white-space: nowrap; color: var(--muted); }
.oc-isum { font-weight: 700; white-space: nowrap; }
.oc-chat .oc-iname { font-size: 15.5px; font-weight: 600; color: var(--text); }
.oc-chat .oc-iquant { font-size: 15.5px; font-weight: 800; color: var(--text); }
.oc-total { display: flex; justify-content: space-between; align-items: center; font-size: 16px; padding-top: 2px; }
.oc-recip { display: flex; gap: 6px; align-items: flex-start; font-size: 13.5px; background: #f4f6fa; border-radius: 8px; padding: 7px 9px; }
.oc-recip .cdek { margin-top: 3px; }
.oc-collected { font-size: 13px; color: var(--green); }
.order-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

.order-total { display: flex; justify-content: space-between; font-size: 15px; }
.recipient { font-size: 14px; background: rgba(255, 255, 255, .65); border-radius: 8px; padding: 5px 8px; }
.recipient.big { font-size: 15px; background: #f5f7fb; }
.track { display: flex; align-items: flex-start; gap: 6px; background: #fff7e0; border: 1px solid #f2dc9a; border-radius: 8px; padding: 4px 6px 4px 8px; flex-wrap: wrap; max-width: 100%; min-width: 0; }
.track code { flex: 1 1 auto; min-width: 0; }
.track-label { font-size: 12px; font-weight: 700; color: var(--amber); }
.track code { font: 700 14.5px/1.3 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .02em; user-select: all; overflow-wrap: anywhere; }
.private { font-size: 13px; background: #eef9f4; border-radius: 8px; padding: 5px 8px; }
.order-hist { font-size: 12px; color: var(--amber); }
.order-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.status { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 7px; padding: 2px 8px; white-space: nowrap; }
.s-new { background: #eaf0ff; color: var(--primary); }
.s-sent { background: #fdf1dc; color: var(--amber); }
.s-check { background: #fff0c2; color: #8a5a00; }
.s-paid { background: #dff5ec; color: var(--green); }
.s-cancelled { background: #eceef2; color: var(--muted); }

/* Ввод — в потоке внизу .thread. Никакого transform.
   Нижний отступ минимальный: белой полосы под полем ввода больше нет. */
.composer {
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 10px 12px 10px;
  flex: none; z-index: 30;
}
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer-row textarea { flex: 1; min-width: 0; resize: none; border: 1px solid transparent; border-radius: 22px; padding: 10px 16px; max-height: 140px; background: #f0f2f7; line-height: 1.4; font-size: 16px; transition: background .15s, border-color .15s; }
.composer-row textarea:focus { outline: none; border-color: var(--primary); background: #fff; }
.attach { cursor: pointer; }
.send { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: var(--primary); color: #fff; font-size: 18px; cursor: pointer; transition: background .15s, transform .1s; }
.send:hover { background: var(--primary-d); }
.send:active { transform: scale(.94); }
.edit-bar { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 8px 14px; font-size: 13px; color: var(--primary); font-weight: 600; border-left: 3px solid var(--primary); margin-bottom: 6px; }
.pending { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; align-items: center; }
.pend { position: relative; flex: none; width: 76px; display: flex; flex-direction: column; gap: 3px; }
.pend img, .pend-icon { width: 76px; height: 76px; border-radius: 10px; object-fit: cover; background: #eef1f6; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.pend-name { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pend-x { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(20, 25, 40, .75); color: #fff; font-size: 11px; cursor: pointer; }
.pend-info { flex: none; padding: 0 6px; }
.rec-bar { display: flex; align-items: center; gap: 10px; padding: 6px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 700; }
@keyframes pulse { 50% { opacity: .3; } }

/* Модальные окна */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 20, 35, .45); display: grid; place-items: center; padding: 14px; z-index: 50; }
.modal { width: 100%; max-width: 520px; max-height: calc(100dvh - 28px); background: var(--panel); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); display: flex; flex-direction: column; }
.modal.modal-wide { max-width: 900px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 4px 18px; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 8px 18px 18px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.modal-foot.end { justify-content: flex-end; }
.modal-foot.sticky { position: sticky; bottom: -18px; background: var(--panel); padding: 10px 0 2px; border-top: 1px solid var(--line); }
.confirm-text { margin: 4px 0 14px; }
.order-form { display: flex; flex-direction: column; gap: 12px; }

.pp-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 14px; cursor: pointer; }
.pp-item:hover { background: #eef3ff; }
.pp-item span:first-child { font-weight: 600; }
.pp-item .muted { font-size: 12.5px; }
.pp-empty { padding: 12px 14px; text-align: center; }
.ret-items { display: flex; flex-direction: column; gap: 6px; }
.ret-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.ret-row.picked { border-color: var(--primary); background: #f5f8ff; }
.ret-info { min-width: 0; }
.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick-row { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.pick-row.picked { border-color: var(--primary); background: #f5f8ff; }
.pick-main { display: flex; align-items: center; gap: 10px; }
.pick-info { flex: 1; min-width: 0; }
.tier-hint { color: var(--green); }
.pick-extra { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.pick-row:not(.picked) .pick-extra { display: none; }
.stepper { display: flex; align-items: center; gap: 2px; flex: none; }
.stepper input { width: 56px; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 2px; font-size: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span2 { grid-column: span 2; }
.ship-summary { background: #f5f7fb; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.file-btn { align-self: flex-start; cursor: pointer; }

/* Страницы */
.page { max-width: 1100px; margin: 0 auto; padding: 18px clamp(10px, 3vw, 28px) 40px; display: flex; flex-direction: column; gap: 14px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; }
.page-head p { margin: 4px 0 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.scroll-x { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips.scroll-x::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; flex: none; }
.chip span { color: var(--muted); margin-left: 2px; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.active span { color: #dce6ff; }
.period { display: flex; flex-direction: column; gap: 8px; }
.dates input { padding: 7px 10px; }
.seg { display: inline-flex; background: #e6eaf2; border-radius: 10px; padding: 3px; }
.seg-btn { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg-btn.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hint-line { margin: 0; }
.hint-warn { margin: 0; background: #fff6e0; border-radius: 10px; padding: 9px 12px; font-size: 14px; }
.private-banner { background: #eef9f4; border: 1px solid #c8ebdc; border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f0f2f6; }
.rules { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }


.save { color: var(--green); font-size: 12px; font-weight: 700; margin-left: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stats > div { background: var(--panel); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.mini-stats b { font-size: 18px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 10px 14px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-body { display: flex; flex-direction: column; gap: 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.stat { background: var(--panel); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); border: 0; border-left: 4px solid #d5dbe7; text-align: left; font: inherit; color: inherit; }
.stat.link { cursor: pointer; }
.stat.link:hover { background: #fafbff; }
.stat.pos { border-left-color: var(--green); }
.stat.neg { border-left-color: var(--red); }
.stat.warn { border-left-color: var(--amber); }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 21px; font-weight: 800; margin: 2px 0; }
.stat.pos .stat-value { color: var(--green); }
.stat.neg .stat-value { color: var(--red); }
.stat-sub { font-size: 12px; color: var(--muted); }

.table-wrap { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.table-wrap.flat { box-shadow: none; border: 1px solid var(--line); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #f0f2f6; vertical-align: top; }
.tbl tbody tr:hover { background: #fafbfd; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl tfoot td { border-top: 1px solid var(--line); border-bottom: 0; }
.tbl .actions { text-align: right; }
.tbl .actions .btn, .tbl .actions .icon-btn { margin: 2px 0 2px 4px; }
.empty-cell { text-align: center; color: var(--muted); padding: 28px !important; }
.tbl .track { display: inline-flex; }
.tier { display: inline-block; font-size: 12.5px; background: #eef9f4; color: var(--green); border-radius: 6px; padding: 1px 7px; margin: 1px 0; white-space: nowrap; }
.bar-cell { background: #eef1f6; border-radius: 4px; height: 8px; min-width: 70px; overflow: hidden; }
.bar-cell span { display: block; height: 100%; background: var(--green); }

.chart { width: 100%; height: auto; display: block; }
.chart .bar-rev { fill: #b9cbff; }
.chart .bar-pro { fill: var(--green); }
.chart .grid { stroke: #eceff4; }
.chart .ax { font-size: 11px; fill: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.lg-rev { background: #b9cbff; }
.lg-pro { background: var(--green); }

/* Курьер */
.c-section { display: flex; flex-direction: column; gap: 10px; }
.c-section h3 { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.c-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.c-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; border-top: 4px solid var(--primary); }
.c-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.c-top b { font-size: 17px; }
.c-items { list-style: none; margin: 0; padding: 0; }
.c-items li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--line); }

.s-list { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); }
.s-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #f0f2f6; flex-wrap: wrap; }
.s-row:last-child { border-bottom: 0; }
.s-main { flex: 1; min-width: 200px; }
.s-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.day-group { background: transparent; }
.day-group summary { cursor: pointer; padding: 8px 4px; list-style-position: inside; }
.day-group .s-list { margin-top: 4px; }

/* Админка */
.admin { display: grid; grid-template-columns: 230px 1fr; min-height: 100%; }
.adm-nav { background: var(--panel); border-right: 1px solid var(--line); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; align-self: start; height: 100%; min-height: calc(100dvh - 53px); }
.adm-link { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--muted); text-align: left; white-space: nowrap; }
.adm-link:hover { background: #f3f5fa; }
.adm-link.active { background: #eaf0ff; color: var(--primary); }
.adm-link .badge { margin-left: auto; }
.adm-body { padding: 18px clamp(10px, 3vw, 28px) 40px; display: flex; flex-direction: column; gap: 14px; min-width: 0; max-width: 1200px; }
.adm-title { font-size: 22px; }
.tiers { display: flex; flex-direction: column; gap: 6px; }
.tier-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.arr-rows { display: flex; flex-direction: column; gap: 8px; }
.arr-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; align-items: end; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.arr-list { display: flex; flex-direction: column; gap: 10px; }
.arr-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.arr-card summary { cursor: pointer; display: flex; flex-direction: column; gap: 6px; list-style: none; }
.arr-card summary::-webkit-details-marker { display: none; }
.arr-card[open] summary { margin-bottom: 10px; }
.arr-card > .btn { margin-top: 8px; }
.arr-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.arr-kpis { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.arr-kpis b { color: var(--text); }
.arr-kpis .pos b { color: var(--green); }
.progress { height: 6px; background: #eef1f6; border-radius: 3px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--primary); }
.switch-cb { position: relative; display: inline-flex; cursor: pointer; }
.switch-cb input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; }
.cb-ui { width: 44px; height: 26px; border-radius: 13px; background: #cfd5e1; position: relative; transition: background .15s; }
.cb-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch-cb input:checked + .sr-only + .cb-ui { background: var(--green); }
.switch-cb input:checked + .sr-only + .cb-ui::after { transform: translateX(18px); }
.switch-cb input:disabled + .sr-only + .cb-ui { opacity: .5; }
.switch-cb input:focus-visible + .sr-only + .cb-ui { outline: 2px solid var(--primary); outline-offset: 2px; }
.add-user .field.inline input { width: 180px; }

/* Уведомления */
.toasts { position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #1f2638; color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; transition: opacity .3s, transform .3s; }
.toast.ok { background: #0f7d5f; }
.toast.error { background: #b62f2f; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Планшет ---------- */
@media (max-width: 980px) {
  .contacts { flex-basis: 290px; }
  .admin { grid-template-columns: 1fr; }
  .adm-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; height: auto; padding: 8px; z-index: 5; scrollbar-width: none; }
  .adm-nav::-webkit-scrollbar { display: none; }
  .adm-link { padding: 8px 12px; background: #f3f5fa; }
  .two-col { grid-template-columns: 1fr; }
}

/* ---------- Телефон ---------- */
@media (max-width: 760px) {
  /* страница целиком неподвижна: её нельзя «протянуть» и сдвинуть шапку */
  html, body { position: fixed; inset: 0; overflow: hidden; }
  body { font-size: 15.5px; }
  .topbar { padding: 6px 10px; gap: 8px; }
  .topbar .nav { display: none; }
  .bottom-nav { display: flex; flex: none; background: var(--panel); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; width: 100%; max-width: 100vw; overflow-x: auto; overflow-y: hidden; }
  .bn-btn { flex: 1 0 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; border: 0; background: transparent; padding: 5px 2px; border-radius: 10px; color: var(--muted); font-size: 10.5px; font-weight: 600; cursor: pointer; line-height: 1.2; max-width: 100vw; }
  .bn-btn .nav-ico { font-size: 20px; line-height: 1.15; }
  .bn-btn .nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bn-btn.active { color: var(--primary); background: #eef3ff; }
  /* Шапка и нижняя панель приложения НЕ скрываются в чате — чат (position: fixed) просто закрывает их собой.
     Раньше они прятались/появлялись, из-за этого список «подпрыгивал» при возврате. */
  .messages, .thread-head { touch-action: pan-y; }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
  body.in-thread .toasts { bottom: 90px; }

  .chat-layout { display: block; overflow: hidden; }
  .contacts {
    position: absolute; inset: 0;
    width: 100%; max-width: 100vw; border-right: 0;
    transform: translateX(0);
    transition: transform .3s cubic-bezier(.32, .72, 0, 1);
    will-change: transform;
    z-index: 10;
  }
  /* .thread занимает всю высоту #app (а #app = видимая область, см. выше),
     поэтому шапка всегда сверху, а композер — прямо над клавиатурой. */
  .thread {
    position: fixed; top: 0; left: 0; right: 0;
    width: 100%; max-width: 100vw;
    height: 100%;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.32, .72, 0, 1);
    will-change: transform;
    pointer-events: none;
    z-index: 20;
    overflow: hidden;
  }
  .chat-layout.has-thread .contacts { transform: translateX(-25%); }
  .chat-layout.has-thread .thread { transform: translateX(0); pointer-events: auto; }

  .contacts-head { padding: 16px 14px 6px; }
  .contacts-head h2 { font-size: 28px; }
  .contact { padding: 10px 8px; }

  .back { display: inline-flex; margin-left: -6px; }
  .thread-head { gap: 10px; padding: 8px 10px; height: calc(60px + env(safe-area-inset-top)); flex: 0 0 calc(60px + env(safe-area-inset-top)); padding-top: calc(8px + env(safe-area-inset-top)); }
  .thread-head .avatar { width: 40px; height: 40px; font-size: 16px; }
  .bubble { max-width: 84%; }
  .msg.is-card .bubble { width: 96%; }
  .messages { padding: 12px 10px; }
  .composer { padding: 8px 10px calc(12px + var(--safe-bottom, 0px)); }
  html.kb-open .composer { padding-bottom: 8px; }
  .composer-row textarea { font-size: 16px; min-height: 42px; }
  .send { width: 42px; height: 42px; }

  .c-grid { grid-template-columns: 1fr; gap: 10px; }
  .c-card { padding: 12px; }
  .c-card .track { margin-bottom: 4px; }
  .c-card .track code { font-size: 17px; }
  .c-card .c-items { font-size: 14px; }
  .c-card .btn { width: 100%; }
  .c-card .recipient { display: none !important; }
  .s-row { flex-direction: column; gap: 6px; padding: 10px 12px; }
  .s-side { align-items: flex-start; width: 100%; }
  .s-side .btn { width: 100%; }


  .msg-ava { display: none; }
  .hide-xs { display: none; }

  .modal-overlay { place-items: end center; padding: 0; }
  .modal { max-width: none !important; border-radius: 18px 18px 0 0; max-height: 94dvh; }
  .modal-body { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .arr-row { grid-template-columns: 1fr 1fr auto; }
  .arr-row .field:first-child { grid-column: span 3; }

  .page, .adm-body { padding: 12px 10px 28px; gap: 12px; }
  .page-head h2, .adm-title { font-size: 20px; }
  .page-head .btn.primary { width: 100%; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat-value { font-size: 18px; }
  .mini-stats b { font-size: 16px; }
  .cards, .c-grid, .prod-grid { grid-template-columns: 1fr; }
  .s-side { align-items: flex-start; }

  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tfoot, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border-bottom: 1px solid var(--line); padding: 8px 2px; }
  .tbl td { border: 0; padding: 4px 10px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; flex: none; max-width: 45%; }
  .tbl td.actions { justify-content: flex-end; flex-wrap: wrap; }
  .tbl tfoot td { display: flex; }
  .bar-cell { width: 50%; }
}
.client-name { font-size: 16.5px; font-weight: 700; }

.c-who { font-size: 15px; font-weight: 600; }
.ship-who { font-size: 15px; font-weight: 600; margin-top: 2px; }

.plist { display: flex; flex-direction: column; gap: 8px; }
.plist-item { background: var(--panel); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); }
.plist-item.variant { margin-left: 12px; border-left: 3px solid var(--primary); background: #fafbff; }
.pl-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pl-name { font-weight: 700; font-size: 15px; min-width: 0; }
.pl-name .pill { margin-left: 4px; }
.pl-stock { font-weight: 800; font-size: 17px; color: var(--primary); white-space: nowrap; }
.pl-stock small { font-weight: 600; font-size: 12px; color: var(--muted); }
.pl-prices { display: flex; flex-direction: column; margin-top: 5px; }
.pl-price { font-size: 13.5px; padding: 1px 0; }
.pl-tier { color: var(--muted); font-size: 12px; margin-right: 5px; }
.pl-price b { font-size: 14.5px; }
.ship-check { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ship-check li { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; }
.ship-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.ship-top b { font-size: 16px; }
.ship-top code { font: 700 15px ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; word-break: break-all; }
.ship-items { color: var(--muted); font-size: 14px; margin-top: 3px; }
.sys.clickable { cursor: pointer; }
.sys.clickable span { transition: background .15s; }
.sys.clickable:hover span { background: #ffe58a; }

.cdek { width: 40px; height: 14px; flex: none; vertical-align: -2px; display: inline-block; }
.field > span .cdek { margin-right: 4px; }
.track.ret { background: #fdecec; border-color: #f3c2c2; }
.track.ret .track-label { color: var(--red); }
.s-collected { background: #e3f6ee; color: var(--green); }
.s-recheck { background: #fde3e3; color: var(--red); }
.s-returned { background: #fde8e8; color: var(--red); }
.recheck-warn { background: #fdeaea; color: #9b2222; border-radius: 8px; padding: 6px 9px; font-size: 13.5px; font-weight: 600; }
.c-card.recheck { border-top-color: var(--red); }
.thumbs { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0; }
.thumbs .ph { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; }
.thumbs .ph img { width: 56px; height: 56px; aspect-ratio: auto; }
.ship-bar { position: sticky; bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: #1f2638; color: #fff; border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.ship-bar .muted { color: #c4cbe0; }
.ship-summary code { font: 700 14px ui-monospace, Menlo, Consolas, monospace; }
.head-btn + .head-btn { margin-left: -4px; }
.me-name { font-size: 14px; }

@media (max-width: 760px) { .ship-bar { bottom: 4px; } .ship-bar .btn { width: 100%; } .me-name { display: none; } }

@media (max-width: 380px) {
  .brand-name { display: none; }
  .stats { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .bn-btn { font-size: 9.5px; padding: 4px 1px; }
  .bn-btn .nav-ico { font-size: 18px; }
}

/* =====================================================================
   ДИЗАЙН 2.0 — «Мягкий индиго»
   Светлая палитра, градиентный акцент, карточки с мягкими тенями.
   Лежит в конце файла и переопределяет базовые стили выше.
   ===================================================================== */
::selection { background: #cdd8ff; }
@media (hover: hover) {
  .contact-list, .messages { scrollbar-width: thin; scrollbar-color: #cfd5ea transparent; }
}

/* Акценты, кнопки */
.logo { background: var(--grad); border-radius: 12px; box-shadow: 0 8px 16px -8px rgba(67, 97, 238, .8); }
.btn { border-radius: 12px; background: #fff; box-shadow: 0 1px 2px rgba(20, 24, 41, .04); }
.btn:hover { background: #f4f6fd; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 10px 20px -12px rgba(67, 97, 238, .95); }
.btn.primary:hover { background: var(--grad); filter: brightness(1.07); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.sm { border-radius: 10px; }
.icon-btn:hover { background: #eef1fb; color: var(--primary); }
.badge { background: var(--grad); box-shadow: 0 4px 10px -4px rgba(67, 97, 238, .85); }
.badge.dot { border-color: #fff; }
.tag { background: #eef1ff; color: var(--primary); }
.avatar { box-shadow: 0 8px 16px -10px rgba(20, 24, 41, .6); }
.status { border-radius: 999px; padding: 3px 11px; letter-spacing: .01em; }
.chip.active { background: var(--grad); border-color: transparent; }
.seg { background: #e8ecf7; }

/* Верхняя и нижняя навигация */
.topbar { background: #fff; border-bottom: 1px solid rgba(20, 24, 41, .06); box-shadow: 0 10px 26px -24px rgba(20, 24, 41, .6); }
.nav-btn { border-radius: 12px; }
.nav-btn.active, .bn-btn.active { background: linear-gradient(135deg, #eaefff, #f1ebff); color: var(--primary); }

/* Список чатов */
.contacts { background: #fff; border-right: 1px solid rgba(20, 24, 41, .06); }
.contacts-head .search input { background: #f1f3fb; border: 1px solid transparent; border-radius: 16px; }
.contacts-head .search input:focus { background: #fff; border-color: #b4c2ff; outline: none; box-shadow: 0 0 0 4px rgba(67, 97, 238, .1); }
.contact { border-radius: 18px; }
.contact:hover { background: #f5f7fd; }
.contact.active { background: linear-gradient(135deg, #eef2ff, #f4efff); }
.contact .avatar { box-shadow: 0 8px 16px -10px rgba(20, 24, 41, .65); }
.contact-last { color: #8a91a8; }
.list-label { color: #9aa1b8; }

/* Переписка */
.thread { background: radial-gradient(700px 420px at 0% 0%, #e4eaff 0%, rgba(228, 234, 255, 0) 70%), radial-gradient(700px 460px at 100% 100%, #efe7ff 0%, rgba(239, 231, 255, 0) 70%), #f3f5fb; }
.thread-head { background: #fff; border-bottom: 1px solid rgba(20, 24, 41, .06); box-shadow: 0 10px 24px -22px rgba(20, 24, 41, .65); }
.thread-title b { letter-spacing: -.01em; }
.thread-search { background: #fffaf0; }
.day span { background: #fff; border: 1px solid #e7eaf5; color: #6f7790; border-radius: 999px; padding: 4px 14px; box-shadow: none; }
.sys span { background: #fff; border: 1px solid #e7eaf5; border-radius: 16px; padding: 7px 14px; box-shadow: 0 1px 2px rgba(20, 24, 41, .04); font-size: 13px; line-height: 1.4; color: #2a3050; }
.bubble { border-radius: 20px 20px 20px 6px; padding: 9px 13px 6px; box-shadow: 0 1px 2px rgba(20, 24, 41, .05), 0 10px 20px -16px rgba(20, 24, 41, .4); }
.msg.mine .bubble { border-radius: 20px 20px 6px 20px; }
.meta { color: #8f96ad; }
.scroll-down { box-shadow: 0 12px 26px -12px rgba(67, 97, 238, .7); }

/* Карточки заказов и чеков — всегда белые, с цветной полосой слева */
.msg.is-card .bubble { position: relative; overflow: hidden; background: #fff; color: var(--text); border: 1px solid #e3e8f6; border-radius: 20px; padding: 12px 14px 9px 18px; box-shadow: 0 2px 4px rgba(20, 24, 41, .04), 0 18px 32px -24px rgba(30, 50, 140, .5); }
.msg.is-card .bubble::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--grad); }
.msg.theirs.is-card .bubble::before { background: linear-gradient(180deg, #10a37f, #38bdf8); }
.msg.is-card .bubble .meta { color: #8f96ad; }
.order-card, .receipt { gap: 10px; }
.oc-meta { font-weight: 600; }
.track { background: #fff8e6; border: 1px dashed #ebc766; border-radius: 12px; }
.track code { color: #3a2f10; }
.oc-track .track { padding: 9px 12px; }
.oc-client { background: #f4f6fe; border-radius: 14px; padding: 6px 12px 6px 6px; }
.oc-items { background: #f8f9fe; border: 1px solid #eceffa; border-radius: 14px; padding: 2px 12px; }
.oc-items li { border-bottom: 1px solid #edf0fa; }
.oc-items li:last-child { border-bottom: 0; }
.oc-chat .oc-iquant, .oc-iquant { background: #e9edff; color: var(--primary); border-radius: 9px; padding: 2px 9px; font-weight: 800; }
.oc-total { border-top: 1px dashed #dde2f2; padding-top: 9px; }
.oc-total b { font-size: 19px; color: var(--primary); }
.oc-recip { background: #f4f6fe; border: 1px solid #e8ecfa; border-radius: 12px; }
.order-hist { background: #fff6e3; color: #9a6200; border-radius: 10px; padding: 5px 10px; }

/* Кнопки «изменить / удалить» у сообщения */
.msg-actions .icon-btn { width: 30px; height: 30px; font-size: 13px; margin: 0 2px; background: #fff; color: #5d6896; box-shadow: var(--shadow); }
@media (hover: none) {
  .msg-actions { display: none; opacity: 1; }
  .msg.show-actions .msg-actions { display: flex; }
}

/* Поле ввода */
.composer { background: #fff; border-top: 1px solid rgba(20, 24, 41, .06); box-shadow: 0 -12px 28px -24px rgba(20, 24, 41, .6); }
.composer-row textarea { background: #f1f3fb; border-radius: 24px; }
.composer-row textarea:focus { background: #fff; border-color: #aebcff; box-shadow: 0 0 0 4px rgba(67, 97, 238, .1); }
.composer-row .icon-btn { color: #6c77a6; }
.send { background: var(--grad); box-shadow: 0 12px 22px -12px rgba(67, 97, 238, .95); }
.send:hover { background: var(--grad); filter: brightness(1.07); }
.edit-bar { background: #f4f6fe; border-radius: 0 12px 12px 0; }
/* Поле ввода на iPhone: редактируемый блок вместо <textarea>, чтобы iOS не показывал панель «^ v ✓» */
.composer-row .msg-input { flex: 1; min-width: 0; position: relative; min-height: 42px; max-height: 140px; overflow-y: auto; padding: 10px 16px; border: 0; border-radius: 24px; background: #f1f3fb; font-size: 16px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; outline: none; -webkit-user-select: text; user-select: text; box-shadow: inset 0 0 0 1px transparent; transition: background .15s, box-shadow .15s; }
.composer-row .msg-input:focus { background: #fff; box-shadow: inset 0 0 0 1.5px #aebcff, 0 0 0 4px rgba(67, 97, 238, .1); }
.composer-row .msg-input.is-empty::before { content: attr(data-placeholder); position: absolute; left: 16px; top: 10px; color: #9aa1b8; pointer-events: none; }

/* Остальные страницы */
.panel, .card, .prod-card, .plist-item, .arr-card, .s-list, .table-wrap { border: 1px solid rgba(20, 24, 41, .05); }
.field input, .field select, .field textarea { border-radius: 14px; background: #fbfcff; }
.field input:focus, .field select:focus, .field textarea:focus, .thread-search input:focus { outline: none; border-color: #aebcff; box-shadow: 0 0 0 4px rgba(67, 97, 238, .1); }
.modal-overlay { background: rgba(16, 20, 44, .5); }
.modal { border-radius: 24px; box-shadow: 0 30px 80px -20px rgba(20, 24, 41, .5); }
@media (max-width: 760px) { .modal { border-radius: 24px 24px 0 0; } }
.login-wrap, .lock-overlay { background: radial-gradient(900px 500px at 10% 0%, #dfe7ff, rgba(223, 231, 255, 0) 60%), radial-gradient(800px 500px at 100% 100%, #f1e4ff, rgba(241, 228, 255, 0) 60%), #eef1f9; }
.login-card { border-radius: 26px; padding: 32px 24px; border: 1px solid rgba(20, 24, 41, .04); box-shadow: 0 30px 70px -34px rgba(67, 97, 238, .55); }
.lock-card { border-radius: 26px; }
.toast { border-radius: 14px; }

/* ---------- Полоса действий под шапкой чата («Новый заказ», «Оплатить», «Возврат») ---------- */
.thread-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-actions { display: flex; gap: 8px; padding: 8px 12px; background: #fff; border-bottom: 1px solid rgba(20, 24, 41, .06); flex: none; overflow-x: auto; scrollbar-width: none; }
.thread-actions::-webkit-scrollbar { display: none; }
.qa-btn { flex: 1 1 0; min-width: max-content; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid #dfe4f6; border-radius: 14px; background: #f6f8ff; color: #2b3563; font-weight: 700; font-size: 14.5px; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .1s, filter .15s; }
.qa-btn:active { transform: scale(.97); }
.qa-btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 10px 20px -12px rgba(67, 97, 238, .95); }
.qa-ico { font-size: 18px; line-height: 1; }
html.kb-open .thread-actions { display: none; } /* при открытой клавиатуре место нужнее сообщениям */

/* ---------- Добавление товара в заказ: список открывается только по нажатию ---------- */
.add-prod-btn { width: 100%; min-height: 46px; border: 1.5px dashed #b9c6ff; background: #f6f8ff; color: var(--primary); box-shadow: none; }
.pp-panel { margin-top: 8px; padding: 10px; border: 1px solid #e3e8f6; border-radius: 18px; background: #f7f8fe; }
.pp-panel input { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; font-size: 16px; background: #fff; }
.pp-results { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 260px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pp-results .pp-item { border: 1px solid #e6e9f6; border-radius: 14px; background: #fff; padding: 10px 14px; }
.pp-results .pp-item:hover, .pp-results .pp-item:active { background: #eef2ff; border-color: #b9c6ff; }

/* ---------- Выбор заказа карточками (оплата, возврат) ---------- */
.op { display: flex; flex-direction: column; gap: 8px; }
.op-q { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; font-size: 16px; background: #fbfcff; }
.op-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; padding: 3px; -webkit-overflow-scrolling: touch; }
.op-item { display: block; cursor: pointer; position: relative; }
.op-item input { position: absolute; opacity: 0; pointer-events: none; }
.op-card { display: flex; flex-direction: column; gap: 3px; position: relative; padding: 11px 14px 11px 46px; border: 1.5px solid #e3e8f6; border-radius: 16px; background: #fff; transition: border-color .15s, background .15s, box-shadow .15s; }
.op-card::before { content: ''; position: absolute; left: 15px; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; border: 2px solid #c3cbe6; background: #fff; }
.op-item input:checked + .op-card { border-color: var(--primary); background: linear-gradient(135deg, #f3f6ff, #f7f2ff); box-shadow: 0 0 0 4px rgba(67, 97, 238, .1); }
.op-item input:checked + .op-card::before { border-color: var(--primary); background: radial-gradient(circle, var(--primary) 0 45%, #fff 50%); }
.op-item input:focus-visible + .op-card { outline: 2px solid var(--primary); outline-offset: 2px; }
.op-top { display: flex; justify-content: space-between; gap: 8px; }
.op-sum { color: var(--primary); white-space: nowrap; }
.op-line { font-size: 13px; color: var(--muted); }
.op-line code { font-weight: 700; color: #3a2f10; }
.op-items { font-size: 13.5px; color: #2a3050; overflow-wrap: anywhere; }

/* ---------- Админка: сброс и проверка ---------- */
.danger-zone { border: 1.5px solid #f3c6cc !important; background: linear-gradient(180deg, #fff, #fff8f8); }
.reset-list { display: flex; flex-direction: column; gap: 8px; }
.reset-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid #e6e9f6; border-radius: 16px; background: #fff; cursor: pointer; }
.reset-item.on { border-color: #f0b4bc; background: #fff6f7; }
.reset-item input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--red); }
.reset-item b { display: block; }
.reset-item small { display: block; color: var(--muted); margin-top: 2px; }
.reset-item small.auto { color: var(--amber); font-weight: 600; }
.audit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.audit-box { border: 1px solid #e6e9f6; border-radius: 14px; padding: 10px 12px; background: #fbfcff; }
.audit-box .v { font-size: 19px; font-weight: 800; }
.audit-box.bad { border-color: #f0b4bc; background: #fff6f7; }
.audit-box.ok { border-color: #bfe6d7; background: #f3fbf7; }

/* ---------- Админка: цены продавцов ---------- */
.sp-input { width: 120px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 16px; text-align: right; background: #fbfcff; }
.sp-input:focus { outline: none; border-color: #aebcff; box-shadow: 0 0 0 4px rgba(67, 97, 238, .1); background: #fff; }
.sp-bar { position: sticky; bottom: 8px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; padding: 10px 14px; background: #fff; border: 1px solid #e3e8f6; border-radius: 16px; box-shadow: var(--shadow); }
.sp-bar .warn-text { margin-right: auto; font-weight: 600; }
.sp-tools { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
@media (max-width: 760px) { .sp-input { width: 130px; } }

/* ---------- Возвраты: карточки, блоки в заказе, график ---------- */
.ret-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 12px 18px; border: 1px solid #f3c6cc; border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.ret-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(180deg, #e04256, #f59e0b); }
.ret-tracks { display: grid; gap: 8px; grid-template-columns: 1fr; }
.ret-lbl { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.ret-foot { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ret-block { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid #f3c6cc; border-radius: 16px; background: #fff7f8; }
.ret-block-head { font-size: 13.5px; font-weight: 700; color: #a12b3d; }
.ret-mini { display: flex; flex-direction: column; gap: 5px; padding: 8px 10px; border: 1px solid #f6d7db; border-radius: 12px; background: #fff; }
.ret-mini-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; }
.ret-mini-items { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.ret-block code, .ret-note code { font: 700 12.5px ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; word-break: break-all; }
.ret-note { margin-top: 4px; padding: 4px 8px; border-radius: 8px; background: #fff0f2; color: #a12b3d; font-size: 12.5px; text-align: left; }
.oc-iback { font-size: 12px; font-weight: 800; color: var(--red); white-space: nowrap; }
.chart .bar-ret { fill: #e04256; }
.lg-ret { background: #e04256; }

/* ---------- Фото: товары, остаток, вложения поставщиков, галерея ---------- */
.pend.gone { display: none; }
.pl-row.has-photo { align-items: center; }
.pl-photo { position: relative; flex: none; width: 56px; height: 56px; padding: 0; border: 1px solid #e3e8f6; border-radius: 14px; overflow: hidden; background: #eef1f9; cursor: zoom-in; -webkit-tap-highlight-color: transparent; }
.pl-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pl-photo-n { position: absolute; right: 3px; bottom: 3px; min-width: 18px; height: 18px; padding: 0 5px; display: flex; align-items: center; justify-content: center; border-radius: 9px; background: rgba(20, 24, 41, .78); color: #fff; font-size: 11px; font-weight: 700; }
.pl-row .pl-photo + .pl-name { flex: 1; }
.prod-cell { display: flex; align-items: center; gap: 10px; text-align: left; }
.tbl-thumb { flex: none; width: 40px; height: 40px; padding: 0; border: 1px solid #e3e8f6; border-radius: 10px; overflow: hidden; background: #eef1f9; cursor: zoom-in; }
.tbl-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sf-block { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px dashed #c9d3f5; border-radius: 14px; background: #f8f9ff; }
.sf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sf-item { position: relative; display: inline-block; }
.sf-item .pend-x { top: -6px; right: -6px; width: 22px; height: 22px; }
.gal { display: flex; flex-direction: column; gap: 10px; }
.gal-main { position: relative; display: flex; align-items: center; justify-content: center; min-height: 200px; border-radius: 16px; overflow: hidden; background: #0f1424; }
.gal-img { display: block; max-width: 100%; max-height: 62vh; object-fit: contain; }
.gal-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #141829; font-size: 28px; line-height: 1; cursor: pointer; box-shadow: 0 6px 16px rgba(0, 0, 0, .3); }
.gal-nav.prev { left: 8px; }
.gal-nav.next { right: 8px; }
.gal-count { text-align: center; }
.gal-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.gal-th { flex: none; width: 56px; height: 56px; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: #eef1f9; cursor: pointer; opacity: .7; }
.gal-th.active { border-color: var(--primary); opacity: 1; }
.gal-th img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gal.single .gal-nav, .gal.single .gal-strip, .gal.single .gal-count { display: none; }

/* ---------- «Я продаю по» в заказе: цена из настроек + возможность поменять ---------- */
.my-price { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px; padding: 8px 10px; border: 1px solid #dbe3fb; border-radius: 14px; background: #f5f8ff; }
.my-price .mini-field { font-weight: 700; color: #2b3563; }
.my-price .mini-field input { width: 120px; padding: 8px 10px; border: 1.5px solid #b9c6ff; border-radius: 10px; background: #fff; font-size: 16px; font-weight: 700; color: var(--text); text-align: right; }
.my-price .mini-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(67, 97, 238, .12); }
.my-hint { flex: 1 1 140px; color: var(--muted); line-height: 1.35; }
.my-hint.my-ok { color: var(--green); font-weight: 600; }
.my-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; flex: 1 1 100%; }
.link-btn { border: 0; background: none; padding: 4px 0; color: var(--primary); font-size: 13px; font-weight: 700; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.link-btn:disabled { opacity: .5; }


/* ---------- Мои розничные цены (Настройки продавца) ---------- */
.rp-list { display: flex; flex-direction: column; gap: 8px; }
.rp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid #e6e9f6; border-radius: 16px; background: #fff; }
.rp-info { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.rp-edit { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.rp-inc { min-height: 16px; text-align: right; }

/* ---------- Админка: «Нужно сделать» ---------- */
.todo { display: flex; flex-direction: column; gap: 8px; }
.todo-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border: 1px solid #e6e9f6; border-radius: 16px; background: #fbfcff; cursor: pointer; font-size: 15px; transition: background .15s, border-color .15s; }
.todo-item:hover, .todo-item:active { background: #eef2ff; border-color: #b9c6ff; }
.todo-item b { font-size: 17px; color: var(--primary); }
.todo-ico { font-size: 22px; line-height: 1; }
.todo-arrow { margin-left: auto; color: #9aa1b8; font-size: 22px; }

/* ---------- Видео товаров: миниатюры, просмотр, скачивание ---------- */
.pl-photo, .tbl-thumb, .gal-th, .pend { position: relative; }
.th-video { display: block; width: 100%; height: 100%; object-fit: cover; background: #0f1424; pointer-events: none; }
.play-ico { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; background: rgba(15, 20, 36, .28); text-shadow: 0 2px 6px rgba(0, 0, 0, .6); pointer-events: none; }
.pend video { display: block; width: 76px; height: 76px; border-radius: 10px; object-fit: cover; background: #0f1424; pointer-events: none; }
.pend .play-ico { inset: 0 auto auto 0; width: 76px; height: 76px; border-radius: 10px; }
.pl-media { margin-top: 2px; font-weight: 500; }
.gal-main .gal-img[hidden], .gal-main .gal-vid[hidden] { display: none !important; }
.gal-vid { display: block; width: 100%; max-height: 62vh; background: #000; }
.gal-main .gal-nav { z-index: 2; opacity: .85; }
.gal-th.vid { background: #0f1424; }
.gal-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.gal-actions .btn.ready { background: var(--grad); border-color: transparent; color: #fff; }
.gal-note { text-align: center; }

/* ---------- Настройки уведомлений и колокольчик в списке чатов ---------- */
.ch-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.np-bell::before { content: '🔔'; font-size: 20px; }
html.np-off .np-bell::before { content: '🔕'; }
.notif-box { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid #dbe3fb; border-radius: 16px; background: #f8f9ff; }
.notif-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px; }
.notif-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-txt small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.notif-status { padding: 8px 10px; border-radius: 12px; background: #fff; border: 1px solid #e6e9f6; color: #2a3050; line-height: 1.4; }
.notif-status.ok { border-color: #bfe6d7; background: #f3fbf7; color: #0b6b52; }
.notif-status.warn { border-color: #f1d9a0; background: #fff8e8; color: #7a5200; }

/* ---------- Журнал действий ---------- */
.jr-cat { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; vertical-align: 1px; background: #eef1f6; color: var(--muted); }
.jr-cat.stock { background: #e3f6ee; color: var(--green); }
.jr-cat.prices { background: #eaf0ff; color: var(--primary); }
.jr-cat.orders { background: #fdf1dc; color: var(--amber); }
.jr-cat.users { background: #f1eaff; color: #6a4cf2; }
.jr-cat.security { background: #fde8e8; color: var(--red); }
.jr-text { overflow-wrap: anywhere; }
.trk-st { flex: 1 1 100%; font-size: 12.5px; font-weight: 700; color: #2b3563; line-height: 1.3; }
.trk-link { color: var(--primary); font-weight: 700; text-decoration: none; white-space: nowrap; }
.trk-link:hover { text-decoration: underline; }
.trk-st.ok { color: var(--green); } .trk-st.bad { color: var(--red); } .trk-st.mute { color: var(--muted); font-weight: 500; }

/* ---------- Частичная оплата: блок «Оплаты» в карточке заказа ---------- */
.pay-block { display: flex; flex-direction: column; gap: 4px; padding: 9px 12px; border: 1px solid #dbe3fb; border-radius: 14px; background: #f5f8ff; }
.pay-head { font-size: 13px; font-weight: 700; color: #2b3563; }
.pay-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; }
.pay-row.rejected span { text-decoration: line-through; color: var(--muted); }
.pay-block .oc-total { font-size: 14.5px; padding-top: 0; border-top: 0; }

/* ---------- «В пути» от поставщиков ---------- */
.inc-line { margin-top: 2px; font-size: 12.5px; font-weight: 600; color: #0f6b8f; }
.inc-line.late { color: var(--amber); }

/* ---------- Ручной порядок товаров ---------- */
.ord-list { display: flex; flex-direction: column; gap: 5px; max-height: 58vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ord-row { display: flex; align-items: center; gap: 4px; padding: 5px 6px 5px 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.ord-row.hot { border-color: var(--primary); background: #f5f8ff; }
.ord-n { width: 52px; flex: none; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 2px; font-size: 15px; }
.ord-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; font-size: 14.5px; padding: 0 4px; }

/* ---------- Накладная продавца (окно выбора, предпросмотр и печать) ---------- */
.inv-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.inv-pick { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1.5px solid #e3e8f6; border-radius: 14px; background: #fff; cursor: pointer; }
.inv-pick.on { border-color: var(--primary); background: #f5f8ff; }
.inv-pick input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--primary); }
.inv-pick-main { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.inv-preview { max-height: 46vh; overflow: auto; border: 1px dashed #c9d3f5; border-radius: 16px; padding: 12px; background: #f8f9ff; -webkit-overflow-scrolling: touch; }
.inv-doc { color: #141829; }
.inv-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.inv-top h1 { font-size: 20px; }
.inv-sub { font-size: 12.5px; color: #6f7790; }
.inv-card { background: #fff; border: 1px solid #dfe4f6; border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; break-inside: avoid; }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.inv-head b { font-size: 16px; }
.inv-track { font-size: 12px; color: #6f7790; text-align: right; }
.inv-track b { font-size: 14px; color: #141829; font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.inv-meta { font-size: 13.5px; margin-bottom: 6px; overflow-wrap: anywhere; }
.inv-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.inv-tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: #6f7790; padding: 6px 6px; border-bottom: 1px solid #dfe4f6; }
.inv-tbl td { padding: 6px; border-bottom: 1px solid #eef0f8; vertical-align: top; overflow-wrap: anywhere; }
.inv-tbl .num { text-align: right; white-space: nowrap; }
.inv-tbl tfoot td { border-bottom: 0; border-top: 2px solid #dfe4f6; font-size: 15px; }
.inv-warn { margin-top: 8px; padding: 7px 10px; border-radius: 10px; background: #fff6e0; font-size: 13px; }
.inv-grand { text-align: right; font-size: 16px; padding: 4px 4px 0; }
@media print {
  #print-root .inv-doc { font-size: 13px; color: #000; }
  #print-root .inv-top h1 { font-size: 20px; }
  #print-root .inv-card { border: 1px solid #000; border-radius: 0; padding: 8px 10px; margin: 0 0 10px; box-shadow: none; }
  #print-root .inv-tbl td, #print-root .inv-tbl th { border: 0; border-bottom: 1px solid #999; padding: 3px 6px; }
  #print-root .inv-tbl tfoot td { border-top: 2px solid #000; }
  #print-root .inv-noprint { display: none !important; }
}

/* ---------- Движение товара и справка «Кто что видит» ---------- */
.mv-in { color: var(--green); font-weight: 700; }
.mv-out { color: var(--red); font-weight: 700; }
.access-help summary { cursor: pointer; list-style: none; }
.access-help summary::-webkit-details-marker { display: none; }
.access-help[open] summary { margin-bottom: 10px; }
.access-help .tbl td { vertical-align: top; }
.access-help p { margin: 0; }

/* Печать: упаковочный лист и накладная */
#print-root { display: none; }
@media print {
  html.printing, html.printing body { height: auto !important; overflow: visible !important; position: static !important; background: #fff !important; }
  html.printing #app, html.printing .modal-overlay, html.printing .toasts { display: none !important; }
  html.printing #print-root { display: block; font: 14px/1.4 Arial, sans-serif; color: #000; }
  #print-root h1 { font-size: 18px; margin: 0 0 8px; }
  .pr-order { break-inside: avoid; border: 1px solid #000; padding: 6px 9px; margin: 0 0 9px; }
  .pr-head { display: flex; justify-content: space-between; gap: 10px; }
  #print-root table { width: 100%; border-collapse: collapse; margin-top: 5px; }
  #print-root td { border: 1px solid #666; padding: 2px 6px; }
  .pr-sum { text-align: right; margin-top: 3px; }
}
