/* Новая CRM Лаврозы. Цвета и шрифты — из loverosa/tokens.css (источник — design/). */
:root { --side: 216px; --tab-h: 62px; }
html, body, #app { height: 100%; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body { overflow: hidden; font-size: 14px; line-height: 1.5; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
.title { font: 600 24px/1.2 var(--sans); letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wrap-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 28px 8px; text-align: center; font: italic 400 20px/1.3 var(--serif); color: var(--muted); }
svg { width: 18px; height: 18px; }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; }
.side { background: var(--graphite); color: #fff; display: flex; flex-direction: column; padding: 22px 14px 16px; gap: 4px; overflow-y: auto; }
.side .brand { height: 15px; color: #fff; --brand-amp: var(--accent-lit); margin: 0 8px 24px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 12px; background: transparent; color: rgba(255,255,255,.72); font-size: 14px; font-weight: 500; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.nav-item .badge { margin-left: auto; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-lit); color: var(--graphite); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.side .me { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid rgba(255,255,255,.1); display: grid; gap: 2px; }
.side .me b { font-size: 14px; }
.side .me span { font-size: 12px; color: rgba(255,255,255,.55); }
.side .me button { margin-top: 10px; justify-self: start; border: 0; background: transparent; color: rgba(255,255,255,.75); padding: 0; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.side .demo-tag { margin: 12px 12px 0; font-size: 11px; color: var(--accent-lit); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
main { min-width: 0; min-height: 0; height: 100%; overflow: hidden; display: flex; flex-direction: column; }
.page { flex: 1; overflow-y: auto; padding: 28px 32px 48px; display: grid; gap: 22px; align-content: start; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tabbar { display: none; }

/* ---------- элементы ---------- */
.btn { min-height: 40px; padding: 0 18px; font-size: 12px; }
.btn-sm { min-height: 32px; padding: 0 14px; font-size: 11px; }
.btn-soft { background: var(--surface); color: var(--graphite); }
.btn-soft:hover { background: var(--line); }
.btn-pink { background: var(--accent); color: var(--graphite); }
.btn-pink:hover { background: #ead0c8; }
.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-bg); }
.btn-danger:hover { background: var(--danger-bg); }
.link { border: 0; background: none; padding: 0; color: var(--accent-deep); font-weight: 600; font-size: 13px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { height: 34px; padding: 0 14px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--surface); color: var(--soft); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.chip.ok { background: #e6efe8; color: var(--ok); }
.chip.warn { background: var(--warning-bg); color: var(--warning); }
.chip.bad { background: var(--danger-bg); color: var(--danger); }
.chip.pink { background: var(--accent); color: var(--accent-deep); }
.chip.dark { background: var(--graphite); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.dot.vk { background: var(--vk); } .dot.tg { background: var(--telegram); } .dot.max { background: var(--max); }
.dot.site { background: var(--accent-deep); } .dot.phone, .dot.shop { background: var(--muted); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--accent-deep); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; position: relative; }
.avatar .dot { position: absolute; right: 0; bottom: 1px; box-shadow: 0 0 0 2px var(--paper); }
.chb { position: absolute; right: -4px; bottom: -3px; width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; color: #fff; box-shadow: 0 0 0 2px var(--paper); }
.chb svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chb.vk { background: var(--vk); } .chb.tg { background: var(--telegram); } .chb.max { background: linear-gradient(135deg, #4c8dff, var(--max) 55%, #b146ff); }
.chb.site { background: var(--accent-deep); } .chb.phone { background: var(--muted); }
.rd { margin-left: 2px; letter-spacing: -2px; color: var(--muted); }
.rd.yes { color: var(--vk); }
.clip.gift { color: var(--accent-deep); border: 0; background: none; }
.quick .q-bonus { background: var(--accent); color: var(--accent-deep); box-shadow: none; font-weight: 600; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-panel); }
.section { display: grid; gap: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-head h2 { font-size: 15px; }
.input, .select, .textarea { width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-field); background: var(--paper); font-size: 14px; outline: 0; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--graphite); }
.textarea { resize: vertical; min-height: 64px; line-height: 1.45; }
.field > span { font-size: 10.5px; letter-spacing: .12em; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; color: var(--soft); }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.search .input { padding-left: 38px; border-radius: 999px; }

/* ---------- списки ---------- */
.list { display: grid; }
.item { display: flex; gap: 12px; align-items: center; padding: 11px 12px; border: 0; border-radius: 14px; background: transparent; text-align: left; width: 100%; min-width: 0; }
.item:hover { background: var(--surface); }
.item[aria-current="true"] { background: var(--accent); }
.item.unread .name { font-weight: 700; }
.item.unread .preview { color: var(--ink); }
.item .name { font-weight: 600; }
.item .preview { color: var(--soft); font-size: 13px; }
.item .meta { display: grid; justify-items: end; gap: 4px; flex: none; font-size: 12px; color: var(--muted); }
.wait-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-deep); }

/* ---------- сегодня ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { padding: 16px 18px; display: grid; gap: 2px; border: 0; text-align: left; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-panel); }
button.kpi:hover { box-shadow: inset 0 0 0 1px var(--graphite); }
.kpi b { font: 600 30px/1.1 var(--sans); font-variant-numeric: tabular-nums; }
.kpi span { color: var(--soft); font-size: 13px; }
.kpi.hot { background: var(--accent); box-shadow: none; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }

/* ---------- заказ в списке ---------- */
.order { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: start; padding: 12px; border: 0; border-radius: 14px; background: transparent; text-align: left; width: 100%; }
.order:hover { background: var(--surface); }
.order .time { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
.order .time small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.order .what { font-size: 13px; color: var(--soft); }
.day-head { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 4px; }

/* ---------- задачи ---------- */
.task { padding: 14px 16px; display: grid; gap: 10px; }
.task .t-head { display: flex; gap: 10px; align-items: center; }
.task .t-title { font-size: 13px; color: var(--soft); }
.task .textarea { font-size: 13.5px; min-height: 76px; background: var(--bg); }
.task .t-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.task.compact .textarea { display: none; }

/* ---------- чаты ---------- */
.chats { display: grid; grid-template-columns: 320px minmax(0, 1fr) 360px; grid-template-rows: minmax(0, 1fr); height: 100%; }
.chats > * { min-width: 0; min-height: 0; }
.chat-list { border-right: 1px solid var(--line); min-height: 0; display: flex; flex-direction: column; background: var(--paper); }
.chat-list .top { padding: 18px 14px 10px; display: grid; gap: 10px; }
.chat-list .list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 6px 16px; align-content: start; }
.conv { display: flex; flex-direction: column; background: var(--bg); min-height: 0; height: 100%; }
.conv-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--paper); min-height: 64px; }
.conv-head .back, .conv-head .deal-btn { display: none; }
.conv-head .sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msgs { flex: 1; overflow-y: auto; padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: min(76%, 520px); padding: 9px 13px; border-radius: 16px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); white-space: pre-wrap; word-wrap: break-word; font-size: 14px; }
.msg.out { align-self: flex-end; background: var(--graphite); color: #fff; box-shadow: none; }
.msg.sending { opacity: .55; }
.msg .m-meta { display: block; font-size: 11px; opacity: .6; margin-top: 3px; text-align: right; }
.sys { align-self: center; font-size: 11.5px; color: var(--muted); padding: 2px 10px; }
.composer { padding: 8px 12px 12px; display: grid; gap: 8px; background: var(--bg); }
.composer .quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.composer .quick::-webkit-scrollbar { display: none; }
.composer .quick button { flex: none; border: 0; border-radius: 999px; background: var(--surface); color: var(--soft); font-size: 12px; font-weight: 600; padding: 6px 11px; }
.composer .quick button:hover { background: var(--accent); color: var(--accent-deep); }
.composer form { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; border-radius: 22px; padding: 11px 16px; }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--graphite); color: #fff; display: grid; place-items: center; flex: none; }
.side-deal { border-left: 1px solid var(--line); background: var(--paper); overflow-y: auto; }

/* ---------- карточка обращения (панель) ---------- */
.deal { padding: 18px 18px 28px; display: grid; gap: 16px; align-content: start; }
.deal-top { display: grid; gap: 6px; }
.deal-top .row { justify-content: space-between; }
.deal-top h3 { font-size: 17px; }
.steps { display: flex; gap: 4px; flex-wrap: wrap; }
.step { border: 0; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 600; background: var(--surface); color: var(--soft); }
.step.done { background: #ebe6e0; color: var(--soft); }
.step[aria-current="step"] { background: var(--graphite); color: #fff; }
.step.lost[aria-current="step"] { background: var(--danger); }
.step:hover:not([aria-current="step"]) { box-shadow: inset 0 0 0 1px var(--graphite); }
.form { display: grid; gap: 12px; }
.form .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form .pair > * { min-width: 0; }
.deal .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.need { font-size: 12.5px; color: var(--warning); background: var(--warning-bg); padding: 8px 12px; border-radius: 12px; }
.mark { display: grid; gap: 6px; padding: 12px; border-radius: 14px; background: var(--bg); }
.mark .row { justify-content: space-between; flex-wrap: wrap; }
.mark > span { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.hist { display: grid; gap: 4px; font-size: 12.5px; color: var(--soft); }
.hist div { display: grid; grid-template-columns: 82px 1fr; gap: 8px; }
.hist time { color: var(--muted); font-variant-numeric: tabular-nums; }
details > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--soft); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: " ▾"; color: var(--muted); }

/* ---------- воронка ---------- */
.board-wrap { flex: 1; overflow: auto; padding: 0 32px 24px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; min-height: 100%; align-items: start; }
.col { background: var(--surface); border-radius: var(--r-panel); padding: 10px; display: grid; gap: 8px; align-content: start; min-height: 240px; transition: box-shadow .15s; }
.col.over { box-shadow: inset 0 0 0 2px var(--accent-deep); background: var(--accent); }
.col-head { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px 6px; }
.col-head b { font-size: 13px; }
.col-head span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col.lost-col { background: transparent; box-shadow: inset 0 0 0 1px dashed var(--line); border: 1px dashed var(--line); }
.card { background: var(--paper); border-radius: 14px; padding: 12px; display: grid; gap: 7px; box-shadow: 0 1px 0 var(--line); border: 0; text-align: left; width: 100%; cursor: grab; }
.card:hover { box-shadow: 0 0 0 1px var(--graphite); }
.card.dragging { opacity: .4; }
.card .c-what { font-size: 12.5px; color: var(--soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .c-foot { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); gap: 6px; }
.card.waiting { box-shadow: inset 3px 0 0 var(--accent-deep), 0 1px 0 var(--line); }
.card .next { justify-self: start; }
.board-mobile { display: none; }

/* ---------- клиенты ---------- */
.clients-table .item { display: grid; grid-template-columns: 40px minmax(0, 1fr) 90px 100px 100px; }
.client-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.client-head .avatar { width: 64px; height: 64px; font-size: 22px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.fact { padding: 12px 14px; border-radius: 14px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 2px; }
.fact b { font-size: 18px; font-variant-numeric: tabular-nums; }
.fact span { font-size: 12px; color: var(--muted); }
.occ { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table td, .mini-table th { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.mini-table th { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.mini-table td.r, .mini-table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }

/* ---------- итоги ---------- */
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 150px 1fr 36px; gap: 10px; align-items: center; font-size: 13px; }
.bar i { display: block; height: 10px; border-radius: 999px; background: var(--accent-deep); min-width: 4px; }
.bar em { font-style: normal; text-align: right; font-variant-numeric: tabular-nums; color: var(--soft); }

/* ---------- вход ---------- */
.login { height: 100%; overflow-y: auto; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.login-box { width: min(340px, 100%); display: grid; gap: 22px; justify-items: center; text-align: center; }
.login-box .brand { height: 74px; color: var(--graphite); }
.pin-dots { display: flex; gap: 14px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--graphite); }
.pin-dots i.on { background: var(--graphite); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px 18px; }
.keypad button { width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); font: 500 26px/1 var(--sans); color: var(--ink); }
.keypad button:active { background: var(--accent); }
.keypad button.ghost { background: transparent; box-shadow: none; font-size: 14px; color: var(--soft); }
.login-msg { min-height: 20px; font-size: 13px; color: var(--danger); }
.pending { display: grid; gap: 12px; padding: 18px; border-radius: var(--r-panel); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); text-align: left; }
.demo-hint { font-size: 12px; color: var(--muted); }

/* ---------- окна ---------- */
#modal { position: fixed; inset: 0; z-index: 50; background: rgba(29,29,31,.38); display: grid; place-items: center; padding: 20px; }
.sheet { background: var(--bg); border-radius: 22px; width: min(560px, 100%); max-height: 100%; overflow-y: auto; display: grid; align-content: start; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.sheet.wide { width: min(1080px, 100%); height: min(780px, 100%); overflow: hidden; grid-template-rows: auto 1fr; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 1; }
.sheet-head h2 { font-size: 16px; }
.sheet-body { padding: 18px 20px 22px; display: grid; gap: 14px; }
.deal-modal { display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; }
.deal-modal .conv { border-right: 1px solid var(--line); }
.deal-modal .side-deal { border-left: 0; }
.deal-tabs { display: none; }
.deal-modal .conv-head { display: none; }
.x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface); display: grid; place-items: center; color: var(--graphite); flex: none; }
.x:hover { background: var(--line); }
.more-list { display: grid; gap: 4px; padding: 10px; }
.more-list button { display: flex; justify-content: space-between; padding: 14px 14px; border: 0; border-radius: 12px; background: var(--paper); font-size: 15px; font-weight: 600; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 60; background: var(--graphite); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 13px; font-weight: 600; transition: all .25s var(--ease); pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
#toast.on { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--danger); }

/* ---------- средние экраны ---------- */
@media (max-width: 1240px) {
  .chats { grid-template-columns: 300px minmax(0, 1fr); }
  .chats > .side-deal { display: none; }
  .conv-head .deal-btn { display: inline-flex; }
}
/* левое меню узкое (значки), при наведении мыши раскрывается поверх (пожелание владельца 21.10.2026) */
@media (min-width: 761px) {
  :root { --side: 72px; }
  .side { width: 72px; position: relative; z-index: 50; transition: width .15s ease, box-shadow .15s ease; }
  .side:hover { width: 216px; box-shadow: 10px 0 30px rgba(0,0,0,.22); }
  .side:not(:hover) { padding: 18px 10px; align-items: center; }
  .side:not(:hover) .brand { width: 34px; height: 34px; margin: 0 0 18px; -webkit-mask-image: url("loverosa/mark.svg"); mask-image: url("loverosa/mark.svg"); aspect-ratio: auto; --amp-size: 0 0; background: var(--accent-lit); }
  .side:not(:hover) .nav-item { justify-content: center; padding: 12px; position: relative; }
  .side:not(:hover) .nav-item .label, .side:not(:hover) .me span, .side:not(:hover) .demo-tag { display: none; }
  .side:not(:hover) .nav-item .badge { position: absolute; top: 2px; right: 0; margin: 0; }
  .side:not(:hover) .me { padding: 12px 0 0; justify-items: center; text-align: center; }
  .side:not(:hover) .me b { font-size: 11px; }
  .side .nav-item, .side .me b { white-space: nowrap; }
}
@media (max-width: 1000px) {
  .two { grid-template-columns: 1fr; }
  .deal-modal { grid-template-columns: minmax(0, 1fr) 340px; }
}

/* ---------- телефон ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .side { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--paper); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .tabbar button { border: 0; background: transparent; display: grid; justify-items: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 4px 0; position: relative; }
  .tabbar button[aria-current="page"] { color: var(--ink); }
  .tabbar .badge { position: absolute; top: -2px; left: 54%; height: 17px; min-width: 17px; font-size: 10px; }
  .tabbar svg { width: 22px; height: 22px; }
  .page { padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 28px; gap: 18px; }
  .title { font-size: 22px; }
  .chats { grid-template-columns: 1fr; }
  .chats.open .chat-list { display: none; }
  .chats:not(.open) .conv { display: none; }
  .chat-list { border-right: 0; }
  .chat-list .top { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
  .conv-head { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .conv-head .back { display: inline-grid; }
  .msg { max-width: 86%; }
  .board-wrap { display: none; }
  .board-mobile { display: grid; gap: 10px; padding: 0 16px 24px; overflow-y: auto; align-content: start; flex: 1; }
  .board-top { padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 10px !important; }
  .clients-table .item { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .clients-table .item .hide-m { display: none; }
  .order { grid-template-columns: 54px 1fr; }
  .order > :last-child { grid-column: 2; }
  #modal { padding: 0; place-items: end stretch; }
  .sheet { border-radius: 22px 22px 0 0; max-height: 94%; width: 100%; }
  .sheet.wide { height: 100%; max-height: 100%; border-radius: 0; }
  .sheet.wide .sheet-head { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .deal-modal { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .deal-tabs { display: flex; padding: 8px 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
  .deal-modal[data-tab="deal"] > .conv, .deal-modal[data-tab="chat"] > .side-deal { display: none; }
  .deal-modal .conv { border-right: 0; }
  .bar { grid-template-columns: 110px 1fr 30px; }
  .form .pair { grid-template-columns: 1fr; }
  .keypad { grid-template-columns: repeat(3, 68px); }
  .keypad button { width: 68px; height: 68px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- дубль ---------- */
.msg.training { background: transparent; color: var(--soft); box-shadow: inset 0 0 0 1px dashed var(--line); border: 1px dashed var(--muted); }
.training-note { font-size: 12px; color: var(--warning); background: var(--warning-bg); padding: 7px 12px; border-radius: 12px; }
.invite-box { flex-basis: 100%; display: grid; gap: 8px; padding: 12px; margin-top: 6px; border-radius: 12px; background: var(--accent); }
.invite-box code { font-size: 12px; word-break: break-all; background: var(--paper); padding: 8px 10px; border-radius: 8px; user-select: all; }

/* ---------- переписка: дата при прокрутке, фото, правка ---------- */
.msgs .sys.day { position: sticky; top: 6px; z-index: 2; align-self: center; background: var(--paper); color: var(--soft); font-weight: 600;
  padding: 4px 12px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.08); margin: 6px 0; }
.msg { white-space: normal; }
.msg .m-text { white-space: pre-wrap; }
.msg.mine { cursor: pointer; }
.msg.deleted { font-style: italic; opacity: .6; }
.msg.deleted.by-client { font-style: normal; opacity: .75; }   /* клиент удалил у себя: текст виден, зачёркнут */
.msg.by-client .m-text { text-decoration: line-through; color: var(--muted); }
.msg.by-client .gallery { opacity: .5; }
.msg .del-mark { color: var(--danger, #b3261e); font-weight: 600; }
.msg.media { padding: 4px; background: transparent; box-shadow: none; }
.msg.out.media { background: transparent; }
.msg.out.media .m-meta { color: var(--muted); padding-right: 6px; }
.gallery { display: grid; gap: 3px; border-radius: 12px; overflow: hidden; margin-bottom: 4px; max-width: 280px; }
.gallery.n2, .gallery.n3, .gallery.n4 { grid-template-columns: 1fr 1fr; }
.ph { display: block; padding: 0; border: 0; background: var(--surface); cursor: zoom-in; }
.ph img { display: block; width: 100%; max-height: 320px; object-fit: cover; }
.gallery.n2 .ph img, .gallery.n3 .ph img, .gallery.n4 .ph img { height: 130px; }
.ph.sticker { background: transparent; } .ph.sticker img { width: 120px; object-fit: contain; }
.att { display: inline-block; margin: 2px 0 4px; text-decoration: underline; text-underline-offset: 3px; }
.msg audio { max-width: 240px; height: 36px; margin: 2px 0 4px; }
.msg-menu { align-self: flex-end; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; font-size: 13px; margin: -2px 0 6px; }
.msg-menu button { border: 0; border-radius: 999px; padding: 7px 13px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; font-size: 13px; }
.msg-menu button.danger { color: var(--danger); }
.edit-bar { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 7px 12px; border-radius: 12px; background: var(--accent); color: var(--accent-deep); font-weight: 600; }
.edit-bar button { border: 0; background: none; color: var(--graphite); font-weight: 600; text-decoration: underline; }
.pending-ph { display: flex; gap: 8px; overflow-x: auto; }
.pending-ph span { position: relative; flex: none; }
.pending-ph img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; display: block; }
.pending-ph span.loading img { opacity: .4; }
.pending-ph button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--graphite); color: #fff; font-size: 14px; line-height: 1; }
.clip { width: 44px; height: 44px; display: grid; place-items: center; flex: none; border-radius: 50%; color: var(--soft); cursor: pointer; }
.clip:hover { background: var(--surface); }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: 16px; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer .x { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; }
@media (max-width: 760px) {
  .input, .select, .textarea, .composer textarea { font-size: 16px; }
}

/* фото профиля */
.avatar { overflow: visible; }
.avatar .ava-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar i { font-style: normal; }

/* карточка клиента и фильтры */
.client-head > .grow { flex: 1 1 220px; min-width: 0; }
.client-head > .row { flex-wrap: wrap; }
a.chip { text-decoration: none; }
.cf { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; align-items: center; }
.cf .select { min-height: 38px; padding: 7px 10px; font-size: 13px; }
@media (max-width: 760px) {
  .client-head .title { font-size: 22px; }
  .client-head > .row { flex-basis: 100%; }
  .client-head > .row .btn { flex: 1 1 0; }
  .cf { grid-template-columns: 1fr 1fr; }
  .cf .select { font-size: 16px; }
}

.pills { min-height: 36px; flex: none; }

/* уведомления */
.push-banner { display: grid; gap: 6px; padding: 14px 16px; border-radius: var(--r-panel); background: var(--accent); }
.push-banner b { font-size: 15px; } .push-banner span { font-size: 13.5px; color: var(--soft); }
.push-banner .btn { justify-self: start; margin-top: 4px; }

/* простой режим: только чаты */
.chats.simple { grid-template-columns: 340px minmax(0, 1fr); }
.chat-list .push-banner { margin-top: 2px; }
@media (max-width: 1240px) { .chats.simple { grid-template-columns: 300px minmax(0, 1fr); } }
@media (max-width: 760px) { .chats.simple { grid-template-columns: 1fr; } }

/* подсказки ответа */
.composer .quick .ai-btn { background: var(--accent); color: var(--accent-deep); }
.ai-panel { display: grid; gap: 6px; padding: 6px 6px 8px 12px; border-radius: 16px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.ai-panel.err { background: var(--danger-bg); color: var(--danger); font-size: 13px; }
.ai-head { display: flex; align-items: center; gap: 10px; font-size: 13px; min-height: 32px; }
.ai-head .grow { min-width: 0; }
.ai-x { width: 32px; height: 32px; background: var(--surface); }
.ai-sum { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 6px; }
.ai-list { display: grid; gap: 6px; max-height: min(38vh, 320px); overflow-y: auto; padding-right: 6px; }
.ai-var { display: grid; gap: 2px; text-align: left; padding: 8px 10px; border: 0; border-radius: 12px; background: var(--surface); font-size: 14px; line-height: 1.4; }
.ai-var:hover { background: var(--accent); }
.ai-var span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ai-var b { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-deep); }

/* облако по размеру текста, как в мессенджерах */
.msgs .msg { width: fit-content; max-width: min(64%, 460px); align-self: flex-start; }
.msgs .msg.out { align-self: flex-end; }
.msgs .msg .m-meta { text-align: right; white-space: nowrap; }
@media (max-width: 760px) { .msgs .msg { max-width: 82%; } }

/* четыре области: меню · чаты · переписка · карточка клиента (режим «Только чаты») */
.chats.simple { grid-template-columns: 320px minmax(0, 1fr) 320px; }
.side-card { border-left: 1px solid var(--line); background: var(--paper); overflow-y: auto; }
.client-side { display: grid; gap: 14px; padding: 16px; align-content: start; }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head .card-close { display: none; }
.card-sec { display: grid; gap: 6px; }
.card-sec h3 { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); font-weight: 600; }
.pf-badge { padding: 8px 12px; border-radius: 12px; background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--soft); }
.pf-badge.ok { background: var(--accent); color: var(--accent-deep); }
.facts.small { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.facts.small .fact { padding: 10px; } .facts.small .fact b { font-size: 15px; }
.buy { display: flex; gap: 8px; font-size: 13px; align-items: baseline; }
.buy .grow { min-width: 0; }
.pf-row { display: grid; gap: 6px; padding: 10px; border-radius: 12px; background: var(--surface); font-size: 14px; }
.client-side .textarea { min-height: 70px; }
@media (max-width: 1240px) {
  .chats.simple { grid-template-columns: 300px minmax(0, 1fr); }
  .chats.simple > .side-card { display: none; }
  .chats.simple.card-on > .side-card { display: block; position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 100vw); z-index: 40; box-shadow: -12px 0 40px rgba(0,0,0,.15); }
  .card-head .card-close { display: inline-grid; }
}
@media (max-width: 760px) { .chats.simple { grid-template-columns: 1fr; } }
.client-side { grid-template-columns: minmax(0, 1fr); }
.client-side > *, .facts.small .fact { min-width: 0; }
.facts.small .fact b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chats.simple .chat-list .pills { flex-wrap: wrap; overflow: visible; }
.buy { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
.buy .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg.lvl { display: grid; grid-template-columns: repeat(3, 1fr); }
.seg.lvl button { font-size: 12.5px; padding: 8px 4px; }
.seg.lvl button[disabled] { cursor: default; }
.anketa { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.anketa .ok { color: var(--ink); }
.pf-new { padding: 12px; border-radius: 14px; background: var(--surface); }
.pf-new .seg label { display: inline-flex; gap: 6px; align-items: center; padding: 8px 10px; font-size: 14px; }

/* цитата: ответ на сообщение или пересланное */
.quote { display: grid; gap: 3px; margin: 0 0 6px; padding: 6px 10px; border-left: 3px solid var(--accent-deep); border-radius: 4px 10px 10px 4px; background: rgba(0,0,0,.04); font-size: 13px; line-height: 1.35; min-width: 0; }
.msg.out .quote { background: rgba(255,255,255,.12); border-left-color: rgba(255,255,255,.6); }
.quote.client { border-left-color: var(--accent-deep); }
.quote[data-act="jump"] { cursor: pointer; }
.quote .q-head { font-size: 11.5px; font-weight: 600; opacity: .75; }
.quote .q-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.quote .q-imgs { display: flex; gap: 4px; }
.quote .q-imgs img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.q-fwd { display: block; font-size: 11.5px; font-weight: 600; opacity: .7; margin-bottom: 4px; }
.msg-menu.in { align-self: flex-start; justify-content: flex-start; }
.ref-bar span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.msg.flash { box-shadow: 0 0 0 3px var(--accent-deep); transition: box-shadow .3s; }
@media (max-width: 760px) {
  .shell.in-chat .tabbar { display: none; }
  .shell.in-chat .composer { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 760px) {
  .kb-open .shell.in-chat .composer { padding-bottom: 8px; }
}

/* ---------- клиент уже в бонусной системе: золотой кружок у аватарки в списке, тёмная плашка в чате ---------- */
.item.in-bonus .avatar { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px #c8a24a; }
.conv.in-bonus .conv-head { background: var(--graphite); border-bottom-color: var(--graphite); color: #fff; }
.conv.in-bonus .conv-head .link { color: #fff !important; }
.conv.in-bonus .conv-head .sub { color: rgba(255,255,255,.68); }
.conv.in-bonus .conv-head .back { color: #fff; background: rgba(255,255,255,.12); }
.conv.in-bonus .conv-head .deal-btn { background: #fff; color: var(--graphite); }
.bonus-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding: 0 16px 10px; background: var(--graphite); color: #fff; font-size: 12.5px; flex: none; }
.bonus-bar svg { width: 15px; height: 15px; flex: none; color: var(--accent-lit); }
.bonus-bar span { color: rgba(255,255,255,.68); }
.card-sec.in-bonus { background: var(--accent); border-radius: 12px; padding: 10px 12px; margin: 0 -4px; }

/* ---------- вкладки мессенджеров одного клиента ---------- */
.ch-tabs { display: flex; gap: 4px; padding: 6px 12px 0; background: var(--paper); border-bottom: 1px solid var(--line); flex: none; overflow-x: auto; }
.ch-tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px 8px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--soft); font-size: 13px; white-space: nowrap; }
.ch-tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--graphite); }
.ch-tabs .chb { position: static; box-shadow: none; }

/* ---------- карточка клиента: складные разделы ---------- */
.fold-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 2px 0; border: 0; background: none; text-align: left; color: var(--ink); font-size: 13px; }
.fold-arrow { color: var(--muted); font-size: 11px; }
.occ-row { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--soft); }
.occ-row b { color: var(--ink); font-weight: 600; }
.occ-edit { display: grid; gap: 6px; }
.occ-edit .input { min-height: 36px; padding: 6px 10px; font-size: 13px; }

/* ---------- панель владельца (web/panel.js) ---------- */
.pnl-page { gap: 18px; grid-auto-rows: max-content; }   /* таблицы с прокруткой вбок не сжимаются по высоте */
.p-presets { padding-bottom: 2px; }
.p-custom { flex-wrap: wrap; }
.p-custom .input { width: 160px; }
.p-fresh .link { margin-left: 4px; font-size: 12.5px; }
.p-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.p-kpi { gap: 4px; align-content: start; }
.p-kpi b { font-size: 26px; }
.p-k { font-size: 10.5px !important; letter-spacing: .12em; text-transform: uppercase; color: var(--muted) !important; font-weight: 600; }
.p-s { font-size: 12px !important; color: var(--soft); }
.p-ds { display: grid; gap: 1px; margin-top: 2px; }
.pd { font-size: 12px; font-weight: 600; color: var(--soft); font-variant-numeric: tabular-nums; }
.pd.good { color: var(--ok); } .pd.bad { color: var(--danger); } .pd.none { color: var(--muted); font-weight: 500; }
.kpi.hot .pd.good { color: #35593f; }
.p-pad { padding: 16px; }
.p-foot { margin: 10px 0 0; font-size: 12px; }
.p-note { padding: 12px 16px; font-size: 13.5px; }
.p-note.bad { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.neg { color: var(--danger); }
.pos { color: var(--ok); }
em.good { color: var(--ok); font-style: normal; font-weight: 600; }
em.bad, .bad em, em .bad { color: var(--danger); font-style: normal; font-weight: 600; }
/* цель месяца */
.p-goal { padding: 16px 18px; display: grid; gap: 12px; }
.p-goal-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.p-goal-top > div:first-child { display: grid; gap: 2px; }
.p-goal-top b { font-size: 22px; font-variant-numeric: tabular-nums; }
.p-progress { position: relative; height: 10px; border-radius: 999px; background: var(--surface); }
.p-progress i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--accent-deep); }
.p-progress s { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--graphite); border-radius: 2px; }
.p-goal-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13.5px; color: var(--soft); }
.p-goal-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
/* график выручки: столбики — HTML, подписи не растягиваются */
.p-chart-wrap { padding: 16px 16px 10px; }
.p-chart { display: grid; grid-template-columns: 52px minmax(0, 1fr); height: 220px; }
.p-axis { position: relative; border-right: 1px solid var(--line); margin-bottom: 22px; }
.p-axis span { position: absolute; right: 8px; transform: translateY(50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.p-bars { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; align-items: end; padding-left: 4px;
  background: linear-gradient(var(--line), var(--line)) 0 calc((100% - 22px) / 2) / 100% 1px no-repeat; }
.p-col { height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) 22px; cursor: default; outline: 0; }
.p-col i { align-self: end; display: block; max-width: 28px; width: 100%; justify-self: center; background: var(--graphite); border-radius: 4px 4px 0 0; transition: background .15s; }
.p-col.now i { background: repeating-linear-gradient(135deg, var(--graphite-2) 0 3px, var(--soft) 3px 6px); }
.p-col:hover i, .p-col:focus i { background: var(--accent-deep); }
.p-col span { font-size: 10.5px; color: var(--muted); text-align: center; padding-top: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.p-tip { position: fixed; z-index: 300; pointer-events: none; background: var(--graphite); color: #fff; padding: 8px 11px; border-radius: 10px; font-size: 12.5px; display: grid; gap: 1px; box-shadow: 0 6px 20px rgba(0,0,0,.18); max-width: 240px; }
.p-tip b { font-weight: 600; }
.p-tip span { color: rgba(255,255,255,.8); font-variant-numeric: tabular-nums; }
/* клиенты */
.p-clients { display: grid; gap: 4px; }
.p-cl { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.p-cl:last-of-type { border-bottom: 0; }
.p-cl > div { display: grid; }
.p-cl .r { text-align: right; font-variant-numeric: tabular-nums; }
.p-name { max-width: 260px; }
/* часы */
.p-heat { display: grid; grid-template-columns: 26px repeat(var(--cols), minmax(22px, 1fr)); gap: 3px; min-width: 380px; max-width: 760px; }
.p-heat i { height: 22px; border-radius: 4px; background: color-mix(in srgb, var(--accent-deep) calc(var(--v) * 100%), var(--surface)); }
.p-hh, .p-hd { font-size: 10.5px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.p-hd { text-align: left; align-self: center; }
/* таблицы ОПиУ и ДДС */
.p-toolbar { flex-wrap: wrap; gap: 10px; }
.p-table-wrap { overflow-x: auto; }
.p-table { min-width: 560px; }
.p-table th:first-child, .p-table td:first-child { position: sticky; left: 0; background: var(--paper); min-width: 190px; z-index: 1; }
.p-table td.r { white-space: nowrap; }
.p-table td.plan { color: var(--muted); font-style: italic; }
.p-table tr.strong td { font-weight: 600; }
.p-table tr.final td { border-top: 2px solid var(--graphite); font-size: 14px; }
.p-table tr.pct td { color: var(--muted); font-size: 11.5px; padding-top: 0; }
.p-table tr.sub-row td:first-child { padding-left: 22px; color: var(--soft); }
.p-src { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; }
.p-now { display: block; font-style: normal; font-size: 9.5px; color: var(--accent-deep); letter-spacing: .1em; }
.p-explain p { margin: 6px 0 0; color: var(--soft); font-size: 13px; }
/* ДДС */
.p-bal { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.p-bal .kpi b { font-size: 22px; }
.p-op-date { width: 52px; flex: none; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.p-amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
.p-ops { max-height: 560px; overflow-y: auto; padding: 4px; }
.p-op .p-del { width: 28px; height: 28px; font-size: 18px; color: var(--muted); background: transparent; opacity: .5; }
.p-op:hover .p-del { opacity: 1; }
.p-acct { width: auto; min-height: 34px; padding: 4px 10px; font-size: 13px; }
.p-uns { flex-wrap: wrap; border-bottom: 1px solid var(--line); border-radius: 0; }
.p-uns-act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; width: 100%; padding-left: 64px; }
.p-uns-act .select { width: auto; min-width: 200px; flex: 1 1 200px; }
.p-check { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--soft); }
.p-form h3 { font-size: 15px; grid-column: 1 / -1; }
.p-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.p-wide, .p-dir { grid-column: 1 / -1; }
.p-dir { justify-self: start; }
.p-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.p-row .input, .p-row .select { width: auto; flex: 1 1 130px; }
.p-day { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--soft); }
.p-day .input { width: 64px; flex: none; }
@media (max-width: 760px) {
  .p-kpi b { font-size: 22px; }
  .p-kpis, .p-bal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .p-chart { height: 180px; grid-template-columns: 40px minmax(0, 1fr); }
  .p-uns-act { padding-left: 0; }
  .p-table th:first-child, .p-table td:first-child { min-width: 150px; }
  .pnl-page .page-head .seg { width: 100%; }
  .pnl-page .page-head .seg button { flex: 1; }
}

/* ---------- меню разделов группами; на телефоне — выезжает по логотипу (09.11.2026) ---------- */
.mtop, .drawer-bg, .side-close, .nav-group.m-only { display: none; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 12px; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.nav-group { display: grid; gap: 2px; }
.nav-gl { padding: 4px 12px; font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.4); white-space: nowrap; }
.nav-item.sub-item { padding: 7px 12px 7px 46px; font-size: 13px; }
@media (min-width: 761px) {
  .side:not(:hover) .nav-gl, .side:not(:hover) .sub-item { display: none; }
  .side:not(:hover) .side-scroll { gap: 4px; }
}
@media (max-width: 760px) {
  .shell { grid-template-rows: auto minmax(0, 1fr); }
  .tabbar { display: none !important; }
  .mtop { display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; background: var(--paper); border-bottom: 1px solid var(--line); min-width: 0; }
  .shell.in-chat .mtop { display: none; }
  .shell.in-chat { grid-template-rows: minmax(0, 1fr); }
  .mlogo { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 6px 6px 6px 2px; color: var(--graphite); position: relative; min-width: 0; }
  .mlogo svg { width: 22px; height: 22px; }
  .mlogo .brand { height: 13px; --brand-amp: var(--accent-deep); }
  .mlogo .badge { margin-left: 2px; }
  .side { display: flex; position: fixed; inset: 0 auto 0 0; z-index: 200; width: min(84vw, 320px);
    padding: calc(16px + env(safe-area-inset-top, 0px)) 14px calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-105%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s; box-shadow: 10px 0 30px rgba(0,0,0,.25); }
  .shell.drawer-open .side { transform: none; visibility: visible; transition: transform .22s ease; }
  .side .side-top { margin-bottom: 14px; }
  .side .brand { margin: 0 8px; }
  .side-close { display: grid; background: rgba(255,255,255,.1); color: #fff; }
  .nav-group.m-only { display: grid; }
  .nav-group.m-only:not(:has(.nav-item)) { display: none; }
  .side .nav-item { padding: 12px; font-size: 15px; }
  .side .nav-item.sub-item { padding: 9px 12px 9px 46px; font-size: 14px; }
  .drawer-bg { display: block; position: fixed; inset: 0; z-index: 190; background: rgba(20,20,22,.4); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
  .shell.drawer-open .drawer-bg { opacity: 1; pointer-events: auto; }
  .shell:not(.in-chat) .page { padding-top: 14px; }
  .shell:not(.in-chat) .chat-list .top { padding-top: 10px; }
  .shell:not(.in-chat) .board-top { padding-top: 10px !important; }
}

/* не ушедшее сообщение — повтор; плашка «пришёл с сайта» (09.11.2026) */
.msg-retry { align-self: flex-end; display: flex; gap: 8px; align-items: center; margin: -2px 0 6px; font-size: 12.5px; color: var(--danger); }
.msg-retry button { border: 0; border-radius: 999px; padding: 6px 12px; background: var(--danger-bg); color: var(--danger); font-weight: 600; font-size: 12.5px; }
.from-site { display: inline-block; margin: 0 0 6px; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-deep); font-size: 12px; font-weight: 600; text-decoration: none; }

/* обучение (09.11.2026) */
.learn .lesson-body { display: grid; gap: 10px; font-size: 15px; line-height: 1.55; max-width: 720px; }
.learn .lesson-body h3 { margin: 8px 0 0; font-size: 16px; }
.learn .lesson-body p, .learn .lesson-body ul { margin: 0; }
.learn .lesson-body ul { padding-left: 20px; display: grid; gap: 4px; }
.lesson-img { max-width: min(100%, 720px); border-radius: 14px; }
.learn-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); font-weight: 700; font-size: 13px; flex: none; }
.learn-num.ok { background: var(--accent); color: var(--accent-deep); }
.quiz-q { display: grid; gap: 6px; padding: 12px; border-radius: 14px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); max-width: 720px; }
.quiz-opt { text-align: left; padding: 10px 12px; border: 0; border-radius: 12px; background: var(--surface); font-size: 14px; }
.quiz-opt.on { box-shadow: inset 0 0 0 2px var(--graphite); }
.quiz-opt.right { background: #e3f1e5; box-shadow: inset 0 0 0 2px #3d8b4f; }
.quiz-opt.wrong { background: var(--danger-bg); box-shadow: inset 0 0 0 2px var(--danger); }
.quiz-why { font-size: 13px; }

/* права на разделы и каталог (09.11.2026) */
.sec-row { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13px; padding: 4px 0 2px; }
.sec-chk { display: inline-flex; gap: 5px; align-items: center; }
.cat-progress { display: grid; gap: 6px; max-width: 520px; }
.cat-progress .bar { height: 8px; border-radius: 99px; background: var(--surface); overflow: hidden; }
.cat-progress .bar i { display: block; height: 100%; background: var(--accent-deep); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.cat-card { display: grid; gap: 10px; padding: 12px; border-radius: 16px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); align-content: start; }
.cat-card.ok { box-shadow: inset 0 0 0 2px #3d8b4f; }
.cat-card.bad { box-shadow: inset 0 0 0 2px var(--danger); }
.cat-top { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px; align-items: start; }
.cat-img { display: block; border-radius: 12px; overflow: hidden; background: var(--surface); aspect-ratio: 3 / 4; }
.cat-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-comp { display: grid; gap: 4px; min-width: 0; font-size: 14px; }
.cat-comp ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.cat-comp li { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.cat-comp li b { white-space: nowrap; }
.cat-qty { display: flex; flex-wrap: wrap; gap: 4px; }
.cat-qty button { min-width: 44px; padding: 6px 10px; border: 0; border-radius: 99px; background: var(--surface); font-weight: 600; font-size: 13px; }
.cat-qty button[aria-pressed="true"] { background: var(--graphite); color: #fff; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.pill-sm { font-size: 12.5px; padding-top: 5px; padding-bottom: 5px; }
.cat-note { display: grid; gap: 6px; }
.cat-note .textarea { min-height: 60px; }
@media (max-width: 760px) { .cat-grid { grid-template-columns: 1fr; } .cat-top { grid-template-columns: 112px minmax(0, 1fr); } }
.cat-card { position: relative; }
.cat-badge { position: absolute; top: 8px; right: 8px; z-index: 1; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.cat-badge.ok { background: #3d8b4f; color: #fff; }
.cat-badge.bad { background: var(--danger); color: #fff; }
.cat-sub { margin-top: 6px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cat-wrap { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cat-wrap li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--soft); }
.cat-card .btn-dark, .cat-card .btn-danger-solid { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px currentColor; }

/* остатки (09.11.2026) */
/* Остатки: число крупно сразу у названия; на широком экране — колонки сверху вниз, без пустой полосы между названием
   и числом (просьба владельца 09.11.2026: «взгляд с ноутбука тянуть направо») */
.stock-list { padding: 4px 12px; columns: 300px; column-gap: 32px; }
.stock-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 8px; margin: 0 -8px;
  border-bottom: 1px solid var(--line); border-radius: 8px; break-inside: avoid; }
@media (hover: hover) { .stock-row:hover { background: var(--hover, rgba(0,0,0,.04)); } }   /* на телефоне подсветка «залипает» */
.stock-row .st-name { display: grid; min-width: 0; line-height: 1.25; }
.stock-row .st-name b { font-size: 14px; }
.stock-row .st-name .sub { font-size: 12px; }
.stock-row .stock-qty { font-size: 20px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stock-row .stock-qty small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stock-row.zero { opacity: .5; }
.stock-row.neg .stock-qty { color: var(--danger); background: var(--danger-bg); padding: 0 6px; border-radius: 6px; }
/* Склад → Списание: сводка (09.11.2026) */
.stock-tabs { margin: 0 0 14px; }
.wo-sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; max-width: 760px; margin-bottom: 10px; }
.wo-kpi { display: grid; gap: 4px; padding: 14px 16px; background: var(--paper, #fff); border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); }
.wo-kpi b { font-size: 24px; }
.wo-top { max-width: 760px; }   /* число рядом с названием, не через весь экран */
.pending-ph .ph-wait { display: block; width: 64px; height: 64px; border-radius: 10px; background: var(--line); }   /* фото сжимается */
/* Очередь фото (13.11.2026): статус на каждом фото, повтор, понятная ошибка */
.pending-ph { padding-top: 6px; }
.pending-ph .ph em { position: absolute; left: 0; right: 0; bottom: 0; font: 600 10px/1.6 var(--sans); font-style: normal; text-align: center;
  color: #fff; background: rgba(0,0,0,.55); border-radius: 0 0 10px 10px; }
.pending-ph .ph.done em { background: rgba(46,125,50,.85); }
.pending-ph .ph.err em { background: var(--danger); }
.pending-ph .ph.err img { opacity: .5; }
.pending-ph .ph-retry { position: absolute; inset: 0 0 16px 0; width: auto; height: auto; border-radius: 10px 10px 0 0; background: rgba(255,255,255,.75);
  color: var(--ink, #222); font: 600 11px/1.2 var(--sans); }
.ph-note { color: var(--danger); font-size: 13px; padding: 4px 2px 0; }
.pending-ph button[data-act="ph-remove"] { z-index: 2; }
