:root {
  --bg1: #dfe4ee; --bg2: #e4dfee; --bg3: #e6e6ef;
  --glass: rgba(255, 255, 255, .55); --edge: rgba(255, 255, 255, .85); --chip: rgba(255, 255, 255, .85);
  --ink: #1f1d3b; --ink2: #3d4058; --muted: #5d6280; --navy: #2b2358;
  --blue: #cfe0f6; --lav: #e4e0fb; --peach: #fbd8ca; --green: #d4eedd; --red: #f8d3cb; --red-ink: #8e2a17;
  --surf: #fff; --soft: rgba(255,255,255,.8); --soft2: rgba(255,255,255,.55); --grey: #eef0f6; --on: #fff;
  --r: 28px; --blur: 10px; --sat: 100%; --fs: 14px; --shadow: none;
  --font: "Montserrat", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font: var(--fs)/1.45 var(--font); color: var(--ink); background: linear-gradient(160deg, var(--bg1) 0%, var(--bg3) 45%, var(--bg2) 100%) fixed; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.glass { background: var(--glass); border: 1.5px solid var(--edge); border-radius: var(--r); backdrop-filter: blur(var(--blur)) saturate(var(--sat)); -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat)); box-shadow: var(--shadow); }
.btn { border: 0; background: var(--btn, var(--navy)); color: var(--btn-on, var(--on)); border-radius: 999px; padding: 0 20px; min-height: 44px; font-weight: 600; cursor: pointer; }
.btn2 { border: 0; background: var(--chip); color: var(--ink); border-radius: 999px; padding: 0 18px; min-height: 40px; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.inp { border: 0; background: var(--surf); border-radius: 16px; padding: 0 14px; min-height: 46px; width: 100%; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.p-green { background: var(--green); } .p-red { background: var(--red); color: var(--red-ink); } .p-lav { background: var(--lav); } .p-peach { background: var(--peach); } .p-grey { background: var(--grey); color: var(--ink2); }
.err { color: var(--red-ink); font-size: 13px; min-height: 18px; margin: 0; }
.muted { color: var(--muted); }
.lang { display: flex; gap: 4px; padding: 4px; background: var(--soft2); border-radius: 999px; }
.lang button { flex: 1; border: 0; background: transparent; border-radius: 999px; min-height: 34px; padding: 0 12px; font-weight: 600; font-size: 12px; color: var(--muted); cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--surf); color: var(--navy); }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.card { width: min(420px, 100%); padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.logo { font-weight: 700; font-size: 20px; color: var(--ink); display: inline-flex; align-items: center; gap: 10px; }
.logomark { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.code { font-family: ui-monospace, Menlo, monospace; background: var(--surf); border-radius: 12px; padding: 10px 12px; word-break: break-all; font-size: 13px; }
.hidden { display: none !important; }

/* приложение */
.shell { padding: 18px; display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.side { flex: 1 1 220px; max-width: 240px; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 0; background: transparent; width: 100%; text-align: left; border-radius: 999px; font-weight: 500; color: var(--ink2); text-decoration: none; min-height: 44px; cursor: pointer; }
button.nav:hover { background: var(--soft2); }
.nav[aria-current="page"], .nav[aria-current="page"]:hover { background: var(--navy); color: var(--on); }
.h1 { margin: 0; font-size: 20px; }
.h2 { margin: 8px 0 0; font-size: 14px; color: var(--ink2); }
.list { display: flex; flex-direction: column; gap: 8px; }
.small { font-size: 12px; }
.full { flex-basis: 100%; }
.full:empty { display: none; }
.once { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 18px; background: var(--lav); }
.once p { margin: 0; font-size: 13px; }
.once-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 200px; min-width: 0; }
.err:empty { min-height: 0; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.panel { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.panel h2 { margin: 0; font-size: 17px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 18px; background: var(--soft); }
.row .grow { flex: 1 1 200px; min-width: 0; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline .field { flex: 1 1 180px; }
@media (max-width: 600px) { .shell { padding: 8px; } .side { max-width: none; } .card { padding: 22px; } }
.row > .grow { flex: 1 1 260px; }
.row > button, .row > .pill { flex: 0 0 auto; }

/* ——— Полная версия ——— */
.shell { min-height: 100vh; align-items: stretch; flex-wrap: nowrap; }
.side { position: sticky; top: 18px; align-self: flex-start; max-height: calc(100vh - 36px); overflow-y: auto; flex: 0 0 230px; }
.nav svg { flex: 0 0 18px; }
.main { min-width: 0; }
.tbtn { border: 0; background: var(--chip); color: var(--ink); border-radius: 999px; padding: 0 12px; min-height: 34px; font-weight: 600; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tbtn[aria-pressed="true"] { background: var(--navy); color: var(--on); }
.tbtn .n { opacity: .75; font-weight: 500; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.search { border: 1.5px solid var(--edge); background: var(--soft); border-radius: 999px; padding: 0 16px; min-height: 42px; width: 100%; }

/* этапы — таблетки с точкой */
.st { border: 1.5px solid var(--edge); background: var(--glass); color: var(--ink); border-radius: 999px; padding: 0 14px; min-height: 36px; font-weight: 500; font-size: 12.5px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; cursor: pointer; }
.st:hover { background: var(--surf); }
.st i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 9px; }
.st[aria-pressed="true"] { background: var(--navy); color: var(--on); box-shadow: 0 6px 14px rgba(43,35,88,.22); }
.st b { font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 9px; }

/* чаты: список | переписка | карточка */
.chats { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(250px, 300px); gap: 14px; height: calc(100vh - 36px); }
.chats > * { min-height: 0; }
.clist { display: flex; flex-direction: column; padding: 14px; gap: 8px; overflow: hidden; }
.clist .items { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; margin: 0 -4px; padding: 0 4px; }
.citem { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 18px; cursor: pointer; border: 0; background: transparent; text-align: left; width: 100%; }
.citem:hover { background: var(--soft2); }
.citem[aria-current="true"] { background: var(--surf); box-shadow: 0 6px 20px rgba(70,60,120,.10); }
.av { flex: 0 0 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: var(--navy); background: var(--lav); }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.thead { padding: 14px 20px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; border-bottom: 1px solid rgba(43,35,88,.08); }
.msgs { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.bin { align-self: flex-start; max-width: 72%; background: var(--surf); border-radius: 18px 18px 18px 6px; padding: 9px 13px; box-shadow: 0 2px 8px rgba(70,60,120,.06); white-space: pre-wrap; word-wrap: break-word; }
.bout { align-self: flex-end; max-width: 72%; background: var(--navy); color: var(--on); border-radius: 18px 18px 6px 18px; padding: 9px 13px; white-space: pre-wrap; word-wrap: break-word; }
.bout.failed { background: #8e2a17; }
.bmeta { font-size: 11px; opacity: .75; margin-top: 3px; display: flex; gap: 6px; justify-content: flex-end; }
.bwho { font-size: 11px; font-weight: 600; opacity: .8; margin-bottom: 2px; }
.sysmsg { align-self: center; font-size: 12px; color: var(--ink2); background: var(--lav); border-radius: 12px; padding: 6px 12px; text-align: center; }
.composer { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.composer .box { display: flex; gap: 8px; align-items: flex-end; background: var(--surf); border-radius: 22px; padding: 6px 6px 6px 16px; }
.composer textarea { flex: 1; border: 0; resize: none; background: transparent; min-height: 40px; max-height: 160px; padding: 10px 0; outline: none; }
.ccard { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.lbl { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { background: var(--soft); border-radius: 18px; padding: 10px 12px; min-width: 0; }
.tile .k { font-size: 11px; color: var(--ink2); }
.tile .v { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.evt { display: flex; gap: 10px; font-size: 12.5px; padding: 6px 0; border-bottom: 1px solid rgba(43,35,88,.06); }
.evt .tm { color: var(--muted); flex: 0 0 auto; }
.emptybig { margin: auto; text-align: center; color: var(--muted); padding: 40px 20px; }
.back { display: none; }

/* канбан */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(176px, 1fr); gap: 12px; overflow-x: auto; align-items: start; padding: 2px 2px 10px; }
.kcol { background: var(--glass); border: 1.5px solid var(--edge); border-radius: 22px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 160px; }
.kcol.drop { background: var(--surf); border-color: var(--navy); }
.kcol h3 { margin: 4px 6px; font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.kcol h3 .n { font-size: 12px; color: var(--muted); background: var(--chip); border-radius: 999px; padding: 1px 9px; }
.kc { background: var(--surf); border: 0; border-radius: 16px; padding: 11px 12px; display: flex; flex-direction: column; gap: 5px; text-align: left; width: 100%; box-shadow: 0 4px 14px rgba(70,60,120,.06); cursor: grab; }
.kc:hover { box-shadow: 0 6px 20px rgba(70,60,120,.14); }
.kc .last { color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.who { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: var(--grey); white-space: nowrap; }

/* дашборд */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--soft); border-radius: 22px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .k, .kpi .d { font-size: 12px; color: var(--ink2); }
.kpi.bad .v { color: #c0392b; } /* баланс ИИ ниже порога, мало дней */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; border-bottom: 1px solid rgba(43,35,88,.15); }
.bars .b { flex: 1; background: var(--navy); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars .b:hover { background: #a98ae6; }
.blabels { display: flex; gap: 6px; font-size: 10.5px; color: var(--muted); }
.blabels span { flex: 1; text-align: center; overflow: hidden; }
.hbar { height: 10px; border-radius: 0 4px 4px 0; background: var(--navy); min-width: 2px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; }
table.t td { padding: 10px; border-top: 1px solid rgba(43,35,88,.08); font-variant-numeric: tabular-nums; }
.scrollx { overflow-x: auto; }
textarea.inp { padding: 12px 14px; min-height: 90px; resize: vertical; }

/* телефон */
@media (max-width: 900px) {
  .shell { flex-direction: column; flex-wrap: nowrap; padding: 8px; gap: 8px; }
  .side { position: static; flex: none; max-width: none; max-height: none; flex-direction: row; overflow-x: auto; padding: 8px; gap: 4px; align-items: center; border-radius: 22px; }
  .side .logo { display: none; }
  .side .nav { width: auto; white-space: nowrap; min-height: 40px; padding: 8px 12px; }
  .chats { grid-template-columns: 1fr; height: auto; }
  .chats.open .clist, .chats:not(.open) .thread, .chats:not(.open) .ccard { display: none; }
  .thread { height: calc(100vh - 90px); }
  .back { display: inline-flex; }
  .bin, .bout { max-width: 88%; }
}

/* средние экраны: карточка клиента — выдвижная панель */
.cardbtn { display: none; }
@media (max-width: 1280px) {
  .chats { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
  .ccard { position: fixed; right: 12px; top: 12px; bottom: 12px; width: min(380px, calc(100vw - 24px)); z-index: 30; display: none; background: rgba(246, 245, 251, .97); box-shadow: 0 30px 80px rgba(40, 36, 80, .25); }
  .chats.card-open .ccard { display: flex; }
  .cardbtn { display: inline-flex; }
}
@media (max-width: 900px) {
  .chats.open.card-open .ccard { display: flex; }
}

/* телефон — последним, чтобы перебить правила для средних экранов */
@media (max-width: 900px) {
  .side { align-self: stretch; width: auto; min-width: 0; }
  .main { width: 100%; }
  .chats { grid-template-columns: minmax(0, 1fr); }
  .kanban { grid-auto-columns: minmax(240px, 82vw); }
}

/* Без полос прокрутки (решение владельца 11.11.2026). Прокрутка колёсиком, тачпадом и пальцем остаётся. */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* Контраст: поля и светлые кнопки видны на любом фоне — и на стекле, и на белых карточках. */
.inp, .search, select.tbtn { border: 1.5px solid rgba(43, 35, 88, .16); }
.inp:hover, .search:hover { border-color: rgba(43, 35, 88, .3); }
.inp:focus, .search:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(43, 35, 88, .12); }
.inp:disabled { background: var(--soft2); color: var(--muted); }
.btn2, .tbtn { border: 1.5px solid rgba(43, 35, 88, .12); }
.btn2:hover, .tbtn:hover { border-color: rgba(43, 35, 88, .28); background: var(--surf); }
.tbtn[aria-pressed="true"], .tbtn[aria-pressed="true"]:hover { border-color: var(--navy); background: var(--navy); color: var(--on); } /* под курсором выбранная кнопка не «пропадает» (белый текст на белом) */
.composer .box { border: 1.5px solid rgba(43, 35, 88, .16); }
.composer .box:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(43, 35, 88, .12); }
.formcard { background: rgba(228, 224, 251, .55); border: 1.5px solid rgba(43, 35, 88, .10); gap: 10px; }
.row { border: 1px solid rgba(43, 35, 88, .06); }

/* Аккуратная ширина форм: поля не растягиваются на весь широкий экран. */
.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 20px; align-items: end; max-width: 980px; }
.inline { align-items: flex-end; }
.inline .field { flex: 0 1 300px; }
.inline > .btn, .inline > button { flex: 0 0 auto; }
.readable { max-width: 820px; }
.formcard { max-width: 820px; }
.fgroup { border: 0; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.fgroup legend { font-size: 13px; font-weight: 700; color: var(--ink2); padding: 0; margin-bottom: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; min-height: 46px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); }
.panel > p.muted, .panel > .muted { max-width: 820px; }
@media (max-width: 600px) { .formgrid { grid-template-columns: 1fr; } .inline .field { flex: 1 1 100%; } }
.hbar[style*="width:0%"] { visibility: hidden; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; margin-left: auto; }
.thead .acts { flex: 0 1 auto; }
@media (max-width: 900px) { .side { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); padding-right: 40px; } }

/* Окно подключения WhatsApp */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(31, 29, 59, .28); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modalcard { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: rgba(250, 249, 255, .97); box-shadow: 0 30px 80px rgba(40, 36, 80, .25); }
.qrbox { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px; border-radius: 22px; background: var(--surf); border: 1.5px solid rgba(43, 35, 88, .1); min-height: 140px; justify-content: center; text-align: center; }
.qrimg { width: 260px; height: 260px; image-rendering: pixelated; }
.qrstate { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 14px; }
.qrsteps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink2); }
.qrok { width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: #1e5c38; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 700; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(43, 35, 88, .15); border-top-color: var(--navy); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Подробные настройки агента — раскрывающийся блок */
.adv { border: 1.5px solid rgba(43, 35, 88, .12); border-radius: 20px; padding: 0 16px; background: var(--soft2); }
.adv[open] { padding-bottom: 14px; }
.adv summary { cursor: pointer; font-weight: 700; font-size: 14px; padding: 14px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
.adv summary::-webkit-details-marker { display: none; }
.adv summary::before { content: '›'; font-size: 18px; transition: transform .15s; }
.adv[open] summary::before { transform: rotate(90deg); }
.adv .fgroup { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(43, 35, 88, .08); }
.adv .fgroup:first-of-type { border-top: 0; padding-top: 0; }
.fgroup legend { float: left; width: 100%; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.fgroup legend + * { clear: both; }
fieldset.fgroup { min-inline-size: 0; }
.testlog { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; padding: 12px; border-radius: 18px; background: var(--soft); border: 1.5px solid rgba(43, 35, 88, .08); }

/* ——— Оформление: темы, стиль стекла, акцент, плотность ——— */
body { zoom: var(--zoom, 1); }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background:
  radial-gradient(40vmax 40vmax at 8% 12%, var(--blob1, rgba(169,138,230,.35)), transparent 60%),
  radial-gradient(36vmax 36vmax at 92% 20%, var(--blob2, rgba(127,183,240,.30)), transparent 60%),
  radial-gradient(44vmax 44vmax at 70% 95%, var(--blob3, rgba(251,190,170,.30)), transparent 60%); }

/* Liquid Glass (по умолчанию): прозрачнее, сильнее размытие, блик по краю */
:root, [data-style="liquid"] { --glass: rgba(255,255,255,.42); --edge: rgba(255,255,255,.75); --blur: 24px; --sat: 180%;
  --shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 -1px 0 rgba(255,255,255,.25), 0 10px 30px rgba(43,35,88,.10); }
[data-style="frosted"] { --glass: rgba(255,255,255,.62); --edge: rgba(255,255,255,.9); --blur: 14px; --sat: 120%; --shadow: 0 6px 20px rgba(43,35,88,.08); }
[data-style="flat"] { --glass: var(--panel, #f7f7fb); --edge: rgba(43,35,88,.08); --blur: 0px; --sat: 100%; --shadow: none; }
[data-style="flat"] body::before { display: none; }

/* Темы */
/* Sana CRM (брендбук 12.11.2026): Фарфор — фон, Графит — текст, Синий — акцент, Лайм — главные кнопки, Коралл — искра. */
[data-theme="sana"] { --bg1: #F4F3EF; --bg2: #EFEEE8; --bg3: #F7F6F2; --blob1: rgba(19,91,255,.12); --blob2: rgba(202,255,52,.20); --blob3: rgba(255,128,95,.12);
  --ink: #121212; --ink2: #2a2a2a; --muted: #5f5f5a; --navy: #135BFF; --on: #fff; --btn: #CAFF34; --btn-on: #121212;
  --lav: #ECFBC4; --blue: #DCE6FF; --peach: #FFE0D7; --panel: #FBFAF7; --font: Arial, "Helvetica Neue", Helvetica, sans-serif; }
[data-theme="mint"] { --bg1: #dcefe8; --bg2: #e3f1ec; --bg3: #e9f3ef; --blob1: rgba(110,200,170,.30); --blob2: rgba(140,200,230,.28); --blob3: rgba(200,230,160,.28); --lav: #d7efe6; --panel: #f3faf7; }
[data-theme="peach"] { --bg1: #f6e3da; --bg2: #f4e6e0; --bg3: #f7ece6; --blob1: rgba(250,170,140,.32); --blob2: rgba(250,210,150,.30); --blob3: rgba(230,160,190,.26); --lav: #fbe2d8; --panel: #fdf6f2; }
[data-theme="graphite"] { --bg1: #e3e4e8; --bg2: #e6e7ea; --bg3: #ececef; --blob1: rgba(150,155,170,.25); --blob2: rgba(170,180,200,.25); --blob3: rgba(200,200,210,.25); --lav: #e6e7ee; --panel: #f6f6f8; }
[data-theme="dark"] { color-scheme: dark;
  --bg1: #15142a; --bg2: #1b1830; --bg3: #121222; --blob1: rgba(120,90,220,.35); --blob2: rgba(60,120,200,.28); --blob3: rgba(200,90,120,.22);
  --ink: #ecebf7; --ink2: #c9c8de; --muted: #a2a1bd; --navy: #a98ae6; --on: #15142a;
  --surf: #26243f; --soft: rgba(255,255,255,.07); --soft2: rgba(255,255,255,.05); --grey: #33314f; --chip: rgba(255,255,255,.10); --panel: #1f1d36;
  --blue: #23385a; --lav: #2f2a52; --peach: #4a2f2a; --green: #1f4433; --red: #4c2420; --red-ink: #ffb4a6; }
[data-theme="dark"][data-style="liquid"], [data-theme="dark"]:not([data-style]) { --glass: rgba(40,38,70,.45); --edge: rgba(255,255,255,.14);
  --shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 10px 30px rgba(0,0,0,.35); }
[data-theme="dark"][data-style="frosted"] { --glass: rgba(40,38,70,.7); --edge: rgba(255,255,255,.12); }
[data-theme="dark"] .inp, [data-theme="dark"] .search, [data-theme="dark"] select, [data-theme="dark"] textarea { color: var(--ink); }
[data-theme="dark"] .qrbox { background: #fff; color: #1f1d3b; } /* QR читается только на белом */

/* Плотность и движение */
[data-density="compact"] .panel { padding: 14px 16px; gap: 9px; }
[data-density="compact"] .row { padding: 8px 12px; }
[data-density="compact"] .nav { min-height: 38px; padding: 7px 12px; }
[data-density="compact"] .shell { gap: 10px; padding: 12px; }
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.btn, .btn2, .tbtn, .st, .nav, .kc, .citem { transition: background .18s, box-shadow .18s, transform .12s; }
.btn:active, .btn2:active, .tbtn:active { transform: scale(.97); }

/* Экран «Оформление» */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.sw { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surf); box-shadow: 0 0 0 1.5px var(--edge); cursor: pointer; padding: 0; }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--navy); }
.themecards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tcard { border: 1.5px solid var(--edge); border-radius: 18px; padding: 10px; background: var(--soft); cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 8px; font-weight: 600; color: var(--ink); }
.tcard[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--navy); }
.tcard .pv { height: 54px; border-radius: 12px; }
.rangeRow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rangeRow input[type=range] { flex: 1 1 200px; accent-color: var(--navy); }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.toggle input { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--grey); position: relative; cursor: pointer; margin: 0; flex: none; transition: background .18s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .18s; }
.toggle input:checked { background: var(--navy); }
.toggle input:checked::after { left: 21px; }
/* Настройки: боковое меню */
.slayout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }
.snav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 12px; }
.snavi { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--ink2); font-weight: 600; cursor: pointer; text-align: left; }
.snavi:hover { background: var(--soft2); }
.snavi[aria-current="page"] { background: var(--soft); color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--edge); }
.sdetail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 760px) { .slayout { grid-template-columns: 1fr; } .snav { flex-direction: row; overflow-x: auto; position: static; } .snavi { flex: none; } }
/* Агенты: запуск, отделы, права */
.launch .checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.chk { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--soft); font-size: 13px; color: var(--ink2); }
.chk .mark { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--grey); font-weight: 700; flex: none; }
.chk.ok .mark { background: var(--green); color: #1e5c38; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.p-green .dot { background: #2f9e62; }
.dept { display: flex; flex-direction: column; gap: 12px; }
.depthead { padding: 6px 4px 0; display: flex; flex-direction: column; gap: 2px; }
.deptlead { display: flex; flex-direction: column; gap: 8px; }
.deptlead > .pill { align-self: flex-start; }
.deptmembers { display: flex; flex-direction: column; gap: 14px; padding-left: 22px; border-left: 2px dashed var(--edge); margin-left: 12px; }
@media (max-width: 600px) { .deptmembers { padding-left: 10px; margin-left: 4px; } }
.perms { display: flex; flex-direction: column; gap: 6px; }
.perm { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 14px; background: var(--soft); cursor: pointer; flex-wrap: wrap; }
.perm .grow { display: flex; flex-direction: column; gap: 1px; }
.perm.fixed { cursor: default; opacity: .9; }
.toggle input:disabled { opacity: .55; cursor: default; }
[data-theme="dark"] .inp, [data-theme="dark"] .search { background: #2d2a4c; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
[data-theme="dark"] .inp:focus { box-shadow: inset 0 0 0 1.5px var(--navy); }
[data-theme="dark"] .inp:disabled { background: rgba(255,255,255,.04); }
.inp { box-shadow: inset 0 0 0 1px rgba(43,35,88,.08); }

/* ——— Чат как в WhatsApp ——— */
.thread { --wa-in: #ffffff; --wa-out: #d9fdd3; --wa-ink: #111b21; --wa-meta: #667781; --wa-tick: #53bdeb;
  --wa-bg: #efeae2; --wa-doodle: rgba(43, 35, 88, .045); }
[data-theme="dark"] .thread { --wa-in: #202c33; --wa-out: #005c4b; --wa-ink: #e9edef; --wa-meta: #8696a0; --wa-bg: #0b141a; --wa-doodle: rgba(255, 255, 255, .03); }
.msgs { background-color: var(--wa-bg);
  background-image: radial-gradient(var(--wa-doodle) 1.2px, transparent 1.4px), radial-gradient(var(--wa-doodle) 1.2px, transparent 1.4px);
  background-size: 22px 22px; background-position: 0 0, 11px 11px; gap: 2px; padding: 14px 6% 18px; }
.msgs.dropping { outline: 3px dashed var(--navy); outline-offset: -10px; }
.bin, .bout { position: relative; max-width: min(65%, 520px); color: var(--wa-ink); border-radius: 8px; padding: 6px 9px 8px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); font-size: 14.2px; line-height: 1.38; display: flex; flex-direction: column; gap: 4px; }
.bin { background: var(--wa-in); }
.bout { background: var(--wa-out); color: var(--wa-ink); }
.bin.tail, .bout.tail { margin-top: 8px; }
.bin.tail { border-top-left-radius: 0; }
.bout.tail { border-top-right-radius: 0; }
.bin.tail::before, .bout.tail::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; }
.bin.tail::before { left: -8px; background: var(--wa-in); clip-path: polygon(100% 0, 0 0, 100% 100%); }
.bout.tail::before { right: -8px; background: var(--wa-out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.bout.failed { background: #fde2dd; }
[data-theme="dark"] .bout.failed { background: #5a2420; }
.btext { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.bmeta { align-self: flex-end; font-size: 11px; color: var(--wa-meta); opacity: 1; margin: -2px 0 -3px; display: inline-flex; gap: 3px; align-items: center; white-space: nowrap; }
.bwho { font-size: 12.5px; font-weight: 600; color: #1f8a5b; opacity: 1; margin: 0; }
[data-theme="dark"] .bwho { color: #53bdeb; }
.tick { display: inline-flex; color: var(--wa-tick); }
.tick.bad { color: #d4553d; font-weight: 700; }
.bimg { display: block; margin: -3px -6px 0; border-radius: 6px; overflow: hidden; max-width: 330px; }
.bimg img { display: block; width: 100%; max-height: 360px; object-fit: cover; }
.bimg.sticker { background: none; max-width: 160px; }
.bvideo { width: 100%; max-width: 330px; max-height: 360px; border-radius: 6px; background: #000; margin: -3px -6px 0; }
.baudio { display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.baudio audio { width: 100%; height: 36px; }
.transcript { font-size: 13px; padding: 6px 8px; border-radius: 6px; background: rgba(0, 0, 0, .05); white-space: pre-wrap; }
[data-theme="dark"] .transcript { background: rgba(255, 255, 255, .06); }
.transcript.unsure .tlabel { color: #b26a00; }
.transcript .tlabel { display: block; font-size: 11px; font-weight: 700; color: var(--wa-meta); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.bfile { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; background: rgba(0, 0, 0, .05); color: inherit; text-decoration: none; min-width: 220px; }
[data-theme="dark"] .bfile { background: rgba(255, 255, 255, .06); }
.bfile .grow { display: flex; flex-direction: column; min-width: 0; }
.bfile strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 13.5px; }
.bfile .small { color: var(--wa-meta); }
.bfile.missing { color: var(--wa-meta); font-size: 13px; min-width: 0; }
.fext { width: 38px; height: 44px; flex: none; border-radius: 4px; background: #d4553d; color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; }
.msgs .sysmsg { margin: 10px 0 4px; background: var(--wa-in); color: var(--wa-meta); box-shadow: 0 1px .5px rgba(11, 20, 26, .13); border-radius: 7px; font-size: 12px; padding: 5px 12px; }
.iconbtn { border: 0; background: transparent; color: var(--muted); width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.iconbtn:hover:not(:disabled) { background: var(--soft2); color: var(--ink); }
.iconbtn:disabled { opacity: .4; cursor: default; }
.composer .box { padding-left: 4px; }
@media (max-width: 900px) { .msgs { padding: 12px 10px 16px; } .bin, .bout { max-width: 86%; } }
/* Доска: как в Super Youtubers */
.who-filter { width: auto; min-height: 42px; border-radius: 999px; padding: 0 14px; }
.kctitle { display: flex; align-items: center; gap: 8px; }
.ksum { margin: -4px 6px 2px; font-size: 12px; font-weight: 700; color: var(--ink2); }
.kc { color: inherit; text-decoration: none; }
.kc.sos { box-shadow: 0 0 0 2px #d4553d; }
.kc.dragging { opacity: .45; }
.kchead { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kchead strong { flex: 1; min-width: 0; font-size: 13.5px; }
.kav { width: 26px; height: 26px; border-radius: 50%; background: var(--lav); color: var(--navy); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.kamt { font-size: 12px; font-weight: 700; white-space: nowrap; }
.kfoot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kempty { border: 1.5px dashed var(--edge); border-radius: 14px; padding: 18px 10px; text-align: center; font-size: 12px; color: var(--muted); }
.kcol.drop .kempty { border-color: var(--navy); color: var(--navy); }
.kmore { align-self: center; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--navy); color: var(--on); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: toastIn .2s ease-out; transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast.bad { background: #8e2a17; color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
/* Этапы в шапке чата */
.stagebar { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; padding-top: 4px; }
.stagebar::-webkit-scrollbar { display: none; }
.spill { border: 1.5px solid var(--edge); background: var(--soft); color: var(--ink2); border-radius: 999px; min-height: 32px; padding: 0 12px; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; flex: none; }
.spill:hover { background: var(--surf); }
.spill[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--on); }
.spill[aria-pressed="true"] .dot { box-shadow: 0 0 0 2px var(--on); }
.sarrow { color: var(--muted); font-weight: 700; flex: none; }
.ssep { width: 1px; height: 22px; background: var(--edge); margin: 0 6px; flex: none; }
.agbody { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }

/* Голосовое: запись в чате */
.recbox { align-items: center; gap: 10px; }
.recdot { width: 10px; height: 10px; border-radius: 50%; background: #e5484d; animation: recpulse 1.2s ease-in-out infinite; flex: none; }
.rectime { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3.2em; }
@keyframes recpulse { 50% { opacity: .35; } }
.recbox .btn svg { margin-right: 6px; vertical-align: -3px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn:disabled { opacity: .5; cursor: default; }

/* Профиль и меню */
.profile { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: var(--soft2); border-radius: 18px; padding: 8px 10px; margin: 0 0 12px; cursor: pointer; color: inherit; font: inherit; }
.profile:hover, .profile[aria-expanded="true"] { background: var(--soft); }
.pava { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: var(--on); font-weight: 700; }
.ptext { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ptext strong, .ptext span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptext span { font-size: 11px; }
.pmenu { position: fixed; z-index: 60; padding: 8px; border-radius: 20px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 18px 50px rgba(20, 18, 50, .22); background: var(--surf); }
.pmhead { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--grey); margin-bottom: 4px; }
.pmi { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 10px; border: 0; background: transparent; border-radius: 12px; font: inherit; color: inherit; cursor: pointer; text-align: left; }
button.pmi:hover, button.pmi:focus-visible { background: var(--grey); }
.pmi.danger { color: var(--red-ink); }
.pmhint { margin: 0; padding: 2px 10px 8px; line-height: 1.4; }
.pmlang { justify-content: space-between; cursor: default; }
.pmlang .lang { min-width: 120px; }
@media (max-width: 900px) {
  .profile { width: auto; flex: none; padding: 4px; margin: 0; order: -1; position: sticky; left: 0; z-index: 2; background: var(--surf); border-radius: 50%; box-shadow: 6px 0 10px -6px rgba(0,0,0,.25); }
  .profile .ptext { display: none; }
}

/* Статус ИИ в меню */
.aistatus { display: flex; align-items: center; gap: 8px; border: 0; background: var(--grey); color: var(--muted); border-radius: 999px; padding: 6px 12px; margin: -4px 0 10px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.aistatus .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .7; }
.aistatus.on { background: var(--green); color: var(--ink); }
.aistatus.on .dot { background: #1f8a5b; opacity: 1; }
.aistatus:disabled { cursor: default; }
@media (max-width: 900px) { .aistatus { margin: 0; flex: none; order: -1; } .aistatus #aistatusText { white-space: nowrap; } }

@media (max-width: 600px) {
  .composer .box > .btn { padding: 0 14px; min-width: 0; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 12px 14px; border-radius: 18px; }
  .kpi .v { font-size: 20px; }
}

/* Начало работы */
.gsteps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.gsteps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--soft2); }
.gsteps li.ok { opacity: .65; }
.gnum { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surf); color: var(--navy); }
.gsteps li.ok .gnum { background: var(--green); color: var(--ink); }
/* База знаний: длинный текст — 3 строки, по нажатию целиком */
.kbody { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.kbody.open { display: block; }
.gsteps li.cur { background: var(--lav); }

/* Телефон: компактная шапка чата — действия и этапы в одну строку с прокруткой, «Отправить» — иконкой */
.sendbtn { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 600px) {
  .thead { padding: 10px 12px; gap: 8px; }
  .thead .acts { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; margin-left: 0; scrollbar-width: none; }
  .thead .acts::-webkit-scrollbar { display: none; }
  .thead .acts > * { flex: none; min-height: 36px; padding: 0 12px; font-size: 13px; }
  .stagebar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .stagebar::-webkit-scrollbar { display: none; }
  .sendtxt { display: none; }
  .sendbtn { padding: 0 14px; }
}

/* ——— ИИ-офис ——— */
.office { display: flex; flex-direction: column; gap: 12px; }
.obar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; }
.obrand { display: flex; flex-direction: column; line-height: 1.2; min-width: 120px; }
.obrand strong { font-size: 16px; }
.oclock { font-weight: 700; font-variant-numeric: tabular-nums; padding: 5px 11px; border-radius: 10px; background: var(--soft); }
.ostats { display: flex; flex-wrap: wrap; gap: 6px; }
.ostat { display: inline-flex; gap: 6px; align-items: baseline; padding: 4px 10px; border-radius: 10px; background: var(--soft2); font-size: 12px; white-space: nowrap; }
.ostat i { font-style: normal; color: var(--muted); }
.ostat b { font-variant-numeric: tabular-nums; }
.ostat.warn { background: var(--red); }
.ogrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; }
.ostagebox { padding: 0; overflow: hidden; position: relative; }
.ostage { position: relative; height: 620px; overflow: hidden; }
.oscene { position: absolute; inset: 0; display: grid; place-items: center; }
.ofloor { width: 980px; height: 640px; display: grid; grid-template-columns: 1.35fr 1fr 1.05fr; grid-template-rows: 1fr 56px 1fr; gap: 0;
  transform: rotateX(52deg) rotateZ(-38deg) scale(var(--fit, .8)); transform-origin: center; }
.oroom { position: relative; background: color-mix(in srgb, var(--c) 13%, var(--surf)); border: 7px solid color-mix(in srgb, var(--c) 32%, var(--surf));
  box-shadow: 16px 16px 0 rgba(30, 30, 60, .10); border-radius: 6px; }
.oroom.o-sales { grid-area: 1 / 1; } .oroom.o-mkt { grid-area: 1 / 2; } .oroom.o-mgmt { grid-area: 1 / 3; } .oroom.ohub { grid-area: 2 / 1 / 3 / 4; border-width: 0 7px; } .oroom.o-hand { grid-area: 3 / 1; } .oroom.o-care { grid-area: 3 / 2; } .oroom.o-ctrl { grid-area: 3 / 3; }
.oanchor { position: absolute; width: 2px; height: 2px; }
/* Подпись комнаты — на внешнем углу здания, подальше от соседних комнат */
.o-sales .oanchor { left: 0; top: 0; } .o-mkt .oanchor { left: 50%; top: 0; } .o-mgmt .oanchor { right: 0; top: 0; } .o-hand .oanchor { left: 0; top: 45%; } .o-care .oanchor { left: 50%; bottom: 0; } .o-ctrl .oanchor { right: 0; bottom: 0; }
.oroom.ohub .oanchor { left: 30%; top: 50%; }
.ohub .oseats { inset: 6px 20px; }
.oseats { position: absolute; inset: 16px 22px 24px; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: var(--gy, 128px) var(--gx, 150px); }
.oseat { width: 66px; height: 40px; position: relative; }
.odesk { position: absolute; inset: 0; background: var(--surf); border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 5px 5px 0 rgba(0,0,0,.10); }
.otokens { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.otok, .oroomlbl { position: absolute; pointer-events: auto; }
.otok { transform: translate(-50%, -88%); display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font: inherit; }
.otok:focus-visible { outline: 2px solid var(--navy); outline-offset: 4px; border-radius: 12px; }
.oroomlbl { transform: translate(-50%, -50%); pointer-events: none; font-weight: 800; font-size: 12.5px; letter-spacing: .03em; color: var(--ink); background: var(--soft);
  border-left: 4px solid var(--c); border-radius: 10px; padding: 5px 9px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.oroomlbl small { display: block; max-width: 170px; white-space: normal; font-weight: 500; font-size: 11px; letter-spacing: 0; color: var(--muted); }
.oroomlbl.hub { transform: translate(-50%, -50%); text-align: center; pointer-events: auto; }
.onums { display: flex; flex-wrap: wrap; gap: 4px; }
.st-working { --ring: #2e9d5b; } .st-idle { --ring: #9aa4ae; } .st-paused { --ring: #d99413; } .st-error { --ring: #d2412f; } .st-off, .st-away { --ring: #c9ced8; } .st-soon { --ring: #d6d9e0; }
.oava { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-weight: 700;
  box-shadow: 0 0 0 3px var(--surf), 0 0 0 6px var(--ring, #9aa4ae), 0 8px 16px rgba(0,0,0,.18); }
.oava.big { width: 46px; height: 46px; border-radius: 14px; box-shadow: none; }
.otok.human .oava { background: color-mix(in srgb, var(--c) 28%, var(--surf)); color: var(--ink); }
.otok.st-working .oava { animation: opulse 1.6s ease-in-out infinite; }
@keyframes opulse { 50% { box-shadow: 0 0 0 3px var(--surf), 0 0 0 10px color-mix(in srgb, var(--ring) 40%, transparent), 0 8px 16px rgba(0,0,0,.18); } }
.otok.st-off .oava, .otok.st-away .oava { opacity: .55; }
.otok.st-soon .oava { opacity: .4; filter: grayscale(1); width: 28px; height: 28px; box-shadow: 0 0 0 2px var(--surf), 0 0 0 4px var(--ring); }
.otok.st-soon .otag { font-size: 10px; padding: 2px 6px; } .otok.st-soon .otag { opacity: .75; font-style: italic; }
.otag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--surf);
  box-shadow: 0 1px 3px rgba(0,0,0,.15); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.otag i { width: 7px; height: 7px; border-radius: 50%; background: var(--ring, #9aa4ae); flex: none; }
.obubble { font-size: 11px; line-height: 1.3; max-width: 150px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; width: max-content; padding: 5px 9px; border-radius: 11px 11px 11px 3px; background: var(--surf); box-shadow: 0 2px 8px rgba(0,0,0,.15); text-align: left; }
.obubble.bad { background: var(--red); } .obubble.warn { background: var(--peach); }
.office.nolabels .otag, .office.nolabels .obubble { display: none; }
.olegend { margin: 0 12px 12px; background: var(--soft2); border-radius: 16px; padding: 8px 12px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.olegend .olk { display: inline-flex; align-items: center; gap: 5px; }
.olegend .olk i { width: 10px; height: 10px; border-radius: 50%; background: var(--ring); }
.olegend p { margin: 0; flex-basis: 100%; color: var(--muted); }
.ofeed { display: flex; flex-direction: column; gap: 8px; padding: 14px; height: 620px; }
.ofeedlist { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ofeedlist li { display: grid; grid-template-columns: 42px 1fr; gap: 8px; padding: 7px 8px; border-left: 3px solid var(--c, var(--edge)); border-radius: 8px; font-size: 12.5px; background: var(--soft2); }
.ofeedlist li.alert { background: var(--red); }
.ofeedlist li.new { animation: oflash 1.4s ease-out; }
@keyframes oflash { from { background: var(--peach); } }
.ofeedlist time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11.5px; padding-top: 1px; }
.ofeedlist a { color: inherit; }
dialog.omodal { width: min(560px, calc(100vw - 32px)); max-height: 86vh; border: 0; border-radius: 24px; padding: 18px; background: var(--surf); color: var(--ink); }
dialog.omodal[open] { display: flex; flex-direction: column; gap: 10px; }
dialog.omodal::backdrop { background: rgba(20, 28, 40, .35); }
.omhead { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; }
.ohist { max-height: 42vh; overflow: auto; }
.evt.bad a, .evt.bad span:last-child { color: var(--red-ink); }
.office:fullscreen { background: linear-gradient(160deg, var(--bg1) 0%, var(--bg3) 45%, var(--bg2) 100%); padding: 14px; overflow: auto; }
.office:fullscreen .ostage, .office:fullscreen .ofeed { height: calc(100vh - 120px); }
@media (max-width: 1500px) { .ogrid { grid-template-columns: 1fr; } .ofeed { height: 420px; } }
/* Телефон: план без изометрии — комнаты стопкой */
@media (max-width: 760px) {
  .ostage { height: auto; }
  .oscene { position: static; display: block; padding: 12px; place-items: normal; }
  .ofloor { width: auto; height: auto; transform: none; display: flex; flex-direction: column; gap: 14px; }
  .oroom { min-height: 190px; box-shadow: none; }
  .oroom.ohub { min-height: 96px; order: -1; border-width: 7px; }
  .oseats { position: static; padding: 96px 12px 20px; gap: 80px 34px; min-height: 120px; }
  .o-sales .oanchor, .o-mkt .oanchor, .o-care .oanchor, .o-mgmt .oanchor, .o-ctrl .oanchor, .o-hand .oanchor { left: 12px; top: 12px; right: auto; bottom: auto; }
  .oroomlbl { transform: none; }
  .oroomlbl.hub { transform: translate(-50%, -50%); }
  .ostats { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .otok.st-working .oava, .ofeedlist li.new { animation: none; } }

/* ——— 3D-офис ——— */
.o3d { position: absolute; inset: 0; z-index: 4; }
.ostage.is3d .oscene, .ostage.is3d .otokens { visibility: hidden; }
.o3dcanvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; cursor: grab; touch-action: none; }
.o3dcanvas:active { cursor: grabbing; }
.o3dlabels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.o3tag, .o3bub, .o3room { position: absolute; left: 0; top: 0; will-change: transform; }
.o3tag { pointer-events: auto; margin: 0; transform-origin: 0 0; translate: -50% -100%; display: inline-flex; align-items: center; gap: 5px; border: 0; cursor: pointer; font: 600 11px/1 var(--font);
  padding: 3px 7px; border-radius: 999px; background: var(--surf); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.18); white-space: nowrap; font-size: 10.5px; }
.o3tag i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.o3tag.st-off, .o3tag.st-away, .o3tag.st-soon { opacity: .6; }
.o3bub { translate: -50% calc(-100% - 26px); font: 500 11px/1.3 var(--font); max-width: 180px; width: max-content; padding: 5px 9px; border-radius: 11px; background: var(--surf); color: var(--ink);
  box-shadow: 0 2px 8px rgba(0,0,0,.18); opacity: 0; transition: opacity .3s; }
.o3bub.show { opacity: 1; }
.o3bub.bad { background: var(--red); } .o3bub.warn { background: var(--peach); } .o3bub.joy { background: #fff0b8; color: #3d2f00; font-weight: 700; }
.o3bub.client { background: #dcf5d9; color: #1d4b2d; translate: -50% calc(-100% - 6px); }
.o3room { translate: -100% -50%; font: 800 11.5px/1.2 var(--font); white-space: nowrap; opacity: .92; color: var(--ink); background: var(--soft); border-left: 4px solid var(--c); border-radius: 10px; padding: 5px 9px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.o3room small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); }
.office.nolabels .o3tag, .office.nolabels .o3bub { display: none !important; }
@media (max-width: 760px) { .ostage.is3d { height: 480px; } .ostage.is3d .oscene { display: none; } }

/* 3D: кнопки «показать отдел», подписи в стиле «белая табличка с цветной кромкой» */
.o3focus { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 3; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.o3focus button { pointer-events: auto; border: 1.5px solid rgba(255,255,255,.9); background: rgba(255,255,255,.78); color: #1f1d3b; border-radius: 999px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 4px 11px; font: 600 12px var(--font); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.o3focus button i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.o3focus button[aria-pressed="true"] { background: #2b2358; border-color: #2b2358; color: #fff; }
.o3dlabels .o3room { background: rgba(255,255,255,.88); color: #1f1d3b; border-radius: 10px; padding: 5px 9px; font: 700 12px/1.2 var(--font); letter-spacing: .04em; translate: 0 -50%; box-shadow: none; opacity: 1; white-space: normal; max-width: 210px; }
.o3dlabels .o3room small { display: block; font: 500 11px var(--font); letter-spacing: 0; color: #6c7189; margin-top: 2px; }
.o3dlabels .o3tag { background: rgba(255,255,255,.93); color: #1f1d3b; border: 1px solid rgba(27,35,48,.12); font: 500 11px/1 var(--font); padding: 3px 7px 3px 6px; }
.o3dlabels .o3tag.human { background: rgba(244,240,232,.95); }
.o3dlabels .o3tag i { width: 7px; height: 7px; background: #9aa4ae; }
.o3dlabels .o3tag.st-working i { background: #2e9d5b; } .o3dlabels .o3tag.st-paused i { background: #d99413; } .o3dlabels .o3tag.st-error i { background: #d2412f; }
.o3dlabels .o3tag.st-off, .o3dlabels .o3tag.st-away, .o3dlabels .o3tag.st-soon { opacity: .55; } .o3dlabels .o3tag.st-soon { font-style: italic; }
.o3dlabels .o3bub { background: #fff; color: #1f1d3b; border: 1px solid rgba(27,35,48,.12); box-shadow: 0 2px 8px rgba(0,0,0,.12); translate: -50% calc(-100% - 22px); }
.o3dlabels .o3bub.bad { background: #fde6e2; } .o3dlabels .o3bub.warn { background: #fff3d6; } .o3dlabels .o3bub.client { background: #dcf5d9; border-color: #b9e3b4; color: #1d4b2d; }
.ostage.is3d { background: #e3e6ef; }

/* 3D на узком экране: короче подписи, кнопки отделов — одной строкой с прокруткой */
@media (max-width: 760px) {
  .o3focus { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .o3focus::-webkit-scrollbar { display: none; }
  .o3focus button { flex: none; font-size: 11px; padding: 3px 9px; }
  .o3dlabels .o3room { font-size: 10px; padding: 3px 6px; max-width: 120px; }
  .o3dlabels .o3room small { display: none; }
  .o3dlabels .o3tag { font-size: 9.5px; padding: 2px 5px; }
  .o3dlabels .o3bub { font-size: 10px; max-width: 140px; }
}

/* Легенда статусов — внутри окна офиса */
.ostage .olegend { position: absolute; left: 12px; bottom: 12px; z-index: 6; margin: 0; padding: 6px 10px; border-radius: 14px; background: rgba(255,255,255,.86); color: #1f1d3b;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11.5px; max-width: calc(100% - 24px); box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.orule { margin: 8px 14px 12px; }
/* Связи агентов */
.o3link { position: absolute; left: 0; top: 0; translate: -50% -50%; font: 600 10.5px/1.2 var(--font); color: #1f1d3b; background: rgba(255,255,255,.92); border: 1.5px solid var(--c); border-radius: 999px; padding: 2px 8px; white-space: nowrap; pointer-events: none; }
.o3links { position: absolute; right: 12px; top: 52px; z-index: 5; width: 250px; max-height: calc(100% - 120px); overflow: auto; background: rgba(255,255,255,.88); color: #1f1d3b; border-radius: 16px; padding: 10px 12px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 11.5px; display: flex; flex-direction: column; gap: 5px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.o3links strong { font-size: 12px; margin-bottom: 2px; }
.o3links div { display: flex; gap: 7px; align-items: baseline; line-height: 1.3; }
.o3links i { flex: none; width: 8px; height: 8px; border-radius: 3px; translate: 0 1px; }
.o3links[hidden] { display: none; }
.o3zoom { position: absolute; right: 12px; bottom: 12px; z-index: 6; display: flex; flex-direction: column; gap: 6px; }
.o3zoom button { width: 38px; height: 38px; border-radius: 12px; border: 1.5px solid rgba(255,255,255,.9); background: rgba(255,255,255,.88); color: #1f1d3b; font: 700 18px var(--font); cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.o3zoom button[aria-pressed="true"] { background: #2b2358; color: #fff; border-color: #2b2358; }
@media (max-width: 760px) {
  .o3links { left: 12px; right: auto; top: auto; bottom: 56px; width: auto; max-width: calc(100% - 70px); max-height: 38%; font-size: 10.5px; }
  .o3link { font-size: 9px; padding: 1px 6px; }
  .ostage .olegend { font-size: 10px; gap: 2px 8px; }
}

.o3links { gap: 4px; }
.o3links > div { display: none; }
.o3links.open > div { display: flex; }
.o3linkshead { border: 0; background: none; padding: 0; font: 700 12px var(--font); color: #1f1d3b; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.o3linkshead::after { content: '▾'; font-size: 11px; transition: transform .2s; }
.o3links.open .o3linkshead::after { transform: rotate(180deg); }
.o3links:not(.open) { width: auto; padding: 7px 12px; }

/* ===== Разделы из вкладок (ИИ-агенты, Настройки) — решение владельца 13.11.2026 ===== */
.hubhead { padding: 6px; border-radius: 999px; align-self: flex-start; max-width: 100%; }
.hubtabs { display: flex; gap: 4px; overflow-x: auto; }
.hubtab { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--ink2); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.hubtab:hover { background: var(--soft2); }
.hubtab[aria-selected="true"], .hubtab[aria-selected="true"]:hover { background: var(--navy); color: var(--on); }
.hubbody { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mtitle, .tabbar, .pmviews { display: none; }

/* ===== Телефон: сверху — название раздела и профиль, снизу — 4 срочных раздела ===== */
@media (max-width: 900px) {
  .shell { padding: 8px 8px calc(84px + env(safe-area-inset-bottom)); gap: 8px; }
  .side { position: sticky; top: 8px; z-index: 20; overflow: visible; -webkit-mask-image: none; mask-image: none; padding: 6px 6px 6px 14px; gap: 8px; min-height: 52px; border-radius: 999px; }
  #navItems .nav { display: none; }
  .mtitle { display: block; flex: 1 1 auto; min-width: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; order: -2; }
  .profile { order: 5; position: static; box-shadow: none; background: var(--soft2); margin: 0; }
  .aistatus { order: 4; padding: 6px 10px; }
  .aistatus { font-size: 11px; }
  .tabbar:not(.hidden) { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 4px; position: fixed; z-index: 40; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); padding: 6px; border-radius: 26px; background: var(--surf); }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; border: 0; border-radius: 20px; background: transparent; color: var(--ink2); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; padding: 4px 2px; }
  .tab[aria-current="page"] { background: var(--navy); color: var(--on); }
  .ticon { position: relative; display: inline-flex; }
  .tlabel { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tbadge { position: absolute; top: -6px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #d4553d; color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
  /* открыт чат — нижняя панель не закрывает поле ввода */
  body:has(.chats.open) .tabbar { display: none; }
  body:has(.chats.open) .shell { padding-bottom: 8px; }
  .pmviews { display: flex; flex-direction: column; gap: 2px; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--edge); }
  .pmenu { max-height: calc(100dvh - 24px); overflow-y: auto; }
  .pmi[aria-current="page"] { background: var(--soft); color: var(--navy); }
  .hubhead { align-self: stretch; border-radius: 22px; }

  /* компактно: меньше отступы и высота полей — больше видно без прокрутки */
  .panel { padding: 14px; gap: 10px; }
  .panel h2, .panel .h1 { font-size: 16px; }
  .h1 { font-size: 18px; }
  .inp { min-height: 42px; border-radius: 14px; }
  .btn { min-height: 42px; padding: 0 16px; }
  .btn2 { min-height: 38px; padding: 0 14px; }
  .row { padding: 10px 12px; gap: 8px; border-radius: 16px; }
  .field { gap: 4px; font-size: 12.5px; }
  .formgrid { gap: 10px; }
  .fgroup { gap: 8px; }
  .fgroup legend { margin-bottom: 6px; }
  .check { min-height: 40px; }
  .acts .btn, .acts .btn2 { min-height: 36px; padding: 0 12px; font-size: 13px; }
  .glass { border-radius: min(var(--r), 24px); }
}
.fold summary .pill { font-weight: 600; }
.arow { padding: 8px 12px; }
@media (max-width: 600px) {
  .hubtabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); width: 100%; }
  .hubtab { flex-direction: column; gap: 3px; min-height: 50px; padding: 4px 2px; font-size: 11px; justify-content: center; }
  .hubtab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .adv { padding: 0 12px; border-radius: 16px; }
  .adv summary { padding: 11px 0; font-size: 13.5px; }
}
/* Отдел агентов — сворачиваемый */
details.dept > summary { list-style: none; cursor: pointer; }
details.dept > summary::-webkit-details-marker { display: none; }
details.dept > summary h2::after { content: '›'; display: inline-block; margin-left: 8px; transform: rotate(90deg); color: var(--muted); transition: transform .15s; }
details.dept[open] > summary h2::after { transform: rotate(-90deg); }
details.dept:not([open]) { gap: 0; }
@media (max-width: 900px) {
  details.dept > summary { padding: 12px 14px; border-radius: 20px; background: var(--glass); border: 1.5px solid var(--edge); }
  .agintro .h1, .agintro > p.muted { display: none; }
  .agintro:has(.err:empty) { display: none; }
}
.tbadge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #d4553d; color: #fff; font-size: 10.5px; font-weight: 700; display: inline-grid; place-items: center; }
.hubtab .ticon { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 900px) { .hubtab .tbadge { position: absolute; top: -6px; right: -12px; } .hubtab .ticon { position: relative; } }
@media (min-width: 901px) { .hubtab .ticon { order: 0; } }
/* Телефон: короткие поля — по два в ряд */
@media (max-width: 600px) {
  .formgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 10px; }
  .formgrid > .field:has(textarea), .formgrid > .field:has(input[type="password"]), .formgrid > .field.wide { grid-column: 1 / -1; }
  details.dept > summary { background: var(--surf); }
}
/* Навигация поменьше (решение владельца 13.11.2026) */
.hubtab { min-height: 34px; padding: 0 12px; font-size: 13px; }
.hubhead { padding: 4px; }
@media (max-width: 900px) {
  .shell { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .side { min-height: 44px; padding: 4px 4px 4px 12px; top: 6px; }
  .mtitle { font-size: 15px; }
  .profile { padding: 2px; }
  .profile .pava { width: 32px; height: 32px; font-size: 13px; }
  .aistatus { padding: 4px 8px; font-size: 10.5px; }
  .tabbar:not(.hidden) { padding: 4px; gap: 2px; border-radius: 22px; bottom: calc(6px + env(safe-area-inset-bottom)); left: 10px; right: 10px; }
  .tab { min-height: 44px; gap: 2px; font-size: 10px; border-radius: 18px; }
  .tab svg { width: 17px; height: 17px; }
  .tbadge { top: -5px; right: -10px; min-width: 16px; height: 16px; font-size: 9.5px; }
}
@media (max-width: 600px) {
  .hubtab { min-height: 40px; gap: 2px; font-size: 10px; padding: 2px; }
  .hubtab svg { width: 15px; height: 15px; }
}

/* ===== Телефон: компактные кнопки навигации и страница без «плавания» (решение владельца 13.11.2026) ===== */
@media (max-width: 900px) {
  /* без эффекта «резинки» и сдвига вбок; фон не «фиксированный» — на телефонах он дёргается при прокрутке */
  html, body { overscroll-behavior: none; overflow-x: hidden; }
  body { background-attachment: scroll; -webkit-text-size-adjust: 100%; }
  /* верхняя строка и нижняя панель закреплены, страница прокручивается между ними */
  .side { position: fixed; top: calc(6px + env(safe-area-inset-top)); left: 8px; right: 8px; width: auto; transform: translateZ(0); }
  .shell { padding-top: calc(58px + env(safe-area-inset-top)); }
  .tabbar:not(.hidden) { display: flex; left: 50%; right: auto; width: auto; max-width: calc(100vw - 20px); transform: translateX(-50%) translateZ(0); gap: 2px; }
  .tab { flex: 0 0 auto; width: 68px; min-height: 42px; }
  .hubhead { align-self: flex-start; border-radius: 999px; }
}
@media (max-width: 600px) {
  .hubtabs { display: flex; width: auto; }
  .hubtab { flex: 0 0 auto; width: 62px; min-height: 40px; }
}

/* ===== Нижняя панель: только иконки, «капля» под активной кнопкой (решение владельца 13.11.2026) ===== */
@media (max-width: 900px) {
  .tabbar:not(.hidden) { position: fixed; gap: 0; padding: 5px; }
  .tab { position: relative; z-index: 1; width: 56px; min-height: 44px; border-radius: 999px; background: transparent !important; transition: color .25s; }
  .tab[aria-current="page"] { color: var(--on); }
  .tab .ticon svg { width: 21px; height: 21px; }
  .tdrop { position: absolute; z-index: 0; left: 0; top: 5px; bottom: 5px; border-radius: 999px; background: var(--navy); box-shadow: 0 6px 16px rgba(19, 91, 255, .35), inset 0 1px 0 rgba(255,255,255,.35); transform-origin: center; transition: width .3s, opacity .2s; will-change: transform; pointer-events: none; }
}
.tdrop { display: none; }
@media (max-width: 900px) { .tdrop { display: block; } }
/* Дашборд сервиса: столбики по месяцам */
.kpi.warn .v { color: #c26a12; }
.sdbars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; max-width: 760px; }
.sdcol { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.sdv { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sdbar { width: 100%; max-width: 54px; height: 140px; border-radius: 12px; background: var(--soft2); display: flex; flex-direction: column-reverse; overflow: hidden; }
.sda { background: var(--navy); }
.sdp { background: #CAFF34; }
.sdbar > span { display: block; width: 100%; }
.sdkey { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
@media (max-width: 600px) { .sdbars { gap: 6px; } .sdbar { height: 110px; } .sdv { font-size: 10px; } }
@media (max-width: 600px) { .hubtabs { overflow: visible; } .hubtab .tbadge { top: -4px; right: -10px; } }
@media (max-width: 600px) { .hubtab .ticon, .hubtab .tbadge { overflow: visible; max-width: none; } }

/* ===== Чат как в WhatsApp: цитата, «Пересланное», реакции, меню сообщения, стикеры (13.11.2026) ===== */
.bin, .bout { position: relative; }
.bquote { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--navy); border-radius: 8px; background: rgba(0,0,0,.05); padding: 5px 8px; margin: 0 0 4px; font: inherit; font-size: 12.5px; color: inherit; cursor: pointer; }
.bquote strong { color: var(--navy); font-size: 12px; }
.ell2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .8; }
.bfwd { display: flex; align-items: center; gap: 4px; font-size: 11.5px; font-style: italic; opacity: .65; margin-bottom: 2px; }
.bdel { font-size: 12px; font-style: italic; opacity: .7; margin-bottom: 2px; }
.deleted .btext, .deleted .bimg, .deleted .bfile, .deleted video, .deleted .baudio { opacity: .45; }
.deleted .btext { text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.bedit { font-size: 10.5px; opacity: .7; margin-right: 4px; font-style: italic; }
.breact { position: absolute; bottom: -12px; display: inline-flex; gap: 1px; padding: 1px 6px; border-radius: 999px; background: var(--surf); box-shadow: 0 2px 6px rgba(0,0,0,.15); font-size: 13px; line-height: 18px; }
.bin .breact { left: 10px; }
.bout .breact { right: 10px; }
.bin:has(.breact), .bout:has(.breact) { margin-bottom: 12px; }
.tick.read { color: #34b7f1; }
.bmenu { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.85); color: var(--ink2); cursor: pointer; opacity: 0; transition: opacity .15s; }
.bin:hover .bmenu, .bout:hover .bmenu, .bmenu:focus-visible { opacity: 1; }
@media (pointer: coarse) { .bmenu { display: none; } }
.flash { animation: bflash 1.2s ease; }
@keyframes bflash { 0%, 60% { box-shadow: 0 0 0 4px rgba(19, 91, 255, .35); } 100% { box-shadow: none; } }
.msgpop { position: fixed; z-index: 70; padding: 6px; border-radius: 18px; display: flex; flex-direction: column; gap: 2px; background: var(--surf); box-shadow: 0 18px 50px rgba(20, 18, 50, .25); }
.popreact { display: flex; justify-content: space-between; gap: 2px; padding: 2px 2px 6px; border-bottom: 1px solid var(--edge); margin-bottom: 4px; }
.remo { border: 0; background: transparent; font-size: 24px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; transition: transform .12s, background .12s; }
.remo:hover { transform: scale(1.18); background: var(--soft2); }
.remo.on { background: var(--lav); }
.replybar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 0 6px; border-radius: 14px; background: var(--soft); border-left: 3px solid var(--navy); }
.stkpanel { margin: 0 0 6px; padding: 10px; border-radius: 18px; background: var(--surf); box-shadow: 0 10px 30px rgba(20,18,50,.15); display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.stkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 6px; }
.stk { aspect-ratio: 1; border: 0; border-radius: 14px; background: var(--soft2); display: grid; place-items: center; cursor: pointer; padding: 4px; }
.stk img { width: 100%; height: 100%; object-fit: contain; }
.stk:hover { background: var(--lav); }
.stk.add { border: 1.5px dashed var(--edge); color: var(--ink2); }
.fwddlg { width: min(420px, calc(100vw - 24px)); padding: 16px; display: flex; flex-direction: column; gap: 10px; border: 0; }
.fwddlg::backdrop { background: rgba(31, 29, 59, .3); }
/* Узкая колонка чата: «Отправить» — иконкой, кнопки поля компактнее, чтобы текст не сжимался */
.thread { container-type: inline-size; }
@container (max-width: 560px) {
  .composer .box > .btn.sendbtn { padding: 0; width: 44px; min-width: 44px; justify-content: center; }
  .composer .sendtxt { display: none; }
  .composer .iconbtn { width: 34px; min-width: 34px; }
  .composer .box { gap: 2px; }
}
/* Живой РОП: выбор клиентов галочками */
.selbar { position: sticky; bottom: 0; z-index: 3; margin-top: 8px; padding: 10px; border-radius: 18px; background: var(--surf); box-shadow: 0 -6px 20px rgba(20,18,50,.12); display: flex; flex-direction: column; gap: 8px; }
.selbar select { max-width: 100%; flex: 1 1 160px; }
.cbox { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--edge); display: grid; place-items: center; align-self: center; background: var(--surf); }
.cbox.on { background: var(--navy); border-color: var(--navy); color: var(--on); }
.citem.picked { background: var(--lav); }
/* Вход через Google */
.gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; text-decoration: none; color: var(--ink); background: var(--surf); }
.ordiv { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.ordiv::before, .ordiv::after { content: ''; flex: 1; height: 1px; background: var(--edge); }

/* Кнопки оплаты Kaspi: значок + текст, без подчёркивания у ссылок-кнопок */
.kbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
a.btn, a.btn2 { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.kico { display: inline-grid; place-items: center; color: #e2382b; }
.btn .kico { color: inherit; }

/* Компьютер: компактнее кнопки, панели и окошки (решение владельца 13.11.2026) */
@media (min-width: 901px) {
  .btn { min-height: 38px; padding: 0 16px; font-size: 13.5px; }
  .btn2 { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
  .tbtn { min-height: 32px; padding: 0 11px; }
  .panel { padding: 16px 18px; gap: 10px; }
  .once { padding: 10px 12px; gap: 6px; border-radius: 16px; }
  .row { padding: 10px 12px; }
  .inp { min-height: 40px; border-radius: 14px; }
  .field { gap: 4px; }
  .formgrid { gap: 10px 16px; }
  .kpi { padding: 12px 14px; border-radius: 18px; }
  .kpi .v { font-size: 22px; }
  .toolbar { gap: 6px; }
  .acts .btn, .acts .btn2 { min-height: 34px; padding: 0 12px; }
}
@media (min-width: 901px) { .once .inp[type="tel"] { max-width: 320px; } .once .field { max-width: 360px; } }

/* ===== Гид-персонаж: обучение при первом входе (app/guide.js) =====
   Движение — минимализм (решение владельца 13.11.2026): только плавное проявление и масштаб,
   одна мягкая кривая, без прыжков, искр и конфетти. Только opacity/transform — легко для телефона. */
:root { --g-ease: cubic-bezier(.22, 1, .36, 1); }
html.gt-lock, html.gt-lock body { overflow: hidden; }
.gtour { position: fixed; inset: 0; z-index: 9000; opacity: 0; transition: opacity .35s var(--g-ease); }
.gtour.in { opacity: 1; }
.gtour.out { opacity: 0; transition-duration: .28s; }
/* Подсветка раздела: всё вокруг приглушено, тонкая рамка плавно переезжает */
.gspot { position: fixed; border-radius: 20px; box-shadow: 0 0 0 200vmax rgba(12, 14, 30, .42); outline: 2px solid rgba(255, 255, 255, .9); outline-offset: 2px; transition: left .5s var(--g-ease), top .5s var(--g-ease), width .5s var(--g-ease), height .5s var(--g-ease); pointer-events: none; }
.gspot.none { left: 50% !important; top: 40% !important; width: 0 !important; height: 0 !important; outline-color: transparent; }
.gstage { position: fixed; right: 28px; bottom: 24px; display: flex; align-items: flex-end; gap: 4px; max-width: calc(100vw - 32px); }
.gtour:not(.ready) .gbubble { visibility: hidden; }
.gbubble { position: relative; width: 380px; max-width: 100%; max-height: min(70vh, 560px); background: var(--surf); padding: 18px 20px 16px; border-radius: 24px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 24px 60px rgba(12, 14, 40, .22); margin-bottom: 30px; opacity: 0; transform: translateY(10px) scale(.98); transition: opacity .45s var(--g-ease), transform .45s var(--g-ease); }
.gtour.ready .gbubble { opacity: 1; transform: none; }
.gtour.out .gbubble { opacity: 0; transform: translateY(6px); transition-duration: .25s; }
.ghead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gskip { border: 0; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 4px 2px; }
.gskip:hover { color: var(--ink); }
.gtitle { margin: 0; font-size: 18px; line-height: 1.25; letter-spacing: -.2px; }
.glines { display: flex; flex-direction: column; gap: 10px; }
.gline { display: flex; flex-direction: column; gap: 2px; }
.gline p { margin: 0; font-size: 13.5px; line-height: 1.45; }
.glabel { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.gwhy { padding: 9px 12px; border-radius: 14px; background: var(--grey); transition: background .5s var(--g-ease); }
.gwhy.lit { background: rgba(202, 255, 52, .32); }
.gwhy .glabel { color: var(--ink); }
/* Смена шага: строки проявляются по очереди */
.gfade { opacity: 0; transform: translateY(6px); transition: opacity .4s var(--g-ease), transform .4s var(--g-ease); }
.gfade.in { opacity: 1; transform: none; }
.gnote { margin: 0; }
.gbtns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 2px; }
.gbtns .btn { min-width: 120px; }
/* Персонаж: проявляется снизу, едва заметно «дышит», позы меняются мягким перетеканием */
.gchar { position: relative; flex: none; width: 150px; height: 220px; border: 0; padding: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; opacity: 0; transform: translateY(14px); transition: opacity .5s var(--g-ease), transform .5s var(--g-ease); }
.gtour.in .gchar { opacity: 1; transform: none; }
.gtour.out .gchar { opacity: 0; transform: translateY(10px); transition-duration: .28s; }
.gchar:focus-visible { outline-offset: -6px; border-radius: 24px; }
.gbody { position: absolute; inset: 0; animation: gtFloat 4.5s ease-in-out infinite; }
@keyframes gtFloat { 50% { transform: translateY(-3px); } }
.gimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transform: scale(.97); transition: opacity .3s var(--g-ease), transform .45s var(--g-ease); pointer-events: none; user-select: none; -webkit-user-drag: none; }
.gimg.on { opacity: 1; transform: none; }
.gshadow { position: absolute; left: 26%; right: 26%; bottom: 2px; height: 8px; border-radius: 50%; background: rgba(12, 14, 40, .16); }
@media (max-width: 900px) {
  .gstage { left: 10px; right: 10px; bottom: calc(86px + env(safe-area-inset-bottom)); flex-direction: column-reverse; align-items: stretch; gap: 0; }
  .gbubble { width: auto; max-height: 52vh; margin: 0; padding: 14px 16px 12px; border-radius: 22px; gap: 8px; }
  .gchar { align-self: flex-end; margin: 0 10px -6px 0; }
  .gtitle { font-size: 16px; }
  .gline p { font-size: 13px; }
  .gbtns .btn { flex: 1; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .gtour, .gbubble, .gchar, .gimg, .gfade, .gspot { transition: none !important; }
  .gbody { animation: none !important; }
}

/* ===== Нижняя панель — адаптивная (решение владельца 13.11.2026) =====
   Ширина — по экрану (кнопки делят её поровну), размеры кнопок и иконок растут с экраном,
   снизу — всегда отступ над полоской «домой» iPhone, даже если браузер не сообщает её высоту. */
@media (max-width: 900px) {
  :root { --tb-gap: max(18px, calc(env(safe-area-inset-bottom) + 4px)); --tb-h: clamp(48px, 13.5vw, 58px); }
  .tabbar:not(.hidden) { left: 50%; right: auto; bottom: var(--tb-gap); width: min(calc(100vw - 24px), calc(var(--n, 4) * 104px)); max-width: none; padding: 5px; border-radius: 999px; justify-content: stretch; box-shadow: 0 12px 34px rgba(20, 24, 60, .18); }
  .tab { flex: 1 1 0; width: auto; min-width: 0; min-height: var(--tb-h); }
  .tab .ticon svg { width: clamp(20px, 5.8vw, 25px); height: clamp(20px, 5.8vw, 25px); }
  .tdrop { top: 5px; bottom: 5px; }
  .shell { padding-bottom: calc(var(--tb-gap) + var(--tb-h) + 22px); }
  .gstage { bottom: calc(var(--tb-gap) + var(--tb-h) + 18px); }
}
/* Широкий телефон боком и планшет: панель не растягивается на весь экран */
@media (max-width: 900px) and (min-width: 600px) {
  .tabbar:not(.hidden) { width: min(calc(100vw - 24px), calc(var(--n, 4) * 96px)); }
  :root { --tb-h: 52px; }
  .tab .ticon svg { width: 22px; height: 22px; }
}

/* ===== Свои значки вместо эмодзи (решение владельца 13.11.2026) ===== */
.zap { display: inline-block; width: .95em; height: .95em; margin: 0 .05em; vertical-align: -.1em; fill: #F5B700; stroke: none; }
.pill svg { flex: none; }
.ricon { display: block; }
.ricon.r_like { color: #135BFF; } .ricon.r_heart { color: #F0435A; fill: rgba(240, 67, 90, .18); } .ricon.r_fire { color: #FF7A1A; fill: rgba(255, 122, 26, .16); }
.ricon.r_laugh, .ricon.r_wow { color: #E09A00; } .ricon.r_pray { color: var(--navy); }
.remo { display: grid; place-items: center; font-size: 22px; }
.breact { align-items: center; padding: 2px 6px; gap: 3px; }
.gwhy .glabel { display: inline-flex; align-items: center; gap: 5px; }

/* ===== Телефон как нативное приложение: без зума и «плавания», компактный список чатов ===== */
@media (max-width: 900px) {
  html, body { touch-action: pan-x pan-y; -webkit-tap-highlight-color: transparent; }
  .chats .clist { background: transparent; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; border-radius: 0; padding: 2px 0 0; gap: 10px; overflow: visible; }
  .clist .search { height: 40px; min-height: 40px; border-radius: 14px; padding: 0 14px; font-size: 15px; background: var(--surf); border-color: transparent; }
  .clist > .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -8px; padding: 0 8px 2px; gap: 6px; -webkit-overflow-scrolling: touch; }
  .clist > .toolbar::-webkit-scrollbar { display: none; }
  .clist > .toolbar .tbtn { flex: none; min-height: 32px; padding: 0 12px; font-size: 13px; }
  .clist .items { gap: 0; margin: 0; padding: 0; overflow: visible; background: var(--surf); border-radius: 18px; }
  .citem { padding: 11px 12px; border-radius: 0; gap: 12px; position: relative; }
  .citem + .citem::before { content: ""; position: absolute; top: 0; left: 70px; right: 0; height: 1px; background: var(--grey); }
  .citem:first-child { border-radius: 18px 18px 0 0; } .citem:last-child { border-radius: 0 0 18px 18px; } .citem:only-child { border-radius: 18px; }
  .citem[aria-current="true"] { box-shadow: none; }
  .citem .av { flex-basis: 46px; height: 46px; font-size: 16px; }
  .citem .pill { font-size: 11px; padding: 1px 8px; min-height: 0; }
}
/* Гид: на телефоне компактнее, кнопки всегда видны (текст прокручивается внутри) */
.gscroll { display: flex; flex-direction: column; gap: 10px; overflow: auto; min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; }
.gbubble { overflow: hidden; }
@media (max-width: 900px) {
  .gscroll { gap: 8px; }
  .gwhy { padding: 8px 10px; }
  .glines { gap: 8px; }
  .gchar { width: 84px; height: 124px; }
}

/* ===== Телефон: минимализм в духе Apple на всех экранах (решение владельца 13.11.2026) =====
   Структура та же — убраны лишние слои: ровный фон без пятен, белые карточки без рамок, теней и «стекла»,
   вложенные блоки — серые без рамок, тише кнопки и поля, вкладки — как сегменты iOS. */
@media (max-width: 900px) {
  body { background: var(--bg1); }
  body::before { display: none; }
  /* карточки */
  .main .glass, .main .panel { background: var(--surf); border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; border-radius: 18px; }
  .main .panel { padding: 16px; gap: 12px; }
  .main { gap: 10px; }
  .h1 { font-size: 19px; letter-spacing: -.2px; }
  .panel h2 { font-size: 16px; letter-spacing: -.1px; }
  .muted, .small { letter-spacing: 0; }
  /* вложенные блоки — серая подложка без рамок */
  .main .row, .main .tile, .main .kpi, .main .once, .main .testlog { background: var(--grey); border: 0; box-shadow: none; border-radius: 14px; }
  /* плитки цифр прямо на фоне (дашборд) — белые, как карточки */
  .main .kpi { background: var(--surf); }
  .main .panel .kpi { background: var(--grey); }
  .main .kpi { padding: 12px 14px; }
  .main .kpi .v { font-size: 22px; }
  /* кнопки: главная — одна яркая, остальные — тихие серые без обводки */
  .btn { min-height: 42px; padding: 0 18px; font-size: 14.5px; }
  .btn2, .tbtn { border: 0 !important; background: var(--grey); }
  .btn2 { min-height: 38px; padding: 0 14px; font-size: 13.5px; }
  .tbtn { min-height: 32px; font-size: 12.5px; }
  .tbtn[aria-pressed="true"], .tbtn[aria-pressed="true"]:hover { background: var(--ink); color: var(--surf); }
  .btn2:hover, .tbtn:hover { background: var(--grey); }
  /* поля ввода — серые, без рамок; фокус — тонкое синее кольцо */
  .inp, .search, select.tbtn, .main select { border: 0 !important; background: var(--grey); border-radius: 12px; min-height: 42px; box-shadow: none; }
  .inp:focus, .search:focus { box-shadow: 0 0 0 2px rgba(19, 91, 255, .35); }
  .clist .search { background: var(--surf); }
  /* вкладки разделов — сегменты iOS: серая подложка, выбранная — белая */
  .hubhead { background: rgba(118, 118, 128, .12) !important; border: 0 !important; box-shadow: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; padding: 2px !important; border-radius: 12px !important; align-self: stretch; }
  .hubtabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); width: 100%; gap: 2px; }
  .hubtab { width: auto !important; min-height: 38px; border-radius: 10px !important; color: var(--ink2); }
  .hubtab[aria-selected="true"], .hubtab[aria-selected="true"]:hover { background: var(--surf) !important; color: var(--ink) !important; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
  /* значки-метки тише */
  .pill { font-weight: 500; }
  /* верхняя строка и нижняя панель — полупрозрачные, как в iOS */
  .side { background: color-mix(in srgb, var(--surf) 82%, transparent) !important; border: 0 !important; box-shadow: 0 1px 0 rgba(0, 0, 0, .06) !important; -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
  .tabbar:not(.hidden) { background: color-mix(in srgb, var(--surf) 86%, transparent) !important; border: 0 !important; box-shadow: 0 6px 24px rgba(0, 0, 0, .10) !important; -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
  /* раскрывающиеся блоки (пароль, входы, журнал) — серые, без рамок */
  .main details.adv { background: var(--grey); border: 0 !important; box-shadow: none; border-radius: 14px; }
  /* заголовок раздела уже есть в верхней строке — второй такой же в карточке не нужен */
  .h1.dup { display: none; }
}

/* ===== Телефон: крупнее и красивее, как в iOS (решение владельца 13.11.2026) =====
   Текст 15–16 px (поля — 16 px: iPhone не приближает страницу при вводе), заголовки крупнее,
   верхняя строка выше: крупное название раздела, аватар 38 px, статус ИИ — аккуратной капсулой. */
@media (max-width: 900px) {
  :root { --fs: 15px; }
  body { font-size: 15px; line-height: 1.45; }
  .small { font-size: 13.5px; }
  /* верхняя строка */
  .side { min-height: 58px !important; padding: 8px 8px 8px 18px !important; gap: 10px !important; border-radius: 22px !important; }
  .shell { padding-top: calc(76px + env(safe-area-inset-top)) !important; }
  .mtitle { font-size: 22px !important; font-weight: 700; letter-spacing: -.4px; }
  .profile .pava { width: 40px !important; height: 40px !important; font-size: 16px !important; }
  .aistatus { font-size: 12.5px !important; padding: 7px 12px !important; gap: 7px; font-weight: 600; }
  .aistatus .dot { width: 8px; height: 8px; }
  /* заголовки и текст в карточках */
  .h1 { font-size: 22px !important; letter-spacing: -.4px; }
  .panel h2, .main h2 { font-size: 19px !important; letter-spacing: -.3px; }
  .main p, .main li, .main label { font-size: 15px; }
  .main .muted.small, .main p.small { font-size: 14px; }
  .fgroup legend { font-size: 12.5px !important; }
  .field > span, .main label > span { font-size: 14px; }
  /* кнопки, поля, фильтры */
  .btn { min-height: 48px !important; font-size: 16px !important; padding: 0 22px !important; }
  .btn2 { min-height: 42px !important; font-size: 15px !important; }
  .tbtn { min-height: 36px !important; font-size: 14px !important; padding: 0 14px !important; }
  .inp, .search, .main select, select.tbtn { font-size: 16px !important; min-height: 46px !important; }
  .pill { font-size: 12.5px !important; padding: 3px 10px !important; }
  /* вкладки-сегменты: только подпись, крупнее */
  .hubtab { font-size: 13.5px !important; font-weight: 600; min-height: 40px !important; padding: 0 4px !important; }
  .hubtab svg { display: none; }
  .hubtab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* список чатов */
  .citem strong { font-size: 16.5px !important; }
  .citem .small { font-size: 14.5px !important; }
  .citem .av { flex-basis: 50px !important; height: 50px !important; font-size: 18px !important; }
  .citem + .citem::before { left: 74px; }
  /* цифры */
  .main .kpi .v { font-size: 28px !important; }
  .main .kpi .k, .main .kpi .d { font-size: 13.5px !important; }
  /* гид */
  .gtitle { font-size: 18px !important; }
  .gline p { font-size: 14.5px !important; }
}
@media (max-width: 900px) {
  /* пять и больше вкладок — чуть мельче, чтобы подписи не обрезались */
  .hubtabs:has(> :nth-child(5)) .hubtab { font-size: 12px !important; padding: 0 1px !important; letter-spacing: -.1px; }
}
@media (max-width: 360px) {
  .mtitle { font-size: 19px !important; }
  .hubtabs:has(> :nth-child(5)) .hubtab { font-size: 10.5px !important; }
  .aistatus #aistatusText { display: none; }
}
/* iPhone приближает страницу, если шрифт поля меньше 16 px. На сенсорных экранах все поля — 16 px: зума при вводе нет. */
@media (max-width: 900px), (pointer: coarse) {
  input, select, textarea, [contenteditable="true"] { font-size: 16px !important; }
}

/* ===== Телефон: поля и кнопки не сливаются с фоном (решение владельца 13.11.2026) ===== */
@media (max-width: 900px) {
  /* поля — белые с тонкой рамкой, как в iOS; на сером фоне тоже видны */
  .inp, .search, .main select, select.tbtn, .main textarea { background: var(--surf) !important; border: 1px solid rgba(60, 60, 67, .2) !important; border-radius: 12px !important; }
  .inp:focus, .search:focus, .main select:focus, .main textarea:focus { border-color: #135BFF !important; box-shadow: 0 0 0 3px rgba(19, 91, 255, .15) !important; outline: none; }
  .inp:disabled { background: var(--grey) !important; border-color: transparent !important; color: var(--muted); }
  /* тихие кнопки внутри серых блоков — белые, чтобы их было видно */
  .main :is(.row, .once, .tile, .kpi, details.adv, .testlog) :is(.btn2, .tbtn:not([aria-pressed="true"])) { background: var(--surf); box-shadow: 0 0 0 1px rgba(60, 60, 67, .12); }
  /* недоступная главная кнопка — спокойно-серая, а не бледно-салатовая */
  .btn:disabled { background: var(--grey) !important; color: var(--muted) !important; opacity: 1 !important; }
  /* ссылки-кнопки — без подчёркивания, фирменный синий */
  .main p a, .main .muted a, .linkbtn { color: #135BFF; text-decoration: none; font-weight: 600; }
  /* строки списков (команда, приглашения, номера): имя сверху, действия — ровной строкой под ним */
  .main .row:has(> .acts) > .grow { flex: 1 1 100%; }
  .main .row > .acts { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 8px; }
  .main .row > .acts select { flex: 1 1 160px; min-width: 0; min-height: 40px !important; max-width: 100%; }
  .main .row > .acts .btn, .main .row > .acts .btn2 { min-height: 40px !important; }
  /* поиск на доске — на всю ширину */
  .main .search { width: 100%; max-width: none !important; flex: 1 1 100%; }
  .main .toolbar > select.tbtn { flex: 1 1 auto; }
  .main .row > .acts select { text-overflow: ellipsis; padding-right: 30px; }
}

/* Презентация для клиентов в базе знаний */
.deckbox { background: var(--grey); border-radius: 16px; padding: 12px 14px; }
.deckbox .fext { width: 34px; height: 40px; }

/* ═══ Чаты как в WhatsApp + спокойный минималистичный стиль (13.11.2026) ═══ */
.thread { --wa-green: #1daa61; --paper: #faf9f5; --line2: #e8e5dc; }
[data-theme="dark"] .thread, [data-theme="dark"] .clist { --wa-green: #21c063; --paper: #1f1e1c; --line2: #3a3833; }
.clist { --wa-green: #1daa61; }
/* Список чатов */
.citem .cmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.citem .crow { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.citem .cname { font-size: 15px; font-weight: 600; }
.citem .ctime { flex: none; font-size: 12px; color: var(--muted); }
.citem.unread .ctime { color: var(--wa-green); font-weight: 600; }
.citem .cprev { font-size: 13.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; min-width: 0; }
.citem.unread .cprev { color: var(--ink); font-weight: 500; }
.citem .cout { color: var(--muted); display: inline-flex; flex: none; }
.citem .cflags { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.citem .cpin { color: var(--muted); display: inline-flex; }
.cunread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--wa-green); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.cunread.dot { min-width: 12px; width: 12px; height: 12px; padding: 0; }
.citem .ctags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.arcrow { padding: 10px 12px; gap: 14px; }
.arcrow .arcico { width: 40px; display: inline-flex; justify-content: center; color: var(--wa-green); }
.arcrow strong { font-size: 15px; font-weight: 600; }

/* Шапка переписки: компактно, как в WhatsApp; действия и этапы — по кнопке ⋮ на телефоне */
.thead { gap: 8px; }
.thead .htop { display: flex; align-items: center; gap: 4px; flex: 1 1 100%; min-width: 0; }
.thead .hwho { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 2px 4px; border-radius: 12px; text-align: left; color: inherit; cursor: pointer; font: inherit; }
.thead .hname { min-width: 0; display: flex; flex-direction: column; }
.thead .hname strong { font-size: 16px; }
.thead .back { display: none; }
.thead .hmore { display: none; }
@media (max-width: 900px) {
  .thead .back { display: inline-flex; }
  .thead .hmore { display: inline-flex; }
  .thead:not(.expanded) > .acts, .thead:not(.expanded) > .stagebar, .thead:not(.expanded) > .toolbar { display: none !important; }
  .thead { padding: 6px 6px 6px 2px !important; }
  .thead .av { width: 38px; height: 38px; font-size: 15px; }
  .thead.expanded { padding-bottom: 10px !important; }
}

/* Поиск по чату */
.findbar { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--line2); background: var(--surf); color: var(--muted); }
.findbar.hidden { display: none; }
.findbar .findin { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 16px; padding: 8px 6px; color: var(--ink); outline: none; }
.findbar .findn { font-size: 12.5px; white-space: nowrap; }
mark.hit { background: #ffe58a; color: inherit; border-radius: 3px; padding: 0 1px; }
[data-theme="dark"] mark.hit { background: #8a6d00; }

/* Переписка: свой узор-обои (не картинка WhatsApp), даты закреплены сверху, кнопка «вниз» */
.msgwrap { position: relative; flex: 1; min-height: 0; display: flex; }
.msgwrap > .msgs { flex: 1; }
.msgs { background-color: var(--wa-bg); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120' fill='none' stroke='%23000' stroke-opacity='.055' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 10h14a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-9l-5 4v-4a3 3 0 0 1-3-3v-8a3 3 0 0 1 3-3z'/%3E%3Cpath d='M62 8l2.4 5 5.6.8-4 3.9.9 5.5-4.9-2.6-4.9 2.6.9-5.5-4-3.9 5.6-.8z'/%3E%3Cpath d='M98 22a5 5 0 0 0-7-7l-1 1-1-1a5 5 0 0 0-7 7l8 8z'/%3E%3Cpath d='M22 62l-8 11h6l-2 9 8-12h-6l2-8z'/%3E%3Cpath d='M50 70l5 5 10-11'/%3E%3Cpath d='M84 60h18v12H84zM84 64h18'/%3E%3Cpath d='M30 100a6 6 0 1 0 0-12 6 6 0 0 0 0 12zM30 100v8'/%3E%3Cpath d='M70 96c4-6 12-6 16 0M74 92h.01M82 92h.01'/%3E%3Cpath d='M100 100l8-4v14l-8-4zM92 98h8v10h-8z'/%3E%3C/svg%3E"); background-size: 240px 240px; background-position: 0 0; }
[data-theme="dark"] .msgs { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120' fill='none' stroke='%23fff' stroke-opacity='.05' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 10h14a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-9l-5 4v-4a3 3 0 0 1-3-3v-8a3 3 0 0 1 3-3z'/%3E%3Cpath d='M62 8l2.4 5 5.6.8-4 3.9.9 5.5-4.9-2.6-4.9 2.6.9-5.5-4-3.9 5.6-.8z'/%3E%3Cpath d='M98 22a5 5 0 0 0-7-7l-1 1-1-1a5 5 0 0 0-7 7l8 8z'/%3E%3Cpath d='M22 62l-8 11h6l-2 9 8-12h-6l2-8z'/%3E%3Cpath d='M50 70l5 5 10-11'/%3E%3Cpath d='M84 60h18v12H84zM84 64h18'/%3E%3Cpath d='M30 100a6 6 0 1 0 0-12 6 6 0 0 0 0 12zM30 100v8'/%3E%3Cpath d='M70 96c4-6 12-6 16 0M74 92h.01M82 92h.01'/%3E%3Cpath d='M100 100l8-4v14l-8-4zM92 98h8v10h-8z'/%3E%3C/svg%3E"); }
.msgs .daysep { position: sticky; top: 6px; z-index: 2; }
.tobottom { position: absolute; right: 16px; bottom: 14px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--surf); color: var(--muted); box-shadow: 0 2px 10px rgba(11, 20, 26, .18); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; z-index: 3; }
.tobottom.hidden { display: none; }
.tobottom .fabn { position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--wa-green); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.tobottom .fabn.hidden { display: none; }
.bin.swiping, .bout.swiping { box-shadow: -3px 0 0 var(--wa-green), 0 1px .5px rgba(11, 20, 26, .13); }

/* Голосовое как в WhatsApp: кнопка, волна, время, скорость */
.baudio { min-width: 250px; }
.vplayer { display: flex; align-items: center; gap: 10px; padding: 2px 2px 0; }
.vplay { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; background: transparent; color: var(--wa-meta); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.vplay svg { fill: currentColor; }
.vmid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.vbars { height: 28px; display: flex; align-items: center; gap: 2px; cursor: pointer; outline: none; }
.vbars i { flex: 1; min-width: 2px; max-width: 4px; border-radius: 2px; background: rgba(17, 27, 33, .22); }
[data-theme="dark"] .vbars i { background: rgba(233, 237, 239, .25); }
.vbars i.on { background: var(--wa-tick); }
.vout .vbars i.on { background: #1f8a5b; }
.vrow { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--wa-meta); }
.vspeed { border: 0; border-radius: 10px; background: rgba(0, 0, 0, .07); color: var(--wa-meta); font: inherit; font-size: 11px; font-weight: 700; padding: 1px 7px; cursor: pointer; }
.bimg { cursor: zoom-in; }

/* Фото на весь экран */
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(11, 13, 16, .94); display: flex; flex-direction: column; color: #fff; animation: lbIn .18s ease; }
@keyframes lbIn { from { opacity: 0; } }
.lbtop { display: flex; align-items: center; gap: 6px; padding: max(10px, env(safe-area-inset-top)) 12px 6px 18px; }
.lbtop .lbcount { font-size: 14px; opacity: .8; }
.lbtop .grow { flex: 1; }
.lbbtn { color: #fff; }
.lbbtn:hover:not(:disabled) { background: rgba(255, 255, 255, .12); color: #fff; }
.lbstage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 8px; }
.lbimg { max-width: min(100%, 1200px); max-height: 100%; object-fit: contain; border-radius: 4px; user-select: none; }
.lbnav { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.lbnav:disabled { opacity: .25; cursor: default; }
@media (pointer: coarse) { .lbnav { display: none; } }
.lbcap { text-align: center; padding: 10px 16px max(16px, env(safe-area-inset-bottom)); font-size: 15px; }
.lbcap .lbtime { font-size: 12px; opacity: .6; margin-top: 2px; }

/* Поле ввода: одна спокойная карточка, мягкая тень, без двойных рамок */
.composer { padding: 8px 14px 14px; background: transparent; }
.composer .box { background: var(--surf); border: 1px solid var(--line2) !important; border-radius: 26px; padding: 6px 6px 6px 6px !important; gap: 2px !important; align-items: flex-end; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 22px rgba(0, 0, 0, .06); }
.composer .box:focus-within { border-color: #cfcabe !important; box-shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 28px rgba(0, 0, 0, .08) !important; }
[data-theme="dark"] .composer .box:focus-within { border-color: #57534b !important; }
.composer textarea { border: 0 !important; background: transparent !important; box-shadow: none !important; border-radius: 0 !important; padding: 10px 4px !important; min-height: 44px; font-size: 16px; line-height: 1.4; }
.composer textarea:focus { box-shadow: none !important; }
.composer .iconbtn { width: 40px !important; min-width: 40px !important; height: 44px; color: var(--muted); }
.composer .box > .btn.sendbtn { width: 44px; min-width: 44px; height: 44px; padding: 0 !important; border-radius: 50%; justify-content: center; background: var(--ink); color: var(--surf); flex: none; }
.composer .box > .btn.sendbtn svg { display: block; }
.composer .sendtxt { display: none; }
.composer .box:not(.hastext) > .sendbtn { display: none; }
.composer .box.hastext > .micbtn { display: none; }
.composer .box.blocked { opacity: .6; }
.aico { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.aico.a1 { background: #2f6bff; } .aico.a2 { background: #e8466a; } .aico.a3 { background: #7f66ff; }
.msgpop .pmi { align-items: center; }

/* Приветствие, когда чат не выбран */
.greet { margin: auto; width: min(620px, 92%); display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 40px 0; text-align: center; animation: grIn .4s ease both; }
@keyframes grIn { from { opacity: 0; transform: translateY(6px); } }
.grtitle { display: flex; align-items: center; gap: 14px; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; font-weight: 400; font-size: clamp(30px, 3.4vw, 42px); letter-spacing: -.01em; color: var(--ink); margin: 0; }
.grstar { width: 38px; height: 38px; fill: #FF805F; flex: none; }
.grsub { margin: 0; color: var(--muted); font-size: 15.5px; }
.grask { width: 100%; display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-radius: 22px; border: 1px solid var(--line2, #e8e5dc); background: var(--surf); color: var(--muted); font: inherit; font-size: 16px; text-align: left; cursor: text; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 26px rgba(0, 0, 0, .06); }
.grask:hover { border-color: #cfcabe; }
.grtiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.grtile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line2, #e8e5dc); background: transparent; color: var(--ink); font: inherit; cursor: pointer; text-align: left; }
.grtile:hover { background: var(--surf); }
.grtile .grn { font-size: 22px; font-weight: 700; }
.grtile .grl { font-size: 13px; color: var(--muted); }
.thread:has(> .greet) { background: var(--paper); }
/* В открытом чате на телефоне — только переписка (как в WhatsApp): общая шапка прячется */
@media (max-width: 900px) {
  body:has(.chats.open) #side { display: none; }
  body:has(.chats.open) .shell { padding-top: max(6px, env(safe-area-inset-top)) !important; padding-bottom: 6px !important; }
  body:has(.chats.open) .thread { height: calc(100dvh - max(6px, env(safe-area-inset-top)) - 6px) !important; }
}
/* Фильтры — одной строкой с прокруткой */
.clist > .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.clist > .toolbar::-webkit-scrollbar { display: none; }
.clist > .toolbar > * { flex: none; }
/* Пока чат не выбран — без пустой колонки карточки */
@media (min-width: 1101px) {
  .chats:not(.open) { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); }
  .chats:not(.open) .ccard { display: none; }
}
.msgs { background-size: 150px 150px; }
.clist > .toolbar, .clist > .search { flex: none; }
.citem .cmed { display: inline-flex; color: var(--muted); margin-right: 2px; }
