/* ============================================================
   Meet Conference — оранжево-белая тема (профессиональные созвоны)
   ============================================================ */
:root {
    --primary: #f26522;        /* оранжевый акцент */
    --primary-dark: #d94f10;
    --primary-soft: #fdeee6;   /* мягкий оранжевый фон под иконки */
    --teal: #15616d;           /* тёмный teal для графиков/акцентов */
    --teal-soft: #e3eef0;
    --ink: #1f2937;            /* основной текст */
    --muted: #6b7280;          /* приглушённый текст */
    --line: #eceef1;           /* границы/разделители */
    --bg: #f6f7f9;             /* фон рабочей области */
    --surface: #ffffff;        /* карточки/сайдбар/топбар */
    --surface-2: #fafbfc;      /* приглушённые блоки (шапки таблиц и т.п.) */
    --surface-3: #f6f7f9;      /* hover/инпуты */
    --sidebar-w: 260px;
    --green: #1aa053;
    --green-soft: #e6f4ec;
    --red: #e23b3b;
    --red-soft: #fdeaea;
    --amber: #f0a92b;
}

/* ===================== ТЁМНАЯ ТЕМА ===================== */
[data-theme="dark"] {
    --primary-soft: rgba(242, 101, 34, .16);
    --primary-dark: #f7945f;
    --teal-soft: rgba(21, 97, 109, .22);
    --green-soft: rgba(26, 160, 83, .18);
    --red-soft: rgba(226, 59, 59, .18);
    --ink: #e6e9ee;
    --muted: #9aa4b2;
    --line: #2c3540;
    --bg: #12161c;
    --surface: #1a1f27;
    --surface-2: #232a34;
    --surface-3: #2b333f;
}
[data-theme="dark"] .sidebar,
[data-theme="dark"] .topbar,
[data-theme="dark"] .app-footer,
[data-theme="dark"] .card,
[data-theme="dark"] .call-chat,
[data-theme="dark"] .notif-menu,
[data-theme="dark"] .dropdown-menu { background: var(--surface); }
[data-theme="dark"] .card-header { background: var(--surface) !important; }
[data-theme="dark"] .side-link { color: #c2c9d4; }
[data-theme="dark"] .side-link:hover { background: var(--surface-2); color: var(--ink); }
[data-theme="dark"] .topbar__icon { color: #c2c9d4; }
[data-theme="dark"] .topbar__icon:hover { background: var(--surface-2); color: var(--ink); }
[data-theme="dark"] .topbar__search input { background: var(--surface-2); color: var(--ink); }
[data-theme="dark"] .topbar__search input:focus { background: var(--surface-3); }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .chat-input input { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .form-control::placeholder { color: #717b88; }
[data-theme="dark"] .form-label,
[data-theme="dark"] .form-check-label,
[data-theme="dark"] label { color: var(--ink); }
[data-theme="dark"] .form-text { color: var(--muted); }
[data-theme="dark"] .breadcrumb-mini, [data-theme="dark"] .breadcrumb-mini a { color: var(--muted); }
[data-theme="dark"] .table { color: var(--ink); }
[data-theme="dark"] .table > thead th { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
[data-theme="dark"] .table-hover > tbody > tr:hover > * { background: var(--surface-2); }
[data-theme="dark"] .table > :not(caption) > * > * { border-color: var(--line); }
[data-theme="dark"] .list-group-item { background: var(--surface); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .bg-light { background: var(--surface-2) !important; color: var(--ink); }
[data-theme="dark"] .alert-light { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .text-muted { color: var(--muted) !important; }
[data-theme="dark"] .btn-light { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .seg { background: var(--surface-2); }
[data-theme="dark"] .seg .active { background: var(--surface); color: var(--ink); }
[data-theme="dark"] .progress { background: var(--surface-2); }
[data-theme="dark"] .notif-item:hover { background: var(--surface-2); }
[data-theme="dark"] .cmsg .cbubble { background: var(--surface-2); color: var(--ink); }
[data-theme="dark"] .wb-toolbar { background: var(--surface); }
[data-theme="dark"] .wb-tool { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .wb-tool:hover { background: var(--surface-3); }
[data-theme="dark"] .nav-group-title { color: #6b7480; }
[data-theme="dark"] .auth-bg { background: linear-gradient(135deg, #15191f, #0f1318); }

* { box-sizing: border-box; }

body {
    font-family: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    margin: 0;
}

a { text-decoration: none; }

/* ===================== LAYOUT ===================== */
.app-layout { min-height: 100vh; }

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
}
.sidebar__brand {
    height: 64px;
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--ink);
    flex-shrink: 0;
}
.sidebar__brand { text-decoration: none; }
.sidebar__brand .logo {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: grid; place-items: center;
    font-size: 1.2rem;
    box-shadow: 0 0 0 4px var(--primary-soft);
    flex-shrink: 0;
}
.sidebar__brand .logo i { line-height: 1; margin-left: 2px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 700; font-size: 1.2rem; color: var(--ink); }
.brand-sub { font-size: .72rem; font-weight: 600; color: var(--primary); letter-spacing: .01em; }
.brand-accent { color: var(--primary); }

.sidebar__nav {
    overflow-y: auto;
    padding: .75rem .75rem 1.5rem;
    flex: 1;
}
.sidebar__nav::-webkit-scrollbar { width: 6px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: #dfe2e6; border-radius: 3px; }

.nav-group-title {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #9ca3af;
    font-weight: 600;
    padding: 1rem .75rem .4rem;
}
.side-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .75rem;
    border-radius: 8px;
    color: #4b5563;
    font-weight: 500;
    position: relative;
    transition: background .15s, color .15s;
}
.side-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.side-link:hover { background: #f6f7f9; color: var(--ink); }
.side-link.active {
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 600;
}
.side-link.active::before {
    content: "";
    position: absolute; left: -.75rem; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 22px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}
.side-badge {
    margin-left: auto;
    font-size: .68rem;
    background: var(--primary);
    color: #fff;
    padding: .1rem .4rem;
    border-radius: 6px;
    font-weight: 600;
}

/* ===================== MAIN ===================== */
.main-wrapper {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.topbar__search {
    flex: 1;
    max-width: 340px;
    position: relative;
}
.topbar__search i {
    position: absolute; left: .8rem; top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}
.topbar__search input {
    width: 100%;
    border: 1px solid var(--line);
    background: #f6f7f9;
    border-radius: 8px;
    padding: .5rem .75rem .5rem 2.2rem;
    font-size: .85rem;
    outline: none;
}
.topbar__search input:focus { border-color: var(--primary); background: #fff; }
.topbar__icons { display: flex; align-items: center; gap: .35rem; margin-left: auto; }
.topbar__icon {
    width: 38px; height: 38px;
    border-radius: 8px;
    display: grid; place-items: center;
    color: #4b5563;
    position: relative;
}
button.topbar__icon { border: 0; background: none; font: inherit; cursor: pointer; }
.topbar__icon:hover { background: #f6f7f9; color: var(--ink); }
.topbar__icon .dot {
    position: absolute; top: 8px; right: 9px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--primary); border: 2px solid #fff;
}
.topbar__user {
    display: flex; align-items: center; gap: .55rem;
    padding-left: .75rem; margin-left: .35rem;
    border-left: 1px solid var(--line);
}
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--teal); color: #fff;
    display: grid; place-items: center;
    font-weight: 600; font-size: .85rem;
}
.topbar__user .u-name { font-weight: 600; line-height: 1.1; }
.topbar__user .u-role { font-size: .72rem; color: var(--muted); }

.content { padding: 1.5rem; flex: 1; }

.app-footer {
    border-top: 1px solid var(--line);
    background: #fff;
    padding: .9rem 1.5rem;
    color: var(--muted);
    font-size: .8rem;
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
}

/* ===================== PAGE HEADER ===================== */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.breadcrumb-mini { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.breadcrumb-mini a { color: var(--muted); }
.breadcrumb-mini .sep { margin: 0 .35rem; }

/* ===================== CARDS ===================== */
.card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.card-header { background: #fff !important; border-bottom: 1px solid var(--line); font-weight: 600; border-radius: 12px 12px 0 0 !important; }

/* Виджеты-статистика (белые карточки в стиле референса) */
.stat-card { display: flex; align-items: flex-start; gap: 1rem; padding: 1.25rem; }
.stat-icon {
    width: 46px; height: 46px; border-radius: 11px;
    display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0;
}
.stat-icon.is-orange { background: var(--primary-soft); color: var(--primary); }
.stat-icon.is-green  { background: var(--green-soft);  color: var(--green); }
.stat-icon.is-teal   { background: var(--teal-soft);   color: var(--teal); }
.stat-icon.is-red    { background: var(--red-soft);    color: var(--red); }
.stat-card .s-label { color: var(--muted); font-size: .82rem; }
.stat-card .s-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; margin: .15rem 0; }
.stat-card .s-sub { font-size: .76rem; color: var(--muted); }

/* ===================== BADGES / BUTTONS ===================== */
.badge { font-weight: 600; padding: .35em .6em; border-radius: 6px; }
.bg-success { background: var(--green) !important; }
.bg-danger  { background: var(--red) !important; }
.bg-warning { background: var(--amber) !important; }
.bg-secondary { background: #6b7280 !important; }

.btn { border-radius: 8px; font-weight: 500; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-success { background: var(--green); border-color: var(--green); }
.btn-success:hover { background: #158242; border-color: #158242; }
a, .text-primary { color: var(--primary); }

/* Сегмент-переключатель (1H 1D 1W 1M / Production·Staging) */
.seg { display: inline-flex; background: #f1f2f4; border-radius: 8px; padding: 3px; gap: 2px; }
.seg button, .seg a {
    border: 0; background: transparent; color: var(--muted);
    font-size: .76rem; font-weight: 600; padding: .3rem .7rem; border-radius: 6px; cursor: pointer;
}
.seg .active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg .active.orange { background: var(--primary); color: #fff; }

/* ===================== TABLES ===================== */
.table { color: var(--ink); }
.table > thead th {
    background: #fafbfc; color: var(--muted);
    font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em;
    border-bottom: 1px solid var(--line);
}
.table > :not(caption) > * > * { padding: .8rem 1rem; }
.table-hover > tbody > tr:hover > * { background: #fafbfc; }

/* progress */
.progress { background: #eef0f2; border-radius: 6px; }

/* ===================== QUICK ACTIONS ===================== */
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .65rem; }
.quick-action {
    display: flex; flex-direction: column; align-items: center; gap: .5rem;
    padding: 1rem .5rem; border: 1px solid var(--line); border-radius: 10px;
    color: var(--ink); text-align: center; transition: .15s;
}
.quick-action:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.quick-action .qa-icon {
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center; font-size: 1.15rem;
}
.quick-action:hover .qa-icon { background: var(--primary); color: #fff; }
.quick-action span { font-size: .78rem; font-weight: 500; line-height: 1.2; }

/* ===================== WORKLOAD BARS ===================== */
.wl-row { margin-bottom: .9rem; }
.wl-row:last-child { margin-bottom: 0; }
.wl-head { display: flex; justify-content: space-between; font-size: .82rem; margin-bottom: .25rem; }
.wl-track { height: 8px; background: #eef0f2; border-radius: 5px; overflow: hidden; }
.wl-fill { height: 100%; background: linear-gradient(90deg, var(--teal), #2a8fa0); border-radius: 5px; }

/* ===================== ROLE DISTRIBUTION ===================== */
.roles-bar { display: flex; height: 26px; border-radius: 7px; overflow: hidden; gap: 3px; }
.roles-bar > span { display: grid; place-items: center; color: #fff; font-size: .72rem; font-weight: 600; }
.roles-bar .r-emp { background: var(--primary); }
.roles-bar .r-adm { background: var(--teal); }
.roles-legend { display: flex; gap: 1.25rem; margin-top: .75rem; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.roles-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; }

/* Донат распределения ролей */
.donut-wrap { position: relative; height: 150px; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.5rem; font-weight: 700; color: var(--ink); pointer-events: none; }

/* Обратный отсчёт до созвона */
.countdown-badge {
    display: inline-block; background: var(--primary-soft); color: var(--primary-dark);
    font-weight: 700; font-size: 1.15rem; padding: .35rem .85rem; border-radius: 10px;
    font-variant-numeric: tabular-nums; letter-spacing: .5px;
}

/* ===================== SUMMARY LIST ===================== */
.sum-row { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.sum-row:last-child { border-bottom: 0; }
.sum-num { font-size: 1.4rem; font-weight: 700; min-width: 44px; }
.sum-label { font-size: .82rem; }
.sum-label small { display: block; color: var(--muted); font-size: .72rem; }

/* ===================== HEATMAP ===================== */
.heatmap {
    display: grid; grid-auto-flow: column;
    grid-template-rows: repeat(7, 1fr); gap: 4px;
    overflow-x: auto; padding-bottom: .25rem;
}
.hm-cell { width: 15px; height: 15px; border-radius: 4px; background: #eef0f2; }
.hm-cell.lvl-1 { background: #fcd9c6; }
.hm-cell.lvl-2 { background: #f7a877; }
.hm-cell.lvl-3 { background: #f47e3f; }
.hm-cell.lvl-4 { background: var(--primary); }
.hm-legend { display: flex; align-items: center; gap: .35rem; font-size: .72rem; color: var(--muted); margin-top: .6rem; }
.hm-legend .hm-cell { width: 12px; height: 12px; }

/* ===================== CALL ROOM (компактный + чат) ===================== */
.call-layout { display: grid; grid-template-columns: 1fr 330px; gap: 1rem; align-items: start; }

/* Левая часть */
.stage-row { display: flex; gap: .6rem; }
.stage {
    flex: 1; position: relative; background: #1e293b; border-radius: 14px;
    overflow: hidden; aspect-ratio: 16 / 9;
}
.stage video { width: 100%; height: 100%; object-fit: cover; }
.stage .stage-ph { position: absolute; inset: 0; display: grid; place-items: center; color: #64748b; font-size: 4rem; }
.stage .stage-name {
    position: absolute; left: .8rem; bottom: .7rem; z-index: 2;
    background: rgba(0,0,0,.55); color: #fff; font-size: .85rem; padding: .25rem .7rem; border-radius: 8px;
}
.stage .stage-timer {
    position: absolute; right: .8rem; top: .7rem; z-index: 2;
    background: rgba(0,0,0,.55); color: #fff; font-size: .8rem; padding: .2rem .6rem; border-radius: 8px;
}
.stage .stage-timer .bi-record-circle { color: #ef4444; }

/* Колонка превью */
.thumbs { display: flex; flex-direction: column; gap: .5rem; width: 96px; max-height: 56vh; overflow-y: auto; }
.thumb {
    position: relative; width: 96px; height: 64px; border-radius: 10px; overflow: hidden;
    background: #1e293b; cursor: pointer; border: 2px solid transparent; flex-shrink: 0;
}
.thumb.active { border-color: var(--primary); }
.thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .t-ph { position: absolute; inset: 0; display: grid; place-items: center; color: #64748b; font-size: 1.4rem; }
.thumb .t-name {
    position: absolute; left: 3px; bottom: 2px; right: 3px; z-index: 2;
    color: #fff; font-size: .6rem; background: rgba(0,0,0,.5); border-radius: 4px;
    padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thumb .t-mic { position: absolute; right: 3px; top: 3px; color: #f87171; font-size: .7rem; z-index: 2; }
.thumb .t-hand { position: absolute; left: 3px; top: 2px; font-size: .8rem; z-index: 3; filter: drop-shadow(0 0 2px #000); }
.thumb .t-allow {
    position: absolute; right: 3px; bottom: 16px; z-index: 4; width: 22px; height: 22px;
    border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: .65rem;
    display: grid; place-items: center; cursor: pointer;
}
.thumb .t-allow.granted { background: var(--green); }
.call-btn.is-on { background: var(--primary); color: #fff; }
.call-btn.rec-on { background: var(--red); color: #fff; animation: recpulse 1.2s infinite; }
@keyframes recpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(226,59,59,.5); } 50% { box-shadow: 0 0 0 9px rgba(226,59,59,0); } }

/* Панель управления */
.call-bar {
    display: flex; justify-content: center; gap: .7rem; margin: 1rem auto 0;
    padding: .55rem .8rem; background: #fff; border: 1px solid var(--line);
    border-radius: 999px; box-shadow: 0 4px 16px rgba(16,24,40,.08); width: max-content;
}
.call-btn {
    width: 52px; height: 52px; border-radius: 50%;
    border: 1px solid var(--line); background: #fff; color: #475569;
    font-size: 1.2rem; display: grid; place-items: center; cursor: pointer;
    transition: transform .15s, box-shadow .15s, background .15s, color .15s;
    box-shadow: 0 1px 3px rgba(16,24,40,.06);
}
.call-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(16,24,40,.16); color: var(--ink); }
.call-btn:active { transform: translateY(0); }
.call-btn:disabled { opacity: .5; cursor: default; transform: none; }
.call-btn.is-off { background: #fdeaea; color: var(--red); border-color: #f6c9c9; }
.call-btn.hangup {
    width: 62px; height: 62px; background: var(--red); border-color: var(--red); color: #fff;
    box-shadow: 0 6px 18px rgba(226,59,59,.45);
}
.call-btn.hangup:hover { background: #cc2f2f; color: #fff; }
.call-status { color: var(--muted); font-size: .82rem; text-align: center; margin-top: .65rem; }

/* Чат */
.call-chat {
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    display: flex; flex-direction: column; height: 70vh; overflow: hidden;
}
.chat-head { padding: .85rem 1rem; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; align-items: center; justify-content: space-between; }

/* Баннер установки на iPhone */
.ios-install {
    display: none; position: fixed; left: 10px; right: 10px; z-index: 1060;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    background: var(--primary); color: #fff; border-radius: 12px; padding: .7rem .85rem;
    align-items: center; gap: .65rem; font-size: .85rem; box-shadow: 0 10px 28px rgba(0,0,0,.3);
}
.ios-install b { font-weight: 700; }

/* Показывать только на мобильном */
.mobile-only { display: none !important; }
@media (max-width: 991px) {
    .call-btn.mobile-only { display: grid !important; }
    .btn-close.mobile-only { display: inline-block !important; }

    /* Созвон как приложение: видео вписано в экран, превью лентой, чат — выезжает снизу */
    body, .main-wrapper, .content { overflow-x: hidden; }
    .call-layout { display: block; max-width: 100%; }
    .call-main, .stage-row { max-width: 100%; }
    .stage-row { flex-direction: column; gap: .5rem; }
    .stage { aspect-ratio: auto; height: 44vh; width: 100%; }
    .stage video { object-fit: contain; background: #0b0f17; }   /* видео целиком, не вылазит за экран */
    .thumbs { flex-direction: row; width: 100%; max-height: none; overflow-x: auto; overflow-y: hidden; }
    .thumb { width: 82px; height: 56px; flex: 0 0 auto; }
    .call-bar { flex-wrap: wrap; gap: .5rem; padding: .5rem .6rem; max-width: 100%; }
    .call-chat {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: 80vh; z-index: 1055;
        border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.35);
        transform: translateY(105%); transition: transform .3s ease;
    }
    .call-layout.chat-open .call-chat { transform: translateY(0); }

    /* компактная шапка комнаты, чтобы кнопки не растягивали ширину */
    .page-head { gap: .5rem; }
    .page-head .btn { padding: .3rem .55rem; font-size: .8rem; }
}
.chat-msgs { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .55rem; }
.cmsg { max-width: 85%; align-self: flex-start; }
.cmsg.mine { align-self: flex-end; text-align: right; }
.cmsg .cname { font-size: .7rem; color: var(--muted); margin: 0 .2rem .1rem; }
.cmsg .cbubble {
    display: inline-block; background: #f1f2f4; color: var(--ink);
    padding: .45rem .7rem; border-radius: 12px; font-size: .85rem; word-break: break-word; text-align: left;
}
.cmsg.mine .cbubble { background: var(--primary-soft); color: var(--primary-dark); }
.cmsg .ctime { font-size: .62rem; color: var(--muted); margin: .15rem .3rem 0; }
.cmsg-act { border: 0; background: none; cursor: pointer; font-size: .72rem; padding: 0; opacity: .6; }
.cmsg-act:hover { opacity: 1; }
.cmsg-link { margin-top: .45rem; }
.cmsg-link .btn { font-size: .78rem; }
.chat-input { display: flex; gap: .5rem; padding: .65rem; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; outline: none; font-size: .85rem; }
.chat-input input:focus { border-color: var(--primary); }
.chat-input .btn { padding: .4rem .8rem; }

@media (max-width: 991px) {
    .call-layout { grid-template-columns: 1fr; }
    .call-chat { height: 50vh; }
}

/* Топбар гостевой страницы созвона */
.guest-topbar {
    display: flex; align-items: center; gap: .55rem; height: 56px; padding: 0 1.25rem;
    background: #fff; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 1.15rem;
}
.guest-topbar .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; }

/* Полноэкранный режим созвона — ТОЛЬКО спикер на весь экран (без превью и чата) */
.call-layout:fullscreen {
    display: block; height: 100vh; padding: .5rem; gap: 0; background: #0b0f17;
}
.call-layout:-webkit-full-screen {
    display: block; height: 100vh; padding: .5rem; gap: 0; background: #0b0f17;
}
.call-layout:fullscreen .call-chat,
.call-layout:fullscreen .thumbs { display: none; }      /* прячем чат и превью */
.call-layout:fullscreen .call-main { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.call-layout:fullscreen .stage-row { flex: 1; min-height: 0; }
.call-layout:fullscreen .stage { aspect-ratio: auto; height: 100%; width: 100%; }
.call-layout:fullscreen .stage video { object-fit: contain; background: #0b0f17; }  /* спикера видно целиком */
.call-layout:fullscreen .call-status { color: #cbd5e1; }

/* Авто-скрытие нижней панели в фуллскрине (как панель задач Windows) */
.call-layout:fullscreen .call-bar, .call-layout:-webkit-full-screen .call-bar {
    position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); margin: 0;
    transition: transform .35s ease, opacity .35s ease; z-index: 60;
}
.call-layout:fullscreen.bar-hidden .call-bar, .call-layout:-webkit-full-screen.bar-hidden .call-bar {
    transform: translateX(-50%) translateY(180%); opacity: 0; pointer-events: none;
}
.call-layout:fullscreen.bar-hidden { cursor: none; }
.call-layout:fullscreen .call-status, .call-layout:-webkit-full-screen .call-status {
    position: fixed; left: 0; right: 0; bottom: .35rem; transition: opacity .35s ease;
}
.call-layout:fullscreen.bar-hidden .call-status { opacity: 0; }

/* ===================== ИНСТРУМЕНТАРИЙ / ДОСКА ===================== */
/* Превью пространства в списке */
.board-thumb {
    display: grid; place-items: center; height: 96px;
    background-color: #0a0c10;
    background-image: radial-gradient(circle, #5b626e 1px, transparent 1.6px);
    background-size: 20px 20px;
    border-radius: 12px 12px 0 0;
    color: #5a6472; font-size: 2rem;
}
.board-thumb:hover { color: #38bdf8; }

/* Заголовок-инпут доски */
.board-title-input {
    font-size: 1.35rem; font-weight: 700; border: 0; border-bottom: 1px dashed transparent;
    background: transparent; outline: none; color: var(--ink); padding: 0; max-width: 480px; width: 100%;
}
.board-title-input:focus { border-bottom-color: var(--primary); }

/* Панель инструментов */
.wb-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    padding: .5rem .65rem; margin-bottom: .75rem;
}
.wb-tool {
    border: 1px solid var(--line); background: #fff; color: #4b5563;
    width: 38px; height: 34px; display: grid; place-items: center; cursor: pointer;
}
.wb-tool:first-child { border-radius: 8px 0 0 8px; }
.wb-tool:last-child { border-radius: 0 8px 8px 0; }
.wb-tool:hover { background: #f6f7f9; color: var(--ink); }
.wb-tool.active { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary); }

.wb-colors { display: flex; align-items: center; gap: 4px; }
.wb-color { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.wb-color:hover { transform: scale(1.12); }
#colorPicker { width: 30px; height: 26px; border: 1px solid var(--line); border-radius: 6px; padding: 0; background: none; cursor: pointer; }

/* Холст: чёрный фон, точки рисуются на канвасе (масштабируются при зуме) */
.wb-wrap {
    border: 1px solid #1c2230; border-radius: 12px; overflow: hidden;
    /* Заполняет экран по высоте (под топбаром/тулбаром), без полос прокрутки */
    height: calc(100vh - 185px); min-height: 360px;
    background: #0a0c10; position: relative;
}
.wb-wrap canvas { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }

.wb-zoom { display: flex; align-items: center; gap: 2px; }
.wb-zoom .zlabel { font-size: .76rem; color: var(--muted); min-width: 42px; text-align: center; }

/* Полноэкранный режим доски */
#boardArea:fullscreen { background: #0a0c10; padding: .6rem; display: flex; flex-direction: column; }
#boardArea:-webkit-full-screen { background: #0a0c10; padding: .6rem; display: flex; flex-direction: column; }
#boardArea:fullscreen .wb-toolbar { margin-bottom: .6rem; }
#boardArea:fullscreen .wb-wrap { height: auto; flex: 1; }

/* Чекбоксы ролей */
.roles-check { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; }
.roles-check li { margin: 0; }

/* ===================== УВЕДОМЛЕНИЯ ===================== */
.notif-badge {
    position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px;
    padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff;
    font-size: .62rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff;
}
.notif-menu { width: 340px; max-width: 92vw; padding: 0; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,.14); overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; border-bottom: 1px solid var(--line); font-weight: 600; }
.notif-item { display: flex; gap: .65rem; padding: .65rem 1rem; border-bottom: 1px solid var(--line); color: var(--ink); align-items: flex-start; }
.notif-item:hover { background: #f6f7f9; }
.notif-item.unread { background: var(--primary-soft); }
.notif-item.unread:hover { background: #fbe2d6; }
.ni-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex-shrink: 0; }
.ni-body { display: flex; flex-direction: column; min-width: 0; }
.ni-text { font-size: .82rem; line-height: 1.25; }
.ni-time { font-size: .68rem; color: var(--muted); margin-top: .1rem; }
.notif-empty { padding: 1.5rem; text-align: center; color: var(--muted); font-size: .85rem; }
.notif-all { display: block; text-align: center; padding: .6rem; font-weight: 600; color: var(--primary); }
.notif-all:hover { background: #f6f7f9; }

/* ===================== AUTH ===================== */
.auth-bg {
    min-height: 100vh;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #fff5f0, #f6f7f9);
    padding: 1rem;
}
.auth-card { border-radius: 16px; box-shadow: 0 12px 40px rgba(16,24,40,.10); width: 100%; max-width: 400px; }
.auth-logo {
    width: 52px; height: 52px; border-radius: 13px; margin: 0 auto;
    background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 1.5rem;
}

/* --- Сплит-экран авторизации в стиле референса --- */
.auth-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 1080px;
    min-height: min(88vh, 720px);
    background: var(--surface);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(16, 24, 40, .16);
}
.auth-aside {
    background: linear-gradient(160deg, #fff3ec 0%, #fde5d5 100%);
    padding: 2.75rem 2.5rem;
    display: flex; flex-direction: column;
    position: relative; overflow: hidden;
}
.auth-aside::after {
    content: ""; position: absolute; right: -90px; bottom: -90px;
    width: 260px; height: 260px; border-radius: 50%;
    background: radial-gradient(circle, rgba(242,101,34,.18), transparent 70%);
}
.auth-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 2.25rem; }
.auth-brand .logo {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary); color: #fff; display: grid; place-items: center;
    font-size: 1.25rem; box-shadow: 0 0 0 5px rgba(242, 101, 34, .16);
}
.auth-brand .logo i { margin-left: 2px; }
.auth-headline { font-size: 1.95rem; font-weight: 800; line-height: 1.22; color: var(--ink); margin: 0 0 .9rem; }
.auth-sub { color: var(--muted); font-size: .95rem; margin: 0 0 2rem; max-width: 34ch; }
.auth-features { display: flex; flex-direction: column; gap: 1.15rem; margin-top: auto; position: relative; z-index: 1; }
.auth-feature { display: flex; gap: .9rem; align-items: flex-start; }
.auth-feature .af-icon {
    width: 44px; height: 44px; border-radius: 12px; background: #fff; color: var(--primary);
    display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(242, 101, 34, .14);
}
.auth-feature h4 { font-size: .92rem; font-weight: 700; margin: 0 0 .12rem; color: var(--ink); }
.auth-feature p { font-size: .8rem; color: var(--muted); margin: 0; line-height: 1.35; }

.auth-form-panel { padding: 3rem; display: flex; flex-direction: column; justify-content: center; }
.auth-form-panel .af-title { font-size: 1.7rem; font-weight: 800; text-align: center; margin: 0 0 .35rem; }
.auth-form-panel .af-desc { text-align: center; color: var(--muted); margin: 0 0 1.9rem; font-size: .92rem; }
.auth-form-panel .form-label { font-weight: 600; font-size: .82rem; margin-bottom: .35rem; }
.auth-form-panel .form-control { border-radius: 10px; padding: .72rem .9rem; }
.auth-form-panel .btn-primary { padding: .78rem; font-weight: 700; border-radius: 10px; font-size: .98rem; }
.auth-divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .78rem; margin: 1.5rem 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-alt { text-align: center; font-size: .88rem; color: var(--muted); }
.auth-terms { text-align: center; font-size: .74rem; color: var(--muted); margin-top: 1.6rem; line-height: 1.5; }

[data-theme="dark"] .auth-split { background: var(--surface); }
[data-theme="dark"] .auth-aside { background: linear-gradient(160deg, #221a15 0%, #2a1d12 100%); }
[data-theme="dark"] .auth-feature .af-icon { background: var(--surface-2); }

@media (max-width: 860px) {
    .auth-split { grid-template-columns: 1fr; max-width: 440px; min-height: 0; }
    .auth-aside { display: none; }
    .auth-form-panel { padding: 2.5rem 1.75rem; }
}

/* ===================== MOBILE ===================== */
.sidebar-backdrop { display: none; }
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .app-layout.nav-open .sidebar { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .app-layout.nav-open .sidebar-backdrop {
        display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1035;
    }
}
.nav-toggle { background: none; border: 0; color: var(--ink); font-size: 1.3rem; display: none; }
@media (max-width: 991px) { .nav-toggle { display: inline-flex; } }

/* ===================== МОБИЛЬНОЕ ПРИЛОЖЕНИЕ ===================== */
.mobile-nav { display: none; }
@media (max-width: 991px) {
    .mobile-nav {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1046;
        background: var(--surface); border-top: 1px solid var(--line);
        justify-content: space-around; align-items: stretch;
        /* высота = панель + безопасная зона снизу (домашняя полоса iPhone) */
        height: calc(56px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -2px 14px rgba(0,0,0,.10);
    }
    .mn-item {
        flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 2px; border: 0; background: none; color: var(--muted); font-size: .6rem; text-decoration: none;
    }
    .mn-item i { font-size: 1.3rem; }
    .mn-item.active { color: var(--primary); }

    /* верхний app-bar: опускаем контент под чёлку/статус-бар iPhone */
    .topbar {
        gap: .4rem;
        height: calc(60px + env(safe-area-inset-top, 0px));
        padding: env(safe-area-inset-top, 0px) .85rem 0;
    }
    .topbar::before { content: "AXIS Meet"; font-weight: 700; color: var(--ink); font-size: 1.05rem; margin-right: auto; }
    .topbar__search, .nav-toggle { display: none; }
    .topbar__user .u-name, .topbar__user .u-role { display: none; }
    .topbar__user { border-left: 0; padding-left: .25rem; }
    .content { padding: 1rem .8rem; }
    .app-footer { display: none; }
    /* место под таб-панель + безопасную зону */
    .main-wrapper { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
    .page-head h1 { font-size: 1.2rem; }
    .card { border-radius: 14px; }

    /* компактные таблицы, чтобы влезали и читались на телефоне */
    .table { font-size: .82rem; }
    .table > :not(caption) > * > * { padding: .5rem .5rem; }
    .table-responsive { -webkit-overflow-scrolling: touch; }

    /* боковое меню тоже учитывает чёлку */
    .sidebar__brand { padding-top: env(safe-area-inset-top, 0px); height: calc(64px + env(safe-area-inset-top, 0px)); }
}

/* ============================================================
   MEET — дашборд / сайдбар / топбар (стиль референса axis)
   ============================================================ */

/* --- Сайдбар: подвал, теги, сворачивание --- */
.sidebar__foot { border-top: 1px solid var(--line); padding: .5rem .75rem; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.side-link .sl-tag { margin-left: auto; font-size: .6rem; font-weight: 700; padding: .1rem .35rem; border-radius: 5px; letter-spacing: .03em; }
.sl-tag.live { background: var(--red); color: #fff; }
.sl-tag.new  { background: var(--green); color: #fff; }
[data-theme="dark"] .sidebar__foot { border-color: var(--line); }

@media (min-width: 992px) {
    .app-layout.sidebar-collapsed .sidebar { width: 76px; }
    .app-layout.sidebar-collapsed .main-wrapper { margin-left: 76px; }
    .app-layout.sidebar-collapsed .brand-text,
    .app-layout.sidebar-collapsed .sl-text,
    .app-layout.sidebar-collapsed .sl-tag,
    .app-layout.sidebar-collapsed .nav-group-title { display: none; }
    .app-layout.sidebar-collapsed .side-link { justify-content: center; }
    .app-layout.sidebar-collapsed .sidebar__brand { justify-content: center; padding: 0; }
    .app-layout.sidebar-collapsed .side-link.active::before { left: 0; }
}

/* --- Топбар: кнопка «Запланировать звонок» --- */
.btn-schedule {
    display: inline-flex; align-items: center; gap: .45rem;
    background: var(--primary); color: #fff; font-weight: 600; font-size: .84rem;
    padding: .55rem .95rem; border-radius: 9px; margin-right: .35rem; white-space: nowrap;
}
.btn-schedule:hover { background: var(--primary-dark); color: #fff; }
@media (max-width: 991px) { .btn-schedule { display: none; } }

/* --- Заголовок дашборда: пилюля периода --- */
.date-pill {
    display: inline-flex; align-items: center; gap: .45rem;
    border: 1px solid var(--line); border-radius: 9px; padding: .5rem .85rem;
    font-size: .82rem; font-weight: 600; color: var(--ink); background: var(--surface); cursor: pointer;
}
.date-pill i:first-child { color: var(--primary); }

/* --- KPI-дельта --- */
.s-delta { font-size: .74rem; font-weight: 600; color: var(--primary); margin-top: .2rem; }
.s-delta .bi { font-size: .7rem; }

/* --- Легенда и обёртка графика (фикс.высота — иначе Chart.js бесконечно растёт) --- */
.chart-legend { display: flex; gap: 1.1rem; font-size: .8rem; color: var(--muted); }
.chart-legend .dot, .donut-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .3rem; }
.chart-wrap { position: relative; height: 240px; width: 100%; }
.chart-wrap canvas { position: absolute; inset: 0; }

/* --- Донат типов звонков --- */
.donut-row { display: flex; align-items: center; gap: 1.1rem; }
.donut-box { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.donut-box canvas { position: absolute; inset: 0; width: 150px !important; height: 150px !important; }
.donut-box .donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-center .dc-num { font-size: 1.5rem; font-weight: 700; color: var(--ink); line-height: 1; }
.donut-center .dc-lbl { font-size: .72rem; color: var(--muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; }
.donut-legend li { display: flex; align-items: center; font-size: .82rem; padding: .3rem 0; }
.donut-legend .dl-name { color: var(--muted); }
.donut-legend .dl-val { margin-left: auto; font-weight: 600; color: var(--ink); }
.donut-legend .dl-val small { color: var(--muted); font-weight: 500; }
@media (max-width: 420px) { .donut-row { flex-direction: column; } }

/* --- Карточка тарифа --- */
.tariff-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.tariff-crown { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 1.2rem; }
.tariff-name { font-weight: 700; font-size: 1.05rem; color: var(--primary); }
.tariff-price { font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.tariff-price small { font-size: .78rem; font-weight: 500; color: var(--muted); }
.tariff-feats { list-style: none; margin: 0 0 1.1rem; padding: 0; }
.tariff-feats li { font-size: .82rem; padding: .32rem 0; color: var(--ink); display: flex; gap: .5rem; align-items: flex-start; }
.tariff-feats .bi { color: var(--primary); font-weight: 700; }

/* --- Список предстоящих звонков --- */
.up-row { display: flex; align-items: center; gap: .7rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.up-row:first-child { padding-top: .3rem; }
.up-date { width: 42px; text-align: center; background: var(--primary-soft); border-radius: 9px; padding: .3rem 0; flex-shrink: 0; }
.up-date b { display: block; font-size: 1.05rem; color: var(--primary-dark); line-height: 1; }
.up-date span { font-size: .66rem; color: var(--primary-dark); text-transform: lowercase; }
.up-info { flex: 1; min-width: 0; }
.up-title { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-meta { font-size: .74rem; color: var(--muted); }
.up-tag { font-size: .68rem; font-weight: 600; padding: .2rem .5rem; border-radius: 6px; white-space: nowrap; }
.up-tag.is-orange { background: var(--primary-soft); color: var(--primary-dark); }
.up-tag.is-violet { background: #ede9fe; color: #6d28d9; }
.up-tag.is-blue   { background: #dbeafe; color: #1d4ed8; }
.up-start { flex-shrink: 0; }
[data-theme="dark"] .up-tag.is-violet { background: rgba(109,40,217,.22); color: #c4b5fd; }
[data-theme="dark"] .up-tag.is-blue   { background: rgba(29,78,216,.22); color: #93c5fd; }

/* --- Список последних записей --- */
.rec-row { display: flex; align-items: center; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.rec-row:first-child { padding-top: .3rem; }
.rec-thumb { position: relative; width: 56px; height: 40px; border-radius: 8px; background: #1e293b; color: #fff; display: grid; place-items: center; font-size: 1rem; flex-shrink: 0; }
.rec-dur { position: absolute; right: 2px; bottom: 2px; font-size: .56rem; background: rgba(0,0,0,.6); padding: 0 3px; border-radius: 3px; }
.rec-info { flex: 1; min-width: 0; }
.rec-title { font-weight: 600; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-meta { font-size: .73rem; color: var(--muted); }
.rec-more { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; padding: 0 .2rem; }
.rec-more:hover { color: var(--ink); }

/* --- Ссылка «Все …» в подвале карточки --- */
.card-foot-link { display: block; text-align: center; padding: .8rem 0 .1rem; font-weight: 600; font-size: .84rem; color: var(--primary); }
.card-foot-link:hover { color: var(--primary-dark); }

/* --- Статус системы --- */
.sys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem .5rem; }
.sys-item { display: flex; align-items: center; gap: .5rem; }
.sys-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); flex-shrink: 0; }
.sys-name { font-size: .82rem; font-weight: 600; }
.sys-state { font-size: .72rem; color: var(--green); }

/* --- Хранилище --- */
.store-top { font-size: .84rem; margin-bottom: .6rem; color: var(--ink); }
.store-pct { text-align: right; font-size: .74rem; color: var(--muted); margin-top: .4rem; }

/* --- AI-саммари --- */
.ai-big { font-size: 2.2rem; font-weight: 700; line-height: 1; display: flex; align-items: baseline; gap: .6rem; }
.ai-delta { font-size: .8rem; font-weight: 600; color: var(--primary); }
.ai-sub { font-size: .8rem; color: var(--muted); margin-top: .5rem; }

/* --- Страница-заглушка --- */
.soon-wrap { padding: 3.5rem 1.5rem; text-align: center; }
.soon-icon { width: 74px; height: 74px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 2rem; margin: 0 auto 1.2rem; }
.soon-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 .5rem; }
.soon-text { color: var(--muted); max-width: 46ch; margin: 0 auto 1.4rem; }
