/* CRM в стиле iOS: системные цвета, размытые панели, группированные списки. */
:root {
  --blue: #007aff; --red: #ff3b30; --green: #34c759; --orange: #ff9500;
  --purple: #af52de; --teal: #30b0c7; --indigo: #5856d6; --pink: #ff2d55; --gray: #8e8e93;

  --bg: #ffffff;                       /* обычные экраны и чат */
  --grouped: #f2f2f7;                  /* «Настройки», шторки */
  --cell: #ffffff;
  --label: #000000;
  --label2: rgba(60, 60, 67, .6);
  --label3: rgba(60, 60, 67, .3);
  --sep: rgba(60, 60, 67, .2);
  --fill: rgba(118, 118, 128, .12);
  --fill2: rgba(118, 118, 128, .2);
  --bar: rgba(249, 249, 249, .8);
  --seg-on: #ffffff;

  --bubble-in: #e9e9eb; --bubble-in-text: #000; --bubble-out: #007aff; --bubble-out-text: #fff;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 44px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #0a84ff; --red: #ff453a; --green: #30d158; --orange: #ff9f0a;
    --purple: #bf5af2; --teal: #40c8e0; --indigo: #5e5ce6; --pink: #ff375f; --gray: #98989d;
    --bg: #000000; --grouped: #000000; --cell: #1c1c1e;
    --label: #ffffff; --label2: rgba(235, 235, 245, .6); --label3: rgba(235, 235, 245, .3);
    --sep: rgba(84, 84, 88, .6); --fill: rgba(118, 118, 128, .24); --fill2: rgba(118, 118, 128, .32);
    --bar: rgba(22, 22, 24, .8); --seg-on: #636366;
    --bubble-in: #262628; --bubble-in-text: #fff; --bubble-out: #0a84ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--label); }
body {
  font: 17px/1.29 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  letter-spacing: -.41px; -webkit-font-smoothing: antialiased; overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }
.ico { display: inline-flex; width: 1em; height: 1em; flex: none; }
.ico svg, [data-icon] svg { width: 100%; height: 100%; display: block; }
[data-icon] { display: inline-flex; }

/* ── каркас ─────────────────────────────────────── */
#app { position: relative; height: 100dvh; overflow: hidden; background: var(--bg); }
#app.grouped, #app.grouped #view { background: var(--grouped); }
#view { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-t) + var(--nav-h)) 0 calc(var(--safe-b) + 66px); }

.navbar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; height: calc(var(--safe-t) + var(--nav-h));
  padding: var(--safe-t) 8px 0; display: flex; align-items: center; gap: 4px;
  transition: background .2s, box-shadow .2s; }
#app.scrolled .navbar, .navbar.solid {
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 .5px 0 var(--sep); }
.nav-title { flex: 1; text-align: center; font-weight: 600; opacity: 0; transition: opacity .15s;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#app.scrolled .nav-title { opacity: 1; }
.nav-side { width: 60px; display: flex; }
.nav-side.right { justify-content: flex-end; padding-right: 8px; }
.conn { width: 8px; height: 8px; border-radius: 50%; background: var(--green); transition: background .3s; }
.conn.bad { background: var(--red); }

.large-title { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .37px; margin: 2px 16px 8px; }

/* ── нижняя панель ──────────────────────────────── */
.tabbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex;
  padding: 0 0 var(--safe-b); background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -.5px 0 var(--sep); }
.tabbar button { flex: 1; height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--gray); font-size: 10px; font-weight: 500; letter-spacing: .1px; position: relative; }
.tabbar .ti { width: 28px; height: 26px; }
.tabbar button.on { color: var(--blue); }
.tabbar b { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 13px; font-weight: 400; line-height: 18px; text-align: center; }
.tabbar b:empty { display: none; }

/* ── управление над списком ─────────────────────── */
.segmented { display: flex; margin: 0 16px 10px; padding: 2px; border-radius: 9px; background: var(--fill); overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button { flex: 1 0 auto; min-width: 64px; height: 28px; border-radius: 7px; font-size: 13px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 5px; padding: 0 10px; white-space: nowrap; }
.segmented button.on { background: var(--seg-on); font-weight: 600; box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); }
.segmented .dot { width: 7px; height: 7px; border-radius: 50%; }
.segmented .dot.off { background: transparent !important; box-shadow: inset 0 0 0 1.5px var(--red); }

.searchbar { position: relative; margin: 0 16px 10px; }
.searchbar .ico { position: absolute; left: 8px; top: 9px; width: 18px; height: 18px; color: var(--label2); pointer-events: none; }
.search { width: 100%; height: 36px; border: 0; border-radius: 10px; background: var(--fill); padding: 0 8px 0 32px;
  font-size: 17px; outline: none; -webkit-appearance: none; }
.search::placeholder { color: var(--label2); }
.search::-webkit-search-cancel-button { -webkit-appearance: none; }

.pills { display: flex; gap: 8px; padding: 0 16px 8px; overflow-x: auto; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill-btn { flex: none; height: 30px; padding: 0 12px; border-radius: 15px; background: var(--fill); font-size: 15px;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; transition: background .15s, color .15s; }
.pill-btn.on { background: var(--blue); color: #fff; }
.pill-btn .n { font-size: 13px; opacity: .65; }
.pills.wrap { flex-wrap: wrap; overflow: visible; padding: 0; }

/* ── список чатов ───────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; gap: 12px; padding: 0 0 0 16px; min-height: 76px; align-items: center; position: relative; cursor: pointer; }
.item:active { background: var(--fill); }
.item .body { flex: 1; min-width: 0; padding: 9px 16px 9px 0; box-shadow: inset 0 -.5px 0 var(--sep); align-self: stretch;
  display: flex; flex-direction: column; justify-content: center; }
.list .item:last-child .body { box-shadow: none; }
.ava { width: 54px; height: 54px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff;
  font-size: 21px; font-weight: 600; letter-spacing: 0; user-select: none; }
.ava.sm { width: 36px; height: 36px; font-size: 14px; }
.ava { position: relative; overflow: hidden; }
.ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.row1 { display: flex; align-items: baseline; gap: 6px; }
.row1 .nm { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 4px; }
.row1 .nm .ico { width: 16px; height: 16px; color: var(--label2); }
.row1 time { font-size: 15px; color: var(--label2); flex: none; letter-spacing: -.24px; }
.item.unread-row .row1 time { color: var(--blue); }
.row2 { display: flex; gap: 8px; align-items: flex-start; margin-top: 1px; }
.row2 .tx { flex: 1; min-width: 0; color: var(--label2); font-size: 15px; line-height: 20px; letter-spacing: -.24px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.row2 .tx b { color: var(--label); font-weight: 400; }
.badge { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--blue); color: #fff;
  font-size: 14px; line-height: 22px; text-align: center; margin-top: 2px; letter-spacing: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.tag { --c: var(--gray); font-size: 12px; font-weight: 500; letter-spacing: 0; padding: 2px 7px; border-radius: 6px;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.tag .ico { width: 11px; height: 11px; }
.tag.late { --c: var(--red); }
.tag.plain { --c: var(--label2); background: var(--fill); }

.section-h { display: flex; justify-content: space-between; padding: 22px 16px 6px 32px; font-size: 13px; line-height: 18px;
  color: var(--label2); text-transform: uppercase; letter-spacing: -.08px; }
.section-h .ico { width: 13px; height: 13px; }
.section-h.late { color: var(--red); }
.section-h.big { text-transform: none; font-size: 20px; font-weight: 700; color: var(--label); letter-spacing: .38px; padding: 20px 16px 8px; }
.section-h.big .n { color: var(--label2); font-weight: 400; font-size: 17px; }

.group { background: var(--cell); margin: 0 16px; border-radius: 10px; overflow: hidden; }
#app:not(.grouped) .group.list-group { margin: 0; border-radius: 0; }
.footer { font-size: 13px; line-height: 18px; color: var(--label2); padding: 6px 16px 0 32px; letter-spacing: -.08px; }

.empty { text-align: center; color: var(--label2); padding: 60px 40px; font-size: 15px; letter-spacing: -.24px; }
.empty .ico { width: 56px; height: 56px; color: var(--label3); margin-bottom: 12px; }
.empty b { display: block; color: var(--label); font-size: 20px; font-weight: 600; margin-bottom: 6px; letter-spacing: .38px; }

.banner { display: flex; gap: 10px; align-items: flex-start; margin: 0 16px 12px; padding: 12px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--orange) 14%, var(--cell)); font-size: 15px; letter-spacing: -.24px; cursor: pointer; }
.banner .ico { width: 20px; height: 20px; color: var(--orange); margin-top: 1px; }
.banner.red { background: color-mix(in srgb, var(--red) 12%, var(--cell)); }
.banner.red .ico { color: var(--red); }

.more-btn { display: block; width: calc(100% - 32px); margin: 16px; height: 44px; border-radius: 12px; background: var(--fill);
  color: var(--blue); font-weight: 500; }

/* ── ячейки «Настроек» ──────────────────────────── */
.cell { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 0 0 16px; width: 100%; text-align: left;
  background: var(--cell); position: relative; cursor: pointer; }
.cell:active { background: var(--fill2); }
.cell.static { cursor: default; }
.cell.static:active { background: var(--cell); }
.cell .main { flex: 1; min-width: 0; padding: 11px 16px 11px 0; display: flex; align-items: center; gap: 8px;
  box-shadow: inset 0 -.5px 0 var(--sep); align-self: stretch; }
.group > .cell:last-child .main, .group > :last-child .main { box-shadow: none; }
.cell .txt { flex: 1; min-width: 0; }
.cell .sub { font-size: 13px; color: var(--label2); letter-spacing: -.08px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.cell .val { color: var(--label2); flex: none; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .chev { width: 8px; height: 14px; color: var(--label3); flex: none; }
.cell .check { width: 18px; height: 18px; color: var(--blue); flex: none; }
.cell.accent { color: var(--blue); }
.cell.danger { color: var(--red); }
.cell.center .main { justify-content: center; }
.sq { width: 30px; height: 30px; border-radius: 7px; flex: none; display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 600; }
.sq .ico { width: 18px; height: 18px; }
.sq.dim { opacity: .45; }
.cell input, .cell textarea, .cell select { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; padding: 0; font-size: 17px; }
.cell textarea { resize: none; min-height: 88px; line-height: 22px; }
.cell input::placeholder, .cell textarea::placeholder { color: var(--label3); }
.cell input[type="datetime-local"] { text-align: right; color: var(--blue); flex: none; max-width: 60%; }
.cell .label { flex: none; }

/* ── чат ────────────────────────────────────────── */
.screen { position: fixed; inset: 0; z-index: 10; background: var(--bg); display: flex; flex-direction: column; height: 100dvh;
  transform: translateX(100%); transition: transform .32s cubic-bezier(.2, .8, .2, 1); box-shadow: -8px 0 30px rgba(0,0,0,.12); }
.screen.open { transform: none; }
.chat-nav { position: relative; flex: none; padding-right: 10px; }
.nav-back { display: flex; align-items: center; gap: 2px; color: var(--blue); height: 44px; padding: 0 4px 0 0; flex: none; }
.nav-back [data-icon] { width: 22px; height: 22px; }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.who .name { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .sub { font-size: 12px; color: var(--label2); letter-spacing: 0; display: flex; align-items: center; gap: 4px; max-width: 100%;
  overflow: hidden; white-space: nowrap; }
.who .sub .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.nav-ava { flex: none; }
.crmline { flex: none; display: flex; gap: 6px; padding: 7px 12px; overflow-x: auto; scrollbar-width: none; background: var(--bar);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: 0 .5px 0 var(--sep); cursor: pointer; }
.crmline::-webkit-scrollbar { display: none; }
.crmline:empty { display: none; }
.crmline .note { font-size: 12px; color: var(--label2); white-space: nowrap; align-self: center; }

#msgs { flex: 1; overflow-y: auto; padding: 8px 16px 8px; display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; }
.day { align-self: center; font-size: 12px; font-weight: 600; color: var(--label2); margin: 14px 0 8px; letter-spacing: 0; }
.msg { position: relative; max-width: 76%; padding: 7px 12px 7px; border-radius: 18px; margin-top: 2px; align-self: flex-start;
  background: var(--bubble-in); color: var(--bubble-in-text); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 22px; }
.msg.first { margin-top: 8px; }
.msg.out { align-self: flex-end; background: var(--bubble-out); color: var(--bubble-out-text); }
.msg.tail::before, .msg.tail::after { content: ""; position: absolute; bottom: 0; height: 20px; }
.msg.tail:not(.out)::before { left: -7px; width: 20px; background: var(--bubble-in); border-bottom-right-radius: 16px 14px; }
.msg.tail:not(.out)::after { left: -26px; width: 26px; background: var(--bg); border-bottom-right-radius: 10px; }
.msg.tail.out::before { right: -7px; width: 20px; background: var(--bubble-out); border-bottom-left-radius: 16px 14px; }
.msg.tail.out::after { right: -26px; width: 26px; background: var(--bg); border-bottom-left-radius: 10px; }
.msg .from { font-size: 13px; font-weight: 600; color: var(--blue); margin-bottom: 1px; }
.msg .t { float: right; font-size: 11px; line-height: 14px; margin: 10px -4px -3px 10px; opacity: .55; letter-spacing: 0; }
.msg a { color: inherit; text-decoration: underline; }
.msg.media-only { padding: 3px; background: transparent !important; }
.msg.media-only.tail::before, .msg.media-only.tail::after { display: none; }
.msg img { display: block; max-width: 100%; max-height: 340px; min-width: 140px; min-height: 100px; border-radius: 15px;
  object-fit: cover; background: var(--fill); margin: -4px -9px 6px; width: calc(100% + 18px); }
.msg.media-only img { margin: 0; width: 100%; }
.msg.media-only .t { position: absolute; right: 12px; bottom: 9px; margin: 0; background: rgba(0,0,0,.45); color: #fff;
  padding: 1px 6px; border-radius: 8px; opacity: 1; }
.msg audio { display: block; width: 240px; max-width: 100%; height: 36px; margin: 2px 0; }
.msg video { display: block; max-width: 100%; max-height: 340px; min-width: 140px; border-radius: 15px; margin: 2px 0; background: #000; }
.msg .file { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.msg .file .ico { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: rgba(255,255,255,.25); }
.msg:not(.out) .file .ico { background: var(--blue); color: #fff; }
.msg.service { align-self: center; background: none; color: var(--label2); font-size: 13px; margin: 8px 0; padding: 0; }
.older { align-self: center; color: var(--label2); font-size: 13px; padding: 10px; display: flex; gap: 8px; align-items: center; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--fill2); border-top-color: var(--label2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#composer { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 7px 10px calc(var(--safe-b) + 7px);
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -.5px 0 var(--sep); }
.round-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--fill); color: var(--label2); display: grid; place-items: center; flex: none; }
.round-btn [data-icon] { width: 18px; height: 18px; }
.input-wrap { flex: 1; min-width: 0; display: flex; align-items: flex-end; border-radius: 18px; background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--sep); padding: 2px 3px 2px 12px; min-height: 34px; }
.input-wrap textarea { flex: 1; min-width: 0; border: 0; outline: none; resize: none; background: none; padding: 5px 0;
  max-height: 140px; font-size: 17px; line-height: 20px; }
.input-wrap textarea::placeholder { color: var(--label3); }
.send { width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center;
  flex: none; transition: opacity .15s, transform .15s; }
.send [data-icon] { width: 16px; height: 16px; }
.send:disabled { opacity: 0; transform: scale(.6); pointer-events: none; }

/* ── шторка ─────────────────────────────────────── */
#sheet-bg { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .3s; }
#sheet-bg.open { opacity: 1; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: calc(100dvh - var(--safe-t) - 12px);
  display: flex; flex-direction: column; background: var(--grouped); border-radius: 12px 12px 0 0;
  transform: translateY(100%); transition: transform .35s cubic-bezier(.2, .9, .25, 1); }
@media (prefers-color-scheme: dark) { #sheet { background: #1c1c1e; } #sheet .group, #sheet .cell { background: #2c2c2e; } }
#sheet.open { transform: none; }
@media (min-width: 700px) {
  #sheet { left: 50%; width: 540px; margin-left: -270px; bottom: auto; top: 50%; border-radius: 14px; max-height: 86dvh;
    transform: translateY(-40%) scale(.97); opacity: 0; transition: transform .25s, opacity .25s; }
  #sheet.open { transform: translateY(-50%); opacity: 1; }
}
.sheet-head { flex: none; display: flex; align-items: center; height: 56px; padding: 6px 16px 0; position: relative; }
.sheet-head::before { content: ""; position: absolute; top: 5px; left: 50%; width: 36px; height: 5px; margin-left: -18px;
  border-radius: 3px; background: var(--label3); }
.sheet-head .side { flex: 1; display: flex; }
.sheet-head .side.right { justify-content: flex-end; }
.sheet-head .side button { color: var(--blue); height: 44px; }
.sheet-head .side button.strong { font-weight: 600; }
.sheet-head .side button:disabled { color: var(--label3); }
.sheet-head h2 { flex: 2; margin: 0; font-size: 17px; font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { overflow-y: auto; padding: 0 0 calc(var(--safe-b) + 24px); -webkit-overflow-scrolling: touch; }
.sheet-body > .section-h:first-child { padding-top: 10px; }
.sheet-person { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 16px 4px; text-align: center; }
.sheet-person .ava { width: 76px; height: 76px; font-size: 30px; }
.sheet-person .nm { font-size: 22px; font-weight: 600; letter-spacing: .35px; }
.sheet-person .sub { font-size: 15px; color: var(--label2); }
.chips-row { padding: 10px 16px 0; }
.btn { display: block; width: calc(100% - 32px); margin: 20px 16px 0; height: 50px; border-radius: 12px; background: var(--blue);
  color: #fff; font-weight: 600; }
.btn:disabled { opacity: .45; }

/* ── всплывашка ─────────────────────────────────── */
#toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 10px); z-index: 40; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 22px; font-size: 15px; font-weight: 500; letter-spacing: -.24px;
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 8px 30px rgba(0,0,0,.18), 0 0 0 .5px var(--sep); display: flex; gap: 8px; align-items: center;
  animation: drop .3s cubic-bezier(.2, .9, .25, 1); }
#toast .ico { width: 20px; height: 20px; color: var(--green); }
#toast.err .ico { color: var(--red); }
@keyframes drop { from { transform: translate(-50%, -30px); opacity: 0; } }

/* ── вход ───────────────────────────────────────── */
body.login-page, body.login-page html { background: var(--grouped); }
.login { max-width: 400px; margin: 0 auto; padding: calc(var(--safe-t) + 11vh) 0 40px; text-align: center; }
.login .app-icon { width: 84px; height: 84px; border-radius: 19px; box-shadow: 0 6px 20px rgba(0,122,255,.3); }
.login h1 { font-size: 28px; font-weight: 700; letter-spacing: .36px; margin: 16px 0 4px; }
.login .lead { color: var(--label2); font-size: 15px; margin: 0 32px 28px; letter-spacing: -.24px; }
.login .group { text-align: left; }
.login .err { color: var(--red); font-size: 15px; margin: 14px 16px 0; }
.login .banner { text-align: left; cursor: default; }

/* ── WhatsApp: привязка по QR ─────────────────────────── */
.qr-box { display: grid; place-items: center; min-height: 300px; margin: 16px; }
.qr-box .qr { width: min(280px, 80vw); height: auto; background: #fff; padding: 12px; border-radius: 16px; }
.qr-wait { display: flex; align-items: center; gap: 10px; color: var(--label2); font-size: 15px; }
.msg .file.plain { display: inline-flex; vertical-align: middle; opacity: .85; cursor: default; margin-right: 6px; }

/* ── ответ с цитатой и вложение к отправке ───────────── */
.bar { flex: none; display: flex; align-items: center; gap: 10px; padding: 6px 12px 0 16px; font-size: 14px; }
.bar .bar-line { width: 3px; align-self: stretch; border-radius: 2px; background: var(--blue); }
.bar .bar-body { flex: 1; min-width: 0; }
.bar .bar-body b { display: block; color: var(--blue); font-size: 13px; }
.bar .bar-body span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--label2); }
.bar .bar-x { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--fill); color: var(--label2); display: grid; place-items: center; }
.bar .bar-x [data-icon], .bar .bar-x .ico { width: 16px; height: 16px; }
.msg .quote { display: block; border-left: 3px solid currentColor; padding: 2px 8px; margin: 0 0 4px; border-radius: 4px;
  background: rgba(127,127,127,.15); font-size: 14px; opacity: .85; cursor: pointer; }
.msg .quote b { display: block; font-size: 12px; }
.msg .quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg.flash { animation: flash 1.2s; }
@keyframes flash { 0%, 100% { filter: none; } 30% { filter: brightness(1.4); } }

/* ── досье ───────────────────────────────────────────── */
.dossier { padding: 4px 16px 24px; font-size: 15px; line-height: 1.4; }
.dossier h2 { font-size: 19px; font-weight: 700; margin: 18px 0 6px; }
.dossier h3 { font-size: 16px; font-weight: 600; margin: 14px 0 4px; color: var(--label2); }
.dossier p { margin: 4px 0; }
.dossier ul { margin: 4px 0 4px 18px; padding: 0; }
.dossier li { margin: 2px 0; }
.dossier blockquote { margin: 6px 0; padding: 4px 10px; border-left: 3px solid var(--blue); color: var(--label2); }
.dossier a { color: var(--blue); text-decoration: none; }
.dossier .row-line { display: flex; gap: 10px; flex-wrap: wrap; padding: 3px 0; border-bottom: 1px solid var(--sep); }
.dossier .row-line span:first-child { font-weight: 600; }

/* ── переключатели в автоправилах ────────────────────── */
.cell input[type=checkbox] { width: 22px; height: 22px; margin: 0 4px 0 0; accent-color: var(--green); flex: none; }
.cell select { background: none; border: 0; font: inherit; color: var(--blue); max-width: 60%; }

/* ── команда ─────────────────────────────────────────── */
.cell.wrap .txt > div:first-child { white-space: normal; }
.login code { font-size: 12px; word-break: break-all; }

/* ── галочки ─────────────────────────────────────────── */
.msg .ticks { margin-left: 4px; letter-spacing: -3px; font-size: 12px; }
.msg .ticks.read { color: var(--blue); }
.msg.out .ticks.read { color: #fff; opacity: 1; }
mark { background: rgba(255, 214, 10, .45); color: inherit; border-radius: 3px; }
.round-btn.ai { color: var(--purple); }
