/* ============================================
   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.2) 0%, rgba(59, 130, 246, 0.2) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    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.3) 0%, rgba(59, 130, 246, 0.3) 100%);
    border-color: rgba(139, 92, 246, 0.5);
    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);
}

/* REMOVED: M365 Icon Bar — moved to M365IconBar.razor.css (component-scoped) */

/* REMOVED: Teams Hub — moved to TeamsHub.razor.css (component-scoped) */
/* REMOVED: M365 Connect Button — moved to M365ConnectButton.razor.css (component-scoped) */

/* REMOVED: duplicate .firm-ai-btn — merged into definition at ~line 401 */

/* 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%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    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); }
}

/* REMOVED: duplicate .firm-ai-globe-orb — merged into definition at ~line 2905 */

.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;
}

/* ============================================
   STANDARD ADD / REMOVE BUTTONS
   Used across Pws pages, illustrations, etc.
   One definition — never redefine in <style> blocks.
   ============================================ */

/* Text add button — light blue, icon + text (e.g. "Add Single Payment", "Add Asset") */
.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #e8f4fc;
    border: 1px solid #c5dff0;
    border-radius: 8px;
    color: #1e3a5f;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn-add:hover {
    background: #d1ebfa;
    border-color: #9ecae8;
}

.btn-add:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-add:disabled:hover {
    background: #e8f4fc;
    border-color: #c5dff0;
}

/* Icon-only add button — square, for toolbars and headers */
.btn-add-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-add-icon:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.btn-add-icon:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Colour variants for icon buttons */
.btn-add-icon.green  { background: #059669; color: white; }
.btn-add-icon.green:hover { background: #047857; color: white; }

.btn-add-icon.blue   { background: #3b82f6; color: white; }
.btn-add-icon.blue:hover  { background: #2563eb; color: white; }

.btn-add-icon.navy   { background: #1e3a5f; color: white; }
.btn-add-icon.navy:hover  { background: #2a4d7a; color: white; }

/* Remove / delete button — small red icon button (e.g. trash icon in lists) */
.btn-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.btn-remove:hover {
    background: #fee2e2;
    border-color: #f87171;
}

/* REMOVED: CLIENTS GRID — moved to Clients.razor.css (component-scoped) */

/* ============================================
   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;
}

/* REMOVED: .firm-form-group, .firm-form-row, .locked-value — canonical versions in forms.css */

/* REMOVED: PROVIDERS PAGE — moved to Providers.razor.css (component-scoped) */

/* REMOVED: .firm-form-group textarea — canonical version in forms.css */

/* 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;
}


/* REMOVED: CALENDAR PAGE — moved to Calendar.razor.css + AttendeePicker.razor.css (component-scoped) */
