/* ============================================================
   Brightlant Webmail — FloatChat Design System
   Exact match: https://float-chat-kappa-lake.vercel.app/
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ── Design Tokens ── */
:root {
    --accent:         #2563eb;
    --accent-dark:    #1d4ed8;
    --accent-light:   #eff6ff;
    --accent-muted:   rgba(37, 99, 235, 0.1);
    --cyan:           #0284c7;
    --emerald:        #059669;
    --amber:          #d97706;
    --danger:         #dc2626;
    --purple:         #7c3aed;

    /* Surface */
    --bg:             #f3f6fc;
    --surface:        #ffffff;
    --surface-2:      #f8fafc;
    --surface-hover:  #eff6ff;
    --border:         #e2e8f0;
    --border-hover:   rgba(37, 99, 235, 0.3);

    /* Text */
    --text-900:       #0f172a;
    --text-700:       #334155;
    --text-500:       #64748b;
    --text-400:       #94a3b8;

    /* Sidebar */
    --sidebar-w:      68px;

    /* Shadows */
    --shadow-xs:  0 1px 4px rgba(15,23,42,0.03);
    --shadow-sm:  0 2px 10px rgba(15,23,42,0.04);
    --shadow-md:  0 4px 20px rgba(15,23,42,0.07);
    --shadow-lg:  0 12px 40px rgba(15,23,42,0.1);

    /* Radius */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-2xl:24px;
}

/* ── Dark theme overrides ── */
[data-theme="dark"] {
    --bg:          #0b1329;
    --surface:     #111c35;
    --surface-2:   #162040;
    --surface-hover:#1e2d50;
    --border:      rgba(255,255,255,0.08);
    --border-hover:rgba(37,99,235,0.4);
    --text-900:    #f1f5f9;
    --text-700:    #cbd5e1;
    --text-500:    #94a3b8;
    --text-400:    #64748b;
    --shadow-xs:   0 1px 4px rgba(0,0,0,0.2);
    --shadow-sm:   0 2px 10px rgba(0,0,0,0.3);
    --shadow-md:   0 4px 20px rgba(0,0,0,0.4);
}

/* ── Accent palettes (5 color-combination themes) ──
   Applied via [data-palette] on <html>; work in both light & dark mode. */
[data-palette="ocean"] {
    --accent: #2563eb; --accent-dark: #1d4ed8; --accent-light: #eff6ff;
    --accent-muted: rgba(37,99,235,0.12); --border-hover: rgba(37,99,235,0.35);
}
[data-palette="violet"] {
    --accent: #7c3aed; --accent-dark: #6d28d9; --accent-light: #f5f3ff;
    --accent-muted: rgba(124,58,237,0.12); --border-hover: rgba(124,58,237,0.35);
}
[data-palette="emerald"] {
    --accent: #059669; --accent-dark: #047857; --accent-light: #ecfdf5;
    --accent-muted: rgba(5,150,105,0.12); --border-hover: rgba(5,150,105,0.35);
}
[data-palette="sunset"] {
    --accent: #ea580c; --accent-dark: #c2410c; --accent-light: #fff7ed;
    --accent-muted: rgba(234,88,12,0.12); --border-hover: rgba(234,88,12,0.35);
}
[data-palette="rose"] {
    --accent: #e11d48; --accent-dark: #be123c; --accent-light: #fff1f2;
    --accent-muted: rgba(225,29,72,0.12); --border-hover: rgba(225,29,72,0.35);
}
/* In dark mode keep the light accent tint subtle instead of near-white */
[data-theme="dark"][data-palette] { --accent-light: rgba(255,255,255,0.06); }

/* ── Base Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Plus Jakarta Sans', -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-900);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ════════════════════════════════════════
   LAYOUT — Wrapper, Sidebar, Content
   ════════════════════════════════════════ */
.wrapper {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ── */
#sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    z-index: 1000;
    transition: width 0.28s cubic-bezier(0.4,0,0.2,1), box-shadow 0.28s ease;
    overflow: hidden;
    flex-shrink: 0;
}

/* Expand on hover */
#sidebar:hover {
    width: 210px;
    box-shadow: 4px 0 24px rgba(37,99,235,0.08);
}

#sidebar.active {
    margin-left: calc(-1 * var(--sidebar-w));
}


/* Sidebar Header — Logo & Brand */
.sidebar-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    transition: all 0.28s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-brand-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    text-decoration: none !important;
    overflow: hidden;
    transition: gap 0.28s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    background: var(--accent);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
    transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-brand-icon:hover {
    transform: scale(1.12) rotate(-8deg);
    box-shadow: 0 8px 24px rgba(37,99,235,0.45);
    background: var(--accent-dark);
}

.sidebar-brand-text {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    line-height: 1.15;
    margin-left: 0;
    transition: opacity 0.22s ease, max-width 0.28s cubic-bezier(0.4,0,0.2,1);
    pointer-events: none;
}

.sidebar-brand-text .brand-title {
    display: block;
    font-size: 14.5px;
    font-weight: 800;
    color: var(--text-900);
    letter-spacing: -0.3px;
}

.sidebar-brand-text .brand-subtitle {
    display: block;
    font-size: 10px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Expanded state header adjustments */
#sidebar:hover .sidebar-header,
#sidebar.expanded .sidebar-header {
    justify-content: flex-start;
    padding: 6px 16px 16px;
}

#sidebar:hover .sidebar-brand-wrapper,
#sidebar.expanded .sidebar-brand-wrapper {
    gap: 12px;
}

#sidebar:hover .sidebar-brand-text,
#sidebar.expanded .sidebar-brand-text {
    opacity: 1;
    max-width: 150px;
    pointer-events: auto;
}


/* Sidebar Nav */
#sidebar ul {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    width: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 145px);
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
}

#sidebar ul::-webkit-scrollbar {
    width: 4px;
}
#sidebar ul::-webkit-scrollbar-track {
    background: transparent;
}
#sidebar ul::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 4px;
}
#sidebar ul::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.sidebar-link {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-md);
    color: var(--text-500) !important;
    text-decoration: none !important;
    transition: background 0.22s ease, transform 0.22s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.22s ease, color 0.2s ease;
    position: relative;
    font-size: 18px;
    cursor: pointer;
    outline: none;
}

/* Hover: lift + glow + icon brighten */
.sidebar-link:hover {
    background: var(--accent-muted);
    color: var(--accent) !important;
    transform: scale(1.14) translateY(-1px);
    box-shadow: 0 6px 18px rgba(37,99,235,0.18);
}

.sidebar-link:hover i {
    color: var(--accent) !important;
    filter: drop-shadow(0 0 6px rgba(37,99,235,0.5));
}

/* Tooltip label slides in from right */
.sidebar-link::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%) scale(0.88) translateX(-6px);
    background: var(--text-900);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    padding: 5px 12px;
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    letter-spacing: 0.2px;
}

/* Tooltip arrow */
.sidebar-link::before {
    content: '';
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) scaleX(0);
    border: 5px solid transparent;
    border-right-color: var(--text-900);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.18s ease;
    z-index: 9999;
}

.sidebar-link:hover::after {
    opacity: 1;
    transform: translateY(-50%) scale(1) translateX(0);
}

.sidebar-link:hover::before {
    opacity: 1;
    transform: translateY(-50%) scaleX(1);
}

/* Active link overrides the ::before arrow with left bar instead */
.sidebar-link.active-link::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
    border: none;
    pointer-events: none;
    opacity: 1;
    transition: none;
}

.sidebar-link.active-link {
    background: var(--accent-muted);
    color: var(--accent) !important;
    transform: none;
    box-shadow: none;
}

.sidebar-link.active-link i {
    color: var(--accent) !important;
}

/* Notification dot on sidebar icon */
.sidebar-notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid var(--surface);
}

/* Unread count pill on the sidebar Notifications link */
.sidebar-notif-count {
    position: absolute;
    top: 3px;
    right: 5px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface);
    z-index: 2;
}

/* Uploaded profile photo inside the sidebar avatar circle */
.sidebar-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* ── Sidebar Expand — Label Slide-In ── */
/* In collapsed state, links are icon-only 44x44 */
.sidebar-link {
    /* already defined above — override gap/layout only */
    gap: 0;
    overflow: hidden;
    white-space: nowrap;
    justify-content: flex-start;
    padding: 0 13px;
}

.sidebar-link i {
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
}

/* Label: hidden by default, slides in when sidebar expands */
.sidebar-label {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    color: inherit;
    margin-left: 0;
    letter-spacing: 0.1px;
    transition: opacity 0.22s ease, max-width 0.28s cubic-bezier(0.4,0,0.2,1), margin-left 0.22s ease;
    pointer-events: none;
}

/* When sidebar expands on hover or click toggle, show labels */
#sidebar:hover,
#sidebar.expanded {
    width: 230px;
    box-shadow: 6px 0 28px rgba(37,99,235,0.09);
}

.sidebar-section-header {
    width: 100%;
    height: 1px;
    background: var(--border);
    margin: 6px 0;
    padding: 0;
    overflow: hidden;
    list-style: none;
    transition: all 0.25s ease;
}
.sidebar-section-header span {
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#sidebar:hover .sidebar-section-header,
#sidebar.expanded .sidebar-section-header {
    height: auto;
    background: transparent;
    margin: 10px 0 4px;
    padding: 2px 18px;
    width: 100%;
}
#sidebar:hover .sidebar-section-header span,
#sidebar.expanded .sidebar-section-header span {
    display: block;
    opacity: 1;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-400);
    text-transform: uppercase;
    letter-spacing: 0.9px;
}

#sidebar:hover .sidebar-link,
#sidebar.expanded .sidebar-link {
    width: 198px;
    padding: 0 14px;
    gap: 12px;
    transform: none !important; /* disable bounce scale during expand */
    justify-content: flex-start;
}

#sidebar:hover .sidebar-link .sidebar-label,
#sidebar.expanded .sidebar-link .sidebar-label {
    opacity: 1;
    max-width: 150px;
    margin-left: 0;
    pointer-events: auto;
}

/* Hover: only icon scale when not sidebar-expanded hover */
#sidebar:not(:hover):not(.expanded) .sidebar-link:hover {
    transform: scale(1.14) translateY(-1px);
}

#sidebar:hover .sidebar-link:hover,
#sidebar.expanded .sidebar-link:hover {
    transform: none;
}

/* Disable tooltip when sidebar is expanded */
#sidebar:hover .sidebar-link::after,
#sidebar:hover .sidebar-link::before,
#sidebar.expanded .sidebar-link::after,
#sidebar.expanded .sidebar-link::before {
    display: none;
}

/* Icon glow on hover still works */
#sidebar:hover .sidebar-link:hover i {
    transform: scale(1.12);
    color: var(--accent) !important;
    filter: drop-shadow(0 0 5px rgba(37,99,235,0.5));
}

/* Active link label always visible (accent color) */
#sidebar:hover .sidebar-link.active-link .sidebar-label {
    color: var(--accent);
}

/* ── Sidebar Footer (User Card) ── */
.sidebar-footer {
    width: 100%;
    padding: 8px 12px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: padding 0.25s ease;
    flex-shrink: 0;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 4px;
    border-radius: var(--r-md);
    text-decoration: none !important;
    transition: background 0.2s ease, width 0.25s ease, padding 0.25s ease;
    overflow: hidden;
    box-sizing: border-box;
}

.sidebar-user-card:hover {
    background: var(--surface-hover);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37,99,235,0.28);
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.22s ease, max-width 0.28s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-900);
    line-height: 1.25;
    text-overflow: ellipsis;
    overflow: hidden;
}

.sidebar-user-role {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-400);
    line-height: 1.2;
}

.sidebar-user-gear {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    color: var(--text-400);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto;
    transition: opacity 0.2s ease, max-width 0.25s ease, color 0.2s ease;
}

.sidebar-user-gear i {
    transition: transform 0.3s ease;
}

/* Expanded state for Sidebar Footer */
#sidebar:hover .sidebar-footer,
#sidebar.expanded .sidebar-footer {
    padding: 10px 12px 14px;
    justify-content: flex-start;
}

#sidebar:hover .sidebar-user-card,
#sidebar.expanded .sidebar-user-card {
    width: 100%;
    padding: 6px 8px;
    justify-content: flex-start;
    gap: 10px;
}

#sidebar:hover .sidebar-user-info,
#sidebar.expanded .sidebar-user-info {
    opacity: 1;
    max-width: 120px;
    pointer-events: auto;
}

#sidebar:hover .sidebar-user-gear,
#sidebar.expanded .sidebar-user-gear {
    opacity: 1;
    max-width: 24px;
    pointer-events: auto;
}

.sidebar-user-card:hover .sidebar-user-gear {
    color: var(--accent);
}

.sidebar-user-card:hover .sidebar-user-gear i {
    transform: rotate(60deg);
}

/* Recent Activity scrollable list */
.fc-activity-scroll-list {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 350px;
    padding-right: 4px;
}
.fc-activity-scroll-list::-webkit-scrollbar {
    width: 6px;
}
.fc-activity-scroll-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
}
.fc-activity-scroll-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}
.fc-activity-scroll-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}


/* Sidebar Footer — User Profile Card */
.sidebar-footer {
    width: 100%;
    padding: 8px 12px 10px;
    margin-top: auto;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    transition: all 0.28s cubic-bezier(0.4,0,0.2,1);
    flex-shrink: 0;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 0;
    width: 44px;
    height: 44px;
    padding: 3px;
    border-radius: var(--r-md);
    text-decoration: none !important;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
    cursor: pointer;
}

.sidebar-user-card:hover {
    background: var(--surface-hover);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--cyan) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    border: 2px solid var(--border);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-user-info {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    margin-left: 0;
    line-height: 1.2;
    transition: opacity 0.22s ease, max-width 0.28s cubic-bezier(0.4,0,0.2,1);
    pointer-events: none;
    flex-grow: 1;
}

.sidebar-user-name {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-900);
    text-overflow: ellipsis;
    overflow: hidden;
}

.sidebar-user-role {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-400);
}

.sidebar-user-gear {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    color: var(--text-400);
    font-size: 13px;
    transition: opacity 0.22s ease, max-width 0.28s ease, color 0.2s ease;
    margin-left: auto;
    flex-shrink: 0;
}

.sidebar-user-card:hover .sidebar-user-gear {
    color: var(--accent);
}

/* Expanded state for footer */
#sidebar:hover .sidebar-footer,
#sidebar.expanded .sidebar-footer {
    padding: 8px 14px 10px;
    justify-content: flex-start;
}

#sidebar:hover .sidebar-user-card,
#sidebar.expanded .sidebar-user-card {
    width: 200px;
    padding: 6px 8px;
    gap: 10px;
}

#sidebar:hover .sidebar-user-info,
#sidebar.expanded .sidebar-user-info {
    opacity: 1;
    max-width: 120px;
    pointer-events: auto;
}

#sidebar:hover .sidebar-user-gear,
#sidebar.expanded .sidebar-user-gear {
    opacity: 1;
    max-width: 24px;
}

/* ── Main Content ── */
#content {
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

/* ── Main Background with Grid ── */
.main-container {
    flex-grow: 1;
    padding: 24px 28px;
    background-color: var(--bg);
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 32px 32px;
    background-position: -1px -1px;
    min-height: calc(100vh - 61px);
    overflow-y: auto;
}

/* ════════════════════════════════════════
   TOP NAVBAR
   ════════════════════════════════════════ */
.top-navbar {
    height: 61px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 900;
    flex-shrink: 0;
}

.top-navbar .btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-500);
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 15px;
}

.top-navbar .btn-icon:hover {
    background: var(--surface-2);
    color: var(--text-900);
    border-color: var(--border-hover);
}

/* Search bar */
.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 7px 14px;
    font-size: 13px;
    color: var(--text-500);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
}

.topbar-search:hover {
    border-color: var(--accent);
    background: var(--surface);
}

.topbar-search kbd {
    background: var(--border);
    border-radius: 5px;
    padding: 1px 6px;
    font-size: 11px;
    color: var(--text-500);
    font-family: inherit;
    margin-left: auto;
}

/* ════════════════════════════════════════
   STAT CARDS — FloatChat Exact Style
   ════════════════════════════════════════ */
.fc-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
    position: relative;
    overflow: hidden;
}

.fc-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

/* FloatChat Icon Badge — Solid Blue Square */
.fc-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ffffff !important;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.fc-icon i, .fc-icon svg { color: #ffffff !important; }

.fc-icon.blue   { background: #2563eb; box-shadow: 0 4px 14px rgba(37,99,235,0.35); }
.fc-icon.cyan   { background: #0284c7; box-shadow: 0 4px 14px rgba(2,132,199,0.35); }
.fc-icon.emerald{ background: #059669; box-shadow: 0 4px 14px rgba(5,150,105,0.35); }
.fc-icon.amber  { background: #d97706; box-shadow: 0 4px 14px rgba(217,119,6,0.35); }
.fc-icon.purple { background: #7c3aed; box-shadow: 0 4px 14px rgba(124,58,237,0.35); }
.fc-icon.pink   { background: #db2777; box-shadow: 0 4px 14px rgba(219,39,119,0.35); }
.fc-icon.teal   { background: #0d9488; box-shadow: 0 4px 14px rgba(13,148,136,0.35); }

.fc-card:hover .fc-icon {
    transform: scale(1.08) rotate(3deg);
}

/* Trend Pills */
.fc-trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
}

.fc-trend.up   { background: #ecfdf5; color: #059669; }
.fc-trend.down { background: #fef2f2; color: #dc2626; }
.fc-trend.flat { background: #f8fafc; color: #64748b; }

/* Card stat number */
.fc-stat-num {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-900);
    letter-spacing: -0.8px;
    line-height: 1.15;
    margin: 8px 0 2px;
}

.fc-stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-500);
}

/* ════════════════════════════════════════
   CHART CONTAINER
   ════════════════════════════════════════ */
.fc-chart-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
}

/* Period filter tabs */
.fc-period-tabs {
    display: flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 3px;
    gap: 2px;
}

.fc-period-tab {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--r-sm);
    border: none;
    background: transparent;
    color: var(--text-500);
    cursor: pointer;
    transition: all 0.18s ease;
}

.fc-period-tab.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

/* ════════════════════════════════════════
   ACTIVITY FEED
   ════════════════════════════════════════ */
.fc-activity-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 20px 20px;
    box-shadow: var(--shadow-sm);
}

.fc-activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all 0.18s ease;
    text-decoration: none !important;
}

.fc-activity-item:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
}

.fc-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* ════════════════════════════════════════
   LAUNCHER / QUICK ACTION TILES
   ════════════════════════════════════════ */
.fc-launcher-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.22s ease;
}

.fc-launcher-tile:hover {
    transform: translateY(-2px);
    background: var(--surface-hover);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

/* ════════════════════════════════════════
   TABLES
   ════════════════════════════════════════ */
.fc-table-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.fc-table-box .table {
    margin: 0;
    font-size: 13px;
}

.fc-table-box .table thead th {
    background: var(--surface-2);
    color: var(--text-500);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid var(--border);
    padding: 11px 16px;
    white-space: nowrap;
}

.fc-table-box .table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-700);
    vertical-align: middle;
}

.fc-table-box .table tbody tr:last-child td { border-bottom: none; }
.fc-table-box .table tbody tr:hover td { background: var(--surface-2); }

/* ════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════ */
.btn-fc-primary {
    background: var(--accent);
    color: #fff !important;
    border: none;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 20px;
    padding: 8px 18px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(37,99,235,0.3);
    cursor: pointer;
    text-decoration: none !important;
}

.btn-fc-primary:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37,99,235,0.4);
    color: #fff !important;
}

.btn-fc-ghost {
    background: var(--surface);
    color: var(--text-700) !important;
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    border-radius: 20px;
    padding: 7px 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none !important;
}

.btn-fc-ghost:hover {
    background: var(--surface-2);
    border-color: var(--border-hover);
    color: var(--text-900) !important;
}

/* ════════════════════════════════════════
   BADGES & PILLS
   ════════════════════════════════════════ */
.fc-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}

.fc-badge.blue   { background: rgba(37,99,235,0.1); color: var(--accent); }
.fc-badge.green  { background: #ecfdf5; color: #059669; }
.fc-badge.red    { background: #fef2f2; color: #dc2626; }
.fc-badge.amber  { background: #fffbeb; color: #d97706; }
.fc-badge.gray   { background: var(--surface-2); color: var(--text-500); border: 1px solid var(--border); }

/* ════════════════════════════════════════
   INBOX / WEBMAIL 3-PANE
   ════════════════════════════════════════ */
.fc-3pane {
    display: flex;
    height: calc(100vh - 61px);
    background: var(--surface);
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.fc-3pane-list {
    width: 340px;
    min-width: 340px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--surface);
}

.fc-3pane-list-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fc-3pane-list-scroll { flex-grow: 1; overflow-y: auto; }

.fc-email-row {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s ease;
}

.fc-email-row:hover { background: var(--surface-2); }
.fc-email-row.selected { background: var(--accent-light); border-left: 3px solid var(--accent); }
.fc-email-row.unread strong { font-weight: 700; }

.fc-3pane-reading {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fc-3pane-reading-toolbar {
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 10;
}

.fc-3pane-reading-content {
    padding: 24px 30px;
    flex-grow: 1;
    overflow-y: auto;
}

/* ════════════════════════════════════════
   FORMS & INPUTS
   ════════════════════════════════════════ */
.fc-input {
    height: 44px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 0 14px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-900);
    width: 100%;
    transition: all 0.2s ease;
    outline: none;
}

.fc-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.fc-input::placeholder { color: var(--text-400); }

.fc-textarea {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px 14px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-900);
    width: 100%;
    transition: all 0.2s ease;
    outline: none;
    resize: vertical;
    min-height: 140px;
}

.fc-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.fc-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-700);
    margin-bottom: 6px;
}

/* ════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════ */
.login-page-bg {
    position: fixed;
    inset: 0;
    background: #060b14;
    background-image:
        radial-gradient(circle at 15% 20%, rgba(37,99,235,0.28) 0%, transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(6,182,212,0.2) 0%, transparent 50%),
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 100%, 100%, 32px 32px, 32px 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px 16px;
    z-index: 10000;
}

.login-split-card {
    width: 100%;
    max-width: 1020px;
    min-height: 560px;
    border-radius: 22px;
    background: rgba(13,21,38,0.94);
    border: 1px solid rgba(56,189,248,0.2);
    box-shadow: 0 30px 80px rgba(0,0,0,0.8);
    overflow: hidden;
}

/* Left hero panel */
.login-hero {
    background: linear-gradient(155deg, rgba(15,23,42,0.9) 0%, rgba(14,116,144,0.12) 100%);
    border-right: 1px solid rgba(255,255,255,0.07);
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Right form panel */
.login-form {
    background: rgba(11,18,32,0.96);
    padding: 36px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Form inputs on dark login panel */
.login-input {
    height: 50px;
    background: #ffffff !important;
    border: 2px solid transparent !important;
    border-radius: 13px !important;
    padding: 0 48px 0 46px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #0f172a !important;
    width: 100%;
    outline: none;
    transition: all 0.22s ease;
    font-family: inherit;
}

.login-input:focus {
    border-color: #0284c7 !important;
    box-shadow: 0 0 0 4px rgba(2,132,199,0.2) !important;
}

.login-input::placeholder { color: #94a3b8 !important; font-weight: 400 !important; }

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-icon {
    position: absolute;
    left: 16px;
    font-size: 15px;
    color: #64748b;
    pointer-events: none;
    z-index: 2;
}

.login-eye-btn {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    z-index: 2;
}

.login-eye-btn:hover { color: #0284c7; }

/* Login main CTA button */
.btn-login-cta {
    background: linear-gradient(90deg, #2563eb 0%, #0284c7 100%);
    color: #fff !important;
    border: none;
    height: 50px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(37,99,235,0.4);
    transition: all 0.25s ease;
    letter-spacing: 0.2px;
}

.btn-login-cta:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 12px 30px rgba(6,182,212,0.45);
}

.btn-login-sso {
    background: rgba(255,255,255,0.05);
    color: #e2e8f0 !important;
    border: 1px solid rgba(255,255,255,0.14);
    height: 46px;
    border-radius: 25px;
    font-size: 13.5px;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-login-sso:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.28);
}

/* Demo login box */
.demo-login-box {
    background: rgba(15,23,42,0.75);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 14px 16px;
}

.demo-account-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    transition: all 0.2s ease;
}

.demo-account-pill:hover {
    background: rgba(37,99,235,0.15);
    border-color: rgba(37,99,235,0.4);
}

/* FloatChat visualizer orb */
.fc-orb {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #38bdf8, #2563eb 55%, #a855f7);
    box-shadow: 0 0 32px rgba(56,189,248,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: orbPulse 4s ease-in-out infinite alternate;
}

@keyframes orbPulse {
    0%   { transform: scale(1);    box-shadow: 0 0 24px rgba(56,189,248,0.4); }
    100% { transform: scale(1.06); box-shadow: 0 0 48px rgba(6,182,212,0.6); }
}

/* Equalizer bars */
.fc-eq-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 36px;
}

.fc-eq-bar {
    width: 4px;
    background: rgba(255,255,255,0.9);
    border-radius: 3px;
    animation: eqAnim 1.2s ease-in-out infinite alternate;
}

.fc-eq-bar:nth-child(1) { animation-delay: 0.0s; height: 40%; }
.fc-eq-bar:nth-child(2) { animation-delay: 0.2s; height: 70%; }
.fc-eq-bar:nth-child(3) { animation-delay: 0.1s; height: 100%; }
.fc-eq-bar:nth-child(4) { animation-delay: 0.3s; height: 60%; }
.fc-eq-bar:nth-child(5) { animation-delay: 0.15s; height: 40%; }

@keyframes eqAnim {
    0%   { height: 20%; opacity: 0.5; }
    100% { height: 100%; opacity: 1; }
}

/* Pulse dot */
.fc-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(0.85); }
}

/* Text cyan gradient */
.text-fc-cyan {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ════════════════════════════════════════
   ALERTS & FLASH MESSAGES
   ════════════════════════════════════════ */
.flash-messages {
    position: fixed;
    top: 72px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
}

.flash-messages .alert {
    border-radius: var(--r-lg);
    border: none;
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
    font-weight: 500;
}

/* ════════════════════════════════════════
   DARK MODE OVERRIDES
   ════════════════════════════════════════ */
[data-theme="dark"] .fc-card,
[data-theme="dark"] .fc-chart-box,
[data-theme="dark"] .fc-activity-box,
[data-theme="dark"] .fc-table-box,
[data-theme="dark"] .fc-launcher-tile,
[data-theme="dark"] .top-navbar,
[data-theme="dark"] #sidebar { background: var(--surface); border-color: var(--border); }

[data-theme="dark"] .fc-trend.up    { background: rgba(5,150,105,0.15); }
[data-theme="dark"] .fc-trend.down  { background: rgba(220,38,38,0.15); }
[data-theme="dark"] .fc-trend.flat  { background: rgba(100,116,139,0.15); }
[data-theme="dark"] .fc-badge.green { background: rgba(5,150,105,0.15); }
[data-theme="dark"] .fc-badge.red   { background: rgba(220,38,38,0.15); }
[data-theme="dark"] .fc-badge.amber { background: rgba(217,119,6,0.15); }

[data-theme="dark"] .fc-3pane,
[data-theme="dark"] .fc-3pane-list,
[data-theme="dark"] .fc-3pane-reading-toolbar { background: var(--surface); border-color: var(--border); }

[data-theme="dark"] .fc-input, [data-theme="dark"] .fc-textarea {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-900);
}

[data-theme="dark"] .fc-email-row.selected { background: rgba(37,99,235,0.15); }
[data-theme="dark"] .fc-activity-item:hover { background: rgba(37,99,235,0.08); }

/* ════════════════════════════════════════
   UTILITIES & HELPERS
   ════════════════════════════════════════ */
.text-fc-blue    { color: var(--accent) !important; }
.text-fc-muted   { color: var(--text-500) !important; }
.text-fc-body    { color: var(--text-700) !important; }
.text-fc-heading { color: var(--text-900) !important; }

.fw-800 { font-weight: 800 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-500 { font-weight: 500 !important; }

.rounded-fc { border-radius: var(--r-lg) !important; }

/* Divider with text */
.fc-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-400);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.fc-divider::before, .fc-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.12);
}

/* outline input group for legacy code compat */
.input-group-glow .form-control:focus {
    box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
    border-color: var(--accent);
}

/* ════════════════════════════════════════════════════════════════
   FLOAT-CHAT STYLE WEBMAIL SUITE (INBOX / READING PANE)
   ════════════════════════════════════════════════════════════════ */
.fc-webmail-container {
    display: flex;
    height: calc(100vh - 105px);
    min-height: 600px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
}

/* Left Pane: Message List (370px) */
.fc-webmail-list-pane {
    width: 380px;
    min-width: 320px;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
}

.fc-webmail-list-header {
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.fc-webmail-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.fc-webmail-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-900);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    min-width: 0;
}

.fc-webmail-search-box {
    position: relative;
    width: 100%;
}

.fc-webmail-search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-400);
    pointer-events: none;
}

.fc-webmail-search-input {
    width: 100%;
    padding: 8px 14px 8px 34px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-900);
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.fc-webmail-search-input:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.fc-webmail-filters {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fc-filter-pill {
    padding: 4px 12px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 20px;
    border: 1px solid transparent;
    background: var(--surface-2);
    color: var(--text-500);
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
}

.fc-filter-pill:hover {
    color: var(--accent);
    background: var(--surface-hover);
}

.fc-filter-pill.active {
    background: var(--accent-light);
    color: var(--accent);
    border-color: rgba(37, 99, 235, 0.2);
    font-weight: 700;
}

[data-theme="dark"] .fc-filter-pill.active {
    background: rgba(37, 99, 235, 0.18);
}

/* Scrollable Messages List */
.fc-webmail-items-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.fc-webmail-items-scroll::-webkit-scrollbar {
    width: 4px;
}
.fc-webmail-items-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.fc-webmail-items-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 4px;
}

/* Individual Email Card */
.fc-mail-item {
    display: flex;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--surface);
    position: relative;
    text-decoration: none !important;
    box-sizing: border-box;
}

.fc-mail-item:hover {
    background: var(--surface-hover);
}

.fc-mail-item.selected {
    background: var(--accent-light) !important;
    border-left: 3.5px solid var(--accent);
}

[data-theme="dark"] .fc-mail-item.selected {
    background: rgba(37, 99, 235, 0.16) !important;
}

.fc-mail-item.unread {
    background: rgba(37, 99, 235, 0.025);
}

.fc-mail-item.unread .fc-mail-sender-name,
.fc-mail-item.unread .fc-mail-subject {
    font-weight: 700 !important;
    color: var(--text-900) !important;
}

.fc-mail-unread-dot {
    position: absolute;
    left: 5px;
    top: 18px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}

.fc-mail-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.fc-mail-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.fc-mail-header-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.fc-mail-sender-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc-mail-time {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-400);
    white-space: nowrap;
    flex-shrink: 0;
}

.fc-mail-subject {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}

.fc-mail-snippet {
    font-size: 11.5px;
    color: var(--text-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
}

.fc-mail-star-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-400);
    transition: color 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.fc-mail-star-btn:hover {
    transform: scale(1.18);
}

.fc-mail-star-btn.starred {
    color: #f59e0b;
}

/* Right Pane: Reading View */
.fc-webmail-view-pane {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface-2);
    overflow: hidden;
}

.fc-webmail-view-toolbar {
    height: 56px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.fc-webmail-content-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 32px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.fc-webmail-content-scroll::-webkit-scrollbar {
    width: 6px;
}
.fc-webmail-content-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 4px;
}

.fc-view-subject {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-900);
    margin-bottom: 18px;
    line-height: 1.3;
    letter-spacing: -0.3px;
    word-break: break-word;
}

.fc-view-sender-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.fc-view-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}

.fc-view-sender-details {
    flex: 1;
    min-width: 0;
}

.fc-view-sender-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}

.fc-view-sender-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-900);
}

.fc-view-date {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-400);
    font-family: 'Inter', monospace;
}

.fc-view-emails-line {
    font-size: 12px;
    color: var(--text-500);
}

.fc-view-emails-line code {
    color: var(--accent);
    font-weight: 600;
    background: var(--accent-light);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11.5px;
}

[data-theme="dark"] .fc-view-emails-line code {
    background: rgba(37, 99, 235, 0.15);
}

.fc-view-body-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 24px 28px;
    box-shadow: var(--shadow-xs);
    min-height: 200px;
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--text-900);
    word-break: break-word;
}

.fc-view-attachments-box {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.fc-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: var(--r-md);
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.fc-attachment-chip:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.fc-view-quickreply {
    margin-top: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 18px 22px;
    box-shadow: var(--shadow-xs);
}

.fc-view-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    text-align: center;
    color: var(--text-400);
}

.fc-view-empty i {
    font-size: 60px;
    color: var(--accent);
    opacity: 0.25;
    margin-bottom: 16px;
}

/* ════════════════════════════════════════════════════════════════
   ENTERPRISE ANALYTICS & INSIGHTS SUITE
   ════════════════════════════════════════════════════════════════ */
.fc-analytics-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
}

.fc-analytics-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.fc-metric-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}

.fc-metric-delta.positive {
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
}

.fc-metric-delta.neutral {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.fc-chart-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.fc-period-pills {
    display: inline-flex;
    background: var(--surface-2);
    padding: 3px;
    border-radius: 12px;
    border: 1px solid var(--border);
    gap: 2px;
}

.fc-period-pill-btn {
    border: none;
    background: transparent;
    padding: 5px 14px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-500);
    cursor: pointer;
    transition: all 0.18s ease;
}

.fc-period-pill-btn:hover {
    color: var(--accent);
}

.fc-period-pill-btn.active {
    background: var(--surface);
    color: var(--accent);
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(15,23,42,0.06);
}

[data-theme="dark"] .fc-period-pill-btn.active {
    background: var(--surface-hover);
    color: #fff;
}

.fc-health-badge-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.fc-health-badge-card:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
}

.fc-health-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════════
   DARK MODE — Bootstrap utility compatibility
   Bootstrap's text/bg/border utilities are hard-coded light-theme
   colors (text-dark = near-black, bg-white = #fff) and never react
   to [data-theme="dark"]. Remap them to theme tokens so every admin
   page (logs, SMTP, users, DNS, domains…) stays readable in dark.
   ════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .text-dark      { color: var(--text-900) !important; }
[data-theme="dark"] .text-black,
[data-theme="dark"] .text-body      { color: var(--text-900) !important; }
[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-secondary { color: var(--text-500) !important; }

[data-theme="dark"] .bg-white { background-color: var(--surface) !important; }
[data-theme="dark"] .bg-light { background-color: var(--surface-2) !important; }

/* Plain Bootstrap cards (many admin pages use .card + bg-white) */
[data-theme="dark"] .card {
    background-color: var(--surface);
    color: var(--text-700);
    border-color: var(--border);
}

/* Borders */
[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-start,
[data-theme="dark"] .border-end { border-color: var(--border) !important; }

/* Form controls */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-control-custom {
    background-color: var(--surface-2);
    border-color: var(--border);
    color: var(--text-900);
}
[data-theme="dark"] .form-control::placeholder { color: var(--text-400); }
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--surface-2);
    color: var(--text-900);
    border-color: var(--accent);
    box-shadow: 0 0 0 .2rem rgba(37,99,235,.25);
}
[data-theme="dark"] .input-group-text {
    background-color: var(--surface-2);
    border-color: var(--border);
    color: var(--text-500);
}
/* Inputs that intentionally sit on the white input-group icons
   (e.g. DNS scanner combo) keep readable dark text */
[data-theme="dark"] .input-group-text.bg-white { background-color: var(--surface) !important; }

/* Tables */
[data-theme="dark"] .table { color: var(--text-700); }
[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: transparent;
    color: var(--text-700);
    border-color: var(--border);
}
[data-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: var(--surface-hover);
    color: var(--text-900);
}

/* Dropdowns / list groups occasionally used on admin pages */
[data-theme="dark"] .dropdown-menu {
    background-color: var(--surface);
    border-color: var(--border);
}
[data-theme="dark"] .dropdown-item { color: var(--text-700); }
[data-theme="dark"] .dropdown-item:hover { background-color: var(--surface-2); color: var(--text-900); }

/* Modals */
[data-theme="dark"] .modal-content {
    background-color: var(--surface);
    color: var(--text-700);
    border-color: var(--border);
}
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer { border-color: var(--border); }

/* ── Sidebar pin button ──
   Small thumbtack in the header. Hidden when the rail is collapsed;
   appears on hover/pin. Clicking pins the sidebar open (adds .pinned
   + .expanded) so it stops collapsing when the mouse leaves. */
.sidebar-pin {
    border: 0; background: transparent; color: var(--text-400);
    width: 28px; height: 28px; border-radius: 8px; padding: 0; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    opacity: 0; max-width: 0; margin-left: 0; overflow: hidden;
    transition: opacity .2s ease, max-width .25s ease, margin-left .2s ease,
                background .15s ease, color .15s ease;
    pointer-events: none;
}
#sidebar:hover .sidebar-pin,
#sidebar.pinned .sidebar-pin {
    opacity: 1; max-width: 28px; margin-left: auto; pointer-events: auto;
}
.sidebar-pin:hover { background: var(--surface-2); color: var(--text-700); }
.sidebar-pin i { font-size: 12px; transition: transform .2s ease; }
#sidebar.pinned .sidebar-pin { color: var(--accent); background: var(--accent-muted); }
#sidebar.pinned .sidebar-pin i { transform: rotate(45deg); }

/* ════════════════════════════════════════
   RESPONSIVE — tablets & phones
   ════════════════════════════════════════ */
@media (max-width: 992px) {
    .main-container { padding: 18px 16px; }
    .top-navbar { padding: 0 14px; }
}

@media (max-width: 768px) {
    /* Off-canvas sidebar: hidden by default, slides in when .expanded */
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 240px !important;
        min-width: 240px;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
        box-shadow: 6px 0 32px rgba(0,0,0,0.22);
    }
    #sidebar:hover { width: 240px !important; }
    #sidebar.expanded { transform: translateX(0); }

    /* Dim backdrop behind the open sidebar */
    #sidebarBackdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }
    #sidebarBackdrop.show { opacity: 1; visibility: visible; }

    #content { width: 100%; }
    .main-container { padding: 14px 12px; background-size: 24px 24px; }
    .top-navbar { padding: 0 10px; }
}

@media (max-width: 480px) {
    .main-container { padding: 12px 10px; }
}

