:root {
    --primary: #4F46E5;
    --accent: #06B6D4;
    --sidebar: #111827;
    --background: #F8FAFC;
    --card: #FFFFFF;
    --border: #E5E7EB;
    --text: #111827;
    --muted: #64748B;
    --success: #16A34A;
    --warning: #F59E0B;
    --danger: #EF4444;
    --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
    --soft-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.kb-category-combobox{position:relative;min-width:210px}.kb-category-menu{position:absolute;right:0;top:calc(100% + 6px);z-index:20;width:260px;padding:8px;background:#fff;border:1px solid #E5E7EB;border-radius:10px;box-shadow:0 12px 28px rgba(0,0,0,.14)}.kb-category-menu input,.kb-category-menu button{width:100%;padding:8px;border:0;background:#fff;text-align:left}.kb-category-menu input{border:1px solid #E5E7EB;border-radius:6px}.kb-category-menu button:hover{background:#F3F4F6}.kb-category-empty{display:block;padding:10px;color:#6B7280}.kb-pagination-footer{display:flex;align-items:center;justify-content:space-between;gap:14px;padding-top:14px;white-space:nowrap}.kb-pagination-controls{display:flex;align-items:center;gap:6px}.kb-page-button{min-width:32px;height:32px;border:1px solid #D1D5DB;border-radius:6px;background:#fff}.kb-page-button.active{background:var(--primary);color:#fff;border-color:var(--primary)}.kb-page-size{display:flex;align-items:center;gap:7px;font-size:13px}.kb-page-size select{width:72px}
@media(max-width:700px){.toolbar-row,.kb-pagination-footer{align-items:stretch;flex-direction:column}.kb-category-combobox{width:100%}.kb-pagination-controls{flex-wrap:wrap}.kb-page-size{justify-content:flex-start}}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    width: 280px;
    height: 100vh;
    flex: 0 0 280px;
    background: var(--sidebar);
    color: #F9FAFB;
    padding: 22px 18px;
    transition: width 0.2s ease, flex-basis 0.2s ease, transform 0.2s ease;
}

.brand {
    padding: 2px 6px 28px;
}

.brand-mark,
.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 21px;
}

.brand-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #FFFFFF;
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.35);
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    object-fit: contain;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 10px;
    color: #CBD5E1;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(79, 70, 229, 0.18);
    color: #FFFFFF;
}

.sidebar-nav i {
    width: 22px;
    color: var(--accent);
    font-size: 18px;
}

.sidebar-card {
    position: absolute;
    right: 18px;
    bottom: 22px;
    left: 18px;
    display: flex;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(229, 231, 235, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-card strong,
.sidebar-card small {
    display: block;
}

.sidebar-card small {
    color: #94A3B8;
}

.status-dot {
    width: 10px;
    height: 10px;
    margin-top: 6px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 5px rgba(6, 182, 212, 0.16);
}

.main {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 82px;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.88);
    backdrop-filter: blur(16px);
}

.header-left,
.header-actions,
.profile-button,
.chat-contact,
.chat-status,
.toolbar-row,
.page-heading-row,
.panel-header,
.form-actions {
    display: flex;
    align-items: center;
}

.header-left,
.header-actions {
    gap: 16px;
}

.header-title-group h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
}

.breadcrumb-label,
.eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.search-box,
.chat-search {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 340px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    color: var(--muted);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.search-box input,
.chat-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
}

.icon-button,
.table-action {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
}

.notification-button {
    position: relative;
}

.notification-button span {
    position: absolute;
    top: 9px;
    right: 10px;
    width: 8px;
    height: 8px;
    border: 2px solid #FFFFFF;
    border-radius: 999px;
    background: var(--danger);
}

.profile-button {
    gap: 10px;
    padding: 6px 8px 6px 6px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card);
}

.profile-meta {
    display: grid;
    line-height: 1.2;
    text-align: left;
}

.profile-meta small {
    color: var(--muted);
}

.avatar {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 50%;
    background: #EEF2FF;
    color: var(--primary);
    font-weight: 800;
}

.avatar-sm {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
}

.avatar.accent {
    background: #ECFEFF;
    color: #0891B2;
}

.avatar.warm {
    background: #FFF7ED;
    color: #EA580C;
}

.avatar.green {
    background: #F0FDF4;
    color: #16A34A;
}

.content {
    flex: 1;
    padding: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 34px 28px;
    color: var(--muted);
    font-size: 13px;
}

.page-grid,
.page-stack {
    display: grid;
    gap: 24px;
}

.dashboard-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
}

.ai-availability-alert {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #fed7aa;
    border-radius: 14px;
    background: #fff7ed;
    color: #9a3412;
}
.ai-availability-alert > span:nth-child(2) { display: grid; gap: 2px; flex: 1; min-width: 0; }
.ai-availability-alert small { color: #7c2d12; }
.ai-availability-alert a { color: #9a3412; font-weight: 800; white-space: nowrap; }
.ai-availability-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: #ffedd5; flex: 0 0 auto; }
.content > .ai-availability-alert { margin-bottom: 16px; }

@media (max-width: 640px) {
    .ai-availability-alert { align-items: flex-start; flex-wrap: wrap; }
    .ai-availability-alert a { margin-left: 48px; }
}

.page-heading {
    max-width: 720px;
}

.page-heading h2 {
    margin: 0 0 8px;
    font-size: 32px;
    font-weight: 800;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
}

.page-heading-row {
    justify-content: space-between;
    gap: 24px;
}

.quick-actions {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 12px;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 800;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-button {
    background: var(--primary);
    color: #FFFFFF;
    box-shadow: 0 14px 30px rgba(79, 70, 229, 0.24);
}

.secondary-button {
    background: var(--card);
    color: var(--text);
    border-color: var(--border);
}

.primary-button:hover,
.secondary-button:hover {
    transform: translateY(-1px);
}

.small {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 10px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    grid-column: 1 / -1;
}

.metric-card,
.panel,
.login-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--card);
    box-shadow: var(--soft-shadow);
}

.metric-card {
    padding: 22px;
}

.metric-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 18px;
    border-radius: 12px;
    font-size: 20px;
}

.metric-icon.indigo {
    background: #EEF2FF;
    color: var(--primary);
}

.metric-icon.cyan {
    background: #ECFEFF;
    color: #0891B2;
}

.metric-icon.green {
    background: #F0FDF4;
    color: var(--success);
}

.metric-icon.amber {
    background: #FFFBEB;
    color: var(--warning);
}

.metric-card p,
.metric-card small {
    margin: 0;
    color: var(--muted);
}

.metric-card strong {
    display: block;
    margin: 6px 0;
    font-size: 30px;
    font-weight: 800;
}

.trend-up {
    color: var(--success) !important;
}

.panel {
    padding: 22px;
}

.panel-header {
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-header h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
}

.pill,
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #EEF2FF;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

.status-badge.active {
    background: #DCFCE7;
    color: #166534;
}

.status-badge.draft {
    background: #FEF3C7;
    color: #92400E;
}

.chart-panel canvas {
    width: 100%;
}

.dashboard-chart-tooltip {
    display: none;
    position: absolute;
    transform: translate(-50%, -100%);
    padding: 6px 8px;
    border-radius: 6px;
    background: #111827;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
}

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

.radio-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 76px;
    padding: 14px;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    cursor: pointer;
}

.radio-card:has(input:checked) {
    border-color: var(--primary);
    background: #EEF2FF;
}

.radio-card input { margin-top: 4px; }
.radio-card span { display: grid; gap: 3px; }
.radio-card small { color: #6B7280; }

.aimnex-toast-container { position: fixed; top: 18px; right: 18px; z-index: 2000; display: grid; gap: 10px; max-width: min(380px, calc(100vw - 36px)); }
.aimnex-toast { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:12px 14px; border-radius:10px; box-shadow:0 10px 24px rgba(0,0,0,.16); color:#fff; font-weight:600; }
.aimnex-toast.success { background:#166534; }.aimnex-toast.error { background:#B91C1C; }
.aimnex-toast button { border:0; background:transparent; color:inherit; font-size:22px; line-height:1; cursor:pointer; }
.aimnex-confirm-backdrop { position:fixed; inset:0; z-index:2001; display:grid; place-items:center; background:rgba(17,24,39,.45); }
.aimnex-confirm { width:min(360px,calc(100vw - 32px)); padding:20px; border-radius:12px; background:#fff; box-shadow:0 18px 45px rgba(0,0,0,.25); }.aimnex-confirm p{margin:0 0 18px}.aimnex-confirm div{display:flex;justify-content:flex-end;gap:10px}.aimnex-confirm button{border:0;border-radius:7px;padding:8px 12px}.aimnex-confirm [data-confirm]{background:#B91C1C;color:#fff}

.donut-wrap,
.legend-list,
.activity-list,
.progress-stack,
.settings-form {
    display: grid;
    gap: 16px;
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.channel-card {
    display: grid;
    gap: 22px;
    min-height: 230px;
}

.channel-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.channel-icon {
    display: inline-grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 14px;
    background: rgba(79, 70, 229, 0.12);
    color: var(--primary);
    font-size: 22px;
}

.channel-card h3 {
    margin: 0 0 8px;
}

.channel-card p,
.form-block small,
.channel-security-note span {
    color: var(--muted);
    line-height: 1.55;
}

.channel-action {
    align-self: end;
    justify-content: center;
}

.channel-card-muted {
    opacity: 0.72;
}

.channel-configuration {
    max-width: 760px;
}

.channel-security-note {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #F8FAFC;
}

.channel-security-note i {
    color: var(--success);
    font-size: 20px;
}

.channel-security-note strong,
.channel-security-note span {
    display: block;
}

@media (max-width: 900px) {
    .channel-grid {
        grid-template-columns: 1fr;
    }
}

.donut-wrap {
    justify-items: center;
}

.legend-list span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-weight: 600;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.ai {
    background: var(--primary);
}

.legend-dot.human {
    background: var(--accent);
}

.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 8px;

    flex: 1;
    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    justify-content: flex-start;
    align-items: stretch;
}

.conversation-item {
    display: flex;
    align-items: center;

    width: 100%;
    min-height: 92px;

    flex-shrink: 0;

    gap: 12px;
    padding: 12px;

    border-radius: 14px;
}

.conversation-item:hover,
.conversation-item.active {
    border-color: #C7D2FE;
    background: #F8FAFF;
}

.conversation-copy {
    display: grid;
    min-width: 0;
    flex: 1;
}

.conversation-copy strong,
.conversation-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-copy small,
.conversation-meta small,
.activity-list small {
    color: var(--muted);
}

.conversation-meta {
    display: grid;
    justify-items: end;
    gap: 5px;
}

.conversation-meta b {
    display: inline-grid;
    min-width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 999px;
    background: var(--accent);
    color: #FFFFFF;
    font-size: 12px;
}

.activity-list div {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 12px;
}

.activity-list i {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 10px;
    background: #F1F5F9;
    color: var(--primary);
}

.auth-body {
    min-height: 100vh;
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(420px, 1fr) minmax(420px, 0.9fr);
}

.auth-visual {
    position: relative;
    display: flex;
    overflow: hidden;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    background: radial-gradient(circle at 20% 20%, rgba(6, 182, 212, 0.24), transparent 28%), linear-gradient(135deg, #111827, #312E81 58%, #0891B2);
    color: #FFFFFF;
}

.auth-copy {
    max-width: 560px;
}

.auth-copy h1 {
    margin: 0 0 18px;
    font-size: 58px;
    font-weight: 800;
    line-height: 1;
}

.auth-copy p {
    margin: 0;
    color: #DDE7F3;
    font-size: 18px;
    line-height: 1.7;
}

.auth-panel {
    display: grid;
    place-items: center;
    padding: 34px;
}

.login-card {
    width: min(100%, 460px);
    padding: 34px;
    animation: rise-in 0.6s ease both;
}

.login-card-header {
    margin-bottom: 26px;
}

.login-card h2 {
    margin: 0 0 8px;
    font-size: 30px;
    font-weight: 800;
}

.login-card p {
    margin: 0;
    color: var(--muted);
}

.form-field,
.form-block {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
    font-weight: 700;
}

.form-field {
    position: relative;
}

.form-field i {
    position: absolute;
    bottom: 14px;
    left: 14px;
    color: var(--muted);
}

.form-field input,
.form-block input,
.form-block textarea,
.form-block select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #FFFFFF;
    outline: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field input {
    height: 50px;
    padding: 0 14px 0 42px;
}

.form-block input,
.form-block textarea,
.form-block select {
    padding: 12px 14px;
}

.form-field input:focus,
.form-block input:focus,
.form-block textarea:focus,
.form-block select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 6px 0 22px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.login-options a {
    color: var(--primary);
}

.check-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.conversation-illustration {
    position: relative;
    min-height: 260px;
}

.illustration-card {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(360px, 80%);
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(18px);
}

.illustration-card p {
    margin: 3px 0 0;
    color: #DDE7F3;
}

.illustration-card-left {
    left: 0;
    top: 22px;
}

.illustration-card-right {
    right: 0;
    top: 118px;
}

.illustration-orbit {
    position: absolute;
    bottom: 0;
    left: 50%;
    display: flex;
    gap: 14px;
    transform: translateX(-50%);
}

.illustration-orbit i {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.14);
    font-size: 22px;
}

.chat-shell {
    display: grid;
    flex: 1;
    min-height: 0;
    overflow: hidden;

    grid-template-columns:
        minmax(340px,380px)
        minmax(0,1fr);

    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.chat-list-pane {
    display: flex;
    flex-direction: column;

    gap: 16px;

    overflow: hidden;
}

.chat-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-list-header h2,
.chat-topbar h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
}

.chat-search {
    min-width: 0;
}

.chat-filter-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.filter-chip {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #FFFFFF;
    color: var(--muted);
    font-weight: 800;
}

.filter-chip.active {
    border-color: #C7D2FE;
    background: #EEF2FF;
    color: var(--primary);
}

.chat-window{
    display:flex;
    flex-direction:column;
    min-width:0;
    min-height:0;
    overflow:hidden;
    background:#F1F5F9;
}

.chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    background: #FFFFFF;
}

.chat-contact {
    gap: 12px;
}

.chat-contact p {
    margin: 4px 0 0;
    color: var(--muted);
}

.chat-status {
    gap: 12px;
}

.mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border-radius: 999px;
    font-weight: 800;
}

.mode-pill.ai {
    background: #EEF2FF;
    color: var(--primary);
}

.messages-pane{
    flex:1;
    min-height:0;
    overflow-y:auto;
    overflow-x:hidden;
    padding:26px;
}

.message-row {
    display: flex;
    margin-bottom: 12px;
}

.message-row.outgoing {
    justify-content: flex-end;
}

.message-bubble {
    max-width: min(560px, 78%);
    padding: 12px 14px 8px;
    border-radius: 16px 16px 16px 4px;
    background: #FFFFFF;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.message-row.outgoing .message-bubble {
    border-radius: 16px 16px 4px 16px;
    background: #DCFCE7;
}

.message-row.outgoing.ai .message-bubble {
    background: #EEF2FF;
}

.message-bubble p {
    margin: 0 0 5px;
}

.message-bubble small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    text-align: right;
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 9px 12px;
    border-radius: 999px;
    background: #FFFFFF;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: typing 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

.composer{
    flex-shrink:0;
    display:flex;
    align-items:center;
    gap:10px;
    padding:16px;
    border-top:1px solid var(--border);
    background:#fff;
}

.composer input {
    height: 48px;
    min-width: 0;
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 18px;
    outline: 0;
}

.send-button {
    display: inline-grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--primary);
    color: #FFFFFF;
}

.toolbar-row {
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.table-search {
    min-width: min(100%, 420px);
}

.compact-select {
    width: auto;
    min-width: 180px;
    border-radius: 12px;
    border-color: var(--border);
}

.app-table {
    margin: 0;
}

.app-table th {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.app-table td,
.app-table th {
    padding: 16px;
    border-color: var(--border);
}

.table-action {
    margin-left: 6px;
}

.table-action.danger {
    color: var(--danger);
}

.narrow-page {
    max-width: 920px;
}

.settings-form {
    align-content: start;
}

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

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

.provider-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--muted);
    font-weight: 800;
}

.provider-option.active {
    border-color: #C7D2FE;
    background: #EEF2FF;
    color: var(--primary);
}

.form-actions {
    justify-content: flex-end;
    gap: 12px;
}

.progress-stack > div {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px;
    color: var(--muted);
    font-weight: 700;
}

.progress-line {
    grid-column: 1 / -1;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #F1F5F9;
}

.progress-line i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.ai-width {
    width: 72%;
}

.human-width {
    width: 28%;
}

.resolve-width {
    width: 64%;
}

.sidebar-collapsed .sidebar {
    width: 92px;
    flex-basis: 92px;
}

.sidebar-collapsed .brand-name,
.sidebar-collapsed .sidebar-nav span,
.sidebar-collapsed .sidebar-card {
    display: none;
}

.sidebar-collapsed .sidebar-nav a {
    justify-content: center;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    40% {
        transform: translateY(-3px);
        opacity: 1;
    }
}

@media (max-width: 1180px) {
    .metric-grid,
    .provider-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 920px) {
    .wrapper {
        display: block;
    }

    .sidebar {
        position: fixed;
        z-index: 50;
        transform: translateX(-100%);
    }

    .sidebar-collapsed .sidebar {
        transform: translateX(0);
        width: 280px;
        flex-basis: 280px;
    }

    .sidebar-collapsed .brand-name,
    .sidebar-collapsed .sidebar-nav span,
    .sidebar-collapsed .sidebar-card {
        display: block;
    }

    .sidebar-collapsed .sidebar-nav a {
        justify-content: flex-start;
    }

    .app-header,
    .content {
        padding-right: 20px;
        padding-left: 20px;
    }

    .header-actions {
        flex: 1;
        justify-content: flex-end;
    }

    .search-box {
        display: none;
    }

    .auth-shell,
    .chat-shell,
    .settings-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 46vh;
        padding: 30px;
    }

    .auth-copy h1 {
        font-size: 42px;
    }

    .chat-shell {
        height: auto;
        min-height: 0;
    }

    .chat-list-pane {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
}

/* Subscription and AI Credit visibility */
.subscription-page{width:100%;max-width:1280px;margin:0 auto}.subscription-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:24px}.subscription-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}.subscription-summary-card{display:grid;gap:7px;min-width:0;padding:21px;border:1px solid var(--border);border-radius:17px;background:#fff;box-shadow:0 8px 26px rgba(15,23,42,.05)}.subscription-summary-card>span,.subscription-summary-card small{color:var(--muted);font-size:12px}.subscription-summary-card>span{font-weight:700}.subscription-summary-card>strong{color:var(--text);font-size:24px;line-height:1.2}.subscription-summary-card.credit-balance{border-color:#c7d2fe;background:linear-gradient(145deg,#fff,#f3f5ff)}.subscription-summary-card.credit-balance>strong{color:var(--primary);font-size:34px}.subscription-summary-card.low{border-color:#fbbf24;background:#fffbeb}.subscription-summary-card.exhausted{border-color:#fca5a5;background:#fef2f2}.subscription-summary-card.exhausted>strong,.subscription-summary-card.exhausted small{color:#b91c1c}.subscription-badge{display:inline-flex;padding:5px 10px;border-radius:999px;background:#e2e8f0;color:#475569;font-size:12px;font-weight:800;text-transform:capitalize}.subscription-badge.active,.subscription-badge.approved{background:#dcfce7;color:#166534}.subscription-badge.pending{background:#dbeafe;color:#1d4ed8}.subscription-badge.expired,.subscription-badge.cancelled,.subscription-badge.rejected,.subscription-badge.inactive{background:#fee2e2;color:#991b1b}.subscription-detail-grid{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(280px,.7fr);gap:20px}.subscription-card-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:20px}.subscription-card-heading h3{margin:0 0 3px}.subscription-card-heading p{margin:0;color:var(--muted)}.subscription-card-heading>strong{color:var(--primary)}.credit-progress{height:12px;overflow:hidden;border-radius:999px;background:#e9edf5}.credit-progress i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--primary),#22b8a7);transition:width .4s ease}.credit-usage-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:20px}.credit-usage-stats div{padding:13px;border-radius:12px;background:#f7f8fc}.credit-usage-stats span,.credit-usage-stats strong{display:block}.credit-usage-stats span{color:var(--muted);font-size:11px}.credit-usage-stats strong{margin-top:4px;font-size:18px}.usage-explanation{margin:18px 0 0;color:var(--muted);font-size:12px}.credit-help-card{display:flex!important;align-items:flex-start;flex-direction:column}.credit-help-icon{display:grid;width:46px;height:46px;place-items:center;border-radius:13px;background:#eef2ff;color:var(--primary);font-size:20px}.credit-help-card h3{margin:14px 0 5px}.credit-help-card p{color:var(--muted)}.credit-help-card>strong{margin-bottom:20px;font-size:12px}.credit-help-card .secondary-button{margin-top:auto}.subscription-table-wrap{width:100%;overflow-x:auto;border:1px solid var(--border);border-radius:13px}.subscription-table{width:100%;min-width:720px;border-collapse:collapse}.subscription-table th,.subscription-table td{padding:13px 15px;border-bottom:1px solid var(--border);text-align:left}.subscription-table th{background:#f8fafc;color:var(--muted);font-size:11px;text-transform:uppercase}.subscription-table tr:last-child td{border-bottom:0}.activity-type{font-weight:700}.credit-change.positive{color:#16803d}.credit-change.negative{color:#b42332}.subscription-empty{padding:30px!important;color:var(--muted);text-align:center!important}.credit-request-history{display:grid}.credit-request-history>div{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:12px 0;border-top:1px solid var(--border)}.credit-request-history>div:first-child{border-top:0}.credit-request-history strong,.credit-request-history small{display:block}.credit-request-history small{color:var(--muted)}.credit-request-modal[hidden]{display:none!important}.credit-request-modal{position:fixed;z-index:110;inset:0;display:grid;place-items:center;padding:18px;opacity:0;transition:opacity .18s}.credit-request-modal.open{opacity:1}.credit-request-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.58);backdrop-filter:blur(3px)}.credit-request-modal>section{position:relative;width:min(100%,500px);padding:28px;border-radius:20px;background:#fff;box-shadow:0 30px 90px rgba(15,23,42,.3)}.credit-request-modal h3{margin:3px 0 5px;font-size:25px}.credit-request-modal section>p{color:var(--muted)}.credit-request-modal form,.credit-request-modal label{display:grid;gap:8px}.credit-request-modal form{gap:17px;margin-top:22px}.credit-request-modal label{color:#334155;font-size:13px;font-weight:700}.credit-request-modal label small{color:var(--muted);font-weight:500}.credit-request-modal input,.credit-request-modal textarea{width:100%;padding:11px 12px;border:1px solid #cbd5e1;border-radius:10px;outline:0}.credit-request-modal input:focus,.credit-request-modal textarea:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(79,70,229,.12)}.modal-close{position:absolute;top:18px;right:18px;display:grid;width:34px;height:34px;place-items:center;border:0;border-radius:9px;background:#f1f5f9;font-size:21px;cursor:pointer}.dashboard-credit-card{grid-column:1/-1;display:grid;grid-template-columns:minmax(240px,.8fr) minmax(400px,1.5fr) auto;align-items:center;gap:24px;padding:24px;border:1px solid #c7d2fe;border-radius:18px;background:linear-gradient(120deg,#fff,#f3f5ff);box-shadow:0 9px 30px rgba(79,70,229,.08)}.dashboard-credit-card h3{margin:2px 0}.dashboard-credit-card>div>strong{display:block;color:var(--primary);font-size:38px}.dashboard-credit-card small{color:var(--muted)}.dashboard-credit-card dl{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:0}.dashboard-credit-card dl div{padding:12px;border-radius:11px;background:rgba(255,255,255,.72)}.dashboard-credit-card dt{color:var(--muted);font-size:11px}.dashboard-credit-card dd{margin:3px 0 0;font-weight:800;text-transform:capitalize}.dashboard-credit-card.low{border-color:#fbbf24;background:#fffbeb}.dashboard-credit-card.exhausted{border-color:#fca5a5;background:#fef2f2}.dashboard-credit-card.exhausted>div>strong{color:#b91c1c}
@media(max-width:1100px){.subscription-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.credit-usage-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.dashboard-credit-card{grid-template-columns:1fr}.dashboard-credit-card dl{grid-template-columns:repeat(3,1fr)}}@media(max-width:760px){.subscription-heading{align-items:flex-start;flex-direction:column}.subscription-detail-grid{grid-template-columns:1fr}.dashboard-credit-card dl{grid-template-columns:1fr}}@media(max-width:520px){.subscription-summary-grid,.credit-usage-stats{grid-template-columns:1fr}.credit-request-modal>section{padding:22px}.subscription-heading .primary-button{width:100%}}

.credit-usage-panel{padding:30px!important}.credit-usage-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;margin-bottom:26px}.credit-usage-heading h3{margin:1px 0 5px;font-size:23px}.credit-usage-heading p{margin:0;color:var(--muted)}.usage-percent{display:grid;flex:0 0 auto;min-width:130px;text-align:right}.usage-percent strong{color:var(--primary);font-size:27px}.usage-percent small{color:var(--muted)}.credit-usage-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:15px}.usage-summary-item{position:relative;display:grid;gap:7px;min-height:138px;padding:20px;border:1px solid var(--border);border-radius:15px;background:#fafbfe}.usage-summary-item:before{content:'';position:absolute;top:0;right:18px;left:18px;height:3px;border-radius:0 0 4px 4px;background:#94a3b8}.usage-summary-item.available:before{background:var(--primary)}.usage-summary-item.used:before{background:#ef8354}.usage-summary-item.plan:before{background:#22a699}.usage-summary-item.topup:before{background:#3b82f6}.usage-summary-item span{color:#475569;font-size:12px;font-weight:750}.usage-summary-item strong{font-size:28px;line-height:1.15}.usage-summary-item small{margin-top:auto;color:var(--muted);font-size:11px}.usage-visual{margin-top:26px;padding:20px;border-radius:15px;background:#f6f7fb}.usage-visual-label{display:flex;justify-content:space-between;gap:18px;margin-bottom:11px;color:var(--muted);font-size:12px}.usage-visual-label strong{color:#334155}.credit-usage-footer{display:flex;align-items:center;justify-content:space-between;gap:24px;margin-top:22px}.credit-usage-footer p{max-width:760px;margin:0;color:var(--muted);font-size:12px}.credit-usage-footer .secondary-button{flex:0 0 auto}.subscription-data-card{scroll-margin-top:20px}.subscription-data-card .subscription-card-heading>span{padding:5px 9px;border-radius:999px;background:#eef2ff;color:var(--primary);font-size:11px;font-weight:800}.subscription-table th,.subscription-table td{vertical-align:middle}.subscription-table .date-cell{min-width:185px;white-space:nowrap}.subscription-table .description-cell{min-width:220px;max-width:420px;overflow-wrap:anywhere}.request-table{min-width:1050px}.subscription-pagination{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:17px;color:var(--muted);font-size:12px}.subscription-pagination>div{display:flex;gap:8px}.subscription-pagination .secondary-button{min-height:36px;padding:8px 13px;font-size:12px}
@media(max-width:1050px){.credit-usage-summary{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:680px){.credit-usage-panel{padding:21px!important}.credit-usage-heading,.credit-usage-footer{align-items:flex-start;flex-direction:column}.usage-percent{text-align:left}.credit-usage-footer .secondary-button{width:100%}.usage-visual-label{flex-direction:column;gap:3px}.subscription-pagination{align-items:flex-start;flex-direction:column}}@media(max-width:480px){.credit-usage-summary{grid-template-columns:1fr}.usage-summary-item{min-height:120px}.subscription-pagination>div,.subscription-pagination a{width:100%}.subscription-pagination>div{display:grid;grid-template-columns:repeat(2,1fr)}}

@media (max-width: 640px) {
    .content {
        padding: 20px 14px;
    }

    .app-header {
        gap: 12px;
        min-height: 72px;
        padding: 12px 14px;
    }

    .profile-meta,
    .notification-button,
    .app-footer {
        display: none;
    }

    .page-heading h2 {
        font-size: 26px;
    }

    .metric-grid,
    .provider-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions,
    .page-heading-row,
    .toolbar-row {
        align-items: stretch;
        flex-direction: column;
    }

    .primary-button,
    .secondary-button {
        width: 100%;
    }

    .login-card {
        padding: 24px;
    }

    .auth-panel {
        padding: 22px;
    }

    .chat-topbar,
    .chat-status {
        align-items: flex-start;
        flex-direction: column;
    }

    .message-bubble {
        max-width: 92%;
    }
}

.chat-list-pane,
.chat-window{
    min-height:0;
}

.chat-shell *{
    min-width:0;
}

.typing-bubble{

    display:flex;
    gap:6px;
    align-items:center;

}

.typing-bubble span{

    width:8px;
    height:8px;

    border-radius:50%;

    background:#8c8c8c;

    animation:typing 1.3s infinite;

}

.typing-bubble span:nth-child(2){

    animation-delay:.2s;

}

.typing-bubble span:nth-child(3){

    animation-delay:.4s;

}

@keyframes typing{

    0%,80%,100%{

        transform:scale(.7);
        opacity:.3;

    }

    40%{

        transform:scale(1);
        opacity:1;

    }

}



/* =========================================================
   CONVERSATIONS PAGE - LAYOUT FIX
========================================================= */

/*
|--------------------------------------------------------------------------
| Prevent page-level scrolling on conversation screen
|--------------------------------------------------------------------------
*/

.content:has(.chat-shell) {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}


/*
|--------------------------------------------------------------------------
| Main Conversation Container
|--------------------------------------------------------------------------
*/

.chat-shell {
    display: grid;

    grid-template-columns:
        minmax(320px, 380px)
        minmax(0, 1fr);

    width: 100%;

    flex: 1;
    min-height: 0;

    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: 20px;

    background: var(--card);

    box-shadow: var(--shadow);
}


/* =========================================================
   LEFT CONVERSATION SIDEBAR
========================================================= */

.chat-list-pane {
    display: flex;
    flex-direction: column;

    min-width: 0;
    min-height: 0;

    padding: 22px 18px 0;

    border-right: 1px solid var(--border);

    background: #FFFFFF;

    overflow: hidden;
}


/*
|--------------------------------------------------------------------------
| Inbox + Conversations Header
|--------------------------------------------------------------------------
*/

.chat-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    flex-shrink: 0;

    gap: 16px;

    margin-bottom: 18px;
}


.chat-list-title {
    min-width: 0;
}


.chat-list-header .eyebrow {
    display: block;

    margin: 0 0 6px;

    line-height: 1.2;

    color: var(--primary);

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 0.08em;

    text-transform: uppercase;
}


.chat-list-header h2 {
    margin: 0;

    line-height: 1.2;

    font-size: 25px;
    font-weight: 800;
}


/* =========================================================
   SEARCH
========================================================= */

.chat-search {
    display: flex;
    align-items: center;

    width: 100%;
    min-width: 0;

    flex-shrink: 0;

    margin-bottom: 16px;
}


.chat-search input {
    min-width: 0;
}


/* =========================================================
   FILTER BUTTONS
========================================================= */

.chat-filter-row {
    display: flex;

    flex-shrink: 0;

    gap: 8px;

    margin-bottom: 16px;

    overflow-x: auto;

    scrollbar-width: none;
}


.chat-filter-row::-webkit-scrollbar {
    display: none;
}


.filter-chip {
    flex-shrink: 0;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}


.filter-chip:hover {
    border-color: #C7D2FE;

    color: var(--primary);
}


.filter-chip.active {
    border-color: #C7D2FE;

    background: #EEF2FF;

    color: var(--primary);
}


/* =========================================================
   CONVERSATION LIST
========================================================= */

.conversation-list {
    display: flex;
    flex-direction: column;

    flex: 1;

    min-height: 0;

    gap: 8px;

    padding-bottom: 18px;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior: contain;
}


/*
|--------------------------------------------------------------------------
| Conversation Scrollbar
|--------------------------------------------------------------------------
*/

.conversation-list::-webkit-scrollbar {
    width: 6px;
}


.conversation-list::-webkit-scrollbar-track {
    background: transparent;
}


.conversation-list::-webkit-scrollbar-thumb {
    border-radius: 999px;

    background: #CBD5E1;
}


.conversation-list::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}


/* =========================================================
   CONVERSATION CARD
========================================================= */

.conversation-item {
    display: flex;
    align-items: center;

    width: 100%;

    min-height: 92px;

    flex-shrink: 0;

    gap: 12px;

    padding: 12px;

    border: 1px solid transparent;

    border-radius: 14px;

    background: transparent;

    text-align: left;

    cursor: pointer;
}


.conversation-item:hover {
    border-color: #E0E7FF;

    background: #F8FAFF;
}


.conversation-item.active {
    border-color: #A5B4FC;

    background: #EEF2FF;
}


/* =========================================================
   CHAT WINDOW
========================================================= */

.chat-window {
    display: flex;
    flex-direction: column;

    min-width: 0;
    min-height: 0;

    overflow: hidden;

    background: #F1F5F9;
}


/* =========================================================
   CHAT HEADER
========================================================= */

.chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    flex-shrink: 0;

    min-height: 82px;

    gap: 16px;

    padding: 16px 22px;

    border-bottom: 1px solid var(--border);

    background: #FFFFFF;
}


/* =========================================================
   MESSAGES AREA
========================================================= */

.messages-pane {
    flex: 1;

    min-width: 0;
    min-height: 0;

    padding: 26px;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior: contain;

    scroll-behavior: smooth;
}


/*
|--------------------------------------------------------------------------
| Message Scrollbar
|--------------------------------------------------------------------------
*/

.messages-pane::-webkit-scrollbar {
    width: 7px;
}


.messages-pane::-webkit-scrollbar-track {
    background: transparent;
}


.messages-pane::-webkit-scrollbar-thumb {
    border-radius: 999px;

    background: #CBD5E1;
}


.messages-pane::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}


/* =========================================================
   MESSAGE COMPOSER
========================================================= */

.composer {
    display: flex;
    align-items: center;

    flex-shrink: 0;

    width: 100%;

    gap: 10px;

    padding: 14px 18px;

    border-top: 1px solid var(--border);

    background: #FFFFFF;
}


.composer input {
    flex: 1;

    min-width: 0;

    height: 48px;
}


/* =========================================================
   EMPTY STATE
========================================================= */

.empty-state-message {
    margin: 40px auto;

    color: var(--muted);

    text-align: center;
}

.kb-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.kb-heading-actions a {
    text-decoration: none;
}

.kb-import-progress {
    margin-top: 18px;
}

.kb-import-progress-track {
    height: 8px;
    overflow: hidden;
    margin-bottom: 7px;
    border-radius: 999px;
    background: #E5E7EB;
}

.kb-import-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width .2s ease;
}

.kb-import-summary {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #F8FAFC;
}

.kb-import-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.kb-import-summary-grid div {
    padding: 12px;
    border-radius: 9px;
    background: #FFFFFF;
}

.kb-import-summary-grid span,
.kb-import-summary-grid strong {
    display: block;
}

.kb-import-summary-grid span {
    color: var(--muted);
    font-size: 12px;
}

.kb-import-summary-grid strong {
    margin-top: 4px;
    font-size: 22px;
}

#knowledgeImportIssues {
    max-height: 220px;
    overflow: auto;
    margin-bottom: 12px;
}

#knowledgeImportIssues ul {
    margin: 8px 0;
    padding-left: 20px;
}

#knowledgeImportIssues li {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 760px) {
    .kb-heading-actions {
        width: 100%;
        justify-content: stretch;
    }

    .kb-heading-actions > * {
        flex: 1 1 160px;
        justify-content: center;
    }

    .kb-import-summary-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   HIDDEN CONVERSATIONS - FILTERING
========================================================= */

.conversation-item.chat-hidden {
    display: none;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 920px) {

    .content:has(.chat-shell) {
        overflow: auto;
    }


    .chat-shell {
        grid-template-columns: 1fr;

        overflow: visible;
    }


    .chat-list-pane {
        min-height: 350px;

        border-right: 0;

        border-bottom: 1px solid var(--border);
    }


    .conversation-list {
        max-height: 400px;
    }


    .chat-window {
        min-height: 650px;
    }

}


/* =========================================================
   CONVERSATIONS PAGE - LAYOUT FIX
========================================================= */

/*
|--------------------------------------------------------------------------
| Prevent page-level scrolling on conversation screen
|--------------------------------------------------------------------------
*/

.content:has(.chat-shell) {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}


/*
|--------------------------------------------------------------------------
| Main Conversation Container
|--------------------------------------------------------------------------
*/

.chat-shell {
    display: grid;

    grid-template-columns:
        minmax(320px, 380px)
        minmax(0, 1fr);

    width: 100%;

    flex: 1;
    min-height: 0;

    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: 20px;

    background: var(--card);

    box-shadow: var(--shadow);
}


/* =========================================================
   LEFT CONVERSATION SIDEBAR
========================================================= */

.chat-list-pane {
    display: flex;
    flex-direction: column;

    min-width: 0;
    min-height: 0;

    padding: 22px 18px 0;

    border-right: 1px solid var(--border);

    background: #FFFFFF;

    overflow: hidden;
}


/*
|--------------------------------------------------------------------------
| Inbox + Conversations Header
|--------------------------------------------------------------------------
*/

.chat-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    flex-shrink: 0;

    gap: 16px;

    margin-bottom: 18px;
}


.chat-list-title {
    min-width: 0;
}


.chat-list-header .eyebrow {
    display: block;

    margin: 0 0 6px;

    line-height: 1.2;

    color: var(--primary);

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 0.08em;

    text-transform: uppercase;
}


.chat-list-header h2 {
    margin: 0;

    line-height: 1.2;

    font-size: 25px;
    font-weight: 800;
}


/* =========================================================
   SEARCH
========================================================= */

.chat-search {
    display: flex;
    align-items: center;

    width: 100%;
    min-width: 0;

    flex-shrink: 0;

    margin-bottom: 16px;
}


.chat-search input {
    min-width: 0;
}


/* =========================================================
   FILTER BUTTONS
========================================================= */

.chat-filter-row {
    display: flex;

    flex-shrink: 0;

    gap: 8px;

    margin-bottom: 16px;

    overflow-x: auto;

    scrollbar-width: none;
}


.chat-filter-row::-webkit-scrollbar {
    display: none;
}


.filter-chip {
    flex-shrink: 0;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}


.filter-chip:hover {
    border-color: #C7D2FE;

    color: var(--primary);
}


.filter-chip.active {
    border-color: #C7D2FE;

    background: #EEF2FF;

    color: var(--primary);
}


/* =========================================================
   CONVERSATION LIST
========================================================= */

.conversation-list {
    display: flex;
    flex-direction: column;

    flex: 1;

    min-height: 0;

    gap: 8px;

    padding-bottom: 18px;

    overflow-y: auto;

    overscroll-behavior: contain;

    overflow-x: scroll;
    max-height: 355px;
}


/*
|--------------------------------------------------------------------------
| Conversation Scrollbar
|--------------------------------------------------------------------------
*/

.conversation-list::-webkit-scrollbar {
    width: 6px;
}


.conversation-list::-webkit-scrollbar-track {
    background: transparent;
}


.conversation-list::-webkit-scrollbar-thumb {
    border-radius: 999px;

    background: #CBD5E1;
}


.conversation-list::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}


/* =========================================================
   CONVERSATION CARD
========================================================= */

.conversation-item {
    display: flex;
    align-items: center;

    width: 100%;

    min-height: 92px;

    flex-shrink: 0;

    gap: 12px;

    padding: 12px;

    border: 1px solid transparent;

    border-radius: 14px;

    background: transparent;

    text-align: left;

    cursor: pointer;
}


.conversation-item:hover {
    border-color: #E0E7FF;

    background: #F8FAFF;
}


.conversation-item.active {
    border-color: #A5B4FC;

    background: #EEF2FF;
}


/* =========================================================
   CHAT WINDOW
========================================================= */

.chat-window {
    display: flex;
    flex-direction: column;

    min-width: 0;
    min-height: 0;

    overflow: hidden;

    background: #F1F5F9;
}


/* =========================================================
   CHAT HEADER
========================================================= */

.chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    flex-shrink: 0;

    min-height: 82px;

    gap: 16px;

    padding: 16px 22px;

    border-bottom: 1px solid var(--border);

    background: #FFFFFF;
}


/* =========================================================
   MESSAGES AREA
========================================================= */

.messages-pane {
    flex: 1;

    min-width: 0;
    min-height: 0;

    padding: 26px;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior: contain;

    scroll-behavior: smooth;
    max-height: 450px;
}


/*
|--------------------------------------------------------------------------
| Message Scrollbar
|--------------------------------------------------------------------------
*/

.messages-pane::-webkit-scrollbar {
    width: 7px;
}


.messages-pane::-webkit-scrollbar-track {
    background: transparent;
}


.messages-pane::-webkit-scrollbar-thumb {
    border-radius: 999px;

    background: #CBD5E1;
}


.messages-pane::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}


/* =========================================================
   MESSAGE COMPOSER
========================================================= */

.composer {
    display: flex;
    align-items: center;

    flex-shrink: 0;

    width: 100%;

    gap: 10px;

    padding: 14px 18px;

    border-top: 1px solid var(--border);

    background: #FFFFFF;
}


.composer input {
    flex: 1;

    min-width: 0;

    height: 48px;
}


/* =========================================================
   EMPTY STATE
========================================================= */

.empty-state-message {
    margin: 40px auto;

    color: var(--muted);

    text-align: center;
}


/* =========================================================
   HIDDEN CONVERSATIONS - FILTERING
========================================================= */

.conversation-item.chat-hidden {
    display: none;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 920px) {

    .content:has(.chat-shell) {
        overflow: auto;
    }


    .chat-shell {
        grid-template-columns: 1fr;

        overflow: visible;
    }


    .chat-list-pane {
        min-height: 350px;

        border-right: 0;

        border-bottom: 1px solid var(--border);
    }


    .conversation-list {
        max-height: 400px;
    }


    .chat-window {
        min-height: 650px;
    }

}
