/* Главная, «Входящие», чат и мобильная версия. Базовые токены и компоненты — в styles.css */

.mob, .mob-inline { display: none; }
.desk-inline { display: inline; }
.desk-flex { display: inline-flex; }
.tabbar, .fab { display: none; }
.icon.flip { transform: rotate(180deg); }
.nav-item .badge.soft, .badge.soft { background: var(--border-strong); color: var(--text); }
.sidebar .badge.soft { background: rgba(255,255,255,.18); color: #fff; }
.me-card.active { outline: 2px solid rgba(58,170,140,.5); }
.badge { display: inline-block; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; flex: none; }
.link-btn { border: 0; background: none; color: var(--brand-ink); font-weight: 500; font-size: 13px; padding: 0; display: inline-flex; align-items: center; gap: 6px; }
.link-btn:hover { text-decoration: underline; }
.logout-btn { width: 100%; margin-top: 4px; }
input[type=search]::-webkit-search-cancel-button { display: none; }

/* ---------- чипы-фильтры ---------- */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--text-2); font-weight: 500; font-size: 13px;
  transition: all .12s;
}
.chip .av { margin-left: -6px; }
.chip span { color: var(--text-3); font-size: 12px; }
.chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.chip.on { background: var(--text); border-color: var(--text); color: #fff; }
.chip.on span { color: rgba(255,255,255,.7); }

/* ---------- подсказка «@» и упоминания ---------- */
.suggest { position: fixed; z-index: 95; width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; animation: fade .1s; }
.suggest button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: none; text-align: left; }
.suggest button.on, .suggest button:hover { background: var(--brand-tint); }
.suggest small { display: block; color: var(--text-3); font-size: 12px; }
.mention { color: var(--brand-ink); background: var(--brand-tint); border-radius: 4px; padding: 0 3px; font-weight: 500; }
.mention.me, .mention.all { background: #FFF1C2; color: #7A5300; }

/* ---------- меню-шторка (телефон) и маленькие диалоги ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 90; background: rgba(20,28,29,.45); display: flex; align-items: flex-end; animation: fade .15s; }
.sheet { width: 100%; max-height: 85dvh; overflow-y: auto; background: var(--surface); border-radius: 18px 18px 0 0; padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); animation: slideup .22s cubic-bezier(.2,.7,.3,1); }
@keyframes slideup { from { transform: translateY(100%); } }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 4px auto 8px; }
.sheet-title { padding: 4px 10px 10px; font-size: 13px; color: var(--text-3); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet button { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px; padding: 0 12px; border: 0; border-radius: 12px; background: none; text-align: left; font-size: 16px; }
.sheet button:active { background: var(--surface-2); }
.sheet button.danger { color: var(--danger); }
.sheet button .icon { width: 20px; height: 20px; color: var(--text-2); }
.sheet button.danger .icon { color: var(--danger); }
.sheet .on .check-mark { margin-left: auto; color: var(--brand); }
.sheet hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.sheet-cancel { justify-content: center; font-weight: 600; margin-top: 6px; background: var(--surface-2) !important; }
.overlay.small .modal.dialog { width: min(440px, 100%); }
.dialog textarea { width: 100%; min-height: 110px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; outline: 0; resize: vertical; }
.dialog .modal-foot { justify-content: flex-end; }
.picker-dialog .search.wide { width: 100%; }
.picker-dialog .search.wide:focus-within { width: 100%; }
.pp-list { margin-top: 10px; max-height: 50dvh; overflow-y: auto; }
.pp-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; text-align: left; }
.pp-list button:hover { background: var(--brand-tint); }
.pp-list small { display: block; color: var(--text-3); font-size: 12px; }
.grow { flex: 1; min-width: 0; }

/* ---------- главная ---------- */
.dash-scroll { background: var(--bg); }
.dash { max-width: 1120px; margin: 0 auto; padding: 28px 28px 80px; }
.dash-hello { text-align: center; margin: 8px 0 24px; }
.dash-date { color: var(--text-2); font-size: 14px; }
.dash-date::first-letter { text-transform: uppercase; }
.dash-hello h1 { margin: 4px 0 0; font-size: 30px; font-weight: 600; letter-spacing: -.6px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.tile {
  position: relative; text-align: left; border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 2px; min-height: 112px;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.tile[data-action]:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--border-strong); }
.tile-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand-ink); margin-bottom: 8px; }
.tile-num { font-size: 28px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1; }
.tile-label { color: var(--text-2); font-size: 13px; }
.tile-sub { color: var(--text-3); font-size: 12px; }
.tile.alarm .tile-ico { background: var(--danger-tint); color: var(--danger); }
.tile.alarm .tile-sub { color: var(--danger); font-weight: 500; }
.tile.warn .tile-ico { background: var(--warn-tint); color: var(--warn); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dcard { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; min-width: 0; }
.dcard-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dcard-head h3 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex: 1; }
.dcard-head h3 .icon { color: var(--brand-ink); }
.dash-rem { padding: 8px 2px; }
.dash-rem .meta { flex-wrap: wrap; }
.dash-rem .link-btn { color: var(--text-2); font-weight: 400; }
.dash-empty { display: flex; gap: 8px; align-items: center; color: var(--text-3); font-size: 13px; padding: 14px 4px; }
.dash-empty .icon { color: var(--brand); }
.dash-row, .dash-chat { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 6px; border: 0; border-radius: 10px; background: none; text-align: left; }
.dash-row:hover, .dash-chat:hover { background: var(--surface-2); }
.dash-row small, .dash-chat small { display: block; color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row b, .dash-chat b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.dcard .in-item { border: 0; border-radius: 10px; margin: 0; }
.dcard .in-card { padding: 8px 6px; }
.dcard .in-card .av { --s: 28px !important; }

/* ---------- «Входящие» ---------- */
.inbox-list { max-width: 860px; padding: 4px 24px 100px; }
.in-group { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); padding: 16px 4px 6px; }
.in-item { position: relative; overflow: hidden; border-radius: 12px; margin-bottom: 4px; }
.in-swipe { position: absolute; inset: 0; display: none; align-items: center; gap: 8px; padding: 0 22px; color: #fff; font-weight: 600; font-size: 14px; }
.in-swipe.left { background: #B8860B; justify-content: flex-start; }
.in-swipe.right { background: var(--brand); justify-content: flex-end; }
.swiping-right .in-swipe.left, .swiping-left .in-swipe.right { display: flex; }
.in-card {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 12px 12px 18px; background: var(--surface); cursor: pointer;
  border: 1px solid transparent; border-radius: 12px; transition: background .1s, border-color .1s;
}
.in-card:hover { background: #F9FAFA; border-color: var(--border); }
.in-dot { position: absolute; left: 6px; top: 24px; width: 7px; height: 7px; border-radius: 50%; background: transparent; }
.in-item.unread .in-dot { background: var(--brand); }
.in-item.unread .in-head { font-weight: 500; }
.in-main { flex: 1; min-width: 0; }
.in-head { font-size: 14px; color: var(--text); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; line-height: 1.4; }
.in-head b { font-weight: 600; }
.in-target { display: inline-flex; align-items: center; gap: 5px; border: 0; background: var(--surface-2); border-radius: 999px; padding: 1px 8px 1px 3px; font-size: 13px; color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
span.in-target { padding-left: 6px; }
button.in-target:hover { background: var(--brand-tint); color: var(--brand-ink); }
.in-text { color: var(--text-2); font-size: 13px; margin-top: 3px; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.in-text.quote { border-left: 3px solid var(--border-strong); padding-left: 8px; }
.in-main .req-lines { font-size: 13px; }
.in-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.in-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.in-when { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.in-tools { display: flex; gap: 2px; opacity: 0; transition: opacity .1s; }
.in-card:hover .in-tools { opacity: 1; }
.in-tools .icon-btn { width: 28px; height: 28px; }
.in-tools .icon-btn.on { color: #B8860B; }
.in-pin-mark { color: #B8860B; }
.in-item.pinned .in-card { background: #FFFDF2; }
.swipe-hint { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 16px; }

/* ---------- чат ---------- */
body[data-view="chat"] .main { overflow: hidden; }
.chat { flex: 1; min-height: 0; display: grid; grid-template-columns: 264px minmax(0, 1fr); background: var(--surface); }
.chat.with-thread { grid-template-columns: 264px minmax(0, 1fr) 380px; }
.chat > * { min-width: 0; }
.ch-thread:empty { display: none; }
.ch-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--surface-2); }
.ch-list-head { display: flex; align-items: center; padding: 16px 12px 8px 16px; }
.ch-list-head h2 { margin: 0; font-size: 20px; font-weight: 600; flex: 1; }
.ch-items { overflow-y: auto; padding: 0 8px 12px; }
.ch-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; text-align: left; }
.ch-item:hover { background: rgba(0,0,0,.04); }
.ch-item.active { background: var(--brand-tint-2); }
.ch-item .ch-ico { background: var(--surface); }
.ch-item.active .ch-ico { background: var(--brand); color: #fff; }
.ch-name { flex: 1; min-width: 0; }
.ch-name b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-name small { display: block; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-item.has-unread b { font-weight: 700; }
.ch-item.has-unread small { color: var(--text-2); }
.ch-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.ch-meta time { font-size: 11px; color: var(--text-3); }
.ch-main, .ch-thread { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ch-thread { border-left: 1px solid var(--border); }
.ch-main.dragging::after, .ch-thread.dragging::after { content: "Отпустите, чтобы прикрепить"; position: absolute; inset: 8px; border: 2px dashed var(--brand); border-radius: 14px; background: rgba(232, 246, 241, .92); display: grid; place-items: center; font-weight: 600; color: var(--brand-ink); z-index: 5; pointer-events: none; }
.ch-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); min-height: 56px; }
.ch-title { flex: 1; min-width: 0; }
.ch-title b { display: block; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-title small { display: block; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-msgs { flex: 1; overflow-y: auto; padding: 12px 0 8px; overscroll-behavior: contain; }
.ch-empty { text-align: center; color: var(--text-2); padding: 60px 24px; }
.ch-empty .icon { width: 36px; height: 36px; color: var(--brand); }
.ch-empty h3 { color: var(--text); margin: 10px 0 4px; }
.load-older { display: block; margin: 0 auto 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 14px; font-size: 13px; color: var(--text-2); }
.day-sep { display: flex; align-items: center; gap: 10px; margin: 14px 16px 6px; color: var(--text-3); font-size: 12px; font-weight: 500; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.th-divider { display: flex; align-items: center; gap: 10px; margin: 6px 16px; color: var(--text-3); font-size: 12px; }
.th-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

.msg { position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 10px; padding: 6px 16px 4px; }
.msg.grouped { padding-top: 1px; }
.msg:hover { background: #F7F9F9; }
.msg.flash { animation: flash 2s ease; }
@keyframes flash { 0%, 30% { background: #FFF5C7; } }
.msg-gutter { display: flex; justify-content: center; }
.msg-gutter time { font-size: 10px; color: transparent; padding-top: 4px; }
.msg.grouped:hover .msg-gutter time { color: var(--text-3); }
.msg-body { min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-head b { font-weight: 600; }
.msg-head time, .msg-head .edited { font-size: 12px; color: var(--text-3); }
.msg-text { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.msg-text a { word-break: break-all; }
.msg.deleted i { color: var(--text-3); font-size: 13px; }
.msg-tools { position: absolute; right: 12px; top: -12px; display: none; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 2px; box-shadow: var(--shadow-sm); }
.msg:hover .msg-tools { display: flex; }
.msg-tools .icon-btn { width: 30px; height: 30px; }
.pcards { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-width: 420px; }
.pcard { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 10px; background: var(--surface); text-align: left; width: 100%; }
.pcard:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.pcard b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard small { display: block; font-size: 12px; color: var(--text-3); }
.pcard-mgr { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); flex: none; }
.pcard.missing { color: var(--text-3); border-left-color: var(--border-strong); }
.m-imgs { display: grid; gap: 4px; margin-top: 6px; max-width: 420px; }
.m-imgs.n1 { grid-template-columns: 1fr; }
.m-imgs.n2 { grid-template-columns: 1fr 1fr; }
.m-imgs.n3 { grid-template-columns: 1fr 1fr 1fr; }
.m-img { padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--surface-2); aspect-ratio: 4 / 3; }
.m-imgs.n1 .m-img { aspect-ratio: auto; max-height: 320px; }
.m-img img { width: 100%; height: 100%; object-fit: cover; }
.m-video { display: block; margin-top: 6px; max-width: min(420px, 100%); max-height: 320px; border-radius: 10px; background: #000; }
.m-voice { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 4px 6px 4px 12px; background: var(--brand-tint); border-radius: 999px; width: fit-content; max-width: 100%; }
.m-voice .icon { color: var(--brand-ink); }
.m-voice audio { height: 36px; max-width: 260px; }
.m-file { margin-top: 6px; max-width: 420px; text-decoration: none; color: inherit; }
.m-file .name { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-file .meta { display: block; font-size: 12px; color: var(--text-3); }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.react { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 14px; }
.react span { font-size: 12px; color: var(--text-2); font-weight: 500; }
.react.mine { background: var(--brand-tint); border-color: var(--brand); }
.react.mine span { color: var(--brand-ink); }
.react.add { color: var(--text-3); opacity: 0; }
.msg:hover .react.add { opacity: 1; }
.th-sum { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 3px 8px 3px 3px; border: 1px solid transparent; border-radius: 8px; background: none; font-size: 13px; }
.th-sum .av { --s: 20px; }
.th-sum b { color: var(--brand-ink); font-weight: 600; }
.th-sum span { color: var(--text-3); font-size: 12px; }
.th-sum:hover { border-color: var(--border); background: var(--surface); }
.emoji-pop { position: fixed; z-index: 90; display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); animation: fade .1s; }
.emoji-pop button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; font-size: 20px; transition: transform .1s; }
.emoji-pop button:hover { background: var(--surface-2); transform: scale(1.2); }

.composer { padding: 8px 14px 12px; border-top: 1px solid var(--border); background: var(--surface); }
.composer.sending { opacity: .6; pointer-events: none; }
.comp-row { display: flex; align-items: flex-end; gap: 4px; border: 1px solid var(--border-strong); border-radius: 14px; padding: 4px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.comp-row:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.comp-row textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: none; padding: 7px 6px; line-height: 1.45; max-height: 200px; min-height: 36px; }
.comp-row .icon-btn { width: 36px; height: 36px; }
.send-btn { width: 38px; height: 38px; flex: none; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; transition: background .15s, color .15s, transform .1s; }
.send-btn:hover { background: var(--brand-tint); color: var(--brand-ink); }
.send-btn.ready { background: var(--brand); color: #fff; }
.send-btn:active { transform: scale(.94); }
.att { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 4px 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-size: 13px; max-width: 240px; }
.att-chip.img { padding-left: 3px; }
.att-chip img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.att-chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-chip button { width: 24px; height: 24px; border: 0; background: none; border-radius: 50%; display: grid; place-items: center; color: var(--text-3); flex: none; }
.att-chip button:hover { background: var(--border); color: var(--text); }
.rec-bar { display: flex; align-items: center; gap: 10px; flex: 1; padding-left: 10px; min-height: 38px; color: var(--text-2); font-size: 14px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }

/* ---------- быстрые действия в карточке (телефон) ---------- */
.quick { display: none; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin: -4px 0 16px; }
.quick-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px; border: 0; border-radius: 14px; background: var(--brand-tint); color: var(--brand-ink); font-size: 12px; font-weight: 500; text-decoration: none; min-width: 0; white-space: nowrap; }
.quick-btn:active { background: var(--brand-tint-2); }

/* ======================================================================
   Телефон: нижняя панель, полноэкранные карточки, шторки, крупные цели
   ====================================================================== */
@media (max-width: 760px) {
  :root { --tabbar-h: calc(60px + env(safe-area-inset-bottom)); }
  html, body { height: 100%; overscroll-behavior-y: none; }
  body { font-size: 15px; background: var(--surface); -webkit-tap-highlight-color: transparent; }
  input, textarea, select { font-size: 16px !important; }  /* иначе iPhone приближает страницу */

  .mob { display: flex; }
  .mob-inline { display: inline; }
  .desk, .desk-inline, .desk-flex { display: none !important; }

  .app { grid-template-columns: 1fr; height: 100dvh; }
  .sidebar { display: none; }
  .main { height: 100dvh; padding-bottom: var(--tabbar-h); }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255,255,255,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
  }
  .tab-btn { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; color: var(--text-3); font-size: 11px; font-weight: 500; }
  .tab-btn .icon { width: 24px; height: 24px; stroke-width: 1.9; }
  .tab-btn .av { --s: 26px !important; }
  .tab-btn.active { color: var(--brand-ink); }
  .tab-btn.active .icon { stroke-width: 2.3; }
  .tab-btn.active .av { box-shadow: 0 0 0 2px var(--brand); }
  .tab-btn .badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
  .tab-btn .badge.soft { background: var(--text-2); }
  .fab:not([hidden]) {
    display: grid; place-items: center; position: fixed; z-index: 16;
    right: 16px; bottom: calc(var(--tabbar-h) + 16px); width: 58px; height: 58px; border: 0; border-radius: 50%;
    background: var(--grad); color: #fff; box-shadow: 0 8px 24px rgba(0,150,168,.35);
  }
  .fab .icon { width: 26px; height: 26px; stroke-width: 2.4; }
  .fab:active { transform: scale(.94); }

  /* шапка: крупный заголовок, как в мобильной Asana */
  .topbar { flex-wrap: wrap; padding: calc(10px + env(safe-area-inset-top)) 16px 6px; min-height: 0; gap: 8px; }
  .page-icon { display: none; }
  .page-title h1 { font-size: 28px; font-weight: 700; letter-spacing: -.6px; }
  .page-title .sub { display: none; }
  .topbar-right { margin-left: auto; }
  .topbar .search { display: flex; order: 3; width: 100% !important; height: 42px; border-radius: 12px; background: var(--surface-2); border-color: transparent; }
  .topbar .search kbd { display: none; }
  .topbar-right:has(.search) { flex: 1 1 100%; order: 3; }
  .tabs { padding: 4px 16px 0; gap: 18px; overflow-x: auto; scrollbar-width: none; }
  .tab { padding: 10px 0 12px; font-size: 15px; white-space: nowrap; }
  .toolbar { padding: 8px 16px; gap: 8px; }
  .toolbar .chips { flex: 1; margin-left: -16px; padding-left: 16px; margin-right: -8px; }
  .toolbar .grow { display: none; }
  .chip { height: 36px; font-size: 14px; }
  .icon-btn { width: 40px; height: 40px; }
  .btn.sm { height: 34px; }
  .content { padding-bottom: 96px; }

  /* список пациентов карточками */
  .mlist { padding: 0 8px; }
  .mrow { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 14px; }
  .mrow:active, .mrow.selected { background: var(--brand-tint); }
  .mrow + .mrow { border-top: 1px solid var(--border); border-radius: 0; }
  .mrow-main { flex: 1; min-width: 0; }
  .mrow-top { display: flex; align-items: center; gap: 6px; }
  .mrow-top .nm { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mrow-top .nm.empty { color: var(--text-3); font-weight: 500; }
  .mrow-sub { color: var(--text-2); font-size: 13px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mrow-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
  .mrow-side .pill { padding: 0 6px; }
  .empty-state { padding: 48px 20px; }

  /* карточка пациента — на весь экран */
  .pane { width: 100vw; border-left: 0; box-shadow: none; z-index: 30; padding-top: env(safe-area-inset-top); }
  .pane-bar { padding: 6px 6px; gap: 2px; min-height: 52px; }
  .pane-title { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
  .pane-bar .saved { position: absolute; right: 56px; top: 18px; }
  .pane-inner { padding: 14px 16px 20px; }
  .p-head { gap: 14px; margin-bottom: 14px; }
  .p-names input { font-size: 22px !important; }
  .quick { display: grid; }
  .pending-item { flex-wrap: wrap; }
  .pending-item .acts { flex: 1 1 100%; justify-content: flex-start; padding-left: 34px; }
  .pending-item .acts .btn { flex: 1; height: 38px; }
  .fields { grid-template-columns: 96px 1fr; }
  .contact-top .label-input { width: 120px; }
  .add-row { flex-wrap: wrap; }
  .add-row input { flex: 1 1 100%; height: 42px !important; }
  .add-row .btn { flex: 1; height: 40px; }
  .rem-form .row2 { flex-wrap: wrap; }
  .rem-form .row2 input { flex: 1 1 100%; }
  .rem-form .row2 .btn { flex: 1; height: 42px; }
  .presets { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .preset { flex: none; height: 34px; }
  .activity { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
  .comment-box .grow { flex-direction: row; align-items: flex-end; }
  .comment-box textarea { flex: 1; }
  .note-meta .acts, .comment .who .icon-btn { opacity: 1 !important; }
  .thumbs { grid-template-columns: repeat(3, 1fr); }
  .dropzone { padding: 16px; font-size: 14px; }

  /* формы — на весь экран, кнопка снизу */
  .overlay { padding: 0; display: flex; align-items: stretch; }
  .modal { flex: 1; min-width: 0; width: 100%; height: 100dvh; max-height: none; border-radius: 0; }
  .modal * { min-width: 0; }
  .modal-head { padding: calc(8px + env(safe-area-inset-top)) 8px 4px; gap: 4px; }
  .modal-head h2 { font-size: 18px; }
  .modal-head .icon-btn.mob { margin-left: 0; }
  .finder .btn.lg span { display: none; }
  .modal-body { padding: 8px 16px 16px; }
  .modal-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .modal-foot .btn.primary { flex: 1; height: 48px; font-size: 16px; }
  .finder .field { height: 48px; }
  .finder .btn.lg { height: 48px; padding: 0 14px; }
  .f input, .f select { height: 44px; }
  .overlay.small { display: flex; align-items: flex-end; background: rgba(20,28,29,.45); }
  .overlay.small .modal.dialog { width: 100%; height: auto; max-height: 90dvh; border-radius: 18px 18px 0 0; animation: slideup .22s cubic-bezier(.2,.7,.3,1); }
  .overlay.small .modal-foot .btn { flex: 1; height: 46px; }
  .picker-dialog .pp-list { max-height: 55dvh; }

  .toasts { left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 12px); }
  body.pane-open .toasts, body[data-chat-screen="channel"] .toasts, body[data-chat-screen="thread"] .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .toast.reminder { width: auto; }
  .lb-stage { padding: 0 0 calc(16px + env(safe-area-inset-bottom)); }
  .lb-nav { display: none; }

  /* главная */
  .dash { padding: calc(14px + env(safe-area-inset-top)) 14px 100px; }
  .dash-hello { text-align: left; margin: 4px 4px 16px; }
  .dash-hello h1 { font-size: 26px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { min-height: 104px; padding: 14px; border-radius: 18px; }
  .tile-num { font-size: 26px; }
  .dash-grid { grid-template-columns: 1fr; gap: 12px; }
  .dcard { border-radius: 18px; padding: 14px; }

  /* «Входящие» */
  .inbox-list { padding: 0 8px 100px; }
  .in-card { padding: 12px 10px 12px 16px; }
  .in-card:hover { background: var(--surface); border-color: transparent; }
  .in-item.pinned .in-card { background: #FFFDF2; }
  .in-tools { display: none; }

  /* чат: список каналов → канал → тред, как в мессенджере */
  .chat, .chat.with-thread { grid-template-columns: minmax(0, 1fr); }
  .chat[data-screen="list"] .ch-main, .chat[data-screen="list"] .ch-thread,
  .chat[data-screen="channel"] .ch-list, .chat[data-screen="channel"] .ch-thread,
  .chat[data-screen="thread"] .ch-list, .chat[data-screen="thread"] .ch-main { display: none; }
  .ch-list { background: var(--surface); border-right: 0; }
  .ch-list-head { padding: calc(12px + env(safe-area-inset-top)) 12px 8px 16px; }
  .ch-list-head h2 { font-size: 28px; font-weight: 700; letter-spacing: -.6px; }
  .ch-item { padding: 10px 8px; }
  .ch-item .ch-ico { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-ink); }
  .ch-item.active { background: none; }
  .ch-name b { font-size: 16px; }
  .ch-name small { font-size: 14px; }
  body[data-chat-screen="channel"] .tabbar, body[data-chat-screen="thread"] .tabbar { display: none; }
  body[data-chat-screen="channel"] .main, body[data-chat-screen="thread"] .main { padding-bottom: 0; }
  .ch-head { padding: calc(6px + env(safe-area-inset-top)) 6px 6px; min-height: 52px; }
  .ch-thread { border-left: 0; }
  .msg { grid-template-columns: 36px 1fr; padding: 6px 12px 4px; }
  .msg:hover { background: none; }
  .msg-tools { display: none !important; }
  .msg .av { --s: 32px !important; }
  .react.add { opacity: 1; }
  .composer { padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
  .comp-row { border-radius: 22px; }
  .comp-row .comp-plus { width: 38px; height: 38px; }
  .m-voice audio { max-width: 200px; }

  /* профиль и вход */
  .settings { padding: 8px 12px 100px; }
  .card { border-radius: 18px; padding: 16px; }
  .profile { align-items: center; }
  .pass-row input { flex: 1 1 100%; width: auto; height: 44px; }
  .pass-row .btn { flex: 1; height: 44px; }
  .login-box input { flex: 1 1 100%; height: 44px; }
  .login-box .btn { flex: 1; height: 42px; }
  .set-row { flex-wrap: wrap; }
  .picker { place-items: start center; overflow-y: auto; padding: calc(28px + env(safe-area-inset-top)) 16px 32px; }
  .picker-box .logo { margin-bottom: 24px; }
  .picker-box h1 { font-size: 24px; }
  .picker-box p { margin-bottom: 20px; font-size: 14px; }
  .picker-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .picker-card { width: auto; padding: 18px 10px 14px; gap: 10px; }
  .picker-card .av { --s: 64px !important; font-size: 24px; }
  .picker-card .nm { font-size: 16px; }
  .login-panel .f input { height: 48px; }
}
