/* ============================================
   THEO DASHBOARD - STYLES
   Professional TC workflow interface
   ============================================ */

/* CSS Variables - Dark Navy Theme (COO Approved Design) */
:root {
    color-scheme: dark;

    /* Background layers - Dark Navy Theme */
    --bg-primary: #0f172a;      /* Main app background */
    --bg-secondary: #1e293b;    /* Sidebar, cards, panels */
    --bg-tertiary: #334155;     /* Hover states, inputs, nested elements */
    --bg-hover: #475569;        /* Active hover */

    /* Accent colors */
    --accent-primary: #3b82f6;     /* Primary actions, active states */
    --accent-secondary: #60a5fa;   /* Lighter accent */
    --accent-muted: #1e40af;       /* Muted accent */
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.3);
    --accent-green: #22c55e;       /* Success, approve, on-track */
    --accent-amber: #f59e0b;       /* Warning, due soon */
    --accent-red: #ef4444;         /* Error, overdue, urgent */
    --accent-purple: #a855f7;      /* Intake forms */
    --accent-cyan: #0891b2;        /* Buyer transactions */
    --accent-orange: #ea580c;      /* Seller transactions */

    /* Text */
    --text-primary: #e2e8f0;    /* Main text */
    --text-secondary: #94a3b8;  /* Muted, labels */
    --text-muted: #64748b;      /* Very muted */

    /* Borders */
    --border-color: #334155;
    --border: #334155;

    /* Priority colors - Updated for dark navy */
    --critical-bg: #7f1d1d;
    --critical-border: #ef4444;
    --critical-text: #fca5a5;

    --high-bg: #78350f;
    --high-border: #f59e0b;
    --high-text: #fcd34d;

    --standard-bg: #14532d;
    --standard-border: #22c55e;
    --standard-text: #86efac;

    /* Status colors */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0891b2;

    /* Shadows - Dark Navy Theme */
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
    --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    /* Spacing */
    --sidebar-width: 240px;
    --sidebar-collapsed: 60px;
    --top-bar-height: 64px;
    --right-panel-width: 320px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Typography */
    --font-primary: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Borders & Shadows */
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;

    /* Legacy mappings for compatibility */
    --primary: #3b82f6;
    --primary-dark: #1e40af;
    --primary-light: #60a5fa;
}

/* Light Theme */
[data-theme="light"] {
    color-scheme: light;

    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-hover: #e2e8f0;

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Priority colors - lighter backgrounds for light theme */
    --critical-bg: #fef2f2;
    --critical-border: #ef4444;
    --critical-text: #b91c1c;

    --high-bg: #fffbeb;
    --high-border: #f59e0b;
    --high-text: #b45309;

    --standard-bg: #f0fdf4;
    --standard-border: #22c55e;
    --standard-text: #15803d;

    /* Adjust shadows for light theme */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Dark Theme (explicit) - Dark Navy */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --critical-bg: #7f1d1d;
    --critical-border: #ef4444;
    --critical-text: #fca5a5;

    --high-bg: #78350f;
    --high-border: #f59e0b;
    --high-text: #fcd34d;

    --standard-bg: #14532d;
    --standard-border: #22c55e;
    --standard-text: #86efac;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: width var(--transition-normal);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--bg-tertiary);
}

.logo-icon {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-primary);
    font-family: Georgia, serif;
}

.logo-mascot {
    height: 85px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.sidebar-nav {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-muted);
    color: var(--text-primary);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item span {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-divider {
    height: 1px;
    background: var(--bg-tertiary);
    margin: var(--spacing-md);
}

.sidebar-nav-bottom {
    margin-top: auto;
}

.sidebar-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--bg-tertiary);
    margin-top: auto;
}

.server-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 12px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s infinite;
}

.server-status.connected .status-dot {
    background: var(--success);
    animation: none;
}

.server-status.error .status-dot {
    background: var(--danger);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-right: var(--right-panel-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Hide right panel on smaller screens */
@media (max-width: 1400px) {
    .main-content {
        margin-right: 0;
    }
    .right-panel {
        display: none;
    }
}

/* Top Bar */
.top-bar {
    height: var(--top-bar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar-left {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-md);
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.quick-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.user-menu-container {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    transition: background var(--transition-fast);
}

.user-info:hover {
    background: var(--bg-tertiary);
}

.user-name {
    font-size: 14px;
    color: var(--text-secondary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

/* User Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.user-dropdown.active {
    display: block;
    animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: var(--bg-tertiary);
}

.user-dropdown-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

.user-dropdown-info {
    flex: 1;
    min-width: 0;
}

.user-dropdown-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
    margin-bottom: 2px;
}

.user-dropdown-email {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--bg-tertiary);
    margin: var(--spacing-xs) 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.user-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.user-dropdown-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.user-dropdown-item.signout {
    color: var(--danger);
}

.user-dropdown-item.signout:hover {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

/* Theme Toggle Row in Dropdown */
.theme-toggle-row {
    justify-content: space-between;
    cursor: default;
}

.theme-toggle-row:hover {
    background: transparent;
}

.theme-toggle-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.theme-toggle-label svg {
    width: 18px;
    height: 18px;
}

.theme-quick-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 2px;
}

.theme-btn {
    padding: 4px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.theme-btn:hover {
    color: var(--text-primary);
}

.theme-btn.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-secondary);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 12px;
}

/* ============================================
   VIEWS
   ============================================ */

.view {
    display: none;
    padding: var(--spacing-lg);
    flex: 1;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
}

.view-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.view-tabs {
    display: flex;
    gap: var(--spacing-xs);
}

.tab-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-primary);
    color: white;
}

/* ============================================
   PRIORITY PANELS
   ============================================ */

.priority-panels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.priority-panel {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--bg-tertiary);
    overflow: hidden;
}

.priority-panel.critical {
    border-left: 3px solid var(--critical-border);
}

.priority-panel.high {
    border-left: 3px solid var(--high-border);
}

.priority-panel.standard {
    border-left: 3px solid var(--standard-border);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
}

.panel-header h2 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.priority-panel.critical .panel-header h2 {
    color: var(--critical-text);
}

.priority-panel.high .panel-header h2 {
    color: var(--high-text);
}

.priority-panel.standard .panel-header h2 {
    color: var(--standard-text);
}

.panel-count {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.panel-content {
    padding: var(--spacing-sm);
    max-height: 300px;
    overflow-y: auto;
}

/* Transaction Cards (in priority panels) */
.transaction-card {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.transaction-card:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.transaction-card:last-child {
    margin-bottom: 0;
}

.transaction-address {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: var(--spacing-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transaction-meta {
    display: flex;
    gap: var(--spacing-md);
    font-size: 12px;
    color: var(--text-muted);
}

.transaction-type {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.transaction-type.listing {
    background: var(--info);
    color: white;
}

.transaction-type.purchase {
    background: var(--success);
    color: white;
}

.transaction-type.referral {
    background: var(--warning);
    color: #000;
}

/* ============================================
   WIDGETS
   ============================================ */

.widgets-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.widget {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--bg-tertiary);
    overflow: hidden;
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
}

.widget-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.widget-count {
    background: var(--accent-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.widget-content {
    padding: var(--spacing-md);
    max-height: 200px;
    overflow-y: auto;
}

/* Challenge Items */
.challenge-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-sm);
}

.challenge-item:last-child {
    margin-bottom: 0;
}

.challenge-icon {
    color: var(--warning);
    flex-shrink: 0;
}

.challenge-icon svg {
    width: 16px;
    height: 16px;
}

.challenge-text {
    flex: 1;
    font-size: 13px;
}

.challenge-address {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Key Dates Items */
.keydate-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.keydate-item:hover {
    background: var(--bg-hover);
}

.keydate-item:last-child {
    margin-bottom: 0;
}

.keydate-info {
    flex: 1;
    min-width: 0;
}

.keydate-type {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.keydate-address {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.keydate-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    margin-left: var(--spacing-sm);
}

.keydate-badge.overdue {
    background: var(--danger);
    color: white;
}

.keydate-badge.today {
    background: var(--warning);
    color: var(--bg-primary);
}

.keydate-badge.warning {
    background: #f0ad4e;
    color: var(--bg-primary);
}

.keydate-badge.upcoming {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.keydate-check {
    color: var(--success);
    margin-right: var(--spacing-sm);
    font-weight: 700;
    font-size: 14px;
}

.keydate-item.completed {
    opacity: 0.7;
}

.keydate-item.completed .keydate-type {
    text-decoration: line-through;
    color: var(--text-muted);
}

.keydate-date-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
    margin-left: var(--spacing-sm);
}

.keydate-date {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.keydate-badge.completed {
    background: var(--success);
    color: white;
}


/* Task Items (compact) */
.task-item-compact {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-sm);
}

.task-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.task-checkbox:hover {
    border-color: var(--accent-primary);
}

.task-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
}

.task-title-compact {
    flex: 1;
    font-size: 13px;
}

.task-due {
    font-size: 11px;
    color: var(--text-muted);
}

.task-due.overdue {
    color: var(--danger);
}

/* ============================================
   DATA TABLES
   ============================================ */

.transactions-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--bg-tertiary);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
}

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.section-controls {
    display: flex;
    gap: var(--spacing-sm);
}

.filter-select, .search-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-hover);
    border-radius: var(--border-radius);
    padding: var(--spacing-sm) var(--spacing-md);
    font-family: var(--font-primary);
    font-size: 13px;
    color: var(--text-primary);
}

.filter-select:focus, .search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Native select option styling for dark theme */
.filter-select option,
.form-select option {
    background: #1a2029;
    color: #e7eaed;
}

[data-theme="light"] .filter-select option,
[data-theme="light"] .form-select option {
    background: #ffffff;
    color: #1e293b;
}

.search-input {
    width: 200px;
}

.table-container {
    overflow-x: auto;
}

.table-container.full-height {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--bg-hover);
    position: sticky;
    top: 0;
}

.data-table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
    font-size: 13px;
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table .empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: var(--spacing-xl);
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: rgba(40, 167, 69, 0.2);
    color: var(--success);
}

.status-badge.pending {
    background: rgba(255, 193, 7, 0.2);
    color: var(--warning);
}

.status-badge.completed {
    background: rgba(23, 162, 184, 0.2);
    color: var(--info);
}

.status-badge.cancelled {
    background: rgba(220, 53, 69, 0.2);
    color: var(--danger);
}

/* Days indicator */
.days-indicator {
    font-family: var(--font-mono);
    font-size: 12px;
}

.days-indicator.urgent {
    color: var(--danger);
    font-weight: 600;
}

.days-indicator.soon {
    color: var(--warning);
}

/* Empty State */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: var(--spacing-lg);
    font-size: 13px;
}

/* ============================================
   TASKS VIEW
   ============================================ */

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.task-item {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.task-item.high {
    border-left: 3px solid var(--danger);
}

.task-item.medium {
    border-left: 3px solid var(--warning);
}

.task-item.low {
    border-left: 3px solid var(--success);
}

.task-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.task-check:hover {
    border-color: var(--accent-primary);
}

.task-check.completed {
    background: var(--success);
    border-color: var(--success);
}

.task-check.completed::after {
    content: '✓';
    color: white;
    font-size: 12px;
}

.task-content {
    flex: 1;
}

.task-title {
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.task-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.task-meta {
    display: flex;
    gap: var(--spacing-md);
    font-size: 12px;
    color: var(--text-muted);
}

.task-meta-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.task-meta-item svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   REPORTS VIEW
   ============================================ */

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

.report-card {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.report-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
}

.report-icon svg {
    width: 24px;
    height: 24px;
    color: var(--accent-primary);
}

.report-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.report-card p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   SETTINGS VIEW
   ============================================ */

.settings-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--bg-tertiary);
    padding-bottom: var(--spacing-sm);
}

.settings-tab {
    padding: var(--spacing-sm) var(--spacing-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
    margin-bottom: -9px;
}

.settings-tab:hover {
    color: var(--text-primary);
}

.settings-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.settings-content {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
}

.settings-group {
    margin-bottom: var(--spacing-lg);
}

.settings-group:last-child {
    margin-bottom: 0;
}

.settings-group h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-sm);
}

.setting-label {
    font-size: 14px;
}

.setting-value {
    font-size: 14px;
    color: var(--text-secondary);
}

/* External link prompt */
.external-link-prompt {
    text-align: center;
    padding: var(--spacing-xl);
}

.external-link-prompt p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--bg-tertiary);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--bg-tertiary);
}

/* Quill Rich Text Editor in Email Compose */
.email-compose-modal .ql-toolbar {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px 6px 0 0;
}

.email-compose-modal .ql-container {
    border: 1px solid var(--bg-tertiary);
    border-top: none;
    border-radius: 0 0 6px 6px;
    font-family: var(--font-main);
    font-size: 14px;
}

.email-compose-modal .ql-editor {
    min-height: 200px;
}

.email-compose-modal .ql-editor.ql-blank::before {
    color: var(--text-secondary);
    font-style: normal;
}

/* Profile Modal */
.profile-modal {
    max-width: 480px;
}

.profile-photo-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--bg-tertiary);
}

.profile-photo-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    color: white;
    overflow: hidden;
}

.profile-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.profile-logo-section {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--bg-tertiary);
}

.logo-upload-area {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-sm);
}

.logo-preview {
    width: 120px;
    height: 60px;
    border: 2px dashed var(--bg-tertiary);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 12px;
    overflow: hidden;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Users Admin Panel */
.users-modal {
    max-width: 900px;
}

.users-toolbar {
    margin-bottom: var(--spacing-md);
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th,
.users-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--bg-tertiary);
}

.users-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table td {
    font-size: 14px;
}

.users-table tbody tr:hover {
    background: var(--bg-hover);
}

.user-avatar-cell {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 14px;
    overflow: hidden;
}

.user-avatar-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge.admin {
    background: rgba(220, 53, 69, 0.2);
    color: #ff6b6b;
}

.role-badge.agent {
    background: rgba(79, 156, 249, 0.2);
    color: #4f9cf9;
}

.role-badge.client {
    background: rgba(40, 167, 69, 0.2);
    color: #5dd879;
}

.role-badge.mini {
    padding: 1px 6px;
    font-size: 10px;
    border-radius: 8px;
}

.role-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.user-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.user-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-danger {
    background: var(--critical-border);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* Transaction Detail Modal */
.txn-detail {
    max-height: 70vh;
    overflow-y: auto;
}

.txn-detail-header {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
}

.txn-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
}

.txn-address {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-delete-txn {
    padding: 6px 12px;
    font-size: 13px;
    background: transparent;
    border: 1px solid var(--danger, #dc3545);
    color: var(--danger, #dc3545);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-delete-txn:hover {
    background: var(--danger, #dc3545);
    color: white;
}

.txn-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.txn-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-top: var(--spacing-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.txn-detail-section {
    margin-bottom: var(--spacing-lg);
}

.txn-detail-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.section-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

.txn-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
    font-size: 13px;
}

.txn-info-grid div {
    color: var(--text-secondary);
}

.txn-info-grid strong {
    color: var(--text-muted);
}

/* Milestone Configuration */
.milestones-config {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.milestone-category {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--spacing-sm);
}

.category-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--bg-hover);
}

.category-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-xs);
}

.milestone-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.milestone-toggle:hover {
    background: var(--bg-hover);
}

.milestone-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.toggle-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.milestone-toggle input:checked + .toggle-label {
    color: var(--text-primary);
    font-weight: 500;
}


/* Form Elements */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-hover);
    border-radius: var(--border-radius);
    padding: var(--spacing-sm) var(--spacing-md);
    font-family: var(--font-primary);
    font-size: 14px;
    color: var(--text-primary);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Role checkboxes for multi-select */
.role-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

.role-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: var(--border-radius);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.role-checkbox:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.role-checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.role-checkbox input[type="checkbox"]:checked + span,
.role-checkbox:has(input:checked) {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* ============================================
   QUICK LINKS DROPDOWN
   ============================================ */

.quick-links-dropdown {
    display: none;
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 200;
}

.quick-links-dropdown.active {
    display: block;
}

.dropdown-header {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--bg-tertiary);
}

.dropdown-content {
    padding: var(--spacing-sm);
}

.dropdown-link {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    border-radius: var(--border-radius-sm);
    transition: background var(--transition-fast);
}

.dropdown-link:hover {
    background: var(--bg-tertiary);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    min-width: 280px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.warning {
    border-left: 3px solid var(--warning);
}

.toast.info {
    border-left: 3px solid var(--info);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

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

@media (max-width: 1200px) {
    .priority-panels {
        grid-template-columns: 1fr;
    }
    
    .widgets-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }
    
    .sidebar .logo-text,
    .sidebar .nav-item span,
    .sidebar .status-text {
        display: none;
    }
    
    .main-content {
        margin-left: var(--sidebar-collapsed);
    }
    
    .top-bar {
        flex-wrap: wrap;
        height: auto;
        padding: var(--spacing-md);
    }
    
    .quick-actions {
        order: 3;
        width: 100%;
        margin-top: var(--spacing-sm);
    }
    
    .section-controls {
        flex-wrap: wrap;
    }
    
    .search-input {
        width: 100%;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.hidden { display: none !important; }

/* ============================================
   FULL INTAKE FORM STYLES
   ============================================ */

.intake-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.intake-modal {
    background: var(--bg-secondary);
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.intake-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.intake-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
}

.intake-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.intake-close:hover {
    color: var(--text-primary);
}

.intake-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 24px;
    background: var(--bg-primary);
    overflow-x: auto;
}

.intake-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    font-size: 13px;
    transition: all 0.2s;
}

.intake-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.intake-tab.active {
    background: var(--primary);
    color: var(--bg-primary);
}

.tab-icon {
    font-size: 14px;
}

.tab-label {
    font-weight: 500;
}

.intake-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.intake-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.intake-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--warning);
}

.intake-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--bg-tertiary);
    background: var(--bg-primary);
}

.intake-progress {
    color: var(--text-muted);
    font-size: 13px;
}

/* Form Layout */
.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-row .form-group.flex-2 {
    flex: 2;
}

.form-row-3 {
    display: flex;
    gap: 12px;
}

.form-row-3 .form-group {
    flex: 1;
}

/* Contact Form Sections */
.contact-form-expanded {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 8px;
}

.form-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title::before {
    content: '';
    width: 3px;
    height: 12px;
    background: var(--accent-primary);
    border-radius: 2px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group label .required {
    color: var(--danger);
}

.form-group label .hint {
    color: var(--text-muted);
    font-weight: normal;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Toggle Buttons */
.toggle-group {
    display: flex;
    gap: 8px;
}

.toggle-btn {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.toggle-btn:hover {
    border-color: var(--primary);
}

.toggle-btn.active {
    background: var(--primary);
    color: #0f1419 !important;  /* Dark text on teal - visible in both modes */
    border-color: var(--primary);
    font-weight: 600;
}

/* Conditional Blocks */
.conditional-block {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: 8px;
    border-left: 3px solid var(--warning);
}

.conditional-block h4 {
    margin-top: 0;
}

/* Client Cards */
.client-card {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.client-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.client-header h4 {
    color: var(--text-primary);
    margin: 0;
}

.entity-fields {
    margin-bottom: 12px;
}

/* Sub-cards (co-agents, team members) */
.sub-card {
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
}

.sub-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 500;
}

/* Checkbox Row */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-row label {
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Buttons */
.btn-add {
    width: 100%;
    padding: 10px;
    border: 1px dashed var(--bg-tertiary);
    border-radius: 6px;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font-size: 14px;
    margin-top: 8px;
    transition: all 0.2s;
}

.btn-add:hover {
    border-color: var(--primary);
    background: rgba(95, 191, 191, 0.1);
}

.btn-remove {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 13px;
}

.btn-remove:hover {
    text-decoration: underline;
}

/* File Upload */
.file-upload-area {
    border: 2px dashed var(--bg-tertiary);
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-area:hover, .file-upload-area.dragover {
    border-color: var(--primary);
    background: rgba(95, 191, 191, 0.05);
}

.file-upload-area p {
    color: var(--text-secondary);
    margin: 0;
}

.file-upload-area .hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.file-list {
    margin-top: 12px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: 6px;
}

.file-name {
    color: var(--text-primary);
    font-size: 14px;
}

.file-size {
    color: var(--text-muted);
    font-size: 12px;
    margin-right: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .intake-modal {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .intake-tabs {
        padding: 8px 12px;
    }
    
    .tab-label {
        display: none;
    }
    
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
}

/* ============================================
   ADDRESS AUTOCOMPLETE STYLES
   ============================================ */

.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--bg-tertiary);
    transition: background 0.15s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: var(--bg-tertiary);
}

.autocomplete-item.no-results {
    color: var(--text-muted);
    cursor: default;
}

.autocomplete-item.no-results:hover {
    background: transparent;
}

.autocomplete-street {
    display: block;
    color: var(--text-primary);
    font-size: 14px;
}

.autocomplete-city {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}

/* ============================================
   SETTINGS MODAL
   ============================================ */

.settings-modal {
    max-width: 600px;
}

.settings-modal .modal-body {
    padding: 0;
}

.settings-modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--bg-tertiary);
    padding: var(--spacing-md) var(--spacing-lg) 0;
    gap: var(--spacing-xs);
}

.settings-modal-tab {
    padding: var(--spacing-sm) var(--spacing-md);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: -1px;
    transition: all var(--transition-fast);
}

.settings-modal-tab:hover {
    color: var(--text-primary);
}

.settings-modal-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.settings-panel {
    display: none;
    padding: var(--spacing-lg);
}

.settings-panel.active {
    display: block;
}

.settings-section {
    margin-bottom: var(--spacing-lg);
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-md);
}

/* Theme Toggle */
.theme-toggle-group {
    display: flex;
    gap: var(--spacing-sm);
}

.theme-toggle-btn {
    flex: 1;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.theme-toggle-btn:hover {
    border-color: var(--bg-hover);
}

.theme-toggle-btn.active {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.theme-toggle-icon {
    font-size: 24px;
    margin-bottom: var(--spacing-xs);
    display: block;
}

.theme-toggle-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.theme-toggle-btn.active .theme-toggle-label {
    color: var(--text-primary);
}

/* Accent Color Picker */
.color-swatches {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: var(--text-primary);
}

.color-swatch.active::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Calendar Color Swatches */
.calendar-color-swatches {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-top: var(--spacing-sm);
}

.calendar-color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.calendar-color-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.calendar-color-swatch.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--text-primary);
}

.settings-section-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

/* Widget Toggles */
.widget-toggles {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.widget-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.widget-toggle-info {
    flex: 1;
}

.widget-toggle-name {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.widget-toggle-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-hover);
    transition: var(--transition-fast);
    border-radius: 26px;
}

.toggle-switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: var(--transition-fast);
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-switch-slider {
    background-color: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-switch-slider:before {
    transform: translateX(22px);
    background-color: white;
}

/* Progress Meter Style Selector */
.progress-style-options {
    display: flex;
    gap: var(--spacing-md);
}

.progress-style-option {
    flex: 1;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-align: center;
    transition: all var(--transition-fast);
}

.progress-style-option:hover {
    border-color: var(--bg-hover);
}

.progress-style-option.active {
    border-color: var(--accent-primary);
}

.progress-style-preview {
    margin-bottom: var(--spacing-sm);
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-style-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.progress-style-option.active .progress-style-label {
    color: var(--text-primary);
}

/* Settings Gear Button */
.settings-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.settings-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.settings-btn svg {
    width: 20px;
    height: 20px;
}

/* Alert Tracking Button */
.alert-tracking-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
}

.alert-tracking-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.alert-tracking-btn svg {
    width: 20px;
    height: 20px;
}

.alert-tracking-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Alert Tracking Panel */
.alert-tracking-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.alert-tracking-panel.open {
    right: 0;
}

.alert-panel-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
}

.alert-panel-header h2 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.alert-panel-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    line-height: 1;
}

.alert-panel-close:hover {
    color: var(--text-primary);
}

.alert-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.alert-section {
    margin-bottom: 1.5rem;
}

.alert-section-header {
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-section-header.overdue {
    background: #FEE2E2;
    color: #991B1B;
}

.alert-section-header.due-today {
    background: #FEF3C7;
    color: #92400E;
}

.alert-section-header.upcoming {
    background: #DBEAFE;
    color: #1E40AF;
}

.alert-section-header.completed {
    background: #D1FAE5;
    color: #065F46;
}

.alert-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.alert-card.overdue {
    border-left: 4px solid var(--danger);
}

.alert-card.urgent {
    border-left: 4px solid var(--warning);
}

.alert-card-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-card-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.alert-card-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.alert-card-status span {
    display: inline-block;
    margin-right: 1rem;
}

.alert-card-actions {
    display: flex;
    gap: 0.5rem;
}

.alert-card-actions .btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

/* Create Alert Modal */
.create-alert-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.create-alert-modal {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    width: 500px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-xl);
}

.create-alert-modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.create-alert-modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
}

.create-alert-modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.create-alert-modal-body {
    padding: 1.25rem;
}

.create-alert-modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--bg-secondary);
}

/* ============================================
   PROGRESS METER STYLES
   ============================================ */

/* Bar Style (default) */
.progress-meter {
    margin: var(--spacing-sm) 0;
}

.progress-meter-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-meter-bar .progress-meter-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-meter-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Circle Style */
.progress-meter-circle {
    width: 48px;
    height: 48px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.progress-meter-circle svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.progress-meter-circle-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 4;
}

.progress-meter-circle-fill {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease;
}

.progress-meter-circle-text {
    position: absolute;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Steps Style */
.progress-meter-steps {
    display: flex;
    gap: 4px;
    align-items: center;
}

.progress-meter-step {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    transition: background 0.2s ease;
}

.progress-meter-step.completed {
    background: var(--accent-primary);
}

.progress-meter-step.current {
    background: linear-gradient(90deg, var(--accent-primary) 50%, var(--bg-tertiary) 50%);
}

/* Progress meter in transaction cards */
.transaction-card .progress-meter {
    margin-top: var(--spacing-sm);
}

/* Widget hidden state */
.widget.hidden-widget {
    display: none;
}

/* Priority panel hidden state */
.priority-panel.hidden-widget {
    display: none;
}

/* Transactions section hidden state */
.transactions-section.hidden-widget {
    display: none;
}

/* ============================================
   TRIGGERS MANAGEMENT PAGE
   ============================================ */

.triggers-page {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.triggers-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
}

.triggers-header-info h3 {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.triggers-description {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.triggers-header-stats {
    display: flex;
    gap: var(--spacing-lg);
}

.trigger-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.trigger-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.trigger-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.triggers-content {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--spacing-lg);
}

@media (max-width: 1024px) {
    .triggers-content {
        grid-template-columns: 1fr;
    }

    .triggers-activity {
        order: -1;
    }
}

.triggers-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* Trigger Categories */
.trigger-category {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--bg-tertiary);
    overflow: hidden;
}

.trigger-category-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
}

.trigger-category-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    border-radius: var(--border-radius);
}

.trigger-category-icon svg {
    width: 18px;
    height: 18px;
    stroke: white;
}

.trigger-category-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.trigger-category-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.trigger-category-items {
    display: flex;
    flex-direction: column;
}

/* Trigger Items */
.trigger-item {
    border-bottom: 1px solid var(--bg-tertiary);
    transition: background 0.2s ease;
}

.trigger-item:last-child {
    border-bottom: none;
}

.trigger-item:hover {
    background: var(--bg-hover);
}

.trigger-item.disabled {
    opacity: 0.6;
}

.trigger-item-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    cursor: pointer;
}

.trigger-item-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    min-width: 0;
}

.trigger-action-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.trigger-action-icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-secondary);
}

.trigger-action-icon.send_email svg { stroke: #4f9cf9; }
.trigger-action-icon.send_sms svg { stroke: #10b981; }
.trigger-action-icon.create_task svg { stroke: #f59e0b; }
.trigger-action-icon.update_status svg { stroke: #8b5cf6; }
.trigger-action-icon.notify_user svg { stroke: #ec4899; }

.trigger-item-info {
    min-width: 0;
}

.trigger-item-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trigger-item-summary {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.trigger-item-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-shrink: 0;
}

.trigger-action-badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 4px;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Trigger Toggle Switch */
.trigger-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.trigger-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.trigger-toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-hover);
    border-radius: 22px;
    transition: all 0.3s ease;
}

.trigger-toggle-slider:before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.trigger-toggle input:checked + .trigger-toggle-slider {
    background: var(--success);
}

.trigger-toggle input:checked + .trigger-toggle-slider:before {
    transform: translateX(18px);
}

/* Trigger Expanded Section */
.trigger-expanded {
    padding: var(--spacing-md);
    padding-top: 0;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--bg-hover);
}

.trigger-expanded-section {
    margin-bottom: var(--spacing-md);
}

.trigger-expanded-section:last-child {
    margin-bottom: 0;
}

.trigger-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.trigger-section-value {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.trigger-edit-field {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.trigger-input {
    width: 80px;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--bg-hover);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.trigger-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.trigger-recipients {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.trigger-recipient-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.trigger-recipient-option:hover {
    background: var(--bg-hover);
}

.trigger-recipient-option input {
    margin: 0;
}

.trigger-expanded-actions {
    display: flex;
    gap: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    border-top: 1px solid var(--bg-hover);
}

.trigger-expanded-actions .btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

/* Triggers Activity Panel */
.triggers-activity {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--bg-tertiary);
    overflow: hidden;
    height: fit-content;
}

.activity-header {
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
}

.activity-header h4 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-empty {
    padding: var(--spacing-lg);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
}

.activity-icon.success {
    background: rgba(40, 167, 69, 0.2);
    color: var(--success);
}

.activity-icon.error {
    background: rgba(220, 53, 69, 0.2);
    color: var(--danger);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-trigger-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-message {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Trigger Preview Modal */
.trigger-preview {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.preview-header {
    display: flex;
    justify-content: center;
}

.preview-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    font-weight: 600;
}

.preview-badge.success {
    background: rgba(40, 167, 69, 0.2);
    color: var(--success);
}

.preview-badge.warning {
    background: rgba(255, 193, 7, 0.2);
    color: var(--warning);
}

.preview-section {
    background: var(--bg-tertiary);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
}

.preview-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.preview-detail {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.preview-detail:last-child {
    margin-bottom: 0;
}

.preview-label {
    color: var(--text-muted);
}

.preview-value {
    color: var(--text-primary);
}

/* Trigger Modal and Form */
.triggers-header-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.trigger-modal {
    max-width: 600px;
    width: 95%;
}

.trigger-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.trigger-form-section {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
}

.trigger-form .form-row {
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-start;
}

.trigger-form .form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.trigger-form .form-group.flex-1 {
    flex: 1;
}

.trigger-form .form-group.flex-2 {
    flex: 2;
}

.trigger-form .form-input,
.trigger-form .form-select,
.trigger-form .form-textarea {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--bg-hover);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 100%;
}

.trigger-form .form-input:focus,
.trigger-form .form-select:focus,
.trigger-form .form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.trigger-form label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trigger-form .form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.trigger-form .modal-footer {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--bg-tertiary);
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

.trigger-form .modal-footer .btn-danger {
    margin-right: auto;
}

.trigger-form .toggle-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.trigger-form .toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

/* ============================================
   DATE FORMULAS STYLES
   ============================================ */

.dates-page {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    padding: var(--spacing-md);
}

.dates-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.dates-header-info h3 {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.dates-description {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.dates-info-box {
    background: var(--accent-bg);
    border: 1px solid var(--accent-border);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-md);
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-start;
}

.dates-info-box .info-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--accent-text);
}

.dates-info-box div {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.dates-info-box strong {
    color: var(--text-primary);
}

.dates-info-box em {
    color: var(--accent-text);
    font-style: normal;
    font-weight: 500;
}

.dates-section {
    margin-top: var(--spacing-md);
}

.dates-section h4 {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.dates-section .section-description {
    margin: 0 0 var(--spacing-md) 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.dates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--spacing-md);
}

.date-formula-card {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.date-formula-card:hover {
    border-color: var(--accent-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.formula-card-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--bg-tertiary);
}

.formula-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-bg);
    border-radius: var(--border-radius-md);
    color: var(--accent-text);
}

.formula-icon svg {
    width: 18px;
    height: 18px;
}

.formula-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.formula-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.formula-type-badge {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.formula-type-badge.business-days {
    color: var(--success);
    font-weight: 500;
}

.formula-card-body {
    padding: var(--spacing-md);
}

.formula-description {
    margin: 0 0 var(--spacing-md) 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.formula-offset-editor {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.formula-offset-editor label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    flex: 1;
}

.formula-offset-input {
    width: 60px;
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    text-align: center;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.formula-offset-input:focus {
    outline: none;
    border-color: var(--accent-border);
    box-shadow: 0 0 0 2px var(--accent-bg);
}

.business-day-note {
    font-size: 0.75rem;
    color: var(--success);
    font-style: italic;
}

.formula-note {
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-sm);
}

.formula-note em {
    font-style: normal;
}

/* ============================================
   PROCESS TEMPLATES STYLES
   ============================================ */

.templates-page {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    padding: var(--spacing-md);
}

.templates-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.templates-header-info h3 {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.templates-description {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.templates-header-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.templates-info-box {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--accent-bg);
    border: 1px solid var(--accent-border);
    border-radius: var(--border-radius-lg);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.templates-info-box .info-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--accent);
}

.templates-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xxl);
    text-align: center;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 2px dashed var(--bg-tertiary);
}

.templates-empty-state svg {
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

.templates-empty-state h4 {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.templates-empty-state p {
    margin: 0 0 var(--spacing-lg) 0;
    color: var(--text-muted);
}

.templates-section {
    margin-bottom: var(--spacing-lg);
}

.templates-section h4 {
    margin: 0 0 var(--spacing-md) 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--bg-tertiary);
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--spacing-md);
}

.template-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--bg-tertiary);
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.template-card:hover {
    border-color: var(--accent-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.template-card.inactive {
    opacity: 0.6;
}

.template-card-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
}

.template-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-bg);
    border-radius: var(--border-radius-md);
    color: var(--accent);
}

.template-icon svg {
    width: 20px;
    height: 20px;
}

.template-info {
    flex: 1;
    min-width: 0;
}

.template-name {
    display: block;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-type-badge {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: var(--border-radius-sm);
    margin-top: 2px;
}

.template-actions {
    display: flex;
    gap: var(--spacing-xs);
}

/* Template card action buttons - ensure visibility */
.template-actions .btn-icon {
    color: var(--text-muted);
    opacity: 0.7;
    background: var(--bg-tertiary);
    border-radius: 4px;
    padding: 4px;
}

.template-actions .btn-icon:hover {
    opacity: 1;
    color: var(--text-primary);
    background: var(--bg-hover);
}

.template-actions .btn-icon svg {
    stroke: currentColor;
}

.template-card-body {
    padding: var(--spacing-md);
}

.template-description {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.template-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.template-task-count {
    display: flex;
    align-items: center;
    gap: 4px;
}

.template-task-count svg {
    color: var(--success);
}

.template-card-tasks {
    background: var(--bg-tertiary);
    padding: var(--spacing-sm) var(--spacing-md);
    border-top: 1px solid var(--bg-tertiary);
}

.template-tasks-preview {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.task-preview-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.8125rem;
}

.task-number {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 50%;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
}

.task-preview-item .task-title {
    flex: 1;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-preview-item .task-assignee {
    font-size: 0.6875rem;
    padding: 2px 6px;
    background: var(--accent-bg);
    color: var(--accent);
    border-radius: var(--border-radius-sm);
    font-weight: 500;
}

.task-preview-more {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding-left: 28px;
}

/* Template Modal */
.template-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.template-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.template-modal {
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.2s;
}

.template-modal-overlay.active .template-modal {
    transform: translateY(0);
}

.template-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--bg-tertiary);
}

.template-modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.template-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.template-modal-close:hover {
    color: var(--text-primary);
}

.template-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
}

.template-form-group {
    margin-bottom: var(--spacing-md);
}

.template-form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.template-form-group input,
.template-form-group select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* Defensive fix for Transaction Type dropdown text rendering */
#templateType,
#templateType option,
.template-modal select,
.template-modal select option,
.template-modal-body select,
.template-modal-body select option {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    -webkit-text-security: none !important;
    text-security: none !important;
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    text-transform: none !important;
    unicode-bidi: normal !important;
}

/* Ensure native select appearance is overridden */
.template-form-group select {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    padding-right: 32px !important;
}

/* Force selected value visibility in closed state */
.template-form-group select:not(:focus) {
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}

[data-theme="dark"] #templateType,
[data-theme="dark"] .template-form-group select {
    color: #e7eaed !important;
    -webkit-text-fill-color: #e7eaed !important;
}

[data-theme="light"] #templateType,
[data-theme="light"] .template-form-group select {
    color: #1e293b !important;
    -webkit-text-fill-color: #1e293b !important;
}

.template-form-group input:focus,
.template-form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-bg);
}

.template-tasks-section {
    margin-top: var(--spacing-lg);
}

.template-tasks-list {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-sm);
    max-height: 300px;
    overflow-y: auto;
}

.empty-tasks-message {
    padding: var(--spacing-lg);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.template-task-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
}

.template-task-item:last-child {
    border-bottom: none;
}

.task-item-drag {
    color: var(--text-muted);
    cursor: grab;
    padding-top: var(--spacing-xs);
}

.task-order-control {
    display: flex;
    align-items: center;
    margin-right: 8px;
}

.task-order-input {
    width: 45px;
    padding: 4px 6px;
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    text-align: center;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.task-order-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.task-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.task-title-input {
    width: 100%;
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.task-item-row {
    display: flex;
    gap: var(--spacing-sm);
}

.task-assignee-select {
    flex: 0 0 120px;
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.task-due-offset {
    flex: 1;
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.task-due-offset::placeholder {
    color: var(--text-muted);
}

.remove-task-btn {
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

.remove-task-btn:hover {
    color: var(--danger);
}

.template-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--bg-tertiary);
}

/* ============================================
   AUDIT LOG STYLES
   ============================================ */

.audit-page {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    padding: var(--spacing-md);
}

.audit-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.audit-header-info h3 {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.audit-description {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.audit-header-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.audit-header-actions .btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.audit-filters {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-md);
    border: 1px solid var(--bg-tertiary);
}

.audit-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: flex-end;
}

.audit-filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.audit-filter-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.date-range-inputs {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.date-range-inputs span {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.date-range-inputs .form-input {
    width: 140px;
}

.audit-filter-group .form-input,
.audit-filter-group .form-select {
    min-width: 150px;
}

.audit-filter-actions {
    flex-direction: row;
    gap: var(--spacing-sm);
    margin-left: auto;
}

.audit-integrity-banner {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
}

.audit-integrity-banner.success {
    background: rgba(40, 167, 69, 0.15);
    border: 1px solid rgba(40, 167, 69, 0.3);
    color: var(--success);
}

.audit-integrity-banner.error {
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: var(--danger);
}

.audit-integrity-banner svg {
    flex-shrink: 0;
}

.audit-table-container {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--bg-tertiary);
    overflow: hidden;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
}

.audit-table thead {
    background: var(--bg-tertiary);
}

.audit-table th {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--bg-hover);
}

.audit-table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.audit-table tbody tr:hover {
    background: var(--bg-hover);
}

.audit-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
}

.audit-table td.loading,
.audit-table td.empty,
.audit-table td.error {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
}

.audit-table td.error {
    color: var(--danger);
}

.audit-timestamp {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    white-space: nowrap;
}

.audit-user {
    font-weight: 500;
    color: var(--text-primary);
}

.audit-action-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.audit-action-badge.action-create {
    background: rgba(40, 167, 69, 0.2);
    color: var(--success);
}

.audit-action-badge.action-update {
    background: rgba(13, 110, 253, 0.2);
    color: var(--accent-primary);
}

.audit-action-badge.action-delete {
    background: rgba(220, 53, 69, 0.2);
    color: var(--danger);
}

.audit-action-badge.action-complete {
    background: rgba(111, 66, 193, 0.2);
    color: #9b7dbd;
}

.audit-action-badge.action-execute {
    background: rgba(255, 193, 7, 0.2);
    color: var(--warning);
}

.audit-action-badge.action-auth {
    background: rgba(23, 162, 184, 0.2);
    color: #5bc0de;
}

.audit-action-badge.action-default {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.audit-entity-id {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.audit-details {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-muted);
}

.audit-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.audit-pagination-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.audit-pagination-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.audit-page-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 0 var(--spacing-sm);
}

/* Audit Detail Modal */
.audit-detail-modal {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.audit-detail-section {
    background: var(--bg-tertiary);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
}

.audit-detail-section h4 {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.audit-detail-row {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid var(--bg-hover);
}

.audit-detail-row:last-child {
    border-bottom: none;
}

.audit-detail-label {
    min-width: 120px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.audit-detail-value {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-word;
}

.audit-detail-value.hash {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.audit-hash-section {
    background: var(--bg-secondary);
    border: 1px dashed var(--bg-hover);
}

/* Spinner for loading states */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .audit-filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .audit-filter-actions {
        margin-left: 0;
        justify-content: flex-end;
    }

    .audit-header {
        flex-direction: column;
    }

    .audit-header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .audit-table-container {
        overflow-x: auto;
    }

    .audit-pagination {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================
   PENDING INTAKES WIDGET
   ============================================ */

.pending-intakes-widget {
    background: var(--bg-secondary);
    border: 2px solid var(--warning);
    border-radius: var(--border-radius-lg);
}

.pending-intakes-widget .widget-header h3 {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.pending-badge {
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.pending-intakes-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-height: 400px;
    overflow-y: auto;
}

.pending-intake-item {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    border-left: 3px solid var(--warning);
}

.pending-intake-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-xs);
}

.pending-intake-address {
    font-weight: 600;
    color: var(--text-primary);
}

.pending-intake-time {
    font-size: 12px;
    color: var(--text-muted);
}

.pending-intake-meta {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

.pending-intake-agent {
    color: var(--accent-primary);
}

.pending-intake-type {
    text-transform: capitalize;
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: 4px;
}

.pending-intake-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.pending-intake-actions .btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
}

.btn-success:hover {
    background: #1e7e34;
}

/* ============================================
   WIZARD PENDING APPROVALS (Hotfix 7I.4)
   ============================================ */

.wizard-approvals-widget {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    border-radius: var(--border-radius-lg);
}

.wizard-approvals-widget .widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wizard-approvals-widget .widget-header h3 {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.widget-header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border-radius: 4px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
}

.wizard-approvals-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-height: 400px;
    overflow-y: auto;
}

.wizard-approval-item {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    border-left: 3px solid var(--accent-primary);
}

.wizard-approval-header {
    margin-bottom: var(--spacing-xs);
}

.wizard-approval-goal {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4;
}

.wizard-approval-meta {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xs);
    font-size: 12px;
    color: var(--text-secondary);
}

.wizard-approval-address {
    color: var(--accent-primary);
}

.wizard-approval-date {
    color: var(--text-muted);
}

.wizard-approval-tasks {
    margin: var(--spacing-sm) 0;
    padding: var(--spacing-sm);
    background: var(--bg-hover);
    border-radius: var(--border-radius);
}

.wizard-task-preview {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 2px 0;
    border-bottom: 1px solid var(--border-color);
}

.wizard-task-preview:last-child {
    border-bottom: none;
}

.wizard-task-more {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    margin-top: var(--spacing-xs);
}

.wizard-approval-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.wizard-approval-actions .btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-link {
    background: transparent;
    color: var(--accent-primary);
    border: none;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--accent-secondary);
}

/* Archive/Restore Styles */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.badge-archived {
    background: var(--warning);
    color: #000;
}

.archived-row {
    opacity: 0.7;
    background: var(--bg-tertiary);
}

.action-cell {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}

.view-header-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

#archivedContactsToggle.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Merge Codes Management */
.merge-codes-page {
    padding: var(--spacing-md);
}

.merge-codes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.merge-codes-header h3 {
    margin: 0;
}

.merge-codes-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.merge-codes-filters {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.merge-codes-filters .form-select {
    min-width: 180px;
}

.merge-codes-table-container {
    overflow-x: auto;
}

.merge-code-token {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    color: var(--accent-primary);
}

.badge-auto {
    background: #3b82f6;
    color: white;
}

.badge-manual {
    background: #f59e0b;
    color: #000;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.inactive-row {
    opacity: 0.5;
    background: var(--bg-tertiary);
}

.btn-xs {
    padding: 2px 8px;
    font-size: 11px;
}

/* Merge Code Picker (Reusable Component) */
.merge-picker {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    width: 280px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

.merge-picker-header {
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
}

.merge-picker-title {
    font-weight: 600;
    font-size: 14px;
}

.merge-picker-search {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.merge-picker-tabs {
    display: flex;
    padding: var(--spacing-xs);
    gap: 2px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.picker-tab {
    padding: 4px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.picker-tab:hover {
    background: var(--bg-tertiary);
}

.picker-tab.active {
    background: var(--accent-primary);
    color: white;
}

.merge-picker-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-xs);
}

.picker-category {
    margin-bottom: var(--spacing-xs);
}

.picker-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.picker-category-header:hover {
    background: var(--border);
}

.picker-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.picker-category.collapsed .picker-arrow {
    transform: rotate(-90deg);
}

.picker-category.collapsed .picker-category-items {
    display: none;
}

.picker-category-items {
    padding: var(--spacing-xs) 0;
}

.picker-item {
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
}

.picker-item:hover {
    background: var(--bg-tertiary);
}

.picker-code {
    font-family: monospace;
    font-size: 12px;
    color: var(--accent-primary);
}

.picker-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.merge-picker-footer {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
}

/* Intake Details Modal */
.intake-details {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.intake-detail-section {
    background: var(--bg-tertiary);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
}

.intake-detail-section h4 {
    margin: 0 0 var(--spacing-sm) 0;
    color: var(--accent-primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.intake-detail-section p {
    margin: var(--spacing-xs) 0;
    color: var(--text-primary);
}

/* ============================================
   SINGLE TRANSACTION PAGE (STP) - 3-COLUMN LAYOUT
   ============================================ */

/* STP View Header */
.stp-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.stp-header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.stp-back-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.stp-back-btn svg {
    width: 16px;
    height: 16px;
}

.stp-title-block h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.stp-subtitle {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.stp-type-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.stp-type-badge.buyer { background: #1e3a5f; color: #60a5fa; }
.stp-type-badge.seller { background: #3d2f1f; color: #fbbf24; }

.stp-header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.stp-header-actions .btn svg {
    width: 14px;
    height: 14px;
}

/* 3-Column Main Grid */
.stp-main-grid {
    display: grid;
    grid-template-columns: 300px 1fr 250px;
    height: calc(100vh - var(--top-bar-height) - 72px);
    overflow: hidden;
}

@media (max-width: 1200px) {
    .stp-main-grid {
        grid-template-columns: 280px 1fr;
    }
    .stp-right-column {
        display: none;
    }
}

@media (max-width: 900px) {
    .stp-main-grid {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    .stp-left-column {
        display: none;
    }
}

/* LEFT COLUMN: Info Carousel */
.stp-left-column {
    background: var(--bg-secondary);
    border-right: 1px solid var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stp-carousel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
    background: var(--bg-tertiary);
}

.stp-carousel-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stp-carousel-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.stp-carousel-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: var(--bg-hover);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.stp-carousel-btn:hover:not(:disabled) {
    background: var(--accent-primary);
    color: white;
}

.stp-carousel-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.stp-carousel-btn svg {
    width: 14px;
    height: 14px;
}

.stp-carousel-dots {
    display: flex;
    gap: 6px;
    padding: 0 var(--spacing-xs);
}

.stp-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bg-hover);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.stp-dot.active {
    background: var(--accent-primary);
    width: 16px;
    border-radius: 3px;
}

.stp-carousel-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.stp-carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.3s ease;
}

.stp-carousel-panel {
    min-width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: var(--spacing-md);
}

/* Info Panel Styles */
.stp-info-section {
    margin-bottom: var(--spacing-lg);
}

.stp-info-section:last-child {
    margin-bottom: 0;
}

.stp-info-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.stp-info-title svg {
    width: 12px;
    height: 12px;
}

.stp-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid var(--bg-tertiary);
    gap: var(--spacing-sm);
}

.stp-info-row:last-child {
    border-bottom: none;
}

.stp-info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.stp-info-value {
    font-size: 0.8125rem;
    color: var(--text-primary);
    text-align: right;
    word-break: break-word;
}

.stp-info-value.empty {
    color: var(--text-muted);
    font-style: italic;
}

/* Allocation of Costs Page */
.stp-alloc-section {
    margin-bottom: var(--spacing-lg);
}

.stp-alloc-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: var(--spacing-sm) 0;
    border-bottom: 2px solid var(--accent-primary);
    margin-bottom: var(--spacing-md);
}

.stp-alloc-section-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
    font-style: italic;
}

.stp-alloc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--bg-tertiary);
    gap: var(--spacing-md);
}

.stp-alloc-row:last-child {
    border-bottom: none;
}

.stp-alloc-subrow {
    background: var(--bg-primary);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-sm);
    margin: var(--spacing-xs) 0;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.stp-alloc-label {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.stp-alloc-sublabel {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: var(--spacing-xs);
}

.stp-alloc-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-shrink: 0;
}

.stp-alloc-radio-group {
    display: flex;
    gap: var(--spacing-sm);
}

.stp-alloc-radio {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.stp-alloc-radio input[type="radio"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.stp-alloc-fifty {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent-primary);
    background: var(--accent-muted);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: var(--spacing-xs);
}

.stp-alloc-fixed {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    font-style: italic;
}

.stp-alloc-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 0;
}

.stp-alloc-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.stp-alloc-input {
    padding: 6px 10px;
    font-size: 0.8125rem;
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-width: 120px;
}

.stp-alloc-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.stp-alloc-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.stp-alloc-subsection {
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm);
    background: var(--bg-primary);
    border-radius: var(--border-radius-sm);
}

.stp-alloc-subsection .stp-alloc-input {
    display: block;
    width: 100%;
    margin-top: var(--spacing-xs);
}

/* Items Included Grid */
.stp-items-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    margin-top: var(--spacing-sm);
}

.stp-items-column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

@media (max-width: 768px) {
    .stp-items-grid {
        grid-template-columns: 1fr;
    }

    .stp-alloc-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .stp-alloc-controls {
        margin-top: var(--spacing-xs);
    }
}

/* Participant Cards */
.stp-participant {
    background: var(--bg-primary);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.stp-participant:last-child {
    margin-bottom: 0;
}

.stp-participant-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.stp-participant-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.stp-participant-info {
    flex: 1;
    min-width: 0;
}

.stp-participant-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.stp-participant-role {
    font-size: 0.6875rem;
    color: var(--accent-primary);
}

.stp-participant-contact {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.stp-participant-contact a {
    color: var(--accent-secondary);
    text-decoration: none;
}

.stp-participant-contact a:hover {
    text-decoration: underline;
}

/* CENTER COLUMN: Tabbed Workspace */
.stp-center-column {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

.stp-workspace-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    padding: 0 var(--spacing-md);
    gap: 0;
    overflow-x: auto;
}

.stp-tab {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color var(--transition-fast);
}

.stp-tab:hover {
    color: var(--text-primary);
}

.stp-tab.active {
    color: var(--accent-primary);
}

.stp-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: var(--spacing-md);
    right: var(--spacing-md);
    height: 2px;
    background: var(--accent-primary);
    border-radius: 1px 1px 0 0;
}

.stp-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    border-radius: 9px;
    margin-left: var(--spacing-xs);
}

.stp-tab.active .stp-tab-badge {
    background: var(--accent-primary);
    color: white;
}

.stp-workspace-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.stp-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    padding: var(--spacing-md);
    display: none;
}

.stp-panel.active {
    display: block;
}

/* Tasks Panel */
.stp-tasks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.stp-task-filters {
    display: flex;
    gap: var(--spacing-xs);
}

.stp-filter-btn {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--bg-tertiary);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.stp-filter-btn:hover {
    background: var(--bg-hover);
}

.stp-filter-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.stp-tasks-progress {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
}

.stp-progress-stat {
    text-align: center;
}

.stp-stat-value {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stp-stat-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.stp-progress-bar-wrap {
    flex: 1;
    min-width: 100px;
}

.stp-progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.stp-progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width var(--transition-normal);
    width: 0;
}

.stp-progress-pct {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
    text-align: right;
    margin-top: 2px;
}

.stp-task-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.stp-task-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.stp-task-item:hover {
    border-color: var(--bg-hover);
}

.stp-task-item.completed {
    opacity: 0.6;
}

.stp-task-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--bg-hover);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all var(--transition-fast);
}

.stp-task-checkbox:hover {
    border-color: var(--accent-primary);
}

.stp-task-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
}

.stp-task-checkbox svg {
    display: none;
    width: 12px;
    height: 12px;
    color: white;
}

.stp-task-checkbox.checked svg {
    display: block;
}

.stp-task-content {
    flex: 1;
    min-width: 0;
}

.stp-task-title {
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.stp-task-item.completed .stp-task-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.stp-task-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: 2px;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.stp-task-due.overdue {
    color: var(--danger);
}

.stp-task-due.today {
    color: var(--warning);
}

.stp-task-assignee {
    padding: 1px 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
}

/* Stages Panel */
.stp-stages-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--bg-hover);
}

.stp-stages-progress-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.stp-stages-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.stp-stages-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--success));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.stp-stages-progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.stp-stages-timeline {
    margin-bottom: var(--spacing-lg);
}

.stp-stages-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.stp-stage-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.stp-stage-item:hover {
    background: var(--bg-hover);
}

.stp-stage-item.selected {
    background: var(--bg-secondary);
    border: 1px solid var(--accent-primary);
}

.stp-stage-indicator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.stp-stage-item.pending .stp-stage-indicator {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 2px solid var(--bg-hover);
}

.stp-stage-item.active .stp-stage-indicator {
    background: var(--accent-primary);
    color: white;
    border: 2px solid var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2);
}

.stp-stage-item.completed .stp-stage-indicator {
    background: var(--success);
    color: white;
    border: 2px solid var(--success);
}

.stp-stage-indicator .stage-number {
    font-size: 0.75rem;
}

.stp-stage-indicator svg {
    width: 14px;
    height: 14px;
}

.stp-stage-content {
    flex: 1;
    min-width: 0;
}

.stp-stage-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.stp-stage-item.pending .stp-stage-name {
    color: var(--text-muted);
}

.stp-stage-item.active .stp-stage-name {
    color: var(--accent-primary);
}

.stp-stage-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.stp-stage-pct {
    padding: 1px 5px;
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.stp-stage-progress-mini {
    margin-top: 4px;
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.stp-stage-progress-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
}

.stp-stage-connector {
    width: 2px;
    height: 16px;
    background: var(--bg-hover);
    margin-left: 26px;
}

.stp-stage-connector.completed {
    background: var(--success);
}

/* Stage Tasks Section */
.stp-stage-tasks-section {
    border-top: 1px solid var(--bg-hover);
    padding-top: var(--spacing-md);
}

.stp-stage-tasks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.stp-stage-task-filters {
    display: flex;
    gap: var(--spacing-xs);
}

.stp-stage-filter-btn {
    padding: 4px 10px;
    font-size: 0.6875rem;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.stp-stage-filter-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.stp-stage-filter-btn.active {
    background: var(--accent-primary);
    color: white;
}

.stp-stage-tasks-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    max-height: 300px;
    overflow-y: auto;
}

/* Stage transition task styling */
.stp-task-item.stage-transition {
    border-left: 3px solid var(--accent-primary);
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.05), transparent);
}

.stage-transition-badge {
    display: inline-block;
    padding: 1px 6px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--accent-primary);
    color: white;
    border-radius: 3px;
    margin-right: 4px;
}

/* Task type badges */
.stp-task-type {
    padding: 1px 5px;
    font-size: 0.625rem;
    text-transform: uppercase;
    border-radius: 3px;
    font-weight: 500;
}

.stp-task-type.type-task {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.stp-task-type.type-doc {
    background: rgba(59, 130, 246, 0.1);
    color: rgb(59, 130, 246);
}

.stp-task-type.type-date {
    background: rgba(245, 158, 11, 0.1);
    color: rgb(217, 119, 6);
}

.stp-task-type.type-status {
    background: rgba(79, 70, 229, 0.1);
    color: var(--accent-primary);
}

/* Task trigger condition */
.stp-task-trigger {
    margin-top: 4px;
    font-size: 0.625rem;
    color: var(--text-muted);
    font-style: italic;
    padding-left: 8px;
    border-left: 2px solid var(--bg-hover);
}

/* Tentative due date styling */
.stp-task-due.tentative {
    color: var(--text-muted);
    font-style: italic;
}

/* Dates Panel */
.stp-dates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--spacing-md);
}

.stp-date-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    border-left: 3px solid var(--bg-tertiary);
}

.stp-date-card.completed { border-left-color: var(--success); }
.stp-date-card.today { border-left-color: var(--warning); }
.stp-date-card.overdue { border-left-color: var(--danger); }

.stp-date-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xs);
}

.stp-date-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.stp-date-status {
    font-size: 0.6875rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.stp-date-status.completed { background: rgba(40, 167, 69, 0.2); color: var(--success); }
.stp-date-status.today { background: rgba(255, 193, 7, 0.2); color: var(--warning); }
.stp-date-status.overdue { background: rgba(220, 53, 69, 0.2); color: var(--danger); }
.stp-date-status.upcoming { background: var(--bg-tertiary); color: var(--text-secondary); }

.stp-date-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stp-date-days {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Expanded Dates Panel - Section Layout */
.stp-date-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
}

.stp-date-section-header {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.stp-date-section-content {
    padding: var(--spacing-xs) 0;
}

.stp-date-row {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    border-left: 3px solid transparent;
    transition: background var(--transition-fast);
}

.stp-date-row:hover {
    background: var(--bg-tertiary);
}

.stp-date-row.overdue { border-left-color: var(--danger); }
.stp-date-row.today { border-left-color: var(--warning); }
.stp-date-row.warning { border-left-color: #F59E0B; }
.stp-date-row.completed { border-left-color: var(--success); }
.stp-date-row.upcoming { border-left-color: var(--accent-primary); }

.stp-date-row-left {
    flex: 1;
    min-width: 180px;
}

.stp-date-row-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.stp-date-row-center {
    flex: 1.5;
    text-align: center;
}

.stp-date-row-value {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.stp-date-row-value.not-set {
    color: var(--text-muted);
    font-style: italic;
}

.stp-date-row-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    min-width: 140px;
    justify-content: flex-end;
}

.stp-date-days-badge {
    font-size: 0.6875rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.stp-date-days-badge.overdue {
    background: rgba(220, 53, 69, 0.15);
    color: var(--danger);
}

.stp-date-days-badge.today {
    background: rgba(255, 193, 7, 0.15);
    color: #D97706;
}

.stp-date-auto-badge {
    font-size: 0.625rem;
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(13, 148, 136, 0.15);
    color: #0D9488;
    text-transform: uppercase;
    font-weight: 600;
}

.stp-date-edit-btn {
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.stp-date-edit-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.stp-date-edit-btn.set {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.stp-date-edit-btn.set:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* Custom Date Styles (Phase 6c) */
.stp-date-row.custom {
    border-left-color: #8B5CF6;
}

.stp-date-row-formula {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.stp-empty-hint {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-style: italic;
}

.stp-add-custom-btn {
    margin-top: var(--spacing-sm);
    width: 100%;
    justify-content: center;
}

.stp-custom-date-edit-btn {
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.stp-custom-date-edit-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.stp-custom-date-delete-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s;
}

.stp-custom-date-delete-btn:hover {
    color: var(--danger);
    background: var(--bg-tertiary);
    opacity: 1;
}

/* Key Date Modal Styles */
.key-date-modal-content {
    padding: var(--spacing-md);
}

.key-date-entry-method {
    margin-bottom: var(--spacing-lg);
}

.key-date-entry-method label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.key-date-radio-group {
    display: flex;
    gap: var(--spacing-lg);
}

.key-date-radio {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.key-date-radio input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.key-date-field {
    margin-bottom: var(--spacing-lg);
}

.key-date-field label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.key-date-field input[type="number"],
.key-date-field input[type="date"] {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.key-date-field input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.2);
}

.key-date-calc-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
    font-style: italic;
}

.key-date-preview {
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--accent-primary);
}

.key-date-preview strong {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.key-date-preview span {
    display: block;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-top: var(--spacing-xs);
}

/* Attachments Panel */
.stp-upload-area {
    border: 2px dashed var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: var(--spacing-md);
}

.stp-upload-area:hover {
    border-color: var(--accent-primary);
    background: rgba(79, 156, 249, 0.05);
}

.stp-upload-area svg {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.stp-upload-area div {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stp-upload-area small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stp-documents-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.stp-doc-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.stp-doc-item:hover {
    background: var(--bg-hover);
}

/* Emails Panel */
.stp-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.stp-email-templates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-sm);
}

.stp-email-template {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.stp-email-template:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.stp-email-template-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.stp-email-template-desc {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Notes Panel */
.stp-add-note {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.stp-add-note textarea {
    flex: 1;
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.875rem;
    resize: vertical;
    min-height: 60px;
}

.stp-add-note textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.stp-add-note .btn {
    align-self: flex-end;
}

.stp-activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.stp-activity-item {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--bg-tertiary);
}

.stp-activity-item.note { border-left-color: var(--accent-primary); }
.stp-activity-item.status-change { border-left-color: var(--success); }
.stp-activity-item.task-complete { border-left-color: var(--warning); }

.stp-activity-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-xs);
}

.stp-activity-type {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stp-activity-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.stp-activity-text {
    font-size: 0.8125rem;
    color: var(--text-primary);
}

/* RIGHT COLUMN: Dates Quick View */
.stp-right-column {
    background: var(--bg-secondary);
    border-left: 1px solid var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stp-quickview-header {
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
    background: var(--bg-tertiary);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.stp-quickview-header svg {
    width: 14px;
    height: 14px;
    color: var(--accent-primary);
}

.stp-quickview-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

.stp-timeline {
    position: relative;
    padding-left: var(--spacing-lg);
}

.stp-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--bg-tertiary);
}

.stp-timeline-item {
    position: relative;
    padding-bottom: var(--spacing-md);
}

.stp-timeline-item:last-child {
    padding-bottom: 0;
}

.stp-timeline-dot {
    position: absolute;
    left: -21px;
    top: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 2px solid var(--bg-secondary);
}

.stp-timeline-item.completed .stp-timeline-dot { background: var(--success); }
.stp-timeline-item.current .stp-timeline-dot {
    background: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.3);
}
.stp-timeline-item.overdue .stp-timeline-dot { background: var(--danger); }
.stp-timeline-item.warning .stp-timeline-dot {
    background: #F59E0B;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

.stp-timeline-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-sm);
}

.stp-timeline-name {
    font-size: 0.75rem;
    color: var(--text-primary);
}

.stp-timeline-item.completed .stp-timeline-name {
    color: var(--text-muted);
    text-decoration: line-through;
}

.stp-timeline-date {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}

.stp-timeline-item.current .stp-timeline-date {
    color: var(--accent-primary);
    font-weight: 500;
}

.stp-timeline-item.overdue .stp-timeline-date {
    color: var(--danger);
}

.stp-timeline-item.warning .stp-timeline-date {
    color: #D97706;
}

.stp-timeline-days {
    font-size: 0.6875rem;
    padding: 2px 6px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
}

.stp-timeline-days.overdue {
    background: rgba(220, 53, 69, 0.15);
    color: var(--danger);
}

.stp-timeline-days.current {
    background: rgba(79, 156, 249, 0.15);
    color: var(--accent-primary);
}

.stp-timeline-days.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #D97706;
}

.stp-timeline-item {
    cursor: pointer;
    transition: background var(--transition-fast);
}

.stp-timeline-item:hover {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

/* STP Loading & Empty States */
.stp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
}

.stp-empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================
   UTILITIES PANEL STYLES
   ============================================ */

.stp-utilities-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.stp-utilities-header .stp-section-title {
    margin: 0;
}

.stp-utilities-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* Empty state for utilities */
.stp-utility-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl) var(--spacing-lg);
    text-align: center;
}

.stp-utility-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-lg);
    color: var(--text-muted);
}

.stp-utility-empty h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.stp-utility-empty p {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 280px;
    margin-bottom: var(--spacing-lg);
}

/* Utility status display */
.stp-utility-status {
    padding: var(--spacing-md);
}

.stp-utility-status-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.stp-utility-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stp-utility-status-badge.pending {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-muted);
}

.stp-utility-status-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #D97706;
}

.stp-utility-status-badge.success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.stp-utility-status-meta {
    display: flex;
    gap: var(--spacing-md);
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Utility timeline */
.stp-utility-timeline {
    position: relative;
    padding-left: 24px;
    margin-bottom: var(--spacing-lg);
}

.stp-utility-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border-primary);
}

.stp-utility-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    position: relative;
    padding-bottom: var(--spacing-md);
}

.stp-utility-timeline-item:last-child {
    padding-bottom: 0;
}

.stp-utility-timeline-dot {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-primary);
}

.stp-utility-timeline-item.completed .stp-utility-timeline-dot {
    background: var(--success);
    border-color: var(--success);
}

.stp-utility-timeline-item.pending .stp-utility-timeline-dot {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
}

.stp-utility-timeline-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stp-utility-timeline-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.stp-utility-timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Utility entries grid */
.stp-utility-entries {
    margin-top: var(--spacing-lg);
    border-top: 1px solid var(--border-primary);
    padding-top: var(--spacing-lg);
}

.stp-utility-entries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.stp-utility-entry {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--spacing-sm);
}

.stp-utility-entry-type {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.stp-utility-entry-value {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.stp-utility-entry-value em {
    color: var(--text-muted);
    font-weight: 400;
}

/* Reminder count */
.stp-utility-reminder-count {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-primary);
    color: var(--text-muted);
}

/* ============================================
   INTAKE PANEL STYLES
   ============================================ */

.stp-intake-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.stp-intake-header .stp-section-title {
    margin: 0;
}

.stp-intake-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* Missing fields alert */
.stp-intake-missing {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.stp-intake-missing-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
    color: #D97706;
    margin-bottom: var(--spacing-sm);
}

.stp-intake-missing-category {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-left: 26px;
    margin-bottom: 4px;
}

/* Empty state */
.stp-intake-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl) var(--spacing-lg);
    text-align: center;
}

.stp-intake-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-lg);
    color: var(--text-muted);
}

.stp-intake-empty h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.stp-intake-empty p {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 280px;
}

/* Intake request cards */
.stp-intake-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.stp-intake-card {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
}

.stp-intake-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.stp-intake-card-info {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.stp-intake-status-badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stp-intake-status-badge.pending {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-muted);
}

.stp-intake-status-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #D97706;
}

.stp-intake-status-badge.success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.stp-intake-card-body {
    margin-bottom: var(--spacing-sm);
}

.stp-intake-progress {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.stp-intake-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

.stp-intake-progress-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s;
}

.stp-intake-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stp-intake-card-actions {
    display: flex;
    gap: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-primary);
}

/* Intake modal styles */
.intake-modal-section {
    margin-bottom: var(--spacing-md);
}

.intake-modal-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.intake-modal-divider {
    height: 1px;
    background: var(--border-primary);
    margin: var(--spacing-lg) 0;
}

.intake-select-all {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.intake-category {
    margin-bottom: var(--spacing-sm);
    border: 1px solid var(--border-primary);
    border-radius: var(--border-radius);
}

.intake-category.collapsed .intake-category-fields {
    display: none;
}

.intake-category.collapsed .intake-category-arrow {
    transform: rotate(-90deg);
}

.intake-category-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.intake-category-arrow {
    transition: transform 0.2s;
}

.intake-category-fields {
    padding: var(--spacing-sm) var(--spacing-md);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-xs);
}

.intake-field-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs);
    font-size: 0.8125rem;
}

.intake-field-option.is-missing {
    background: rgba(245, 158, 11, 0.1);
    border-radius: 4px;
}

.intake-field-option label {
    cursor: pointer;
}

/* Intake submission view */
.intake-submission-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.intake-submission-item {
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.intake-submission-label {
    font-size: 0.75rem;
    text-transform: capitalize;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.intake-submission-value {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* ============================================
   INTAKE FORM ENHANCEMENTS (Robyn's 14 items)
   ============================================ */

/* CRITICAL: Dark mode fix for ALL select elements */
/* Force visible text on select elements in dark mode */
select,
.form-select,
.intake-modal select,
.intake-modal .form-select,
.client-type {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e7eaed' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
    padding-right: 32px;
    /* Prevent text masking/garbling */
    -webkit-text-security: none !important;
    text-security: none !important;
    font-family: inherit;
}

/* Selected value text must be visible */
[data-theme="dark"] select,
[data-theme="dark"] .form-select,
[data-theme="dark"] .client-type {
    background-color: #242d3a !important;
    color: #e7eaed !important;
}

/* Light mode select styling */
[data-theme="light"] select,
[data-theme="light"] .form-select,
[data-theme="light"] .client-type {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231e293b' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
}

/* Option styling for dropdowns */
select option,
.form-select option,
.client-type option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px 12px;
}

[data-theme="dark"] select option,
[data-theme="dark"] .form-select option,
[data-theme="dark"] .client-type option {
    background-color: #1a2029 !important;
    color: #e7eaed !important;
}

[data-theme="light"] select option,
[data-theme="light"] .form-select option,
[data-theme="light"] .client-type option {
    background-color: #ffffff !important;
    color: #1e293b !important;
}

/* Custom Dropdown Component - replaces native select for full styling control */
.custom-dropdown {
    position: relative;
    display: inline-block;
    min-width: 140px;
}

.custom-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-hover);
    border-radius: var(--border-radius);
    padding: var(--spacing-sm) var(--spacing-md);
    font-family: var(--font-primary);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color var(--transition-fast);
}

.custom-dropdown-trigger:hover {
    border-color: var(--accent-primary);
}

.custom-dropdown-trigger svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.custom-dropdown.open .custom-dropdown-trigger svg {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-hover);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.custom-dropdown.open .custom-dropdown-menu {
    display: block;
}

.custom-dropdown-option {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.custom-dropdown-option:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.custom-dropdown-option.selected {
    background: var(--accent-primary);
    color: white;
}

/* Light theme adjustments */
[data-theme="light"] .custom-dropdown-menu {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .custom-dropdown-option:hover {
    background: #f1f5f9;
}

/* Transaction type grid (#20) - 7 options in responsive grid */
.txn-type-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.txn-type-grid .toggle-btn {
    padding: 10px 8px;
    font-size: 13px;
    white-space: nowrap;
}

/* Referral Only spans full width on last row */
.txn-type-grid .toggle-btn:last-child {
    grid-column: span 1;
}

@media (max-width: 768px) {
    .txn-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .txn-type-grid {
        grid-template-columns: 1fr;
    }
}

/* Checkbox group for dual agency multi-select */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-hover);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.checkbox-label:hover {
    border-color: var(--accent-primary);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.checkbox-label input[type="checkbox"]:checked + span,
.checkbox-label:has(input:checked) {
    color: var(--accent-primary);
}

/* Address autocomplete suggestions */
.address-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.address-suggestion {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
}

.address-suggestion:last-child {
    border-bottom: none;
}

.address-suggestion:hover {
    background: var(--bg-hover);
}

.address-suggestion-text {
    font-weight: 500;
}

.address-suggestion-secondary {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Currency input styling */
.currency-input::placeholder {
    color: var(--text-muted);
}

/* Sub-card styling for team members */
.sub-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-hover);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.sub-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Intake tab scrolling for more sections */
.intake-tabs {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.intake-tabs::-webkit-scrollbar {
    height: 4px;
}

.intake-tabs::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 2px;
}

.intake-tab {
    flex-shrink: 0;
    min-width: fit-content;
}

/* ============================================
   MICROSOFT-STYLE COLOR PICKER (#15)
   ============================================ */

.color-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.color-picker-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 8px;
    width: 420px;
    max-width: 95vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.color-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.color-picker-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.color-picker-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.color-picker-close:hover {
    color: var(--text-primary);
}

.color-picker-tabs {
    display: flex;
    border-bottom: 1px solid var(--bg-tertiary);
}

.color-picker-tab {
    flex: 1;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.color-picker-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.color-picker-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.color-picker-content {
    padding: 16px;
}

.color-picker-panel {
    display: none;
}

.color-picker-panel.active {
    display: block;
}

/* Standard tab - color grid */
.color-picker-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.color-picker-standard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2px;
}

.color-picker-cell {
    width: 24px;
    height: 24px;
    border: 1px solid transparent;
    cursor: pointer;
    border-radius: 2px;
    transition: transform 0.1s, border-color 0.1s;
}

.color-picker-cell:hover {
    transform: scale(1.15);
    border-color: var(--text-primary);
    z-index: 1;
}

/* Custom tab - spectrum and hue */
.color-picker-custom-layout {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.color-picker-spectrum-area {
    position: relative;
    width: 256px;
    height: 256px;
    border: 1px solid var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

#colorSpectrum {
    display: block;
    cursor: crosshair;
}

.color-spectrum-cursor {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.color-picker-hue-area {
    position: relative;
    width: 20px;
    height: 256px;
    border: 1px solid var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

#colorHueSlider {
    display: block;
    cursor: pointer;
}

.color-hue-cursor {
    position: absolute;
    left: -2px;
    right: -2px;
    height: 4px;
    background: white;
    border: 1px solid rgba(0,0,0,0.3);
    border-radius: 2px;
    transform: translateY(-50%);
    pointer-events: none;
}

/* RGB inputs */
.color-picker-inputs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.color-picker-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.color-picker-input-group label {
    font-size: 11px;
    color: var(--text-secondary);
}

.color-picker-input-group input[type="number"],
.color-picker-input-group input[type="text"] {
    width: 60px;
    padding: 6px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-hover);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: var(--font-mono);
}

.color-picker-input-group input[type="text"] {
    width: 80px;
}

.color-picker-input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Preview section */
.color-picker-preview-section {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    border-top: 1px solid var(--bg-tertiary);
}

.color-picker-preview-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.color-preview-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.color-preview-new,
.color-preview-current {
    width: 60px;
    height: 40px;
    border-radius: 4px;
    border: 1px solid var(--bg-tertiary);
}

/* Footer buttons */
.color-picker-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--bg-tertiary);
}

/* Custom swatch in settings */
.color-swatch-custom {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-swatch-label {
    font-size: 16px;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
}

.color-swatch-custom:not(.active) .custom-swatch-label {
    color: var(--text-primary);
    text-shadow: none;
}

/* ============================================
   TUTORIAL SYSTEM
   Interactive click-through tutorials
   ============================================ */

/* Overlay - darkens everything except spotlight */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9998;
    pointer-events: none;
}

/* Spotlight - highlights target element */
.tutorial-spotlight {
    position: fixed;
    z-index: 9999;
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
    pointer-events: none;
    transition: all 0.3s ease-out;
}

/* Tooltip - instruction box (forced light mode for readability on dark overlay) */
.tutorial-tooltip {
    position: fixed;
    z-index: 10000;
    background: #ffffff !important;
    color: #333333 !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 12px;
    padding: 0;
    width: 320px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: tutorialTooltipIn 0.25s ease-out;
}

@keyframes tutorialTooltipIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tutorial-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f5f5f5 !important;
    border-bottom: 1px solid #e0e0e0 !important;
}

.tutorial-step-counter {
    font-size: 12px;
    color: #666666 !important;
    font-weight: 500;
}

.tutorial-close-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #666666 !important;
    border-radius: 4px;
    transition: all 0.15s;
}

.tutorial-close-btn:hover {
    background: #e8e8e8 !important;
    color: #333333 !important;
}

.tutorial-close-btn svg {
    width: 16px;
    height: 16px;
}

.tutorial-tooltip-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a !important;
    margin: 0;
    padding: 16px 16px 8px;
}

.tutorial-tooltip-content {
    font-size: 14px;
    color: #555555 !important;
    line-height: 1.5;
    margin: 0;
    padding: 0 16px 16px;
}

.tutorial-tooltip-footer {
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0 !important;
    background: #fafafa !important;
    border-radius: 0 0 12px 12px;
}

.tutorial-tooltip-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tutorial-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}

.tutorial-btn-primary {
    background: var(--primary);
    color: #0f1419;
}

.tutorial-btn-primary:hover {
    background: var(--primary-light);
}

.tutorial-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.tutorial-btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Progress dots */
.tutorial-progress-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.tutorial-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    transition: all 0.2s;
}

.tutorial-dot.active {
    background: var(--primary);
    transform: scale(1.2);
}

.tutorial-dot.completed {
    background: var(--primary);
    opacity: 0.5;
}

/* Help button in header */
.help-btn {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all 0.15s;
    position: relative;
}

.help-btn:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
}

.help-btn svg {
    width: 20px;
    height: 20px;
}

/* Help dropdown */
.help-menu-container {
    position: relative;
}

.help-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease-out;
    z-index: 1000;
}

.help-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.help-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.help-dropdown-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.help-dropdown-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.help-menu-content {
    padding: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.help-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}

.help-menu-item:hover {
    background: var(--bg-tertiary);
}

.help-menu-item.completed {
    opacity: 0.7;
}

.help-menu-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 8px;
    color: var(--text-secondary);
}

.help-menu-item.completed .help-menu-icon {
    background: var(--primary);
    background-opacity: 0.2;
    color: var(--primary);
}

.help-menu-icon svg {
    width: 18px;
    height: 18px;
}

.help-menu-text {
    flex: 1;
}

.help-menu-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.help-menu-desc {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

.help-dropdown-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--bg-tertiary);
}

.help-reset-btn {
    font-size: 12px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
}

.help-reset-btn:hover {
    color: var(--primary);
}

/* Welcome modal for first-time users */
.tutorial-welcome-modal {
    max-width: 400px;
}

.tutorial-welcome-modal .modal-body {
    padding: 0;
}

.tutorial-welcome {
    text-align: center;
    padding: 32px;
}

.tutorial-welcome-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.tutorial-welcome-icon svg {
    width: 32px;
    height: 32px;
}

.tutorial-welcome h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.tutorial-welcome p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 24px;
}

.tutorial-welcome-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.tutorial-welcome-actions .btn {
    padding: 10px 24px;
}

/* ============================================
   CALENDAR SETTINGS (Phase 5c)
   ============================================ */

.calendar-settings-page {
    max-width: 800px;
}

.calendar-settings-page .settings-group {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.calendar-settings-page .settings-group h4 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.calendar-settings-page .help-text {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 16px;
}

/* Connection Status */
.calendar-connection-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.connection-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
}

.connection-message {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Sync Status Grid */
.sync-status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.sync-stat {
    text-align: center;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.sync-stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.sync-stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.sync-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sync-result-message,
.save-result-message {
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
}

.sync-result-message.success,
.save-result-message.success {
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.sync-result-message.error,
.save-result-message.error {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Radio Options */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.radio-option:hover {
    background: var(--bg-hover);
}

.radio-option input[type="radio"] {
    margin-top: 4px;
    accent-color: var(--primary);
}

.radio-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.radio-label strong {
    color: var(--text-primary);
    font-size: 14px;
}

.radio-description {
    font-size: 12px;
    color: var(--text-muted);
}

/* Color Pickers Grid */
.color-pickers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.color-picker-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.color-picker-item label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-input-wrapper input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-hex {
    font-family: monospace;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 4px 8px;
    border-radius: 4px;
}

.color-description {
    font-size: 11px;
    color: var(--text-muted);
}

/* Toggle Option */
.toggle-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.toggle-option input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-option input[type="checkbox"]:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-option input[type="checkbox"]:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.toggle-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toggle-label strong {
    color: var(--text-primary);
    font-size: 14px;
}

.toggle-description {
    font-size: 12px;
    color: var(--text-muted);
}

/* Settings Actions */
.settings-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-top: 8px;
}

/* Spinner for buttons */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   iCAL FEED SECTION - Phase 5f
   ============================================ */

.ical-url-container {
    margin-bottom: 16px;
}

.ical-url-container.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.ical-url-container label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.ical-url-input-group {
    display: flex;
    gap: 8px;
}

.ical-url-input {
    flex: 1;
    padding: 10px 12px;
    font-size: 13px;
    font-family: monospace;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
}

.ical-url-input:focus {
    outline: none;
    border-color: var(--primary);
}

.ical-copy-message {
    display: block;
    font-size: 12px;
    margin-top: 6px;
    min-height: 18px;
}

.ical-copy-message.success {
    color: var(--success);
}

.ical-copy-message.error {
    color: var(--danger);
}

.ical-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.ical-warning {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.ical-instructions {
    margin-top: 16px;
}

.ical-instructions details {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 12px 16px;
}

.ical-instructions summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.ical-instructions summary:hover {
    color: var(--primary);
}

.ical-instructions-content {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.ical-instructions-content p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.ical-instructions-content p:last-child {
    margin-bottom: 0;
}

.ical-instructions-content strong {
    color: var(--text-primary);
}

/* Small button variant */
.btn.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn.btn-outline:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================
   CALENDAR VIEW - Phase 5d
   ============================================ */

.calendar-view-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem;
    gap: 1rem;
}

/* Calendar Header */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.calendar-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calendar-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.calendar-nav-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-nav-btn svg {
    width: 18px;
    height: 18px;
}

.calendar-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0.5rem;
}

/* View Toggle */
.calendar-view-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 4px;
}

.calendar-view-toggle .view-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-view-toggle .view-btn:hover {
    color: var(--text-primary);
}

.calendar-view-toggle .view-btn.active {
    background: var(--accent-primary);
    color: white;
}

/* Calendar Filters */
.calendar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.calendar-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.calendar-filters .filter-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-filters .filter-group select,
.calendar-filters .filter-group input {
    min-width: 150px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.calendar-filters .filter-search {
    flex: 1;
    min-width: 200px;
}

.calendar-filters .filter-search input {
    width: 100%;
}

.calendar-filters .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Calendar Legend */
.calendar-legend {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-dot.milestone { background-color: #0D9488; }
.legend-dot.contingency { background-color: #9333EA; }
.legend-dot.disclosure { background-color: #0D9488; }
.legend-dot.task { background-color: #F26522; }

/* Month View Grid */
.calendar-grid-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.calendar-weekdays .weekday {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    flex: 1;
}

.calendar-day {
    min-height: 100px;
    padding: 0.5rem;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    cursor: default;
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

.calendar-day.other-month {
    background: var(--bg-secondary);
}

.calendar-day.other-month .day-number {
    color: var(--text-muted);
}

.calendar-day.today {
    background: rgba(79, 156, 249, 0.15);
}

.calendar-day.today .day-number {
    background: var(--accent-primary);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-number {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow: hidden;
}

/* Calendar Events */
.calendar-event {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    background-color: var(--event-color);
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.calendar-event .event-acronym {
    font-weight: 600;
}

.more-events {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 2px 6px;
    cursor: pointer;
}

.more-events:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

/* Week View */
.calendar-week-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.week-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.week-day-header {
    padding: 1rem;
    text-align: center;
    border-right: 1px solid var(--border);
}

.week-day-header:last-child {
    border-right: none;
}

.week-day-header.today {
    background: rgba(79, 156, 249, 0.15);
}

.week-day-header .day-name {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.week-day-header .day-date {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.week-day-header.today .day-date {
    color: var(--accent-primary);
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    flex: 1;
}

.week-day {
    padding: 0.75rem;
    border-right: 1px solid var(--border);
    background: var(--bg-primary);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.week-day:last-child {
    border-right: none;
}

.week-day.today {
    background: rgba(79, 156, 249, 0.15);
}

.week-day .no-events {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    padding: 1rem;
}

.week-event {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.5rem;
    border-radius: 6px;
}

.week-event .event-acronym {
    font-weight: 600;
    font-size: 0.75rem;
}

.week-event .event-title {
    font-size: 0.75rem;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* List View */
.calendar-list-container {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.list-events {
    padding: 1rem;
}

.no-events-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.no-events-message svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-events-message p {
    font-size: 1rem;
}

.list-date-group {
    margin-bottom: 1.5rem;
}

.list-date-group.past .list-date-header {
    opacity: 0.6;
}

.list-date-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.75rem;
}

.list-date-header .date-day {
    font-weight: 600;
    color: var(--text-primary);
}

.list-date-header .date-full {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.list-date-header .today-badge {
    background: var(--accent-primary);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.list-date-group.today .list-date-header {
    color: var(--accent-primary);
}

.list-date-events {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.list-event {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
}

.list-event:hover {
    border-color: var(--event-color);
    background: var(--bg-secondary);
}

.list-event .event-indicator {
    width: 4px;
    height: 100%;
    min-height: 40px;
    border-radius: 2px;
}

.list-event .event-details {
    flex: 1;
    min-width: 0;
}

.list-event .event-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.list-event .event-acronym-badge {
    background: var(--event-color);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.list-event .event-address {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-event .event-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.list-event .event-type-label {
    text-transform: capitalize;
}

.list-event .event-notes {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-event .event-action {
    color: var(--text-muted);
}

.list-event .event-action svg {
    width: 20px;
    height: 20px;
}

.list-event:hover .event-action {
    color: var(--accent-primary);
}

/* Day Events Popup */
.day-events-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-events-popup .popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.day-events-popup .popup-content {
    position: relative;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.day-events-popup .popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.day-events-popup .popup-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.day-events-popup .popup-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.day-events-popup .popup-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.day-events-popup .popup-events {
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.day-events-popup .popup-event {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.day-events-popup .popup-event:hover {
    background: var(--bg-tertiary);
}

.day-events-popup .popup-event .event-indicator {
    width: 4px;
    height: 32px;
    border-radius: 2px;
}

.day-events-popup .popup-event .event-acronym {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.day-events-popup .popup-event .event-address {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Calendar Summary */
.calendar-summary {
    display: flex;
    justify-content: flex-end;
    padding: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .calendar-filters {
        flex-direction: column;
    }

    .calendar-filters .filter-group {
        width: 100%;
    }

    .calendar-filters .filter-group select,
    .calendar-filters .filter-group input {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .calendar-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .calendar-header-right {
        width: 100%;
        justify-content: space-between;
    }

    .calendar-day {
        min-height: 60px;
        padding: 0.25rem;
    }

    .calendar-event {
        font-size: 0.625rem;
        padding: 1px 4px;
    }

    .week-day {
        padding: 0.5rem;
        min-height: 150px;
    }

    .calendar-legend {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

/* ============================================
   PHASE 6b REVISED: SUBMISSION DETAILS MODAL
   Tabbed Interface Matching New Transaction
   ============================================ */

/* Modal Overlay */
.submission-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Modal Container */
.submission-modal {
    background: var(--bg-secondary);
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Modal Header */
.submission-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.submission-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}

.submission-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.submission-close:hover {
    color: var(--text-primary);
}

/* Tab Bar */
.submission-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 24px;
    background: var(--bg-primary);
    overflow-x: auto;
    border-bottom: 1px solid var(--bg-tertiary);
    position: relative;
    z-index: 10; /* Ensure tabs stay above scrolling content */
}

.submission-tabs::-webkit-scrollbar {
    height: 4px;
}

.submission-tabs::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 2px;
}

.submission-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    font-size: 13px;
    transition: all 0.2s;
}

.submission-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.submission-tab.active {
    background: var(--primary);
    color: var(--bg-primary);
}

.submission-tab .tab-icon {
    font-size: 14px;
}

.submission-tab .tab-label {
    font-weight: 500;
}

/* Body Content */
.submission-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 300px;
    max-height: calc(90vh - 200px); /* Leave room for header, tabs, footer */
}

.submission-section-content {
    padding: 24px;
}

.submission-section {
    max-width: 100%;
}

.submission-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.submission-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary);
}

/* Key Dates Accordion - inside scroll area */
.submission-body .key-dates-accordion {
    margin: 0 24px 24px;
    border: 1px solid var(--bg-tertiary);
    border-radius: 8px;
    background: var(--bg-primary);
    overflow: hidden;
}

.key-dates-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    background: var(--bg-tertiary);
}

.key-dates-accordion-header:hover {
    background: var(--bg-tertiary);
}

.key-dates-accordion-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.accordion-icon {
    font-size: 10px;
    color: var(--text-muted);
}

.key-dates-count {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 4px 10px;
    border-radius: 12px;
}

.key-dates-accordion-body {
    padding: 16px;
    background: var(--bg-primary);
}

.key-dates-defaults {
    padding: 12px 0;
    border-bottom: 1px solid var(--bg-tertiary);
    margin-bottom: 16px;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.checkbox-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.checkbox-inline:hover {
    color: var(--primary);
}

/* Key Dates Calculator */
.key-dates-calculator {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.key-dates-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.key-dates-group h5 {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.key-date-row {
    display: grid;
    grid-template-columns: 150px 1fr 120px;
    gap: 12px;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.key-date-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.key-date-label small {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 2px;
}

.key-date-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.key-date-input .form-input {
    flex: 1;
    max-width: 150px;
}

.key-date-input .form-input-sm {
    width: 50px;
    padding: 8px;
    text-align: center;
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
}

.key-date-input .form-input-sm:focus {
    outline: none;
    border-color: var(--primary);
}

.key-date-input span {
    font-size: 12px;
    color: var(--text-muted);
}

.key-date-preview {
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
    text-align: right;
    white-space: nowrap;
}

/* Footer */
.submission-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--bg-tertiary);
    background: var(--bg-primary);
}

.submission-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.submission-progress {
    color: var(--text-muted);
    font-size: 13px;
}

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

.submission-actions .btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.submission-actions .btn-outline {
    background: transparent;
    border: 1px solid var(--bg-tertiary);
    color: var(--text-secondary);
}

.submission-actions .btn-outline:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.submission-actions .btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.submission-actions .btn-danger-outline:hover {
    background: var(--danger);
    color: white;
}

.submission-actions .btn-success {
    background: var(--success);
    border: 1px solid var(--success);
    color: white;
}

.submission-actions .btn-success:hover {
    background: #218838;
    border-color: #218838;
}

/* Client Cards */
.sub-client-card {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.sub-client-card:last-child {
    margin-bottom: 0;
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.client-card-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-remove {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
}

.btn-remove:hover {
    color: #ff4d4d;
}

.btn-add-client {
    margin-top: 12px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.checkbox-row label {
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Entity Fields */
.entity-fields {
    background: var(--bg-primary);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
}

/* Documents Placeholder */
.documents-placeholder {
    text-align: center;
    padding: 40px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    color: var(--text-muted);
}

.documents-placeholder .placeholder-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .submission-tabs {
        padding: 8px 16px;
    }

    .submission-tab .tab-label {
        display: none;
    }

    .submission-body {
        padding: 16px;
    }

    .key-date-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .key-date-preview {
        text-align: left;
    }

    .submission-footer {
        padding: 12px 16px;
    }

    .submission-actions {
        flex-direction: column;
    }

    .submission-actions .btn {
        width: 100%;
    }
}

/* ============================================
   DATE TEMPLATES (Phase 6c Reset)
   ============================================ */

/* Date Templates List Page */
.date-templates-page {
    padding: 0;
}

.date-templates-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 20px;
}

.date-templates-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.date-templates-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

.date-templates-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Template Row */
.template-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.template-row:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.template-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.template-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.template-description {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.entry-count {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.template-actions {
    display: flex;
    gap: 8px;
}

/* Template Detail Page */
.template-detail-page {
    padding: 0;
}

.template-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 20px;
}

.template-detail-title {
    flex: 1;
}

.template-detail-title h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
}

.template-detail-desc {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}

/* Entry Rows */
.template-entries-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.entry-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    transition: all 0.15s ease;
}

.entry-row:hover {
    border-color: var(--accent-primary);
}

.entry-row.dragging {
    opacity: 0.5;
    border-color: var(--accent-primary);
    border-style: dashed;
}

.entry-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 14px;
    padding: 4px;
    user-select: none;
}

.entry-drag-handle:active {
    cursor: grabbing;
}

.entry-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.entry-label {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.entry-formula {
    font-size: 12px;
    color: var(--text-muted);
}

.entry-meta {
    color: var(--text-muted);
    font-size: 12px;
}

.entry-applies {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
}

.entry-actions {
    display: flex;
    gap: 6px;
}

/* Entry Modal */
.entry-modal .form-row {
    display: flex;
    gap: 16px;
}

.entry-modal .form-divider {
    height: 1px;
    background: var(--border-primary);
    margin: 16px 0;
}

.entry-modal .checkbox-group {
    display: flex;
    gap: 16px;
}

.entry-modal .checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}

.entry-modal .hidden {
    display: none;
}

/* Entry Modal - AFrame Style Enhancements */
.entry-modal .form-section {
    margin-bottom: 16px;
}

.entry-modal .form-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.entry-modal .form-row.align-center {
    align-items: center;
}

/* Radio Group */
.entry-modal .radio-group {
    display: flex;
    gap: 16px;
}

.entry-modal .radio-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    padding: 12px 16px;
    border: 1px solid var(--border-primary);
    border-radius: var(--border-radius-md);
    background: var(--bg-secondary);
    flex: 1;
    transition: all 0.15s ease;
}

.entry-modal .radio-label:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.entry-modal .radio-label:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.entry-modal .radio-label input[type="radio"] {
    margin-top: 2px;
}

.entry-modal .radio-text {
    font-weight: 500;
    color: var(--text-primary);
    display: block;
}

.entry-modal .radio-desc {
    font-size: 12px;
    color: var(--text-secondary);
    display: block;
    margin-top: 2px;
}

/* Button Toggle Group */
.entry-modal .btn-toggle-group {
    display: flex;
    border: 1px solid var(--border-primary);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

.entry-modal .btn-toggle {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.entry-modal .btn-toggle:not(:last-child) {
    border-right: 1px solid var(--border-primary);
}

.entry-modal .btn-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.entry-modal .btn-toggle.active {
    background: var(--accent-primary);
    color: white;
}

/* Toggle Switch */
.entry-modal .toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.entry-modal .toggle-label input[type="checkbox"] {
    display: none;
}

.entry-modal .toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--bg-tertiary);
    border-radius: 11px;
    transition: background 0.2s ease;
}

.entry-modal .toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.entry-modal .toggle-label input:checked + .toggle-switch {
    background: var(--accent-primary);
}

.entry-modal .toggle-label input:checked + .toggle-switch::after {
    transform: translateX(18px);
}

/* Input with Prefix */
.entry-modal .input-with-prefix {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-primary);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    background: var(--bg-secondary);
}

.entry-modal .input-with-prefix:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-bg);
}

.entry-modal .input-prefix {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    border-right: 1px solid var(--border-primary);
}

.entry-modal .input-with-prefix .form-input {
    border: none;
    border-radius: 0;
    flex: 1;
}

.entry-modal .input-with-prefix .form-input:focus {
    box-shadow: none;
}

/* Checkbox Group Horizontal */
.entry-modal .checkbox-group-horizontal {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.entry-modal .checkbox-group-horizontal .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.entry-modal .checkbox-group-horizontal .checkbox-label span {
    font-size: 14px;
}

/* Visibility Toggles */
.entry-modal .visibility-toggles {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.entry-modal .visibility-toggle-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-primary);
}

.entry-modal .toggle-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.entry-modal .toggle-title {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.entry-modal .toggle-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Formula Section */
.entry-modal .formula-section {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-primary);
    margin-bottom: 16px;
}

.entry-modal .formula-section.hidden {
    display: none;
}

/* Days Input with Suffix */
.entry-modal .days-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.entry-modal .days-input-wrapper input {
    width: 80px;
    text-align: center;
}

.entry-modal .days-input-wrapper input:disabled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.entry-modal .days-suffix {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Custom Dropdown for Calc Type */
.entry-modal .custom-dropdown {
    position: relative;
}

.entry-modal .custom-dropdown-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: border-color 0.15s ease;
}

.entry-modal .custom-dropdown-selected:hover {
    border-color: var(--accent-primary);
}

.entry-modal .dropdown-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entry-modal .dropdown-arrow {
    font-size: 10px;
    color: var(--text-secondary);
    margin-left: 8px;
}

.entry-modal .custom-dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.entry-modal .custom-dropdown-options.open {
    display: block;
}

.entry-modal .dropdown-option {
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.entry-modal .dropdown-option:hover {
    background: var(--bg-secondary);
}

.entry-modal .dropdown-option.selected {
    background: var(--bg-tertiary);
}

.entry-modal .dropdown-option .option-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.entry-modal .dropdown-option .option-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Reminder Section Styles */
.entry-modal .reminder-toggle-group {
    display: flex;
    gap: 0;
    border: 1px solid var(--border-primary);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

.entry-modal .reminder-radio {
    flex: 1;
    margin: 0;
    cursor: pointer;
}

.entry-modal .reminder-radio input[type="radio"] {
    display: none;
}

.entry-modal .reminder-radio-btn {
    display: block;
    padding: 10px 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.entry-modal .reminder-radio input:checked + .reminder-radio-btn {
    background: var(--accent-primary);
    color: white;
}

.entry-modal .reminder-config {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-primary);
}

.entry-modal .reminder-config.hidden {
    display: none;
}

.entry-modal .reminder-days-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.entry-modal .reminder-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.entry-modal .reminder-days-input {
    width: 70px;
}

.entry-modal .reminder-days-input input {
    width: 100%;
    text-align: center;
    padding: 8px;
}

.entry-modal .reminder-notify-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.entry-modal .reminder-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.entry-modal .reminder-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
}

.entry-modal .reminder-checkbox input[type="checkbox"] {
    display: none;
}

.entry-modal .reminder-checkbox .checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-primary);
    border-radius: 4px;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.entry-modal .reminder-checkbox input:checked + .checkbox-custom {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.entry-modal .reminder-checkbox input:checked + .checkbox-custom::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* STP Template Dropdown */
.stp-date-template-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-primary);
}

.stp-date-template-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stp-date-template-header label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.stp-template-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}

.stp-template-select:hover {
    border-color: var(--accent-primary);
}

.stp-template-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(var(--accent-primary-rgb), 0.2);
}

/* Template Entries in STP */
.stp-date-section.template-entries {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.stp-date-section.template-entries .stp-date-section-header {
    color: var(--accent-primary);
    font-size: 11px;
    margin-bottom: 8px;
}

.stp-date-formula-badge {
    display: inline-block;
    font-size: 10px;
    color: var(--accent-primary);
    background: rgba(var(--accent-primary-rgb), 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 2px;
}
/* ============================================
   THEO CHAT WIDGET STYLES
   Append to: static/styles.css
   ============================================ */

/* ---- Chat Color Variables (easy theming) ---- */
:root {
    --theo-chat-bg: #ffffff;
    --theo-chat-header-bg: #4a6fa5;
    --theo-chat-header-text: #ffffff;
    --theo-chat-border: #e0e0e0;
    --theo-chat-input-bg: #f8f9fa;
    --theo-chat-input-border: #d0d0d0;
    
    /* Message bubble colors - User */
    --theo-bubble-user-bg: #4a6fa5;
    --theo-bubble-user-text: #ffffff;
    
    /* Message bubble colors - Theo/Assistant */
    --theo-bubble-assistant-bg: #f0f2f5;
    --theo-bubble-assistant-text: #1a1a1a;
    
    /* Status indicator */
    --theo-status-online: #28a745;
    --theo-status-thinking: #ffc107;
}

/* ---- Main Container ---- */
.theo-chat-container {
    width: 100%;
    background: var(--theo-chat-bg);
    border: 1px solid var(--theo-chat-border);
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Collapsed state */
.theo-chat-container.collapsed .theo-chat-messages {
    max-height: 120px;
}

.theo-chat-container.collapsed .theo-chat-toggle-icon {
    transform: rotate(0deg);
}

/* Expanded state */
.theo-chat-container.expanded .theo-chat-messages {
    max-height: 350px;
}

.theo-chat-container.expanded .theo-chat-toggle-icon {
    transform: rotate(180deg);
}

/* ---- Chat Header ---- */
.theo-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--theo-chat-header-bg);
    color: var(--theo-chat-header-text);
    cursor: pointer;
    user-select: none;
}

.theo-chat-header:hover {
    filter: brightness(1.05);
}

.theo-chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theo-chat-icon {
    font-size: 1.2em;
}

.theo-chat-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.theo-chat-status {
    font-size: 0.75rem;
    padding: 2px 8px;
    background: var(--theo-status-online);
    border-radius: 10px;
    opacity: 0.9;
}

.theo-chat-status.thinking {
    background: var(--theo-status-thinking);
    color: #1a1a1a;
}

.theo-chat-toggle-icon {
    font-size: 0.85rem;
    transition: transform 0.3s ease;
}

/* ---- Messages Area ---- */
.theo-chat-messages {
    padding: 16px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--theo-chat-bg);
}

/* Scrollbar styling */
.theo-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.theo-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.theo-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.theo-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ---- Message Bubbles ---- */
.theo-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.theo-message-user {
    align-self: flex-end;
    align-items: flex-end;
}

.theo-message-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.theo-message-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

/* User bubble */
.theo-message-user .theo-message-bubble {
    background: var(--theo-bubble-user-bg);
    color: var(--theo-bubble-user-text);
    border-bottom-right-radius: 4px;
}

/* Assistant bubble */
.theo-message-assistant .theo-message-bubble {
    background: var(--theo-bubble-assistant-bg);
    color: var(--theo-bubble-assistant-text);
    border-bottom-left-radius: 4px;
}

.theo-message-time {
    font-size: 0.7rem;
    color: #888;
    margin-top: 4px;
    padding: 0 4px;
}

/* Typing indicator */
.theo-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
}

.theo-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #888;
    border-radius: 50%;
    animation: theoBounce 1.4s infinite ease-in-out;
}

.theo-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.theo-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.theo-typing-indicator span:nth-child(3) { animation-delay: 0s; }

@keyframes theoBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ---- Input Area ---- */
.theo-chat-input-container {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--theo-chat-border);
    background: var(--theo-chat-input-bg);
}

.theo-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--theo-chat-input-border);
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.theo-chat-input:focus {
    border-color: var(--theo-chat-header-bg);
}

.theo-chat-input::placeholder {
    color: #999;
}

.theo-chat-send {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--theo-chat-header-bg);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.theo-chat-send:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.theo-chat-send:active {
    transform: scale(0.95);
}

.theo-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ---- Claude Escalation Prompt (REFACTOR) ---- */
.theo-escalation-prompt {
    padding: var(--spacing-sm);
}

.escalation-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    border: 1px solid #d0d5dd;
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    text-align: center;
}

.escalation-icon {
    font-size: 24px;
    margin-bottom: var(--spacing-xs);
    opacity: 0.7;
}

.escalation-text {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    line-height: 1.4;
}

.escalation-warning {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
    font-style: italic;
}

.escalation-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    flex-wrap: wrap;
}

.escalation-actions .btn {
    min-width: 120px;
}

/* ============================================
   REJECTED PLANS VIEW (7I.6)
   ============================================ */

.rejected-plans-content {
    padding: var(--spacing-md);
}

.rejected-plans-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.rejected-plans-count {
    font-size: 14px;
    color: var(--text-muted);
}

.rejected-plans-table-wrapper {
    overflow-x: auto;
}

.rejected-plans-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.rejected-plans-table th,
.rejected-plans-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.rejected-plans-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rejected-plans-table tr:hover {
    background: var(--bg-hover);
}

.rejected-address {
    font-weight: 500;
    color: var(--text-primary);
}

.rejected-summary {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rejected-date {
    color: var(--text-muted);
    white-space: nowrap;
}

.rejected-by {
    color: var(--accent-primary);
}

.rejected-reason {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: italic;
    color: var(--text-secondary);
}

.rejected-actions {
    white-space: nowrap;
}

.rejected-actions .btn {
    margin-right: var(--spacing-xs);
}

.view-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* ============================================
   KNOWLEDGE BASE (RAG)
   ============================================ */

.knowledge-base-page {
    max-width: 900px;
}

.knowledge-base-page .settings-group {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.knowledge-base-page .settings-group h4 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.knowledge-base-page .help-text {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 16px;
}

/* KB Stats Grid */
.kb-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.kb-stat {
    text-align: center;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.kb-stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.kb-stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.kb-category-breakdown {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-primary);
}

.kb-category-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 4px;
}

.kb-category-badge {
    font-size: 12px;
    padding: 3px 8px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 12px;
    font-weight: 500;
}

/* KB Upload Form */
.kb-upload-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kb-upload-row {
    display: flex;
    gap: 16px;
}

.kb-upload-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kb-upload-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.kb-upload-field input[type="file"] {
    padding: 10px;
    border: 2px dashed var(--border-primary);
    border-radius: 8px;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: border-color 0.2s;
}

.kb-upload-field input[type="file"]:hover {
    border-color: var(--primary);
}

.kb-upload-field input[type="text"],
.kb-upload-field select {
    padding: 10px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
}

.kb-upload-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.kb-upload-status {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
}

.kb-upload-status .loading {
    color: var(--text-secondary);
}

.kb-upload-status .success {
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
}

.kb-upload-status .error {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
}

/* KB Documents Table */
.kb-documents-table {
    width: 100%;
    border-collapse: collapse;
}

.kb-documents-table th,
.kb-documents-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
}

.kb-documents-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg-tertiary);
}

.kb-documents-table th:first-child {
    border-radius: 6px 0 0 0;
}

.kb-documents-table th:last-child {
    border-radius: 0 6px 0 0;
    text-align: right;
}

.kb-documents-table td:last-child {
    text-align: right;
}

.kb-documents-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.kb-doc-title {
    font-weight: 500;
    color: var(--text-primary);
}

.btn-icon {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
}

.btn-danger-icon:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* KB Query Form */
.kb-query-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kb-query-input-row {
    display: flex;
    gap: 12px;
}

.kb-query-input-row input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
}

.kb-query-input-row input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.kb-query-results {
    min-height: 100px;
}

.kb-results-header {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-primary);
}

.kb-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kb-result-item {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 16px;
    border-left: 3px solid var(--primary);
}

.kb-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.kb-result-source {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}

.kb-result-score {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 10px;
    font-weight: 500;
}

.kb-result-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* Danger Zone */
.danger-zone {
    border: 1px solid var(--danger);
    background: rgba(239, 68, 68, 0.05) !important;
}

.danger-zone h4 {
    color: var(--danger) !important;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Agent Action Button */
.btn-agent-action {
    background: #dc2626;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-agent-action:hover {
    background: #b91c1c;
}

.btn-agent-action svg {
    width: 16px;
    height: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .kb-stats-grid {
        grid-template-columns: 1fr;
    }

    .kb-upload-row {
        flex-direction: column;
    }

    .kb-query-input-row {
        flex-direction: column;
    }
}

/* ============================================
   EMAIL TEMPLATES (Phase 8)
   ============================================ */

.email-templates-page {
    padding: 0;
}

.email-templates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 20px;
}

.email-templates-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.email-templates-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.email-filter {
    min-width: 160px;
}

.email-templates-table {
    width: 100%;
    border-collapse: collapse;
}

.email-templates-table th,
.email-templates-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
}

.email-templates-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.email-templates-table tbody tr:hover {
    background: var(--bg-hover);
}

.email-template-row .template-name {
    font-weight: 500;
    color: var(--text-primary);
}

.email-template-row .subject-line {
    color: var(--text-secondary);
    font-size: 13px;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.type-badge.type-buyer {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
}

.type-badge.type-seller {
    background: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
}

.type-badge.type-referral {
    background: rgba(167, 139, 250, 0.15);
    color: #A78BFA;
}

.type-badge.type-other {
    background: rgba(107, 114, 128, 0.15);
    color: #6B7280;
}

/* ============================================
   AGENT PORTAL MANAGEMENT
   ============================================ */

.agent-portal-page {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.agent-portal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
}

.agent-portal-header-info h3 {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.agent-portal-description {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.agent-portal-stats {
    display: flex;
    gap: var(--spacing-md);
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    min-width: 80px;
}

.stat-box .stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.stat-box .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.agent-portal-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--spacing-lg);
}

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

.agent-settings-panel {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--bg-tertiary);
    padding: var(--spacing-md);
    height: fit-content;
}

.agent-settings-panel h4 {
    margin: 0 0 var(--spacing-md) 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--bg-tertiary);
}

.setting-row:last-of-type {
    border-bottom: none;
    margin-bottom: var(--spacing-md);
}

.setting-row label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.setting-input {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.setting-input input[type="number"] {
    width: 60px;
    padding: var(--spacing-xs);
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-hover);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    text-align: center;
}

.setting-input input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

.agent-list-panel {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--bg-tertiary);
    overflow: hidden;
}

.agent-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
}

.agent-list-header h4 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.agent-list-header .search-input {
    width: 200px;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
}

.agent-list {
    max-height: 500px;
    overflow-y: auto;
}

.agent-list-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
    cursor: pointer;
    transition: background 0.15s;
}

.agent-list-item:hover {
    background: var(--bg-hover);
}

.agent-list-item:last-child {
    border-bottom: none;
}

.agent-info {
    flex: 1;
    min-width: 0;
}

.agent-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.agent-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin-right: var(--spacing-md);
}

.session-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.session-count.has-sessions {
    color: var(--success);
    font-weight: 500;
}

.last-activity {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.agent-detail {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.detail-section {
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--bg-tertiary);
}

.detail-section:last-of-type {
    border-bottom: none;
}

.detail-section h4 {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-xs) 0;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.detail-value {
    font-size: 0.8rem;
    color: var(--text-primary);
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.session-row {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    gap: var(--spacing-md);
}

.session-row.inactive {
    opacity: 0.6;
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-device {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

.session-meta {
    display: flex;
    gap: var(--spacing-md);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.session-status .status-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.status-badge.active {
    background: rgba(40, 167, 69, 0.2);
    color: var(--success);
}

.status-badge.expired {
    background: rgba(107, 114, 128, 0.2);
    color: var(--text-muted);
}

.empty-state.small {
    padding: var(--spacing-md);
    font-size: 0.8rem;
}

.trigger-cell {
    font-size: 12px;
}

.trigger-manual {
    color: var(--text-muted);
    font-style: italic;
}

.trigger-status {
    color: var(--accent-primary);
}

.trigger-date {
    color: var(--warning-dark, #f57c00);
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    padding: 4px 10px;
    font-size: 12px;
}

.email-templates-stats {
    display: flex;
    gap: 20px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-primary);
    font-size: 13px;
    color: var(--text-muted);
}

/* Toggle Switch Small */
.toggle-switch.small {
    width: 32px;
    height: 18px;
}

.toggle-switch.small .toggle-slider {
    width: 32px;
    height: 18px;
    border-radius: 9px;
}

.toggle-switch.small .toggle-slider::after {
    width: 14px;
    height: 14px;
    top: 2px;
    left: 2px;
}

.toggle-switch.small input:checked + .toggle-slider::after {
    transform: translateX(14px);
}

/* Email Template Modal */
.email-template-modal {
    max-width: 700px;
    width: 95%;
}

.email-template-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.email-template-form .form-row {
    display: flex;
    gap: 16px;
}

.email-template-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.email-template-form .form-group.flex-1 {
    flex: 1;
}

.email-template-form .form-group.flex-2 {
    flex: 2;
}

.email-template-form label {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
}

.email-template-form .form-input,
.email-template-form .form-select,
.email-template-form .form-textarea {
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.email-template-form .form-input:focus,
.email-template-form .form-select:focus,
.email-template-form .form-textarea:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-bg);
}

.email-template-form .form-textarea {
    resize: vertical;
    font-family: inherit;
}

.email-template-form .form-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.form-section-header {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    margin: 8px 0 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.placeholders-reference {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: -8px;
}

.placeholders-reference summary {
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    user-select: none;
}

.placeholders-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.placeholder-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.placeholder-code:hover {
    background: var(--accent-bg);
    color: var(--accent-primary);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.toggle-label input {
    width: auto;
}

.trigger-date-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.trigger-date-row input {
    width: 70px;
}

.trigger-date-row select {
    flex: 1;
}

.trigger-date-row span {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ============================================
   NIGHT TRAINING SETTINGS
   ============================================ */

.training-settings-page {
    max-width: 900px;
}

.training-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.training-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.training-status .status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.training-status .status-indicator.enabled {
    background: #10B981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.training-status .status-indicator.disabled {
    background: #6B7280;
}

.training-status .status-text {
    font-weight: 600;
    font-size: 16px;
}

.training-actions {
    display: flex;
    gap: 10px;
}

.training-running-banner {
    background: linear-gradient(90deg, #3B82F6, #8B5CF6);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.training-running-banner a {
    color: white;
    text-decoration: underline;
    margin-left: auto;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.training-next-run {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.training-next-run .next-run-label {
    color: var(--text-secondary);
}

.training-next-run .next-run-time {
    font-weight: 600;
    color: var(--primary);
}

.training-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.training-config-grid .config-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.training-config-grid .config-item label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.training-config-grid .config-item input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    font-size: 14px;
}

.training-toggles {
    margin-bottom: 16px;
}

.training-toggles .toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    cursor: pointer;
}

.training-toggles .toggle-row input {
    width: 18px;
    height: 18px;
}

.config-item.full-width {
    grid-column: 1 / -1;
    max-width: 500px;
}

.config-item.full-width input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
}

.config-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.scenario-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.scenario-stats .stat-box {
    background: var(--bg-tertiary);
    padding: 16px 24px;
    border-radius: 8px;
    text-align: center;
    min-width: 100px;
}

.scenario-stats .stat-box .stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.scenario-stats .stat-box .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.scenario-categories {
    margin-top: 12px;
}

.scenario-categories h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-chip {
    background: var(--bg-tertiary);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    text-transform: capitalize;
}

.reports-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.report-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.report-item:hover {
    background: var(--bg-hover);
}

.report-item .report-date {
    font-weight: 600;
}

.report-item .report-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.report-item .pass-rate {
    color: #10B981;
    font-weight: 600;
}

.report-item .flagged-count {
    color: #F59E0B;
}

.report-item .acknowledged-badge {
    color: #10B981;
    font-size: 12px;
}

/* Training Live Modal */
.training-live-modal {
    max-width: 700px;
}

.training-live-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.live-progress {
    margin-bottom: 20px;
}

.live-progress .progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.progress-bar-large {
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
}

.progress-bar-large .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #10B981);
    border-radius: 12px;
    transition: width 0.3s ease;
}

.live-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.live-stats .stat-box {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-tertiary);
}

.live-stats .stat-box.pass { border-left: 4px solid #10B981; }
.live-stats .stat-box.flag { border-left: 4px solid #F59E0B; }
.live-stats .stat-box.fail { border-left: 4px solid #EF4444; }

.live-stats .stat-box .stat-value {
    font-size: 24px;
    font-weight: 700;
}

.live-stats .stat-box .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.live-categories {
    margin-bottom: 20px;
}

.live-categories h4 {
    margin-bottom: 12px;
}

.category-score {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.category-score .cat-name {
    width: 120px;
    font-size: 13px;
    text-transform: capitalize;
}

.category-score .cat-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.category-score .cat-fill {
    height: 100%;
    background: #10B981;
    border-radius: 4px;
}

.category-score .cat-pct {
    width: 40px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
}

.live-recent h4 {
    margin-bottom: 8px;
}

.recent-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
}

.recent-result.pass { background: rgba(16, 185, 129, 0.1); }
.recent-result.flag { background: rgba(245, 158, 11, 0.1); }
.recent-result.fail { background: rgba(239, 68, 68, 0.1); }

.recent-result .result-icon {
    font-size: 16px;
}

.recent-result .result-title {
    flex: 1;
    font-size: 13px;
}

.recent-result .result-confidence {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Training Report Modal */
.training-report-modal {
    max-width: 800px;
}

.training-report-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.training-report .report-header {
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.training-report .report-date {
    color: var(--text-secondary);
}

.training-report .report-summary {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
}

.training-report .summary-stat {
    text-align: center;
}

.training-report .summary-stat.highlight .stat-value {
    color: #10B981;
    font-size: 32px;
}

.training-report .report-results {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
}

.training-report .result-item {
    font-weight: 600;
}

.training-report .result-item.pass { color: #10B981; }
.training-report .result-item.flag { color: #F59E0B; }
.training-report .result-item.fail { color: #EF4444; }

.training-report .report-section {
    margin-bottom: 20px;
}

.training-report .category-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.training-report .category-name {
    width: 180px;
}

.training-report .progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.training-report .progress-fill {
    height: 100%;
    background: #10B981;
    border-radius: 4px;
}

.training-report .category-rate {
    width: 50px;
    text-align: right;
    font-weight: 600;
}

.training-report .category-status {
    width: 100px;
    font-size: 12px;
}

.flagged-section, .gaps-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.flagged-detail, .gap-detail {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 8px;
}

.flagged-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.flagged-category {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.flagged-setup {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.flagged-reason {
    font-size: 12px;
    color: #F59E0B;
}

.gap-detail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.gap-detail.high { border-left: 4px solid #EF4444; }
.gap-detail.medium { border-left: 4px solid #F59E0B; }
.gap-detail.low { border-left: 4px solid #10B981; }

.gap-severity-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-secondary);
}

.gap-detail.high .gap-severity-badge { color: #EF4444; }
.gap-detail.medium .gap-severity-badge { color: #F59E0B; }
.gap-detail.low .gap-severity-badge { color: #10B981; }

.gap-topic {
    font-weight: 600;
}

.gap-description {
    width: 100%;
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0 8px 0;
}

.resolved-badge {
    color: #10B981;
    font-size: 12px;
}

/* ---- Responsive Adjustments ---- */
@media (max-width: 768px) {
    .theo-chat-container.expanded .theo-chat-messages {
        max-height: 250px;
    }
    
    .theo-message {
        max-width: 90%;
    }
}

/* ---- Dark Mode Support (if applicable) ---- */
@media (prefers-color-scheme: dark) {
    .theo-chat-container {
        --theo-chat-bg: #2a2a2a;
        --theo-chat-border: #404040;
        --theo-chat-input-bg: #333333;
        --theo-chat-input-border: #505050;
        --theo-bubble-assistant-bg: #3a3a3a;
        --theo-bubble-assistant-text: #e0e0e0;
    }
}

/* ============================================
   CONTACTS CRM MODULE
   ============================================ */

/* Contacts Page Layout */
.contacts-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: calc(100vh - var(--top-bar-height));
}

/* Contacts Content - Side-by-side Filters + Contacts */
.contacts-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

/* Contacts Search - Inline in Stats Bar */
.contacts-search-inline {
    display: flex;
    align-items: center;
    position: relative;
    flex: 1;
    max-width: 300px;
}

.contacts-search-inline svg {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    pointer-events: none;
}

.contacts-search-inline input {
    width: 100%;
    padding: 6px 30px 6px 32px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 13px;
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.contacts-search-inline input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.contacts-search-inline input::placeholder {
    color: var(--text-muted);
}

.contacts-search-inline .search-clear {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
}

.contacts-search-inline .search-clear:hover {
    color: var(--text-primary);
}

.contacts-search-input {
    position: relative;
    max-width: 400px;
}

.contacts-search-input input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    padding-left: 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-hover);
    border-radius: var(--border-radius);
    font-size: 14px;
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.contacts-search-input input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.contacts-search-input input::placeholder {
    color: var(--text-muted);
}

.contacts-search-input svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

/* Contacts Filters Sidebar */
.contacts-filters {
    width: 220px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--bg-tertiary);
    padding: var(--spacing-lg);
    overflow-y: auto;
    flex-shrink: 0;
}

.filter-section {
    margin-bottom: var(--spacing-lg);
    background: var(--bg-tertiary);
    padding: var(--spacing-md);
    border-radius: 8px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

/* Filter Action Buttons */
.contacts-filters .filter-clear,
.contacts-filters .filter-duplicates {
    width: 100%;
    margin-top: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.contacts-filters .filter-duplicates {
    margin-top: var(--spacing-sm);
}

.contacts-filters .filter-duplicates svg {
    flex-shrink: 0;
}

.duplicates-badge {
    background: var(--accent-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Role Type Dropdown */
.role-type-dropdown {
    position: relative;
}

.role-dropdown-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.role-dropdown-trigger:hover {
    border-color: var(--accent-primary);
}

.role-dropdown-trigger svg {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.role-type-dropdown.open .role-dropdown-trigger svg {
    transform: rotate(180deg);
}

.role-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.role-type-dropdown.open .role-dropdown-menu {
    display: block;
}

.role-dropdown-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 13px;
}

.role-dropdown-option:hover {
    background: var(--bg-hover);
}

.role-dropdown-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.role-dropdown-option.selected {
    background: var(--bg-hover);
}

/* Filter Header with Manage Button */
.filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.filter-header h4 {
    margin-bottom: 0;
}

.manage-roles-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.manage-roles-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

/* Role Type Filter with Color Badge */
.filter-checkbox-color {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.filter-checkbox-color:hover {
    background: var(--bg-hover);
}

.filter-checkbox-color input {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
    cursor: pointer;
}

.filter-checkbox-color .role-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.filter-checkbox-color span {
    font-size: 13px;
    color: var(--text-secondary);
}

.filter-checkbox-color input:checked ~ span {
    color: var(--text-primary);
}

/* Manage Roles Modal */
.manage-roles-modal .modal-body {
    padding: var(--spacing-lg);
}

.roles-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    max-height: 400px;
    overflow-y: auto;
}

.role-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.role-item-drag {
    color: var(--text-muted);
    cursor: grab;
    padding: var(--spacing-xs);
}

.role-item-drag:active {
    cursor: grabbing;
}

.role-item-badge {
    flex: 1;
}

.role-item-badge .role-badge {
    font-size: 12px;
    padding: 4px 10px;
}

.role-item-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.role-item-actions button {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.role-item-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.role-item-actions button.delete-btn:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.role-item-actions .locked-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.roles-help-text {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--spacing-md);
}

/* Role Form Modal */
.role-form-modal .modal-body {
    padding: var(--spacing-lg);
}

.color-picker-row {
    display: flex;
    gap: var(--spacing-lg);
}

.color-picker-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.color-picker-group span {
    font-size: 12px;
    color: var(--text-muted);
}

.color-picker-group input[type="color"] {
    width: 60px;
    height: 36px;
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    padding: 2px;
}

.role-preview {
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.filter-checkbox,
.filter-radio {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.filter-checkbox:hover,
.filter-radio:hover {
    background: var(--bg-hover);
}

.filter-checkbox input,
.filter-radio input {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
    cursor: pointer;
}

.filter-checkbox span,
.filter-radio span {
    font-size: 13px;
    color: var(--text-secondary);
}

.filter-checkbox input:checked + span,
.filter-radio input:checked + span {
    color: var(--text-primary);
}

/* Contacts List Area */
.contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    align-self: stretch;
}

/* Contacts Grid - Column flow (top-to-bottom, then next column) */
.contacts-grid {
    column-count: auto;
    column-width: 280px;
    column-gap: var(--spacing-md);
}

.contacts-grid .contact-card {
    break-inside: avoid;
    margin-bottom: var(--spacing-md);
}

/* Contact Card */
.contact-card {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.contact-card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-company {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Role Badge */
.contact-role-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 4px;
    margin-top: var(--spacing-xs);
}

/* Role Colors */
.contact-role-badge.agent {
    background: rgba(79, 156, 249, 0.15);
    color: #4f9cf9;
}

.contact-role-badge.lender {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
}

.contact-role-badge.title {
    background: rgba(139, 92, 246, 0.15);
    color: #8B5CF6;
}

.contact-role-badge.attorney {
    background: rgba(245, 158, 11, 0.15);
    color: #F59E0B;
}

.contact-role-badge.inspector {
    background: rgba(236, 72, 153, 0.15);
    color: #EC4899;
}

.contact-role-badge.appraiser {
    background: rgba(6, 182, 212, 0.15);
    color: #06B6D4;
}

.contact-role-badge.other {
    background: rgba(107, 114, 128, 0.15);
    color: #6B7280;
}

/* Contact Card Details */
.contact-card-details {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    font-size: 13px;
    color: var(--text-secondary);
}

.contact-detail {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.contact-detail svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.contact-detail span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Contact Card Footer */
.contact-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--bg-tertiary);
}

.contact-transactions-count {
    font-size: 12px;
    color: var(--text-muted);
}

.contact-quick-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.contact-quick-action {
    width: 28px;
    height: 28px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.contact-quick-action:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.contact-quick-action svg {
    width: 14px;
    height: 14px;
}

/* Contacts Empty State */
.contacts-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl) var(--spacing-lg);
    text-align: center;
}

.contacts-empty svg {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

.contacts-empty h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.contacts-empty p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Contact Count Badge */
.contacts-count {
    font-size: 13px;
    color: var(--text-muted);
    padding: var(--spacing-sm) 0;
}

/* ============================================
   CONTACT SLIDEOUT PANEL
   ============================================ */

.slideout-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.slideout-overlay.active {
    opacity: 1;
    visibility: visible;
}

.contact-slideout {
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    max-width: 100%;
    height: 100vh;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
    z-index: 950;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
}

.contact-slideout.active {
    transform: translateX(0);
}

/* Slideout Header */
.slideout-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--bg-tertiary);
}

.slideout-contact-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.slideout-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 22px;
    flex-shrink: 0;
}

.slideout-name-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.slideout-company {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.slideout-header-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.slideout-close {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.slideout-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.slideout-close svg {
    width: 20px;
    height: 20px;
}

/* Portal Invite Button */
.btn-portal-invite {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white !important;
    border-radius: var(--border-radius);
}

.btn-portal-invite:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    transform: scale(1.05);
}

.btn-portal-invite svg {
    stroke: white;
}

/* Slideout Tabs */
.slideout-tabs {
    display: flex;
    border-bottom: 1px solid var(--bg-tertiary);
    padding: 0 var(--spacing-lg);
    background: var(--bg-secondary);
}

.slideout-tab {
    padding: var(--spacing-md) var(--spacing-lg);
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
}

.slideout-tab:hover {
    color: var(--text-primary);
}

.slideout-tab.active {
    color: var(--accent-primary);
}

.slideout-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: var(--spacing-lg);
    right: var(--spacing-lg);
    height: 2px;
    background: var(--accent-primary);
    border-radius: 2px 2px 0 0;
}

/* Slideout Content */
.slideout-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
}

.slideout-tab-content {
    display: none;
}

.slideout-tab-content.active {
    display: block;
}

/* Overview Tab */
.overview-section {
    margin-bottom: var(--spacing-lg);
}

.overview-section:last-child {
    margin-bottom: 0;
}

.overview-section h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.overview-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
    font-size: 14px;
    color: var(--text-primary);
}

.overview-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.overview-item a {
    color: var(--accent-primary);
    text-decoration: none;
}

.overview-item a:hover {
    text-decoration: underline;
}

/* Notes Section */
.contact-notes {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.contact-notes:empty::before {
    content: 'No notes added yet.';
    color: var(--text-muted);
    font-style: italic;
}

/* Transactions Tab */
.transaction-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.transaction-item {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.transaction-item:hover {
    background: var(--bg-hover);
}

.transaction-item-address {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.transaction-item-meta {
    display: flex;
    gap: var(--spacing-md);
    font-size: 12px;
    color: var(--text-secondary);
}

.transaction-item-role {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(79, 156, 249, 0.15);
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Interactions Tab */
.interactions-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.interaction-item {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.interaction-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.interaction-icon svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.interaction-icon.call svg { color: #10B981; }
.interaction-icon.email svg { color: #4f9cf9; }
.interaction-icon.text svg { color: #8B5CF6; }
.interaction-icon.note svg { color: #F59E0B; }
.interaction-icon.meeting svg { color: #EC4899; }

.interaction-content {
    flex: 1;
    min-width: 0;
}

.interaction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.interaction-type {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    text-transform: capitalize;
}

.interaction-date {
    font-size: 12px;
    color: var(--text-muted);
}

.interaction-summary {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.interaction-summary:empty::before {
    content: 'No summary';
    color: var(--text-muted);
    font-style: italic;
}

/* Empty State for Tabs */
.tab-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    text-align: center;
}

.tab-empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

.tab-empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Log Interaction Button */
.log-interaction-btn {
    width: 100%;
    margin-top: var(--spacing-md);
}

/* ============================================
   CONTACT MODALS
   ============================================ */

.contact-modal .modal {
    max-width: 520px;
}

.contact-modal .modal-body {
    max-height: 60vh;
}

/* Add Contact Modal - rounded inputs */
#contactModalOverlay input,
#contactModalOverlay select,
#contactModalOverlay textarea {
    border-radius: 8px;
}

/* Modal Sections */
.modal-section {
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
}

.modal-section:last-child {
    border-bottom: none;
}

.modal-section-header {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-primary);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-xs);
    border-bottom: 2px solid var(--accent-primary);
    display: inline-block;
}

.modal-section .form-row {
    display: flex;
    gap: var(--spacing-md);
}

.modal-section .form-group {
    margin-bottom: var(--spacing-sm);
}

.modal-section .required {
    color: #ef4444;
}

/* Form Row (2 columns) */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.form-row .form-group {
    margin-bottom: 0;
}

/* Role Select Styling */
.role-select-wrapper {
    position: relative;
}

.role-select-wrapper select {
    appearance: none;
    padding-right: 32px;
}

.role-select-wrapper::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-muted);
    pointer-events: none;
}

/* Log Interaction Modal */
.log-interaction-modal .modal {
    max-width: 480px;
}

.interaction-type-selector {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.interaction-type-btn {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-hover);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.interaction-type-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.interaction-type-btn.active {
    background: rgba(79, 156, 249, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.interaction-type-btn svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   CONTACT SLIDEOUT - EXPANDED SECTIONS
   ============================================ */

/* Header Layout */
.slideout-header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
}

.slideout-name-role h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

/* Quick Actions Bar */
.slideout-quick-actions {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--bg-hover);
}

.slideout-quick-actions .action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
}

.slideout-quick-actions .action-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.slideout-quick-actions .action-btn svg {
    width: 18px;
    height: 18px;
}

/* Section Grouping */
.slideout-section {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--bg-tertiary);
}

.slideout-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-header {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.section-header::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--accent-primary);
    border-radius: 2px;
}

/* Detail Rows (View Mode) */
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--spacing-sm) 0;
    font-size: 14px;
}

.detail-row label {
    color: var(--text-muted);
    font-size: 13px;
    min-width: 130px;
    flex-shrink: 0;
}

.detail-row .detail-value {
    color: var(--text-primary);
    text-align: right;
    flex: 1;
}

.detail-row .detail-value a {
    color: var(--accent-primary);
    text-decoration: none;
}

.detail-row .detail-value a:hover {
    text-decoration: underline;
}

.detail-row .address-value {
    text-align: right;
    line-height: 1.6;
}

/* Contact Tags */
.contact-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.contact-tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Edit Mode Footer */
.slideout-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-tertiary);
    border-top: 1px solid var(--bg-hover);
}

.slideout-footer-right {
    display: flex;
    gap: var(--spacing-md);
}

/* Form Elements in Slideout (Edit Mode) */
.slideout-section .form-row {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.slideout-section .form-row:last-child {
    margin-bottom: 0;
}

.slideout-section .form-row .form-group {
    margin-bottom: 0;
}

.slideout-section .form-row .form-group.flex-1 {
    flex: 1;
}

.slideout-section .form-row .form-group.flex-2 {
    flex: 2;
}

.slideout-section .form-group {
    margin-bottom: var(--spacing-md);
}

.slideout-section .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.slideout-section .form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

.slideout-section .form-input,
.slideout-section .form-select,
.slideout-section .form-textarea {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-hover);
    border-radius: var(--border-radius);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 14px;
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.slideout-section .form-input:focus,
.slideout-section .form-select:focus,
.slideout-section .form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.slideout-section .form-input:disabled {
    background: var(--bg-hover);
    cursor: not-allowed;
    color: var(--text-muted);
}

.slideout-section .form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* Edit button styling */
#slideoutEditBtn {
    display: flex;
    align-items: center;
    gap: 6px;
}

#slideoutEditBtn svg {
    flex-shrink: 0;
}

/* Contacts Stats Bar */
.contacts-stats-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--bg-tertiary);
    font-size: 13px;
    color: var(--text-secondary);
}

.contacts-stats-bar strong {
    color: var(--text-primary);
}

.stats-divider {
    color: var(--text-muted);
}

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.per-page-selector select {
    padding: 4px 28px 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    min-width: 70px;
}

.per-page-selector select:hover {
    border-color: var(--accent-primary);
}

.per-page-selector select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(var(--accent-primary-rgb), 0.2);
}

/* Alphabetical Tabs */
.contacts-alpha-tabs {
    display: flex;
    gap: 4px;
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    flex-wrap: wrap;
}

.alpha-tab {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.alpha-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.alpha-tab.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.alpha-tabs-divider {
    color: var(--text-muted);
    padding: 0 8px;
    display: flex;
    align-items: center;
    font-size: 14px;
}

.alpha-field-toggle {
    padding: 6px 12px;
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.alpha-field-toggle:hover {
    background: #d1d5db;
    border-color: #9ca3af;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 4px;
}

.view-toggle-btn {
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.view-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.view-toggle-btn svg {
    width: 16px;
    height: 16px;
}

/* Contacts Table (List View) */
.contacts-table-wrapper {
    flex: 1;
    overflow: auto;
    background: var(--bg-primary);
}

.contacts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.contacts-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-secondary);
}

.contacts-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.contacts-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.contacts-table th.sortable:hover {
    color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.contacts-table th .sort-icon {
    margin-left: 4px;
    opacity: 0.3;
}

.contacts-table th .sort-icon::after {
    content: '↕';
}

.contacts-table th.sorted-asc .sort-icon::after {
    content: '↑';
    opacity: 1;
}

.contacts-table th.sorted-desc .sort-icon::after {
    content: '↓';
    opacity: 1;
}

.contacts-table th.sorted-asc .sort-icon,
.contacts-table th.sorted-desc .sort-icon {
    opacity: 1;
    color: var(--accent-primary);
}

.contacts-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--bg-tertiary);
    vertical-align: middle;
}

.contacts-table tbody tr {
    transition: background var(--transition-fast);
}

.contacts-table tbody tr:hover {
    background: var(--bg-hover);
    cursor: pointer;
}

.contacts-table .contact-row-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

.contacts-table .contact-row-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.contacts-table .contact-row-info {
    display: flex;
    flex-direction: column;
}

.contacts-table .contact-row-fullname {
    font-weight: 500;
    color: var(--text-primary);
}

.contacts-table .contact-row-role {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
}

.contacts-table .contact-row-company {
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contacts-table .contact-row-phone,
.contacts-table .contact-row-email {
    color: var(--text-secondary);
}

.contacts-table .contact-row-email {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contacts-table .contact-row-actions {
    display: flex;
    gap: 8px;
}

.contacts-table .contact-row-actions button {
    padding: 6px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.contacts-table .contact-row-actions button:hover {
    background: var(--accent-primary);
    color: white;
}

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

@media (max-width: 1024px) {
    .contacts-filters {
        width: 180px;
    }

    .contact-slideout {
        width: 100%;
        max-width: 420px;
    }
}

@media (max-width: 768px) {
    .contacts-content {
        flex-direction: column;
    }

    .contacts-filters {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--bg-tertiary);
        padding: var(--spacing-md);
    }

    .filter-section {
        margin-bottom: var(--spacing-md);
    }

    .filter-options {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .contacts-grid {
        column-count: 1;
    }

    /* Hide view toggle and list view on mobile */
    .view-toggle,
    .view-toggle-divider {
        display: none !important;
    }

    .contacts-table-wrapper {
        display: none !important;
    }

    /* Stats bar wrapping on mobile */
    .contacts-stats-bar {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .contact-slideout {
        max-width: 100%;
    }

    .slideout-tabs {
        padding: 0 var(--spacing-md);
    }

    .slideout-tab {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 13px;
    }

    .slideout-quick-actions {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .slideout-section .form-row {
        flex-direction: column;
    }

    .detail-row {
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .detail-row .detail-value {
        text-align: left;
    }

    .detail-row .address-value {
        text-align: left;
    }

    .slideout-footer {
        padding: var(--spacing-sm) var(--spacing-md);
    }
}

/* ============================================
   CONTACTS LOADING STATE
   ============================================ */

.contacts-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
}

.contacts-loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   DARK NAVY THEME - NEW COMPONENTS
   COO Approved Design (theo_ux_mockup_v2.html)
   ============================================ */

/* ========== PENDING APPROVALS SECTION ========== */
.pending-section {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    border: 2px solid var(--accent-red);
    border-radius: var(--border-radius-xl);
    padding: 20px;
    margin-bottom: 25px;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.2); }
}

.pending-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.pending-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pending-count {
    background: var(--accent-red);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
}

.pending-actions {
    display: flex;
    gap: 10px;
}

.pending-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.pending-btn.primary {
    background: var(--accent-green);
    color: white;
}

.pending-btn.primary:hover {
    background: #16a34a;
}

.pending-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.pending-btn.secondary:hover {
    background: var(--bg-hover);
}

.pending-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

@media (max-width: 1200px) {
    .pending-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.pending-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px;
    border-left: 4px solid var(--accent-amber);
}

.pending-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}

.pending-card-type {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.pending-card-type.new-txn {
    background: var(--accent-blue);
    color: white;
}

.pending-card-type.document {
    background: var(--accent-green);
    color: white;
}

.pending-card-type.intake {
    background: var(--accent-purple);
    color: white;
}

.pending-card-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.pending-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.pending-card-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.4;
}

.pending-card-actions {
    display: flex;
    gap: 8px;
}

.pending-card-btn {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.pending-card-btn.approve {
    background: var(--accent-green);
    color: white;
}

.pending-card-btn.approve:hover {
    background: #16a34a;
}

.pending-card-btn.review {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.pending-card-btn.review:hover {
    background: var(--bg-hover);
}

.pending-card-btn.reject {
    background: #7f1d1d;
    color: #fca5a5;
}

.pending-card-btn.reject:hover {
    background: #991b1b;
}

/* Collapsed Pending Alert */
.pending-alert {
    background: linear-gradient(90deg, #7f1d1d, #991b1b);
    border: 2px solid var(--accent-red);
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pending-alert:hover {
    background: linear-gradient(90deg, #991b1b, #b91c1c);
}

.pending-alert-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pending-alert-icon {
    font-size: 1.5rem;
}

.pending-alert-text {
    font-weight: 600;
    color: var(--text-primary);
}

.pending-alert-count {
    background: var(--accent-red);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    color: white;
}

.pending-alert-right {
    color: #fca5a5;
    font-size: 0.9rem;
}

/* ========== STAGE PIPELINE - HORIZONTAL ========== */
.stage-pipeline {
    display: flex;
    gap: 2px;
    margin-bottom: 25px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px;
    overflow-x: auto;
}

.stage-pill {
    flex: 1;
    min-width: 90px;
    text-align: center;
    padding: 12px 8px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.stage-pill:hover {
    background: var(--bg-hover);
}

.stage-pill.active {
    background: var(--accent-blue);
    box-shadow: var(--shadow-glow-blue);
}

.stage-pill.has-items::after {
    content: attr(data-count);
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--accent-amber);
    color: #000;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stage-pill .stage-num {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.stage-pill .stage-name {
    font-size: 0.65rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.stage-pill.active .stage-name {
    color: #dbeafe;
}

.stage-pill.active .stage-num {
    color: white;
}

/* ========== TRANSACTION CARDS GRID ========== */
.txn-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

@media (max-width: 1200px) {
    .txn-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.txn-card {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    border-left: 4px solid transparent;
    transition: all 0.2s;
}

.txn-card:hover {
    background: #283548;
    transform: translateX(3px);
}

.txn-card.urgent {
    border-left-color: var(--accent-red);
}

.txn-card.warning {
    border-left-color: var(--accent-amber);
}

.txn-card.on-track {
    border-left-color: var(--accent-green);
}

.txn-address {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.txn-type {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.txn-type.buyer {
    background: var(--accent-cyan);
    color: white;
}

.txn-type.seller {
    background: var(--accent-orange);
    color: white;
}

.txn-agent {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.txn-deadline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-primary);
}

.txn-deadline.overdue {
    background: #7f1d1d;
    color: #fca5a5;
}

.txn-deadline.soon {
    background: #78350f;
    color: #fcd34d;
}

.txn-progress {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.trigger-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-top: 8px;
}

/* ========== RIGHT PANEL ========== */
.right-panel {
    width: var(--right-panel-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
}

.right-panel .panel-header {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* Quick Stats Grid */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.quick-stat-btn {
    padding: 15px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.quick-stat-btn:hover {
    background: var(--bg-hover);
}

.quick-stat-btn.alert {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    border: 1px solid var(--accent-red);
}

.quick-stat-btn .icon {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.quick-stat-btn .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.quick-stat-btn.alert .label {
    color: #fca5a5;
}

.quick-stat-btn .count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-blue);
}

.quick-stat-btn.alert .count {
    color: #fca5a5;
}

/* Activity Feed */
.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.activity-icon.pending {
    background: rgba(245, 158, 11, 0.3);
}

.activity-icon.trigger {
    background: rgba(59, 130, 246, 0.3);
}

.activity-icon.doc {
    background: rgba(34, 197, 94, 0.3);
}

.activity-icon.status {
    background: rgba(168, 85, 247, 0.3);
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-size: 0.85rem;
    margin-bottom: 3px;
    color: var(--text-primary);
}

.activity-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.activity-address {
    font-size: 0.75rem;
    color: var(--accent-blue);
    margin-top: 3px;
}

.activity-action {
    margin-top: 8px;
}

.activity-action-btn {
    padding: 5px 12px;
    border-radius: 5px;
    border: none;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.activity-action-btn.review {
    background: var(--accent-amber);
    color: #000;
}

.activity-action-btn.review:hover {
    background: #d97706;
}

/* Deadlines Section */
.deadline-section {
    margin-top: 20px;
}

.deadline-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.deadline-item.critical {
    background: #7f1d1d;
    border: 1px solid var(--accent-red);
    color: #fca5a5;
}

.deadline-time {
    color: #fcd34d;
    font-weight: 600;
    min-width: 60px;
    font-size: 0.75rem;
}

/* ========== SIDEBAR UPDATES FOR PENDING NAV ========== */
.nav-item.pending-nav {
    background: linear-gradient(90deg, #7f1d1d, #991b1b);
    color: #fca5a5;
    border: 1px solid var(--accent-red);
}

.nav-item.pending-nav:hover {
    background: linear-gradient(90deg, #991b1b, #b91c1c);
}

.nav-badge {
    margin-left: auto;
    background: var(--accent-red);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.nav-badge.warning {
    background: var(--accent-amber);
    color: #000;
}

/* ========== VIEW TOGGLE BUTTONS ========== */
.view-toggle-new {
    display: flex;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 4px;
}

.view-btn-new {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.view-btn-new:hover {
    color: var(--text-primary);
}

.view-btn-new.active {
    background: var(--accent-blue);
    color: white;
}

/* ========== SECTION LABELS ========== */
.section-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 20px 0 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

/* ========== PAGE HEADER UPDATES ========== */
.page-header-new {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-title-new {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ========== LOGO STYLING ========== */
.logo-new {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: #60a5fa;
}

/* ========== PENDING INTAKES WIDGET - DARK NAVY STYLE ========== */
/* Red/Urgent style when items are pending */
.pending-intakes-widget,
.wizard-approvals-widget {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    border: 2px solid var(--accent-red);
    border-radius: var(--border-radius-xl);
    animation: pulse-border 2s infinite;
    transition: all 0.3s ease;
}

.pending-intakes-widget .widget-header,
.wizard-approvals-widget .widget-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pending-intakes-widget .widget-header h3,
.wizard-approvals-widget .widget-header h3 {
    color: var(--text-primary);
    font-weight: 600;
}

.pending-intakes-widget .widget-count,
.wizard-approvals-widget .widget-count {
    background: var(--accent-red);
}

.pending-intakes-widget .empty-state,
.wizard-approvals-widget .empty-state {
    color: rgba(255, 255, 255, 0.7);
}

/* Neutral style when empty (count = 0) */
.pending-intakes-widget.empty,
.wizard-approvals-widget.empty {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    animation: none;
}

.pending-intakes-widget.empty .widget-header,
.wizard-approvals-widget.empty .widget-header {
    border-bottom: 1px solid var(--bg-tertiary);
}

.pending-intakes-widget.empty .widget-count,
.wizard-approvals-widget.empty .widget-count {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.pending-intakes-widget.empty .empty-state,
.wizard-approvals-widget.empty .empty-state {
    color: var(--text-muted);
}

/* ========== EXISTING TRANSACTION CARD UPDATES ========== */
.transaction-card {
    border-left: 4px solid transparent;
}

.transaction-card.urgent,
.priority-panel.critical .transaction-card {
    border-left-color: var(--accent-red);
}

.priority-panel.high .transaction-card {
    border-left-color: var(--accent-amber);
}

.priority-panel.standard .transaction-card {
    border-left-color: var(--accent-green);
}

/* ========== TRANSACTION CARD PROGRESS BARS ========== */
.transaction-card .txn-progress {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.transaction-card .progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.transaction-card .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.transaction-card .progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Transaction card trigger badge */
.transaction-card .trigger-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-top: 8px;
}

/* Transaction card warning state */
.transaction-card.warning {
    border-left-color: var(--accent-amber);
}

.transaction-card.on-track {
    border-left-color: var(--accent-green);
}

/* ========== PENDING ACTIONS BUTTONS ========== */
.pending-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pending-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.pending-btn.primary {
    background: var(--accent-green);
    color: white;
}

.pending-btn.primary:hover {
    background: #16a34a;
}

.pending-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.pending-btn.secondary:hover {
    background: var(--bg-hover);
}

/* Hide Approve All when empty */
.pending-intakes-widget.empty .pending-btn.primary {
    display: none;
}

/* ========== SIDEBAR LOGO UPDATE ========== */
.sidebar-logo .logo-text {
    color: #60a5fa;
}
