/* ============================================
   PERPETUAL 2.0 - AI-DRIVEN FINTECH
   ============================================ */

/* CSS Variables (defaults - can be overridden by firm theme) */
:root {
    --nav-background: #1a1f2e;
    --nav-text: #ffffff;
    --topbar-background: #1e3a5f;
    --topbar-text: #ffffff;
    --color-primary: #1e3a5f;
    --color-primary-hover: #2c5282;
    --color-primary-light: #e6eef5;
}

/* Layout flush - removes content padding for full-bleed pages that handle their own scroll */
.firm-content.layout-flush {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.firm-content.layout-flush > * {
    flex: 1;
    min-height: 0;
}

/* Base - CSS Grid layout (same pattern as admin shell) */
.firm-app {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    grid-template-rows: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, #f1f5f9 0%, #f8fafc 50%, #eef2ff 100%);
    transition: grid-template-columns 0.25s ease;
}

/* When AI is open, main content area shrinks to make room (AI panel is now fixed positioned) */
.firm-app.ai-open .firm-main {
    margin-right: 380px;
}

/* Full-bleed pages hide the sidebar (e.g., API Tester with its own nav) */
.firm-app.sidebar-hidden {
    grid-template-columns: minmax(0, 1fr);
}

.firm-app.sidebar-hidden .firm-sidebar {
    display: none;
}

/* ============================================
   HAMBURGER — hidden on desktop, replaces logo on phone
   ============================================ */
.hamburger-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: var(--topbar-text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.15s;
}

.hamburger-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* Logo wrap — base style (phone media query overrides to display: none) */
.topbar-logo-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   RESPONSIVE — 3 states, all automatic
   ============================================ */

/* --- TABLET (768–1280): sidebar collapses to icons, hover to peek --- */
@media (max-width: 1280px) {
    .firm-app {
        grid-template-columns: 64px minmax(0, 1fr);
    }

    /* Sidebar shrinks — hide text, show only icons */
    .firm-sidebar {
        width: 64px;
        overflow: visible; /* allow hover flyout to overlay content */
        z-index: 200;
    }

    .firm-sidebar .client-header {
        padding: 12px 0;
        justify-content: center;
    }

    .firm-sidebar .client-info,
    .firm-sidebar .seccl-brand span,
    .firm-sidebar .seccl-back {
        display: none;
    }

    .firm-nav {
        padding: 12px 8px;
        overflow-y: hidden;
    }

    .firm-nav-link {
        justify-content: center;
        padding: 12px 0;
        gap: 0;
    }

    .firm-nav-link span {
        display: none;
    }

    .firm-nav-link i {
        font-size: 18px;
        width: auto;
    }

    /* Nav groups — show parent icon only, hide chevron and children */
    .firm-nav-group-header {
        justify-content: center;
        padding: 12px 0;
        gap: 0;
    }

    .firm-nav-group-header span,
    .firm-nav-chevron {
        display: none;
    }

    .firm-nav-group-items {
        display: none;
    }

    /* Hover to peek — sidebar expands as overlay on hover */
    .firm-sidebar:hover {
        width: 240px;
        box-shadow: 4px 0 24px rgba(0,0,0,0.25);
    }

    .firm-sidebar:hover .client-info,
    .firm-sidebar:hover .seccl-brand span,
    .firm-sidebar:hover .seccl-back {
        display: block;
    }

    .firm-sidebar:hover .client-header {
        padding: 16px;
        justify-content: flex-start;
    }

    .firm-sidebar:hover .firm-nav {
        padding: 20px 14px;
        overflow-y: auto;
    }

    .firm-sidebar:hover .firm-nav-link {
        justify-content: flex-start;
        padding: 12px 14px;
        gap: 14px;
    }

    .firm-sidebar:hover .firm-nav-link span {
        display: inline;
    }

    .firm-sidebar:hover .firm-nav-link i {
        font-size: 15px;
        width: 20px;
    }

    .firm-sidebar:hover .firm-nav-group-header {
        justify-content: flex-start;
        padding: 12px 14px;
        gap: 14px;
    }

    .firm-sidebar:hover .firm-nav-group-header span,
    .firm-sidebar:hover .firm-nav-chevron {
        display: inline;
    }

    .firm-sidebar:hover .firm-nav-group-items {
        display: block;
    }

    .firm-sidebar:hover .firm-nav-group.expanded .firm-nav-group-items {
        max-height: 500px;
    }

    /* Topbar adapts — hide search text input, show just icon */
    .firm-search input {
        width: 0;
        padding: 10px 0 10px 40px;
        border: none;
        background: transparent;
    }

    .firm-search:focus-within input {
        width: 200px;
        padding: 10px 14px 10px 40px;
        border: 1px solid rgba(0,0,0,0.1);
        background: rgba(0,0,0,0.03);
    }

    .firm-topbar-name {
        display: none;
    }
}

/* --- PHONE (<768): sidebar gone, hamburger replaces logo --- */
@media (max-width: 767px) {
    .firm-app {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Sidebar off-screen by default */
    .firm-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Undo tablet hover-to-peek — not wanted on phone */
    .firm-sidebar:hover {
        width: 280px;
        box-shadow: 4px 0 24px rgba(0,0,0,0.25);
    }

    /* Restore all text labels inside sidebar (tablet hid them) */
    .firm-sidebar .client-info,
    .firm-sidebar .seccl-brand span,
    .firm-sidebar .seccl-back {
        display: block;
    }

    .firm-sidebar .client-header {
        padding: 16px;
        justify-content: flex-start;
    }

    .firm-nav {
        padding: 20px 14px;
    }

    .firm-nav-link {
        justify-content: flex-start;
        padding: 12px 14px;
        gap: 14px;
    }

    .firm-nav-link span {
        display: inline;
    }

    .firm-nav-link i {
        font-size: 15px;
        width: 20px;
    }

    .firm-nav-group-header {
        justify-content: flex-start;
        padding: 12px 14px;
        gap: 14px;
    }

    .firm-nav-group-header span,
    .firm-nav-chevron {
        display: inline;
    }

    .firm-nav-group-items {
        display: block;
    }

    /* Mobile nav open — slide sidebar in */
    .firm-app.mobile-nav-open .firm-sidebar {
        left: 0;
    }

    /* Backdrop */
    .mobile-nav-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        animation: fadeIn 0.2s ease;
    }

    /* Hamburger visible, logo hidden */
    .hamburger-btn {
        display: flex;
    }

    .topbar-logo-wrap {
        display: none;
    }

    /* Topbar compact */
    .firm-topbar {
        padding: 0 16px;
    }

    .firm-search {
        display: none;
    }

    .firm-topbar-name {
        display: none;
    }

    /* M365 icons too many for phone — hide them (!important: base styles at line ~654 come later in file) */
    .m365-icon-bar {
        display: none !important;
    }

    .topbar-separator {
        display: none !important;
    }

    /* Tighten topbar actions gap (!important: base style at ~546 comes later in file) */
    .firm-topbar-actions {
        gap: 6px !important;
    }

    /* AI panel full-width on mobile */
    .firm-app.ai-open .firm-main {
        margin-right: 0;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.firm-app *, .firm-app *::before, .firm-app *::after {
    box-sizing: border-box;
}

/* ============================================
   SIDEBAR
   ============================================ */
.firm-sidebar {
    background: var(--nav-background);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    transition: width 0.25s ease;
}

/* Adviser Section */
.firm-adviser {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    text-align: center;
}

.firm-adviser-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #1e3a5f;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    margin-bottom: 14px;
}

.firm-adviser-name {
    color: #ffffff;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.firm-adviser-title {
    color: #64748b;
    font-size: 11px;
    letter-spacing: 0.3px;
}

/* AI Sparkle Button - Topbar */
.firm-ai-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(59, 130, 246, 0.3) 100%);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.firm-ai-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.5) 0%, rgba(59, 130, 246, 0.5) 100%);
    border-color: rgba(139, 92, 246, 0.6);
    transform: scale(1.05);
}

.firm-ai-btn i {
    font-size: 16px;
    background: linear-gradient(135deg, #a78bfa 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: sparkle-pulse 2s ease-in-out infinite;
}

@keyframes sparkle-pulse {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

/* Nav */
.firm-nav {
    flex: 1;
    padding: 20px 14px;
    overflow-y: auto;
}

.firm-nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 4px;
    position: relative;
}

.firm-nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: #3b82f6;
    border-radius: 0 3px 3px 0;
    transition: height 0.2s ease;
}

.firm-nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    text-decoration: none;
}

.firm-nav-link.active,
.firm-nav-link:active,
.firm-nav-link:focus {
    background: rgba(255,255,255,0.1);
    color: #ffffff;
    text-decoration: none;
}

.firm-nav-link.active::before {
    height: 24px;
}

.firm-nav-link i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    opacity: 0.85;
}

.firm-nav-link.active i {
    opacity: 1;
}

/* ============================================
   MAIN AREA
   ============================================ */
.firm-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden; /* Critical: contains scroll context so topbar stays fixed */
    background: var(--color-background);
}

/* Top Bar */
.firm-topbar {
    height: 64px;
    flex-shrink: 0;
    background: var(--topbar-background);
    color: var(--topbar-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.firm-topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.firm-topbar-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: contain;
}

.firm-topbar-name {
    color: var(--topbar-text);
    font-weight: 600;
    font-size: 18px;
    letter-spacing: -0.3px;
}

.firm-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Search */
.firm-search {
    position: relative;
}

.firm-search input {
    width: 240px;
    padding: 10px 14px 10px 40px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(0,0,0,0.03);
    color: var(--topbar-text);
    font-size: 13px;
    transition: all 0.2s ease;
}

.firm-search input::placeholder {
    color: var(--topbar-text);
    opacity: 0.5;
}

.firm-search input:focus {
    outline: none;
    background: rgba(0,0,0,0.05);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.firm-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--topbar-text);
    opacity: 0.5;
    font-size: 13px;
}

/* Dark topbar variant */
.dark-topbar .firm-search input {
    border-color: rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.08);
}

.dark-topbar .firm-search input:focus {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
}

/* Icon Buttons */
.firm-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.08);
    color: var(--topbar-text);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.firm-icon-btn:hover {
    background: rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

/* Dark topbar variant - lighter icon backgrounds */
.dark-topbar .firm-icon-btn {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.1);
}

.dark-topbar .firm-icon-btn:hover {
    background: rgba(255,255,255,0.15);
}

.firm-notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* =====================================================
   M365 ICON BAR — Microsoft 365 top bar integration
   ===================================================== */

.m365-icon-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    z-index: 9999;
}

.m365-icon-bar .firm-icon-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
    position: relative;
    z-index: 9999;
}

.m365-icon-bar .firm-icon-btn.m365-active {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.3);
}

.topbar-separator {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.15);
    margin: 0 4px;
}

/* Flyout overlay — catches outside clicks */
.m365-flyout-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
}

/* Flyout panel */
.m365-flyout-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: 480px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    z-index: 9999;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.m365-flyout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid #e8ecf0;
}

.m365-flyout-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.m365-flyout-link {
    font-size: 12px;
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.m365-flyout-link:hover {
    text-decoration: underline;
}

.m365-flyout-content {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

/* Day headers (calendar) */
.m365-day-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    padding: 10px 18px 4px;
}

/* Individual list items */
.m365-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 18px;
    cursor: pointer;
    transition: background 0.1s;
}

.m365-item:hover {
    background: #f8fafc;
}

.m365-item-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.m365-item-body {
    flex: 1;
    min-width: 0;
}

.m365-item-title {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.m365-item-meta {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading & empty states */
.m365-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 13px;
}

.m365-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    font-size: 13px;
}

/* ── Mail specific ── */

.m365-mail-item {
    gap: 8px;
}

.m365-unread .m365-item-title,
.m365-unread .m365-mail-from {
    font-weight: 600;
}

.m365-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2563eb;
    flex-shrink: 0;
    margin-top: 6px;
}

.m365-mail-from {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
}

.m365-mail-time {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ── Tasks specific ── */

.m365-task-item {
    gap: 10px;
}

.m365-task-circle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    flex-shrink: 0;
    margin-top: 2px;
}

.m365-task-list {
    color: #0078d4;
    font-weight: 500;
}

.m365-overdue {
    color: #dc2626;
    font-weight: 600;
}

/* =====================================================
   TEAMS HUB — In-canvas colleague messaging
   ===================================================== */

/* ── Hub container ── */
.teams-hub {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    margin: 0;
}

/* ── Search bar ── */
.teams-hub-search {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #e8ecf0;
    background: #fafbfc;
    flex-shrink: 0;
}

.teams-search-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 6px 14px;
    flex: 1;
    max-width: 320px;
}

.teams-search-input-wrap i {
    color: #94a3b8;
    font-size: 13px;
}

.teams-search-input-wrap input {
    border: none;
    outline: none;
    font-size: 13px;
    width: 100%;
    background: transparent;
    color: #1e293b;
}

.teams-search-filters {
    display: flex;
    gap: 4px;
}

.teams-filter-pill {
    padding: 4px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}

.teams-filter-pill.active {
    background: #6264a7;
    color: #fff;
    border-color: #6264a7;
}

.teams-filter-pill:hover:not(.active) {
    border-color: #6264a7;
    color: #6264a7;
}

.teams-external-link {
    margin-left: auto;
    font-size: 12px;
    color: #6264a7;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}

.teams-external-link:hover {
    text-decoration: underline;
}

.teams-external-link i {
    font-size: 10px;
    margin-left: 3px;
}

/* ── Two-column body ── */
.teams-hub-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* ── Left: Chat list ── */
.teams-chat-list {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid #e8ecf0;
    overflow-y: auto;
    background: #fafbfc;
    scrollbar-width: thin;
}

.teams-list-loading,
.teams-list-empty {
    padding: 32px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.teams-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    cursor: pointer;
    user-select: none;
}

.teams-section-header i {
    font-size: 10px;
    transition: transform 0.2s;
}

.teams-section-header i.collapsed {
    transform: rotate(-90deg);
}

/* Contact row */
.teams-contact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.12s;
    border-left: 3px solid transparent;
}

.teams-contact:hover {
    background: #f1f3f5;
}

.teams-contact.active {
    background: rgba(98, 100, 167, 0.08);
    border-left-color: #6264a7;
}

.teams-contact-presence {
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.teams-presence {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #94a3b8;
}

.teams-presence.online {
    background: #10b981;
}

.teams-presence.busy {
    background: #ef4444;
}

.teams-presence.away {
    background: #f59e0b;
}

.teams-contact-info {
    flex: 1;
    min-width: 0;
}

.teams-contact-name {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.teams-contact-preview {
    font-size: 12px;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 1px;
}

.teams-contact-time {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Right: Conversation ── */
.teams-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
}

/* Empty state */
.teams-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    gap: 8px;
}

.teams-empty-state i {
    font-size: 48px;
    margin-bottom: 8px;
    opacity: 0.4;
}

.teams-empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: #64748b;
    margin: 0;
}

.teams-empty-state p {
    font-size: 13px;
    margin: 0;
}

/* Conversation header */
.teams-conv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e8ecf0;
    flex-shrink: 0;
    gap: 12px;
}

.teams-conv-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.teams-conv-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.teams-conv-participants {
    font-size: 12px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.teams-conv-header-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.teams-header-action {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s;
}

.teams-header-action:hover:not(:disabled) {
    background: #f1f3f5;
    color: #6264a7;
}

.teams-header-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Messages area ── */
.teams-conv-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
}

.teams-messages-loading,
.teams-messages-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 14px;
    gap: 8px;
}

/* Pending approval notice */
.teams-pending-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 32px;
    margin: auto;
    max-width: 400px;
}

.teams-pending-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.teams-pending-icon i {
    font-size: 24px;
    color: #6264a7;
}

.teams-pending-notice h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 8px;
}

.teams-pending-notice p {
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

.teams-pending-sub {
    margin-top: 8px !important;
    font-size: 12px !important;
    color: #94a3b8 !important;
}

/* Date divider */
.teams-date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0;
}

.teams-date-divider span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    background: #fff;
    padding: 0 12px;
}

.teams-date-divider::before,
.teams-date-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

/* Message rows */
.teams-msg {
    display: flex;
    gap: 10px;
    max-width: 70%;
    margin-bottom: 4px;
}

.teams-msg.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.teams-msg.other {
    align-self: flex-start;
}

/* Avatar circles */
.teams-msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    color: white;
    background: linear-gradient(135deg, #6264a7 0%, #4f46e5 100%);
    overflow: hidden;
}

.teams-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Message content wrapper */
.teams-msg-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Message bubbles */
.teams-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    background: #f1f3f5;
    color: #1e293b;
}

.teams-msg-bubble.own {
    background: linear-gradient(135deg, #6264a7 0%, #4f46e5 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.teams-msg.other .teams-msg-bubble {
    border-bottom-left-radius: 4px;
}

.teams-msg-sender {
    font-size: 12px;
    font-weight: 600;
    color: #6264a7;
    margin-bottom: 3px;
}

.teams-msg-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

.teams-msg.own .teams-msg-time {
    text-align: right;
}

/* ── Compose area ── */
.teams-conv-compose {
    border-top: 1px solid #e8ecf0;
    padding: 12px 20px;
    background: #fafbfc;
    flex-shrink: 0;
}

.teams-compose-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 13px;
    margin-bottom: 8px;
}

.teams-compose-error button {
    margin-left: auto;
    border: none;
    background: none;
    color: #dc2626;
    cursor: pointer;
    font-size: 12px;
}

.teams-compose-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.teams-compose-mic {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.teams-compose-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    background: white;
    transition: border-color 0.15s, height 0.1s;
    box-sizing: border-box;
    min-height: 40px;
    max-height: 160px;
    line-height: 1.4;
    overflow-y: auto;
}

.teams-compose-input:focus {
    border-color: #6264a7;
    box-shadow: 0 0 0 3px rgba(98, 100, 167, 0.1);
}

/* Mic button */
.teams-mic-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.15s;
}

.teams-mic-btn:hover {
    background: #e2e8f0;
    color: #6264a7;
}

.teams-mic-btn.recording {
    background: #ef4444;
    color: white;
    animation: teams-pulse-mic 1.5s infinite;
}

@keyframes teams-pulse-mic {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Done button (during dictation) */
.teams-done-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: #10b981;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s;
}

.teams-done-btn:hover {
    background: #059669;
}

/* Polish indicator */
.teams-polish-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    font-size: 13px;
    color: #6264a7;
    font-weight: 500;
}

/* Send button */
.teams-send-btn {
    width: 38px;
    height: 38px;
    background: #6264a7;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.teams-send-btn:hover:not(:disabled) {
    background: #4f46e5;
}

.teams-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* M365 Connect Button */
.m365-connect-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: #0078d4;
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
}

.m365-connect-btn:hover {
    background: #106ebe;
    color: #fff;
    text-decoration: none;
}

.m365-connect-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.m365-connected {
    color: #16a34a;
}

/* AI Sparkle Button */
.firm-ai-btn {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.firm-ai-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(59, 130, 246, 0.3) 100%);
    border-color: rgba(139, 92, 246, 0.5);
}

.firm-ai-btn i {
    background: linear-gradient(135deg, #a78bfa 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: sparkle-pulse 2s ease-in-out infinite;
}

/* Adviser Photo in Topbar */
.firm-topbar-adviser {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.firm-topbar-adviser:hover {
    border-color: rgba(255,255,255,0.4);
    transform: scale(1.05);
}

/* User menu button - wraps adviser avatar with chevron */
.firm-user-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
}

.firm-user-btn .firm-topbar-adviser {
    margin: 0;
}

.firm-user-btn:hover .firm-topbar-adviser {
    border-color: rgba(255,255,255,0.4);
    transform: scale(1.05);
}

.firm-user-chevron {
    font-size: 10px;
    color: rgba(255,255,255,0.6);
    transition: color 0.2s ease;
}

.firm-user-btn:hover .firm-user-chevron {
    color: rgba(255,255,255,0.9);
}

/* Content - no padding, pages manage their own spacing */
.firm-content {
    flex: 1;
    min-height: 0; /* Critical: allows flex child to shrink and scroll */
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Scrollbar styling */
.firm-content::-webkit-scrollbar {
    width: 8px;
}

.firm-content::-webkit-scrollbar-track {
    background: transparent;
}

.firm-content::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
}

.firm-content::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* ============================================
   CARDS
   ============================================ */
.firm-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: 
        0 4px 24px rgba(30, 58, 95, 0.06),
        0 1px 3px rgba(30, 58, 95, 0.04);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.firm-card:hover {
    transform: translateY(-6px);
    box-shadow: 
        0 20px 40px rgba(30, 58, 95, 0.12),
        0 8px 16px rgba(30, 58, 95, 0.06);
}

.firm-card-static {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow:
        0 4px 24px rgba(30, 58, 95, 0.06),
        0 1px 3px rgba(30, 58, 95, 0.04);
    overflow: hidden;
}

/* ============================================
   STAT CARDS
   ============================================ */
.firm-stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.firm-card:hover .firm-stat-icon {
    transform: scale(1.12);
}

.firm-stat-icon.navy { 
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    box-shadow: 0 8px 20px rgba(30, 58, 95, 0.35);
}
.firm-card:hover .firm-stat-icon.navy {
    box-shadow: 0 12px 28px rgba(30, 58, 95, 0.5);
}

.firm-stat-icon.green { 
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}
.firm-card:hover .firm-stat-icon.green {
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.5);
}

.firm-stat-icon.amber { 
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35);
}
.firm-card:hover .firm-stat-icon.amber {
    box-shadow: 0 12px 28px rgba(245, 158, 11, 0.5);
}

.firm-stat-icon.violet { 
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.35);
}
.firm-card:hover .firm-stat-icon.violet {
    box-shadow: 0 12px 28px rgba(139, 92, 246, 0.5);
}

.firm-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
}

.firm-stat-badge.green { 
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: #059669;
}
.firm-stat-badge.amber { 
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #d97706;
}

.firm-stat-label { 
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}

.firm-stat-value { 
    color: #0f172a;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.1;
}

.firm-stat-sub { 
    color: #94a3b8;
    font-size: 12px;
    margin-top: 8px;
}

/* ============================================
   ACTIVITY LIST
   ============================================ */
.firm-activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
}

.firm-activity-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.firm-activity-title-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
    font-size: 14px;
}

.firm-activity-title h3 {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.firm-activity-link {
    font-size: 13px;
    font-weight: 600;
    color: #1e3a5f;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.firm-activity-link:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.firm-activity-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f8fafc;
}

.firm-activity-item:last-child {
    border-bottom: none;
}

.firm-activity-item:hover {
    background: linear-gradient(90deg, #f8fafc 0%, transparent 100%);
}

.firm-activity-item:hover .firm-activity-avatar {
    transform: scale(1.15);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.firm-activity-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.firm-activity-avatar.blue { 
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}
.firm-activity-avatar.green { 
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}
.firm-activity-avatar.violet { 
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
}
.firm-activity-avatar.amber { 
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.firm-activity-content {
    flex: 1;
    min-width: 0;
}

.firm-activity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.firm-activity-name {
    font-weight: 600;
    color: #0f172a;
    font-size: 14px;
}

.firm-activity-tag {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.firm-activity-tag.blue { background: #eff6ff; color: #2563eb; }
.firm-activity-tag.green { background: #ecfdf5; color: #059669; }
.firm-activity-tag.violet { background: #f5f3ff; color: #7c3aed; }
.firm-activity-tag.amber { background: #fffbeb; color: #d97706; }

.firm-activity-desc {
    color: #64748b;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.firm-activity-time {
    color: #94a3b8;
    font-size: 12px;
    flex-shrink: 0;
    font-weight: 500;
}

/* ============================================
   QUICK ACTIONS
   ============================================ */
.firm-actions-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.firm-actions-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.1) 0%, rgba(30, 58, 95, 0.05) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1e3a5f;
    font-size: 14px;
}

.firm-actions-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.firm-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    margin-bottom: 12px;
}

.firm-action-btn:last-child {
    margin-bottom: 0;
}

.firm-action-btn.primary {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    color: white;
    box-shadow: 0 8px 24px rgba(30, 58, 95, 0.3);
}

.firm-action-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(30, 58, 95, 0.4);
}

.firm-action-btn.secondary {
    background: white;
    color: #334155;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    border: 1px solid #f1f5f9;
}

.firm-action-btn.secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    border-color: #e2e8f0;
}

.firm-action-btn.secondary:hover .firm-action-btn-icon {
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.1) 0%, rgba(30, 58, 95, 0.05) 100%);
    color: #1e3a5f;
}

.firm-action-btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.firm-action-btn.primary .firm-action-btn-icon {
    background: rgba(255,255,255,0.15);
}

.firm-action-btn.secondary .firm-action-btn-icon {
    background: #f8fafc;
    color: #64748b;
}

.firm-action-btn-text {
    flex: 1;
    min-width: 0;
}

.firm-action-btn-title {
    font-weight: 600;
    font-size: 14px;
    display: block;
}

.firm-action-btn-sub {
    font-size: 12px;
    opacity: 0.65;
    display: block;
    margin-top: 2px;
}

.firm-action-btn-arrow {
    font-size: 12px;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.firm-action-btn:hover .firm-action-btn-arrow {
    opacity: 1;
    transform: translateX(4px);
}

/* ============================================
   AI PANEL
   ============================================ */
/* AI Panel - Fixed position to stay above overlays */
.firm-ai-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1f2e 0%, #151923 100%);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,0.2);
    overflow: hidden;
    z-index: 1100; /* Above document editor overlay (1000) */
}

.firm-ai-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.firm-ai-header-row {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
}

.firm-ai-header-row select {
    flex-shrink: 1;
    min-width: 0;
}

.firm-ai-header-row .firm-ai-close {
    flex-shrink: 0;
    margin-left: auto;
}

.firm-ai-context {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.firm-ai-context-entity {
    color: #64748b;
}

.firm-ai-context-visible {
    color: #64748b;
    font-size: 11px;
}

/* Legacy classes - keep for backwards compatibility */
.firm-ai-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.firm-ai-title i {
    background: linear-gradient(135deg, #a78bfa 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 18px;
}

.firm-ai-context-indicator {
    font-size: 10px;
    color: #64748b;
    font-weight: 400;
    padding: 2px 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    white-space: nowrap;
}

.firm-ai-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.firm-ai-close:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* Debug Mode Toggle */
.firm-ai-debug {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.firm-ai-debug:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

.firm-ai-debug.active {
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.firm-ai-debug.active:hover {
    background: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

/* Messages Area */
.firm-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

/* Ready state - subtle indicator Charlie is listening */
.firm-ai-ready {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: rgba(167, 139, 250, 0.6);
    font-size: 13px;
    font-weight: 500;
    animation: ready-fade-in 0.3s ease-out;
}

.firm-ai-ready i {
    font-size: 14px;
    opacity: 0.8;
}

@keyframes ready-fade-in {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Wafer thin scrollbar - Webkit */
.firm-ai-messages::-webkit-scrollbar {
    width: 4px;
}

.firm-ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

.firm-ai-messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

.firm-ai-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

.firm-ai-message {
    display: flex;
    gap: 12px;
}

.firm-ai-message.assistant .firm-ai-message-content {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: #e2e8f0;
    padding: 10px 14px;
    border-radius: 16px 16px 16px 4px;
    font-size: 13px;
    line-height: 1.45;
}

.firm-ai-message.user .firm-ai-message-content {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #e2e8f0;
    padding: 10px 14px;
    border-radius: 16px 16px 4px 16px;
    font-size: 13px;
    line-height: 1.45;
    margin-left: auto;
}

/* Code Blocks in Messages */
.firm-ai-code-block {
    margin: 12px 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.firm-ai-code-block:first-child {
    margin-top: 0;
}

.firm-ai-code-block:last-child {
    margin-bottom: 0;
}

.firm-ai-code-lang {
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.2);
    font-size: 10px;
    font-weight: 600;
    color: #a78bfa;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.firm-ai-code-block pre {
    margin: 0;
    padding: 12px;
    overflow-x: auto;
}

.firm-ai-code-block code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Tables in Messages */
.firm-ai-table-wrapper {
    margin: 12px 0;
    overflow-x: auto;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.firm-ai-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.firm-ai-table th,
.firm-ai-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.firm-ai-table th {
    background: rgba(0, 0, 0, 0.2);
    font-weight: 600;
    color: #a78bfa;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.firm-ai-table td {
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: #e2e8f0;
}

.firm-ai-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

/* Results styling */
.firm-ai-message-content strong {
    color: #a78bfa;
    font-weight: 600;
}

.firm-ai-message-content em {
    color: #94a3b8;
    font-style: italic;
    font-size: 11px;
}

/* Input Area */
.firm-ai-input-area {
    padding: 16px 20px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.firm-ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.firm-ai-suggestion {
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.1);
    color: #a78bfa;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.firm-ai-suggestion:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
}

.firm-ai-input-row {
    display: flex;
    gap: 8px;
}

/* ============================================
   NEW INPUT BOX STYLES
   ============================================ */

.firm-ai-input-box {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 12px;
}

.firm-ai-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: white;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    max-height: 300px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.firm-ai-input::placeholder {
    color: #64748b;
}

.firm-ai-input:focus {
    outline: none;
}

/* Thin scrollbar for input textarea - Webkit */
.firm-ai-input::-webkit-scrollbar {
    width: 4px;
}

.firm-ai-input::-webkit-scrollbar-track {
    background: transparent;
}

.firm-ai-input::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

.firm-ai-input::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

.firm-ai-input-controls {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* Speaker Button (voice mute/unmute) */
.firm-ai-speaker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.firm-ai-speaker:hover {
    background: rgba(59, 130, 246, 0.25);
    transform: scale(1.05);
}

/* Mic Button */
.firm-ai-mic {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.firm-ai-mic:hover {
    background: rgba(239, 68, 68, 0.25);
    transform: scale(1.05);
}

/* Clear/Broom Button */
.firm-ai-clear {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(156, 163, 175, 0.15);
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.firm-ai-clear:hover {
    background: rgba(156, 163, 175, 0.25);
    transform: scale(1.05);
    color: #d1d5db;
}

/* Sweep animation for broom */
.firm-ai-clear.sweeping {
    animation: broom-sweep 0.4s ease-out;
}

.firm-ai-clear.sweeping i {
    animation: broom-rotate 0.4s ease-out;
}

@keyframes broom-sweep {
    0% { transform: scale(1); }
    25% { transform: scale(1.2) translateX(-3px); }
    50% { transform: scale(1.3) translateX(6px); }
    75% { transform: scale(1.1) translateX(2px); }
    100% { transform: scale(1) translateX(0); }
}

@keyframes broom-rotate {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    50% { transform: rotate(25deg); }
    75% { transform: rotate(-5deg); }
    100% { transform: rotate(0deg); }
}

/* Chat messages sweep-out animation */
.firm-ai-messages.sweeping .firm-ai-message {
    animation: message-sweep-out 0.3s ease-out forwards;
}

.firm-ai-messages.sweeping .firm-ai-message:nth-child(1) { animation-delay: 0s; }
.firm-ai-messages.sweeping .firm-ai-message:nth-child(2) { animation-delay: 0.03s; }
.firm-ai-messages.sweeping .firm-ai-message:nth-child(3) { animation-delay: 0.06s; }
.firm-ai-messages.sweeping .firm-ai-message:nth-child(4) { animation-delay: 0.09s; }
.firm-ai-messages.sweeping .firm-ai-message:nth-child(5) { animation-delay: 0.12s; }
.firm-ai-messages.sweeping .firm-ai-message:nth-child(n+6) { animation-delay: 0.15s; }

@keyframes message-sweep-out {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(100%) scale(0.8);
    }
}

/* Voice Mode Button */
.firm-ai-voice-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    color: #60a5fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.firm-ai-voice-btn:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(139, 92, 246, 0.25) 100%);
    transform: scale(1.05);
}

/* Custom bars icon for voice button */
.firm-ai-bars-icon {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 16px;
}

.firm-ai-bars-icon span {
    width: 3px;
    background: #60a5fa;
    border-radius: 2px;
    animation: bars-pulse 1s ease-in-out infinite;
}

.firm-ai-bars-icon span:nth-child(1) {
    height: 8px;
    animation-delay: 0s;
}

.firm-ai-bars-icon span:nth-child(2) {
    height: 14px;
    animation-delay: 0.15s;
}

.firm-ai-bars-icon span:nth-child(3) {
    height: 10px;
    animation-delay: 0.3s;
}

@keyframes bars-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Voice button active state */
.firm-ai-voice-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.4) 0%, rgba(139, 92, 246, 0.4) 100%);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.firm-ai-bars-icon.active span {
    animation: bars-active 0.5s ease-in-out infinite alternate;
}

@keyframes bars-active {
    0% { transform: scaleY(0.5); opacity: 0.7; }
    100% { transform: scaleY(1.3); opacity: 1; }
}

/* Voice status in input area */
.firm-ai-voice-status {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    min-height: 60px;
}

.firm-ai-voice-listening {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.firm-ai-voice-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.4;
    flex: 1;
}

.firm-ai-voice-label i {
    margin-right: 6px;
}

/* Stop button while Charlie is speaking */
.firm-ai-stop-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.firm-ai-stop-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.05);
}

/* Reset button - clear transcript */
.firm-ai-reset-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.firm-ai-reset-btn:hover {
    background: rgba(148, 163, 184, 0.25);
    color: #cbd5e1;
    transform: scale(1.05);
}

/* Spacer to push controls to right */
.firm-ai-controls-spacer {
    flex: 1;
}

/* Mic button active state in voice mode */
.firm-ai-mic.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(139, 92, 246, 0.3) 100%);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

/* Send Button - only visible when there's content */
.firm-ai-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.firm-ai-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

/* ============================================
   DICTATE WAVEFORM - Full width scrolling
   ============================================ */

.firm-ai-dictate-waveform {
    height: 48px;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.firm-ai-wave-container {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
}

.firm-ai-wave-bar {
    width: 3px;
    background: linear-gradient(180deg, #8b5cf6 0%, #3b82f6 100%);
    border-radius: 2px;
    flex-shrink: 0;
    animation: bar-scroll 6s linear forwards;
}

@keyframes bar-scroll {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(-400px); opacity: 1; }
}

/* Varying heights and delays - simulates voice, bars appear staggered from right */
.firm-ai-wave-bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.firm-ai-wave-bar:nth-child(2) { height: 16px; animation-delay: 0.12s; }
.firm-ai-wave-bar:nth-child(3) { height: 28px; animation-delay: 0.24s; }
.firm-ai-wave-bar:nth-child(4) { height: 14px; animation-delay: 0.36s; }
.firm-ai-wave-bar:nth-child(5) { height: 32px; animation-delay: 0.48s; }
.firm-ai-wave-bar:nth-child(6) { height: 10px; animation-delay: 0.6s; }
.firm-ai-wave-bar:nth-child(7) { height: 24px; animation-delay: 0.72s; }
.firm-ai-wave-bar:nth-child(8) { height: 38px; animation-delay: 0.84s; }
.firm-ai-wave-bar:nth-child(9) { height: 12px; animation-delay: 0.96s; }
.firm-ai-wave-bar:nth-child(10) { height: 30px; animation-delay: 1.08s; }
.firm-ai-wave-bar:nth-child(11) { height: 6px; animation-delay: 1.2s; }
.firm-ai-wave-bar:nth-child(12) { height: 22px; animation-delay: 1.32s; }
.firm-ai-wave-bar:nth-child(13) { height: 36px; animation-delay: 1.44s; }
.firm-ai-wave-bar:nth-child(14) { height: 14px; animation-delay: 1.56s; }
.firm-ai-wave-bar:nth-child(15) { height: 26px; animation-delay: 1.68s; }
.firm-ai-wave-bar:nth-child(16) { height: 8px; animation-delay: 1.8s; }
.firm-ai-wave-bar:nth-child(17) { height: 34px; animation-delay: 1.92s; }
.firm-ai-wave-bar:nth-child(18) { height: 18px; animation-delay: 2.04s; }
.firm-ai-wave-bar:nth-child(19) { height: 40px; animation-delay: 2.16s; }
.firm-ai-wave-bar:nth-child(20) { height: 12px; animation-delay: 2.28s; }
.firm-ai-wave-bar:nth-child(21) { height: 28px; animation-delay: 2.4s; }
.firm-ai-wave-bar:nth-child(22) { height: 6px; animation-delay: 2.52s; }
.firm-ai-wave-bar:nth-child(23) { height: 20px; animation-delay: 2.64s; }
.firm-ai-wave-bar:nth-child(24) { height: 34px; animation-delay: 2.76s; }
.firm-ai-wave-bar:nth-child(25) { height: 16px; animation-delay: 2.88s; }
.firm-ai-wave-bar:nth-child(26) { height: 24px; animation-delay: 3s; }
.firm-ai-wave-bar:nth-child(27) { height: 38px; animation-delay: 3.12s; }
.firm-ai-wave-bar:nth-child(28) { height: 10px; animation-delay: 3.24s; }
.firm-ai-wave-bar:nth-child(29) { height: 30px; animation-delay: 3.36s; }
.firm-ai-wave-bar:nth-child(30) { height: 14px; animation-delay: 3.48s; }
.firm-ai-wave-bar:nth-child(31) { height: 22px; animation-delay: 3.6s; }
.firm-ai-wave-bar:nth-child(32) { height: 36px; animation-delay: 3.72s; }
.firm-ai-wave-bar:nth-child(33) { height: 8px; animation-delay: 3.84s; }
.firm-ai-wave-bar:nth-child(34) { height: 26px; animation-delay: 3.96s; }
.firm-ai-wave-bar:nth-child(35) { height: 18px; animation-delay: 4.08s; }
.firm-ai-wave-bar:nth-child(36) { height: 32px; animation-delay: 4.2s; }
.firm-ai-wave-bar:nth-child(37) { height: 12px; animation-delay: 4.32s; }
.firm-ai-wave-bar:nth-child(38) { height: 40px; animation-delay: 4.44s; }
.firm-ai-wave-bar:nth-child(39) { height: 20px; animation-delay: 4.56s; }
.firm-ai-wave-bar:nth-child(40) { height: 28px; animation-delay: 4.68s; }
.firm-ai-wave-bar:nth-child(41) { height: 6px; animation-delay: 4.8s; }
.firm-ai-wave-bar:nth-child(42) { height: 34px; animation-delay: 4.92s; }
.firm-ai-wave-bar:nth-child(43) { height: 16px; animation-delay: 5.04s; }
.firm-ai-wave-bar:nth-child(44) { height: 24px; animation-delay: 5.16s; }
.firm-ai-wave-bar:nth-child(45) { height: 38px; animation-delay: 5.28s; }
.firm-ai-wave-bar:nth-child(46) { height: 10px; animation-delay: 5.4s; }
.firm-ai-wave-bar:nth-child(47) { height: 30px; animation-delay: 5.52s; }
.firm-ai-wave-bar:nth-child(48) { height: 14px; animation-delay: 5.64s; }
.firm-ai-wave-bar:nth-child(49) { height: 22px; animation-delay: 5.76s; }
.firm-ai-wave-bar:nth-child(50) { height: 36px; animation-delay: 5.88s; }

/* Dictate Control Buttons */
.firm-ai-dictate-cancel,
.firm-ai-dictate-done,
.firm-ai-processing-spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.firm-ai-dictate-cancel {
    background: rgba(255,255,255,0.1);
    color: #94a3b8;
}

.firm-ai-dictate-cancel:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.firm-ai-dictate-done {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.firm-ai-dictate-done:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

/* Processing State */
.firm-ai-processing {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 12px 14px;
    color: #94a3b8;
    font-size: 14px;
}

.firm-ai-processing-spinner {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    cursor: default;
}

.firm-ai-processing-spinner i {
    font-size: 16px;
}

/* ============================================
   VOICE MODE - AMBIENT GLOBE
   ============================================ */

.firm-ai-voice-mode {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #0a0f1a 0%, #0f172a 100%);
}

.firm-ai-voice-globe {
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.firm-ai-globe-orb {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: 
        radial-gradient(ellipse at 30% 30%, rgba(255,255,255,0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(59, 130, 246, 0.6) 0%, transparent 50%),
        linear-gradient(135deg, #60a5fa 0%, #3b82f6 25%, #8b5cf6 50%, #a78bfa 75%, #60a5fa 100%);
    background-size: 100% 100%, 100% 100%, 200% 200%;
    box-shadow: 
        0 0 60px rgba(59, 130, 246, 0.5),
        0 0 120px rgba(139, 92, 246, 0.3),
        inset 0 0 40px rgba(255,255,255,0.1);
    animation: orb-rotate 8s linear infinite, orb-pulse 3s ease-in-out infinite;
}

@keyframes orb-rotate {
    0% { background-position: 0% 50%, 0% 50%, 0% 50%; }
    100% { background-position: 0% 50%, 0% 50%, 200% 50%; }
}

@keyframes orb-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 60px rgba(59, 130, 246, 0.5), 0 0 120px rgba(139, 92, 246, 0.3);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 0 80px rgba(59, 130, 246, 0.6), 0 0 160px rgba(139, 92, 246, 0.4);
    }
}

.firm-ai-voice-controls {
    display: flex;
    gap: 20px;
    margin-top: 48px;
}

.firm-ai-voice-mute,
.firm-ai-voice-exit {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
}

.firm-ai-voice-mute {
    background: rgba(255,255,255,0.1);
    color: white;
}

.firm-ai-voice-mute:hover {
    background: rgba(255,255,255,0.15);
    transform: scale(1.05);
}

.firm-ai-voice-mute.muted {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.firm-ai-voice-exit {
    background: rgba(255,255,255,0.1);
    color: #94a3b8;
}

.firm-ai-voice-exit:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* Voice mode states */
.firm-ai-voice-mode.listening .firm-ai-globe-orb {
    animation: orb-rotate 8s linear infinite, orb-listening 0.5s ease-in-out infinite;
    box-shadow:
        0 0 80px rgba(59, 130, 246, 0.7),
        0 0 160px rgba(139, 92, 246, 0.4),
        inset 0 0 40px rgba(255,255,255,0.2);
}

.firm-ai-voice-mode.speaking .firm-ai-globe-orb {
    animation: orb-rotate 4s linear infinite, orb-speaking 0.3s ease-in-out infinite;
    box-shadow:
        0 0 100px rgba(16, 185, 129, 0.6),
        0 0 180px rgba(59, 130, 246, 0.4),
        inset 0 0 50px rgba(255,255,255,0.2);
}

.firm-ai-voice-mode.processing .firm-ai-globe-orb {
    animation: orb-rotate 2s linear infinite, orb-thinking 1s ease-in-out infinite;
    box-shadow:
        0 0 60px rgba(139, 92, 246, 0.6),
        0 0 120px rgba(245, 158, 11, 0.3),
        inset 0 0 40px rgba(255,255,255,0.15);
}

@keyframes orb-listening {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes orb-speaking {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes orb-thinking {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.02) rotate(2deg); }
    75% { transform: scale(1.02) rotate(-2deg); }
}

/* Orb icon styling */
.firm-ai-globe-orb {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.firm-ai-globe-orb i {
    font-size: 48px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.firm-ai-globe-orb:hover {
    transform: scale(1.03);
}

.firm-ai-globe-orb.pulsing {
    animation: orb-rotate 8s linear infinite, orb-listening 0.5s ease-in-out infinite !important;
}

.firm-ai-globe-orb.speaking {
    animation: orb-rotate 4s linear infinite, orb-speaking 0.3s ease-in-out infinite !important;
}

.firm-ai-globe-orb.thinking {
    animation: orb-rotate 2s linear infinite, orb-thinking 1s ease-in-out infinite !important;
}

/* Voice status text */
.firm-ai-voice-status {
    margin-top: 24px;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    min-height: 24px;
}

/* Voice transcript display */
.firm-ai-voice-transcript {
    margin-top: 16px;
    padding: 16px 24px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 12px;
    max-width: 90%;
    text-align: center;
    color: #60a5fa;
    font-size: 15px;
    font-style: italic;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Voice response display */
.firm-ai-voice-response {
    margin-top: 12px;
    padding: 16px 24px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 12px;
    max-width: 90%;
    text-align: center;
    color: #10b981;
    font-size: 14px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    max-height: 120px;
    overflow-y: auto;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.firm-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.firm-page-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.firm-page-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 8px 24px rgba(30, 58, 95, 0.3);
}

.firm-page-title h1 {
    font-size: 26px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.5px;
}

.firm-page-title p {
    font-size: 13px;
    color: #64748b;
    margin: 4px 0 0 0;
}

.firm-page-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Client Search */
.firm-client-search {
    position: relative;
}

.firm-client-search input {
    width: 280px;
    padding: 12px 14px 12px 42px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #0f172a;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.firm-client-search input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.firm-client-search input::placeholder {
    color: #94a3b8;
}

.firm-client-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 14px;
}

/* Buttons */
.firm-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(30, 58, 95, 0.3);
}

.firm-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(30, 58, 95, 0.4);
}

.firm-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.firm-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.firm-btn-secondary:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

/* ============================================
   CLIENTS GRID
   ============================================ */
.firm-clients-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

@media (max-width: 1400px) {
    .firm-clients-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1200px) {
    .firm-clients-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .firm-clients-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .firm-clients-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .firm-page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .firm-page-actions {
        flex-direction: column;
    }

    .firm-client-search input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .firm-clients-grid {
        grid-template-columns: 1fr;
    }
}

/* Client Card */
.firm-client-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow:
        0 4px 24px rgba(30, 58, 95, 0.06),
        0 1px 3px rgba(30, 58, 95, 0.04);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.firm-client-card:hover {
    transform: translateY(-8px);
    box-shadow:
        0 24px 48px rgba(30, 58, 95, 0.15),
        0 12px 24px rgba(30, 58, 95, 0.08);
}

/* Client Avatar */
.firm-client-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin: 0 auto 16px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
    color: white;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.firm-client-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.firm-client-card:hover .firm-client-avatar {
    transform: scale(1.12);
}

/* Avatar Colors */
.firm-client-avatar.blue {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}
.firm-client-card:hover .firm-client-avatar.blue {
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.5);
}

.firm-client-avatar.green {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}
.firm-client-card:hover .firm-client-avatar.green {
    box-shadow: 0 12px 32px rgba(16, 185, 129, 0.5);
}

.firm-client-avatar.violet {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
}
.firm-client-card:hover .firm-client-avatar.violet {
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.5);
}

.firm-client-avatar.amber {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
}
.firm-client-card:hover .firm-client-avatar.amber {
    box-shadow: 0 12px 32px rgba(245, 158, 11, 0.5);
}

.firm-client-avatar.rose {
    background: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
    box-shadow: 0 8px 24px rgba(225, 29, 72, 0.35);
}
.firm-client-card:hover .firm-client-avatar.rose {
    box-shadow: 0 12px 32px rgba(225, 29, 72, 0.5);
}

.firm-client-avatar.cyan {
    background: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%);
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.35);
}
.firm-client-card:hover .firm-client-avatar.cyan {
    box-shadow: 0 12px 32px rgba(6, 182, 212, 0.5);
}

/* Client Name */
.firm-client-name {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Client Details */
.firm-client-detail {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
    flex-wrap: wrap;
}

.firm-client-partner {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #ec4899;
}

.firm-client-partner i {
    font-size: 10px;
}

/* Client Actions */
.firm-client-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
}

.firm-client-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
}

.firm-client-action:hover {
    background: #3b82f6;
    color: white;
    transform: scale(1.1);
}

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */
.firm-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 80px 20px;
    color: #64748b;
    font-size: 15px;
}

.firm-loading i {
    font-size: 20px;
    color: #3b82f6;
}

.firm-empty {
    text-align: center;
    padding: 80px 20px;
}

.firm-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    color: #94a3b8;
    font-size: 32px;
}

.firm-empty h3 {
    font-size: 18px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 8px 0;
}

.firm-empty p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

/* ============================================
   MODAL
   ============================================ */
.firm-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.firm-modal {
    background: white;
    border-radius: 24px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.2);
}

.firm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid #f1f5f9;
}

.firm-modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.firm-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.firm-modal-close:hover {
    background: #e2e8f0;
    color: #334155;
}

.firm-modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

.firm-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
}

/* Form Elements */
.firm-form-group {
    margin-bottom: 20px;
}

.firm-form-group:last-child {
    margin-bottom: 0;
}

.firm-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.firm-form-group input,
.firm-form-group select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #0f172a;
    font-size: 14px;
    transition: all 0.2s ease;
}

.firm-form-group input:focus,
.firm-form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.firm-form-group input::placeholder {
    color: #94a3b8;
}

.firm-form-row {
    display: flex;
    gap: 12px;
}

.firm-form-row .firm-form-group {
    flex: 1;
}

/* ============================================
   PROVIDERS PAGE
   ============================================ */

/* Filter Select */
.firm-filter-select {
    padding: 10px 36px 10px 14px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #334155;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2364748b'%3E%3Cpath d='M7 10l5 5 5-5H7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    transition: all 0.2s ease;
}

.firm-filter-select:hover {
    border-color: #cbd5e1;
}

.firm-filter-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Providers Grid */
.firm-providers-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

@media (max-width: 1600px) {
    .firm-providers-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1400px) {
    .firm-providers-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1100px) {
    .firm-providers-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 800px) {
    .firm-providers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .firm-providers-grid {
        grid-template-columns: 1fr;
    }
}

/* Provider Card */
.firm-provider-card {
    background: white;
    border-radius: 20px;
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.04);
}

.firm-provider-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
    border-color: rgba(59, 130, 246, 0.2);
}

/* Provider Logo */
.firm-provider-logo {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    margin: 0 auto 16px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: white;
    transition: all 0.3s ease;
    overflow: hidden;
}

.firm-provider-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.firm-provider-card:hover .firm-provider-logo {
    transform: scale(1.08);
}

/* Logo Colors */
.firm-provider-logo.blue {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}
.firm-provider-card:hover .firm-provider-logo.blue {
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.5);
}

.firm-provider-logo.green {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}
.firm-provider-card:hover .firm-provider-logo.green {
    box-shadow: 0 12px 32px rgba(16, 185, 129, 0.5);
}

.firm-provider-logo.violet {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
}
.firm-provider-card:hover .firm-provider-logo.violet {
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.5);
}

.firm-provider-logo.amber {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
}
.firm-provider-card:hover .firm-provider-logo.amber {
    box-shadow: 0 12px 32px rgba(245, 158, 11, 0.5);
}

.firm-provider-logo.rose {
    background: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
    box-shadow: 0 8px 24px rgba(225, 29, 72, 0.35);
}
.firm-provider-card:hover .firm-provider-logo.rose {
    box-shadow: 0 12px 32px rgba(225, 29, 72, 0.5);
}

.firm-provider-logo.cyan {
    background: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%);
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.35);
}
.firm-provider-card:hover .firm-provider-logo.cyan {
    box-shadow: 0 12px 32px rgba(6, 182, 212, 0.5);
}

/* Provider Name */
.firm-provider-name {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Provider Type Badge */
.firm-provider-type {
    margin-bottom: 10px;
}

.firm-provider-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.firm-provider-type-badge.blue {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.firm-provider-type-badge.green {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.firm-provider-type-badge.violet {
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
}

.firm-provider-type-badge.amber {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.firm-provider-type-badge.rose {
    background: rgba(225, 29, 72, 0.12);
    color: #be123c;
}

.firm-provider-type-badge.cyan {
    background: rgba(6, 182, 212, 0.12);
    color: #0891b2;
}

/* Provider Description */
.firm-provider-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Textarea for form */
.firm-form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #0f172a;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: all 0.2s ease;
}

.firm-form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.firm-form-group textarea::placeholder {
    color: #94a3b8;
}

/* Document Editor overlay - respects Charlie panel */
/* NOTE: Core .editor-overlay styles are in editors.css (z-index: 99999, transparent bg).
   Only add overrides here for AI panel awareness. */

html.ai-panel-open .editor-overlay {
    right: 380px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   CALENDAR PAGE — SfSchedule with Outlook sync
   ═══════════════════════════════════════════════════════════════════════════ */

.calendar-page {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
}

/* Loading state */
.calendar-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
    font-size: 14px;
    color: #64748b;
}

.calendar-loading i {
    font-size: 18px;
    color: #0078d4;
}

/* No Graph configured state */
.calendar-no-graph {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.calendar-no-graph-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.calendar-no-graph-icon i {
    font-size: 28px;
    color: #94a3b8;
}

.calendar-no-graph h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 8px;
}

.calendar-no-graph p {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

/* ── SfSchedule theme overrides ── */

/* Only kill the top border so schedule flows from breadcrumb. Keep sides + bottom. */
.calendar-page .e-schedule {
    border-top: none !important;
}

/* Light toolbar background */
.calendar-page .e-schedule .e-schedule-toolbar .e-toolbar-items {
    background: #f8fafc;
}

/* Header cells (day names) */
.calendar-page .e-schedule .e-header-cells {
    font-weight: 600;
    font-size: 12px;
    color: #475569;
}

/* Current day highlight */
.calendar-page .e-schedule .e-header-cells.e-current-day {
    color: #0078d4;
}

/* ── Soft pastel appointment palette (matches Outlook) ── */

/* Base appointment: pastel background, dark text, left accent border */
.calendar-page .e-schedule .e-appointment {
    border: none;
    border-radius: 4px;
    border-left: 3px solid transparent;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Default: Teams meeting — soft blue */
.calendar-page .e-schedule .e-appointment.cat-teams {
    background: #dbeafe !important;
    border-left-color: #3b82f6;
    color: #1e3a5f !important;
}

/* Default: non-Teams — soft grey-blue */
.calendar-page .e-schedule .e-appointment.cat-default {
    background: #e2e8f0 !important;
    border-left-color: #64748b;
    color: #334155 !important;
}

/* Blue category */
.calendar-page .e-schedule .e-appointment.cat-blue {
    background: #dbeafe !important;
    border-left-color: #3b82f6;
    color: #1e3a5f !important;
}

/* Green category */
.calendar-page .e-schedule .e-appointment.cat-green {
    background: #dcfce7 !important;
    border-left-color: #22c55e;
    color: #14532d !important;
}

/* Purple category */
.calendar-page .e-schedule .e-appointment.cat-purple {
    background: #ede9fe !important;
    border-left-color: #8b5cf6;
    color: #3b0764 !important;
}

/* Red category */
.calendar-page .e-schedule .e-appointment.cat-red {
    background: #fee2e2 !important;
    border-left-color: #ef4444;
    color: #7f1d1d !important;
}

/* Orange category */
.calendar-page .e-schedule .e-appointment.cat-orange {
    background: #ffedd5 !important;
    border-left-color: #f97316;
    color: #7c2d12 !important;
}

/* Yellow category */
.calendar-page .e-schedule .e-appointment.cat-yellow {
    background: #fef9c3 !important;
    border-left-color: #eab308;
    color: #713f12 !important;
}

/* Client-linked event — soft teal */
.calendar-page .e-schedule .e-appointment.cat-linked {
    background: #ccfbf1 !important;
    border-left-color: #0d9488;
    color: #134e4a !important;
}

/* Work hours cell background */
.calendar-page .e-schedule .e-work-hours {
    background: #fafbfc;
}

/* Non-work hours */
.calendar-page .e-schedule .e-work-cells:not(.e-work-hours) {
    background: #f1f5f9;
}

/* Time indicator (red line) */
.calendar-page .e-schedule .e-current-timeline {
    border-top: 2px solid #ef4444;
}

.calendar-page .e-schedule .e-current-time {
    color: #ef4444;
    font-weight: 600;
}

/* ── Editor dialog overrides ── */

.calendar-page .e-schedule .e-popup.e-popup-open.e-dialog {
    width: 780px !important;
    max-width: 90vw;
    border-radius: 12px;
    overflow: hidden;
}

.calendar-page .e-schedule .e-dlg-header-content {
    background: #0f172a !important;
    padding: 10px 20px !important;
}

.calendar-page .e-schedule .e-dlg-header,
.calendar-page .e-schedule .e-dlg-header * {
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

.calendar-page .e-schedule .e-dlg-content {
    padding: 0 !important;
}

/* ── Calendar editor form ── */

.calendar-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 20px;
}

.calendar-editor-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calendar-editor-label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.calendar-editor-row {
    display: flex;
    gap: 12px;
}

.calendar-editor-half {
    flex: 1;
    min-width: 0;
}

/* Category colour picker — row of swatches */
.calendar-category-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.calendar-cat-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.calendar-cat-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

.calendar-cat-swatch.active {
    border-color: #475569;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #94a3b8;
    transform: scale(1.1);
}

.calendar-cat-clear {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px dashed #cbd5e1;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 11px;
    padding: 0;
    transition: all 0.15s ease;
    margin-left: 4px;
}

.calendar-cat-clear:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: #fef2f2;
}

/* ── Attendee Picker ── */
.attendee-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.attendee-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.attendee-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 10px;
    background: #e8f0fe;
    border-radius: 16px;
    font-size: 12px;
    color: #1e3a5f;
    line-height: 1.3;
    max-width: 280px;
}

.attendee-chip.response-accepted {
    background: #dcfce7;
    color: #14532d;
}

.attendee-chip.response-declined {
    background: #fef2f2;
    color: #991b1b;
    opacity: 0.7;
}

.attendee-chip.response-tentative {
    background: #fef9c3;
    color: #713f12;
}

.attendee-chip-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attendee-chip-email {
    color: #64748b;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attendee-chip-status {
    font-size: 10px;
    flex-shrink: 0;
}

.attendee-chip-status .fa-check { color: #16a34a; }
.attendee-chip-status .fa-xmark { color: #dc2626; }
.attendee-chip-status .fa-question { color: #ca8a04; }

.attendee-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 50%;
    font-size: 10px;
    flex-shrink: 0;
    padding: 0;
    transition: all 0.15s ease;
}

.attendee-chip-remove:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #ef4444;
}

.attendee-search-wrap {
    position: relative;
}

.attendee-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: #1e293b;
    background: #fff;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.attendee-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.attendee-search-input::placeholder {
    color: #94a3b8;
}

.attendee-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10000;
}

.attendee-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s ease;
}

.attendee-dropdown-item:hover {
    background: #f1f5f9;
}

.attendee-dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.attendee-dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.attendee-dropdown-name {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
}

.attendee-dropdown-detail {
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
}

.attendee-dropdown-external {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #3b82f6;
    font-size: 13px;
    font-weight: 500;
}

.attendee-dropdown-external i {
    font-size: 12px;
}

.attendee-dropdown-loading {
    padding: 12px;
    text-align: center;
    color: #64748b;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.attendee-dropdown-empty {
    padding: 12px;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
}

/* Teams meeting toggle */
.calendar-teams-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.calendar-teams-label {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
}

.calendar-teams-join {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #6264a7;
    color: #fff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease;
}

.calendar-teams-join:hover {
    background: #4b4d8a;
    color: #fff;
    text-decoration: none;
}

/* ── Join Meeting button (sits in colour swatch row) ── */

.calendar-join-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #5b5fc7;
    color: #fff;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.calendar-join-btn:hover {
    background: #4b4d8a;
    color: #fff;
    text-decoration: none;
}

.calendar-join-btn i {
    font-size: 12px;
}

/* ── Editor footer ── */

.calendar-editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: transparent;
}

.calendar-editor-footer-left,
.calendar-editor-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.calendar-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.calendar-btn-primary {
    background: #0f172a;
    color: #fff;
}

.calendar-btn-primary:hover:not(:disabled) {
    background: #1e293b;
}

.calendar-btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.calendar-btn-secondary:hover:not(:disabled) {
    background: #cbd5e1;
}

.calendar-btn-danger {
    background: transparent;
    color: #ef4444;
    border: 1px solid #fecaca;
}

.calendar-btn-danger:hover:not(:disabled) {
    background: #fef2f2;
}

/* ── SfSchedule input overrides to match Perpetual style ── */

.calendar-editor .e-input-group {
    border-radius: 6px;
}

.calendar-editor .e-textbox,
.calendar-editor .e-input {
    font-size: 13px;
}

/* RichTextEditor in editor */
.calendar-editor .e-richtexteditor {
    border-radius: 6px;
    overflow: hidden;
}
