:root {
    --primary-color: #4361ee;
    --primary-light: #4895ef;
    --secondary-color: #3f37c9;
    --accent-color: #4cc9f0;
    --bg-color: #f8f9fa;
    --sidebar-bg: #ffffff;
    --text-main: #2b2d42;
    --text-muted: #8d99ae;
    --card-bg: rgba(255, 255, 255, 0.8);
    --border-color: #e9ecef;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.1rem 1rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 2rem;
    letter-spacing: -0.5px;
    flex: 0 0 auto;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.nav-menu {
    list-style: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.35rem;
    scrollbar-gutter: stable;
}

.nav-menu::-webkit-scrollbar {
    width: 6px;
}

.nav-menu::-webkit-scrollbar-thumb {
    background: #d9def5;
    border-radius: 999px;
}

.nav-menu::-webkit-scrollbar-track {
    background: transparent;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: #f0f3ff;
    color: var(--primary-color);
}

.nav-link.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.nav-group-label {
    margin: 1.25rem 0 0.6rem;
    padding: 0 16px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-parent {
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
}

.nav-parent.child-active {
    background: #f0f3ff;
    color: var(--primary-color);
}

.nav-chevron {
    width: 16px;
    height: 16px;
    margin-left: auto;
    transition: transform 0.2s ease;
}

.nav-item--collapsible.open .nav-chevron {
    transform: rotate(180deg);
}

.nav-submenu {
    display: none;
    list-style: none;
    margin: 0.35rem 0 0.75rem 0;
    padding-left: 34px;
}

.nav-item--collapsible.open .nav-submenu {
    display: block;
}

.nav-sublink {
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 0.84rem;
    gap: 8px;
}

.nav-sublink i {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
}

/* Main Content */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: calc(100vw - 260px);
    overflow-x: hidden;
    position: relative;
    z-index: 101;
}

.top-bar {
    height: 70px;
    padding: 0 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
    overflow: visible;
}

.top-bar-status-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 1 auto;
    min-width: 0;
    overflow: visible;
}

.demo-mode-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fff8e6;
    border: 1px solid #f5d76e;
    color: #8a6d1d;
    font-size: 0.75rem;
    font-weight: 600;
    flex: 0 1 auto;
    max-width: 340px;
    line-height: 1.2;
}

.max-bot-auth-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.max-bot-auth-hint:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
    color: #1e3a8a;
}

.max-bot-auth-hint-text {
    min-width: 0;
    text-align: center;
}

.max-bot-auth-hint-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    flex-shrink: 0;
}

.max-bot-auth-hint:hover .max-bot-auth-hint-icon {
    background: #1d4ed8;
}

.max-bot-auth-hint-icon i {
    width: 15px;
    height: 15px;
}

.top-bar .max-bot-auth-help {
    flex-shrink: 0;
}

.top-bar .max-bot-auth-help summary {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #2563eb;
}

.top-bar .max-bot-auth-help .module-help-text {
    left: auto;
    right: 0;
    top: calc(100% + 10px);
    width: min(300px, calc(100vw - 48px));
    z-index: 200;
}

.max-bot-auth-help-content p {
    margin: 0;
    color: var(--text-main);
    font-weight: 600;
}

.max-bot-auth-help-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.82rem;
    text-decoration: none;
}

@keyframes max-bot-auth-hint-pulse {
    0%, 100% {
        background: #eff6ff;
        border-color: #60a5fa;
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.28);
    }

    50% {
        background: #dbeafe;
        border-color: #2563eb;
        box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
    }
}

.max-bot-auth-hint--attention {
    animation: max-bot-auth-hint-pulse 1.5s ease-in-out infinite;
}

.max-bot-auth-hint--attention:hover {
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    .max-bot-auth-hint--attention {
        animation: none;
        border-color: #2563eb;
    }
}

.max-bot-auth-hint-slot:empty {
    display: none;
}

.auth-card .max-bot-auth-hint {
    margin: 0 0 16px;
    width: 100%;
}

.demo-mode-banner i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.demo-mode-banner--readonly {
    background: #eef5ff;
    border-color: #b8ccf5;
    color: #2f4f9c;
}

.page-title h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ai-copilot-trigger[hidden] {
    display: none !important;
}

.ai-copilot-trigger {
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid rgba(67, 97, 238, 0.18);
    border-radius: 999px;
    background: #f8faff;
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.08);
    animation: ai-copilot-pulse 1.8s ease-in-out infinite;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.ai-copilot-trigger:hover {
    background: #eef2ff;
    box-shadow: 0 6px 18px rgba(67, 97, 238, 0.14);
    transform: translateY(-1px);
    animation-play-state: paused;
}

.ai-copilot-trigger i {
    width: 17px;
    height: 17px;
}

@keyframes ai-copilot-pulse {
    0%,
    100% {
        border-color: rgba(67, 97, 238, 0.18);
        box-shadow: 0 4px 12px rgba(67, 97, 238, 0.08);
    }

    50% {
        border-color: rgba(67, 97, 238, 0.58);
        box-shadow: 0 0 0 6px rgba(67, 97, 238, 0.08), 0 8px 22px rgba(67, 97, 238, 0.18);
    }
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ddd;
    object-fit: cover;
}

.content-area {
    padding: 2.5rem 3rem;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

/* Dashboard Widgets */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    min-width: 0;
}

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
    min-width: 0;
}

.card:hover {
    transform: translateY(-5px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    align-items: center;
}

.card-title {
    font-weight: 700;
    color: var(--text-main);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.metric-card {
    min-width: 0;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
}

.metric-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    flex: 0 0 auto;
}

.metric-icon i {
    width: 22px;
    height: 22px;
}

.metric-info {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.metric-label,
.metric-value,
.metric-change {
    display: block;
    min-width: 0;
}

.metric-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1.25;
}

.metric-value {
    color: var(--text-main);
    font-size: 1.75rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.03em;
}

.metric-change {
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1.25;
}

.metric-change.positive {
    color: var(--success);
}

.metric-change.negative {
    color: var(--danger);
}

.status-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.2;
    vertical-align: middle;
}

.status-online {
    background: #e8f5e9;
    color: var(--success);
}

.live-bot-badge {
    position: relative;
    width: 24px;
    height: 24px;
    margin-left: 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    background: #e8f5e9;
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.5);
    animation: liveBadgePulse 1.45s ease-out infinite;
    vertical-align: middle;
    cursor: help;
}

.live-bot-badge i {
    width: 13px;
    height: 13px;
}

@keyframes liveBadgePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.45);
        transform: scale(1);
    }
    70% {
        box-shadow: 0 0 0 9px rgba(76, 175, 80, 0);
        transform: scale(1.04);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
        transform: scale(1);
    }
}

body.auth-locked {
    overflow: hidden;
}

.auth-screen {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 18% 18%, rgba(67, 97, 238, 0.18), transparent 30%),
        radial-gradient(circle at 82% 12%, rgba(76, 175, 80, 0.13), transparent 28%),
        linear-gradient(135deg, #eef4ff 0%, #f8faff 46%, #f6fbf8 100%);
    backdrop-filter: blur(10px);
}

.auth-card {
    width: min(520px, calc(100vw - 32px));
    padding: 38px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 34px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.93));
    box-shadow: 0 30px 90px rgba(67, 97, 238, 0.16);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 30px;
}

.auth-card .logo-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    box-shadow: 0 12px 26px rgba(67, 97, 238, 0.22);
}

.auth-title {
    font-size: 2rem;
    line-height: 1;
    font-weight: 900;
    color: var(--text-main);
    letter-spacing: -0.04em;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.94rem;
    font-weight: 600;
    margin-top: 8px;
}

.auth-field {
    display: block;
    margin-top: 16px;
}

.auth-field > span {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 800;
}

.auth-input-wrap {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 0 16px;
    border: 1px solid #e1e7f5;
    border-radius: 18px;
    background: #f8faff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.auth-input-wrap:focus-within {
    border-color: rgba(67, 97, 238, 0.55);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.09);
}

.auth-input-wrap i {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

.auth-input-wrap input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-main);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
}

.auth-input-wrap input::placeholder {
    color: #b6c0d4;
}

.auth-submit {
    width: 100%;
    justify-content: center;
    margin-top: 22px;
    padding: 17px 20px;
    border-radius: 20px;
    font-size: 1rem;
    box-shadow: 0 18px 34px rgba(67, 97, 238, 0.22);
}

.auth-error {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid #fecaca;
    border-radius: 18px;
    color: var(--danger);
    background: #fff1f2;
    font-weight: 700;
    font-size: 0.9rem;
}

.auth-error i {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
}

.auth-hint {
    margin-top: 18px;
    text-align: center;
    line-height: 1.45;
}

.auth-demo {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eef2f7;
}

.auth-demo-title {
    margin-bottom: 10px;
    color: #9aa3b5;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
}

.auth-demo-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-demo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #8b93a7;
    font-size: 0.78rem;
    line-height: 1.35;
}

.auth-demo-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.auth-demo-fill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 1px solid #e3e8f2;
    border-radius: 8px;
    background: #f8faff;
    color: #8b93a7;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.auth-demo-fill:hover {
    background: #eef3ff;
    border-color: #c9d6f5;
    color: #4b5d88;
}

.auth-demo-fill i {
    width: 14px;
    height: 14px;
}

.auth-demo-creds {
    color: #7a8296;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.76rem;
    font-weight: 500;
    white-space: nowrap;
}

.auth-demo-label {
    color: #a0a8ba;
    font-size: 0.74rem;
    font-weight: 500;
    text-align: left;
}

.qr-access-modal {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.qr-access-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 22px;
    align-items: center;
    padding: 22px;
    border: 1px solid #e5ebfb;
    border-radius: 24px;
    background: linear-gradient(135deg, #f8faff, #ffffff);
    box-shadow: 0 18px 50px rgba(67, 97, 238, 0.08);
}

.qr-access-title {
    color: var(--text-main);
    font-size: 1.15rem;
    font-weight: 900;
}

.qr-access-text {
    margin-top: 8px;
    color: var(--text-muted);
    line-height: 1.55;
    font-weight: 600;
}

.qr-access-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.qr-code-box {
    min-height: 250px;
    border: 1px dashed #cfd8f6;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.qr-code-box canvas {
    width: 220px !important;
    height: 220px !important;
}

.qr-code-box svg {
    width: 220px;
    height: 220px;
    border-radius: 16px;
    display: block;
}

.qr-loading,
.qr-fallback {
    color: var(--text-muted);
    font-weight: 700;
    text-align: center;
    padding: 16px;
}

.qr-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.qr-fallback-image {
    width: 220px;
    height: 220px;
    border-radius: 16px;
}

.qr-fallback-note {
    max-width: 220px;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.qr-fallback.is-error .qr-fallback-image {
    display: none;
}

.qr-fallback.is-error::before {
    content: "QR не загрузился";
    color: var(--danger);
    font-weight: 900;
}

.qr-fallback i {
    width: 34px;
    height: 34px;
    color: var(--primary-color);
}

.status-warning {
    background: #fff3e0;
    color: var(--warning);
}

.status-error {
    background: #ffebee;
    color: var(--danger);
}

.status-danger {
    background: #ffebee;
    color: var(--danger);
}

/* Chat module */
.chat-module {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.chat-module-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 20px;
    margin-bottom: 2rem;
    min-width: 0;
}

.chat-module-hero > div {
    min-width: 0;
}

.chat-module-hero p {
    max-width: 860px;
}

.chat-primary-action {
    min-height: 48px;
    justify-content: center;
    white-space: nowrap;
}

.chat-hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.chat-secondary-action {
    min-height: 48px;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-main);
    cursor: pointer;
    white-space: nowrap;
}

.chat-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    min-width: 0;
}

.student-agent-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin-bottom: 2rem;
    border: 1px solid #dbe6ff;
    background:
        radial-gradient(circle at 12% 18%, rgba(67, 97, 238, 0.12), transparent 32%),
        linear-gradient(135deg, #ffffff 0%, #f8fbff 56%, #f7fff9 100%);
    box-shadow: 0 18px 40px rgba(67, 97, 238, 0.08);
}

.chat-language-settings-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    border-color: #dbe6ff;
    background:
        radial-gradient(circle at 10% 18%, rgba(67, 97, 238, 0.1), transparent 30%),
        linear-gradient(135deg, #ffffff 0%, #f8fbff 62%, #f7fff9 100%);
}

.student-agent-main {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    min-width: 0;
}

.student-agent-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: var(--primary-color);
    background: #eef4ff;
}

.student-agent-icon svg {
    width: 25px;
    height: 25px;
}

.student-agent-title {
    color: var(--text-main);
    font-size: 1.02rem;
    font-weight: 900;
    margin-bottom: 5px;
}

.student-agent-text {
    max-width: 760px;
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.45;
}

.student-language-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
}

.student-language-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 11px;
    border: 1px solid #dbe6ff;
    border-radius: 999px;
    background: #f7f9ff;
    color: var(--primary-color);
    font-size: 0.76rem;
    font-weight: 900;
    line-height: 1.1;
    white-space: nowrap;
}

.student-agent-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(74px, auto)) auto;
    align-items: center;
    gap: 10px;
}

.student-agent-stats > div,
.student-summary-grid > div {
    min-width: 84px;
    padding: 12px 14px;
    border: 1px solid #e8eefb;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
}

.student-agent-stats strong,
.student-summary-grid strong {
    display: block;
    color: var(--text-main);
    font-size: 1.34rem;
    font-weight: 950;
    line-height: 1;
}

.student-agent-stats span,
.student-summary-grid span {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 800;
}

.student-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.student-language-flow {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid #dbe6ff;
    border-radius: 16px;
    background: #f8fbff;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.4;
}

.student-language-flow strong {
    color: var(--text-main);
}

.student-restriction-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.student-operation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.student-operation-card {
    min-height: 78px;
    border: 1px solid #dbe6ff;
    border-radius: 17px;
    background: #fff;
    color: var(--text-main);
    cursor: pointer;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 900;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.student-operation-card:hover {
    border-color: rgba(67, 97, 238, 0.42);
    box-shadow: 0 12px 28px rgba(67, 97, 238, 0.1);
    transform: translateY(-1px);
}

.student-operation-card svg {
    width: 21px;
    height: 21px;
    color: var(--primary-color);
}

.student-operation-card.is-danger {
    border-color: rgba(244, 67, 54, 0.24);
    background: #fff8f8;
}

.student-operation-card.is-danger svg {
    color: var(--danger);
}

.student-operation-history {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.student-operation-history-row,
.student-operation-empty {
    padding: 11px 13px;
    border: 1px solid #e5ebfb;
    border-radius: 14px;
    background: #f8fbff;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
}

.student-operation-history-row {
    display: grid;
    grid-template-columns: 72px minmax(120px, 0.45fr) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.student-operation-history-row strong {
    color: var(--text-main);
}

.student-operation-history-row em {
    font-style: normal;
}

.settings-status-card--danger {
    border-color: rgba(244, 67, 54, 0.24);
    background: #fff8f8;
}

.chat-scenario-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    min-width: 0;
}

.chat-scenario-row button {
    white-space: nowrap;
}

.chat-adapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.chat-adapter-card {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
    min-width: 0;
}

.chat-adapter-card code {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: var(--text-muted);
    font-family: monospace;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar--ai-only .nav-menu {
    display: none;
}

.sidebar--ai-only::after {
    content: 'Доступен AI-агент и личный кабинет в шапке';
    display: block;
    margin: 12px 16px 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--text-muted);
}

    overflow: hidden;
}

.chat-history-toolbar {
    margin-bottom: 0;
    padding: 0;
    border-bottom: none;
}

.chat-history-toolbar .chat-table-filter {
    padding: 9px 14px;
    border-radius: 12px;
    background: #f8faff;
    border-color: #e3e8f2;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.chat-history-toolbar .chat-table-filter:focus-within {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.chat-history-toolbar .chat-table-filter input {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    min-height: auto;
    padding: 0;
    border-radius: 0;
    background: transparent;
}

.chat-history-nav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: 1px solid #e3e8f2;
    border-radius: 12px;
    background: #f8faff;
}

.chat-history-nav[hidden] {
    display: none !important;
}

.chat-history-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.chat-history-nav-btn:hover {
    background: #e8edff;
    color: var(--primary-color);
}

.chat-history-nav-btn i {
    width: 16px;
    height: 16px;
}

.chat-history-match-pos {
    min-width: 48px;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}

.chat-history-toolbar .chat-table-filter-count {
    padding: 6px 10px;
    border-radius: 999px;
    background: #f4f6ff;
    color: var(--text-muted);
    font-weight: 600;
}

.chat-history-toolbar .chat-table-filter-reset {
    border-radius: 10px;
}

.chat-history-hit {
    background: #ffe082;
    color: inherit;
    padding: 0 2px;
    border-radius: 3px;
}

.chat-history-bubble.is-bot .chat-history-hit {
    background: rgba(255, 255, 255, 0.42);
    color: #fff;
}

.chat-history-hit.is-active {
    background: #ff9800;
    color: #1f1f1f;
    box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.35);
}

.chat-history-bubble.is-bot .chat-history-hit.is-active {
    background: #fff3e0;
    color: #1f1f1f;
}

.chat-history-item--focus {
    position: relative;
}

.chat-history-item--focus::before {
    content: '';
    position: absolute;
    inset: -4px -8px;
    border: 2px solid rgba(67, 97, 238, 0.28);
    border-radius: 14px;
    pointer-events: none;
}

.chat-table-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 0 18px 14px;
    border-bottom: 1px solid var(--border-color);
}

.chat-table-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 280px;
    min-width: 220px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
}

.chat-table-filter i {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex: 0 0 auto;
}

.chat-table-filter input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.86rem;
}

.chat-table-filter-count {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.chat-table-filter-reset {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 0.78rem;
}

.chat-table-scroll {
    overflow-x: auto;
    padding-bottom: 2px;
}

.chat-table {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.86rem;
}

.chat-table th {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-weight: 800;
    text-align: left;
    white-space: nowrap;
}

.sortable-table th {
    user-select: none;
}

.table-sort-button {
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    font: inherit;
    font-weight: inherit;
    text-align: left;
}

.table-sort-button:hover {
    color: var(--primary-color);
}

.table-sort-indicator {
    width: 15px;
    height: 15px;
    border-radius: 999px;
    flex: 0 0 15px;
    display: inline-grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1;
    background: #f4f6ff;
    opacity: 0.78;
}

.table-sort-indicator::before {
    content: "↕";
}

.sortable-table th.is-sorted-asc .table-sort-button,
.sortable-table th.is-sorted-desc .table-sort-button {
    color: var(--primary-color);
}

.sortable-table th.is-sorted-asc .table-sort-indicator,
.sortable-table th.is-sorted-desc .table-sort-indicator {
    background: rgba(67, 97, 238, 0.12);
    color: var(--primary-color);
    opacity: 1;
}

.sortable-table th.is-sorted-asc .table-sort-indicator::before {
    content: "↑";
}

.sortable-table th.is-sorted-desc .table-sort-indicator::before {
    content: "↓";
}

.chat-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.chat-table th:nth-child(1),
.chat-table td:nth-child(1) {
    width: 20%;
}

.chat-table th:nth-child(2),
.chat-table td:nth-child(2) {
    width: 10%;
}

.chat-table th:nth-child(3),
.chat-table td:nth-child(3) {
    width: 15%;
}

.chat-table th:nth-child(4),
.chat-table td:nth-child(4) {
    width: 15%;
}

.chat-table th:nth-child(5),
.chat-table td:nth-child(5) {
    width: 20%;
}

.chat-table th:nth-child(6),
.chat-table td:nth-child(6) {
    width: 20%;
}

.chat-table .status-tag {
    min-height: 28px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.76rem;
    justify-content: center;
    line-height: 1.1;
    white-space: nowrap;
}

.chat-table .chat-tag-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.chat-table .chat-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.chat-action,
.chat-action-secondary,
.chat-action-primary,
.chat-action-danger {
    min-width: 0;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    line-height: 1.15;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.chat-action-secondary i,
.chat-action-primary i,
.chat-action-danger i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.chat-action-secondary {
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.86);
    color: var(--text-main);
}

.chat-action-secondary:hover {
    border-color: rgba(67, 97, 238, 0.22);
    background: #f8faff;
    color: var(--primary-color);
}

.chat-action-primary {
    border: none;
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.18);
}

.chat-action-primary:hover {
    background: var(--secondary-color);
    box-shadow: 0 6px 16px rgba(67, 97, 238, 0.24);
}

.chat-action-danger {
    border: none;
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.18);
}

.chat-action-danger:hover {
    background: #d93636;
    box-shadow: 0 6px 16px rgba(244, 67, 54, 0.24);
}

.chat-table .chat-main {
    font-weight: 800;
    color: var(--text-main);
}

.chat-table .chat-sub {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.74rem;
    line-height: 1.25;
}

.chat-table .chat-mono {
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.8rem;
    line-height: 1.3;
}

.chat-table.student-directory-table {
    min-width: 1280px;
    table-layout: fixed;
}

.chat-table.student-directory-table th,
.chat-table.student-directory-table td {
    vertical-align: top;
}

.chat-table.student-directory-table th:nth-child(1),
.chat-table.student-directory-table td:nth-child(1) {
    width: 20%;
}

.chat-table.student-directory-table th:nth-child(2),
.chat-table.student-directory-table td:nth-child(2) {
    width: 8%;
}

.chat-table.student-directory-table th:nth-child(3),
.chat-table.student-directory-table td:nth-child(3) {
    width: 12%;
}

.chat-table.student-directory-table th:nth-child(4),
.chat-table.student-directory-table td:nth-child(4) {
    width: 14%;
}

.chat-table.student-directory-table th:nth-child(5),
.chat-table.student-directory-table td:nth-child(5) {
    width: 8%;
}

.chat-table.student-directory-table th:nth-child(6),
.chat-table.student-directory-table td:nth-child(6) {
    width: 12%;
}

.chat-table.student-directory-table th:nth-child(7),
.chat-table.student-directory-table td:nth-child(7) {
    width: 8%;
}

.chat-table.student-directory-table th:nth-child(8),
.chat-table.student-directory-table td:nth-child(8) {
    width: 12%;
}

.participant-source-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.participant-source-badge--live {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.participant-source-badge--demo {
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
}

.participant-directory-source-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.participant-presence-badges {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.participant-presence-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.participant-presence-badge--bot {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.participant-presence-badge--group {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.participant-filter-chip--presence.is-active {
    background: #0f766e;
    border-color: #0f766e;
}

.participant-directory-filter-chips--presence {
    width: 100%;
}

.participant-directory-badges,
.participant-profile-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.participant-directory-filters {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.participant-directory-filter-field {
    min-width: 220px;
    margin: 0;
}

.participant-directory-filter-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.participant-filter-chip {
    border: 1px solid #dbeafe;
    background: #fff;
    color: var(--text-main);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.participant-filter-chip.is-active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.participant-directory-filter-actions {
    margin-left: auto;
}

.participant-directory-name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.participant-directory-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #dbeafe;
}

.participant-directory-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.participant-directory-avatar--fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
}

.chat-participants-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 280px;
}

.chat-participants-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.chat-participants-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.chat-participants-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-participants-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-participant-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #eef2ff;
    border-radius: 12px;
    background: #fff;
}

.chat-participant-row-main {
    flex: 1;
    min-width: 0;
}

.chat-participant-row-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-participant-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.chat-participants-empty {
    padding: 24px 16px;
    border: 1px dashed #dbeafe;
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.student-directory-table .chat-main,
.student-directory-table .chat-sub {
    overflow-wrap: anywhere;
    word-break: normal;
}

.student-directory-table .chat-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    white-space: normal;
}

.chat-history-outgoing {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    animation: chat-message-in 0.22s ease;
}

.chat-history-meta {
    margin-bottom: 4px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 500;
}

.chat-history-item {
    width: 100%;
    min-width: 0;
}

.chat-history-bubble-row {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    width: fit-content;
    max-width: 100%;
}

.chat-history-block--incoming .chat-history-bubble-row {
    flex-direction: row;
}

.chat-history-block--outgoing .chat-history-bubble-row {
    flex-direction: row-reverse;
}

.chat-history-bubble {
    position: relative;
    display: inline-block;
    width: fit-content;
    max-width: min(520px, calc(100vw - 220px));
    min-width: 72px;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    font-size: 0.85rem;
    line-height: 1.4;
}

.chat-history-block {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.chat-history-block--incoming {
    justify-content: flex-start;
}

.chat-history-block--outgoing {
    justify-content: flex-end;
}

.chat-history-block--compact .chat-history-author-avatar--spacer {
    width: 32px;
    flex-shrink: 0;
}

.chat-history-message-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    flex-shrink: 0;
}

.chat-history-block--incoming .chat-history-message-wrap {
    align-items: flex-start;
}

.chat-history-block--outgoing .chat-history-message-wrap {
    align-items: flex-end;
    margin-left: auto;
}

.chat-history-author-avatar {
    width: 32px;
    flex-shrink: 0;
}

.chat-history-avatar {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: #dbeafe;
    flex-shrink: 0;
}

.chat-history-avatar img,
.chat-history-avatar-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.chat-history-avatar img {
    object-fit: cover;
    display: block;
}

.chat-history-avatar img[hidden] {
    display: none !important;
}

.chat-history-avatar-fallback {
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-history-avatar-fallback[hidden] {
    display: none !important;
}

.chat-history-bubble-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--primary-color);
}

.chat-history-author-name {
    color: var(--primary-color);
}

.chat-history-role {
    padding: 1px 6px;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 500;
}

.chat-history-bubble.is-incoming {
    background: #fff;
    color: var(--text-main);
    border: 1px solid #eef2ff;
    border-radius: 16px 16px 16px 4px;
}

.chat-history-bubble.is-outgoing,
.chat-history-bubble.is-bot {
    background: var(--primary-color);
    color: #fff;
    border: 1px solid rgba(67, 97, 238, 0.16);
    border-radius: 16px 16px 4px 16px;
}

.chat-history-bubble.is-system {
    background: #ffebee;
    color: var(--text-main);
    border: 1px solid #ffcdd2;
    border-radius: 12px;
}

.chat-history-bubble--media {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-width: 0;
}

.chat-history-bubble--sticker {
    max-width: 170px;
}

.chat-history-bubble--media .chat-history-bubble-meta {
    margin-top: 4px;
    padding: 0 2px;
}

.chat-history-bubble--media.is-outgoing .chat-history-bubble-meta,
.chat-history-bubble--media.is-bot .chat-history-bubble-meta {
    color: var(--text-muted);
}

.chat-history-attachment {
    display: block;
    max-width: 100%;
}

.chat-history-attachment-image {
    display: block;
    object-fit: contain;
    border-radius: 12px;
    background: transparent;
}

.chat-history-attachment--sticker .chat-history-attachment-image {
    border-radius: 0;
}

.chat-history-attachment--file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.06);
    color: inherit;
    text-decoration: none;
    word-break: break-word;
}

.chat-history-bubble.is-outgoing .chat-history-attachment--file,
.chat-history-bubble.is-bot .chat-history-attachment--file {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.chat-history-bubble-text {
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: normal;
}

.chat-history-bubble-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 6px;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.chat-history-bubble.is-outgoing .chat-history-bubble-meta,
.chat-history-bubble.is-bot .chat-history-bubble-meta {
    color: rgba(255, 255, 255, 0.82);
}

.chat-history-edited {
    opacity: 0.85;
}

.chat-history-bubble-status {
    display: inline-flex;
    color: rgba(255, 255, 255, 0.92);
}

.chat-history-bubble-status i {
    width: 14px;
    height: 14px;
}

.chat-history-reply-quote {
    margin-bottom: 8px;
}

.chat-history-reply-quote-mark {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    border-left: 3px solid var(--primary-color);
    border-radius: 8px;
    background: rgba(67, 97, 238, 0.08);
    text-align: left;
}

.chat-history-reply-quote--outgoing .chat-history-reply-quote-mark {
    border-left-color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.16);
}

.chat-history-reply-quote-author {
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--primary-color);
}

.chat-history-reply-quote--outgoing .chat-history-reply-quote-author {
    color: #fff;
}

.chat-history-reply-quote-text {
    font-size: 0.78rem;
    line-height: 1.3;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-history-reply-quote--outgoing .chat-history-reply-quote-text {
    color: rgba(255, 255, 255, 0.9);
}

.chat-history-menu-trigger {
    position: relative;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-top: 6px;
    border: none;
    border-radius: 8px;
    background: #fff;
    color: var(--text-muted);
    border: 1px solid #eef2ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.chat-history-block:hover .chat-history-menu-trigger,
.chat-history-bubble-row:focus-within .chat-history-menu-trigger,
.chat-history-item--editing .chat-history-menu-trigger {
    opacity: 1;
}

.chat-history-menu-trigger i {
    width: 14px;
    height: 14px;
}

.chat-history-menu {
    display: none;
    flex-direction: column;
    min-width: 228px;
    width: 228px;
    padding: 6px;
    border: 1px solid #eef2ff;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.chat-history-menu:not([hidden]) {
    display: flex;
}

.chat-history-menu--floating {
    position: fixed;
    z-index: 2500;
    pointer-events: auto;
}

.chat-history-editor {
    width: 100%;
    min-width: min(320px, 100%);
    max-width: min(72%, 520px);
    padding: 10px;
    border: 1px solid #eef2ff;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.chat-history-block--outgoing .chat-history-editor {
    margin-left: auto;
}

.chat-history-editor textarea {
    width: 100%;
    min-height: 72px;
    resize: vertical;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    font-size: 0.85rem;
    line-height: 1.4;
}

.chat-history-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.chat-history-item--editing .chat-history-menu,
.chat-history-item--editing .chat-history-menu-trigger {
    display: none;
}

.chat-history-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-main);
    font: inherit;
    font-size: 0.82rem;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-history-menu-item span {
    flex: 1;
    min-width: 0;
}

.chat-history-menu-item:hover {
    background: #f8faff;
}

.chat-history-menu-item.is-danger {
    color: var(--danger);
}

.chat-history-menu-item i {
    width: 15px;
    height: 15px;
}

.chat-modal-reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin-bottom: 8px;
    padding: 8px 10px;
    border-left: 3px solid var(--primary-color);
    border-radius: 10px;
    background: #f8faff;
}

.chat-modal-reply-preview-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.chat-modal-reply-preview-mark {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    border-left: 3px solid var(--primary-color);
    border-radius: 8px;
    background: rgba(67, 97, 238, 0.06);
}

.chat-modal-reply-preview-author {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--primary-color);
}

.chat-modal-reply-preview-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-modal-reply-preview-close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-modal-reply-preview-close i {
    width: 16px;
    height: 16px;
}

.chat-modal-composer {
    flex-wrap: wrap;
}

@keyframes chat-message-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Survey module */
.survey-module {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.survey-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 20px;
    margin-bottom: 2rem;
}

.survey-hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.survey-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.survey-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 20px;
    align-items: start;
}

.survey-form-grid {
    display: grid;
    gap: 12px;
}

.survey-form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.survey-field {
    display: grid;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.survey-field input,
.survey-field select,
.survey-field textarea {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-main);
    font: inherit;
    font-size: 0.86rem;
    outline: none;
}

.survey-field textarea {
    min-height: 82px;
    resize: vertical;
}

.survey-option-list,
.survey-check-grid {
    display: grid;
    gap: 8px;
}

.survey-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-main);
    font-size: 0.84rem;
}

.survey-panel-note {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    background: #f8faff;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
}

.survey-modal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

.survey-question-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
}

.survey-send-preview {
    padding: 14px;
    border: 1px solid #eef2ff;
    border-radius: 14px;
    background: #f8faff;
}

/* Site radar module */
.radar-module {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.radar-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 20px;
    margin-bottom: 2rem;
}

.module-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    position: relative;
}

.module-intro {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

@keyframes module-help-pulse {
    0%,
    100% {
        box-shadow: var(--shadow), 0 0 0 0 rgba(67, 97, 238, 0.18);
        border-color: var(--border-color);
    }

    50% {
        box-shadow: var(--shadow), 0 0 0 5px rgba(67, 97, 238, 0.1);
        border-color: rgba(67, 97, 238, 0.42);
    }
}

@keyframes module-help-nudge {
    0%,
    88%,
    100% {
        transform: translateX(0);
    }

    90% {
        transform: translateX(-3px);
    }

    92% {
        transform: translateX(3px);
    }

    94% {
        transform: translateX(-2px);
    }

    96% {
        transform: translateX(2px);
    }
}

.module-help {
    position: relative;
}

.module-help summary {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: #fff;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 900;
    line-height: 1;
    cursor: help;
    list-style: none;
    box-shadow: var(--shadow);
    animation:
        module-help-pulse 2.6s ease-in-out infinite,
        module-help-nudge 4s ease-in-out infinite;
}

.module-help summary::-webkit-details-marker {
    display: none;
}

.module-help summary:hover,
.module-help[open] summary {
    animation: none;
    border-color: rgba(67, 97, 238, 0.35);
    background: #f8faff;
}

@media (prefers-reduced-motion: reduce) {
    .module-help summary {
        animation: none;
    }
}

.module-help-label {
    margin-bottom: 6px;
    color: var(--primary-color);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.module-help-text {
    position: absolute;
    left: 0;
    top: calc(100% + 10px);
    z-index: 150;
    width: min(580px, calc(100vw - 48px));
    max-height: min(480px, 62vh);
    overflow-y: auto;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow-lg);
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.55;
}

.module-help-text p + p,
.module-help-text ul {
    margin-top: 8px;
}

.module-help-text ul + p {
    margin-top: 12px;
}

.module-help-text ul {
    padding-left: 18px;
}

.module-help-text li + li {
    margin-top: 4px;
}

.module-help-text strong {
    color: var(--text-main);
    font-weight: 700;
}

/* Заголовок блока и текст - на разных строках (Типовые кейсы, Источники и т.д.) */
.module-help-text p > strong {
    display: block;
    margin-bottom: 4px;
}

.module-help-text code {
    padding: 1px 5px;
    border-radius: 4px;
    background: #f3f4f8;
    color: var(--text-main);
    font-size: 0.78rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.module-help:not([open]) .module-help-text {
    display: none;
}

.module-help:hover .module-help-text {
    display: block;
}

.module-help--modal[open] .module-help-text,
.module-help--modal:hover .module-help-text {
    position: fixed;
    z-index: 2500;
    margin-top: 0;
    box-shadow: var(--shadow-lg);
}

.kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 2rem;
}

.module-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 20px;
}

.module-actions-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-split-grid {
    grid-template-columns: 1.2fr 0.8fr;
    align-items: stretch;
    gap: 20px;
}

.dashboard-charts-grid {
    grid-template-columns: 1.35fr 0.65fr;
    align-items: stretch;
    gap: 20px;
}

/* AI content module */
.ai-content-module {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.ai-content-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 20px;
    margin-bottom: 2rem;
}

.ai-content-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.ai-content-layout {
    grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr);
    gap: 20px;
    margin-bottom: 20px;
}

.ai-scenario-list {
    display: grid;
    gap: 10px;
    margin-top: 4px;
}

.ai-scenario-card {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    font: inherit;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.ai-scenario-card:hover {
    border-color: rgba(67, 97, 238, 0.24);
    background: #f8faff;
}

.ai-scenario-card.is-active {
    border-color: rgba(67, 97, 238, 0.35);
    background: #f0f7ff;
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.08);
}

.ai-scenario-title {
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.25;
}

.ai-scenario-meta {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.35;
}

.ai-content-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 4px;
}

.ai-content-kpi {
    min-width: 0;
    padding: 10px 8px;
    border-radius: 12px;
    text-align: center;
}

.ai-content-kpi--neutral {
    border: 1px solid #eef2ff;
    background: #f8faff;
}

.ai-content-kpi--positive {
    border: 1px solid rgba(16, 185, 129, 0.18);
    background: rgba(16, 185, 129, 0.08);
}

.ai-content-kpi--negative {
    border: 1px solid rgba(244, 67, 54, 0.18);
    background: rgba(244, 67, 54, 0.08);
}

.ai-content-kpi-value {
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 900;
    line-height: 1.1;
}

.ai-content-kpi--positive .ai-content-kpi-value {
    color: var(--success);
}

.ai-content-kpi--negative .ai-content-kpi-value {
    color: var(--danger);
}

.ai-content-kpi-label {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.25;
    word-break: break-word;
}

.ai-content-targeting {
    margin-top: 18px;
}

.ai-content-targeting .form-section-subtitle {
    margin-bottom: 10px;
    font-weight: 800;
}

.ai-content-tag-more {
    border: 1px dashed var(--border-color);
    background: #fff;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
}

.ai-content-draft-card {
    margin-top: 0;
}

.ai-draft-panel {
    margin-top: 4px;
    padding: 1.1rem 1.2rem;
    border: 1px solid #eef2ff;
    border-radius: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
}

.ai-draft-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.ai-draft-title {
    color: var(--text-main);
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.3;
}

.ai-draft-time {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.ai-draft-text {
    color: var(--text-main);
    font-size: 0.9rem;
    line-height: 1.55;
}

.ai-draft-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 1rem;
}

/* Bitrix CRM module */
.bitrix-module {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.bitrix-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 20px;
    margin-bottom: 2rem;
}

.bitrix-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.bitrix-connection-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px 18px;
    border: 1px solid rgba(16, 185, 129, 0.28);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, #fff 72%);
}

.bitrix-connection-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.bitrix-connection-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #2fc6f6, #1b87e5);
    color: #fff;
    flex: 0 0 auto;
}

.bitrix-connection-icon i {
    width: 20px;
    height: 20px;
}

.bitrix-connection-copy {
    min-width: 0;
}

.bitrix-connection-title {
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 900;
    line-height: 1.25;
    word-break: break-word;
}

.bitrix-connection-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    color: var(--success);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
}

.bitrix-connection-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    cursor: help;
}

.bitrix-connection-badge i {
    width: 14px;
    height: 14px;
}

.bitrix-connection-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.bitrix-sync-time {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.bitrix-sync-btn {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 0.82rem;
}

.bitrix-sync-tooltip {
    position: relative;
    display: inline-flex;
}

.bitrix-sync-tooltip-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 40;
    width: min(320px, calc(100vw - 32px));
    padding: 12px 14px;
    border: 1px solid rgba(67, 97, 238, 0.18);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.bitrix-sync-tooltip:hover .bitrix-sync-tooltip-panel,
.bitrix-sync-tooltip:focus-within .bitrix-sync-tooltip-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bitrix-sync-tooltip-title {
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 10px;
}

.bitrix-sync-tooltip-meta {
    display: grid;
    gap: 8px;
    margin: 0;
}

.bitrix-sync-tooltip-meta div {
    display: grid;
    gap: 2px;
}

.bitrix-sync-tooltip-meta dt {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.bitrix-sync-tooltip-meta dd {
    margin: 0;
    color: var(--text-main);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
}

.bitrix-sync-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
}

.bitrix-sync-status.is-online {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.bitrix-sync-status.is-warning {
    background: rgba(239, 108, 0, 0.12);
    color: #ef6c00;
}

.bitrix-card-note {
    margin: -4px 0 12px;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.45;
}

.bitrix-agent-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin-bottom: 28px;
    border: 1px solid #dbe6ff;
    background:
        radial-gradient(circle at 8% 18%, rgba(67, 97, 238, 0.13), transparent 30%),
        linear-gradient(135deg, #fff 0%, #f8fbff 58%, #f7fff9 100%);
    box-shadow: 0 18px 42px rgba(67, 97, 238, 0.08);
}

.bitrix-agent-main {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 14px;
    align-items: flex-start;
    min-width: 0;
}

.bitrix-agent-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: #eef4ff;
    color: var(--primary-color);
}

.bitrix-agent-title {
    color: var(--text-main);
    font-size: 1.02rem;
    font-weight: 950;
    line-height: 1.2;
}

.bitrix-agent-text {
    max-width: 840px;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.45;
}

.bitrix-agent-pills,
.bitrix-agent-source-entities {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
}

.bitrix-agent-pills span,
.bitrix-agent-source-entities span {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 5px 10px;
    border: 1px solid #dbe6ff;
    border-radius: 999px;
    background: #f7f9ff;
    color: var(--primary-color);
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1.1;
}

.bitrix-agent-modal {
    display: grid;
    gap: 14px;
}

.bitrix-agent-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.bitrix-agent-kpi-grid > div {
    padding: 13px 14px;
    border: 1px solid #e8eefb;
    border-radius: 16px;
    background: #fff;
}

.bitrix-agent-kpi-grid strong {
    display: block;
    color: var(--text-main);
    font-size: 1.28rem;
    font-weight: 950;
    line-height: 1;
}

.bitrix-agent-kpi-grid span {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 800;
}

.bitrix-agent-source-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.bitrix-agent-source-card,
.bitrix-agent-report-card,
.bitrix-agent-operation,
.bitrix-agent-report-preview {
    border: 1px solid #e5ebfb;
    border-radius: 16px;
    background: #fff;
}

.bitrix-agent-source-card {
    padding: 14px;
}

.bitrix-agent-source-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-main);
    font-size: 0.84rem;
}

.bitrix-agent-operation-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.bitrix-agent-operation {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 14px;
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.35;
}

.bitrix-agent-operation i {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    color: var(--success);
}

.bitrix-agent-report-list {
    display: grid;
    gap: 10px;
}

.bitrix-agent-report-card {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
}

.bitrix-agent-report-index {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: #eef4ff;
    color: var(--primary-color);
    font-weight: 950;
}

.bitrix-agent-report-title {
    color: var(--text-main);
    font-size: 0.86rem;
    font-weight: 900;
}

.bitrix-agent-report-meta {
    margin-top: 3px;
    color: var(--primary-color);
    font-size: 0.72rem;
    font-weight: 900;
}

.bitrix-agent-report-result {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.45;
}

.bitrix-agent-report-preview {
    display: grid;
    gap: 9px;
    padding: 15px;
    background: #f8fbff;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.45;
}

.bitrix-agent-report-preview strong {
    color: var(--text-main);
}

.bitrix-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    color: var(--text-main);
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1.2;
}

.bitrix-section-title i {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.bitrix-tasks-layout {
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.bitrix-crm-grid,
.bitrix-kb-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.bitrix-channels-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.bitrix-task-list,
.bitrix-rule-list,
.bitrix-lead-list {
    display: grid;
    gap: 10px;
    margin-top: 4px;
}

.bitrix-task-item,
.bitrix-rule-card,
.bitrix-lead-card {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: #f8fafc;
}

.bitrix-task-head,
.bitrix-rule-foot,
.bitrix-lead-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.bitrix-task-id {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 800;
}

.bitrix-task-title {
    margin-top: 6px;
    color: var(--text-main);
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.3;
}

.bitrix-rule-title,
.bitrix-lead-title {
    color: var(--text-main);
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.3;
}

.bitrix-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.bitrix-rule-card {
    border-left: 3px solid var(--primary-color);
}

.bitrix-rule-card--warning {
    border-left-color: var(--warning);
}

.bitrix-rule-card--purple {
    border-left-color: #9c27b0;
}

.bitrix-rule-body {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.55;
}

.bitrix-rule-foot {
    margin-top: 8px;
    align-items: center;
}

.bitrix-rule-stat {
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 700;
    white-space: nowrap;
}

.bitrix-lead-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.bitrix-lead-meta {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.35;
}

.bitrix-lead-card .status-tag {
    flex: 0 0 auto;
}

.bitrix-status--new {
    background: #e3f2fd;
    color: #1565c0;
}

.bitrix-status--work {
    background: #fff3e0;
    color: #e65100;
}

.bitrix-status--done {
    background: #e8f5e9;
    color: #2e7d32;
}

.bitrix-status--muted {
    background: #f1f1f1;
    color: #666;
}

.bitrix-add-rule-btn {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 0.72rem;
}

.bitrix-channel-card {
    border-left: 3px solid var(--success);
}

.bitrix-channel-card--inactive {
    border-left-color: #ccc;
}

.bitrix-channel-desc {
    margin: 0 0 10px;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.45;
}

.bitrix-channel-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    color: var(--text-main);
    font-size: 0.75rem;
}

.bitrix-stat-warning {
    color: var(--warning);
    font-style: normal;
    font-weight: 800;
}

.bitrix-stat-ok {
    color: var(--success);
    font-style: normal;
    font-weight: 800;
}

.bitrix-channel-connect {
    width: fit-content;
    min-height: 38px;
    padding: 8px 14px;
    font-size: 0.78rem;
}

.bitrix-sync-note {
    margin: 12px 0 0;
    padding: 0 2px;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.45;
}

.bitrix-resync-btn {
    margin-top: 12px;
    width: fit-content;
}

.bitrix-alert-row {
    border-color: rgba(244, 67, 54, 0.22);
    background: #fdf2f2;
}

.bitrix-alert-danger {
    color: var(--danger);
    font-weight: 800;
}

.bitrix-alert-warning {
    color: var(--warning);
    font-weight: 800;
}

.bitrix-settings-modal,
.bitrix-rule-modal {
    display: grid;
    gap: 14px;
}

.bitrix-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.bitrix-settings-modal .form-section,
.bitrix-rule-modal .form-section {
    min-width: 0;
}

.bitrix-permission-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.bitrix-permission-list .status-tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    border: 1px solid #e5ebfb;
    background: #fff;
    color: var(--text-main);
    font-weight: 800;
}

.bitrix-permission-list input {
    accent-color: var(--primary-color);
}

.module-backend-help summary {
    background: #eef3ff;
    color: var(--primary-color);
}

.module-backend-help summary i {
    width: 16px;
    height: 16px;
}

.module-backend-help .module-help-text {
    width: min(430px, calc(100vw - 48px));
}

.module-backend-help-content ul {
    margin-top: 8px;
}

.module-backend-help-content .status-tag {
    display: inline-flex;
    margin-top: 4px;
}

.kpi-card .card-header {
    align-items: flex-start;
    gap: 8px;
}

.kpi-card-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.kpi-help {
    position: relative;
    z-index: 2;
}

.kpi-card:has(.kpi-help[open]),
.kpi-card:has(.kpi-help[open]):hover {
    transform: none;
}

.kpi-help summary {
    list-style: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: #f8faff;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.kpi-help summary::-webkit-details-marker {
    display: none;
}

.kpi-help-text {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: auto;
    z-index: 150;
    width: min(280px, 70vw);
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.kpi-help-text--portaled {
    position: fixed;
    z-index: 200;
}

.kpi-help:not([open]) .kpi-help-text {
    display: none;
}

.alert-signals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-main);
}

.alert-signal-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.embedded-dashboard-module-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 1.5rem;
}

.embedded-dashboard-module-intro {
    min-width: 0;
    flex: 1 1 auto;
}

.embedded-dashboard-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 10px 18px;
    border: none;
    border-radius: 12px;
    background: var(--primary-color);
    color: #fff;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.embedded-dashboard-add-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(67, 97, 238, 0.24);
}

.embedded-dashboard-add-btn i {
    width: 18px;
    height: 18px;
}

.embedded-dashboard-module .card:hover,
.embedded-dashboard-module .embedded-dashboard-card:hover {
    transform: none;
}

.embedded-dashboard-grid {
    grid-template-columns: minmax(320px, 0.42fr) minmax(0, 1fr);
    align-items: stretch;
    gap: 20px;
}

.embedded-dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.embedded-dashboard-preview {
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
    min-height: 620px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.embedded-dashboard-preview-header {
    min-height: 58px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    background: #fafbff;
    flex: 0 0 auto;
}

.embedded-dashboard-preview-meta {
    min-width: 0;
    flex: 1 1 auto;
}

.embedded-dashboard-preview-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.embedded-dashboard-preview-heading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    white-space: nowrap;
}

.embedded-dashboard-preview-title {
    font-size: 0.92rem;
    color: var(--text-main);
}

.embedded-dashboard-preview-source {
    font-size: 0.72rem;
    color: var(--primary-color);
    background: #eef2ff;
    border: 1px solid rgba(67, 97, 238, 0.15);
    border-radius: 999px;
    padding: 2px 8px;
    font-weight: 600;
}

.embedded-preview-url {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.embedded-dashboard-panel-switcher {
    display: none;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
    overflow-x: auto;
    scrollbar-width: thin;
}

.embedded-dashboard-panel-switcher::-webkit-scrollbar {
    height: 4px;
}

.embedded-dashboard-panel-switcher::-webkit-scrollbar-thumb {
    background: #d5dcf7;
    border-radius: 999px;
}

.embedded-panel-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 5px 11px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: white;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    flex: 0 0 auto;
}

.embedded-panel-switch-btn i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.embedded-panel-switch-btn:hover {
    background: #f8faff;
    border-color: #c9d4ff;
    color: var(--text-main);
}

.embedded-panel-switch-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px rgba(67, 97, 238, 0.22);
}

.embedded-preview-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.embedded-preview-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.embedded-preview-status--loading {
    color: #9a5a00;
    background: #fff8e6;
    border: 1px solid #f5d76e;
}

.embedded-preview-status--loading::before {
    background: #f5a623;
    animation: embedded-status-pulse 1.2s ease-in-out infinite;
}

@keyframes embedded-status-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.85); }
}

.embedded-preview-status--ready {
    color: #1b5e20;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
}

.embedded-preview-status--ready::before {
    background: #43a047;
}

.embedded-preview-status--info {
    color: #1565c0;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
}

.embedded-preview-status--info::before {
    background: #1e88e5;
}

.embedded-preview-status--error {
    color: #b71c1c;
    background: #ffebee;
    border: 1px solid #ffcdd2;
}

.embedded-preview-status--error::before {
    background: #e53935;
}

.embedded-dashboard-auth-banner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 16px;
    background: #eef6ff;
    border-bottom: 1px solid #d7e7ff;
    color: #1e4f91;
    font-size: 0.78rem;
    line-height: 1.45;
}

.embedded-dashboard-auth-banner[hidden] {
    display: none !important;
}

.embedded-dashboard-auth-banner i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.embedded-dashboard-preview-body {
    position: relative;
    height: 568px;
    background: #f4f6fb;
    padding: 14px;
    flex: 1 1 auto;
    min-height: 0;
}

.embedded-dashboard-preview-body--loading {
    background: #eef2ff;
}

.embedded-dashboard-frame {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: white;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    transition: opacity 0.25s ease;
}

.embedded-dashboard-frame--loading {
    opacity: 0.15;
    pointer-events: none;
}

.embedded-dashboard-loading {
    position: absolute;
    inset: 14px;
    z-index: 3;
    display: grid;
    place-items: center;
    padding: 24px;
    border-radius: 12px;
    background: rgba(248, 250, 255, 0.94);
    backdrop-filter: blur(2px);
}

.embedded-dashboard-loading[hidden] {
    display: none !important;
}

.embedded-dashboard-loading-card {
    width: min(100%, 360px);
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-radius: 14px;
    border: 1px solid #dbe4ff;
    background: white;
    box-shadow: 0 14px 36px rgba(67, 97, 238, 0.12);
    text-align: center;
}

.embedded-dashboard-loading-spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid #dbe4ff;
    border-top-color: var(--primary-color);
    animation: embedded-dashboard-spin 0.9s linear infinite;
}

@keyframes embedded-dashboard-spin {
    to { transform: rotate(360deg); }
}

.embedded-dashboard-loading-title {
    font-size: 0.95rem;
    color: var(--text-main);
}

.embedded-dashboard-loading-text {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.embedded-dashboard-loading-progress {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: #edf2ff;
    overflow: hidden;
}

.embedded-dashboard-loading-progress-bar {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #4895ef, var(--primary-color));
    animation: embedded-dashboard-progress 1.6s ease-in-out infinite;
}

@keyframes embedded-dashboard-progress {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(280%); }
}

.embedded-dashboard-loading-hint {
    margin: 0;
    font-size: 0.72rem;
    color: #6b7a90;
    line-height: 1.4;
}

.embedded-dashboard-loading-hint[hidden] {
    display: none !important;
}

.embedded-dashboard-overlay {
    position: absolute;
    inset: 14px;
    display: grid;
    place-items: center;
    background: rgba(248, 250, 255, 0.92);
    border-radius: 12px;
    z-index: 2;
}

.embedded-dashboard-overlay[hidden] {
    display: none !important;
}

.embedded-dashboard-overlay-card {
    max-width: 420px;
    padding: 18px 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: white;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    display: grid;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-main);
}

.embedded-overlay-actions,
.embedded-panel-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.embedded-panel-btn {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: white;
    color: var(--text-main);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.embedded-panel-btn--primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.embedded-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.78rem;
    line-height: 1.45;
}

.embedded-note i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.embedded-note--info {
    background: #eef6ff;
    border: 1px solid #d7e7ff;
    color: #1e4f91;
}

.embedded-note--warning {
    background: #fff7ed;
    border: 1px solid #fde4c8;
    color: #9a5a00;
}

.embedded-settings-form,
.embedded-dashboard-modal-form {
    display: grid;
    gap: 12px;
}

.embedded-field {
    display: grid;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.embedded-field input,
.embedded-field select {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    color: var(--text-main);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.embedded-field input:focus,
.embedded-field select:focus {
    border-color: rgba(67, 97, 238, 0.42);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.08);
}

.embedded-field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.embedded-source-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
    color: var(--text-main);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.embedded-source-btn:hover:not(.active):not(.embedded-source-btn--add) {
    border-color: rgba(67, 97, 238, 0.35);
    background: #fafbff;
}

.embedded-source-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.embedded-source-btn__label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.embedded-source-btn__label i {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.embedded-source-btn__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.embedded-source-btn__meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}

.embedded-source-btn.active .embedded-source-btn__meta {
    color: rgba(255, 255, 255, 0.92);
}

.embedded-source-meta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    cursor: help;
}

.embedded-source-meta-icon i {
    width: 14px;
    height: 14px;
}

.embedded-source-meta-icon--live {
    color: #22c55e;
    animation: embedded-source-live-pulse 1.2s ease-in-out infinite;
}

.embedded-source-meta-icon--demo,
.embedded-source-meta-icon--auth {
    color: var(--text-muted);
}

.embedded-source-btn.active .embedded-source-meta-icon--demo,
.embedded-source-btn.active .embedded-source-meta-icon--auth {
    color: rgba(255, 255, 255, 0.88);
}

.embedded-source-btn.active .embedded-source-meta-icon--live {
    animation: embedded-source-live-pulse-active 1.2s ease-in-out infinite;
}

@keyframes embedded-source-live-pulse {
    0%, 100% {
        opacity: 1;
        color: #22c55e;
    }

    50% {
        opacity: 0.3;
        color: #16a34a;
    }
}

@keyframes embedded-source-live-pulse-active {
    0%, 100% {
        opacity: 1;
        color: #bbf7d0;
    }

    50% {
        opacity: 0.35;
        color: #86efac;
    }
}

.embedded-source-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.embedded-source-btn--add {
    justify-content: flex-start;
    border-style: dashed;
    background: #f8faff;
    color: var(--primary-color);
}

.embedded-source-btn--add:hover {
    border-color: rgba(67, 97, 238, 0.45);
    background: #f0f3ff;
}

.embedded-dashboard-preview-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.embedded-dashboard-preview-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
}

.embedded-dashboard-text-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-main);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.embedded-dashboard-text-btn:hover {
    border-color: rgba(67, 97, 238, 0.35);
    background: #f8faff;
    color: var(--primary-color);
}

.embedded-dashboard-text-btn--active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.embedded-dashboard-text-btn--active:hover {
    background: #3651d4;
    border-color: #3651d4;
    color: white;
}

.embedded-dashboard-text-btn i {
    width: 15px;
    height: 15px;
}

.embedded-dashboard-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-main);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.embedded-dashboard-icon-btn:hover {
    border-color: rgba(67, 97, 238, 0.35);
    background: #f8faff;
    color: var(--primary-color);
}

.embedded-dashboard-icon-btn i {
    width: 16px;
    height: 16px;
}

.embedded-dashboard-module.embedded-dashboard-module--expanded {
    animation: none;
    transform: none;
}

.embedded-dashboard-module--expanded .embedded-dashboard-module-hero,
.embedded-dashboard-module--expanded .embedded-dashboard-sidebar {
    display: none;
}

.embedded-dashboard-module--expanded .embedded-dashboard-grid {
    display: block;
    min-height: 0;
}

.embedded-dashboard-preview--expanded {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 220;
    min-height: 0;
    margin: 0;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
    box-shadow: none;
}

body.embedded-dashboard-fullscreen .sidebar {
    transform: translateX(-100%);
    visibility: hidden;
    pointer-events: none;
}

body.embedded-dashboard-fullscreen .main-wrapper {
    margin-left: 0;
    max-width: 100vw;
}

body.embedded-dashboard-fullscreen .top-bar {
    display: none;
}

body.embedded-dashboard-fullscreen .content-area {
    padding: 0;
}

.embedded-dashboard-preview--expanded .embedded-dashboard-preview-header {
    flex: 0 0 auto;
    min-height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    align-items: center;
    padding-top: 12px;
    padding-bottom: 12px;
}

.embedded-dashboard-preview--expanded .embedded-dashboard-panel-switcher {
    display: flex;
}

.embedded-dashboard-preview--expanded .embedded-preview-url {
    display: none;
}

.embedded-dashboard-preview--expanded .embedded-dashboard-preview-title-row {
    flex-wrap: nowrap;
}

.embedded-dashboard-preview--expanded .embedded-dashboard-preview-body {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    padding: 10px;
}

.embedded-dashboard-preview--expanded .embedded-dashboard-overlay,
.embedded-dashboard-preview--expanded .embedded-dashboard-loading {
    inset: 10px;
}

.embedded-dashboard-preview--expanded .embedded-preview-url {
    max-width: min(720px, 55vw);
}

body.embedded-dashboard-body-lock {
    overflow: hidden;
}

body.embedded-dashboard-fullscreen .sidebar-backdrop {
    display: none !important;
}

.modal-content:has(.embedded-dashboard-modal) {
    max-width: min(640px, calc(100vw - 48px));
}

.embedded-dashboard-modal {
    padding-top: 4px;
}

@media (max-width: 1100px) {
    .embedded-dashboard-module-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .embedded-dashboard-add-btn {
        justify-content: center;
    }

    .embedded-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .embedded-dashboard-preview {
        grid-column: auto;
        grid-row: auto;
    }

    .embedded-field-row {
        grid-template-columns: 1fr;
    }

    .embedded-dashboard-preview-body {
        height: 480px;
    }

    .embedded-dashboard-preview--expanded {
        left: 0;
    }

    .embedded-dashboard-text-btn span {
        display: none;
    }

    .embedded-dashboard-text-btn {
        width: 34px;
        padding: 0;
        justify-content: center;
    }
}

.radar-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.radar-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.radar-site-panel {
    margin-bottom: 2rem;
    padding: 18px;
    border: 1px solid #e3e9fb;
    border-radius: 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.05);
}

.radar-site-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.radar-site-panel-kicker {
    margin-bottom: 4px;
    color: var(--primary-color);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.radar-site-panel-title {
    color: var(--text-main);
    font-size: 1.02rem;
    font-weight: 900;
    line-height: 1.25;
}

.radar-site-switcher {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.radar-site-tab {
    min-width: 0;
    position: relative;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: #fff;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
    box-shadow: var(--shadow);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.radar-site-tab:hover {
    border-color: rgba(67, 97, 238, 0.28);
    box-shadow: 0 8px 24px rgba(67, 97, 238, 0.08);
    transform: translateY(-1px);
}

.radar-site-tab.active {
    border-color: rgba(67, 97, 238, 0.5);
    background: #f8faff;
    box-shadow: 0 12px 30px rgba(67, 97, 238, 0.12);
}

.radar-site-tab.active::before {
    content: "";
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 0;
    width: 4px;
    border-radius: 0 999px 999px 0;
    background: var(--primary-color);
}

.radar-site-tab-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.radar-site-tab-value {
    color: var(--text-main);
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1;
}

.radar-site-add-card {
    min-height: 126px;
    border-style: dashed;
    background: rgba(248, 250, 252, 0.72);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0.72;
}

.radar-site-add-card:hover {
    border-color: rgba(67, 97, 238, 0.32);
    background: #fff;
    color: var(--primary-color);
    opacity: 1;
}

.radar-site-add-card strong,
.radar-site-add-card small {
    display: block;
}

.radar-site-add-card strong {
    color: inherit;
    font-size: 0.9rem;
    font-weight: 900;
}

.radar-site-add-card small {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.74rem;
    line-height: 1.35;
}

.radar-site-add-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    border-radius: 14px;
    background: #eef2ff;
    color: var(--primary-color);
}

.radar-site-add-icon i {
    width: 20px;
    height: 20px;
}

.radar-alert-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 2rem;
}

.radar-alert-card {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: #fff;
}

.radar-alert-card.danger {
    border-left: 4px solid var(--danger);
    background: #fff7f7;
}

.radar-alert-card.warning {
    border-left: 4px solid var(--warning);
    background: #fffaf0;
}

.radar-alert-card.info {
    border-left: 4px solid var(--primary-color);
    background: #f8faff;
}

.radar-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    gap: 20px;
    align-items: start;
    margin-bottom: 2rem;
}

.radar-card-list,
.radar-profile-list,
.radar-timeline {
    display: grid;
    gap: 12px;
}

.radar-site-card,
.radar-profile-card,
.radar-event-card {
    min-width: 0;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: #fff;
}

.radar-site-top,
.radar-profile-top,
.radar-event-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.radar-title {
    color: var(--text-main);
    font-weight: 800;
    line-height: 1.25;
}

.radar-muted {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.radar-tags,
.radar-metrics-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.radar-metric-pill {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
}

.radar-form-grid {
    display: grid;
    gap: 12px;
}

.radar-form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.radar-field {
    display: grid;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.25;
}

.radar-field input,
.radar-field select,
.radar-field textarea {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
    color: var(--text-main);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    outline: none;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.radar-field input:focus,
.radar-field select:focus,
.radar-field textarea:focus {
    border-color: rgba(67, 97, 238, 0.42);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.08);
}

.radar-field select {
    appearance: none;
    padding-right: 36px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-main) 50%),
        linear-gradient(135deg, var(--text-main) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 50%,
        calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.radar-field textarea {
    min-height: 96px;
    resize: vertical;
    line-height: 1.45;
}

.radar-check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.radar-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 44px;
    padding: 9px 10px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.25;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02);
}

.radar-check input {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--primary-color);
}

/* AI Copilot */
.ai-copilot-overlay {
    position: fixed;
    inset: 0;
    z-index: 2400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(15, 23, 42, 0.36);
    backdrop-filter: blur(5px);
}

.ai-copilot-window {
    width: min(1120px, 96vw);
    height: min(760px, 90vh);
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.ai-copilot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: #fcfcff;
}

.ai-copilot-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ai-copilot-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    border-radius: 14px;
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 8px 18px rgba(67, 97, 238, 0.22);
}

.ai-copilot-icon i {
    width: 21px;
}

.ai-copilot-close {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 999px;
    background: #f1f3f8;
    color: var(--text-muted);
    cursor: pointer;
}

.ai-copilot-body {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 0;
}

.ai-copilot-body--side-collapsed {
    grid-template-columns: minmax(0, 1fr) 58px;
}

.ai-copilot-chat {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    border-right: 1px solid var(--border-color);
}

.ai-copilot-prompts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 16px 20px 10px;
}

.ai-prompt-chip {
    padding: 8px 11px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: #fff;
    color: var(--text-main);
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
}

.ai-prompt-chip:hover {
    border-color: rgba(67, 97, 238, 0.28);
    background: #f8faff;
    color: var(--primary-color);
}

.ai-prompt-chip--report {
    position: relative;
    border-color: rgba(67, 97, 238, 0.45);
    background: linear-gradient(135deg, #eef3ff 0%, #ffffff 100%);
    color: var(--primary-color);
    box-shadow: 0 0 0 0 rgba(67, 97, 238, 0.26);
    animation: aiReportChipPulse 1.9s ease-in-out infinite;
}

@keyframes aiReportChipPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(67, 97, 238, 0.26);
        transform: translateY(0);
    }
    50% {
        box-shadow: 0 0 0 7px rgba(67, 97, 238, 0);
        transform: translateY(-1px);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(67, 97, 238, 0);
        transform: translateY(0);
    }
}

.ai-copilot-messages {
    min-height: 0;
    overflow-y: auto;
    padding: 10px 20px 20px;
    display: grid;
    align-content: start;
    gap: 14px;
}

.ai-message {
    max-width: 88%;
    display: grid;
    gap: 8px;
}

.ai-message.user {
    justify-self: end;
}

.ai-message.bot {
    justify-self: start;
}

.ai-message-bubble {
    padding: 13px 15px;
    border-radius: 16px;
    line-height: 1.48;
    font-size: 0.86rem;
}

.ai-message.user .ai-message-bubble {
    background: var(--primary-color);
    color: #fff;
    border-bottom-right-radius: 6px;
}

.ai-message.bot .ai-message-bubble {
    background: #f8faff;
    color: var(--text-main);
    border: 1px solid #eef2ff;
    border-bottom-left-radius: 6px;
}

.ai-answer-actions,
.ai-source-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-source-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: #fff;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
}

.ai-copilot-side {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 18px;
    background: #fbfcff;
}

.ai-side-toggle {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid rgba(67, 97, 238, 0.18);
    border-radius: 14px;
    background: #fff;
    color: var(--primary-color);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.08);
}

.ai-side-toggle:hover {
    border-color: rgba(67, 97, 238, 0.32);
    background: #f8faff;
}

.ai-side-toggle i {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

.ai-side-content {
    display: grid;
    margin-top: 12px;
}

.ai-copilot-body--side-collapsed .ai-copilot-side {
    padding: 14px 9px;
    overflow: hidden;
}

.ai-copilot-body--side-collapsed .ai-side-content {
    display: none;
}

.ai-copilot-body--side-collapsed .ai-side-toggle {
    min-height: 150px;
    padding: 12px 6px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.ai-copilot-body--side-collapsed .ai-side-toggle i {
    transform: rotate(90deg);
}

.ai-side-section {
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: #fff;
    margin-bottom: 12px;
}

.ai-side-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--text-main);
    font-size: 0.84rem;
    font-weight: 900;
}

.ai-capability-group + .ai-capability-group,
.ai-capability-group + .ai-side-section {
    margin-top: 4px;
}

.ai-capability-list {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.ai-capability-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-main);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.ai-capability-btn span {
    min-width: 0;
}

.ai-capability-btn small {
    flex: 0 0 auto;
    padding: 3px 6px;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary-color);
    font-size: 0.62rem;
    font-weight: 900;
}

.ai-capability-btn:hover {
    border-color: rgba(67, 97, 238, 0.35);
    background: #f8faff;
}

.ai-pain-closure-list {
    display: grid;
    gap: 8px;
}

.ai-pain-closure {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #eef2ff;
    background: #f8faff;
    font-size: 0.78rem;
    color: var(--text-main);
}

.ai-pain-closure strong {
    font-size: 0.8rem;
}

.ai-pain-closure span {
    color: var(--text-muted);
    line-height: 1.45;
}

.ai-side-title i {
    width: 16px;
    color: var(--primary-color);
}

.ai-copilot-footer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: #fff;
}

.ai-voice-btn,
.ai-send-btn {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 14px;
    cursor: pointer;
}

.ai-voice-btn {
    background: #fff3e0;
    color: var(--warning);
}

.ai-send-btn {
    background: var(--primary-color);
    color: #fff;
}

.ai-copilot-input {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 11px 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: #fff;
    color: var(--text-main);
    font: inherit;
    font-size: 0.9rem;
    outline: none;
}

.ai-copilot-input:focus {
    border-color: rgba(67, 97, 238, 0.42);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.08);
}

.ai-copilot-window--report-open {
    grid-template-rows: auto minmax(0, 1fr);
}

.ai-copilot-window--report-open .ai-copilot-body,
.ai-copilot-window--report-open .ai-copilot-footer {
    display: none;
}

.ai-copilot-report-viewer {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    background: #f8faff;
    overflow: hidden;
}

.ai-copilot-report-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    background: #fff;
}

.ai-copilot-report-toolbar-title {
    min-width: 0;
    display: grid;
    gap: 2px;
    text-align: center;
}

.ai-copilot-report-toolbar-kicker {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ai-copilot-report-toolbar-title strong {
    font-size: 0.92rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-copilot-report-toolbar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.ai-copilot-report-back {
    flex-shrink: 0;
}

.ai-copilot-report-frame-wrap {
    min-height: 0;
    padding: 14px;
}

.ai-copilot-report-frame {
    width: 100%;
    height: 100%;
    min-height: min(620px, calc(90vh - 180px));
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.ai-report-generation {
    display: grid;
    gap: 10px;
}

.ai-report-generation-title {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.ai-report-generation-steps {
    display: grid;
    gap: 8px;
}

.ai-report-generation-step {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.ai-report-generation-step.is-active {
    color: var(--primary-color);
    font-weight: 700;
}

.ai-report-generation-step.is-done {
    color: var(--text-main);
}

.ai-report-generation-step-icon {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
}

.ai-report-generation-step-icon i {
    width: 16px;
    height: 16px;
}

.ai-report-generation-step.is-active .ai-report-generation-step-icon i {
    animation: embedded-dashboard-spin 0.9s linear infinite;
}

.radar-profile-card {
    display: grid;
    gap: 10px;
}

.radar-progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef1f6;
}

.radar-progress > span {
    display: block;
    height: 100%;
    border-radius: 999px;
}

.radar-modal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

.modal-content:has(.radar-modal-grid) {
    max-width: min(1100px, calc(100vw - 64px));
}

.modal-content:has(.radar-modal-grid) .radar-form-row {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.modal-content:has(.radar-modal-grid) .radar-field input,
.modal-content:has(.radar-modal-grid) .radar-field select,
.modal-content:has(.radar-modal-grid) .radar-field textarea {
    font-size: 0.82rem;
}

.modal-content:has(.radar-modal-grid) .radar-check {
    align-items: flex-start;
}

.modal-content:has(.chat-modal-composer) {
    max-width: min(920px, calc(100vw - 48px));
}

.chat-modal-composer {
    width: 100%;
    min-width: 0;
    align-items: center;
}

.chat-modal-composer input {
    min-width: 0;
}

.modal-content:has(.chat-modal-shell) {
    max-width: min(920px, calc(100vw - 48px));
    max-height: min(88vh, 820px);
}

#modal-body:has(.chat-modal-shell) {
    display: flex;
    flex-direction: column;
    padding: 25px;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.chat-modal-shell {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 16px;
}

.chat-modal-tabs {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    border-bottom: 1px solid #eef2ff;
    padding-bottom: 2px;
}

.chat-modal-tab {
    padding: 0 0 12px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.chat-modal-tab.is-active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.chat-modal-tab--export {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-bottom-color: transparent !important;
    color: var(--text-muted);
    font-weight: 500;
}

.chat-modal-tab--export i {
    width: 14px;
    height: 14px;
}

.chat-modal-panels {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.chat-modal-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.chat-modal-panel.is-active {
    display: flex;
}

.chat-modal-panel--stats {
    overflow-y: auto;
    padding-right: 4px;
}

.chat-modal-panel--history {
    gap: 12px;
}

.chat-modal-history-toolbar {
    flex-shrink: 0;
}

.chat-modal-history {
    flex: 1;
    min-height: 220px;
    max-height: min(52vh, 460px);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 36px 20px 20px;
    border: 1px solid #eef2ff;
    border-radius: 12px;
    background: #f8f9fa;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.chat-modal-history-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.chat-modal-footer {
    flex-shrink: 0;
}

.chat-modal-footer[hidden] {
    display: none !important;
}

.chat-modal-footer .chat-modal-composer {
    width: 100%;
}

.chat-modal-composer {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px;
    border: 1px solid #eef2ff;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.chat-modal-composer-attach {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    color: var(--text-muted);
    cursor: pointer;
}

.chat-modal-composer-attach i {
    width: 18px;
    height: 18px;
}

.chat-modal-composer input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    background: transparent;
}

.chat-modal-send-btn {
    background: var(--primary-color) !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 24px !important;
    border-radius: 8px !important;
    cursor: pointer;
    font-weight: 600;
}

.chat-modal-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid #eef2ff;
    border-radius: 14px;
    background: #f8faff;
}

.chat-modal-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.chat-modal-meta-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chat-modal-meta-item strong {
    color: var(--text-main);
    font-size: 0.92rem;
    font-weight: 700;
    word-break: break-word;
}

.chat-modal-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
}

.chat-modal-stats--expanded {
    gap: 18px;
    margin-bottom: 18px;
}

.chat-modal-stats--expanded .chat-modal-stat-card {
    padding: 22px 18px;
}

.chat-modal-stats--expanded .chat-modal-stat-value {
    font-size: 2.2rem;
}

.chat-modal-stats--expanded .chat-modal-stat-label {
    font-size: 0.84rem;
}

.chat-modal-stats--secondary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.chat-modal-stats-layout {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-modal-stat-card {
    padding: 16px;
    text-align: center;
    border-radius: 14px;
    border: 1px solid #eef2ff;
    background: linear-gradient(145deg, #ffffff, #f8faff);
    box-shadow: none;
}

.chat-modal-stat-card--warning {
    border-color: #fff3e0;
    background: linear-gradient(145deg, #ffffff, #fffdf8);
}

.chat-modal-stat-card--danger {
    border-color: #ffebee;
    background: linear-gradient(145deg, #ffffff, #fffafa);
}

.chat-modal-stat-card--muted {
    border-color: #eef2f7;
    background: #fbfcff;
}

.chat-modal-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 6px;
    line-height: 1.1;
}

.chat-modal-stat-card--warning .chat-modal-stat-value {
    color: var(--warning);
}

.chat-modal-stat-card--danger .chat-modal-stat-value {
    color: var(--danger);
}

.chat-modal-stat-card--muted .chat-modal-stat-value {
    color: var(--text-main);
    font-size: 1.35rem;
}

.chat-modal-stat-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Engagement module */
.engagement-module {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.engagement-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 20px;
    margin-bottom: 2rem;
}

.engagement-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.engagement-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.engagement-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 20px;
    align-items: start;
    margin-bottom: 2rem;
}

.engagement-model-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.engagement-model-item,
.engagement-program-card,
.engagement-segment-card {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: #fff;
}

.engagement-model-item {
    display: grid;
    gap: 8px;
}

.engagement-model-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    font-weight: 800;
}

.engagement-model-title i {
    width: 17px;
    color: var(--primary-color);
}

.engagement-program-list,
.engagement-segment-list {
    display: grid;
    gap: 12px;
}

.engagement-program-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.engagement-program-title {
    color: var(--text-main);
    font-weight: 800;
    line-height: 1.25;
}

.engagement-muted {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.engagement-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.engagement-progress {
    height: 8px;
    margin: 10px 0 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef1f6;
}

.engagement-progress > span {
    display: block;
    height: 100%;
    border-radius: 999px;
}

.engagement-metric-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    color: var(--text-muted);
    font-size: 0.76rem;
}

.engagement-form-grid {
    display: grid;
    gap: 12px;
}

.engagement-form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.engagement-field {
    display: grid;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.engagement-field input,
.engagement-field select,
.engagement-field textarea {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-main);
    font: inherit;
    font-size: 0.86rem;
    outline: none;
}

.engagement-field textarea {
    min-height: 82px;
    resize: vertical;
}

.engagement-check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.engagement-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-main);
    font-size: 0.84rem;
}

.engagement-modal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

@media (max-width: 1500px) {
    .radar-kpi-grid,
    .radar-site-switcher,
    .radar-alert-grid,
    .engagement-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    .ai-content-hero,
    .ai-content-layout {
        grid-template-columns: 1fr;
    }

    .ai-content-actions {
        justify-content: flex-start;
    }

    .radar-hero,
    .radar-layout,
    .radar-modal-grid,
    .engagement-hero,
    .engagement-layout,
    .engagement-modal-grid {
        grid-template-columns: 1fr;
    }

    .radar-actions,
    .engagement-actions {
        justify-content: flex-start;
    }

    .radar-site-panel-head {
        display: grid;
    }
}

@media (max-width: 760px) {
    .radar-kpi-grid,
    .radar-site-switcher,
    .radar-alert-grid,
    .radar-form-row,
    .radar-check-grid,
    .engagement-kpi-grid,
    .engagement-model-grid,
    .engagement-form-row,
    .engagement-check-grid {
        grid-template-columns: 1fr;
    }

    .delete-user-card,
    .logout-confirm-card {
        grid-template-columns: 1fr;
        justify-items: start;
    }
}

@media (max-width: 1500px) {
    .survey-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    .survey-hero,
    .survey-layout,
    .survey-modal-grid {
        grid-template-columns: 1fr;
    }

    .survey-hero-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .survey-kpi-grid,
    .survey-form-row {
        grid-template-columns: 1fr;
    }
}

.bot-registry-modal {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 25px;
    overflow: hidden;
}

.bot-registry-header {
    flex-shrink: 0;
}

.bot-registry-scroll {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 2px;
}

.bot-registry-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.bot-action-panel {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px dashed #dfe6fb;
    border-radius: 18px;
    background: #f8faff;
}

.bot-action-panel.is-active {
    border-style: solid;
    background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
    box-shadow: 0 10px 26px rgba(67, 97, 238, 0.07);
}

.bot-action-panel-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #eef2ff;
    color: var(--primary-color);
}

.bot-action-panel-icon i {
    width: 20px;
    height: 20px;
}

.bot-action-panel-title {
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 900;
    line-height: 1.25;
}

.bot-action-panel-text,
.bot-action-panel-body {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.bot-action-panel-body {
    display: grid;
    gap: 12px;
    margin-top: 10px;
}

.bot-inline-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.bot-inline-switch-row {
    min-height: 44px;
    display: flex;
    align-items: center;
}

.bot-inline-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.bot-sync-mode {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.bot-sync-mode button {
    min-height: 42px;
    padding: 9px 10px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: #fff;
    color: var(--text-main);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 900;
}

.bot-sync-mode button.is-active {
    border-color: rgba(67, 97, 238, 0.42);
    background: #eef2ff;
    color: var(--primary-color);
}

.bot-sync-mode i {
    width: 15px;
    height: 15px;
}

.bot-registry-summary .card {
    border-radius: 14px;
}

.bot-registry-list {
    display: grid;
    gap: 10px;
}

.bot-registry-card {
    display: block;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: #fff;
    min-width: 0;
}

.bot-registry-card.is-disabled {
    background: #f8fafc;
    border-style: dashed;
    opacity: 0.92;
}

.bot-registry-visibility {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 8px;
    border: 1px solid #eef2ff;
    border-radius: 999px;
    background: #f8faff;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.bot-registry-visibility.is-connected {
    border-color: rgba(34, 197, 94, 0.28);
    background: #f0fdf4;
}

.bot-registry-visibility.is-disconnected {
    border-color: #e2e8f0;
    background: #f8fafc;
}

.bot-registry-visibility-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 8px;
    background: #94a3b8;
}

.bot-registry-visibility.is-connected .bot-registry-visibility-dot {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
}

.bot-registry-visibility.is-disconnected .bot-registry-visibility-dot {
    background: #cbd5e1;
}

.bot-registry-visibility-label {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    white-space: nowrap;
}

.bot-registry-visibility.is-connected .bot-registry-visibility-label {
    color: #15803d;
}

.bot-registry-visibility.is-disconnected .bot-registry-visibility-label {
    color: #64748b;
}

.bot-registry-visibility .form-switch {
    transform: scale(0.9);
}

.bot-sync-confirm-intro {
    color: var(--text-main);
    font-size: 0.88rem;
    line-height: 1.45;
}

.bot-sync-confirm-list {
    margin: 12px 0 14px;
    padding-left: 18px;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.bot-sync-confirm-list strong {
    color: var(--text-main);
}

.bot-sync-preview {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.bot-sync-preview-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #eef2ff;
    border-radius: 12px;
    background: #f8faff;
}

.bot-sync-preview-name {
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 800;
}

.bot-sync-preview-meta {
    color: var(--text-muted);
    font-size: 0.72rem;
    white-space: nowrap;
}

.bot-registry-empty {
    padding: 18px;
    border: 1px dashed var(--border-color);
    border-radius: 14px;
    background: #f8faff;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.bot-registry-disabled-block {
    margin-top: 14px;
}

.bot-registry-disabled-toggle {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    background: #fff;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
}

.bot-registry-disabled-toggle:hover {
    border-color: rgba(67, 97, 238, 0.22);
    color: var(--primary-color);
    background: #f8faff;
}

.bot-registry-list--disabled {
    margin-top: 10px;
}

.bot-registry-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    min-width: 0;
}

.bot-registry-expand {
    width: 32px;
    height: 32px;
    margin-top: 2px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.bot-registry-expand i {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.bot-registry-card.is-expanded .bot-registry-expand {
    border-color: rgba(67, 97, 238, 0.28);
    color: var(--primary-color);
}

.bot-registry-card.is-expanded .bot-registry-expand i {
    transform: rotate(180deg);
}

.bot-registry-name {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    min-width: 0;
    cursor: pointer;
}

.bot-registry-name:focus-visible {
    outline: 2px solid rgba(67, 97, 238, 0.35);
    outline-offset: 2px;
    border-radius: 10px;
}

.bot-registry-details[hidden] {
    display: none;
}

.bot-registry-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    border-radius: 10px;
    background: #f0f3ff;
    color: var(--primary-color);
}

.bot-registry-title {
    color: var(--text-main);
    font-weight: 800;
    line-height: 1.2;
}

.bot-registry-sub {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.35;
}

.bot-registry-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bot-registry-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap;
    align-items: center;
}

.bot-registry-actions .chat-action {
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.72rem;
}

.bot-registry-actions .chat-action-secondary {
    color: var(--text-muted);
}

.bot-registry-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f1f3f8;
}

.bot-registry-meta-title {
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bot-registry-metric-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    color: var(--text-main);
    font-size: 0.78rem;
}

.bot-registry-ops {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, auto)) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f1f3f8;
}

.bot-ops-button {
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
    color: var(--text-main);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font: inherit;
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
}

.bot-ops-button:hover {
    border-color: rgba(67, 97, 238, 0.22);
    background: #f8faff;
    color: var(--primary-color);
}

.bot-ops-button i {
    width: 15px;
    height: 15px;
}

.bot-ops-events {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.bot-ops-events span {
    padding: 4px 7px;
    border-radius: 999px;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
}

.bot-chat-sync-note {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.bot-chat-sync-note span {
    min-width: 0;
    padding: 12px;
    border: 1px solid #eef2ff;
    border-radius: 14px;
    background: #f8faff;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.bot-chat-sync-note strong {
    color: var(--text-main);
}

.bot-chat-list {
    display: grid;
    gap: 10px;
}

.bot-chat-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 13px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: #fff;
}

.bot-chat-title {
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 900;
    line-height: 1.25;
}

.bot-chat-meta {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.35;
}

.bot-chat-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

@media (max-width: 1100px) {
    .bot-registry-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bot-registry-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .bot-registry-top,
    .bot-action-panel,
    .bot-inline-grid,
    .bot-sync-mode,
    .bot-registry-ops,
    .bot-registry-meta,
    .bot-chat-sync-note,
    .bot-chat-row,
    .chat-language-settings-panel {
        grid-template-columns: 1fr;
    }

    .chat-language-settings-panel .student-agent-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bot-chat-status {
        justify-content: flex-start;
    }
}

@media (max-width: 1500px) {
    .chat-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    .chat-module-hero {
        grid-template-columns: 1fr;
    }

    .chat-hero-actions,
    .chat-primary-action {
        justify-content: flex-start;
    }

    .chat-primary-action {
        justify-self: start;
    }
}

@media (max-width: 760px) {
    .chat-kpi-grid {
        grid-template-columns: 1fr;
    }

    .chat-scenario-row {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .chat-scenario-row button {
        grid-column: 2;
        justify-self: start;
    }
}

/* Pulse animation for connection indicator */
@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.pulse-dot {
    display: inline-block;
    animation: pulse-green 1.5s ease-in-out infinite;
    color: var(--success);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade {
    animation: fadeIn 0.5s ease forwards;
}

/* Notifications Dropdown */
.notifications {
    position: relative;
}

.notifications-trigger {
    position: relative;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(67, 97, 238, 0.14);
    border-radius: 12px;
    background: #fff;
    color: var(--text-muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.notifications-trigger:hover,
.notifications:has(.notifications-dropdown.active) .notifications-trigger {
    background: #f8faff;
    border-color: rgba(67, 97, 238, 0.28);
    color: var(--primary-color);
    box-shadow: 0 6px 18px rgba(67, 97, 238, 0.1);
}

.notifications-trigger i {
    width: 18px;
    height: 18px;
}

.notifications-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    border-radius: 999px;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    line-height: 1;
}

.notifications-badge:empty,
.notifications-badge.is-hidden {
    display: none;
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(380px, calc(100vw - 32px));
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
    border: 1px solid rgba(226, 232, 240, 0.95);
    display: none;
    z-index: 1100;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.notifications-dropdown.active {
    display: block;
    animation: modal-up 0.24s ease-out;
}

/* User Profile Dropdown */
.profile-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px 6px 14px;
    border: 1px solid rgba(67, 97, 238, 0.12);
    border-radius: 14px;
    background: #fff;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.profile-container:hover,
.profile-container:has(.profile-dropdown.active) {
    background: #f8faff;
    border-color: rgba(67, 97, 238, 0.24);
    box-shadow: 0 6px 18px rgba(67, 97, 238, 0.08);
}

.user-info-name {
    font-weight: 700;
    font-size: 0.86rem;
    color: var(--text-main);
    line-height: 1.25;
}

.user-info-role {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.25;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 2px solid #eef2ff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(280px, calc(100vw - 32px));
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
    border: 1px solid rgba(226, 232, 240, 0.95);
    display: none;
    z-index: 1100;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.profile-dropdown.active {
    display: block;
    animation: modal-up 0.24s ease-out;
}

.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 14px;
    border-bottom: 1px solid #f1f3f8;
    background: linear-gradient(180deg, #fcfcff 0%, #fff 100%);
}

.profile-dropdown-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 2px solid #eef2ff;
    object-fit: cover;
    flex-shrink: 0;
}

.profile-dropdown-meta {
    min-width: 0;
}

.profile-dropdown-name {
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.3;
}

.profile-dropdown-role {
    margin-top: 3px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary-color);
}

.profile-dropdown-menu {
    padding: 8px;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    text-decoration: none;
    color: var(--text-main);
    border-radius: 12px;
    font-size: 0.84rem;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease;
}

.profile-dropdown-item:hover {
    background: #f8faff;
    color: var(--primary-color);
}

.profile-dropdown-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #f8faff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.profile-dropdown-item-icon i {
    width: 17px;
    height: 17px;
    color: var(--text-muted);
}

.profile-dropdown-item:hover .profile-dropdown-item-icon {
    background: #eef2ff;
}

.profile-dropdown-item:hover .profile-dropdown-item-icon i {
    color: var(--primary-color);
}

.profile-dropdown-item.logout {
    color: var(--danger);
}

.profile-dropdown-item.logout .profile-dropdown-item-icon {
    background: rgba(244, 67, 54, 0.08);
}

.profile-dropdown-item.logout .profile-dropdown-item-icon i {
    color: var(--danger);
}

.profile-dropdown-item.logout:hover {
    background: rgba(244, 67, 54, 0.06);
}

.profile-dropdown-divider {
    height: 1px;
    background: #f1f3f8;
    margin: 6px 8px;
}

/* ========== Modal Refinements ========== */
.modal-profile-header {
    display: flex;
    gap: 30px;
    align-items: center;
    margin-bottom: 32px;
    background: rgba(67, 97, 238, 0.03);
    padding: 24px;
    border-radius: 24px;
    border: 1px solid rgba(67, 97, 238, 0.08);
}

.modal-profile-avatar-container {
    position: relative;
    flex-shrink: 0;
}

.modal-profile-avatar {
    width: 110px;
    height: 110px;
    border-radius: 32px;
    border: 4px solid white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    display: block;
}

.modal-profile-cam-btn {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.4);
    transition: transform 0.2s;
}

.modal-profile-cam-btn:hover {
    transform: scale(1.1);
}

.modal-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.1rem;
}

.modal-section-title i {
    color: var(--primary-color);
    width: 20px;
    height: 20px;
}

.modal-card {
    background: white;
    padding: 20px;
    border-radius: 20px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.modal-input-group {
    margin-bottom: 15px;
}

.modal-input-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}

.modal-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.9rem;
    background: white;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s;
}

.modal-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

.modal-log-container {
    max-height: 220px;
    overflow-y: auto;
    background: #0f172a;
    border-radius: 18px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.05);
}

.modal-log-entry {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.4;
}

.modal-log-entry:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.modal-achievement-badge {
    width: 52px;
    height: 52px;
    background: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    font-size: 1.5rem;
    border: 1px solid #f1f5f9;
    cursor: help;
    transition: all 0.2s;
}

.modal-achievement-badge:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.notif-header {
    padding: 16px 18px;
    border-bottom: 1px solid #f1f3f8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, #fcfcff 0%, #fff 100%);
}

.notif-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-weight: 800;
    font-size: 0.92rem;
    color: var(--text-main);
}

.notif-count-pill {
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary-color);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.2;
}

.notif-count-pill.is-hidden {
    display: none;
}

.notif-clear-btn {
    border: 0;
    background: transparent;
    color: var(--primary-color);
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.notif-clear-btn:hover {
    background: #f0f3ff;
}

.notif-list {
    max-height: min(420px, 58vh);
    overflow-y: auto;
    padding: 8px;
}

.notif-list::-webkit-scrollbar {
    width: 6px;
}

.notif-list::-webkit-scrollbar-thumb {
    background: #d9def5;
    border-radius: 999px;
}

.notif-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.notif-item + .notif-item {
    margin-top: 4px;
}

.notif-item:hover {
    background: #f8faff;
}

.notif-item.is-unread {
    background: #f8faff;
    box-shadow: inset 0 0 0 1px rgba(67, 97, 238, 0.08);
}

.notif-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.notif-icon i {
    width: 18px;
    height: 18px;
}

.notif-icon--danger {
    background: rgba(244, 67, 54, 0.1);
    color: var(--danger);
}

.notif-icon--warning {
    background: rgba(255, 152, 0, 0.12);
    color: var(--warning);
}

.notif-icon--success {
    background: rgba(76, 175, 80, 0.12);
    color: var(--success);
}

.notif-icon--info {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

.notif-body {
    min-width: 0;
}

.notif-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.notif-title {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text-main);
    line-height: 1.35;
}

.notif-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    flex-shrink: 0;
    margin-top: 5px;
}

.notif-desc {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.notif-time {
    margin-top: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #94a3b8;
}

.notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 18px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.notif-empty i {
    width: 28px;
    height: 28px;
    color: #c7d2fe;
    margin-bottom: 8px;
}

/* Mobile menu toggle - desktop hidden */
.mobile-menu-toggle {
    display: none;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-main);
}

.sidebar-backdrop {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .qr-access-card {
        grid-template-columns: 1fr;
    }

    .qr-code-box {
        min-height: 230px;
    }

    body.sidebar-mobile-open {
        overflow: hidden;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 190;
        backdrop-filter: blur(2px);
    }

    body.sidebar-mobile-open .sidebar-backdrop {
        display: block;
    }

    .sidebar {
        width: min(280px, 88vw);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 200;
        box-shadow: none;
    }

    body.sidebar-mobile-open .sidebar {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(15, 23, 42, 0.12);
    }

    .main-wrapper {
        margin-left: 0;
        max-width: 100vw;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

    .top-bar {
        padding: 10px 1rem;
        height: auto;
        min-height: 64px;
        gap: 10px;
    }

    .page-title {
        min-width: 0;
        flex: 1 1 auto;
    }

    .page-title h1 {
        font-size: 1.05rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .top-bar-status-group {
        display: none;
    }

    .content-area {
        padding: 1rem;
    }

    .ai-copilot-trigger span {
        display: none;
    }

    .user-info {
        display: none;
    }

    .grid,
    .kpi-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .chat-kpi-grid,
    .survey-kpi-grid,
    .radar-kpi-grid,
    .engagement-kpi-grid,
    .radar-site-switcher,
    .radar-alert-grid,
    .bot-registry-summary {
        grid-template-columns: 1fr;
    }

    .chat-module-hero,
    .radar-hero,
    .survey-hero,
    .engagement-hero,
    .ai-content-hero,
    .bitrix-hero {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .chat-hero-actions,
    .radar-actions,
    .survey-hero-actions,
    .engagement-actions,
    .ai-content-actions,
    .bitrix-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        justify-content: flex-start;
    }

    .chat-hero-actions > *,
    .radar-actions > *,
    .survey-hero-actions > *,
    .engagement-actions > *,
    .ai-content-actions > *,
    .bitrix-actions > * {
        width: 100%;
        justify-content: center;
        white-space: normal;
    }

    .ai-content-layout,
    .bitrix-tasks-layout,
    .bitrix-crm-grid,
    .bitrix-channels-grid,
    .bitrix-kb-grid {
        grid-template-columns: 1fr;
    }

    .bitrix-connection-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .bitrix-connection-meta {
        justify-content: stretch;
        flex-direction: column;
        align-items: stretch;
    }

    .bitrix-sync-time {
        white-space: normal;
    }

    .bitrix-sync-btn,
    .bitrix-resync-btn,
    .bitrix-channel-connect {
        width: 100%;
        justify-content: center;
    }

    .bitrix-lead-card {
        flex-direction: column;
        align-items: stretch;
    }

    .bitrix-lead-card .status-tag {
        align-self: flex-start;
    }

    .bitrix-rule-foot {
        flex-wrap: wrap;
    }

    .bitrix-add-rule-btn {
        width: 100%;
        justify-content: center;
    }

    .ai-content-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ai-draft-actions {
        flex-direction: column;
    }

    .ai-draft-actions > * {
        width: 100%;
        justify-content: center;
    }

    .radar-site-panel-head {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .module-intro {
        font-size: 0.85rem;
    }

    .notifications-dropdown {
        width: min(320px, calc(100vw - 24px));
        right: -8px;
    }

    .profile-dropdown {
        right: 0;
        width: min(280px, calc(100vw - 24px));
    }

    .module-actions-row {
        flex-direction: column;
        align-items: stretch;
    }

    .module-actions-buttons {
        justify-content: flex-start;
    }

    .module-actions-buttons > * {
        flex: 1 1 auto;
        justify-content: center;
    }

    .dashboard-split-grid,
    .dashboard-charts-grid,
    #main-content .grid[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .chat-scenario-row {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .chat-scenario-row > :nth-child(3) {
        grid-column: 2;
        justify-self: start;
    }

    .modal-overlay.active,
    .modal-overlay--nested.active {
        padding: 0;
        flex-direction: column;
        align-items: stretch;
        overflow: hidden;
    }

    .modal-overlay--confirm.active {
        padding: 16px;
        align-items: center;
        justify-content: center;
    }

    .modal-overlay.active > .modal-content,
    .modal-overlay--nested.active > .modal-content,
    .modal-content,
    .modal-content:has(.radar-modal-grid),
    .modal-content:has(.settings-modal),
    .modal-content:has(.user-account-modal),
    .modal-content:has(.delete-user-confirmation),
    .modal-content:has(.logout-confirmation),
    .modal-content:has(.chat-modal-composer),
    .modal-content:has(.embedded-dashboard-modal),
    .modal-content:has(.hub-settings-modal),
    .modal-content--nested {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        height: auto;
        flex: 1;
        max-height: none;
        min-height: 0;
        border-radius: 0;
        box-shadow: none;
        overflow: hidden;
        animation: modal-up-mobile 0.24s ease-out;
    }

    .modal-content--confirm {
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 0;
        max-height: calc(100dvh - 32px);
        border-radius: 18px;
    }

    .modal-header {
        padding: 14px 16px;
        flex-shrink: 0;
    }

    .modal-header h3,
    #modal-title,
    #bot-submodal-title {
        min-width: 0;
        flex: 1;
        font-size: 1rem;
        line-height: 1.3;
    }

    .modal-title-row {
        flex-wrap: wrap;
    }

    .modal-body {
        flex: 1;
        min-height: 0;
    }

    .modal-body-scrollable {
        padding: 12px 14px;
        flex: 1;
        min-width: 0;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .bot-registry-modal {
        padding: 12px 14px;
    }

    .settings-modal,
    .hub-settings-modal {
        min-width: 0;
        max-width: 100%;
        gap: 12px;
    }

    .hub-settings-modal .form-section {
        padding: 12px;
        min-width: 0;
    }

    .hub-stats-grid,
    .hub-settings-modal .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 0;
    }

    .hub-settings-modal .mini-stat-card {
        padding: 10px 6px;
        min-width: 0;
    }

    .hub-settings-modal .mini-stat-value {
        font-size: 1rem;
    }

    .hub-settings-modal .mini-stat-label {
        font-size: 0.58rem;
        letter-spacing: 0.02em;
        line-height: 1.25;
        word-break: break-word;
        hyphens: auto;
    }

    .hub-provider-card-summary,
    .hub-scenario-card-summary {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        padding: 12px;
    }

    .hub-provider-card-name,
    .hub-scenario-card-summary > span:first-child {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .hub-provider-card-summary .status-tag,
    .hub-scenario-card-summary .status-tag {
        font-size: 0.62rem;
        padding: 4px 8px;
        white-space: normal;
        text-align: center;
        max-width: 92px;
        line-height: 1.2;
    }

    .hub-provider-card-body,
    .hub-scenario-card-body {
        padding: 0 12px 12px;
    }

    .hub-provider-add {
        font-size: 0.78rem;
    }

    .form-section-title {
        font-size: 0.9rem;
        overflow-wrap: anywhere;
    }

    .modal-footer {
        flex-shrink: 0;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    #bot-submodal-body.modal-body {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .radar-modal-grid,
    .survey-modal-grid,
    .engagement-modal-grid,
    .modal-content:has(.radar-modal-grid) .radar-form-row,
    .radar-form-row,
    .radar-check-grid,
    .engagement-form-row,
    .engagement-check-grid,
    .survey-form-row {
        grid-template-columns: 1fr !important;
    }

    #modal-body [style*="grid-template-columns"],
    .modal-body-scrollable [style*="grid-template-columns"],
    #bot-submodal-body [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .chat-modal-stats,
    .chat-modal-stats--secondary {
        grid-template-columns: 1fr !important;
    }

    .chat-modal-history {
        max-height: min(46vh, 360px);
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        gap: 10px;
    }

    .modal-footer .chat-action-secondary,
    .modal-footer .chat-action-primary,
    .modal-footer .chat-action-danger {
        width: 100%;
        justify-content: center;
    }

    .modal-footer-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .form-grid:not(.form-grid-single) {
        grid-template-columns: 1fr;
    }

    .form-section-header,
    .form-toggle-row:not(.form-toggle-row-stacked) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 12px;
    }

    .form-section-header > div:first-child,
    .form-toggle-row:not(.form-toggle-row-stacked) > div:first-child {
        min-width: 0;
    }

    .form-section-header .form-switch,
    .form-toggle-row:not(.form-toggle-row-stacked) .form-switch {
        grid-column: 2;
        grid-row: 1;
        width: 46px;
        height: 26px;
        min-width: 46px;
        max-width: 46px;
        flex: none;
        justify-self: end;
    }

    .form-toggle-row-stacked .form-toggle-head > div:first-child {
        min-width: 0;
    }

    .form-section-details-summary {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        gap: 10px;
    }

    .form-section-details-summary .form-section-subtitle {
        grid-column: 1;
    }

    .chat-settings-actions {
        flex-direction: column;
    }

    .chat-settings-actions .chat-action-secondary,
    .chat-settings-actions .chat-action-primary {
        width: 100%;
        flex: 0 0 auto;
        min-height: 46px;
        max-height: none;
        justify-content: center;
        white-space: normal;
    }

    .form-check-row {
        display: grid;
        grid-template-columns: 20px minmax(0, 1fr);
        align-items: start;
        gap: 12px;
    }

    .form-check-row input[type="checkbox"] {
        order: unset;
        grid-column: 1;
        grid-row: 1;
        width: 20px;
        height: 20px;
        min-width: 20px;
        max-width: 20px;
        flex: none;
        margin-top: 2px;
    }

    .form-check-row > span {
        grid-column: 2;
        grid-row: 1;
    }

    .settings-status-card {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .settings-status-card > .status-tag {
        grid-column: 2;
        justify-self: start;
    }

    .support-ticket-meta-grid {
        grid-template-columns: 1fr;
    }

    .support-ticket-reply-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .support-ticket-reply-actions .chat-action-secondary,
    .support-ticket-reply-actions .chat-action-primary {
        width: 100%;
        justify-content: center;
    }

    .bot-submodal-footer.modal-footer-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .bot-submodal-footer .chat-action-secondary,
    .bot-submodal-footer .chat-action-primary {
        width: 100%;
        justify-content: center;
    }

    .hub-mapping-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .hub-provider-card-actions {
        justify-content: stretch;
    }

    .hub-provider-card-actions .chat-action-primary {
        width: 100%;
        justify-content: center;
    }

    .hub-mapping-row strong {
        text-align: left;
    }

    .form-check-list-header {
        flex-direction: column;
        align-items: stretch;
    }

    .form-check-list-actions {
        width: 100%;
    }

    .form-check-list-actions .chat-action-secondary {
        width: 100%;
        justify-content: center;
    }

    .modal-footer > div[style*="display:flex"],
    .modal-footer > div[style*="display: flex"] {
        width: 100%;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .modal-footer > div[style*="display:flex"] > *,
    .modal-footer > div[style*="display: flex"] > * {
        width: 100%;
        justify-content: center;
    }

    .bot-submodal-body {
        padding: 16px;
    }

    .embedded-dashboard-preview-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .embedded-dashboard-preview-actions {
        width: 100%;
        justify-content: space-between;
    }

    .embedded-dashboard-preview-toolbar {
        border-left: 0;
        padding-left: 0;
        flex-wrap: wrap;
    }

    .embedded-dashboard-preview-title-row {
        width: 100%;
    }

    .embedded-preview-url {
        white-space: normal;
        word-break: break-all;
    }

    .embedded-dashboard-preview--expanded .embedded-dashboard-preview-title-row {
        flex-wrap: wrap;
    }

    .embedded-dashboard-panel-switcher {
        width: 100%;
        flex: 1 1 100%;
    }

    .embedded-panel-switch-btn span {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .form-section {
        padding: 14px;
    }
}

@media (max-width: 980px) {
    .ai-copilot-window {
        height: 92vh;
    }

    .ai-copilot-body {
        grid-template-columns: 1fr;
    }

    .ai-copilot-side {
        display: none;
    }
}

@media (max-width: 620px) {
    .ai-copilot-overlay {
        padding: 10px;
    }

    .ai-copilot-window {
        width: 100%;
        height: 96vh;
        border-radius: 18px;
    }

    .ai-copilot-footer {
        grid-template-columns: auto minmax(0, 1fr) auto;
        padding: 12px;
    }
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal-overlay--nested {
    z-index: 2100;
    background: rgba(15, 23, 42, 0.28);
}

.modal-overlay--confirm {
    z-index: 2200;
    background: rgba(15, 23, 42, 0.38);
}

.modal-content--confirm {
    width: min(440px, calc(100vw - 40px));
    max-width: 440px;
    padding: 24px;
    text-align: center;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
}

.confirm-dialog-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    box-shadow: inset 0 -8px 16px rgba(15, 23, 42, 0.12);
}

.confirm-dialog-icon i {
    width: 28px;
    height: 28px;
    stroke-width: 2.4;
}

.confirm-dialog-icon--success {
    background: var(--success);
}

.confirm-dialog-icon--error {
    background: var(--danger);
}

.confirm-dialog-icon--warning {
    background: var(--warning);
}

.confirm-dialog-icon--info {
    background: var(--primary-color);
}

.confirm-dialog-body h3 {
    margin: 0 0 8px;
    color: var(--text-main);
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1.3;
}

.confirm-dialog-body p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.5;
}

.confirm-dialog-footer {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #f1f3f8;
}

.modal-overlay.has-submodal {
    background: rgba(15, 23, 42, 0.52);
}

.modal-content--nested {
    max-width: 760px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
    animation: modal-up 0.24s ease-out;
}

.bot-submodal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
}

.bot-submodal-title i {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

.bot-submodal-body {
    padding: 20px 24px 10px;
}

.bot-submodal-footer {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #f1f3f8;
}

.bot-submodal-footer.modal-footer-actions {
    justify-content: flex-end;
}

.modal-content {
    background: white;
    width: 95%;
    max-width: 650px;
    max-height: 85vh;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-up 0.3s ease-out;
}

@keyframes modal-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modal-up-mobile {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fcfcfc;
}

.close-btn {
    background: #f0f0f0;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #e0e0e0;
    color: var(--text-color);
}

.modal-body {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.modal-body-scrollable {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-content:has(.settings-modal),
.modal-content:has(.user-account-modal) {
    max-width: min(980px, calc(100vw - 64px));
}

.modal-content:has(.bot-registry-modal) {
    max-width: min(1120px, calc(100vw - 64px));
    max-height: 88vh;
}

#modal-body:has(.bot-registry-modal) {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
}

.modal-content:has(.delete-user-confirmation),
.modal-content:has(.logout-confirmation) {
    max-width: min(760px, calc(100vw - 64px));
}

.modal-content input:not([type="checkbox"]):not([type="radio"]),
.modal-content select,
.modal-content textarea {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 11px 13px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
    color: var(--text-main);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    outline: none;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.modal-content textarea {
    min-height: 92px;
    resize: vertical;
    line-height: 1.45;
}

.modal-content select {
    appearance: none;
    padding-right: 38px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-main) 50%),
        linear-gradient(135deg, var(--text-main) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 50%,
        calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}

.modal-content input:not([type="checkbox"]):not([type="radio"]):focus,
.modal-content select:focus,
.modal-content textarea:focus {
    border-color: rgba(67, 97, 238, 0.42);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.08);
}

.modal-content input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    margin: 0;
    appearance: none;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-content input[type="checkbox"]:checked {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' d='M5 10.5l3.2 3.1L15 6.8'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 16px 16px;
}

.modal-content input[type="checkbox"]:focus-visible {
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.14);
}

.settings-modal {
    display: grid;
    gap: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
}

.chat-settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-settings-actions .chat-action-secondary,
.chat-settings-actions .chat-action-primary {
    flex: 0 0 auto;
    min-height: 46px;
    height: auto;
}

.modal-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.modal-title-row i {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.modal-empty-note {
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.hub-settings-modal {
    display: grid;
    gap: 14px;
}

.hub-provider-list,
.hub-scenario-list {
    display: grid;
    gap: 10px;
}

.hub-provider-card,
.hub-scenario-card {
    border: 1px solid #e7ecfb;
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.03);
}

.hub-provider-card-summary,
.hub-scenario-card-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    list-style: none;
    min-width: 0;
}

.hub-provider-card-summary::-webkit-details-marker,
.hub-scenario-card-summary::-webkit-details-marker {
    display: none;
}

.hub-provider-card-name,
.hub-scenario-card-summary > span:first-child {
    color: var(--text-main);
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.25;
    min-width: 0;
}

.hub-provider-card-body,
.hub-scenario-card-body {
    display: grid;
    gap: 12px;
    padding: 0 16px 16px;
    border-top: 1px solid #eef2ff;
}

.hub-provider-token-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.hub-provider-token-state {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 800;
}

.hub-provider-token-state i {
    width: 12px;
    height: 12px;
}

.hub-provider-token-state--ok {
    color: var(--success);
}

.hub-provider-token-state--warn {
    color: var(--warning);
}

.hub-provider-card-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.hub-provider-add {
    width: 100%;
    min-height: 44px;
    border: 1px dashed #d7def5;
    border-radius: 14px;
    background: #f8faff;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.hub-inline-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid #dfe6fb;
    border-radius: 14px;
    background: #fff;
    color: var(--primary-color);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(67, 97, 238, 0.08);
    white-space: nowrap;
}

.hub-inline-link i {
    width: 16px;
    height: 16px;
}

.hub-extension-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
}

.hub-extension-card {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 18px;
    min-height: 275px;
    padding: 22px;
    border: 1px solid #e5ebfb;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.hub-extension-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.72;
}

.hub-extension-card--blue::before {
    background: radial-gradient(circle at 0 0, rgba(67, 97, 238, 0.12), transparent 35%);
}

.hub-extension-card--red::before {
    background: radial-gradient(circle at 0 0, rgba(239, 68, 68, 0.11), transparent 35%);
}

.hub-extension-card--green::before {
    background: radial-gradient(circle at 0 0, rgba(76, 175, 80, 0.12), transparent 35%);
}

.hub-extension-head,
.hub-extension-body,
.hub-extension-action {
    position: relative;
    z-index: 1;
}

.hub-extension-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.hub-extension-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.07);
}

.hub-extension-icon i {
    width: 26px;
    height: 26px;
    color: var(--primary-color);
}

.hub-extension-card--red .hub-extension-icon i {
    color: var(--danger);
}

.hub-extension-card--green .hub-extension-icon i {
    color: var(--success);
}

.hub-extension-tags {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.hub-extension-body h4 {
    margin: 0 0 8px;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 900;
}

.hub-extension-body p {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.48;
}

.hub-extension-points {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hub-extension-points span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 9px;
    border: 1px solid #edf1fb;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--text-main);
    font-size: 0.68rem;
    font-weight: 800;
}

.hub-extension-points i {
    width: 12px;
    height: 12px;
    color: var(--success);
}

.hub-extension-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    width: 100%;
    border: 0;
    border-radius: 16px;
    background: var(--primary-color);
    color: #fff;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(67, 97, 238, 0.18);
}

.hub-extension-action--secondary {
    border: 1px solid #dfe6fb;
    background: #fff;
    color: var(--primary-color);
    box-shadow: none;
}

.hub-stats-grid {
    margin-bottom: 0;
}

.hub-mapping-list {
    display: grid;
    gap: 8px;
}

.hub-mapping-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #eef2ff;
    border-radius: 14px;
    background: #fff;
    min-width: 0;
}

.hub-mapping-row span {
    color: var(--text-main);
    font-size: 0.84rem;
    font-weight: 800;
}

.hub-mapping-row strong {
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 800;
    text-align: right;
}

.chat-module-check-row span {
    display: grid;
    gap: 6px;
}

.chat-module-tag {
    width: fit-content;
}

.chat-module-link {
    border: 0;
    padding: 0;
    background: none;
    color: var(--primary-color);
    font: inherit;
    font-size: inherit;
    font-weight: 800;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.form-section-details {
    gap: 0;
}

.form-section-details-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    list-style: none;
}

.form-section-details-summary::-webkit-details-marker {
    display: none;
}

.form-section-details-summary::after {
    content: '+';
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 900;
    line-height: 1;
}

.form-section-details[open] .form-section-details-summary::after {
    content: '−';
}

.form-section-details-body {
    display: grid;
    gap: 14px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #eef2ff;
}

.form-section {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid #e7ecfb;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.form-section-header,
.form-toggle-row,
.form-toggle-head,
.settings-status-card,
.form-check-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    min-width: 0;
}

.form-section-title {
    color: var(--text-main);
    font-size: 0.98rem;
    font-weight: 900;
    line-height: 1.25;
}

.form-section-subtitle,
.form-toggle-subtitle,
.settings-status-subtitle,
.form-check-row small {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-grid-single {
    grid-template-columns: 1fr;
}

.form-field {
    display: grid;
    gap: 7px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.form-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.form-inline input {
    flex: 1;
}

.form-number-input {
    max-width: 86px;
    flex: 0 0 86px !important;
}

.form-icon-button {
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
    padding: 0;
}

.form-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.form-tags .status-tag {
    border: 1px solid rgba(67, 97, 238, 0.18);
    background: #eef2ff;
    color: var(--primary-color);
}

.form-tags i {
    width: 13px;
    height: 13px;
}

.settings-status-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid #eef2ff;
    border-radius: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
}

.settings-status-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #eef2ff;
    color: var(--primary-color);
    flex: 0 0 auto;
}

.settings-status-icon i {
    width: 21px;
    height: 21px;
}

.settings-status-title,
.form-toggle-title,
.form-check-row strong {
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 900;
    line-height: 1.25;
}

.form-toggle-list,
.form-check-list {
    display: grid;
    gap: 10px;
}

.form-check-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 14px 0 10px;
}

.form-check-list-title {
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 800;
}

.form-check-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.form-check-list-actions .chat-action-secondary {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 0.72rem;
}

.form-toggle-row,
.form-check-row {
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: #fff;
}

.form-toggle-row-stacked {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
}

.form-toggle-row-stacked .form-toggle-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.form-toggle-row-stacked > input,
.form-toggle-row-stacked > .form-inline {
    width: 100%;
    min-width: 0;
}

.form-toggle-row-stacked .form-inline {
    flex-wrap: wrap;
}

.form-toggle-row-stacked .form-inline input[type="text"] {
    flex: 1 1 160px;
    min-width: 0;
}

.form-switch {
    width: 46px;
    height: 26px;
    min-width: 46px;
    max-width: 46px;
    position: relative;
    flex: 0 0 46px;
    border: 0;
    border-radius: 999px;
    background: #cbd5e1;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
    transition: background 0.2s ease, box-shadow 0.2s ease;
    padding: 0;
}

.form-switch span {
    width: 20px;
    height: 20px;
    position: absolute;
    top: 3px;
    left: 3px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
    transition: transform 0.2s ease;
}

.form-switch.is-on {
    background: var(--primary-color);
    box-shadow: 0 6px 14px rgba(67, 97, 238, 0.22);
}

.form-switch.is-on span {
    transform: translateX(20px);
}

.form-switch.is-locked {
    cursor: not-allowed;
    opacity: 0.92;
    box-shadow: inset 0 0 0 1px rgba(67, 97, 238, 0.18);
}

.form-switch.is-locked:disabled {
    pointer-events: none;
}

.form-switch:focus-visible {
    outline: 3px solid rgba(67, 97, 238, 0.16);
    outline-offset: 2px;
}

.form-check-row {
    justify-content: flex-start;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.form-check-row input[type="checkbox"] {
    order: -1;
    flex: 0 0 20px;
    margin-top: 1px;
}

.form-check-row span {
    display: grid;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.form-check-row small {
    max-width: 760px;
}

.support-ticket-summary {
    display: grid;
    gap: 14px;
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid #e7ecfb;
    border-radius: 18px;
    background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.04);
}

.support-ticket-summary-top,
.support-ticket-message-meta,
.support-ticket-reply {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.support-ticket-summary-top {
    justify-content: space-between;
    flex-wrap: wrap;
}

.support-ticket-type-complaint {
    background: #e8f5e9;
    color: #2e7d32;
}

.support-ticket-type-tech {
    background: #eef2ff;
    color: var(--primary-color);
}

.support-ticket-type-idea {
    background: #f3e5f5;
    color: #7b1fa2;
}

.support-ticket-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.support-ticket-user i {
    width: 15px;
    height: 15px;
}

.support-ticket-subject {
    color: var(--text-main);
    font-size: 1.02rem;
    font-weight: 900;
    line-height: 1.25;
}

.support-ticket-desc {
    color: var(--text-main);
    font-size: 0.9rem;
    line-height: 1.55;
}

.support-ticket-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.support-ticket-meta-grid > div {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #eef2ff;
    border-radius: 14px;
    background: #fff;
}

.support-ticket-meta-grid span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 800;
}

.support-ticket-meta-grid strong {
    color: var(--text-main);
    font-size: 0.82rem;
    line-height: 1.25;
}

.support-ticket-section-title {
    margin-bottom: 12px;
    color: var(--text-main);
    font-size: 0.96rem;
    font-weight: 900;
}

.support-ticket-thread {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: #fff;
}

.support-ticket-message {
    display: grid;
    gap: 6px;
    padding: 11px 12px;
    border: 1px solid #eef2ff;
    border-radius: 14px;
    background: #f8faff;
}

.support-ticket-message.is-admin {
    background: #fff;
}

.support-ticket-message-meta {
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 800;
}

.support-ticket-message-meta strong {
    color: var(--text-main);
}

.support-ticket-message.is-admin .support-ticket-message-meta strong {
    color: var(--primary-color);
}

.support-ticket-message-text {
    color: var(--text-main);
    font-size: 0.86rem;
    line-height: 1.45;
}

.support-ticket-reply {
    display: grid;
    gap: 10px;
    width: 100%;
}

.support-ticket-reply input {
    width: 100%;
    min-width: 0;
}

.support-ticket-reply-actions {
    justify-content: flex-end;
}

.user-actions-cell {
    position: relative;
    overflow: visible;
}

.user-actions-trigger {
    width: 34px;
    height: 34px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.user-actions-trigger:hover,
.user-actions-trigger.is-open {
    border-color: rgba(67, 97, 238, 0.18);
    background: #f8faff;
    color: var(--primary-color);
}

.user-actions-trigger i {
    width: 17px;
    height: 17px;
}

.user-actions-menu {
    position: fixed;
    z-index: 100000;
    min-width: 220px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
    display: grid;
    gap: 4px;
    text-align: left;
}

.user-actions-menu button {
    width: 100%;
    min-height: 38px;
    padding: 9px 10px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 9px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    text-align: left;
}

.user-actions-menu button:hover {
    background: #f8faff;
    color: var(--primary-color);
}

.user-actions-menu button.is-danger {
    color: var(--danger);
}

.user-actions-menu button.is-danger:hover {
    background: #ffebee;
    color: var(--danger);
}

.user-actions-menu i {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.modal-footer-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
}

.modal-footer .chat-action-secondary,
.modal-footer .chat-action-primary,
.modal-footer .chat-action-danger {
    min-height: 46px;
    padding: 11px 18px;
    border-radius: 14px;
    font-size: 0.9rem;
}

.modal-save-button {
    min-width: 210px;
    min-height: 46px;
    border-radius: 14px;
}

@media (max-width: 768px) {
    .modal-save-button {
        min-width: 0;
        width: 100%;
    }
}

.delete-user-confirmation,
.logout-confirmation {
    padding: 28px;
}

.logout-confirm-card {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 20px;
    border: 1px solid rgba(244, 67, 54, 0.2);
    border-radius: 20px;
    background: linear-gradient(135deg, #fff7f7 0%, #ffffff 100%);
}

.logout-confirm-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: #ffebee;
    color: var(--danger);
}

.logout-confirm-icon i {
    width: 25px;
    height: 25px;
}

.logout-confirm-copy {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.logout-confirm-title {
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.25;
}

.logout-confirm-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.45;
}

.delete-user-card {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 20px;
    border: 1px solid rgba(244, 67, 54, 0.2);
    border-radius: 20px;
    background: linear-gradient(135deg, #fff7f7 0%, #ffffff 100%);
}

.delete-user-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: #ffebee;
    color: var(--danger);
}

.delete-user-icon i {
    width: 25px;
    height: 25px;
}

.delete-user-copy {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.delete-user-name {
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.25;
}

.delete-user-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.45;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    background: #fcfcfc;
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.feedback-stack {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 1000000;
    display: grid;
    gap: 12px;
    width: min(560px, calc(100vw - 40px));
    pointer-events: none;
}

.feedback-toast {
    position: relative;
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    min-height: 104px;
    padding: 20px 22px;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
    transform: translateY(28px) scale(0.98);
    opacity: 0;
    pointer-events: auto;
    transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.24s ease;
}

.feedback-toast.is-visible {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.feedback-toast.is-hiding {
    transform: translateY(28px) scale(0.98);
    opacity: 0;
}

.feedback-icon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    box-shadow: inset 0 -8px 16px rgba(15, 23, 42, 0.12);
}

.feedback-icon i {
    width: 30px;
    height: 30px;
    stroke-width: 2.6;
}

.feedback-content {
    min-width: 0;
}

.feedback-label {
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.feedback-title {
    color: var(--text-main);
    font-size: 1.02rem;
    font-weight: 900;
    line-height: 1.2;
    text-transform: uppercase;
}

.feedback-message {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.35;
}

.feedback-close {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--text-muted);
    cursor: pointer;
}

.feedback-close:hover {
    background: #e7ecf5;
    color: var(--text-main);
}

.feedback-close i {
    width: 17px;
    height: 17px;
}

.feedback-progress {
    position: absolute;
    left: 22px;
    right: 22px;
    bottom: 0;
    height: 3px;
    border-radius: 999px 999px 0 0;
    transform-origin: left;
    animation: feedback-progress 4.2s linear forwards;
}

.feedback-toast-success .feedback-icon,
.feedback-toast-success .feedback-progress {
    background: var(--success);
}

.feedback-toast-error .feedback-icon,
.feedback-toast-error .feedback-progress {
    background: var(--danger);
}

.feedback-toast-warning .feedback-icon,
.feedback-toast-warning .feedback-progress {
    background: var(--warning);
}

.feedback-toast-info .feedback-icon,
.feedback-toast-info .feedback-progress {
    background: var(--primary-color);
}

.feedback-toast-error {
    border-color: rgba(244, 67, 54, 0.22);
}

.feedback-toast-warning {
    border-color: rgba(255, 152, 0, 0.26);
}

.feedback-toast-info {
    border-color: rgba(67, 97, 238, 0.2);
}

@keyframes feedback-progress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* Log Styles */
.log-container {
    background: #0d1117;
    color: #e6edf3;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    padding: 20px;
    border-radius: 12px;
    font-size: 0.8rem;
    line-height: 1.6;
    margin-top: 15px;
    border: 1px solid #30363d;
}

.log-entry {
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 4px;
}

.log-error {
    color: #ff7b72;
    font-weight: 600;
}

.log-success {
    color: #3fb950;
}

.log-warn {
    color: #d29922;
}

.log-time {
    color: #8b949e;
    margin-right: 12px;
    font-weight: normal;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.mini-stat-card {
    background: #f8faff;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(67, 97, 238, 0.1);
    text-align: center;
}

.user-account-modal {
    display: grid;
    gap: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
}

.user-account-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 22px;
    align-items: start;
    padding: 20px;
    border: 1px solid #e7ecfb;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.04) 0%, #fff 58%);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.user-account-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.user-account-name {
    margin: 0 0 10px;
    font-size: 1.45rem;
    font-weight: 900;
    color: var(--text-main);
    line-height: 1.2;
}

.user-account-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.user-account-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.2;
}

.user-account-badge i {
    width: 14px;
    height: 14px;
}

.user-account-badge--role {
    background: rgba(16, 185, 129, 0.1);
    color: #0f9f74;
}

.user-account-badge--id {
    background: #f1f5f9;
    color: #64748b;
}

.user-account-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.user-account-stat {
    padding: 16px 14px;
    border: 1px solid #e7ecfb;
    border-radius: 16px;
    background: #fff;
    text-align: center;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.03);
}

.user-account-stat-value {
    display: block;
    font-size: 1.28rem;
    font-weight: 900;
    line-height: 1.1;
}

.user-account-stat-label {
    display: block;
    margin-top: 6px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.user-account-panel {
    padding: 18px;
    border: 1px solid #e7ecfb;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.user-account-achievements {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.user-account-achievement {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    border: 1px solid #e7ecfb;
    background: #fff;
    display: grid;
    place-items: center;
    color: var(--primary-color);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: help;
}

.user-account-achievement i {
    width: 22px;
    height: 22px;
}

.user-account-achievement:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.user-account-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.user-activity-log {
    display: grid;
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
    padding: 4px;
}

.user-activity-entry {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid #e7ecfb;
    border-radius: 14px;
    background: #fff;
}

.user-activity-meta {
    font-size: 0.68rem;
    font-weight: 700;
    color: #94a3b8;
}

.user-activity-line {
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-main);
}

.user-activity-tag {
    font-weight: 800;
}

.user-activity-tag--success {
    color: var(--success);
}

.user-activity-tag--info {
    color: var(--primary-color);
}

.user-activity-tag--danger {
    color: var(--danger);
}

@media (max-width: 900px) {
    .user-account-hero,
    .user-account-grid-2 {
        grid-template-columns: 1fr;
    }

    .user-account-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.mini-stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.mini-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
