@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    /* Typography */
    --font-body: 'Inter', 'Helvetica Neue', system-ui, -apple-system, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', 'Helvetica Neue', system-ui, -apple-system, sans-serif;

    /* Core palette */
    --color-base-950: #020617;
    --color-base-900: #0f172a;

    --color-base-800: #101828;
    --color-base-700: #1d2939;
    --color-base-600: #344054;

    --color-base-500: #475467;
    --color-base-300: #98a2b3;
    --color-base-200: #cbd5f5;
    --color-base-100: #f8fafc;

    /* Backgrounds */
    --bg-main: #0f172a;
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1d2939;

    /* Glassmorphism */
    --glass-bg: rgba(16, 24, 40, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 18px;
    --glass-shadow: 0 30px 60px -20px rgba(2, 6, 23, 0.55);

    /* Sidebar */
    --bg-sidebar: #101828;
    --sidebar-text: #cbd5f5;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: rgba(37, 99, 235, 0.18);
    --sidebar-active-text: #f8fafc;
    --sidebar-border-right: rgba(255, 255, 255, 0.05);

    /* Typography colors */
    --text-main: #f8fafc;
    --text-muted: rgba(248, 250, 252, 0.7);
    --text-highlight: #8fd3ff;

    /* Accent & semantic */
    --primary: #5b7cfa;
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #f43f5e 100%);
    --primary-hover: #4156c5;
    --primary-glow: 0 20px 40px rgba(91, 124, 250, 0.35);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Surfaces */
    --card-bg: #101828;
    --surface-raised: #1d2939;
    --surface-hover: rgba(255, 255, 255, 0.04);
    --border-color: rgba(255, 255, 255, 0.08);
    --card-radius: 16px;
    --shadow-sm: 0 2px 12px rgba(2, 6, 23, 0.35);
    --shadow: 0 35px 65px -25px rgba(2, 6, 23, 0.75);

    /* Brand & CTA */
    --brand-primary: #5b7cfa;
    --brand-secondary: #7c3aed;
    --cta-primary: #f97066;
    --cta-hover: #f04438;
    --focus-ring: rgba(91, 124, 250, 0.35);
    --focus-border: #5b7cfa;

    /* Spacing scale */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 2.5rem;
    --spacing-3xl: 3rem;

    /* Type scale */
    --text-xs: 0.75rem;
    --text-sm: 0.85rem;
    --text-base: 0.95rem;
    --text-lg: 1.1rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;

    /* Radius tokens */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --radius-pill: 999px;

    /* Transition tokens */
    --transition-fast: 0.15s ease-in-out;
    --transition-base: 0.2s ease-in-out;
    --transition-slow: 0.3s ease-in-out;
}

html,
body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    background-image: radial-gradient(circle at top, rgba(91, 124, 250, 0.25), transparent 45%), radial-gradient(circle at 20% 20%, rgba(244, 63, 94, 0.18), transparent 35%);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    color: var(--text-main);
    letter-spacing: -0.01em;
}

/* =========================================
   Bootstrap Global Overrides
   ========================================= */

/* Typography Enforcement */
body,
button,
input,
select,
textarea,
.btn,
.nav-link,
.form-control,
table {
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
}

.modern-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 30px 45px -15px rgba(15, 23, 42, 0.75);
}

.modern-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modern-card-title {
    margin-bottom: 0;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
}

.modern-card-body {
    padding: 1.5rem;
}

.modern-card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Modern Buttons */
.btn-premium {
    background-image: var(--primary-gradient);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-premium:hover {
    background-color: var(--primary-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-premium-outline {
    background-color: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
}

.btn-premium-outline:hover {
    background-color: var(--primary);
    color: white;
}

.btn-premium-sm {
    padding: 0.35rem 0.75rem;
    font-size: var(--text-sm);
    border-radius: var(--radius-sm);
}

.btn-premium-lg {
    padding: 0.85rem 1.75rem;
    font-size: var(--text-lg);
    border-radius: var(--radius-md);
}

/* Tables Modern */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.modern-table th {
    background-color: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    font-weight: 600;
    text-align: left;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.modern-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.modern-table tr:last-child td {
    border-bottom: none;
}

/* =========================================
/* =========================================
   Admin Surface — removed (migrated to modern-card)
   ========================================= */

.page-breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.page-breadcrumb .breadcrumb {
    margin-bottom: 0;
    background: transparent;
    padding: 0;
}

.page-header .page-title {
    margin: 0 0 0.35rem;
    font-size: 2rem;
}

.page-subtitle {
    margin: 0;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* surface-card — removed (migrated to modern-card) */

.meta-chip {
    border-radius: 999px;
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.85rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.theme-card {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.theme-card--default {
    border-color: rgba(91, 124, 250, 0.6);
    box-shadow: 0 20px 40px rgba(91, 124, 250, 0.25);
}

.theme-card__header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-avatar {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.theme-card__titles h3 {
    margin: 0;
    font-size: 1.2rem;
}

.theme-card__titles p {
    margin: 0;
    color: var(--text-muted);
}

.theme-chip {
    margin-left: auto;
    background: rgba(91, 124, 250, 0.2);
    color: #8fd3ff;
    padding: 0.2rem 0.8rem;
    border-radius: 999px;
    font-size: 0.75rem;
}

.theme-card__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.theme-meta-item span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.theme-meta-item strong {
    font-size: 1rem;
}

.theme-card__actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.loading-state,
.empty-state {
    padding: 2rem;
    text-align: center;
    border: 1px dashed var(--border-color);
    border-radius: 18px;
    color: var(--text-muted);
}

.loading-state .spinner-border {
    width: 2rem;
    height: 2rem;
    margin-bottom: 1rem;
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
}

/* Theme Editor */
.theme-editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 1.5rem;
}

.editor-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.panel-card {
    background: var(--surface-raised);
    border-radius: 22px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.segmented-control {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.segmented-control button {
    background: transparent;
    border: none;
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    font-weight: 600;
}

.segmented-control button.active {
    background: rgba(91, 124, 250, 0.15);
    color: var(--text-main);
}

.panel-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.preview-pane .preview-card {
    position: sticky;
    top: 1rem;
    background: var(--surface-raised);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.preview-frame {
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 22px;
    padding: 1.5rem;
    border: 1px dashed var(--border-color);
}

.preview-container-wrapper {
    min-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-label {
    color: var(--text-muted);
}

.form-control-modern,
.form-select.form-control-modern {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 12px;
    padding: 0.65rem 0.85rem;
}

.form-control-modern:focus {
    border-color: var(--focus-border);
    box-shadow: 0 0 0 2px var(--focus-ring);
}

.input-group .form-control-color {
    width: 52px;
    padding: 0;
}

.action-switch .form-check-input {
    cursor: pointer;
}

@media (max-width: 1200px) {
    .theme-editor-grid {
        grid-template-columns: 1fr;
    }

    .preview-pane .preview-card {
        position: static;
    }
}

.modern-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.04);
}

/* Badges */
.badge-modern {
    padding: 0.35em 0.65em;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.18);
    color: #6ce9a6;
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fda29b;
}

.badge-info {
    background-color: rgba(59, 130, 246, 0.18);
    color: #84caff;
}

/* Forms — duplicate removed; canonical definition is above (line ~452) */

/* =========================================
   Glossy Icons — consolidated from scoped CSS
   ========================================= */
.glossy-icon-base {
    border-radius: 50%;
    background: linear-gradient(135deg, #4a90e2 0%, #0056b3 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.4), inset 0 -2px 5px rgba(0, 0, 0, 0.3), 0 4px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.glossy-icon-base::after {
    content: '';
    position: absolute;
    top: 5%;
    left: 15%;
    width: 70%;
    height: 40%;
    border-radius: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
    opacity: 0.6;
}

.user-avatar-glossy {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar-glossy img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-glossy:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Utilities */
.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

/* Workspace + nav rail */
.nav-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    /*padding: 1.5rem 1.25rem 2rem;*/
    gap: 1rem;
}

.nav-scrollable {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.nav-scrollable::-webkit-scrollbar {
    width: 6px;
}

.nav-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
}

.workspace-region {
    padding: 0.75rem 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.workspace-switcher {
    position: relative;
}

.workspace-trigger {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(16, 24, 40, 0.9), rgba(15, 23, 42, 0.85));
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.workspace-trigger:hover {
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.workspace-trigger__icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.workspace-trigger__meta {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.workspace-trigger__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.workspace-trigger__plan {
    font-size: 0.75rem;
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
}

.workspace-menu {
    position: absolute;
    top: calc(100% + 0.75rem);
    left: 0;
    width: 100%;
    border-radius: 18px;
    background: var(--surface-raised);
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 55px rgba(2, 6, 23, 0.65);
    padding: 1rem;
    z-index: 1000;
}

.workspace-menu__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.workspace-menu__title {
    margin: 0;
    font-weight: 600;
}

.workspace-menu__header small {
    color: var(--text-muted);
}

.workspace-menu__search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.85rem;
}

.workspace-menu__search input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
}

.workspace-menu__search input:focus {
    outline: none;
}

.workspace-menu__list {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.workspace-option {
    border: none;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.workspace-option:hover {
    background: var(--surface-hover);
    transform: translateX(2px);
}

.workspace-option.active {
    background: rgba(91, 124, 250, 0.12);
    border: 1px solid rgba(91, 124, 250, 0.35);
}

.workspace-option__icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.workspace-option__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
}

.workspace-option__meta small {
    color: var(--text-muted);
}

.workspace-empty {
    padding: 2rem 1rem;
    text-align: center;
    border: 1px dashed var(--border-color);
    border-radius: 12px;
}

.workspace-menu__footer {
    margin-top: 1rem;
}

.nav-rail {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-section--divider {
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.nav-section--footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.nav-section__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.nav-link-modern--collapsible {
    justify-content: space-between;
    border: 1px solid transparent;
}

.nav-collapsible {
    display: grid;
    grid-template-columns: 1fr;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.nav-collapsible.open {
    max-height: 800px;
}

.nav-chip {
    margin-left: auto;
    background: rgba(244, 63, 94, 0.2);
    color: #fda29b;
    font-size: 0.75rem;
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    font-weight: 600;
}

/* Chat workspace */
.chat-shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 320px;
    gap: 1rem;
    height: calc(100vh - 90px);
    padding: 1rem 1.5rem 1.5rem;
}

.chat-pane {
    background: var(--surface-raised);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.chat-pane--list {
    overflow-y: auto;
}

.chat-pane--details {
    overflow: hidden;
    padding: 0;
}

.chat-pane__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.chat-pane__metrics {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.count-pill {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 0.15rem 0.85rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

.status-chip--ok {
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.3);
}

.status-chip--alert {
    color: #f97066;
    border-color: rgba(249, 112, 102, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.chat-pane__filters {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.chat-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
}

.chat-search input {
    border: none;
    background: transparent;
    color: var(--text-main);
    width: 100%;
}

.chat-search input:focus {
    outline: none;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-chip {
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    background: transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.filter-chip.is-active {
    background: rgba(91, 124, 250, 0.2);
    border-color: rgba(91, 124, 250, 0.5);
    color: var(--text-main);
}

.chat-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-section--recent {
    margin-top: 1.25rem;
}

.chat-section__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.chat-section__footer {
    margin-top: 0.75rem;
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-right: 0.35rem;
}

.chat-list::-webkit-scrollbar {
    width: 6px;
}

.chat-list__item {
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 0.75rem;
    display: flex;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.01);
    color: var(--text-main);
    text-align: left;
}

.chat-list__item:hover {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.chat-list__item.is-active {
    border-color: rgba(91, 124, 250, 0.5);
    background: rgba(91, 124, 250, 0.12);
}

.chat-list__avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(91, 124, 250, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    position: relative;
    text-transform: uppercase;
}

.chat-list__avatar--xl {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    font-size: 1.2rem;
}

.presence-dot {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--surface-raised);
}

.chat-list__content {
    flex: 1;
    min-width: 0;
}

.chat-list__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.chat-list__name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-list__time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-list__row--meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chat-list__preview {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chip {
    border-radius: 999px;
    padding: 0.1rem 0.6rem;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.chip--alert {
    background: rgba(249, 112, 102, 0.2);
    color: #f97066;
}

.chat-tags {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-top: 0.4rem;
}

.chat-tags--workspace {
    margin: 0 0 1rem;
}

.tag-pill {
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.7rem;
    color: #fff;
}

.chat-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    border: 1px dashed var(--border-color);
    border-radius: 16px;
}

.chat-empty--center {
    border: none;
    background: transparent;
}

.chat-empty__icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(91, 124, 250, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.75rem;
    color: #8fd3ff;
}

.chat-pane--workspace {
    background: var(--surface-raised);
    display: flex;
    flex-direction: column;
    padding: 0;
}

.chat-workspace__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.chat-visitor {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-visitor h4 {
    margin: 0;
    font-size: 1.2rem;
}

.chat-visitor__meta {
    display: flex;
    gap: 0.4rem;
    color: var(--text-muted);
    margin: 0;
    font-size: 0.85rem;
}

.chat-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chat-workspace__body {
    flex: 1;
    min-height: 0;
    margin-top: 0;
}

.chat-pane--details>* {
    flex: 1;
    overflow-y: auto;
    border-radius: 22px;
}

.chat-window {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    gap: 1rem;
}

.chat-window__header {
    background: linear-gradient(120deg, #2563eb, #7c3aed);
    color: #fff;
    border-radius: 18px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 20px 35px -25px rgba(37, 99, 235, 0.55);
}

.chat-window__header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.chat-window__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1rem 1rem 1rem;
    gap: 0.5rem;
    height: 0;
    min-height: 0;
}

.chat-window__messages {
    background: var(--color-base-100);
    border-radius: 18px;
    border: 1px solid var(--border-color);
    flex: 1;
    overflow-y: auto;
}

.chat-window__composer {
    background: var(--color-base-100);
    border-radius: 18px;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(2, 6, 23, 0.08);
    flex-shrink: 0;
}

@media (max-width: 1400px) {
    .chat-shell {
        grid-template-columns: 280px minmax(0, 1fr);
    }

    .chat-pane--details {
        display: none;
    }
}

@media (max-width: 1024px) {
    .chat-shell {
        grid-template-columns: 1fr;
        height: auto;
    }

    .chat-pane--list {
        order: 2;
    }

    .chat-pane--workspace {
        order: 1;
    }
}

/* NavMenu Modern */
.nav-link-modern {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0.25rem 0;
    position: relative;
}

.nav-link-modern:hover {
    background-color: var(--sidebar-hover);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-link-modern.active {
    background-color: var(--sidebar-active);
    color: var(--sidebar-active-text);
    font-weight: 600;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.15);
}

.nav-link-modern.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    opacity: 0.8;
}

.nav-link-modern i {
    font-size: 1.25rem;
    opacity: 0.8;
}

/* Blazor Specifics */
#blazor-error-ui {
    background: var(--danger);
    color: white;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .reload {
    margin-left: 0.5rem;
    color: white;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Sidebar States and Styles */
.sidebar {
    background-color: var(--bg-sidebar) !important;
    border-right: 1px solid var(--sidebar-border-right, rgba(255, 255, 255, 0.05));
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.sidebar-minimized {
    width: 75px !important;
    min-width: 75px !important;
}

.sidebar.sidebar-minimized .nav-panel {
    /*padding: 1.5rem 0.5rem;*/
    align-items: center;
}

.sidebar.sidebar-minimized .nav-section__label,
.sidebar.sidebar-minimized .nav-link-modern span,
.sidebar.sidebar-minimized .nav-chip,
.sidebar.sidebar-minimized .nav-link-modern--collapsible i:last-child {
    display: none !important;
}

.sidebar.sidebar-minimized .nav-link-modern {
    width: 50px;
    height: 50px;
    justify-content: center;
    padding: 0;
    border-radius: 12px;
}

.sidebar.sidebar-minimized .nav-link-modern i {
    font-size: 1.4rem;
    margin: 0 !important;
    color: var(--primary) !important;
}

.sidebar.sidebar-minimized .nav-link-modern.active::before {
    width: 3px;
    left: -8px;
}

/* Specific overrides for light skin to ensure sidebar visibility */
.skin-light .sidebar {
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
}

.skin-light .nav-link-modern:hover {
    background-color: #f1f5f9;
}

#blazor-error-ui {
    background: var(--danger);
    color: white;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 10000;
}

/* =========================================
   Reduced Motion — Accessibility
   ========================================= */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}