/* QuChat — дизайн-система кабинета v2 (Premium SaaS, light). Токены — из Developer Handoff v1.0. */
:root {
  --primary: #0FA39A;
  --primary-hover: #0B7F78;
  --accent: #12B5A5;
  --soft: #E3F5F3;
  --soft-2: #F0FAF9;
  --bg: #F3F7F7;
  --surface: #FFFFFF;
  --text: #1C2B2A;
  --muted: #6B7F7D;
  --border: #E5ECEB;
  --border-strong: #D3DFDE;
  --success: #1F9D55;
  --success-bg: #E6F6EC;
  --warning: #C98A00;
  --warning-bg: #FFF5DC;
  --error: #D64545;
  --error-bg: #FCEAEA;
  --info: #3186D8;
  --info-bg: #E8F1FB;
  --bubble-me: #DDF5F1;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(16, 43, 42, .05), 0 1px 3px rgba(16, 43, 42, .04);
  --shadow-md: 0 6px 24px rgba(16, 43, 42, .08);
  --shadow-lg: 0 18px 50px rgba(16, 43, 42, .18);
  --sb: 240px;
  --topbar: 72px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: Inter, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 28px; line-height: 1.2; font-weight: 700; margin: 0; letter-spacing: -.4px; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 14px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 10px; }
svg { flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: var(--primary); color: #fff; text-decoration: none !important; transition: background .2s var(--ease), border-color .2s, box-shadow .2s;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn svg { width: 18px; height: 18px; }
.btn.secondary { background: #fff; color: var(--primary-hover); border-color: var(--primary); }
.btn.secondary:hover { background: var(--soft-2); }
.btn.ghost { background: transparent; color: var(--primary-hover); }
.btn.ghost:hover { background: var(--soft); }
.btn.light { background: var(--soft); color: var(--primary-hover); }
.btn.light:hover { background: #d3efeb; }
.btn.outline { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn.outline:hover { border-color: var(--primary); color: var(--primary-hover); }
.btn.danger { background: #fff; color: var(--error); border-color: #f0bcbc; }
.btn.danger:hover { background: var(--error-bg); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted);
  display: inline-grid; place-items: center; cursor: pointer; position: relative; flex-shrink: 0; transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--soft); color: var(--primary-hover); }
.icon-btn.boxed { border-color: var(--border); background: #fff; }
.icon-btn.active { background: var(--soft); color: var(--primary-hover); border-color: #bfe5e0; }
.icon-btn.primary { background: var(--primary); color: #fff; }
.icon-btn.primary:hover { background: var(--primary-hover); color: #fff; }
.icon-btn:disabled { opacity: .45; cursor: default; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--error); border: 2px solid #fff; }

/* ---------- поля ---------- */
label.f { display: block; font-weight: 500; font-size: 13px; margin: 14px 0 6px; color: var(--text); }
label.f .req { color: var(--error); }
input, select, textarea {
  width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 10px; font: inherit; background: #fff; color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
textarea { height: auto; padding: 10px 14px; resize: vertical; }
select { appearance: none; padding-right: 36px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236B7F7D' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
input::placeholder, textarea::placeholder { color: #9AABA9; }
input:hover, select:hover, textarea:hover { border-color: #b9cecc; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 163, 154, .15); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--muted); }
input.invalid { border-color: var(--error); box-shadow: 0 0 0 3px rgba(214, 69, 69, .12); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; cursor: pointer; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 40px; }
.check { display: flex; gap: 10px; align-items: center; margin: 10px 0; cursor: pointer; }
/* переключатель */
.toggle { display: flex; align-items: flex-start; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); cursor: pointer; }
.toggle:first-of-type { border-top: 0; }
.toggle input { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: #CFDCDB; position: relative; cursor: pointer; flex-shrink: 0; transition: background .2s; margin-top: 1px; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.toggle input:checked { background: var(--primary); }
.toggle input:checked::after { transform: translateX(16px); }
.toggle b { display: block; font-weight: 600; }
.toggle small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- карточки, бейджи ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card.flat { box-shadow: none; }
.card.pad-0 { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12px; font-weight: 600; background: #EEF2F2; color: var(--muted); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--success-bg); color: var(--success); }
.pill.warn { background: var(--warning-bg); color: var(--warning); }
.pill.err { background: var(--error-bg); color: var(--error); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.teal { background: var(--soft); color: var(--primary-hover); }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--info-bg); color: var(--info); }
.tag:nth-child(3n+2) { background: var(--soft); color: var(--primary-hover); }
.tag:nth-child(3n) { background: #F1EAFB; color: #7A4CC2; }
.tag button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; font-size: 14px; line-height: 1; opacity: .7; }
.tag button:hover { opacity: 1; }
.badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--primary-hover)); color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; overflow: hidden; position: relative; font-size: 15px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 36px; height: 36px; font-size: 13px; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.avatar.c1 { background: linear-gradient(135deg, #5AA9E6, #3186D8); }
.avatar.c2 { background: linear-gradient(135deg, #F2A65A, #D9822B); }
.avatar.c3 { background: linear-gradient(135deg, #A78BDA, #7A4CC2); }
.avatar.c4 { background: linear-gradient(135deg, #8FA3A1, #6B7F7D); }
.ic-tile { width: 44px; height: 44px; border-radius: 12px; background: var(--soft); color: var(--primary-hover); display: grid; place-items: center; flex-shrink: 0; }
.ic-tile svg { width: 22px; height: 22px; }
.ic-tile.ok { background: var(--success-bg); color: var(--success); }
.ic-tile.warn { background: var(--warning-bg); color: var(--warning); }
.ic-tile.err { background: var(--error-bg); color: var(--error); }
.ic-tile.info { background: var(--info-bg); color: var(--info); }
.ic-tile.grey { background: #EEF2F2; color: var(--muted); }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .ic-tile { margin: 0 auto 14px; width: 56px; height: 56px; border-radius: 16px; }
.empty h3 { color: var(--text); font-size: 16px; }
.skeleton { background: linear-gradient(90deg, #edf2f2 25%, #f6f9f9 50%, #edf2f2 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--soft); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-loader { display: grid; place-items: center; padding: 80px 0; }
.progress { height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 10px 16px; }
.kv > div:nth-child(odd) { color: var(--muted); }
code.key { display: block; padding: 12px 14px; background: #0F2A28; color: #B6F3EA; border-radius: 10px; word-break: break-all; font-size: 13px; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--info-bg); color: var(--text); margin-bottom: 16px; font-size: 13px; }
.alert > span:first-child { color: var(--info); margin-top: 1px; }
.alert > span:first-child svg { width: 20px; height: 20px; }
.alert.err { background: var(--error-bg); } .alert.err > span:first-child { color: var(--error); }
.alert.warn { background: var(--warning-bg); } .alert.warn > span:first-child { color: var(--warning); }
.alert.ok { background: var(--success-bg); } .alert.ok > span:first-child { color: var(--success); }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #FAFCFC; white-space: nowrap; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #FAFCFC; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
td .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
td.actions-cell { text-align: right; white-space: nowrap; }
.table-foot { padding: 14px 16px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }

/* ---------- вкладки ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tabs button { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 12px 16px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button svg { width: 18px; height: 18px; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary-hover); border-bottom-color: var(--primary); font-weight: 600; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--border); background: #fff; font: inherit; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; white-space: nowrap; }
.seg button .n { color: var(--muted); font-weight: 600; }
.seg button:hover { border-color: var(--primary); }
.seg button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.seg button.active .n { color: rgba(255, 255, 255, .85); }
.seg.boxed { background: var(--soft); padding: 4px; border-radius: 12px; gap: 2px; }
.seg.boxed button { border: 0; background: transparent; border-radius: 9px; color: var(--primary-hover); flex: 1; justify-content: center; }
.seg.boxed button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------- оболочка ---------- */
.app { display: grid; grid-template-columns: var(--sb) minmax(0, 1fr); height: 100vh; transition: grid-template-columns .25s var(--ease); }
.app.collapsed { --sb: 64px; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; padding: 16px 12px; gap: 14px; overflow: hidden; }
.sb-brand { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 4px; }
.sb-brand .logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 22px; letter-spacing: -.6px; color: var(--text); text-decoration: none !important; min-width: 0; }
.sb-brand .logo svg { width: 34px; height: 34px; }
.sb-brand .icon-btn { margin-left: auto; width: 34px; height: 34px; border: 1px solid var(--border); }
.org { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; font-weight: 600; font-size: 13px; color: var(--text); }
.org svg { width: 20px; height: 20px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.nav a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 10px; color: var(--text); font-weight: 500; text-decoration: none !important; position: relative; white-space: nowrap; transition: background .15s, color .15s; }
.nav a svg { width: 20px; height: 20px; color: var(--muted); transition: color .15s; }
.nav a:hover { background: var(--soft-2); }
.nav a.active { background: var(--soft); color: var(--primary-hover); font-weight: 600; }
.nav a.active svg { color: var(--primary); }
.nav a .badge { margin-left: auto; }
.nav .sep { height: 1px; background: var(--border); margin: 8px 4px; flex-shrink: 0; }
.sb-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; font-size: 13px; }
.sb-card.link { display: block; color: inherit; text-decoration: none !important; transition: border-color .2s; }
.sb-card.link:hover { border-color: #bfe5e0; }
.sb-card.plan { background: linear-gradient(140deg, #F2FBFA, #E3F5F3); border-color: #CFEDEA; }
.sb-card .t { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.sb-card .t svg { width: 20px; height: 20px; color: #E0A100; }
.sb-card .btn { margin-top: 10px; }
.sb-line { display: flex; align-items: center; gap: 10px; }
.sb-line .wa { width: 36px; height: 36px; border-radius: 50%; background: #25D366; color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.sb-line .wa svg { width: 20px; height: 20px; }
.app.collapsed .sidebar { padding: 16px 10px; }
.app.collapsed .sb-brand .logo span,
.app.collapsed .nav a > span:not(.badge),
.app.collapsed .org span, .app.collapsed .org > svg:last-child,
.app.collapsed .sb-card { display: none; }
.app.collapsed .sb-brand { flex-direction: column; height: auto; gap: 12px; }
.app.collapsed .sb-brand .icon-btn { margin: 0; transform: rotate(180deg); }
.app.collapsed .org { justify-content: center; padding: 0; }
.app.collapsed .nav a { justify-content: center; padding: 0; }
.app.collapsed .nav a .badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; font-size: 10px; padding: 0 5px; }
.tip { position: fixed; background: var(--text); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; z-index: 1100; pointer-events: none; white-space: nowrap; transform: translateY(-50%); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { height: var(--topbar); flex-shrink: 0; display: flex; align-items: center; gap: 16px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--border); }
.gsearch { position: relative; flex: 1; max-width: 640px; }
.gsearch input { background: var(--bg); border-color: transparent; padding-left: 44px; padding-right: 74px; }
.gsearch input:focus { background: #fff; }
.gsearch svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
.gsearch kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 12px var(--font); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; background: #fff; }
.topbar .sep { width: 1px; height: 32px; background: var(--border); }
.topbar .spacer { flex: 1; }
.anchor { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; padding: 6px 8px; border-radius: 12px; font: inherit; text-align: left; }
.user-btn:hover { background: var(--soft-2); }
.user-btn .nm { font-weight: 600; line-height: 1.2; }
.user-btn .rl { font-size: 12px; color: var(--muted); }
.user-btn > svg { width: 18px; height: 18px; color: var(--muted); }
.content { flex: 1; min-height: 0; overflow-y: auto; }
.page { padding: 28px 32px 40px; max-width: 1360px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.crumbs svg { width: 14px; height: 14px; }

/* выпадающие панели */
.pop { position: absolute; top: calc(100% + 8px); right: 0; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 200; min-width: 240px; overflow: hidden; animation: popIn .16s var(--ease); }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px); } }
.pop .menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 16px; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; text-align: left; text-decoration: none !important; }
.pop .menu-item:hover { background: var(--soft-2); }
.pop .menu-item svg { width: 18px; height: 18px; color: var(--muted); }
.pop .menu-item.danger { color: var(--error); }
.pop .menu-item.danger svg { color: var(--error); }
.pop .pop-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 600; gap: 8px; }
.notif { width: 380px; max-height: 480px; display: flex; flex-direction: column; }
.notif-list { overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:hover { background: var(--soft-2); }
.notif-item.unread { background: #F6FCFB; }
.notif-item .ni { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.notif-item .ni svg { width: 18px; height: 18px; }
.notif-item .ni.ok { background: var(--success-bg); color: var(--success); }
.notif-item .ni.err { background: var(--error-bg); color: var(--error); }
.notif-item .ni.warn { background: var(--warning-bg); color: var(--warning); }
.notif-item .ni.info { background: var(--info-bg); color: var(--info); }
.notif-item .nt { font-weight: 600; font-size: 13px; }
.notif-item .nd { font-size: 13px; color: var(--muted); }
.notif-item .nw { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- KPI и «Главная» ---------- */
.kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: flex-start; }
.kpi.clickable { cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.kpi.clickable:hover { border-color: #bfe5e0; box-shadow: var(--shadow-md); }
.kpi.on { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,163,154,.12); }
.kpi .lbl { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi .val { font-size: 28px; font-weight: 700; letter-spacing: -.5px; line-height: 1.2; margin-top: 4px; }
.kpi .delta { font-size: 12px; font-weight: 600; margin-top: 2px; }
.kpi .delta.up { color: var(--success); }
.kpi .delta.down { color: var(--error); }
.kpi .delta.flat { color: var(--muted); }
.kpi .sdot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.dash-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.chart { width: 100%; height: 260px; display: block; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .l-in { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .l-out { fill: none; stroke: var(--info); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: #fff; stroke-width: 2; }
.chart .hover-line { stroke: var(--border-strong); stroke-dasharray: 3 3; }
.chart-tip { position: absolute; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); padding: 8px 12px; font-size: 12px; pointer-events: none; white-space: nowrap; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.mini-list > * { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); text-decoration: none !important; color: inherit; }
.mini-list > *:last-child { border-bottom: 0; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.quick a { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-weight: 600; text-decoration: none !important; transition: border-color .2s, background .2s; }
.quick a:hover { border-color: var(--primary); background: var(--soft-2); }
.quick a .ic-tile { width: 36px; height: 36px; border-radius: 10px; }
.quick a .ic-tile svg { width: 18px; height: 18px; }

/* ---------- линии ---------- */
.filters { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filters .input-icon { flex: 1; min-width: 240px; }
.filters select { width: auto; min-width: 180px; }
.line-cell { display: flex; align-items: center; gap: 12px; }
.line-cell .ic-tile { width: 40px; height: 40px; border-radius: 12px; }
.line-cell b { display: block; white-space: nowrap; }
.days-left { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--success-bg); color: var(--success); }
.days-left.warn { background: var(--warning-bg); color: var(--warning); }
.days-left.err { background: var(--error-bg); color: var(--error); }
.line-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.line-card { display: block; color: inherit; text-decoration: none !important; transition: border-color .2s, box-shadow .2s; margin: 0; }
.line-card:hover { border-color: #bfe5e0; box-shadow: var(--shadow-md); }
.qr-box { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; }
.qr-box img { width: 264px; height: 264px; border-radius: 16px; border: 1px solid var(--border); background: #fff; padding: 8px; }
.qr-steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 16px; }
.qr-steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.qr-steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; background: var(--soft); color: var(--primary-hover); font-weight: 700; font-size: 13px; display: grid; place-items: center; flex-shrink: 0; }
.pair-code { font-size: 32px; font-weight: 800; letter-spacing: 6px; color: var(--primary-hover); background: var(--soft); padding: 14px 20px; border-radius: 12px; display: inline-block; font-variant-numeric: tabular-nums; }
.two-col { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }

/* ---------- тарифы и заказы ---------- */
.plans { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.plan { position: relative; border: 1.5px solid var(--border); border-radius: 14px; padding: 22px; cursor: pointer; background: #fff; transition: border-color .2s, box-shadow .2s, background .2s; }
.plan:hover { border-color: #9fd9d3; }
.plan.active { border-color: var(--primary); background: var(--soft-2); box-shadow: 0 0 0 3px rgba(15,163,154,.12); }
.plan .name { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.plan .price { font-size: 30px; font-weight: 800; letter-spacing: -.6px; margin: 10px 0 2px; }
.plan .price small { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.plan .ribbon { position: absolute; top: -11px; right: 16px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 10px; }
.plan ul { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; font-size: 13px; }
.plan ul li { display: flex; gap: 8px; align-items: center; }
.plan ul li svg { width: 16px; height: 16px; color: var(--primary); }
.summary { background: var(--soft-2); border: 1px solid #CFEDEA; border-radius: 14px; padding: 20px; }
.summary .ln { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; color: var(--muted); }
.summary .ln b { color: var(--text); }
.summary > .btn { margin-top: 16px; }
.summary .tot { display: flex; justify-content: space-between; font-weight: 700; font-size: 18px; border-top: 1px solid #CFEDEA; padding-top: 12px; margin-top: 12px; }
.steps-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.steps-bar .st { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; font-size: 13px; }
.steps-bar .st i { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 12px; background: #fff; }
.steps-bar .st.on { color: var(--text); }
.steps-bar .st.on i { background: var(--primary); border-color: var(--primary); color: #fff; }
.steps-bar .ln { flex: 1; height: 2px; background: var(--border); max-width: 80px; min-width: 20px; }

/* ---------- чаты ---------- */
.chats { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; height: 100%; padding: 16px; }
.chats.drawer-open { grid-template-columns: 380px minmax(0, 1fr) 340px; }
.chat-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-list .head { padding: 18px 18px 12px; display: flex; flex-direction: column; gap: 12px; }
.chat-list .seg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chat-list .seg button { padding: 0 11px; }
.chat-list .seg button { padding: 0 12px; }
.chat-list .head h2 { margin: 0; font-size: 22px; font-weight: 700; }
.line-pick { position: relative; }
.line-pick svg.wa { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: #25D366; pointer-events: none; }
.line-pick select { padding-left: 42px; }
.chat-items { overflow-y: auto; flex: 1; }
.chat-item { display: flex; gap: 12px; padding: 12px 18px; cursor: pointer; border-left: 3px solid transparent; transition: background .15s; }
.chat-item:hover { background: var(--soft-2); }
.chat-item.active { background: var(--soft); border-left-color: var(--primary); }
.chat-item .meta { min-width: 0; flex: 1; }
.chat-item .top { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.chat-item .name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .time { font-size: 12px; color: var(--muted); flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px; }
.chat-item .prev { color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 2px; }
.chat-item .prev > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .sub { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; align-items: center; }
.chat-item .sub .tag { height: 20px; font-size: 11px; padding: 0 7px; border-radius: 6px; }
.chat-item .flags svg { width: 13px; height: 13px; color: var(--muted); }
.unread { background: var(--primary); color: #fff; border-radius: 11px; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; flex-shrink: 0; }
.typing { color: var(--primary-hover); font-style: italic; }
.thread { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; position: relative; }
.thread-empty { margin: auto; text-align: center; color: var(--muted); padding: 24px; }
.thread-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.thread-head .back { display: none; }
.thread-head .who .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-head .who b { font-size: 16px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-head .tools { display: flex; gap: 4px; align-items: center; }
.thread-head .tools .vsep { width: 1px; height: 28px; background: var(--border); margin: 0 6px; }
.messages { flex: 1; overflow-y: auto; padding: 20px 28px; display: flex; flex-direction: column; gap: 8px;
  background: #F4F8F7 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23DFEAE8' stroke-width='1.2'%3E%3Cpath d='M20 18a8 8 0 1 1-4 7l-3 1 1-3a8 8 0 0 1 6-5z'/%3E%3Ccircle cx='86' cy='30' r='5'/%3E%3Cpath d='M64 84h14v10H64z'/%3E%3Cpath d='M22 92l6-6 6 6'/%3E%3Cpath d='M98 78c3 0 5 2 5 5s-2 5-5 5'/%3E%3C/g%3E%3C/svg%3E"); }
.msg { max-width: 66%; padding: 10px 14px 8px; border-radius: 14px; background: #fff; align-self: flex-start; box-shadow: 0 1px 2px rgba(16,43,42,.08); word-wrap: break-word; position: relative; font-size: 14.5px; }
.msg.me { align-self: flex-end; background: var(--bubble-me); }
.msg .body { white-space: pre-wrap; }
.msg .foot { font-size: 11px; color: var(--muted); display: flex; gap: 6px; justify-content: flex-end; align-items: center; margin-top: 2px; }
.msg .tick { display: inline-flex; }
.msg .tick svg { width: 16px; height: 16px; }
.msg .tick.read { color: var(--info); }
.msg .tick.failed { color: var(--error); }
.msg img.media, .msg video { max-width: 100%; max-height: 340px; border-radius: 10px; display: block; margin-bottom: 4px; cursor: pointer; }
.msg img.sticker { max-width: 150px; }
.msg audio { width: 280px; max-width: 100%; }
.msg .doc { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: rgba(255,255,255,.75); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 4px; text-decoration: none !important; color: var(--text); min-width: 240px; }
.fi { width: 38px; height: 44px; border-radius: 6px; background: #8FA3A1; color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; text-transform: uppercase; }
.fi.pdf { background: #E5484D; } .fi.xls { background: #1F9D55; } .fi.doc { background: #3186D8; } .fi.zip { background: #C98A00; }
.msg .doc b { display: block; font-weight: 600; }
.msg .doc > svg { width: 20px; height: 20px; color: var(--muted); margin-left: auto; }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--border); padding: 4px 14px; border-radius: 14px; margin: 8px 0; }
.msg .sender { font-size: 12px; font-weight: 700; color: var(--primary-hover); margin-bottom: 2px; }
.msg .quote { border-left: 3px solid var(--primary); background: rgba(15,163,154,.08); border-radius: 8px; padding: 6px 10px; margin-bottom: 6px; font-size: 13px; color: var(--muted); cursor: pointer; max-height: 64px; overflow: hidden; }
.msg .quote b { color: var(--primary-hover); display: block; font-size: 12px; }
.msg.deleted .body { color: var(--muted); text-decoration: line-through; }
.msg .del-label { font-size: 12px; color: var(--error); margin-bottom: 2px; }
.msg.call { align-self: center; background: #FFF7E6; text-align: center; }
.msg.undecryptable .body { color: var(--muted); font-style: italic; }
.msg.has-react { margin-bottom: 14px; }
.msg .reactions { display: flex; gap: 4px; flex-wrap: wrap; position: absolute; bottom: -14px; left: 12px; }
.msg.me .reactions { left: auto; right: 12px; }
.msg .reactions span { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 0 6px; font-size: 13px; box-shadow: var(--shadow); }
.msg .actions { position: absolute; top: -16px; right: 8px; display: none; gap: 2px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 2px; box-shadow: var(--shadow-md); z-index: 5; }
.msg:not(.me) .actions { right: auto; left: 8px; }
.msg:hover .actions { display: flex; }
.msg .actions button { border: 0; background: transparent; cursor: pointer; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); display: grid; place-items: center; }
.msg .actions button svg { width: 16px; height: 16px; }
.msg .actions button:hover { background: var(--soft); color: var(--primary-hover); }
.emoji-pop { position: absolute; top: -52px; display: flex; gap: 2px; background: #fff; border: 1px solid var(--border); border-radius: 22px; padding: 4px 6px; box-shadow: var(--shadow-md); z-index: 10; }
.emoji-pop button { border: 0; background: transparent; font-size: 20px; cursor: pointer; border-radius: 50%; width: 36px; height: 36px; }
.emoji-pop button:hover { background: var(--soft); }
.msg .media-btn { display: flex; gap: 8px; align-items: center; border: 1px dashed var(--border-strong); background: rgba(255,255,255,.6); border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; width: 100%; text-align: left; margin-bottom: 4px; color: var(--primary-hover); }
.msg .media-btn svg { width: 18px; height: 18px; }
.msg .retry { border: 0; background: none; color: var(--error); cursor: pointer; font-size: 11px; text-decoration: underline; padding: 0; }
.msg.highlight { box-shadow: 0 0 0 2px var(--primary); }
.composer { padding: 12px 16px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.composer .bar { display: flex; gap: 10px; align-items: flex-end; }
.composer .box { flex: 1; display: flex; align-items: flex-end; gap: 2px; border: 1px solid var(--border-strong); border-radius: 14px; padding: 4px 6px 4px 14px; background: #fff; transition: border-color .2s, box-shadow .2s; min-width: 0; }
.composer .box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,163,154,.12); }
.composer textarea { border: 0; box-shadow: none !important; padding: 9px 0; height: 40px; min-height: 40px; max-height: 160px; resize: none; background: transparent; }
.composer .icon-btn { width: 38px; height: 38px; }
.composer .send { width: 48px; height: 48px; border-radius: 14px; }
.composer .send svg { width: 22px; height: 22px; }
.composer .plus { width: 48px; height: 48px; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.composer .file-chip { align-self: flex-start; display: inline-flex; gap: 6px; align-items: center; font-size: 13px; background: var(--soft); color: var(--primary-hover); padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.composer .file-chip svg { width: 14px; height: 14px; }
.thread.drag::after { content: 'Отпустите файл, чтобы прикрепить'; position: absolute; inset: 8px; border: 2px dashed var(--primary); border-radius: 14px; background: rgba(240,250,249,.92); display: grid; place-items: center; font-weight: 600; color: var(--primary-hover); z-index: 20; }
.reply-bar { display: flex; align-items: center; gap: 10px; border-left: 3px solid var(--primary); background: var(--soft-2); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.reply-bar .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar button { border: 0; background: none; cursor: pointer; color: var(--muted); display: grid; }
.reply-bar svg { width: 16px; height: 16px; }
.icon-btn.rec { background: var(--error); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.rec-time { font-variant-numeric: tabular-nums; color: var(--error); font-weight: 700; align-self: center; }
.emoji-panel { position: absolute; bottom: 80px; right: 80px; width: 300px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 30; }
.emoji-panel button { border: 0; background: none; font-size: 20px; height: 34px; border-radius: 8px; cursor: pointer; }
.emoji-panel button:hover { background: var(--soft); }
/* быстрые ответы */
.tpl-panel { position: absolute; bottom: 80px; right: 120px; width: 360px; max-height: 340px; overflow: auto; display: grid; gap: 2px; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 30; }
.tpl-panel button { display: grid; gap: 2px; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 10px; cursor: pointer; font: inherit; color: inherit; }
.tpl-panel button:hover { background: var(--soft); }
.tpl-panel button > span { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tpl-panel .tpl-manage { color: var(--primary-hover); font-weight: 600; font-size: 13px; border-top: 1px solid var(--border); border-radius: 0 0 10px 10px; margin-top: 4px; }
@media (max-width: 720px) { .tpl-panel { left: 12px; right: 12px; width: auto; } }
/* Contact Drawer */
.drawer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 0; overflow: hidden; animation: slideIn .2s var(--ease); }
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; }
.drawer-body { overflow-y: auto; flex: 1; }
.drawer .profile { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 22px 18px 18px; gap: 2px; border-bottom: 1px solid var(--border); }
.drawer .profile b { font-size: 17px; margin-top: 10px; }
.dsec { border-bottom: 1px solid var(--border); }
.dsec > button { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border: 0; background: none; font: inherit; font-weight: 600; cursor: pointer; color: var(--text); }
.dsec > button svg { width: 18px; height: 18px; color: var(--muted); transition: transform .2s; }
.dsec.closed > button svg { transform: rotate(-90deg); }
.dsec.closed .dsec-body { display: none; }
.dsec-body { padding: 0 18px 16px; font-size: 13px; }
.dsec-body .kv { grid-template-columns: 100px 1fr; gap: 8px 10px; }
.note { background: #FFFBEA; border: 1px solid #F5E7B5; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.note .nh { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 4px; gap: 8px; }
.note .nh button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; display: grid; }
.note .nh button svg { width: 14px; height: 14px; }
.note .nb { white-space: pre-wrap; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; text-decoration: none !important; color: var(--text); }
.file-row .fi { width: 34px; height: 34px; border-radius: 8px; font-size: 9px; overflow: hidden; }
.file-row .fi img { width: 100%; height: 100%; object-fit: cover; }
.file-row .fi svg { width: 18px; height: 18px; }
.tag-input { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tag-input input { height: 30px; width: 130px; padding: 0 10px; font-size: 12px; border-radius: 8px; }

/* ---------- авторизация ---------- */
.auth { display: grid; grid-template-columns: minmax(380px, 5fr) 7fr; min-height: 100vh; background: #fff; }
.auth-side { background: radial-gradient(circle at 15% 10%, rgba(255,255,255,.14) 0, transparent 40%), linear-gradient(155deg, #12B5A5 0%, #0B7F78 55%, #075F5B 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-side .logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 24px; letter-spacing: -.6px; color: #fff; text-decoration: none !important; }
.auth-side .logo svg { width: 40px; height: 40px; }
.auth-side h2 { font-size: 36px; line-height: 1.15; font-weight: 800; letter-spacing: -.8px; margin: auto 0 28px; max-width: 420px; }
.auth-side ul { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: 14px; font-size: 16px; }
.auth-side li { display: flex; gap: 12px; align-items: center; }
.auth-side li svg { width: 24px; height: 24px; background: rgba(255,255,255,.2); border-radius: 50%; padding: 4px; }
.auth-side .bubble { position: absolute; right: -70px; bottom: -70px; width: 300px; height: 300px; opacity: .12; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 460px; background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 36px; box-shadow: var(--shadow-md); }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin-bottom: 22px; }
.auth-card .btn.block { margin-top: 22px; height: 48px; }
.auth-card .alt { text-align: center; margin-top: 18px; color: var(--muted); font-size: 13px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-wrap .icon-btn { position: absolute; right: 2px; top: 2px; }

/* ---------- toast и modal ---------- */
#toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
.toast { display: flex; align-items: center; gap: 12px; background: #fff; color: var(--text); padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); border-left: 4px solid var(--primary); box-shadow: var(--shadow-lg); width: 380px; max-width: calc(100vw - 32px); animation: toastIn .22s var(--ease); font-weight: 500; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.toast > span:first-child { color: var(--primary); }
.toast > span:first-child svg { width: 20px; height: 20px; }
.toast .tx { flex: 1; }
.toast button { border: 0; background: none; cursor: pointer; color: var(--muted); display: grid; padding: 2px; }
.toast button svg { width: 16px; height: 16px; }
.toast.ok { border-left-color: var(--success); background: #F5FCF8; } .toast.ok > span:first-child { color: var(--success); }
.toast.err { border-left-color: var(--error); background: #FFF7F7; } .toast.err > span:first-child { color: var(--error); }
.toast.warn { border-left-color: var(--warning); background: #FFFBF0; } .toast.warn > span:first-child { color: var(--warning); }
.toast.info { border-left-color: var(--info); background: #F6FAFE; } .toast.info > span:first-child { color: var(--info); }
.modal-bg { position: fixed; inset: 0; background: rgba(12, 32, 30, .45); display: grid; place-items: center; z-index: 900; padding: 16px; animation: fadeIn .15s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 500px; max-height: 90vh; overflow: auto; padding: 26px; box-shadow: var(--shadow-lg); animation: popIn .2s var(--ease); }
.modal.wide { max-width: 720px; }
.modal h2 { font-size: 20px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ---------- кабинет внутри портала Битрикс24 ---------- */
.app.embed { grid-template-columns: minmax(0, 1fr); }
.app.embed .sidebar, .app.embed .topbar { display: none; }
.app.embed .chats { padding: 8px; gap: 8px; }
.embed-nav { display: flex; gap: 6px; padding: 8px 12px 0; }
.embed-nav a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; }
.embed-nav a svg { width: 16px; height: 16px; }
.embed-nav a.active { background: var(--soft); color: var(--primary-hover); }

/* ---------- адаптив (desktop/tablet; мобильная версия — следующий этап) ---------- */
@media (max-width: 1280px) {
  .chats.drawer-open { grid-template-columns: 340px minmax(0, 1fr); }
  .chats.drawer-open .drawer { position: fixed; right: 16px; top: 88px; bottom: 16px; width: 340px; z-index: 50; box-shadow: var(--shadow-lg); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .app, .app.collapsed { --sb: 64px; }
  .app .sidebar { padding: 16px 10px; }
  .app .sb-brand .logo span, .app .nav a > span:not(.badge), .app .org span, .app .org > svg:last-child, .app .sb-card { display: none; }
  .app .org { justify-content: center; padding: 0; }
  .app .nav a { justify-content: center; padding: 0; }
  .app .nav a .badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; font-size: 10px; padding: 0 5px; }
  .app .sb-brand { flex-direction: column; height: auto; }
  .app .sb-brand .icon-btn { display: none; }
  .chats { grid-template-columns: 300px minmax(0, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .gsearch kbd { display: none; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .user-btn .nm, .user-btn .rl, .user-btn > svg { display: none; }
  .page { padding: 18px 14px; }
  .chats { grid-template-columns: 1fr; padding: 8px; }
  .chats.open .chat-list { display: none; }
  .chats:not(.open) .thread { display: none; }
  .thread-head .back { display: inline-grid; }
  .msg { max-width: 88%; }
  .kv { grid-template-columns: 1fr; }
  .notif { width: calc(100vw - 24px); }
}
