
/* Screen-reader only: visually hidden but accessible to search engines and assistive tech */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* CSS Variables for theming - Modern Matte Design */
:root {
    /* ========================================
     * SSOT: Lock/Upgrade Icon
     * Used throughout the UI for locked features that require plan upgrade.
     * Change this single value to update all lock icons consistently.
     * Note: JS files (main.js, benchmarking.js) also use this icon in strings
     *       and should be updated manually if this value changes.
     * ======================================== */
    --lock-icon: '🔒';
    
    /* Light mode - Modern matte palette */
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --input-border: #e5e7eb;
    --shadow: rgba(0,0,0,0.04);
    --shadow-md: rgba(0,0,0,0.06);
    --shadow-color: rgba(0,0,0,0.06);
    --code-bg: #f9fafb;
    --selection-bg: #bfdbfe;
    
    /* Modern matte accent colors */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    --border: #e5e7eb;
    --bg-color: #fafafa;
    
    /* Table header colors - light mode */
    --table-header-bg: #f8fafc;
    --table-header-hover: #f1f5f9;
    
    /* Warning/incomplete marker - needs contrast on white */
    --incomplete-marker: #d97706;
    
    /* Scrollbar colors */
    --scrollbar-bg: #f3f4f6;
    --scrollbar-thumb: #d1d5db;
    --scrollbar-thumb-hover: #9ca3af;
}

body[data-theme="dark"] {
    /* Dark mode - Modern matte palette */
    --bg-primary: #0a0a0a;
    --bg-secondary: #171717;
    --bg-card: #171717;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --border-color: #27272a;
    --input-border: #3f3f46;
    --shadow: rgba(0,0,0,0.2);
    --shadow-md: rgba(0,0,0,0.3);
    --shadow-color: rgba(0,0,0,0.3);
    --code-bg: #18181b;
    --selection-bg: #312e81;
    
    /* Modern matte accent colors for dark mode - desaturated for matte finish */
    --primary: #5b5bd6;  /* Muted indigo - less saturated than #6366f1 */
    --primary-hover: #6e6eef;  /* Slightly brighter for hover in dark mode */
    --success: #0d9668;  /* Muted emerald - less saturated than #10b981 */
    --warning: #d97706;  /* Kept same as light mode */
    --error: #dc2626;    /* Kept same as light mode */
    --border: #27272a;
    --bg-color: #0a0a0a;
    
    /* Table header colors - dark mode */
    --table-header-bg: #1a1d23;
    --table-header-hover: #252a33;
    
    /* Warning/incomplete marker - bright for dark bg */
    --incomplete-marker: #facc15;
    
    /* Scrollbar colors */
    --scrollbar-bg: #171717;
    --scrollbar-thumb: #3f3f46;
    --scrollbar-thumb-hover: #52525b;
}

/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Custom Scrollbar Styling - Modern Design */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-bg);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 6px;
    border: 2px solid var(--scrollbar-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-bg);
}

/* Selection styling */
::selection {
    background-color: var(--selection-bg);
    color: var(--text-primary);
}

::-moz-selection {
    background-color: var(--selection-bg);
    color: var(--text-primary);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent browser-level scrolling */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    z-index: 100;
    box-shadow: 0 2px 4px var(--shadow);
}

body[data-theme="dark"] header {
    background: #0a0a0a;
    border-bottom-color: #1a1a1a;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

.header-content {
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================
   APP LOGO (Phase 6: Productization)
   ============================================ */
.app-logo {
    display: flex;
    align-items: center;
    height: 36px;
    color: var(--text-primary);
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.app-logo:hover {
    opacity: 0.8;
}

.app-logo svg {
    height: 36px;
    width: auto;
}

/* Subtle bounce on click */
@keyframes logoBounce {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(0.92); }
    60% { transform: scale(1.06); }
    80% { transform: scale(0.98); }
}

.app-logo.logo-bounce {
    animation: logoBounce 0.4s ease;
}

/* Test mode indicator - compact style */
.test-mode-indicator {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(251, 191, 36, 0.15);
    color: #b45309;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

body[data-theme="dark"] .test-mode-indicator {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.2);
}

/* ============================================
   CREDITS BADGE (Phase 6: Productization)
   ============================================ */
.credits-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.credits-badge:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

body[data-theme="dark"] .credits-badge {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-color);
}

body[data-theme="dark"] .credits-badge:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
}

.credits-icon {
    width: 14px;
    height: 14px;
    stroke: var(--text-secondary);
}

.credits-value {
    font-weight: 600;
    color: var(--primary);
}

.credits-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.credits-badge.credits-exhausted .credits-value {
    color: var(--error);
}

.credits-badge.credits-exhausted {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}

/* ============================================
   OVER-LIMIT BANNER (Phase 9.3: Graceful Downgrades)
   Warning banner when user exceeds task limit
   ============================================ */
.over-limit-banner {
    margin: 8px 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #92400e;
}

.over-limit-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.over-limit-text {
    flex: 1;
    line-height: 1.3;
}

.over-limit-text strong {
    font-weight: 600;
    color: #b45309;
}

body[data-theme="dark"] .over-limit-banner {
    background: linear-gradient(135deg, #422006, #78350f);
    border-color: #b45309;
    color: #fcd34d;
}

body[data-theme="dark"] .over-limit-text strong {
    color: #fbbf24;
}

/* ============================================
   QUEUE PANEL (Phase 8.3: Sequential Batching)
   In task rail, collapsible panel showing job queue
   ============================================ */
.queue-panel {
    margin: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.queue-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(245, 158, 11, 0.05);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s ease;
}

.queue-panel-header:hover {
    background: rgba(245, 158, 11, 0.1);
}

.queue-panel.has-jobs .queue-panel-header {
    background: rgba(245, 158, 11, 0.1);
}

.queue-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.queue-icon {
    width: 14px;
    height: 14px;
    stroke: var(--warning);
}

.queue-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--warning);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9px;
}

.queue-count-badge.empty {
    background: var(--text-secondary);
    opacity: 0.5;
}

.queue-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.queue-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.queue-panel.collapsed .queue-toggle-btn {
    transform: rotate(-90deg);
}

.queue-panel-content {
    max-height: 200px;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.queue-panel.collapsed .queue-panel-content {
    max-height: 0;
}

.queue-dropdown-list {
    max-height: 200px;
    overflow-y: auto;
}

.queue-item {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
}

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

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

.queue-item-info {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.queue-item-info:hover {
    background-color: rgba(99, 102, 241, 0.1);
}

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

.queue-item-status {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.queue-item-status.status-running {
    color: var(--success);
}

.queue-item-status.status-running .queue-status-icon {
    animation: spin 1s linear infinite;
}

.queue-item-status.status-queued {
    color: var(--warning);
}

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

.queue-item-cancel {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.queue-item-cancel:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
}

.queue-empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.4;
}

.queue-empty-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
    opacity: 0.5;
}

/* Dark mode adjustments */
body[data-theme="dark"] .queue-panel {
    background: var(--bg-card);
}

body[data-theme="dark"] .queue-panel-header {
    background: rgba(245, 158, 11, 0.08);
}

body[data-theme="dark"] .queue-panel.has-jobs .queue-panel-header {
    background: rgba(245, 158, 11, 0.12);
}

body[data-theme="dark"] .queue-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ============================================
   TASK RAIL BENCHMARK INDICATOR
   Overlay icon for running/queued tasks (like preflight)
   ============================================ */

/* Running benchmark indicator - spinning icon at top-right of card */
.task-card.benchmark-running {
    border-color: var(--success);
}

.task-card.benchmark-running::after {
    content: '⟳';
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 1rem;
    color: var(--success);
    animation: benchmark-spin 1s linear infinite;
    z-index: 10;
}

/* Queued benchmark indicator - hourglass icon at top-right of card */
.task-card.benchmark-queued {
    border-color: var(--warning);
}

.task-card.benchmark-queued::after {
    content: '⏳';
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.9rem;
    color: var(--warning);
    opacity: 0.85;
    z-index: 10;
}

@keyframes benchmark-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
   USER MENU (Phase 6: Productization)
   ============================================ */
.user-menu {
    position: relative;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.user-avatar:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.avatar-initials {
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer; /* Inherit clickable from parent */
    pointer-events: none; /* Let clicks pass through to parent .user-avatar */
}

/* Google profile photo in avatar */
.avatar-photo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    pointer-events: none; /* Let clicks pass through to parent .user-avatar */
}

/* User Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 10px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    overflow: hidden;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.user-dropdown.hidden {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
}

body[data-theme="dark"] .user-dropdown {
    background: #1a1a1a;
    border-color: #2a2a2a;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.3);
}

.dropdown-header {
    padding: 14px 16px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

body[data-theme="dark"] .dropdown-header {
    background: #141414;
    border-bottom-color: #2a2a2a;
}

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

.dropdown-user-email {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

body[data-theme="dark"] .dropdown-divider {
    background: #2a2a2a;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s ease;
}

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

body[data-theme="dark"] .dropdown-item:hover {
    background: #252525;
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-secondary);
    flex-shrink: 0;
}

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

.dropdown-item-danger svg {
    stroke: var(--error);
}

.dropdown-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Sign In button in dropdown (guest mode) */
.dropdown-item-signin {
    color: var(--primary);
    font-weight: 600;
}

.dropdown-item-signin svg {
    stroke: var(--primary);
}

.dropdown-item-signin:hover {
    background: rgba(79, 70, 229, 0.1);
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    /* Light mode hover - preview dark mode colors */
    background-color: #171717;
    border-color: #3f3f46;
    transform: scale(1.05);
}

/* Make sun icon more visible in dark mode */
body[data-theme="dark"] .theme-toggle {
    background-color: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.4);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.2);
}

body[data-theme="dark"] .theme-toggle:hover {
    /* Dark mode hover - preview light mode colors */
    background-color: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Legacy API key section - deprecated in Phase 6 */
.api-key-section {
    display: none; /* Hidden - auth now handled via shim */
}

/* Legacy AI Generation Credits Display - deprecated in Phase 6 */
/* Use .credits-badge instead */
.generation-credits-container {
    display: none; /* Hidden - replaced by .credits-badge */
}

#apiKey {
    width: 300px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
}

/* Status bar - Toast notification style (doesn't take layout space) */
.status-bar {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    max-width: 400px;
    text-align: center;
}

.status-bar:not(:empty) {
    opacity: 1;
    pointer-events: auto;
}

.status-bar.status-info {
    background-color: var(--bg-primary);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.status-bar.status-success {
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #059669;
}

.status-bar.status-warning {
    background-color: #fffbeb;
    color: #d97706;
    border: 1px solid #d97706;
}

.status-bar.status-error {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #dc2626;
}

body[data-theme="dark"] .status-bar.status-info {
    background-color: rgba(79, 70, 229, 0.95);
    color: #e0e7ff;
}

body[data-theme="dark"] .status-bar.status-success {
    background-color: rgba(5, 80, 55, 0.95);
    color: #a7f3d0;
}

body[data-theme="dark"] .status-bar.status-warning {
    background-color: rgba(120, 65, 5, 0.95);
    color: #fcd34d;
}

body[data-theme="dark"] .status-bar.status-error {
    background-color: rgba(127, 29, 29, 0.95);
    color: #fecaca;
}

/* Note banner - Modern Matte Design */
.note-banner {
    background-color: rgba(217, 119, 6, 0.08);
    padding: 0.75rem 2rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 500;
}

/* Main container */
.container {
    display: flex;
    width: 100%;
    margin: 0;
    padding: 0;
    flex: 1;
    min-height: 0; /* Important for flex children to shrink */
    overflow: hidden;
    position: relative;
}

/* Workspace layout */
.workspace {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 100%;
}

.main-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    flex-shrink: 0;
}

.mobile-task-strip {
    display: none;
}

.main-tab {
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 12px 16px;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    border-radius: 6px 6px 0 0;
}

.main-tab:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.03);
}

body[data-theme='dark'] .main-tab:hover {
    background: rgba(255, 255, 255, 0.05);
}

.main-tab.active {
    color: var(--primary);
    border-color: var(--primary);
    font-weight: 700;
    background: rgba(79, 70, 229, 0.05);
}

body[data-theme='dark'] .main-tab.active {
    background: rgba(99, 102, 241, 0.1);
}

.main-tab:focus-visible {
    outline: none;
    border-bottom: 3px solid var(--primary);
}

.view-wrapper {
    flex: 1;
    position: relative;
    min-height: 0;
}

/* Panels - Modern Matte Design */
.left-panel, .right-panel {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: 0 1px 2px var(--shadow);
    border: 1px solid var(--border-color);
}

.left-panel {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

.right-panel {
    flex: 1;
    min-width: 0;
    position: relative;
    overflow-y: auto;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

h3 {
    font-size: 1.1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

/* Form elements */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Optional field hint - subtle, non-intimidating */
.optional-hint {
    font-weight: 400;
    font-size: 0.85em;
    color: var(--text-muted);
    opacity: 0.7;
}

input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.15s ease;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--shadow-md);
}

body[data-theme="dark"] input[type="text"]:focus,
body[data-theme="dark"] input[type="number"]:focus,
body[data-theme="dark"] input[type="password"]:focus,
body[data-theme="dark"] textarea:focus,
body[data-theme="dark"] select:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea {
    resize: vertical;
    font-family: monospace;
    line-height: 1.4;
}

/* Simple mode objective textarea - fills available space dynamically */
#simpleObjective {
    min-height: 300px;
    flex: 1 1 auto;
    resize: none; /* No resize handle */
    height: 100%; /* Fill all available space */
}

#yamlPreview {
    background-color: var(--code-bg);
    min-height: 400px;
    color: var(--text-primary);
    /* Preserve formatting for loading messages */
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Buttons */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    align-items: center;
}

/* Phase 10.4: Modern Split Button for Agent Selector */
.split-button-container {
    display: inline-flex;
    align-items: stretch;
    position: relative;
}

.split-button-container .split-main {
    border-radius: 6px 0 0 6px;
    padding: 10px 20px;
    font-weight: 600;
    min-width: 0;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.split-button-container .split-arrow {
    border-radius: 0 6px 6px 0;
    padding: 10px 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.split-button-container .split-arrow:hover {
    background-color: rgba(0, 0, 0, 0.15);
}

/* Agent Dropdown Menu - Opens upward */
.agent-dropdown-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 4px); /* Open above the button */
    top: auto;
    left: 0;
    min-width: 180px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15); /* Shadow goes up */
    z-index: 100;
    overflow: hidden;
}

.agent-dropdown-menu.show {
    display: block;
}

.agent-dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer !important;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid var(--border-color);
}

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

.agent-dropdown-item:hover:not(.locked) {
    background-color: var(--bg-secondary);
}

.agent-dropdown-item.selected {
    background-color: rgba(79, 70, 229, 0.1);
}

.agent-dropdown-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.agent-dropdown-item .agent-name {
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.agent-dropdown-item .agent-cost {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.agent-dropdown-item .agent-lock {
    font-size: 0.8rem;
}

.agent-dropdown-item .agent-info-icon {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-decoration: underline dotted;
    cursor: pointer;
}

/* Dark mode adjustments */
[data-theme="dark"] .agent-dropdown-menu {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4); /* Shadow goes up */
}

[data-theme="dark"] .agent-dropdown-item:hover:not(.locked) {
    background-color: #374151;
}

[data-theme="dark"] .agent-dropdown-item.selected {
    background-color: rgba(79, 70, 229, 0.2);
}

.btn {
    padding: 0.625rem 1.25rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn:hover:not(:disabled) {
    background-color: var(--bg-primary);
    border-color: var(--input-border);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary);
    opacity: 0.85;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--shadow-md);
}

/* Emerald/Green Button - For Purchases (matches Purchased wallet) */
.btn-purchase {
    background-color: #10b981;
    color: white;
    border-color: #10b981;
}

.btn-purchase:hover:not(:disabled) {
    background-color: #059669;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

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

.btn-success:hover:not(:disabled) {
    background-color: var(--success);
    opacity: 0.85;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--shadow-md);
}

/* Pulsing glow on Save button after task generation — draws attention */
/* Light mode: stronger shadow with darker green for contrast against white */
@keyframes saveGlowLight {
    0%, 100% { box-shadow: 0 0 6px rgba(5, 150, 105, 0.4), 0 2px 8px rgba(5, 150, 105, 0.15); }
    50% { box-shadow: 0 0 20px rgba(5, 150, 105, 0.7), 0 0 40px rgba(5, 150, 105, 0.25); }
}

/* Dark mode: brighter glow pops well against dark backgrounds */
@keyframes saveGlowDark {
    0%, 100% { box-shadow: 0 0 4px rgba(16, 185, 129, 0.3); }
    50% { box-shadow: 0 0 16px rgba(16, 185, 129, 0.6), 0 0 32px rgba(16, 185, 129, 0.2); }
}

.btn-success.save-ready {
    animation: saveGlowLight 1.8s ease-in-out infinite;
    font-weight: 600;
}

[data-theme="dark"] .btn-success.save-ready {
    animation: saveGlowDark 1.8s ease-in-out infinite;
}

/* Pulsing glow on Start Benchmark button when models are selected */
@keyframes benchGlowLight {
    0%, 100% { box-shadow: 0 0 6px rgba(79, 70, 229, 0.4), 0 2px 8px rgba(79, 70, 229, 0.15); }
    50% { box-shadow: 0 0 20px rgba(79, 70, 229, 0.7), 0 0 40px rgba(79, 70, 229, 0.25); }
}

@keyframes benchGlowDark {
    0%, 100% { box-shadow: 0 0 4px rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 0 16px rgba(99, 102, 241, 0.6), 0 0 32px rgba(99, 102, 241, 0.2); }
}

.btn-primary.bench-ready {
    animation: benchGlowLight 1.8s ease-in-out infinite;
    font-weight: 600;
}

[data-theme="dark"] .btn-primary.bench-ready {
    animation: benchGlowDark 1.8s ease-in-out infinite;
}

/* Dark Mode: Muted button colors for matte finish */
[data-theme="dark"] .btn-primary {
    background-color: #5b5bd6;  /* Muted indigo */
    border-color: #5b5bd6;
}

[data-theme="dark"] .btn-primary:hover:not(:disabled) {
    background-color: #4f4fc7;  /* Slightly darker on hover */
    border-color: #4f4fc7;
}

[data-theme="dark"] .btn-success {
    background-color: #0d9668;  /* Muted emerald */
    border-color: #0d9668;
}

[data-theme="dark"] .btn-success:hover:not(:disabled) {
    background-color: #0a7d56;  /* Slightly darker on hover */
    border-color: #0a7d56;
}

[data-theme="dark"] .btn-purchase {
    background-color: #0d9668;  /* Muted emerald */
    border-color: #0d9668;
}

[data-theme="dark"] .btn-purchase:hover:not(:disabled) {
    background-color: #0a7d56;  /* Slightly darker on hover */
    border-color: #0a7d56;
}

/* Upload section */
.upload-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

input[type="file"] {
    margin: 0.75rem 0;
}

#uploadStatus {
    margin-top: 1rem;
}

#uploadStatus ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

/* =============== Task Preview Panel Redesign =============== */

/* Task Preview panel - flex layout with scroll for reports */
.task-preview-panel {
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Panel scrolls to show reports below */
}

.task-preview-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.task-preview-panel .panel-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.task-preview-panel .panel-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-edit-preview {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    opacity: 0.6;
    transition: opacity 0.2s;
    cursor: pointer;
}

.btn-edit-preview:hover {
    opacity: 1;
}

.task-preview-panel .panel-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

/* Validation status badge */
.validation-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.validation-badge.pending {
    color: var(--text-secondary);
}

.validation-badge.valid {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #059669;
}

.validation-badge.invalid {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

.validation-badge .badge-icon {
    font-size: 0.65rem;
}

/* Spinner next to validation badge */
.validation-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 6px;
}

.validation-spinner.hidden {
    display: none;
}

/* YAML Preview textarea - fills available space, scrollable content */
.task-preview-panel .yaml-preview-wrapper {
    flex: 1 1 auto;
    height: 540px;
    min-height: 120px;
    max-height: 540px;
    overflow: hidden;
}

.task-preview-panel #yamlPreview {
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    resize: none;
    overflow-y: auto; /* Scroll if content is too long */
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    background: var(--code-bg);
}

/* Save row - contains save button and scroll indicator on same line */
.preview-save-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    margin-bottom: 16px;
    flex: 0 0 auto;
}

/* Preview save area - container for moved save button */
.preview-save-area {
    display: flex;
    gap: 10px;
}

.preview-save-area:empty {
    display: none;
}

/* Scroll indicator - inline, shows when there's content below */
.scroll-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(var(--primary-rgb), 0.06);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scroll-indicator:hover {
    background: rgba(var(--primary-rgb), 0.12);
    border-color: rgba(var(--primary-rgb), 0.25);
    color: var(--primary);
}

.scroll-indicator.hidden {
    display: none;
}

.scroll-indicator-text {
    opacity: 0.85;
}

.scroll-indicator-arrow {
    font-size: 0.85rem;
    animation: bounceDown 1.5s ease-in-out infinite;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(2px); }
}

/* Reports section - split layout */
.reports-section {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.reports-section.hidden {
    display: none;
}

/* Report cards */
.report-card {
    flex: 1 1 auto;
    min-width: 200px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.8rem;
}

.report-card.hidden {
    display: none;
}

/* Error card styling */
.report-card-errors {
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(220, 38, 38, 0.05);
}

.report-card-errors .report-title {
    color: #dc2626;
}

/* Warning card styling */
.report-card-warnings {
    border-color: rgba(217, 119, 6, 0.3);
    background: rgba(217, 119, 6, 0.05);
}

.report-card-warnings .report-title {
    color: #d97706;
}

[data-theme="dark"] .report-card-errors {
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.1);
}

[data-theme="dark"] .report-card-errors .report-title {
    color: #f87171;
}

[data-theme="dark"] .report-card-warnings {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.1);
}

[data-theme="dark"] .report-card-warnings .report-title {
    color: #fbbf24;
}

/* Preflight, Errors & Warnings collapsed by default */
.preflight-toggle,
.errors-toggle,
.warnings-toggle {
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
}

.preflight-toggle:hover,
.errors-toggle:hover,
.warnings-toggle:hover {
    opacity: 0.8;
}

.preflight-chevron,
.errors-chevron,
.warnings-chevron {
    font-size: 0.65rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    margin-left: auto;
}

.preflight-count,
.errors-count,
.warnings-count {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 6px;
}

.preflight-collapsible,
.errors-collapsible,
.warnings-collapsible {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.report-card-preflight.expanded .preflight-collapsible,
.report-card-errors.expanded .errors-collapsible,
.report-card-warnings.expanded .warnings-collapsible {
    max-height: 2000px;
}

.report-card-preflight.expanded .preflight-chevron,
.report-card-errors.expanded .errors-chevron,
.report-card-warnings.expanded .warnings-chevron {
    transform: rotate(90deg);
}

.report-card-preflight.expanded .preflight-toggle,
.report-card-errors.expanded .errors-toggle,
.report-card-warnings.expanded .warnings-toggle {
    margin-bottom: 8px;
}

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

.report-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.report-content {
    color: var(--text-secondary);
}

/* Token estimates in preflight */
.token-estimates {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.token-estimate-item {
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: monospace;
}

/* Ingest warnings */
.ingest-warnings {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ingest-warnings li {
    padding: 4px 0;
    font-size: 0.75rem;
    color: #d97706;
    border-bottom: 1px solid var(--border-color);
}

.ingest-warnings li:last-child {
    border-bottom: none;
}

/* Errors and warnings lists */
.errors-list, .warnings-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.errors-list li {
    padding: 4px 0;
    font-size: 0.75rem;
    color: #dc2626;
}

.warnings-list li {
    padding: 4px 0;
    font-size: 0.75rem;
    color: #d97706;
}

/* Spinner for preflight processing */
.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.hidden {
    display: none;
}

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

/* Save Details section */
.save-details-section {
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.save-details-section.hidden {
    display: none;
}

.save-details-section .section-header-with-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.save-details-section .section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.save-details-section .btn-icon {
    padding: 2px 6px;
    font-size: 0.7rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.save-details-content {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.75rem;
}

.save-details-content.hidden {
    display: none;
}

.detail-row {
    display: flex;
    gap: 8px;
    padding: 3px 0;
}

.detail-label {
    color: var(--text-secondary);
    min-width: 90px;
}

.detail-value {
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.7rem;
    word-break: break-all;
}

/* Dark mode adjustments */
[data-theme="dark"] .validation-badge.valid {
    color: #34d399;
}

[data-theme="dark"] .validation-badge.invalid {
    color: #f87171;
}

[data-theme="dark"] .ingest-warnings li {
    color: #fbbf24;
}

[data-theme="dark"] .errors-list li {
    color: #f87171;
}

[data-theme="dark"] .warnings-list li {
    color: #fbbf24;
}

/* Legacy results section - keep for backward compat */
.results-section {
    margin-top: 2rem;
}

.result-group {
    margin-bottom: 1rem;
}

.result-group strong {
    color: #555;
}

body[data-theme="dark"] .result-group strong {
    color: #9ca3af;
}

/* Section header with toggle button */
.section-header-with-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.section-header-with-toggle h3 {
    margin: 0;
}

.section-header-with-toggle .btn-icon {
    font-size: 12px;
    padding: 4px 8px;
    transition: transform 0.3s ease;
}

.section-header-with-toggle .btn-icon.collapsed {
    transform: rotate(-90deg);
}

#validationStatus {
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
}

#validationStatus.success {
    color: #2e7d32;
    background-color: #e8f5e9;
}

#validationStatus.error {
    color: #c62828;
    background-color: #ffebee;
}

ul {
    list-style: none;
    margin-top: 0.5rem;
}

ul li {
    padding: 0.25rem 0;
    padding-left: 1rem;
    position: relative;
}

ul li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #666;
}

ul li.empty {
    color: #999;
    font-style: italic;
}

ul li.empty:before {
    content: "";
}

/* Hidden class */
.hidden {
    display: none;
}

/* Token estimates */
#tokenEstimates {
    font-family: monospace;
    font-size: 0.9rem;
    background-color: var(--code-bg);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
}

/* Error styling */
.error {
    color: #d32f2f;
}

/* Save results */
#saveResults span {
    font-family: monospace;
    color: #1976d2;
}

/* Responsive adjustments for tablet/intermediate widths */
/* Instead of wrapping (which breaks layout), hide task rail and use mobile nav */
@media (max-width: 1200px) and (min-width: 769px) {
    /* Keep row layout, don't wrap */
    .container {
        flex-wrap: nowrap;
    }
    
    /* Narrow down task rail instead of full-width wrap */
    .task-rail {
        width: 200px;
        min-width: 200px;
        flex-shrink: 0;
    }
    
    /* Compact task cards */
    .task-card {
        padding: 8px;
    }
    
    .task-title {
        font-size: 0.8rem;
    }
    
    .task-description {
        font-size: 0.7rem;
        -webkit-line-clamp: 1;
    }
    
    /* Hide some task rail elements to save space */
    .storage-usage-container {
        display: none;
    }
    
    .task-counter-container {
        padding: 8px;
    }
    
    .task-counter-label {
        font-size: 0.75rem;
    }
    
    .workspace {
        flex: 1;
        min-width: 0;
    }

    .main-tabs {
        padding: 0 12px 4px 12px;
        gap: 12px;
    }
    
    .main-tab {
        font-size: 0.9rem;
        padding: 8px 12px;
    }

    /* --- Panels: tighter padding to reclaim space --- */
    .left-panel, .right-panel {
        padding: 1.25rem;
    }

    .view-section {
        padding: 8px 12px 12px 12px;
        gap: 14px;
    }

    /* --- Panel headers: compact --- */
    .panel-header-row {
        gap: 8px;
    }

    .panel-header-row h2 {
        font-size: 0.9rem;
    }

    .right-panel .panel-header h2 {
        font-size: 0.9rem;
    }

    /* --- Mode switcher: slightly smaller --- */
    .mode-tab {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    /* --- Buttons: compact to prevent truncation --- */
    .split-button-container .split-main {
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    .split-button-container .split-arrow {
        padding: 8px 10px;
    }

    .btn-quick-bench {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    .btn-new-task {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    /* --- Task Preview header: smaller buttons --- */
    .task-preview-panel .panel-header-right .btn-link {
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    .btn-edit-preview {
        font-size: 0.75rem;
    }

    /* --- Benchmark two-column: tighter --- */
    .benchmark-container.two-column-layout {
        gap: 12px;
    }
}

/* File checkboxes */
.file-checkboxes {
    margin: 10px 0;
    max-height: 150px;
    overflow-y: auto;
}

.file-checkboxes label {
    display: block;
    padding: 5px 10px;
    margin: 2px 0;
    background: var(--bg-color);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.file-checkboxes label:hover {
    background: var(--border-color);
}

.file-checkboxes input[type="checkbox"] {
    margin-right: 8px;
}

/* Header title group - for title + test mode indicator */
.header-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.header-title-group h1 {
    margin: 0;
}

/* Test mode indicator - subtle inline text */
.test-mode-indicator {
    font-size: 0.7rem;
    font-weight: 500;
    color: #e67e22;
    letter-spacing: 0.3px;
    opacity: 0.9;
}

.test-mode-indicator.hidden {
    display: none;
}

/* Dark mode adjustment */
[data-theme="dark"] .test-mode-indicator {
    color: #f39c12;
}

/* Tooltip */
.tooltip {
    cursor: help;
    color: var(--primary);
    font-weight: bold;
    margin-left: 5px;
    position: relative;
    display: inline-block;
    transition: all 0.2s ease;
}

.tooltip:hover {
    color: var(--primary);
    transform: scale(1.2);
}

/* Make elements with tooltips more visible */
/* Exceptions: clickable elements, links, and branding */
[title]:not(button):not(a):not(.credits-badge):not(.agent-dropdown-item):not(.task-card):not(.user-avatar):not(.avatar-initials):not(.app-logo):not(#user-avatar):not(#app-logo):not(.guest-banner-tour):not(.share-btn-social) {
    cursor: help;
}

/* Enhanced tooltip styling */
[title] {
    position: relative;
}

/* Style mode dropdown options with tooltips */
select option[title] {
    cursor: help;
}

/* Style the info symbol in dropdown options */
select option {
    font-family: var(--font-family);
}

/* Buttons with tooltips */
button[data-field] {
    position: relative;
}

/* Dark mode adjustments for tooltips */
[data-theme="dark"] .tooltip {
    color: #64B5F6;
}

[data-theme="dark"] .tooltip:hover {
    color: #90CAF9;
}

/* Test cards - Modern Matte Design */
.test-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    position: relative;
    transition: all 0.2s ease;
}

.test-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

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

.remove-test-btn {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.remove-test-btn:hover {
    background-color: #d32f2f;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-alt);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.tests-section {
    margin-top: 1.5rem;
}

.tests-header-controls {
    float: right;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.test-counter {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    min-width: 2.5rem;
    text-align: center;
}

.test-counter.warning {
    color: #f59e0b;
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.test-counter.danger {
    color: var(--error);
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

#testsContainer {
    margin-top: 1rem;
    /* No max-height or overflow - test cards flow naturally, panel scrolls */
}

.test-attachment-select {
    margin-top: 0.5rem;
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    background-color: var(--code-bg);
}

.test-attachment-select label {
    display: block;
    margin: 0.25rem 0;
}

/* Drag & drop zones */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.drop-zone.drag-over {
    border-color: var(--primary);
    background-color: rgba(59, 130, 246, 0.05);
}

body[data-theme="dark"] .drop-zone.drag-over {
    background-color: rgba(59, 130, 246, 0.1);
}

.drop-zone p {
    margin: 0;
    color: var(--text-secondary);
}

/* Prompt textarea with drag & drop capability */
.prompt-textarea-dropzone {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.prompt-textarea-dropzone.drag-over {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

/* Attachment bar - compact inline attachment controls */
.attachment-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 0;
}

.attachment-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-attach {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-attach:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

.btn-attach .attach-icon {
    font-size: 1rem;
}

/* Dark mode for attach button in Advanced mode */
[data-theme="dark"] .btn-attach {
    color: var(--text-secondary);
    border-color: var(--border-color);
    background: transparent;
}

[data-theme="dark"] .btn-attach:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

.attachment-bar .tooltip {
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: help;
}

/* Inline file list in attachment bar */
.attachment-bar .file-list-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    min-height: 28px;
    overflow-x: auto;
}

.attachment-bar .file-list-inline:empty::after {
    content: 'No attachments';
    color: var(--text-tertiary);
    font-size: 0.8rem;
    font-style: italic;
}

.attachment-bar .file-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 16px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    box-shadow: 0 1px 2px var(--shadow);
}

.attachment-bar .file-item .file-remove {
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.attachment-bar .file-item .file-remove:hover {
    opacity: 1;
    color: var(--error);
}

/* Simple Mode: Full-height layout with buttons at bottom */
#simpleMode {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: calc(100vh - 300px);
}

.simple-prompt-group {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 0; /* Remove default form-group margin */
}

.simple-prompt-group textarea {
    flex: 1 1 auto;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Simple mode buttons - more space below file list */
#simpleButtons {
    flex-shrink: 0;
    margin-top: 16px;
    flex-wrap: wrap;
    align-items: center;
}

/* Drag-over state for textarea */
.simple-prompt-group textarea.drag-over {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

[data-theme="dark"] .simple-prompt-group textarea.drag-over {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}

/* Button group with attach icon */
.button-group .btn-icon-only {
    margin-right: 8px;
}

/* Icon-only button (e.g., attach) */
.btn-icon-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon-only:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.btn-icon-only svg {
    flex-shrink: 0;
}

[data-theme="dark"] .btn-icon-only {
    color: var(--text-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-icon-only:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

/* Inline file list (compact, horizontal scroll if overflow) */
.file-list-inline {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    padding: 4px 0;
    min-height: 36px; /* Explicit min height for cards */
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: thin; /* Firefox */
}

.file-list-inline:empty {
    display: none;
    margin: 0;
    padding: 0;
}

/* Subtle scrollbar for file list */
.file-list-inline::-webkit-scrollbar {
    height: 4px;
}

.file-list-inline::-webkit-scrollbar-track {
    background: transparent;
}

.file-list-inline::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.file-list-inline .file-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    font-size: 0.8rem;
    line-height: 1;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 16px; /* Pill shape */
    box-shadow: 0 0 0 1px var(--border-color); /* Use box-shadow instead of border */
    flex-shrink: 0;
    white-space: nowrap;
    height: 28px; /* Explicit height */
    box-sizing: border-box;
    color: var(--text-primary);
    line-height: 1;
    flex-shrink: 0; /* Don't shrink chips */
    white-space: nowrap;
}

.file-list-inline .file-item .file-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-list-inline .file-item .remove-file {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    opacity: 0.7;
    transition: all 0.15s ease;
    margin-left: 2px;
}

.file-list-inline .file-item .remove-file:hover {
    opacity: 1;
    color: var(--error);
}

[data-theme="dark"] .file-list-inline .file-item {
    background: var(--bg-tertiary);
    box-shadow: 0 0 0 1px var(--border-color);
}

.btn-small {
    font-size: 0.9rem;
    padding: 2px 8px;
}

/* Bundle meter */
.bundle-meter {
    margin: 12px 0;
}

.meter-bar {
    width: 100%;
    height: 20px;
    background-color: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.meter-fill {
    height: 100%;
    background-color: var(--success);
    transition: width 0.3s ease;
}

.meter-text {
    display: block;
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* File list */
.file-list {
    max-height: 200px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.file-item label {
    flex: 1;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.file-item input[type="checkbox"] {
    margin-right: 8px;
}

.file-name {
    flex: 1;
}

.file-size {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-left: 8px;
}

.test-attachments {
    margin-top: 8px;
}

.available-uploads {
    margin-top: 12px;
}

/* =============== Edit Mode Banner =============== */
.edit-mode-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(79, 70, 229, 0.04));
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.edit-mode-banner.hidden {
    display: none;
}

.edit-mode-icon {
    font-size: 1rem;
}

.edit-mode-text {
    flex: 1;
    color: var(--text-secondary);
}

.edit-mode-text strong {
    color: var(--primary);
    font-weight: 600;
}

.btn-new-task {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 4px 10px;
    transition: all 0.15s ease;
}

.btn-new-task:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Quick Benchmark button */
.btn-quick-bench {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border: 1px solid transparent;
    color: white;
    font-size: 0.8rem;
    padding: 4px 12px;
    transition: all 0.15s ease;
    font-weight: 500;
}

.btn-quick-bench:hover {
    filter: brightness(1.15);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.btn-quick-bench:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: none;
    box-shadow: none;
}

/* Hide Quick Benchmark for guest users (they can't save tasks) */
body.guest-mode .btn-quick-bench {
    display: none;
}

/* Quick Benchmark confirmation bar */
.quick-bench-confirm {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 16px;
    padding: 32px 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 100;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    min-width: 380px;
    max-width: 90%;
    animation: slideDownFadeIn 0.3s ease-out;
}

.quick-bench-confirm-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.quick-bench-confirm-cost {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.quick-bench-confirm-cost .tooltip {
    font-size: 0.75rem;
    margin-left: 4px;
    color: var(--text-secondary);
    opacity: 0.7;
    cursor: help;
}

@keyframes slideDownFadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.quick-bench-confirm.hidden {
    display: none;
}

.quick-bench-confirm-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.quick-bench-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.quick-bench-confirm-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.quick-bench-confirm-actions .btn {
    padding: 10px 28px;
    font-size: 0.95rem;
}

/* Upgrade-locked buttons (at limit, click opens billing) */
.btn.upgrade-locked {
    position: relative;
    opacity: 0.7;
    cursor: pointer !important;
}

.btn.upgrade-locked::before {
    content: var(--lock-icon) ' ';
    font-size: 0.85em;
}

.btn.upgrade-locked:hover {
    opacity: 0.9;
    border-color: var(--primary);
}

/* Dark mode adjustments */
body[data-theme='dark'] .edit-mode-banner {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.06));
    border-color: rgba(99, 102, 241, 0.25);
}

/* =============== Panel Headers (Unified) =============== */
.panel-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 10px;
    flex-wrap: wrap;
}

.panel-header-row h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* Right panel header in Editor view */
.right-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    margin-bottom: 1rem;
    border-bottom: none;
    background: transparent;
}

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

.mode-switcher {
    display: inline-flex;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    min-width: 0;
    overflow: hidden;
    background: var(--bg-primary);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.mode-tab {
    padding: 6px 14px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
    font-size: 0.8rem;
    position: relative;
}

.mode-tab:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background: var(--border-color);
}

.mode-tab:hover:not(.active) {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

body[data-theme='dark'] .mode-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06);
}

.mode-tab.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.mode-tab.active::after {
    display: none;
}

.mode-content {
    animation: fadeIn 0.2s ease;
    flex: 1 1 auto; /* Allow mode content to fill available space */
}

.mode-content[style*="display: none"] {
    animation: none;
}

/* =============== Task Rail =============== */
.task-rail {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
    flex-shrink: 0;
    z-index: 10;
}

/* Dark mode specific styling for task rail */
body[data-theme="dark"] .task-rail {
    background: #0a0a0a;
    border-right-color: #1a1a1a;
}

.task-rail-header {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

body[data-theme="dark"] .task-rail-header {
    border-bottom-color: #1a1a1a;
}

.task-rail-title {
    flex: 0;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--text-primary);
}

.task-search-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.task-search {
    width: 100%;
    padding: 6px 32px 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s;
}

/* Hide the browser's default search clear button */
.task-search::-webkit-search-cancel-button,
.task-search::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.search-clear-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    display: none;
}

.search-clear-btn:hover {
    opacity: 1;
}

.task-search:not(:placeholder-shown) ~ .search-clear-btn {
    display: block;
}

body[data-theme="dark"] .task-search {
    background: #171717;
    border-color: #27272a;
}

.task-search:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-primary);
}

body[data-theme="dark"] .btn-icon {
    border-color: #27272a;
}

.btn-icon:hover {
    background: var(--bg-primary);
    border-color: var(--primary);
    transform: scale(1.05);
}

body[data-theme="dark"] .btn-icon:hover {
    background: #171717;
}

#task-rail-toggle {
    transition: transform 0.3s;
}

body.rail-collapsed #task-rail-toggle {
    transform: rotate(180deg);
}

.task-rail-strip {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Custom scrollbar for dark mode */
body[data-theme="dark"] .task-rail-strip::-webkit-scrollbar {
    width: 8px;
}

body[data-theme="dark"] .task-rail-strip::-webkit-scrollbar-track {
    background: #0a0a0a;
}

body[data-theme="dark"] .task-rail-strip::-webkit-scrollbar-thumb {
    background: #27272a;
    border-radius: 4px;
}

body[data-theme="dark"] .task-rail-strip::-webkit-scrollbar-thumb:hover {
    background: #3f3f46;
}

/* Compact mode - narrow rail with minimal task info but full functionality */
body.rail-collapsed .task-rail {
    width: 50px;
    min-width: 50px;
}

body.rail-collapsed .task-rail-header {
    flex-direction: column;
    padding: 8px 4px;
    gap: 6px;
}

body.rail-collapsed .task-rail-title,
body.rail-collapsed #task-search,
body.rail-collapsed .task-search-wrapper,
body.rail-collapsed #task-rail-refresh {
    display: none;
}

body.rail-collapsed .storage-usage-container {
    display: none;
}

body.rail-collapsed .task-rail-strip {
    padding: 4px;
}

/* Compact task cards */
body.rail-collapsed .task-card {
    padding: 6px;
    margin-bottom: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
}

body.rail-collapsed .task-card .task-title {
    font-size: 0.65rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
    line-height: 1.2;
}

body.rail-collapsed .task-card .task-meta,
body.rail-collapsed .task-card .task-snippet {
    display: none;
}

/* Tooltip on hover for compact cards */
body.rail-collapsed .task-card {
    position: relative;
}

body.rail-collapsed .task-card[data-task-name]::after {
    content: attr(data-task-name);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 100;
}

body.rail-collapsed .task-card:hover::after {
    opacity: 1;
}

/* Active state in compact mode */
body.rail-collapsed .task-card.active {
    background: var(--primary);
    border-color: var(--primary);
}

body.rail-collapsed .task-card.active .task-title {
    color: white;
}

/* Task Cards */
.task-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

body[data-theme="dark"] .task-card {
    background: #171717;
    border-color: #27272a;
}

.task-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow);
    border-color: var(--primary);
}

body[data-theme="dark"] .task-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.task-card.active {
    border-color: var(--primary);
    background-color: rgba(79, 70, 229, 0.08);
    box-shadow: 0 0 0 2px var(--primary);
}

body[data-theme="dark"] .task-card.active {
    background-color: rgba(99, 102, 241, 0.15);
    box-shadow: 0 0 0 2px var(--primary);
}

/* Preflight loading indicator on task card */
.task-card.preflight-loading {
    pointer-events: none;
    border-color: var(--primary);
}

.task-card.preflight-loading::after {
    content: '⟳';
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.85rem;
    color: var(--primary);
    animation: preflight-spin 1s linear infinite;
}

@keyframes preflight-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Gray out other tasks while preflight is running */
.task-rail-strip:has(.task-card.preflight-loading) .task-card:not(.preflight-loading) {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

.task-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.task-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

body[data-theme="dark"] .task-meta {
    color: #71717a;
}

.task-snippet {
    font-size: 0.875rem;
    color: var(--text-secondary);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

body[data-theme="dark"] .task-snippet {
    color: #a1a1aa;
}

/* No tasks message */
.no-tasks {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-size: 0.875rem;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px;
    min-width: 100px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    z-index: 1000;
    backdrop-filter: blur(12px);
}

body[data-theme="dark"] .context-menu {
    background: rgba(23, 23, 23, 0.95);
    border-color: #27272a;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8);
}

.context-menu-item {
    padding: 10px 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.context-menu-item:hover {
    background: var(--bg-primary);
    color: var(--primary);
}

body[data-theme="dark"] .context-menu-item:hover {
    background: rgba(79, 70, 229, 0.1);
}

/* =============== Layout Fixes =============== */
/* .container height handled in Main Container section */

/* Loading animation for YAML preview - amber for "processing" state */
#yamlPreview.loading-animation {
    color: #d97706;
    font-weight: 700;
}

/* Generating Overlay — spinner + label centered over the YAML preview */
.yaml-preview-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.generating-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: var(--bg-card);
    border-radius: 8px;
    z-index: 2;
}

.generating-overlay.hidden {
    display: none;
}

.generating-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: #d97706;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.generating-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #d97706;
    letter-spacing: 0.02em;
}

/* Post-generation tip — floats over YAML preview, no layout impact */
.preview-tip {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    z-index: 5;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary);
    border-radius: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
    animation: tipFadeIn 0.3s ease-out;
}
@keyframes tipFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.preview-tip.hidden {
    display: none;
}
.preview-tip-icon {
    flex-shrink: 0;
    font-size: 0.95rem;
    margin-top: 1px;
}
.preview-tip-text strong {
    color: var(--text-primary);
}
.preview-tip-dismiss {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.preview-tip-dismiss:hover {
    opacity: 1;
}

/* Processing message style for preflight checks and other status messages */
.processing-message {
    color: #d97706;
    font-weight: 700;
}

/* Rotating dots animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =============== Manual Mode Buttons =============== */
#manualMode .button-group .btn {
    padding: 8px 14px;
    font-size: 0.875rem;
}

#copyFromPreviewBtn {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

#copyFromPreviewBtn:hover {
    background: #4338ca;
}

#validateManualBtn,
#preflightManualBtn,
#applyToAdvancedBtn {
    background: #374151;
    color: white;
    border-color: #374151;
}

#validateManualBtn:hover,
#preflightManualBtn:hover,
#applyToAdvancedBtn:hover {
    background: #1f2937;
}

#saveManualBtn {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

#saveManualBtn:hover {
    background: #047857;
}

/* Dark mode adjustments */
body[data-theme="dark"] #validateManualBtn,
body[data-theme="dark"] #preflightManualBtn,
body[data-theme="dark"] #applyToAdvancedBtn {
    background: #4b5563;
    border-color: #4b5563;
}

body[data-theme="dark"] #validateManualBtn:hover,
body[data-theme="dark"] #preflightManualBtn:hover,
body[data-theme="dark"] #applyToAdvancedBtn:hover {
    background: #6b7280;
}

/* Status bar styling - MOVED to toast notification style at top of file */

/* Validation Card Styles */
.validation-error-card,
.validation-warning-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 1rem;
    transition: border-color 0.2s;
}

.validation-error-card {
    border-color: var(--error);
    background-color: rgba(239, 68, 68, 0.05);
}

.validation-warning-card {
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.05);
}

.validation-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.validation-card-message {
    font-weight: 600;
    color: var(--text-primary);
}

.validation-card-path {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
}

.validation-card-hint,
.validation-card-raw {
    margin-top: 0.75rem;
}

.validation-card-hint summary,
.validation-card-raw summary {
    cursor: pointer;
    color: var(--primary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.validation-card-hint pre,
.validation-card-raw code {
    background: var(--bg-primary);
    padding: 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    overflow-x: auto;
    margin-top: 0.5rem;
}

.validation-card-fixes {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.validation-card-fixes .btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* Location text - shows line number and edit link */
.validation-card-location-text {
    margin: 0.5rem 0 0.75rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.validation-card-location-text .location-line {
    font-weight: 600;
    color: var(--primary);
    font-family: var(--font-mono);
}

.validation-card-location-text .location-desc {
    color: var(--text-secondary);
}

.validation-card-location-text .edit-link {
    color: var(--primary);
    text-decoration: none;
    margin-left: 0.25rem;
}

.validation-card-location-text .edit-link:hover {
    text-decoration: underline;
}

.validation-card-location-text .edit-link strong {
    font-weight: 600;
}

/* Code snippet showing problematic YAML */
.validation-card-snippet {
    margin: 0.75rem 0;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    overflow: hidden;
}

.snippet-label {
    background: var(--bg-tertiary, #2a2a2a);
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
}

.snippet-code {
    background: var(--bg-primary);
    padding: 0.75rem;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.6;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
    color: var(--text-primary);
}

/* Suggestion box - how to fix */
.validation-card-suggestion {
    margin: 0.75rem 0;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 0.375rem;
    overflow: hidden;
}

.suggestion-label {
    background: rgba(59, 130, 246, 0.15);
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
}

.suggestion-text {
    padding: 0.75rem;
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--text-primary);
    background: transparent;
}

/* Dark mode adjustments for validation cards */
body[data-theme="dark"] .validation-error-card {
    background-color: rgba(239, 68, 68, 0.1);
}

body[data-theme="dark"] .snippet-label {
    background: #1a1d23;
}

body[data-theme="dark"] .validation-card-suggestion {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.25);
}

body[data-theme="dark"] .suggestion-label {
    background: rgba(59, 130, 246, 0.2);
}

body[data-theme="dark"] .validation-warning-card {
    background-color: rgba(245, 158, 11, 0.1);
}

body[data-theme="dark"] .validation-card-hint pre,
body[data-theme="dark"] .validation-card-raw code {
    background: #1a1a1a;
}

/* Editor with line numbers */
.editor-container {
    position: relative;
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    overflow: hidden;
    background: var(--bg-primary);
}

.line-numbers {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.75rem 0.5rem;
    font-family: monospace;
    text-align: right;
    user-select: none;
    min-width: 3rem;
    border-right: 1px solid var(--border-color);
    overflow-y: hidden; /* Controlled by JS scroll sync */
    overflow-x: hidden;
    flex-shrink: 0;
}

.editor-container textarea {
    border: none;
    flex: 1;
    resize: none;
    padding: 0.75rem 1rem;
    background: transparent;
    /* CRITICAL: Disable text wrapping so line numbers stay in sync */
    white-space: pre;
    overflow-x: auto; /* Horizontal scroll for long lines */
    overflow-y: hidden; /* No internal scroll - parent panel scrolls */
    min-height: 400px; /* Minimum height for empty state */
    height: auto; /* Auto-expand to content */
}

/* Ensure consistent line height and font - use em units for zoom resilience */
.editor-container textarea,
.line-numbers {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5em; /* em-based for zoom resilience */
}

/* Match padding exactly for alignment */
.line-numbers {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

/* Editor hint for horizontal scrolling */
.editor-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
    opacity: 0.7;
    font-style: italic;
}

/* Dark mode adjustments */
body[data-theme="dark"] .line-numbers {
    background: #1a1a1a;
    color: #6b7280;
}

/* Storage Usage Meter */
.storage-usage-container {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

body[data-theme="dark"] .storage-usage-container {
    background: #1a1a1a;
    border-bottom-color: #27272a;
}


.storage-usage-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.btn-link {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--primary);
    cursor: pointer;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
    font-weight: 500;
    text-decoration: none;
}

.btn-link:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    transform: translateY(-1px);
}

body[data-theme="dark"] .btn-link {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.3);
}

body[data-theme="dark"] .btn-link:hover {
    background: rgba(79, 70, 229, 0.2);
    border-color: var(--primary);
}

.storage-usage-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

body[data-theme="dark"] .storage-usage-bar-container {
    background: #0a0a0a;
}

.storage-usage-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
    width: 0%;
}

.storage-usage-bar.warning {
    background: #f59e0b;
}

.storage-usage-bar.danger {
    background: var(--error);
}

.storage-usage-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Task Counter */
.task-counter-container {
    padding: 0.5rem 1rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

body[data-theme="dark"] .task-counter-container {
    background: #1a1a1a;
    border-bottom-color: #27272a;
}

body.rail-collapsed .task-counter-container {
    display: none;
}

/* Clickable task counter container (non-Expert users at warning/limit) */
.task-counter-container.clickable-upgrade {
    cursor: pointer !important;
    transition: background-color 0.15s ease;
}

.task-counter-container.clickable-upgrade:hover {
    background-color: rgba(99, 102, 241, 0.1);
}

.task-counter-container.clickable-upgrade .task-counter,
.task-counter-container.clickable-upgrade .task-counter[title] {
    cursor: pointer !important;
}

.task-counter-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    font-size: 0.875rem;
}

.task-counter {
    font-weight: 600;
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: help;
    transition: all 0.2s;
}

.task-counter.normal {
    color: var(--text-primary);
    background: var(--bg-primary);
}

.task-counter.warning {
    color: #d97706;
    background: rgba(245, 158, 11, 0.15);
}

.task-counter.limit {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.15);
    font-weight: 700;
}

body[data-theme="dark"] .task-counter.warning {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.2);
}

body[data-theme="dark"] .task-counter.limit {
    color: #f87171;
    background: rgba(239, 68, 68, 0.25);
}

.task-counter-bar-container {
    width: 100%;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

body[data-theme="dark"] .task-counter-bar-container {
    background: #0a0a0a;
}

.task-counter-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease, background 0.3s ease;
    width: 0%;
}

.task-counter-bar.warning {
    background: #f59e0b;
}

.task-counter-bar.limit {
    background: #ef4444;
}

/* Modal Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

body[data-theme="dark"] .modal-backdrop {
    background: rgba(0, 0, 0, 0.7);
}

.modal-backdrop.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

/* Generic Dialog Modal Styles */
.dialog-modal {
    max-width: 400px;
    padding: 0;
    overflow: hidden;
    animation: slideIn 0.2s ease;
}

.dialog-modal .modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    background: var(--bg-secondary);
}

.dialog-modal .prompt-input {
    width: 100%;
    margin-top: 0.5rem;
}

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

body[data-theme="dark"] .modal-content {
    background: #0a0a0a;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.8);
}

body[data-theme="dark"] .dialog-modal .modal-footer {
    background: #1a1a1a;
    border-top-color: #27272a;
}

/* Signature Warning Modal */
.signature-warning-modal {
    max-width: 500px;
}

.signature-warning-modal .warning-header {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-bottom: 1px solid #f59e0b;
}

.signature-warning-modal .warning-header h2 {
    color: #92400e;
    font-size: 1rem;
}

body[data-theme="dark"] .signature-warning-modal .warning-header {
    background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
    border-bottom-color: #b45309;
}

body[data-theme="dark"] .signature-warning-modal .warning-header h2 {
    color: #fbbf24;
}

.signature-warning-modal .warning-detail {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    padding: 12px;
    margin: 12px 0;
    border-radius: 4px;
    color: #92400e;
}

body[data-theme="dark"] .signature-warning-modal .warning-detail {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.signature-warning-modal .warning-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
    border: none;
}

.btn-warning:hover {
    background: #d97706;
}

.modal-content.modal-large {
    max-width: 800px;
}

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

body[data-theme="dark"] .modal-header {
    border-bottom-color: #27272a;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.storage-summary {
    margin-bottom: 2rem;
}

.storage-summary h3 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    color: var(--text-primary);
}

#modal-storage-usage {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.storage-breakdown h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s;
}

body[data-theme="dark"] .breakdown-item {
    background: #1a1a1a;
    border-color: #27272a;
}

.breakdown-item:hover {
    border-color: var(--primary);
}

.breakdown-info {
    flex: 1;
}

.breakdown-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

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

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

.btn-danger {
    background: var(--error);
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

/* Stop generation button */
.stop-generation-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    margin-left: 0.5rem;
}

.stop-generation-btn:hover {
    background: var(--danger, #dc3545);
    color: white;
    border-color: var(--danger, #dc3545);
}

.stop-generation-btn.hidden {
    display: none;
}

/* Storage quota exceeded card */
.quota-exceeded-card {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

body[data-theme="dark"] .quota-exceeded-card {
    background: rgba(239, 68, 68, 0.15);
}

.quota-exceeded-header {
    font-weight: 600;
    color: var(--error);
    margin-bottom: 0.5rem;
}

.quota-exceeded-details {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.quota-exceeded-cta {
    margin-top: 1rem;
}

.quota-exceeded-cta .btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.quota-exceeded-cta .btn-primary:hover {
    background: #4338ca;
}

/* =========================================================================
   Budget Suggestions Modal
   ========================================================================= */

.budget-suggestions-modal {
    max-width: 560px;
}

.budget-header {
    text-align: center;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.budget-header-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.budget-header h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.budget-header-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.budget-cost-summary {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

body[data-theme="dark"] .budget-cost-summary {
    background: #141414;
    border-color: #27272a;
}

.budget-cost-item {
    text-align: center;
}

.budget-cost-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.budget-cost-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

.budget-cost-value.estimate {
    color: var(--error);
}

.budget-cost-value.balance {
    color: var(--text-primary);
}

.budget-cost-value.shortfall {
    color: var(--warning);
}

.budget-explanation {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.75rem;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 4px;
    border-left: 3px solid var(--primary);
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

body[data-theme="dark"] .budget-explanation {
    background: rgba(99, 102, 241, 0.12);
}

.budget-suggestions-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.budget-suggestions-title::before {
    content: "💡";
}

.budget-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.budget-suggestion-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.15s ease;
    cursor: pointer;
}

.budget-suggestion-card:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

body[data-theme="dark"] .budget-suggestion-card {
    background: #141414;
    border-color: #27272a;
}

body[data-theme="dark"] .budget-suggestion-card:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
}

.budget-suggestion-info {
    flex: 1;
}

.budget-suggestion-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
}

.budget-suggestion-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.budget-suggestion-cost {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    color: #10b981;
    font-weight: 500;
}

.budget-suggestion-savings {
    color: var(--primary);
}

.budget-suggestion-warning {
    color: var(--warning);
    font-style: italic;
}

.budget-suggestion-action {
    flex-shrink: 0;
}

.budget-suggestion-card .btn-start {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
}

.budget-suggestion-card .btn-start:hover {
    background: #4338ca;
}

body[data-theme="dark"] .budget-suggestion-card .btn-start {
    background: #5b5bd6;
}

body[data-theme="dark"] .budget-suggestion-card .btn-start:hover {
    background: #4f4fcc;
}

.budget-footer {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.budget-footer .btn-secondary {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.budget-footer .btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--primary);
}

.budget-footer .btn-buy {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
}

.budget-footer .btn-buy:hover {
    background: #059669;
}

body[data-theme="dark"] .budget-footer .btn-buy {
    background: #0d9668;
}

body[data-theme="dark"] .budget-footer .btn-buy:hover {
    background: #0a7a55;
}

body[data-theme="dark"] .budget-footer {
    border-top-color: #27272a;
}

/* Panel Header (generic - used in Editor view) */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

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

/* Authoring Guide Modal */
.modal-fullscreen {
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    margin: 5vh auto;
}

.modal-header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.guide-search {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 300px;
}

.guide-search:focus {
    outline: none;
    border-color: var(--primary);
}

.guide-body {
    height: calc(100% - 60px);
    overflow: hidden;
    padding: 0;
}

#guide-content {
    width: 100%;
    height: 100%;
    overflow: hidden; /* Let iframe handle scrolling */
}

#guide-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Dark mode fixes for guide */
body[data-theme="dark"] .guide-search {
    background: var(--bg-secondary);
}

/* Search highlight */
.search-highlight {
    background: #ffeb3b;
    color: #000;
    padding: 2px 4px;
    border-radius: 2px;
}

body[data-theme="dark"] .search-highlight {
    background: #ffc107;
    color: #000;
}

/* Learn more links in validation cards */
.validation-card-learn-more {
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.validation-card-learn-more a {
    color: var(--primary);
    text-decoration: none;
}

.validation-card-learn-more a:hover {
    text-decoration: underline;
}

/* =============== VIEWS =============== */
.view-section {
    position: absolute;
    inset: 0;
    padding: 8px 20px 20px 20px;
    background-color: var(--bg-primary);
    transition: transform 0.3s ease, opacity 0.3s ease;
    overflow-y: auto;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.view-section.active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
    visibility: visible;
}

.view-section.hidden {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    visibility: hidden;
}

/* Ensure left/right panels take full height in view */
.view-section .left-panel, 
.view-section .right-panel {
    height: 100%;
    overflow-y: auto;
}

/* Benchmark View Styles */
.benchmark-container {
    max-width: 1200px;
    margin: 0 auto 0 0;
    width: 100%;
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow);
}

.benchmark-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.benchmark-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Task Rail adjustments to sit above views if needed */
.task-rail {
    z-index: 20;
}

/* ==================================================================================================================
    Media Queries
   ================================================================================================================== */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
    }
    
    .task-rail {
        display: none;
    }
    
    /* When task rail is active on mobile */
    .task-rail.active {
        display: flex;
        position: fixed;
        left: 0;
        top: 60px;
        bottom: 0;
        width: 80%;
        z-index: 100;
        background: var(--bg-secondary);
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    }
    
    .header-content {
        flex-direction: row;
        gap: 10px;
        height: auto;
        padding: 10px 16px;
    }
    
    .header-left {
        flex-shrink: 0;
    }
    
    .app-logo svg {
        height: 28px;
    }
    
    .header-right {
        flex: 1;
        justify-content: flex-end;
        gap: 8px;
    }
    
    /* Compact credits badge on mobile */
    .credits-badge {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    
    .credits-label {
        display: none; /* Hide "credits" text on mobile */
    }
    
    .credits-icon {
        width: 12px;
        height: 12px;
    }
    
    /* Smaller avatar on mobile */
    .user-avatar {
        width: 32px;
        height: 32px;
    }
    
    .avatar-initials {
        font-size: 0.65rem;
    }
    
    .user-dropdown {
        right: -8px;
        width: 200px;
    }
    
    .view-section {
        padding: 10px;
    }

    .main-tabs {
        padding: 0 12px 4px 12px;
        gap: 12px;
    }
}

/* =============== BENCHMARKING UI =============== */
.benchmark-container.two-column-layout {
    display: flex;
    gap: 20px;
    height: 100%;
    max-width: none; /* Override default constraint */
    margin: 0;
    padding: 0; /* Remove container padding, panels have their own */
    background: transparent;
    border: none;
    box-shadow: none;
}

.model-selection-panel {
    position: relative;
    flex: 1;
    min-width: 0; /* Allow shrinking */
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.config-panel {
    width: 280px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Benchmark panel headers */
.model-selection-panel .panel-header,
.config-panel .panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.model-selection-panel .panel-header h2,
.config-panel .panel-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.model-selection-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px; /* Extra space for scrolling */
}

.provider-group {
    margin-bottom: 25px;
}

.provider-header {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
}

.model-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.model-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.model-card:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow);
}

.model-card.selected {
    border-color: var(--primary);
    background-color: rgba(79, 70, 229, 0.08);
    box-shadow: 0 0 0 2px var(--primary);
}

body[data-theme='dark'] .model-card.selected {
    background-color: rgba(99, 102, 241, 0.15);
}

/* Phase 9.5: Locked Model Upsell */
.model-card.locked-model {
    opacity: 0.6;
    filter: grayscale(0.5);
    cursor: pointer;
    border-color: var(--border-color);
    position: relative;
}

.model-card.locked-model::before {
    content: var(--lock-icon);
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.75rem;
    z-index: 2;
}

.model-card.locked-model:hover {
    border-color: var(--warning);
    opacity: 0.8;
    filter: grayscale(0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.model-card.locked-model .model-name {
    color: var(--text-secondary);
}

body[data-theme='dark'] .model-card.locked-model:hover {
    box-shadow: 0 2px 6px rgba(251, 191, 36, 0.15);
    box-shadow: 0 0 0 2px var(--primary);
}

.model-name {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-context {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.config-form {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.action-bar {
    padding: 12px 14px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    margin-top: auto; /* Push to bottom */
    flex-shrink: 0;
}

/* Cost Estimate Display — above Start Benchmark button */
.cost-estimate {
    text-align: center;
    padding: 6px 10px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    line-height: 1.4;
}

.cost-estimate.hidden {
    display: none;
}

.cost-estimate-label {
    color: var(--text-secondary);
}

.cost-estimate-value {
    font-weight: 600;
    color: var(--text-primary);
}

.cost-estimate .tooltip {
    font-size: 0.7rem;
    margin-left: 3px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.cost-estimate-warn {
    margin-left: 4px;
    color: #e6a817;
    cursor: help;
    font-size: 0.85rem;
}

.full-width {
    width: 100%;
    padding: 10px;
    font-size: 0.85rem;
}

.loading-placeholder {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}



/* Filter bar */
.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* ============================================================================
   PROVIDER LOGO SYSTEM - SSOT Styles
   ============================================================================
   Logos are loaded from: /ui/assets/logos/{provider_name}.png
   If image doesn't exist, a placeholder square is shown.
   ============================================================================ */

.provider-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    overflow: hidden;
    background: transparent;
    flex-shrink: 0;
    color: var(--text-primary); /* Ensures SVG with fill="currentColor" inherits correct color */
}

/* SVG inside provider-logo should fill the container */
.provider-logo svg {
    width: 100%;
    height: 100%;
}

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

/* Placeholder shown when no logo available */
.provider-logo.placeholder {
    background: var(--bg-tertiary, #e5e5e5);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .provider-logo.placeholder {
    background: var(--bg-tertiary, #3a3a3a);
}

/* Size variants */
.provider-logo-sm {
    width: 16px;
    height: 16px;
}

.provider-logo-md {
    width: 24px;
    height: 24px;
}

.provider-logo-lg {
    width: 32px;
    height: 32px;
}

/* Provider filter section */
.filter-providers-section {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.filter-providers-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.filter-providers-scroll::-webkit-scrollbar {
    height: 4px;
}

.filter-providers-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.filter-providers-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.filter-provider-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    color: var(--text-primary); /* Ensures SVG icons inherit correct color */
}

.filter-provider-btn:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.filter-provider-btn.active {
    border-color: var(--primary);
    background: var(--primary-light, rgba(99, 102, 241, 0.1));
    box-shadow: 0 0 0 2px var(--primary-light, rgba(99, 102, 241, 0.2));
}

.filter-provider-btn .provider-logo {
    width: 24px;
    height: 24px;
    color: inherit; /* Inherit color from parent button */
    cursor: pointer; /* Override [title] help cursor rule */
    pointer-events: none; /* Let clicks pass through to button */
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.filter-checkbox input {
    width: auto;
    margin: 0;
}

.panel-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.panel-controls .search-input {
    flex: 1;
    min-width: 150px;
}

/* Model card header with badges */
.model-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.model-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.badge {
    font-size: 0.75rem;
    line-height: 1;
}

/* Phase 10.9: Limited availability badge (amber warning) */
.badge-limited {
    color: #f59e0b;
    cursor: help;
    animation: pulse-amber 2s infinite;
}

@keyframes pulse-amber {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 0.5; }
}

/* Provider header styling */
.provider-header {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.provider-header:hover {
    color: var(--primary);
}

.provider-count {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary);
}

/* Model details drawer */
.model-details-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.model-details-drawer.open {
    right: 0;
}

.drawer-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.drawer-header h3 {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    padding-right: 30px;
    word-break: break-all;
}

.drawer-provider {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.drawer-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
}

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

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Phase 10.9: Drawer warnings (limited_availability, etc.) */
.drawer-warnings-section {
    margin-bottom: 16px;
}

.drawer-warning {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.drawer-warning-amber {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--text-primary);
}

.drawer-warning .warning-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.drawer-warning .warning-content {
    flex: 1;
}

.drawer-warning .warning-content strong {
    display: block;
    color: #f59e0b;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.drawer-warning .warning-content p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.detail-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    word-break: break-word;
}

/* Context menu for models */
.model-context-menu {
    min-width: 150px;
}


/* =============== BENCHMARKING UI POLISH =============== */

/* Filter Chips */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.filter-chip:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.filter-chip .chip-icon {
    font-size: 0.9rem;
}

.filter-chip-tier {
    font-size: 0.8rem;
    padding: 4px 10px;
}

/* Pricing tier filter chips - matte colors matching model tier badges */
.filter-chip-tier[data-tier="very_low"] {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
    color: #059669;
}
.filter-chip-tier[data-tier="very_low"]:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: #10b981;
}
.filter-chip-tier[data-tier="very_low"].active {
    background: rgba(16, 185, 129, 0.4);
    border-color: #10b981;
    border-width: 2px;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    font-weight: 600;
}

.filter-chip-tier[data-tier="low"] {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.3);
    color: #2563eb;
}
.filter-chip-tier[data-tier="low"]:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: #3b82f6;
}
.filter-chip-tier[data-tier="low"].active {
    background: rgba(59, 130, 246, 0.4);
    border-color: #3b82f6;
    border-width: 2px;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
    font-weight: 600;
}

.filter-chip-tier[data-tier="medium"] {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.3);
    color: #d97706;
}
.filter-chip-tier[data-tier="medium"]:hover {
    background: rgba(245, 158, 11, 0.25);
    border-color: #f59e0b;
}
.filter-chip-tier[data-tier="medium"].active {
    background: rgba(245, 158, 11, 0.4);
    border-color: #f59e0b;
    border-width: 2px;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
    font-weight: 600;
}

.filter-chip-tier[data-tier="high"] {
    background: rgba(249, 115, 22, 0.12);
    border-color: rgba(249, 115, 22, 0.3);
    color: #ea580c;
}
.filter-chip-tier[data-tier="high"]:hover {
    background: rgba(249, 115, 22, 0.25);
    border-color: #f97316;
}
.filter-chip-tier[data-tier="high"].active {
    background: rgba(249, 115, 22, 0.4);
    border-color: #f97316;
    border-width: 2px;
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.5);
    font-weight: 600;
}

.filter-chip-tier[data-tier="very_high"] {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #dc2626;
}
.filter-chip-tier[data-tier="very_high"]:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
}
.filter-chip-tier[data-tier="very_high"].active {
    background: rgba(239, 68, 68, 0.4);
    border-color: #ef4444;
    border-width: 2px;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
    font-weight: 600;
}

/* Dark mode adjustments for tier filter chips */
body[data-theme='dark'] .filter-chip-tier[data-tier="very_low"] {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
}
body[data-theme='dark'] .filter-chip-tier[data-tier="low"] {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}
body[data-theme='dark'] .filter-chip-tier[data-tier="medium"] {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
}
body[data-theme='dark'] .filter-chip-tier[data-tier="high"] {
    background: rgba(249, 115, 22, 0.15);
    color: #fdba74;
}
body[data-theme='dark'] .filter-chip-tier[data-tier="very_high"] {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

/* Dark mode active states for tier filter chips */
body[data-theme='dark'] .filter-chip-tier[data-tier="very_low"].active {
    background: rgba(16, 185, 129, 0.45);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}
body[data-theme='dark'] .filter-chip-tier[data-tier="low"].active {
    background: rgba(59, 130, 246, 0.45);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}
body[data-theme='dark'] .filter-chip-tier[data-tier="medium"].active {
    background: rgba(245, 158, 11, 0.45);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}
body[data-theme='dark'] .filter-chip-tier[data-tier="high"].active {
    background: rgba(249, 115, 22, 0.45);
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.6);
}
body[data-theme='dark'] .filter-chip-tier[data-tier="very_high"].active {
    background: rgba(239, 68, 68, 0.45);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

/* Clear Filters Button */
.filter-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    margin-left: 4px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.filter-clear-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
}

.filter-clear-btn:active {
    transform: scale(0.95);
}

body[data-theme='dark'] .filter-clear-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.filter-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 4px;
}

/* Provider Header - Section Style */
.provider-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.provider-header:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.03);
}

body[data-theme='dark'] .provider-header:hover {
    background: rgba(99, 102, 241, 0.08);
}

/* Legacy placeholder - now using .provider-logo system */
.provider-logo-placeholder {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: var(--border-color);
    flex-shrink: 0;
}

/* Provider header uses the SSOT logo system */
.provider-header .provider-logo {
    width: 24px;
    height: 24px;
}

.provider-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    text-transform: capitalize;
}

.provider-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.provider-select-hint {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.provider-header:hover .provider-select-hint {
    opacity: 1;
}

/* Model Card - Compact Design */
.model-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    min-height: unset;
}

.model-card-top {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.model-badges {
    display: flex;
    gap: 2px;
}

.badge {
    font-size: 0.65rem;
    opacity: 0.75;
}

.model-menu-btn {
    background: none;
    border: none;
    padding: 2px 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 3px;
    opacity: 0;
    transition: all 0.15s ease;
    line-height: 1;
    flex-shrink: 0;
    margin-left: auto;
}

.model-card:hover .model-menu-btn {
    opacity: 1;
}

.model-menu-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.model-name {
    font-weight: 500;
    font-size: 0.8rem;
    line-height: 1.2;
    white-space: nowrap;
}

.model-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.model-context {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Pricing tier indicator - single colored pill */
.model-tier {
    display: none; /* Hide text-based tier */
}

.price-indicator {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.price-pill {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
}

/* Price pill colors by tier */
.price-indicator[data-tier="very_low"] .price-pill { background: #10b981; }
.price-indicator[data-tier="low"] .price-pill { background: #3b82f6; }
.price-indicator[data-tier="medium"] .price-pill { background: #f59e0b; }
.price-indicator[data-tier="high"] .price-pill { background: #f97316; }
.price-indicator[data-tier="very_high"] .price-pill { background: #ef4444; }

.model-tier.tier-very_low { background: #d1fae5; color: #065f46; }
.model-tier.tier-low { background: #dbeafe; color: #1e40af; }
.model-tier.tier-medium { background: #fef3c7; color: #92400e; }
.model-tier.tier-high { background: #fed7aa; color: #c2410c; }
.model-tier.tier-very_high { background: #fecaca; color: #b91c1c; }

body[data-theme='dark'] .model-tier.tier-very_low { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
body[data-theme='dark'] .model-tier.tier-low { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
body[data-theme='dark'] .model-tier.tier-medium { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
body[data-theme='dark'] .model-tier.tier-high { background: rgba(249, 115, 22, 0.2); color: #fdba74; }
body[data-theme='dark'] .model-tier.tier-very_high { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

/* Context Menu Polish */
.model-context-menu {
    min-width: 160px;
    padding: 4px 0;
}

.model-context-menu .context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}

.menu-icon {
    font-size: 0.9rem;
    width: 20px;
    text-align: center;
}

/* Drawer - Polished Sections */
.drawer-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.drawer-title-row h3 {
    margin: 0;
    padding-right: 0;
}

.drawer-close {
    position: static;
    flex-shrink: 0;
}

.drawer-subtitle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.drawer-tier {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
}

.drawer-section {
    margin-bottom: 24px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.section-icon {
    font-size: 1rem;
}

.info-icon {
    margin-left: auto;
    cursor: help;
    color: var(--primary);
    font-size: 0.85rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.pricing-grid {
    grid-template-columns: repeat(3, 1fr);
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.detail-icon {
    font-size: 1rem;
    opacity: 0.7;
}

.detail-item .detail-label {
    font-size: 0.7rem;
    margin: 0;
}

.detail-item .detail-value {
    font-size: 0.9rem;
    font-weight: 500;
}

.detail-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-row-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-row-inline .detail-label {
    font-size: 0.8rem;
    min-width: 60px;
    margin: 0;
}

.detail-row-inline .detail-value {
    font-size: 0.85rem;
}

/* Host row - subtle styling */
.host-row {
    opacity: 0.7;
    font-size: 0.85rem;
}

.host-row .host-value {
    font-style: italic;
}

.modality-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8rem;
    text-transform: capitalize;
}

.notes-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0;
}

/* =============== CONFIG PANEL POLISH =============== */

.config-form {
    padding: 12px 14px;
    flex: 1;
    overflow-y: auto;
}

.config-section {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Compact row layout for config items */
.config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

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

.config-row-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    flex-shrink: 0;
    white-space: nowrap;
}

.config-row-label .tooltip {
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: help;
}

/* Compact inputs */
.config-input-compact {
    width: 60px;
    padding: 5px 8px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8rem;
    text-align: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.config-input-compact:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

/* Number input spinner - use color-scheme for dark mode native controls */
body[data-theme="dark"] .config-input-compact[type="number"] {
    color-scheme: dark;
}

/* Compact selects */
.config-select-compact {
    padding: 5px 24px 5px 8px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.config-select-compact:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.config-select-compact:hover {
    border-color: var(--primary);
}

/* Slider control */
.config-row-slider {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.config-row-slider .config-row-label {
    margin-bottom: 2px;
}

.slider-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.config-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.config-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.config-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

.config-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.config-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

.config-slider:focus {
    outline: none;
}

.config-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.slider-value {
    min-width: 70px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
}

.slider-value.no-limit {
    color: var(--warning);
    font-style: italic;
}

/* Toggle Switch - Modern iOS-style (compact) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: all 0.25s ease;
    border-radius: 20px;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: all 0.25s ease;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

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

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

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

/* Advanced Config Accordion */
.config-advanced {
    margin-top: 8px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.config-advanced summary {
    padding: 8px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--bg-primary);
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
    list-style: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.config-advanced summary::-webkit-details-marker {
    display: none;
}

.config-advanced summary::before {
    content: '›';
    font-size: 1rem;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
}

.config-advanced[open] summary::before {
    transform: rotate(90deg);
}

.config-advanced[open] summary {
    border-bottom-color: var(--border-color);
    color: var(--text-primary);
}

.config-advanced summary:hover {
    color: var(--primary);
}

.config-advanced summary:hover::before {
    color: var(--primary);
}

.advanced-content {
    padding: 8px 10px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 0;
}

.advanced-content .config-row {
    padding: 6px 0;
}

.advanced-content .config-row:first-child {
    padding-top: 0;
}

.advanced-content .config-row:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

/* Legacy checkbox label (for backwards compat) */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type='checkbox'] {
    width: auto;
    margin: 0;
}

.checkbox-label .tooltip {
    margin-left: auto;
}

/* Model card tooltip - JS-powered (appended to body to avoid overflow clipping) */
.model-card-tooltip {
    position: fixed;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.6;
    white-space: pre-line;
    min-width: 180px;
    max-width: 260px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
}

.model-card-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

/* Tooltip arrow */
.model-card-tooltip::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -6px;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--border-color);
}

/* =============== RUNNER MODAL (Phase 4) =============== */

.runner-modal-content {
    width: 600px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
}

.runner-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.runner-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.runner-title-row h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.runner-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.runner-status-badge.status-running {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.runner-status-badge.status-queued {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.runner-status-badge.status-completed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.runner-status-badge.status-failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.runner-status-badge.status-cancelled {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.runner-job-id {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.runner-job-id code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
}

.runner-body {
    padding: 20px 24px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Progress Section */
.runner-progress-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.runner-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.runner-progress-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.runner-progress-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.runner-progress-bar-container {
    height: 10px;
    background: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.runner-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #818cf8);
    border-radius: 5px;
    transition: width 0.4s ease-out;
    position: relative;
}

.runner-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes pulse-queue {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Queued state - pulsing animation */
.runner-progress-bar.queued {
    width: 100% !important;
    background: linear-gradient(90deg, var(--warning), #fbbf24);
    animation: pulse-queue 2s ease-in-out infinite;
}

/* Stats Grid */
.runner-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.runner-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.runner-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.runner-stat .stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Model Status List */
.runner-models-section h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.runner-model-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 80px;
    overflow-y: auto;
    padding: 2px;
}

.runner-model-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.runner-model-item .model-status-icon {
    font-size: 0.7rem;
}

.runner-model-item.status-pending {
    opacity: 0.6;
}

.runner-model-item.status-pending .model-status-icon::before {
    content: '○';
    color: var(--text-secondary);
}

.runner-model-item.status-running {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.runner-model-item.status-running .model-status-icon::before {
    content: '◐';
    color: var(--primary);
    animation: spin 1s linear infinite;
}

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

.runner-model-item.status-completed {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.08);
}

.runner-model-item.status-completed .model-status-icon::before {
    content: '✓';
    color: var(--success);
}

.runner-model-item.status-failed {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.08);
}

.runner-model-item.status-failed .model-status-icon::before {
    content: '✗';
    color: var(--error);
}

/* Log Window */
.runner-logs-section {
    flex: 1;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

.runner-logs-section h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.runner-log-window {
    flex: 1;
    min-height: 100px;
    max-height: 150px;
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 8px;
    padding: 12px 14px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.72rem;
    line-height: 1.6;
    overflow-y: auto;
    color: #c9d1d9;
}

body[data-theme="light"] .runner-log-window {
    background: #1e1e1e;
    border-color: #333;
    color: #d4d4d4;
}

.runner-log-placeholder {
    color: #6e7681;
    font-style: italic;
}

.runner-log-entry {
    margin: 0;
    padding: 2px 0;
    word-break: break-word;
}

.runner-log-entry.log-info {
    color: #58a6ff;
}

.runner-log-entry.log-success {
    color: #3fb950;
}

.runner-log-entry.log-error {
    color: #f85149;
}

.runner-log-entry.log-warning {
    color: #d29922;
}

/* Footer */
.runner-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    gap: 12px;
    background: var(--bg-secondary);
}

.runner-cancel-btn {
    min-width: 160px;
    padding: 10px 24px;
    font-weight: 600;
}

.runner-close-btn,
.runner-results-btn {
    min-width: 140px;
    padding: 10px 24px;
    font-weight: 600;
}

/* Danger button style */
.btn-danger {
    background: var(--error);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #dc2626;
    filter: brightness(1.1);
}

.btn-danger:disabled {
    background: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* =============== RESULTS TABLE =============== */

.results-container {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Phase 9.5: Fix results table height to match other tabs */
    min-height: calc(100vh - 140px);
    max-height: calc(100vh - 140px);
    flex-grow: 1;
}

/* Results Header */
.results-header {
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.results-title-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.results-title-inline {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

/* Subtle "Benchmark Results" label - eyebrow text */
.results-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    opacity: 0.7;
    white-space: nowrap;
}

/* Task title - inline with label */
.results-task-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.2;
}

.results-task-title:empty,
.results-task-title.hidden {
    display: none;
}

/* Meta row: status badge + job info */
.results-meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

/* Legacy h2 in results header (if any) */
.results-header h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Ghost button style */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

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

/* Cancel button - two-stage stop control (in progress bar area) */
.btn-cancel {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    margin-left: 12px;
    flex-shrink: 0;
}

.btn-cancel:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
}

.btn-cancel:disabled {
    opacity: 0.6;
    cursor: wait;
}

.btn-cancel.hidden {
    display: none;
}

.btn-cancel .cancel-icon {
    font-size: 0.9rem;
}

/* After first click - pending graceful stop */
.btn-cancel.cancel-pending {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.4);
    animation: pulse-warning 1.5s ease-in-out infinite;
}

.btn-cancel.cancel-pending:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.5);
}

/* Force stop state */
.btn-cancel.cancel-force-ready {
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.5);
}

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

.results-status-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-status-badge.status-pending {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
}

.results-status-badge.status-queued {
    background: rgba(250, 204, 21, 0.15);
    color: #facc15;
}

.results-status-badge.status-running {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    animation: pulse-badge 2s ease-in-out infinite;
}

.results-status-badge.status-completed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.results-status-badge.status-failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.results-status-badge.status-cancelled {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
}

.results-status-badge.status-preview {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.results-status-badge.status-empty {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
}

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

.results-header-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* View Toggle Segmented Control */
.view-toggle-segment {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.view-toggle-btn:first-child {
    border-right: 1px solid var(--border-color);
}

.view-toggle-btn:hover:not(.active) {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

/* Dark mode adjustments for toggle */
[data-theme="dark"] .view-toggle-segment {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .view-toggle-btn {
    color: var(--text-secondary);
}

[data-theme="dark"] .view-toggle-btn:first-child {
    border-color: var(--border-color);
}

[data-theme="dark"] .view-toggle-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

[data-theme="dark"] .view-toggle-btn.active {
    background: var(--primary);
    color: white;
}

.view-toggle-icon {
    font-size: 0.7rem;
    opacity: 0.8;
}

.view-toggle-btn.active .view-toggle-icon {
    opacity: 1;
}

/* Simple View - Hide enhanced columns */
.results-table.simple-view .col-rec-temp,
.results-table.simple-view .col-tier,
.results-table.simple-view .col-cost,
.results-table.simple-view .col-time,
.results-table.simple-view .col-acc-dollar,
.results-table.simple-view .col-acc-min,
.results-table.simple-view .col-out-tokens,
.results-table.simple-view .col-completion {
    display: none;
}

/* Simple View - Adaptive column widths that stretch to fill space */
.results-table.simple-view {
    table-layout: fixed;
    width: 100%;
}

.results-table.simple-view th,
.results-table.simple-view td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Simple view column proportions - stretch to fill */
.results-table.simple-view .col-rank {
    width: 6%;
    min-width: 50px;
    text-align: center;
}

.results-table.simple-view .col-model {
    width: 34%;
    min-width: 150px;
    text-align: left;
}

.results-table.simple-view .col-provider {
    width: 22%;
    min-width: 100px;
    text-align: left;
}

.results-table.simple-view .col-score {
    width: 22%;
    min-width: 120px;
    text-align: center;
}

.results-table.simple-view .col-stability {
    width: 16%;
    min-width: 80px;
    text-align: center;
}

/* Responsive adjustments for simple view */
@media (max-width: 768px) {
    .results-table.simple-view .col-rank {
        width: 8%;
    }
    .results-table.simple-view .col-model {
        width: 35%;
    }
    .results-table.simple-view .col-provider {
        width: 20%;
    }
    .results-table.simple-view .col-score {
        width: 22%;
    }
    .results-table.simple-view .col-stability {
        width: 15%;
    }
}

.results-job-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* Progress Bar (sticky at top) */
.results-progress-container {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
}

.results-progress-bar-wrapper {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.results-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease;
}

.results-progress-container.complete .results-progress-bar {
    background: var(--success);
}

.results-progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 100px;
    text-align: right;
    margin-left: auto;  /* Push to the right */
}

/* Low-accuracy hint — shown when all models score poorly */
.low-accuracy-hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    margin: 0 24px 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary);
    border-radius: 6px;
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.low-accuracy-hint.hidden {
    display: none;
}
.low-accuracy-hint .hint-icon {
    flex-shrink: 0;
    font-size: 1rem;
    margin-top: 1px;
}
.low-accuracy-hint .hint-text strong {
    color: var(--text-primary);
}
.low-accuracy-hint .hint-dismiss {
    flex-shrink: 0;
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.15rem;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.low-accuracy-hint .hint-dismiss:hover {
    opacity: 1;
}

/* Sort Indicator - inline with progress text */
.sort-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sort-indicator.hidden {
    display: none;
}

.sort-indicator-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sort-indicator-text strong {
    color: var(--primary);
    font-weight: 600;
}

.reset-sort-btn {
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 4px;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.reset-sort-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
}

/* Results Table Container */
.results-table-container {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.results-refresh-hint {
    display: block;
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted, #888);
    opacity: 0.55;
    transition: opacity 0.2s;
}
.results-refresh-hint:hover {
    opacity: 1;
}
.results-refresh-hint a {
    color: var(--primary, #6366f1);
    text-decoration: none;
    cursor: pointer;
}
.results-refresh-hint a:hover {
    text-decoration: underline;
}

/* Results Table */
.results-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.results-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.results-table th {
    background: var(--table-header-bg);
    padding: 14px 12px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    border-bottom: 2px solid var(--border-color);
    /* Ensure header has visual separation in light mode */
    box-shadow: 0 1px 3px var(--shadow);
}

.results-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Column widths - Enhanced layout with rank column */
.results-table .col-rank {
    width: 45px;
    min-width: 45px;
    max-width: 45px;
    text-align: center;
}

.results-table .col-model {
    width: 17%;
    min-width: 140px;
}

.results-table .col-provider {
    width: 12%;
    min-width: 100px;
}

.results-table .col-score {
    width: 14%;
    min-width: 110px;
}

.results-table .col-stability {
    width: 8%;
    min-width: 70px;
}

.results-table .col-rec-temp {
    width: 7%;
    min-width: 60px;
}

.results-table .col-tier {
    width: 8%;
    min-width: 70px;
}

.results-table .col-cost {
    width: 10%;
    min-width: 80px;
}

.results-table .col-time {
    width: 9%;
    min-width: 70px;
}

.results-table .col-acc-dollar {
    width: 9%;
    min-width: 70px;
}

.results-table .col-acc-min {
    width: 8%;
    min-width: 65px;
}

.results-table .col-out-tokens {
    width: 7%;
    min-width: 65px;
}

.results-table .col-completion {
    width: 8%;
    min-width: 95px;
}

/* Sortable Headers */
.results-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px;
    transition: background-color 0.15s ease;
}

.results-table th.sortable:hover {
    background: var(--table-header-hover);
}

.results-table th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    opacity: 0.3;
    font-size: 0.7rem;
}

.results-table th.sortable.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--primary);
}

.results-table th.sortable.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--primary);
}

/* Rank cell styling */
.rank-cell {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.rank-cell.rank-gold {
    color: #fbbf24;
}

.rank-cell.rank-silver {
    color: #94a3b8;
}

.rank-cell.rank-bronze {
    color: #cd7f32;
}

/* Row styling */
.results-row {
    transition: background 0.2s ease, opacity 0.3s ease;
    position: relative;
}

.results-row:hover {
    background: rgba(99, 102, 241, 0.08);
    cursor: pointer;
}

/* "View details" hint on row hover - positioned over Rank column (less critical) */
.results-row::after {
    content: '→ Details';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    background: var(--bg-secondary);
    padding: 3px 6px;
    border-radius: 3px;
    font-weight: 600;
    border: 1px solid var(--primary);
    z-index: 1;
}

.results-row:hover::after {
    opacity: 1;
}

.results-row.status-pending {
    opacity: 0.5;
}

.results-row.status-running {
    background: rgba(99, 102, 241, 0.05);
}

.results-row.status-running:hover {
    background: rgba(99, 102, 241, 0.12);
}

.results-row.status-failed {
    background: rgba(239, 68, 68, 0.05);
}

.results-row.status-failed:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Queued row styling (Phase 8.3 Sequential Batching) */
.results-row.status-queued {
    background: rgba(250, 204, 21, 0.05);
}

.results-row.status-queued:hover {
    background: rgba(250, 204, 21, 0.12);
}

/* Row animation for new completed rows */
.results-row.row-new {
    animation: row-fade-in 0.5s ease-out;
}

@keyframes row-fade-in {
    from {
        opacity: 0;
        background: rgba(99, 102, 241, 0.15);
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        background: transparent;
        transform: translateY(0);
    }
}

/* Model name */
.results-row .model-name {
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* Provider cell - fix alignment issue */
.results-row td.col-provider {
    vertical-align: middle;
}

.results-row td.col-provider > * {
    display: inline-flex;
    vertical-align: middle;
}

.results-row .provider-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: capitalize;
    margin-left: 8px;
}

/* Status text for pending/running */
.status-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.status-text.status-pending {
    color: var(--text-secondary);
}

/* Queued status text (Phase 8.3 Sequential Batching) */
.status-text.status-queued {
    color: #facc15;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.queued-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #facc15;
    animation: queued-pulse 1.5s ease-in-out infinite;
}

@keyframes queued-pulse {
    0%, 100% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
}

.status-text.status-running {
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Running status text with activity info */
.running-status-text {
    font-weight: 500;
    font-size: 0.8rem;
    opacity: 0.9;
    min-width: 70px;
}

/* Spinner for running status */
.results-row .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

/* Score Badges */
.score-badge {
    display: inline-block;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
    white-space: nowrap;
}

.score-badge.score-high {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.score-badge.score-medium {
    background: rgba(250, 204, 21, 0.15);
    color: #facc15;
    border: 1px solid rgba(250, 204, 21, 0.3);
}

.score-badge.score-low {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.score-badge.score-na {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.score-badge.score-failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Incomplete marker - indicates failed tests (not billed) */
.incomplete-marker {
    color: var(--incomplete-marker);
    font-size: 0.9em;
    margin-left: 4px;
    font-weight: 600;
    cursor: help;
}

/* Stability Pill */
.stability-pill {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    background: rgba(148, 163, 184, 0.1);
}

/* Stability color coding based on normalized variance - subtle text colors only */
.stability-pill.stability-stable {
    color: var(--success);
}

.stability-pill.stability-moderate {
    color: var(--text-secondary);
}

.stability-pill.stability-unstable {
    color: var(--error);
}

.stability-pill.stability-na {
    color: var(--text-secondary);
    opacity: 0.6;
    font-style: italic;
}

/* Tier Badges */
.tier-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.tier-badge.tier-unknown {
    color: var(--text-secondary);
}

.tier-badge.tier-very-low {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.tier-badge.tier-low {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.tier-badge.tier-standard,
.tier-badge.tier-medium {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.tier-badge.tier-high {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.tier-badge.tier-very-high {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Metric Pills (Cost, Time, Acc/$, Acc/min) */
.metric-pill {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.08);
    white-space: nowrap;
}

.metric-pill .measured-indicator {
    color: var(--primary);
    font-weight: 700;
    margin-left: 1px;
}

/* Rec. Temp Pill */
.rec-temp-pill {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    background: rgba(99, 102, 241, 0.08);
    white-space: nowrap;
}

/* Discovered Temperature - optimal temp found via exploration */
.rec-temp-pill.temp-discovered {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.18);
    font-weight: 600;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* N/A Temperature - model doesn't support temperature parameter */
.rec-temp-pill.temp-na {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Completion Pill */
.completion-pill {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.completion-pill.completion-full {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.completion-pill.completion-partial {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.completion-pill.completion-low {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* =========================================================================
   RESULTS BAR CHART VIEW
   ========================================================================= */

.results-chart-container {
    padding: 8px 0;
    flex: 1;
    overflow-y: auto;
}

.results-chart-container.hidden {
    display: none;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.chart-bar-row:hover {
    background: var(--bg-secondary, #f4f4f5);
}

.chart-bar-row + .chart-bar-row {
    margin-top: 4px;
}

.chart-bar-rank {
    flex: 0 0 28px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    font-family: var(--font-mono, monospace);
}

.chart-bar-rank.chart-rank-gold   { color: #fbbf24; }
.chart-bar-rank.chart-rank-silver { color: #94a3b8; }
.chart-bar-rank.chart-rank-bronze { color: #cd7f32; }

.chart-bar-identity {
    flex: 0 0 180px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.chart-bar-model {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-bar-provider {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.chart-bar-provider .provider-logo {
    width: 14px;
    height: 14px;
}

.chart-bar-track {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-bar-bg {
    flex: 1;
    height: 28px;
    background: var(--bg-tertiary, #e4e4e7);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease-out;
    min-width: 2px;
}

.chart-bar-fill.bar-high {
    background: linear-gradient(90deg, #059669 0%, #10b981 100%);
}

.chart-bar-fill.bar-medium {
    background: linear-gradient(90deg, #d97706 0%, #facc15 100%);
}

.chart-bar-fill.bar-low {
    background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
}

.chart-bar-fill.bar-pending {
    background: var(--bg-tertiary, #d4d4d8);
}

.chart-bar-score {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    white-space: nowrap;
    pointer-events: none;
}

.chart-bar-score-outside {
    flex: 0 0 auto;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    font-family: var(--font-mono, monospace);
    display: none;
}

.chart-bar-meta {
    flex: 0 0 200px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.chart-bar-meta .tier-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
}

.chart-bar-meta .chart-time {
    font-family: var(--font-mono, monospace);
    font-size: 0.7rem;
}

.chart-bar-meta .chart-cost {
    font-family: var(--font-mono, monospace);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Status rows (pending, running, failed) */
.chart-bar-row.chart-status-pending .chart-bar-fill,
.chart-bar-row.chart-status-queued .chart-bar-fill {
    width: 0% !important;
}

.chart-bar-row.chart-status-running .chart-bar-fill {
    background: linear-gradient(90deg, #6366f1 0%, #818cf8 100%);
    animation: chartBarPulse 1.5s ease-in-out infinite;
}

.chart-bar-row.chart-status-failed .chart-bar-fill {
    background: rgba(239, 68, 68, 0.3);
}

.chart-bar-status-label {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.chart-bar-status-label .spinner-inline {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1.5px solid rgba(99, 102, 241, 0.3);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: tourSpinnerSpin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes chartBarPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* When bar is too narrow, show score outside instead */
.chart-bar-row[data-score-outside="true"] .chart-bar-score {
    display: none;
}
.chart-bar-row[data-score-outside="true"] .chart-bar-score-outside {
    display: block;
}

/* Empty chart state */
.chart-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Dark mode */
[data-theme="dark"] .chart-bar-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .chart-bar-bg {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .chart-bar-fill.bar-high {
    background: linear-gradient(90deg, #047857 0%, #10b981 100%);
}

[data-theme="dark"] .chart-bar-fill.bar-medium {
    background: linear-gradient(90deg, #b45309 0%, #f59e0b 100%);
}

[data-theme="dark"] .chart-bar-fill.bar-low {
    background: linear-gradient(90deg, #b91c1c 0%, #ef4444 100%);
}

/* =============== INSIGHTS PANEL =============== */

.insights-panel {
    margin: 12px 0 8px;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.insights-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 10px;
    cursor: pointer;
    user-select: none;
}

.insights-header:hover {
    color: var(--text-primary);
}

.insights-header-icon {
    width: 14px;
    height: 14px;
    stroke: var(--text-secondary);
    flex-shrink: 0;
}

.insights-chevron {
    width: 14px;
    height: 14px;
    margin-left: auto;
    stroke: var(--text-secondary);
    transition: transform 0.2s ease;
}

.insights-panel.collapsed .insights-chevron {
    transform: rotate(180deg);
}

.insights-panel.collapsed .insights-header {
    margin-bottom: 0;
}

.insights-panel.collapsed .insights-list {
    display: none;
}

.insights-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.84rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

.insight-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

.insight-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

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

.insight-topAccuracy .insight-icon      { color: #6366f1; }
.insight-projectedSavings .insight-icon { color: #10b981; }
.insight-hardestTests .insight-icon    { color: #ef4444; }

[data-theme="dark"] .insight-topAccuracy .insight-icon      { color: #818cf8; }
[data-theme="dark"] .insight-projectedSavings .insight-icon { color: #34d399; }
[data-theme="dark"] .insight-hardestTests .insight-icon    { color: #f87171; }

/* =============== RESULTS DETAILS DRAWER =============== */

.results-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.results-drawer.open {
    pointer-events: auto;
    opacity: 1;
}

.results-drawer .drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.results-drawer .drawer-content {
    position: relative;
    width: 500px;
    max-width: 90vw;
    height: 100%;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.results-drawer.open .drawer-content {
    transform: translateX(0);
}

.results-drawer .drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.results-drawer .drawer-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.results-drawer .drawer-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 4px;
}

.results-drawer .drawer-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.results-drawer .drawer-section {
    margin-bottom: 24px;
}

.results-drawer .drawer-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.results-drawer .detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.results-drawer .detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

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

.results-drawer .tooltip-hint {
    font-size: 0.65rem;
    color: var(--text-secondary);
    cursor: help;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.results-drawer .tooltip-hint:hover {
    opacity: 1;
}

.results-drawer .detail-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.results-drawer .json-block {
    margin: 0;
    padding: 16px;
    background: #1a1d23;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #e2e8f0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

/* Drawer provider styling with logo */
.results-drawer .detail-provider {
    display: flex;
    align-items: center;
    gap: 8px;
}

.results-drawer .detail-provider .provider-logo {
    flex-shrink: 0;
}

/* Drawer collapsible sections */
.results-drawer .drawer-section-collapsible .section-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.results-drawer .drawer-section-collapsible .section-toggle:hover {
    color: var(--primary);
}

.results-drawer .drawer-section-collapsible .toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.results-drawer .drawer-section-collapsible.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.results-drawer .drawer-section-collapsible.collapsed .json-block,
.results-drawer .drawer-section-collapsible.collapsed .test-results-list {
    display: none;
}

/* Temperature Discovery - subtle inline indicator */
.results-drawer .detail-item.temp-discovered .detail-label {
    color: var(--primary);
    font-weight: 600;
}

.results-drawer .detail-item.temp-discovered .detail-value {
    color: var(--primary);
    font-weight: 600;
}

.results-drawer .detail-subtitle {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: 2px;
    font-family: var(--font-mono);
}

/* Ensure badges in drawer match table styling */
.results-drawer .detail-value .score-badge,
.results-drawer .detail-value .stability-pill,
.results-drawer .detail-value .tier-badge,
.results-drawer .detail-value .completion-pill {
    font-family: var(--font-mono);
}

/* Test Results Section in Drawer */
.section-subtitle {
    margin: 0 0 12px 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.test-results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.test-result-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.test-result-item.test-passed {
    border-left: 3px solid var(--success);
}

.test-result-item.test-failed {
    border-left: 3px solid var(--error);
}

.test-result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    background: var(--bg-primary);
    transition: background 0.15s ease;
}

.test-result-header:hover {
    background: var(--bg-secondary);
}

.test-status-icon {
    font-size: 0.9rem;
    font-weight: 700;
    width: 20px;
    text-align: center;
}

.test-passed .test-status-icon {
    color: var(--success);
}

.test-failed .test-status-icon {
    color: var(--error);
}

.test-id {
    flex: 1;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.test-id .pass-label {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.test-score {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.test-expand-icon {
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.test-result-item.expanded .test-expand-icon {
    transform: rotate(90deg);
}

.test-result-details {
    display: none;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.test-result-item.expanded .test-result-details {
    display: block;
}

.test-detail-row {
    margin-bottom: 12px;
}

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

.test-detail-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.test-detail-value {
    margin: 0;
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.test-detail-value.response-text {
    background: #1a1d23;
    color: #e2e8f0;
    border-color: transparent;
}

.test-detail-value.prompt-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    max-height: 150px;
}

.test-summary {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 8px;
}

/* =========================================================================
   Issues & Suggestions Section
   ========================================================================= */

.issues-section {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.08), rgba(217, 119, 6, 0.02));
    border: 1px solid rgba(217, 119, 6, 0.3);
    border-radius: 12px;
    padding: 16px;
}

.issues-section h4 {
    color: #d97706 !important;
    margin-bottom: 8px !important;
}

.issues-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.issue-card {
    padding: 14px 16px;
    border-radius: 8px;
    border-left: 4px solid;
}

.issue-card.issue-warning {
    background: rgba(217, 119, 6, 0.1);
    border-left-color: #d97706;
}

.issue-card.issue-error {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: #ef4444;
}

.issue-card.issue-info {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: #3b82f6;
}

.issue-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.issue-icon {
    font-size: 1.1rem;
}

.issue-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.issue-count {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.issue-suggestion {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.issue-suggestion strong {
    color: var(--text-primary);
    font-weight: 600;
}

.issue-details-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.issue-detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-size: 0.8rem;
}

.issue-detail-test {
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.issue-detail-message {
    color: var(--text-secondary);
    word-break: break-word;
}

/* Hide detailed error log when collapsed */
.drawer-section-collapsible.collapsed .issue-details-list {
    display: none;
}

/* Billing status badges (Phase 9.8: nuanced messaging) */
.issue-billing-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: auto;
}

/* "Not charged" - for infrastructure errors (no tokens consumed) */
.issue-billing-badge.not-charged {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

/* "Saved credits" - for fail-fast (positive framing) */
.issue-billing-badge.credits-saved {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

/* Legacy class for backwards compatibility */
.issue-not-billed {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: auto;
}

/* Light mode adjustments - stronger contrast */
[data-theme="light"] .issues-section {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.12), rgba(217, 119, 6, 0.04));
    border-color: rgba(217, 119, 6, 0.5);
}

[data-theme="light"] .issue-card.issue-warning {
    background: rgba(217, 119, 6, 0.15);
    border-left-color: #b45309;
}

[data-theme="light"] .issue-card.issue-error {
    background: rgba(239, 68, 68, 0.15);
    border-left-color: #dc2626;
}

[data-theme="light"] .issue-card.issue-info {
    background: rgba(59, 130, 246, 0.15);
    border-left-color: #2563eb;
}

[data-theme="light"] .issue-detail-item {
    background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .issue-title {
    color: #1f2937;
}

[data-theme="light"] .issue-suggestion {
    color: #1f2937;
}

[data-theme="light"] .issues-section .section-subtitle {
    color: #374151;
}

[data-theme="light"] .issue-detail-test {
    color: #111827;
}

[data-theme="light"] .issue-detail-message {
    color: #1f2937;
}

[data-theme="light"] .issue-not-billed,
[data-theme="light"] .issue-billing-badge.not-charged {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

[data-theme="light"] .issue-billing-badge.credits-saved {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

/* Empty row */
.results-table .empty-row td {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Export buttons */
.results-header .btn-small {
    padding: 6px 14px;
    font-size: 0.8rem;
}

/* Mobile panel toggle buttons - hidden by default on desktop */
.mobile-panel-toggle,
.mobile-preview-toggle,
.mobile-editor-toggle,
.benchmark-mobile-tabs,
.mobile-benchmark-toggle {
    display: none;
}

/* Mobile responsiveness */
@media (max-width: 1024px) {
    /* Hide less important columns on tablet */
    .results-table .col-stability,
    .results-table .col-rec-temp,
    .results-table .col-acc-dollar,
    .results-table .col-acc-min,
    .results-table .col-out-tokens,
    .results-table .col-completion {
        display: none;
    }
    
    .results-table .col-model { width: 25%; }
    .results-table .col-provider { width: 15%; }
    .results-table .col-score { width: 20%; }
    .results-table .col-tier { width: 15%; }
    .results-table .col-cost { width: 12%; }
    .results-table .col-time { width: 13%; }
}

@media (max-width: 768px) {
    .results-header {
        padding: 16px;
    }
    
    .results-title-row {
        width: 100%;
    }
    
    .results-task-title {
        font-size: 1.25rem;
    }
    
    .results-meta-row {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .results-progress-container {
        padding: 8px 16px;
    }
    
    .results-table th,
    .results-table td {
        padding: 10px 8px;
        font-size: 0.8rem;
    }
    
    /* Hide more columns on mobile */
    .results-table .col-stability,
    .results-table .col-rec-temp,
    .results-table .col-tier,
    .results-table .col-acc-dollar,
    .results-table .col-acc-min,
    .results-table .col-out-tokens,
    .results-table .col-completion {
        display: none;
    }
    
    .results-table .col-model {
        width: 35%;
    }
    
    .results-table .col-provider {
        width: 20%;
    }
    
    .results-table .col-score {
        width: 20%;
    }
    
    .results-table .col-cost {
        width: 12%;
    }
    
    .results-table .col-time {
        width: 13%;
    }
    
    /* Drawer on mobile */
    .results-drawer .drawer-content {
        width: 100%;
        max-width: 100%;
    }
    
    .results-drawer .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   BENCHMARK RUNNING - UI LOCK STATE
   Prevents navigation during active benchmark to avoid desync bugs
   ========================================================================= */

/* When benchmark is running, lock navigation elements */
body.benchmark-running .task-rail-strip {
    pointer-events: none;
    opacity: 0.5;
    filter: grayscale(30%);
}

body.benchmark-running .task-card {
    cursor: not-allowed;
}

/* Disable Editor and Benchmark tabs, keep Results tab active */
body.benchmark-running .main-tab:not([data-view="results"]) {
    pointer-events: none;
    opacity: 0.5;
    cursor: not-allowed;
}

/* Add visual indicator that UI is locked */
body.benchmark-running .task-rail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    opacity: 0.3;
    z-index: 10;
    pointer-events: none;
}

body.benchmark-running .task-rail {
    position: relative;
}

/* Show a "running" indicator on the task rail */
body.benchmark-running .task-rail-header::after {
    content: '⏳ Benchmark running...';
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #b45309;
    padding: 6px 12px;
    background: rgba(251, 191, 36, 0.25);
    border: 1px solid rgba(217, 119, 6, 0.4);
    border-radius: 6px;
    margin-top: 8px;
    text-align: center;
}

body[data-theme='dark'].benchmark-running .task-rail-header::after {
    color: #fbbf24;
    background: rgba(217, 119, 6, 0.2);
    border-color: rgba(251, 191, 36, 0.35);
}

/* Keep task rail header controls working (refresh, collapse) */
body.benchmark-running .task-rail-controls {
    pointer-events: auto;
    opacity: 1;
}

/* Ensure stop button and results table remain interactive */
body.benchmark-running .results-container {
    pointer-events: auto;
}

body.benchmark-running .btn-cancel {
    pointer-events: auto;
}

/* Dark mode adjustments */
body[data-theme='dark'].benchmark-running .task-rail::before {
    background: var(--bg-primary);
}

/* =========================================================================
   BENCHMARK ACTIVE (Pro/Expert - Phase 8.3 Sequential Batching)
   ========================================================================= */
/* Pro/Expert users can navigate while benchmark runs - just show indicator */

body.benchmark-active .task-rail-header::after {
    content: '🔄 Benchmark active';
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #059669;
    padding: 6px 12px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 6px;
    margin-top: 8px;
    text-align: center;
}

body[data-theme='dark'].benchmark-active .task-rail-header::after {
    color: #10b981;
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.35);
}

/* Hide benchmark indicator when rail is collapsed */
body.rail-collapsed.benchmark-active .task-rail-header::after {
    display: none;
}

/* =========================================================================
   SHARE RESULTS FEATURE
   ========================================================================= */

/* Share Button - Standard share icon style (like iOS/common share buttons) */
.btn-share {
    background: var(--primary) !important;
    color: white !important;
    border: 2px solid var(--primary) !important;
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-share:hover {
    background: #4338ca !important; /* Darker indigo for hover */
    border-color: #4338ca !important;
    color: white !important;
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.btn-share:active {
    transform: scale(0.98) translateY(0);
    color: white !important;
    background: #3730a3 !important; /* Even darker for active */
    border-color: #3730a3 !important;
}

.btn-share .share-icon-svg {
    width: 16px;
    height: 16px;
    stroke: white !important;
}

/* Export Dropdown */
.export-dropdown {
    position: relative;
}

.export-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 4px;
}

.export-dropdown-trigger .dropdown-arrow {
    width: 10px;
    height: 10px;
    transition: transform 0.2s;
}

.export-dropdown:hover .dropdown-arrow,
.export-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.export-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 140px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.15s ease;
}

.export-dropdown:hover .export-dropdown-menu,
.export-dropdown.open .export-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.export-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    text-align: left;
    transition: background 0.15s;
}

.export-option:first-child {
    border-radius: 7px 7px 0 0;
}

.export-option:last-child {
    border-radius: 0 0 7px 7px;
}

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

/* Disabled export buttons for sample/preview results */
.export-dropdown.disabled,
.export-option.disabled,
button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.export-dropdown-trigger.disabled:hover {
    background: inherit;
}

.export-option-icon {
    font-size: 0.875rem;
    width: 20px;
    text-align: center;
}

/* Share Modal Styles */
.share-modal-content {
    max-width: 480px;
    width: 95%;
    border-radius: 12px;
    overflow: hidden;
}

.share-modal-header {
    background: var(--primary-color, #4f46e5);
    color: white;
    padding: 14px 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.share-modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.share-modal-header .modal-close {
    position: absolute;
    right: 14px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
    line-height: 1;
}

.share-modal-header .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.share-modal-body {
    padding: 16px;
    background: var(--bg-primary);
}

/* Preview Container */
.share-preview-container {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 14px;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.share-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.share-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.share-preview-image {
    max-width: 100%;
    max-height: 350px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Compact Share Options - horizontal row */
.share-options-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.share-btn-compact {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-primary);
}

.share-btn-compact:hover {
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.share-btn-compact svg {
    width: 18px;
    height: 18px;
}

.share-divider {
    width: 1px;
    height: 28px;
    background: var(--border-color);
    margin: 0 4px;
}

/* Social share buttons - compact */
.share-btn-social {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: white;
}

.share-btn-social:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.share-btn-social .social-icon {
    font-size: 1rem;
    font-weight: 700;
    font-family: system-ui, sans-serif;
}

.share-btn-social svg {
    width: 18px;
    height: 18px;
}

.share-btn-x {
    background: #000000;
}

.share-btn-linkedin {
    background: #0077b5;
}

.share-btn-reddit {
    background: #ff4500;
}

.share-btn-whatsapp {
    background: #25D366;
}

/* Dark mode adjustments */
body.dark-mode .share-modal-body {
    background: var(--dark-bg-primary);
}

body.dark-mode .share-preview-container {
    background: var(--dark-bg-secondary);
    border-color: var(--dark-border-color);
}

body.dark-mode .share-btn-compact {
    background: var(--dark-bg-secondary);
    border-color: var(--dark-border-color);
    color: var(--dark-text-primary);
}

body.dark-mode .share-btn-compact:hover {
    background: var(--dark-bg-hover);
}

body.dark-mode .share-divider {
    background: var(--dark-border-color);
}

body.dark-mode .export-dropdown-menu {
    background: var(--dark-bg-primary);
    border-color: var(--dark-border-color);
}

body.dark-mode .export-option {
    color: var(--dark-text-primary);
}

body.dark-mode .export-option:hover {
    background: var(--dark-bg-hover);
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .share-modal-content {
        border-radius: 12px 12px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
        width: 100%;
    }
    
    .share-options-compact {
        gap: 6px;
    }
    
    .share-btn-compact,
    .share-btn-social {
        width: 36px;
        height: 36px;
    }
}

/* Share Tip */
.share-tip {
    text-align: center;
    padding: 10px 16px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 6px;
    margin-top: 12px;
}

.share-tip-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

body.dark-mode .share-tip,
body[data-theme="dark"] .share-tip {
    background: rgba(99, 102, 241, 0.15);
}

body.dark-mode .share-tip-text,
body[data-theme="dark"] .share-tip-text {
    color: var(--dark-text-secondary, #9ca3af);
}

/* ============================================================================
   PHASE 9: BILLING MODAL STYLES - "Modern Matte" / Technical Aesthetic
   ============================================================================ */

/* Modal Content - prevent border radius bleeding */
.billing-modal-content {
    max-width: 780px;
    width: 95%;
    max-height: 90vh;  /* Increased from 85vh for more feature matrix visibility */
    overflow: hidden;
    border-radius: 12px;
}

/* Header - Clean Technical Style (no gradient) */
.billing-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9fafb;
}

[data-theme="dark"] .billing-header {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.billing-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
}

[data-theme="dark"] .billing-header h2 {
    color: var(--text-primary);
}

.billing-header .modal-close {
    color: #6b7280;
    font-size: 1.5rem;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.billing-header .modal-close:hover {
    color: #111827;
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .billing-header .modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.billing-body {
    padding: 12px 24px 16px 24px;
    overflow-y: auto;
    max-height: calc(88vh - 60px);
}

/* Loading & Error States */
.billing-loading {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.billing-error {
    text-align: center;
    padding: 32px 20px;
    color: var(--error);
    font-size: 0.85rem;
}

.billing-empty {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Wallet Section - Compact & Data-focused */
.billing-wallet {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.wallet-total {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-right: 24px;
    border-right: 1px solid var(--border-color);
}

.wallet-total-value {
    font-size: 2rem;
    font-weight: 700;
    color: #374151;
    line-height: 1;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
    letter-spacing: -0.02em;
}

[data-theme="dark"] .wallet-total-value {
    color: #e5e7eb;
}

.wallet-total-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.wallet-breakdown {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.wallet-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-primary);
    border-radius: 6px;
}

.wallet-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.wallet-icon {
    font-size: 0.75rem;
}

.wallet-icon.monthly {
    color: var(--primary);
}

.wallet-icon.purchased {
    color: #10b981;
}

.wallet-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

/* Color-coded wallet values to match icons */
.wallet-row:nth-child(1) .wallet-value {
    color: var(--primary);
}

.wallet-row:nth-child(2) .wallet-value {
    color: #10b981;
}

/* Dark mode: Muted emerald for wallet purchased value */
[data-theme="dark"] .wallet-row:nth-child(2) .wallet-value {
    color: #34d399;
}

[data-theme="dark"] .wallet-icon.purchased {
    color: #34d399;
}

/* Value group for stacking value + sublabel */
.wallet-value-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}

.wallet-reset-sublabel {
    font-size: 0.6rem;
    color: var(--text-secondary);
    font-family: inherit;
    opacity: 0.8;
}

.wallet-tier {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.tier-badge {
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tier-badge.tier-free {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
    border: 1px solid rgba(107, 114, 128, 0.2);
}

.tier-badge.tier-pro {
    background: var(--primary);
    color: white;
}

.tier-badge.tier-expert {
    background: linear-gradient(135deg, #f59e0b 0%, #dc2626 100%);
    color: white;
}

/* Header Tier Badge (top-right next to credits) */
.header-tier-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

.header-tier-badge:empty {
    display: none;  /* Hide when empty (Free tier) */
}

.header-tier-badge .tier-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Small variant for compact spaces */
.tier-badge.tier-badge-small {
    font-size: 0.65rem;
    padding: 2px 5px;
}

.wallet-reset {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* Billing Tabs - Underline style with stronger hierarchy */
.billing-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.billing-tab {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

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

.billing-tab.active {
    color: var(--primary);
}

.billing-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.billing-tab-content {
    animation: fadeIn 0.15s ease;
}

.billing-tab-content.hidden {
    display: none;
}

/* Credit Packs Grid - Compact Cards */
.billing-packs-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.credit-pack-card {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 10px 12px;
    text-align: center;
    transition: all 0.15s ease;
    cursor: pointer;
}

.credit-pack-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
    transform: translateY(-2px);
}

.credit-pack-card.popular {
    border-color: var(--primary);
}

.credit-pack-card.best-value {
    border-color: #10b981;
}

/* Dark mode: Darker emerald border for best-value card */
[data-theme="dark"] .credit-pack-card.best-value {
    border-color: #059669;
}

/* Pack Badges - Square/Technical Style */
.pack-badge {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.pack-badge.popular {
    background: var(--primary);
    color: white;
}

.pack-badge.best-value {
    background: #10b981;
    color: white;
}

/* Dark mode: Darker emerald for best-value badge */
[data-theme="dark"] .pack-badge.best-value {
    background: #059669;
}

.pack-badge.savings {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

[data-theme="dark"] .pack-badge.savings {
    background: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Pack Header - Small, Uppercase, Muted */
.pack-header {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-top: 6px;
    margin-bottom: 8px;
}

/* Pack Hero - Credit Amount Section */
.pack-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-bottom: 12px;
}

.pack-credits-value {
    font-size: 2rem;
    font-weight: 700;
    color: #10b981;  /* Emerald - visual link: Buy Green → Green wallet increases */
    line-height: 1;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

/* Dark mode: Muted emerald for credit numbers */
[data-theme="dark"] .pack-credits-value {
    color: #34d399;  /* Slightly desaturated for dark backgrounds */
}

.pack-credits-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: lowercase;
}

/* Legacy classes (kept for compatibility) */
.pack-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    margin-top: 2px;
}

.pack-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

.pack-credits {
    font-size: 0.85rem;
    font-weight: 600;
    color: #111827;
    margin-top: 4px;
    margin-bottom: 12px;
}

[data-theme="dark"] .pack-credits {
    color: var(--text-primary);
}

/* Pack Buy Button - Green to match Purchased wallet */
.pack-buy-btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    background-color: #10b981 !important;
    border-color: #10b981 !important;
    color: white;
}

.pack-buy-btn:hover:not(:disabled) {
    background-color: #059669 !important;
    border-color: #059669 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Dark mode: Muted emerald (less bright) */
[data-theme="dark"] .pack-buy-btn {
    background-color: #059669 !important;
    border-color: #059669 !important;
}

[data-theme="dark"] .pack-buy-btn:hover:not(:disabled) {
    background-color: #047857 !important;
    border-color: #047857 !important;
}

.packs-benefit-note {
    grid-column: 1 / -1;
    text-align: center;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.packs-benefit-note strong {
    color: var(--text-primary);
}

/* Feature Matrix Table - Technical Style */
.billing-matrix {
    overflow: visible;
}

.matrix-scroll-container {
    overflow-x: auto;
    max-height: 310px;  /* Balanced: shows ~8 rows, keeps upgrade button visible */
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.feature-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.feature-matrix th,
.feature-matrix td {
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

/* Zebra striping */
.feature-matrix tbody tr:nth-child(even) td {
    background: #f9fafb;
}

[data-theme="dark"] .feature-matrix tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

/* Sticky header - SOLID white background to prevent transparency */
.feature-matrix thead th {
    background: #ffffff;
    font-weight: 600;
    color: #111827;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid var(--border-color);
}

[data-theme="dark"] .feature-matrix thead th {
    background: #1f2937;  /* Solid dark background to prevent transparency on scroll */
    color: var(--text-primary);
}

.feature-matrix th.feature-name,
.feature-matrix td.feature-name {
    text-align: left;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 120px;
    background: #ffffff;
    position: sticky;
    left: 0;
    z-index: 5;
}

[data-theme="dark"] .feature-matrix th.feature-name,
[data-theme="dark"] .feature-matrix td.feature-name {
    background: var(--bg-secondary);
}

/* Tooltip affordance for feature names with definitions */
.feature-matrix td.feature-name.has-tooltip {
    text-decoration: underline dotted #9ca3af;
    text-underline-offset: 4px;
    cursor: help;
}

.feature-matrix thead th.feature-name {
    z-index: 15;
}

.feature-matrix .tier-col {
    min-width: 100px;
}

/* Free tier header - muted/faded to de-emphasize */
.feature-matrix thead th.tier-col:nth-child(2) {
    color: #9ca3af;  /* Muted gray */
    font-weight: 500;
}

[data-theme="dark"] .feature-matrix thead th.tier-col:nth-child(2) {
    color: #6b7280;  /* Slightly muted for dark mode */
}

/* Vertical delimiters between all columns */
.feature-matrix th,
.feature-matrix td {
    border-right: 1px solid #e5e7eb;
}

.feature-matrix th:last-child,
.feature-matrix td:last-child {
    border-right: none;
}

[data-theme="dark"] .feature-matrix th,
[data-theme="dark"] .feature-matrix td {
    border-right: 1px solid #374151;
}

[data-theme="dark"] .feature-matrix th:last-child,
[data-theme="dark"] .feature-matrix td:last-child {
    border-right: none;
}

/* Current tier - just the badge indicator, no column tint */
.feature-matrix .tier-col.current {
    /* No background - let accent colors drive the visual hierarchy */
}

.feature-matrix td.current-col {
    /* No background - current is indicated by badge only */
}

.current-badge {
    display: block;
    font-size: 0.55rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 4px;
}

/* ====== TIER NAME STYLING ====== */
.tier-name {
    display: block;
    font-size: 1rem;
    font-weight: 700;
}

.tier-name.muted {
    color: #9ca3af;
    font-weight: 500;
}

.tier-tagline {
    display: block;
    font-size: 0.6rem;
    font-weight: 400;
    color: #6b7280;
    margin-top: 2px;
}

/* Tier column headers: clickable hover effect (non-current tiers only) */
.feature-matrix .tier-col.accent-pro:not(.current),
.feature-matrix .tier-col.accent-expert:not(.current) {
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.feature-matrix .tier-col.accent-pro:not(.current):hover,
.feature-matrix .tier-col.accent-expert:not(.current):hover {
    opacity: 0.85;
}

/* Mobile tier cards: clickable hover/active effect */
.mobile-tier-card:not(.current):not([data-tier="free"]) {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mobile-tier-card:not(.current):not([data-tier="free"]):active {
    transform: scale(0.98);
}

/* ====== PRO COLUMN - PURPLE ACCENT ====== */
.feature-matrix .tier-col.accent-pro {
    background: #f5f3ff;
    border-bottom-color: var(--primary);
}

/* Dark mode: SOLID background to prevent transparency on scroll */
[data-theme="dark"] .feature-matrix .tier-col.accent-pro {
    background: #2d2654;  /* Solid dark purple */
}

.feature-matrix td.accent-pro-cell {
    background: #faf9ff;
}

[data-theme="dark"] .feature-matrix td.accent-pro-cell {
    background: rgba(79, 70, 229, 0.05);
}

.feature-matrix tbody tr:nth-child(even) td.accent-pro-cell {
    background: #f3f0ff;
}

[data-theme="dark"] .feature-matrix tbody tr:nth-child(even) td.accent-pro-cell {
    background: rgba(79, 70, 229, 0.08);
}

/* ====== EXPERT COLUMN - AMBER ACCENT ====== */
.feature-matrix .tier-col.accent-expert {
    background: #fffbeb;
    border-bottom-color: #f59e0b;
}

/* Dark mode: SOLID background to prevent transparency on scroll */
[data-theme="dark"] .feature-matrix .tier-col.accent-expert {
    background: #3d3425;  /* Solid dark amber/brown */
}

.feature-matrix td.accent-expert-cell {
    background: #fffef5;
}

[data-theme="dark"] .feature-matrix td.accent-expert-cell {
    background: rgba(245, 158, 11, 0.03);
}

.feature-matrix tbody tr:nth-child(even) td.accent-expert-cell {
    background: #fef9e7;
}

[data-theme="dark"] .feature-matrix tbody tr:nth-child(even) td.accent-expert-cell {
    background: rgba(245, 158, 11, 0.06);
}

.tier-value {
    color: #111827;
    font-size: 0.8rem;
}

[data-theme="dark"] .tier-value {
    color: var(--text-primary);
}

/* Mobile tier cards - hidden by default, shown on mobile */
.mobile-tier-cards {
    display: none;
}

/* Matrix scroll container - always allow horizontal scroll */
.matrix-scroll-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile tier cards are now handled in mobile.css */

/* Landscape mode with short height: compact header */
@media (max-height: 500px) and (orientation: landscape) {
    .billing-header {
        padding: 8px 16px;
    }
    
    .billing-wallet {
        padding: 8px 12px;
        gap: 8px;
    }
    
    .wallet-total-value {
        font-size: 1.2rem;
    }
    
    .billing-tabs {
        margin-bottom: 8px;
    }
    
    .billing-tab {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    /* Keep matrix visible but compact */
    .feature-matrix {
        font-size: 0.7rem;
    }
    
    .feature-matrix th,
    .feature-matrix td {
        padding: 4px 6px;
    }
}

/* Remove blue highlight for Pro column - use dark gray instead */
.tier-value.highlight {
    color: #111827;
    font-weight: 500;
}

[data-theme="dark"] .tier-value.highlight {
    color: var(--text-primary);
}

.tier-value.muted {
    color: #6b7280;
}

[data-theme="dark"] .tier-value.muted {
    color: var(--text-secondary);
}

.tier-value small {
    display: block;
    font-size: 0.65rem;
    color: #6b7280;
    margin-top: 1px;
}

/* Strikethrough original price (monthly when yearly is selected) */
.price-original {
    color: #9ca3af;
    font-weight: 400;
    font-size: 0.85em;
    text-decoration: line-through;
    margin-right: 2px;
}

[data-theme="dark"] .price-original {
    color: #6b7280;
}

.matrix-footnote {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 4px;
    text-align: left;
    padding-left: 4px;
}

[data-theme="dark"] .matrix-footnote {
    color: var(--text-secondary);
}

/* Billing Interval Toggle (Monthly/Yearly) */
.billing-interval-toggle {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin: 8px 0 4px 0;
    background: var(--bg-tertiary, #f3f4f6);
    border-radius: 6px;
    padding: 2px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

[data-theme="dark"] .billing-interval-toggle {
    background: rgba(255, 255, 255, 0.05);
}

.interval-btn {
    padding: 4px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.interval-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .interval-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.interval-btn.active {
    background: white;
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .interval-btn.active {
    background: var(--bg-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.interval-savings {
    font-size: 0.65rem;
    font-weight: 600;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    padding: 1px 4px;
    border-radius: 3px;
}

[data-theme="dark"] .interval-savings {
    background: rgba(16, 185, 129, 0.2);
}

.tier-upgrade-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

/* Upgrade Button - Indigo to match Monthly/Subscription wallet */
.btn-upgrade {
    padding: 10px 24px;
    font-size: 0.85rem;
    font-weight: 600;
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white;
}

.btn-upgrade:hover:not(:disabled) {
    background-color: #4338ca !important;
    border-color: #4338ca !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

/* Expert Upgrade Button - Amber/Gold style */
.btn-expert {
    padding: 10px 24px;
    font-size: 0.85rem;
    font-weight: 600;
    background-color: #f59e0b !important;
    border-color: #f59e0b !important;
    color: white;
}

/* Dark mode: Slightly muted amber for less glare */
[data-theme="dark"] .btn-expert {
    background-color: #d97706 !important;
    border-color: #d97706 !important;
}

.btn-expert:hover:not(:disabled) {
    background-color: #d97706 !important;
    border-color: #d97706 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .btn-expert:hover:not(:disabled) {
    background-color: #b45309 !important;
    border-color: #b45309 !important;
}

.btn-manage-sub {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.btn-manage-sub:hover {
    color: var(--primary);
}

/* Credits Badge - Clickable indicator (opens Billing modal) */
.credits-badge {
    cursor: pointer !important;
    transition: all 0.15s ease;
    border-radius: 6px;
}

.credits-badge:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .credits-badge:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Responsive Billing */
@media (max-width: 800px) {
    .billing-packs-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .billing-modal-content {
        max-height: 95vh;
        border-radius: 12px 12px 0 0;
    }
    
    .billing-wallet {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .wallet-total {
        padding-right: 0;
        border-right: none;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--border-color);
        align-items: center;
    }
    
    .billing-packs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .feature-matrix {
        font-size: 0.7rem;
    }
    
    .feature-matrix th,
    .feature-matrix td {
        padding: 8px 6px;
    }
    
    .tier-upgrade-actions {
        flex-direction: column;
    }
}

/* =========================================================================
   Results Cost Badge (Phase 10.6)
   ========================================================================= */

.results-cost-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: 12px;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.results-cost-badge .cost-value {
    font-weight: 600;
    color: var(--text-primary);
}

.results-cost-badge .cost-savings {
    color: var(--success);
    font-weight: 500;
    font-size: 0.8rem;
}

[data-theme="dark"] .results-cost-badge {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .results-cost-badge .cost-savings {
    color: #34d399;
}

/* =========================================================================
   Billing History (Phase 10.6)
   ========================================================================= */

/* Header actions container */
.billing-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.billing-history-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.billing-history-link:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.billing-history-link svg {
    width: 14px;
    height: 14px;
}

[data-theme="dark"] .billing-history-link {
    color: var(--text-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .billing-history-link:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

/* History View */
.billing-history-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.billing-history-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.billing-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.billing-back-btn.hidden {
    display: none !important;
}

.billing-history-link.hidden {
    display: none !important;
}

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

/* History Table */
.billing-history-content {
    max-height: 400px;
    overflow-y: auto;
}

.billing-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.billing-history-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 5;
}

.billing-history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.billing-history-table tbody tr:hover {
    background: rgba(79, 70, 229, 0.02);
}

[data-theme="dark"] .billing-history-table tbody tr:hover {
    background: rgba(79, 70, 229, 0.05);
}

.history-date {
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.history-desc {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-model {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.history-amount {
    text-align: right;
    white-space: nowrap;
}

.history-amount .amount-positive {
    color: var(--success);
    font-weight: 600;
}

.history-amount .amount-negative {
    color: var(--error);
    font-weight: 500;
}

/* Inline savings indicator (same line as amount) */
.history-savings-inline {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.7rem;
    color: var(--success);
    opacity: 0.85;
    cursor: help;
}

[data-theme="dark"] .history-savings-inline {
    color: #34d399;
}

/* Legend at top of history table */
.history-legend {
    display: flex;
    justify-content: flex-end;
    padding: 4px 8px 8px 8px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.history-legend-item {
    opacity: 0.7;
}

[data-theme="dark"] .history-legend {
    color: var(--text-secondary);
}

.history-status-cell {
    text-align: center;
}

.history-status {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 4px;
}

.history-status.status-completed {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
}

.history-status.status-credit {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.history-status.status-refund {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warning);
}

.history-status.status-pending {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.history-status.status-cancelled {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

[data-theme="dark"] .history-status.status-completed {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

[data-theme="dark"] .history-status.status-credit {
    background: rgba(79, 70, 229, 0.15);
    color: #818cf8;
}

[data-theme="dark"] .history-status.status-refund {
    background: rgba(217, 119, 6, 0.15);
    color: #fbbf24;
}

[data-theme="dark"] .history-status.status-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

[data-theme="dark"] .history-status.status-cancelled {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
}

.billing-history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.billing-history-empty p {
    margin: 0 0 8px 0;
}

.history-empty-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* ============================================
   PWA INSTALL BANNER
   ============================================ */
.pwa-install-banner {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    max-width: 480px;
    width: calc(100% - 32px);
    background: var(--bg-secondary);
    border: 1px solid var(--primary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.25), 0 0 0 1px rgba(99, 102, 241, 0.1);
    animation: pwa-slide-down 0.4s ease-out;
}

.pwa-install-banner.hidden {
    display: none;
}

@keyframes pwa-slide-down {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}

.pwa-install-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    color: var(--primary);
}

.pwa-install-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    line-height: 1.3;
    color: var(--text-primary);
}

.pwa-install-text strong {
    font-weight: 600;
}

.pwa-install-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.pwa-install-action {
    flex-shrink: 0;
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.pwa-install-action:hover {
    background: var(--primary-hover);
    transform: scale(1.03);
}

.pwa-install-action:active {
    transform: scale(0.97);
}

.pwa-install-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.pwa-install-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* iOS share icon inline */
.pwa-ios-share-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin: 0 2px;
    color: var(--primary);
}

/* Hide install banner during most tour steps (avoids z-index conflicts).
   The banner is shown via JS during the final results step (onEnter),
   so we use a modifier class to allow it through. */
body.tour-active .pwa-install-banner:not(.pwa-show-during-tour) {
    display: none !important;
}

/* ============================================
   APP FOOTER
   ============================================ */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, var(--bg-secondary) 60%, transparent);
    padding: 4px 16px 6px;
    z-index: 50;
    font-size: 0.7rem;
    pointer-events: none; /* Allow clicking through the gradient */
    opacity: 0.85;
    transition: opacity 0.2s;
}

.app-footer:hover {
    opacity: 1;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    pointer-events: auto; /* Re-enable clicking on the actual content */
}

.footer-copyright {
    opacity: 0.7;
}

.footer-divider {
    opacity: 0.4;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Footer Partner Badge */
.footer-badge {
    display: inline-flex;
    align-items: center;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.footer-badge:hover {
    opacity: 1;
}

.footer-badge-img {
    height: 18px;
    width: auto;
    vertical-align: middle;
    filter: grayscale(30%);
    transition: filter 0.2s ease;
}

.footer-badge:hover .footer-badge-img {
    filter: grayscale(0%);
}

body[data-theme="dark"] .footer-badge svg[fill="currentColor"] {
    fill: #e4e4e7;
}

/* ============================================
   HELP MODAL
   ============================================ */
.help-modal-content {
    max-width: 700px;
    max-height: 85vh;
}

.help-header {
    padding: 16px 24px;
}

.help-body {
    padding: 0;
}

.help-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: 0 16px;
    gap: 4px;
    overflow-x: auto;
}

.help-tab {
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.2s;
}

.help-tab:hover {
    color: var(--text-primary);
    background: rgba(79, 70, 229, 0.05);
}

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

.help-tab-content {
    padding: 12px 24px 24px;
    overflow-y: auto;
    max-height: calc(85vh - 140px);
}

.help-tab-content.hidden {
    display: none;
}

/* Quick Start Tab */
.quickstart-content {
    max-width: 550px;
    margin: 0 auto;
}

.quickstart-intro {
    color: var(--text-secondary);
    margin-bottom: 24px;
    text-align: center;
}

.quickstart-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.quickstart-step {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.step-number {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-title {
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-tab-ref {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(79, 70, 229, 0.15);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.step-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.quickstart-tip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(79, 70, 229, 0.08);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.tip-icon {
    font-size: 1.2rem;
}

/* Limits Tab */
.limits-content h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
}

.limits-content h3:not(:first-child) {
    margin-top: 24px;
}

.limits-intro {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.limits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.limit-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
}

.limit-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.limit-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.limits-loading {
    color: var(--text-secondary);
    font-style: italic;
    padding: 16px;
    text-align: center;
}

/* Caching Tab */
.caching-content p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.caching-content h3 {
    margin: 0 0 12px 0;
}

.caching-content h4 {
    margin: 20px 0 12px 0;
    font-size: 0.95rem;
}

.caching-benefits {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.caching-benefit {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.benefit-icon {
    font-size: 1.5rem;
}

.caching-benefit p {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
}

.caching-providers {
    list-style: none;
    padding: 0;
}

.caching-providers li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.caching-providers li:last-child {
    border-bottom: none;
}

.caching-note {
    font-size: 0.85rem;
    padding: 12px;
    background: rgba(79, 70, 229, 0.08);
    border-radius: 6px;
    margin-top: 16px;
}

/* ============================================
   EDITOR / BENCHMARK / RESULTS HELP TABS
   ============================================ */
.help-section-content {
    max-width: 650px;
}

.help-section-content h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.help-section-content h3:not(:first-child) {
    margin-top: 24px;
}

.help-intro {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* Feature list (for editor modes, etc.) */
.help-feature-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 8px;
}

.help-feature {
    padding: 14px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.help-feature-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.help-feature-badge {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(79, 70, 229, 0.15);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.help-feature-icon {
    font-size: 1rem;
}

.help-feature-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.help-feature p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Bullet list */
.help-bullet-list {
    margin: 8px 0 16px 0;
    padding-left: 20px;
}

.help-bullet-list li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.5;
}

.help-bullet-list li strong {
    color: var(--text-primary);
}

/* Config grid (for benchmark options, results columns) */
.help-config-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 12px 0 16px 0;
}

.help-config-item {
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.help-config-item strong {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.help-config-item p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Action box (for Task Guide, etc.) */
.help-action-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--primary);
    border-radius: 8px;
    margin: 16px 0;
}

.help-action-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.help-action-box strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.help-action-box p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Tip box */
.help-tip-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(250, 204, 21, 0.1);
    border-radius: 6px;
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.help-tip-box .tip-icon {
    font-size: 1rem;
}

/* Important tip - highlighted version */
.help-tip-box.help-tip-important {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
}

/* Footnote - subtle, muted text at bottom of sections */
.help-footnote {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.5));
    line-height: 1.5;
    font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .help-config-grid {
        grid-template-columns: 1fr;
    }
}

/* Contact Tab */
.contact-content h3 {
    margin: 0 0 12px 0;
}

.contact-content > p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.contact-email-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 24px;
}

.contact-email-icon {
    font-size: 2rem;
}

.contact-email-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contact-email-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.contact-email-address {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.contact-email-address:hover {
    text-decoration: underline;
}

.contact-categories {
    margin-bottom: 20px;
}

.contact-categories p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.contact-categories ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.contact-categories li {
    font-size: 0.85rem;
    color: var(--text-primary);
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}


/* ============================================
   QUICK START MODAL (First Visit)
   ============================================ */
.quickstart-modal-content {
    max-width: 500px;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
}

.quickstart-modal-body {
    padding: 32px;
    text-align: center;
}

.quickstart-header {
    margin-bottom: 20px;
}

.quickstart-header h2 {
    font-size: 1.5rem;
    margin-bottom: 6px;
}

.quickstart-hook {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
}

.quickstart-value-line {
    font-size: 0.82rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin: 8px 0 0;
    line-height: 1.4;
}

/* Use-case chips */
.quickstart-usecases {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 22px;
}

.usecase-chip {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    font-size: 0.78rem;
    color: var(--text-secondary);
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
}

.usecase-open {
    font-style: italic;
    opacity: 0.55;
}

/* Outcome cards */
.quickstart-outcomes {
    display: flex;
    gap: 14px;
    justify-content: center;
    margin-bottom: 20px;
}

.outcome-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    flex: 1;
    max-width: 145px;
}

.outcome-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(79, 70, 229, 0.1);
    border-radius: 50%;
}

.outcome-icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--primary);
}

.outcome-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.outcome-subtitle {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

/* Social proof line */
.quickstart-proof {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.55;
    margin: 0 0 18px;
}

/* Friction removal line */
.quickstart-friction {
    font-size: 0.78rem;
    color: var(--text-secondary);
    opacity: 0.6;
    margin: 0 0 14px;
}

.quickstart-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.quickstart-close {
    padding: 12px 32px;
}

/* ============================================
   WHY BENCHMARK TAB
   ============================================ */

.why-benchmark-content {
    padding-top: 8px;
}

.why-intro {
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary);
}

.why-section {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.why-section h4 {
    margin: 0 0 6px 0;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.why-section p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.why-section em {
    color: var(--primary);
    font-style: normal;
    font-weight: 500;
}

.why-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding: 14px 18px;
    background: rgba(79, 70, 229, 0.08);
    border-radius: 8px;
    color: var(--primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.why-icon {
    font-size: 1.3rem;
}

/* ============================================
   LEGAL MODALS (ToS, Privacy)
   ============================================ */
.legal-modal-content {
    max-width: 720px;
    max-height: 85vh;
}

.legal-body {
    padding: 24px 32px;
    max-height: calc(85vh - 60px);
    overflow-y: auto;
}

.legal-content {
    line-height: 1.7;
    font-size: 0.95rem;
}

.legal-content h3 {
    margin-top: 28px;
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.legal-content h3:first-of-type {
    margin-top: 8px;
}

.legal-content h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.legal-content p {
    margin-bottom: 12px;
}

.legal-content ul {
    margin: 12px 0;
    padding-left: 24px;
}

.legal-content ul li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.legal-content ul li strong {
    color: var(--text-primary);
}

.legal-content a {
    color: var(--primary);
    text-decoration: none;
}

.legal-content a:hover {
    text-decoration: underline;
}

.legal-effective-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

.legal-company-info,
.legal-contact,
.legal-authority {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 0.9rem;
    line-height: 1.8;
}

.legal-prohibited-list {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 8px;
    padding: 16px 16px 16px 40px;
    margin: 16px 0;
}

.legal-prohibited-list li {
    color: var(--text-primary);
    margin-bottom: 10px;
}

body[data-theme="dark"] .legal-prohibited-list {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.9rem;
}

.legal-table th,
.legal-table td {
    padding: 12px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.legal-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.legal-table td {
    color: var(--text-secondary);
}

.legal-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

body[data-theme="dark"] .legal-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.legal-notice {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(79, 70, 229, 0.08);
    border-radius: 6px;
}

.legal-checklist {
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.legal-checklist li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.legal-checklist li:last-child {
    border-bottom: none;
}

.legal-footer {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.legal-footer a {
    color: var(--primary);
}

/* Legal modal scrollbar styling */
.legal-body::-webkit-scrollbar {
    width: 8px;
}

.legal-body::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.legal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.legal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================================================
 * GUEST MODE / EXPLORE MODE STYLES (Phase 2: Auth Integration)
 * ============================================================================ */

/* Guest Mode Banner in Header */
.guest-mode-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 16px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    border-radius: 8px;
    margin-left: 16px;
    animation: guestBannerPulse 2s ease-in-out infinite;
}

@keyframes guestBannerPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0); }
}

.guest-banner-text {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
}

.guest-icon {
    font-size: 1rem;
}

.guest-signin-btn {
    padding: 4px 12px;
    background: white;
    color: #4f46e5;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.guest-signin-btn:hover {
    background: #f0f0ff;
    transform: translateY(-1px);
}

.guest-banner-tour {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.guest-banner-tour:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
}

/* Dark mode adjustments */
[data-theme="dark"] .guest-mode-banner {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

[data-theme="dark"] .guest-signin-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #4f46e5;
}

[data-theme="dark"] .guest-signin-btn:hover {
    background: #ffffff;
}

/* Sample Task Badge */
.task-card.sample-task {
    border-left: 3px solid #8b5cf6;
    position: relative;
}

.task-card.sample-task::before {
    content: 'SAMPLE';
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 2px 6px;
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .task-card.sample-task {
    border-left-color: #a78bfa;
}

/* Sample Preview Banner */
.sample-preview-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 0.875rem;
}

.sample-preview-banner .sample-icon {
    font-size: 1rem;
}

.sample-preview-banner .sample-cta {
    margin-left: auto;
    opacity: 0.9;
    font-size: 0.8rem;
}

/* Sample Results Banner */
.sample-results-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #f8f4ff 0%, #ede9fe 100%);
    border: 1px solid #ddd6fe;
    border-radius: 8px;
    margin-bottom: 16px;
}

.sample-results-banner .banner-icon {
    font-size: 1.25rem;
}

.sample-results-banner .banner-text {
    color: #5b21b6;
    font-size: 0.9rem;
    font-weight: 500;
}

.sample-results-banner .banner-cta {
    margin-left: 16px;
    padding: 6px 14px;
    background: #8b5cf6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sample-results-banner .banner-cta:hover {
    background: #7c3aed;
    transform: translateY(-1px);
}

[data-theme="dark"] .sample-results-banner {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    border-color: #4c1d95;
}

[data-theme="dark"] .sample-results-banner .banner-text {
    color: #c4b5fd;
}

/* ========================================================================
   SHOWCASE ONBOARDING BANNER
   ======================================================================== */

.showcase-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 0 8px 0;
    padding: 6px 14px;
    background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    animation: showcaseFadeIn 0.4s ease-out;
}

.showcase-banner.hidden {
    display: none;
}

.showcase-banner-icon {
    font-size: 1rem;
    color: #6366f1;
    flex-shrink: 0;
    line-height: 1;
}

.showcase-banner-text {
    font-size: 0.82rem;
    color: #3730a3;
    white-space: nowrap;
}

.showcase-cta-btn {
    flex-shrink: 0;
    padding: 4px 14px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    white-space: nowrap;
    animation: showcaseCtaPulse 2s ease-in-out infinite;
}

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

@keyframes showcaseCtaPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); }
}

[data-theme="dark"] .showcase-banner {
    background: linear-gradient(135deg, #1e1b4b 0%, #172554 100%);
    border-color: #3730a3;
}

[data-theme="dark"] .showcase-banner-text {
    color: #c7d2fe;
}

[data-theme="dark"] .showcase-banner-icon {
    color: #a5b4fc;
}

/* ========================================================================
   TOUR NUDGE FLOATING CARD
   ======================================================================== */

.tour-nudge {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 18px;
    padding: 36px 44px 32px;
    max-width: 420px;
    width: 90%;
    background: var(--bg-secondary, #ffffff);
    border: 2px solid #6366f1;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.22);
    animation: tourNudgeFadeIn 0.35s ease-out;
}

.tour-nudge.hidden {
    display: none;
}

.tour-nudge-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary, #18181b);
}

.tour-nudge-btn {
    width: 100% !important;
    padding: 16px 32px !important;
    font-size: 1.15rem !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
    white-space: nowrap;
}

.tour-nudge-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary, #71717a);
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
}

.tour-nudge-close:hover {
    color: var(--text-primary, #18181b);
}

@keyframes tourNudgeFadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.tour-wait-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: tourSpinnerSpin 0.8s linear infinite;
    vertical-align: -2px;
    margin-right: 6px;
}

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

.tour-waiting-step p {
    animation: tourMsgFadeIn 0.4s ease;
}

@keyframes tourMsgFadeIn {
    from { opacity: 0.3; transform: translateY(4px); }
    to   { opacity: 1;   transform: translateY(0); }
}

.tour-wait-hint {
    font-size: 0.75rem;
    opacity: 0.55;
    margin-top: 6px;
    font-style: italic;
}

[data-theme="dark"] .tour-nudge {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Showcase task card in desktop rail */
.task-card.showcase-card {
    border-left: 3px solid #6366f1;
    background: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 100%);
}

.task-card.showcase-card .task-title {
    color: #4f46e5;
}

[data-theme="dark"] .task-card.showcase-card {
    background: linear-gradient(135deg, #1e1b4b 0%, #172554 100%);
    border-left-color: #818cf8;
}

[data-theme="dark"] .task-card.showcase-card .task-title {
    color: #a5b4fc;
}

/* Showcase pill in mobile strip */
.task-pill.showcase-pill {
    border: 1px solid #6366f1;
    color: #4f46e5;
    font-weight: 600;
}

.pill-showcase {
    margin-right: 4px;
    color: #6366f1;
}

[data-theme="dark"] .task-pill.showcase-pill {
    border-color: #818cf8;
    color: #a5b4fc;
}

[data-theme="dark"] .pill-showcase {
    color: #818cf8;
}

/* Read-only mode for sample tasks */
body.guest-mode .yaml-editor.viewing-sample {
    pointer-events: none;
    opacity: 0.9;
}

body.guest-mode .yaml-editor.viewing-sample::after {
    content: 'Preview Mode - Sign in to edit';
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 4px 8px;
    background: rgba(139, 92, 246, 0.9);
    color: white;
    font-size: 0.7rem;
    border-radius: 4px;
}

/* ============================================================================
 * AUTH LOADING OVERLAY
 * Prevents flash of guest UI while Firebase determines auth state
 * ============================================================================ */

.auth-loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.auth-loading-logo {
    width: 64px;
    height: 64px;
    animation: auth-loading-pulse 1.5s ease-in-out infinite;
}

.auth-loading-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

@keyframes auth-loading-pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(0.95);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================================================
 * SIGN-IN MODAL STYLES
 * ============================================================================ */

.signin-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.signin-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.signin-modal {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.signin-modal-overlay.show .signin-modal {
    transform: translateY(0);
}

.signin-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-primary);
    border-radius: 50%;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.signin-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.signin-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--primary);
}

.signin-modal-header h2 {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.signin-tagline {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.signin-context {
    text-align: center;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Benefits - subtle reassurance below CTA */
.signin-benefits {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 16px;
    margin-bottom: 12px;
}

.signin-benefit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 0;
    background: transparent;
    border: none;
}

.signin-benefit .benefit-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
    color: #10b981;
}

.signin-benefit span:last-child {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 400;
}

/* Google Sign-In Button - Enhanced for visibility */
.signin-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #4285F4 0%, #3367D6 100%);
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(66, 133, 244, 0.4);
    margin-bottom: 8px;
}

.signin-google-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.5);
}

.signin-google-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.4);
}

.google-icon {
    flex-shrink: 0;
    background: white;
    border-radius: 4px;
    padding: 2px;
}

/* Dark theme - same prominent blue */
[data-theme="dark"] .signin-google-btn {
    background: linear-gradient(135deg, #4285F4 0%, #3367D6 100%);
    color: white;
}

[data-theme="dark"] .signin-google-btn:hover {
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.6);
}

.signin-terms {
    text-align: center;
    margin-top: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.signin-terms a {
    color: var(--primary);
    text-decoration: none;
}

.signin-terms a:hover {
    text-decoration: underline;
}

/* ToS and Privacy modals must appear ABOVE sign-in modal */
#tos-modal,
#privacy-modal {
    z-index: 10001 !important;
}

/* ============================================================================
 * GATED BUTTON STATES (for guest mode)
 * ============================================================================ */

body.guest-mode [data-gated-for-guest] {
    position: relative;
}

body.guest-mode [data-gated-for-guest]::after {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    cursor: pointer;
}

/* Visual indicator that button is gated */
body.guest-mode .split-button-container[data-gated-for-guest="true"] .btn-primary,
body.guest-mode button[data-gated-for-guest="true"] {
    /* Subtle visual change to indicate gated state */
}

/* Hide dropdown arrow for guests - agent selection doesn't work in guest mode */
body.guest-mode .split-button-container .split-arrow {
    display: none;
}

body.guest-mode .split-button-container .split-main {
    border-radius: 8px;
}

/* Intro.js Tour Styling */
.introjs-tooltip.openmark-tour-tooltip {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border-radius: 14px;
    padding: 0;
    min-width: 280px;
    max-width: 340px;
}

/* Hide the default header (creates empty space) */
.introjs-tooltip.openmark-tour-tooltip .introjs-tooltip-header {
    display: none;
}

.introjs-tooltip.openmark-tour-tooltip .introjs-tooltiptext {
    color: var(--text-primary);
    padding: 16px 20px 12px;
}

/* Tour step content styling */
.tour-step {
    text-align: left;
}

.tour-step h4 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.tour-step p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 10px 0;
    line-height: 1.45;
}

.tour-step ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tour-step ul li {
    position: relative;
    padding-left: 14px;
    margin-bottom: 4px;
    font-size: 0.825rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.tour-step ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.tour-step ul li:last-child {
    margin-bottom: 0;
}

.tour-step ul li strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Final step (sign up CTA) styling */
.tour-step-final h4 {
    font-size: 1.1rem;
}

.tour-step-final p {
    margin-bottom: 6px;
}

.tour-step-final .tour-cta-text {
    margin-top: 8px;
    margin-bottom: 0;
    color: #10b981;
}

.tour-step-final .tour-cta-text strong {
    color: #10b981;
}

/* Green done button for final step */
.introjs-tooltip.openmark-tour-final .introjs-donebutton {
    background: #10b981 !important;
    border-color: #10b981 !important;
    color: white !important;
}

.introjs-tooltip.openmark-tour-final .introjs-donebutton:hover {
    background: #059669 !important;
    border-color: #059669 !important;
}

/* Mobile tour adjustments — Quick Tour: centered below header+tabs+task strip */
@media (max-width: 768px) {
    .introjs-tooltip.openmark-tour-tooltip {
        position: fixed !important;
        top: 195px !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translateX(-50%) !important;
        min-width: auto;
        max-width: calc(100vw - 32px);
        width: calc(100vw - 32px);
        margin: 0 !important;
    }
    
    /* Guided Benchmark: bottom-sheet style so interactive areas stay visible */
    .introjs-tooltip.openmark-guided-tooltip {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 14px 14px 0 0 !important;
        /* Slightly below highlighted elements so buttons on top remain clickable */
        z-index: 9999998 !important;
    }
    
    /* Per-step override: center-top when bottom-sheet would cover the target */
    body.guided-step-top .introjs-tooltip.openmark-guided-tooltip {
        top: 150px !important;
        bottom: auto !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: calc(100vw - 32px) !important;
        max-width: calc(100vw - 32px) !important;
        border-radius: 14px !important;
    }
    
    .introjs-tooltip.openmark-tour-tooltip .introjs-tooltipbuttons {
        padding: 12px 16px;
        gap: 8px;
    }
    
    .introjs-tooltip.openmark-tour-tooltip .introjs-button {
        padding: 10px 12px;
        font-size: 0.8rem;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
    }
    
    .introjs-tooltip.openmark-tour-tooltip .introjs-tooltiptext {
        padding: 14px 16px 10px;
    }
    
    .tour-step p,
    .tour-step ul li {
        font-size: 0.8rem;
    }
    
    .tour-step h4 {
        font-size: 1rem;
    }
    
    /* Hide arrow on mobile - fixed position doesn't need it */
    .introjs-tooltip.openmark-tour-tooltip .introjs-arrow {
        display: none;
    }
}

/* Progress bar styling */
.introjs-tooltip.openmark-tour-tooltip .introjs-progress {
    background: var(--border-color);
    height: 3px;
    border-radius: 2px;
    margin: 0 20px 12px;
}

.introjs-tooltip.openmark-tour-tooltip .introjs-progressbar {
    background: var(--primary);
    height: 3px;
    border-radius: 2px;
}

/* Step numbers */
.introjs-tooltip.openmark-tour-tooltip .introjs-helperNumberLayer {
    display: none;
}

/* Button container */
.introjs-tooltip.openmark-tour-tooltip .introjs-tooltipbuttons {
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

/* Button styling */
.introjs-tooltip.openmark-tour-tooltip .introjs-button {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-shadow: none;
    cursor: pointer;
    transition: all 0.15s ease;
    flex: 1;
    text-align: center;
}

.introjs-tooltip.openmark-tour-tooltip .introjs-button:hover {
    background: var(--bg-tertiary, rgba(255,255,255,0.05));
    border-color: var(--text-secondary);
}

/* Next/Done button - primary style */
.introjs-tooltip.openmark-tour-tooltip .introjs-nextbutton,
.introjs-tooltip.openmark-tour-tooltip .introjs-donebutton {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.introjs-tooltip.openmark-tour-tooltip .introjs-nextbutton:hover,
.introjs-tooltip.openmark-tour-tooltip .introjs-donebutton:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* Skip/close button */
.introjs-tooltip.openmark-tour-tooltip .introjs-skipbutton {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 4px 8px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s;
    z-index: 10;
}

.introjs-tooltip.openmark-tour-tooltip .introjs-skipbutton:hover {
    opacity: 1;
}

/* Arrow styling */
.introjs-tooltip.openmark-tour-tooltip .introjs-arrow {
    border: none;
}

.introjs-tooltip.openmark-tour-tooltip .introjs-arrow.top {
    border-bottom-color: var(--bg-secondary);
}

.introjs-tooltip.openmark-tour-tooltip .introjs-arrow.bottom {
    border-top-color: var(--bg-secondary);
}

.introjs-tooltip.openmark-tour-tooltip .introjs-arrow.left {
    border-right-color: var(--bg-secondary);
}

.introjs-tooltip.openmark-tour-tooltip .introjs-arrow.right {
    border-left-color: var(--bg-secondary);
}

/* Delete button on task cards — visible on hover (desktop), always visible (mobile) */
.task-card {
    position: relative;
}

.task-card-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary, #71717a);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    z-index: 2;
}

.task-card:hover .task-card-delete-btn {
    opacity: 0.6;
}

.task-card-delete-btn:hover {
    opacity: 1 !important;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* Helper layer (highlight box) */
.introjs-helperLayer {
    background: rgba(99, 102, 241, 0.1);
    border: 2px solid rgba(99, 102, 241, 0.4);
    border-radius: 8px;
}

/*
 * Fix stacking context for tours:
 * .view-section.active has position:absolute + z-index:10 + transform:translateX(0)
 * ALL THREE create a stacking context, trapping children's z-index inside it.
 * The intro.js overlay sits at z-index:999999, so highlighted elements can
 * never appear above it. Setting z-index:auto + transform:none breaks the
 * stacking context so intro.js default behavior works correctly.
 */
body.tour-active .view-section.active {
    z-index: auto !important;
    transform: none !important;
}

/* Light theme adjustments */
[data-theme="light"] .introjs-tooltip.openmark-tour-tooltip {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .tour-step ul li::before {
    color: var(--primary);
}

[data-theme="light"] .introjs-helperLayer {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.3);
}

/* Hide tour overlay/tooltip on mobile while waiting for async operations
   (e.g. generation in progress — the view switches to preview panel,
   so the step 2 highlight box would point at nothing) */
body.tour-waiting .introjs-helperLayer,
body.tour-waiting .introjs-tooltipReferenceLayer,
body.tour-waiting .introjs-tooltip,
body.tour-waiting .introjs-overlay {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.2s ease-out;
}

/* Hide tour tooltip when the virtual keyboard is open on mobile.
   The user is already engaged with the input — the tooltip served its purpose
   and would otherwise eat precious screen real estate. */
body.tour-active.tour-keyboard-open .introjs-tooltip,
body.tour-active.tour-keyboard-open .introjs-helperLayer,
body.tour-active.tour-keyboard-open .introjs-tooltipReferenceLayer,
body.tour-active.tour-keyboard-open .introjs-overlay {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.15s ease-out;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GUIDED BENCHMARK TOUR STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

/* Welcome step — centered content */
.tour-step-welcome {
    text-align: center;
    padding: 4px 0;
}

.tour-step-welcome h4 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.tour-step-welcome p {
    margin-bottom: 8px;
}

.tour-step-welcome p strong {
    color: #10b981;
}

/* Auto-select button inside the model selection tour step */
.tour-autoselect-btn {
    display: block;
    width: 100%;
    margin: 10px 0 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.01em;
}

.tour-autoselect-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.tour-autoselect-btn:active {
    transform: translateY(0);
}

.tour-autoselect-btn.tour-autoselect-done {
    background: #10b981;
    cursor: default;
    transform: none;
    box-shadow: none;
}

.tour-autoselect-btn.tour-autoselect-done:hover {
    background: #10b981;
    transform: none;
    box-shadow: none;
}

/* Hint text below auto-select button */
.tour-hint {
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
    font-style: italic;
    margin-top: 4px !important;
    margin-bottom: 0 !important;
}

/* Guided tooltip — same base as openmark-tour-tooltip */
.introjs-tooltip.openmark-guided-tooltip {
    min-width: 300px;
    max-width: 380px;
}

/* Suggestion chips for guided benchmark step 1 */
.tour-suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 2px;
}

.tour-suggestion-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tour-suggestion-chip:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
    color: #4338ca;
    transform: translateY(-1px);
}

.tour-suggestion-chip:active {
    transform: translateY(0);
}

.tour-suggestion-chip.tour-chip-active {
    background: rgba(99, 102, 241, 0.25);
    border-color: #6366f1;
    color: #4338ca;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.2);
}

/* Dark mode overrides for suggestion chips */
body[data-theme="dark"] .tour-suggestion-chip {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.3);
}

body[data-theme="dark"] .tour-suggestion-chip:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: rgba(99, 102, 241, 0.5);
    color: #c7d2fe;
}

body[data-theme="dark"] .tour-suggestion-chip.tour-chip-active {
    background: rgba(99, 102, 241, 0.4);
    border-color: #6366f1;
    color: #e0e7ff;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

