/* Faith & Ethics Benchmark - Web Interface Styles */

/* ==========================================================================
   Design Tokens — Radix Colors 12-step scale system
   See docs/UI_DESIGN_SYSTEM.md for full spec

   Each hue uses a 12-step scale inspired by Radix Colors:
     Steps 1-2:  App / subtle backgrounds
     Steps 3-5:  Component backgrounds (normal, hover, active)
     Steps 6-8:  Borders (subtle, default, emphasis)
     Steps 9-10: Solid colors (normal, hover)
     Steps 11-12: Text (low-contrast, high-contrast)

   Semantic tokens alias into these scales for backward compatibility.
   theme-manager.js regenerates scales dynamically for custom accent colors.
   ========================================================================== */

:root {
    /* --- Radix-style neutral scale (gray tinted toward BYU Blue accent) --- */
    --gray-1:  #f9fafb;
    --gray-2:  #f3f5f7;
    --gray-3:  #eceef1;
    --gray-4:  #e4e7eb;
    --gray-5:  #dce0e5;
    --gray-6:  #cdd2d9;
    --gray-7:  #b8bfc8;
    --gray-8:  #8b95a1;
    --gray-9:  #5f6b7a;
    --gray-10: #4e5968;
    --gray-11: #3d4654;
    --gray-12: #1a2030;

    /* --- Radix-style accent scale (from BYU Blue #002E5D) --- */
    --accent-1:  #f5f8fc;
    --accent-2:  #e8eff7;
    --accent-3:  #d4e2f0;
    --accent-4:  #bdd3e9;
    --accent-5:  #a3c1e0;
    --accent-6:  #84abd4;
    --accent-7:  #5e90c4;
    --accent-8:  #2a6eb0;
    --accent-9:  #002E5D;
    --accent-10: #002548;
    --accent-11: #1a4a7a;
    --accent-12: #0a1e33;

    /* --- Red scale (error/danger) --- */
    --red-1:  #fef5f5;
    --red-2:  #fde8e8;
    --red-3:  #fcd4d4;
    --red-4:  #f9bcbc;
    --red-5:  #f5a0a0;
    --red-6:  #ef7f7f;
    --red-7:  #e65c5c;
    --red-8:  #d93939;
    --red-9:  #dc3545;
    --red-10: #c82333;
    --red-11: #a11d2a;
    --red-12: #4c0d13;

    /* --- Green scale (success) --- */
    --green-1:  #f4fbf6;
    --green-2:  #e2f5e8;
    --green-3:  #c9ebd3;
    --green-4:  #aedfbc;
    --green-5:  #8fd1a3;
    --green-6:  #6cbf87;
    --green-7:  #47ab6a;
    --green-8:  #2b9651;
    --green-9:  #28a745;
    --green-10: #218838;
    --green-11: #1a6e2e;
    --green-12: #0c3418;

    /* --- Amber scale (warning) --- */
    --amber-1:  #fffdf5;
    --amber-2:  #fff8e1;
    --amber-3:  #ffefbf;
    --amber-4:  #ffe499;
    --amber-5:  #ffd666;
    --amber-6:  #ffc533;
    --amber-7:  #f5ad0b;
    --amber-8:  #d99508;
    --amber-9:  #f59e0b;
    --amber-10: #d98b07;
    --amber-11: #946008;
    --amber-12: #4a2e04;

    /* --- Blue/info scale --- */
    --blue-1:  #f5f9fe;
    --blue-2:  #e8f0fc;
    --blue-3:  #d0e2f9;
    --blue-4:  #b5d1f5;
    --blue-5:  #96bdf0;
    --blue-6:  #72a5e8;
    --blue-7:  #4a8adf;
    --blue-8:  #1d6fd3;
    --blue-9:  #0062B8;
    --blue-10: #0054a0;
    --blue-11: #004488;
    --blue-12: #002044;

    /* --- Layout tokens --- */
    --layout-max-width: 1920px;
    --layout-padding: 24px;

    /* --- Semantic tokens: aliases into Radix scales (light mode) --- */
    /* Surfaces */
    --surface-primary:    var(--gray-1);
    --surface-secondary:  var(--gray-2);
    --surface-tertiary:   var(--gray-3);
    --surface-elevated:   var(--gray-1);
    --surface-inset:      var(--gray-5);

    /* Borders */
    --border-default:     var(--gray-6);
    --border-muted:       var(--gray-4);
    --border-emphasis:    var(--gray-8);

    /* Text */
    --text-primary:       var(--gray-12);
    --text-secondary:     var(--gray-11);
    --text-tertiary:      var(--gray-9);
    --text-on-emphasis:   #ffffff;
    --text-link:          var(--accent-color);

    /* Accent (user-customizable, BYU Blue default) */
    --accent-color:       var(--accent-9);
    --accent-hover:       var(--accent-10);
    --accent-muted:       var(--accent-3);
    --accent-subtle:      var(--accent-2);

    /* Status */
    --status-success:     var(--green-9);
    --status-success-bg:  var(--green-3);
    --status-warning:     var(--amber-9);
    --status-warning-bg:  var(--amber-3);
    --status-danger:      var(--red-9);
    --status-danger-bg:   var(--red-3);
    --status-info:        var(--blue-9);
    --status-info-bg:     var(--blue-3);

    /* Interactive */
    --interactive-hover:  var(--gray-4);
    --interactive-active: var(--gray-5);

    /* Shadows */
    --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md:  0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg:  0 4px 16px rgba(0, 0, 0, 0.12);

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

    /* Badge semantic colors */
    --badge-bank-bg:     var(--blue-3);
    --badge-bank-text:   var(--blue-11);
    --badge-prompt-bg:   var(--purple-3);
    --badge-prompt-text: var(--purple-11);
    --badge-rubric-bg:   var(--green-3);
    --badge-rubric-text: var(--green-11);
    --badge-preset-bg:   var(--amber-3);
    --badge-preset-text: var(--amber-11);
    --badge-admin-bg:    var(--red-3);
    --badge-admin-text:  var(--red-11);
    --badge-dev-bg:      var(--purple-3);
    --badge-dev-text:    var(--purple-11);

    /* --- Component tokens --- */
    --btn-primary-bg:       var(--accent-color);
    --btn-primary-text:     var(--text-on-emphasis);
    --btn-primary-hover:    var(--accent-hover);
    --btn-secondary-bg:     transparent;
    --btn-secondary-text:   var(--text-primary);
    --btn-secondary-border: var(--border-default);
    --btn-danger-bg:        var(--status-danger);
    --btn-danger-text:      var(--text-on-emphasis);

    --table-header-bg:      var(--surface-secondary);
    --table-header-text:    var(--text-secondary);
    --table-border:         var(--border-muted);
    --table-row-hover:      var(--interactive-hover);

    --nav-bg:               #002E5D;
    --nav-border:           transparent;
    --nav-text:             rgba(255, 255, 255, 0.6);
    --nav-text-hover:       rgba(255, 255, 255, 0.9);
    --nav-text-active:      #ffffff;
    --nav-brand:            #ffffff;

    --card-bg:              var(--surface-primary);
    --card-border:          var(--border-default);

    --modal-backdrop:       rgba(0, 0, 0, 0.5);
    --modal-bg:             var(--surface-elevated);

    --toast-success-bg:     var(--status-success);
    --toast-error-bg:       var(--status-danger);
    --toast-info-bg:        var(--status-info);

    --input-bg:             var(--surface-primary);
    --input-border:         var(--border-default);
    --input-focus-ring:     var(--accent-muted);
    --input-placeholder:    var(--text-tertiary);

    /* --- Typography --- */
    --font-sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                  'Helvetica Neue', Arial, sans-serif;
    --font-mono:  'SF Mono', 'Fira Code', 'Cascadia Code', 'Courier New', monospace;

    /* --- Font sizes --- */
    --font-size-xs:  12px;
    --font-size-sm:  13px;
    --font-size-base: 14px;
    --font-size-md:  15px;
    --font-size-lg:  16px;
    --font-size-xl:  18px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;

    /* --- Spacing (4px base) --- */
    --space-0: 0;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* --- Border radii --- */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 9999px;

    /* --- Legacy aliases (map old vars to new system for backward compat) --- */
    --primary-color: var(--accent-color);
    --secondary-color: var(--status-info);
    --success-color: var(--status-success);
    --warning-color: var(--status-warning);
    --danger-color: var(--status-danger);
    --light-gray: var(--surface-secondary);
    --medium-gray: var(--surface-inset);
    --dark-gray: var(--text-tertiary);
    --text-color: var(--text-primary);
    --border-radius: var(--radius-sm);

    /* --- Legacy primitive aliases (old names -> Radix scale steps) --- */
    --color-blue-50:  var(--blue-1);
    --color-blue-100: var(--blue-2);
    --color-blue-200: var(--blue-4);
    --color-blue-500: var(--blue-9);
    --color-blue-700: var(--accent-9);
    --color-blue-900: var(--accent-12);

    --color-gray-50:  var(--gray-1);
    --color-gray-100: var(--gray-2);
    --color-gray-200: var(--gray-4);
    --color-gray-300: var(--gray-6);
    --color-gray-400: var(--gray-8);
    --color-gray-500: var(--gray-9);
    --color-gray-600: var(--gray-11);
    --color-gray-700: var(--gray-11);
    --color-gray-800: var(--gray-12);
    --color-gray-900: var(--gray-12);

    --color-red-500:    var(--red-9);
    --color-red-600:    var(--red-10);
    --color-green-500:  var(--green-9);
    --color-green-600:  var(--green-10);
    --color-amber-500:  var(--amber-9);
    --color-orange-500: #fd7e14;
    --color-teal-500:   #20c997;

    /* Alert color variants (now derived from scales) */
    --info-bg: var(--blue-3);
    --info-border: var(--blue-6);
    --info-text: var(--blue-11);
    --warning-bg: var(--amber-3);
    --warning-border: var(--amber-6);
    --warning-text: var(--amber-11);
    --success-bg: var(--green-3);
    --success-border: var(--green-6);
    --success-text: var(--green-11);

    /* Hover/accent colors */
    --info-bg-light: var(--blue-2);

    /* Highlight */
    --highlight-bg: #fffde7;
    --highlight-flash: #fff176;

    /* Provider brand colors (intentional, not theme-dependent) */
    --brand-openai: #10a37f;
    --brand-anthropic: #d4a373;
    --brand-google: #4285f4;
    --brand-meta: #0668e1;
    --brand-mistral: #ff7000;
    --brand-perplexity: #6366f1;
    --brand-xai: #1da1f2;
    --brand-deepseek: #7c3aed;
    --brand-open-router: #39d353;
    --brand-together: #20808d;

    /* Cost indicator colors */
    --cost-medium: var(--amber-11);
    --cost-medium-bg: var(--amber-3);
    --cost-high: var(--red-11);
    --cost-high-bg: var(--red-3);

    /* Extreme danger (purge/reset) */
    --danger-extreme: #8B0000;
    --danger-extreme-hover: #660000;

    /* Purple accent (pairwise, custom prompts) */
    --purple-9: #8b5cf6;
    --purple-3: #ede9fe;
    --purple-11: #6d28d9;
}

/* Dark mode: warm neutral scale aligned with survey visualization aesthetic */
[data-theme="dark"] {
    /* Neutral scale (dark) — pure warm grays, no blue tint */
    --gray-1:  #111111;
    --gray-2:  #1a1a1a;
    --gray-3:  #222222;
    --gray-4:  #2a2a2a;
    --gray-5:  #333333;
    --gray-6:  #3a3a3a;
    --gray-7:  #4a4a4a;
    --gray-8:  #666666;
    --gray-9:  #888888;
    --gray-10: #999999;
    --gray-11: #aaaaaa;
    --gray-12: #eeeeee;

    /* Accent scale (dark - warmer blue, aligned with survey viz #5a9fd4) */
    --accent-1:  #0d1520;
    --accent-2:  #121e30;
    --accent-3:  #182a42;
    --accent-4:  #1e3555;
    --accent-5:  #254268;
    --accent-6:  #305280;
    --accent-7:  #3d6899;
    --accent-8:  #4d80b5;
    --accent-9:  #5a9fd4;
    --accent-10: #72aeda;
    --accent-11: #8abee2;
    --accent-12: #c8dff0;

    /* Red scale (dark) */
    --red-1:  #1f1214;
    --red-2:  #2c1519;
    --red-3:  #3e1c22;
    --red-4:  #52232b;
    --red-5:  #662b35;
    --red-6:  #7e3541;
    --red-7:  #9e4150;
    --red-8:  #c54f5f;
    --red-9:  #f85149;
    --red-10: #fa6e68;
    --red-11: #ff8c84;
    --red-12: #fdd;

    /* Green scale (dark) */
    --green-1:  #0d1f12;
    --green-2:  #122917;
    --green-3:  #18381f;
    --green-4:  #1e4727;
    --green-5:  #265830;
    --green-6:  #306b3b;
    --green-7:  #3b8249;
    --green-8:  #489a57;
    --green-9:  #3fb950;
    --green-10: #5cc96a;
    --green-11: #7dd88a;
    --green-12: #d4f4da;

    /* Amber scale (dark) */
    --amber-1:  #1e1500;
    --amber-2:  #2b1e02;
    --amber-3:  #3d2a04;
    --amber-4:  #503706;
    --amber-5:  #644508;
    --amber-6:  #7a560b;
    --amber-7:  #966b0f;
    --amber-8:  #b48113;
    --amber-9:  #d29922;
    --amber-10: #deaa3e;
    --amber-11: #eabb5a;
    --amber-12: #fdf0d0;

    /* Blue/info scale (dark) */
    --blue-1:  #0c1520;
    --blue-2:  #111d30;
    --blue-3:  #172843;
    --blue-4:  #1d3458;
    --blue-5:  #24426e;
    --blue-6:  #2d5285;
    --blue-7:  #38659e;
    --blue-8:  #457ab8;
    --blue-9:  #58a6ff;
    --blue-10: #70b5ff;
    --blue-11: #8ec6ff;
    --blue-12: #d6ecff;

    /* Override semantic aliases that don't auto-follow scale changes */
    --text-on-emphasis:   #ffffff;

    /* Shadows (heavier for dark backgrounds) */
    --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md:  0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg:  0 4px 16px rgba(0, 0, 0, 0.5);

    /* Highlight */
    --highlight-bg: #3d3500;
    --highlight-flash: #5a4e00;

    /* Extreme danger */
    --danger-extreme: #b91c1c;
    --danger-extreme-hover: #991b1b;

    /* Purple accent */
    --purple-9: #a78bfa;
    --purple-3: #2e1065;
    --purple-11: #c4b5fd;

    /* Badge overrides for dark mode (dark backgrounds, lighter text) */
    --badge-bank-bg:     var(--blue-3);
    --badge-bank-text:   var(--blue-11);
    --badge-prompt-bg:   var(--purple-3);
    --badge-prompt-text: var(--purple-11);
    --badge-rubric-bg:   var(--green-3);
    --badge-rubric-text: var(--green-11);
    --badge-preset-bg:   var(--amber-3);
    --badge-preset-text: var(--amber-11);
    --badge-admin-bg:    var(--red-3);
    --badge-admin-text:  var(--red-11);
    --badge-dev-bg:      var(--purple-3);
    --badge-dev-text:    var(--purple-11);

    /* Nav - warm neutral dark, consistent with survey viz */
    --nav-bg:               #151515;
    --nav-border:           #2a2a2a;
    --nav-text:             #888888;
    --nav-text-hover:       #cccccc;
    --nav-text-active:      var(--accent-color);
    --nav-brand:            var(--accent-color);

    /* Tell browser to use dark variants for native controls (select, file, scrollbars) */
    color-scheme: dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-lg);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--surface-primary);
}

/* Text selection highlighting */
::selection {
    background-color: var(--accent-muted);
    color: var(--text-primary);
}

/* Global link styling — ensures all links adapt to dark mode */
a {
    color: var(--accent-11, var(--accent-color));
    text-decoration: none;
}

a:hover {
    color: var(--accent-9, var(--accent-hover));
    text-decoration: underline;
}

/* Global keyboard focus indicator (visible only for keyboard navigation, not mouse clicks) */
:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Remove default focus ring for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* Links styled as buttons should keep button text color, not link hover color */
a.primary-button,
a.primary-button:hover,
a.primary-button:visited,
a.secondary-button,
a.secondary-button:hover,
a.secondary-button:visited,
a.danger-button,
a.danger-button:hover,
a.danger-button:visited {
    text-decoration: none;
}

a.primary-button,
a.primary-button:hover,
a.primary-button:visited {
    color: var(--btn-primary-text);
}

a.secondary-button,
a.secondary-button:hover,
a.secondary-button:visited {
    color: var(--btn-secondary-text);
}

a.danger-button,
a.danger-button:hover,
a.danger-button:visited {
    color: var(--btn-danger-text);
}

.container {
    width: 100%;
    max-width: var(--layout-max-width);
    margin: 0 auto;
    padding: 0 var(--layout-padding);
}

/* Navbar */
.navbar {
    background-color: var(--accent-color);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow-md);
}

.navbar .container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: white;
    text-decoration: none;
}

.logo:hover {
    opacity: 0.9;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-links li {
    display: flex;
    align-items: center;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity var(--transition-fast);
}

.nav-links a:hover {
    opacity: 0.8;
}

/* Main content */
main {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: var(--font-size-2xl);
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
}

/* Auto-refresh toggle */
.auto-refresh-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    user-select: none;
    white-space: nowrap;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md, 6px);
    background: var(--surface-secondary, var(--light-gray));
}
.auto-refresh-toggle label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
}
.auto-refresh-toggle input[type="checkbox"] {
    accent-color: var(--accent-color);
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.auto-refresh-toggle:has(input[type="checkbox"]:checked) .auto-refresh-label {
    color: var(--text-primary);
}
.auto-refresh-slider {
    width: 60px;
    height: 4px;
    cursor: pointer;
    accent-color: var(--accent-color);
}
.auto-refresh-status {
    color: var(--text-secondary);
    font-size: 0.75rem;
    min-width: 2.2em;
}

/* Consortium Header Section */
.consortium-section {
    margin-top: 0;
    margin-bottom: 2rem;
}

.consortium-title {
    color: var(--text-primary);
    font-size: var(--font-size-2xl);
    font-weight: 300;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
}

.authors-section {
    padding: 1.25rem;
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
}

.authors {
    font-size: var(--font-size-base);
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.affiliations {
    font-size: var(--font-size-sm);
    color: var(--dark-gray);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}


/* Action Cards */
.action-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.action-card {
    display: block;
    background: var(--surface-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md, var(--border-radius));
    padding: 1.25rem;
    transition: box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.action-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--accent-color);
    text-decoration: none;
    color: inherit;
}

.action-card:visited {
    color: inherit;
}

.action-card h5 {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.action-card p {
    color: var(--dark-gray);
    font-size: var(--font-size-sm);
    margin-bottom: 0;
}

/* Stats Grid (Dashboard) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--light-gray);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.stat-card h3 {
    font-size: var(--font-size-base);
    color: var(--dark-gray);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--primary-color);
}

/* Dashboard sections */
.dashboard-section {
    margin-bottom: 2rem;
}

.dashboard-section h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-color);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border: none;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: var(--font-size-base);
}

.data-table thead {
    background-color: transparent;
    color: var(--text-secondary);
}

.data-table th {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border-default);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: relative;
}

.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-muted);
}

/* Legacy unscoped nth-child column rules removed — they applied to ALL
   DataTables and broke column widths. Page-specific rules below (e.g.
   .banks-table, .results-table) are the correct pattern. */

/* Banks table - 9 columns: Title | Type | Faith | Questions | Jobs | Evals | Owner | Last Modified | Actions */
/* Column 1: Title */
.banks-table td:nth-child(1) {
    max-width: 200px;
    font-weight: 600;
}

/* Column 2: Type */
.banks-table td:nth-child(2) {
    width: 70px;
    text-align: center;
}

/* Column 3: Faith */
.banks-table td:nth-child(3) {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Column 4: Questions count - centered */
.banks-table td:nth-child(4) {
    width: 60px;
    text-align: center;
}

/* Column 5: Jobs count - centered */
.banks-table td:nth-child(5) {
    width: 50px;
    text-align: center;
}

/* Column 6: Evals count - centered */
.banks-table td:nth-child(6) {
    width: 50px;
    text-align: center;
}

/* Column 7: Owner */
.banks-table td:nth-child(7) {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Column 9: Actions - ensure all buttons visible */
.banks-table th:nth-child(9),
.banks-table td:nth-child(9) {
    width: 180px;
    min-width: 180px;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    text-align: center;
    white-space: nowrap;
}

/* Clickable count links in banks table */
.bank-ref-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}
.bank-ref-link:hover {
    text-decoration: underline;
}

/* Results table - fixed layout, handle overflow in cells */
.results-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.results-table td:nth-child(3) {
    white-space: normal;
    word-break: break-word;
}
/* Actions column: don't clip buttons */
.results-table td:last-child {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
    background-color: var(--table-row-hover);
    box-shadow: inset 3px 0 0 var(--accent-color, var(--primary-color));
}

.data-table tbody tr.job-running {
    background-color: var(--warning-bg);
}

.data-table tbody tr.highlight {
    background-color: var(--highlight-bg);
    animation: highlight-fade 3s ease-in-out;
}

@keyframes highlight-fade {
    0% { background-color: var(--highlight-flash); }
    100% { background-color: var(--highlight-bg); }
}

.data-table td.question-text {
    max-width: 500px;
    white-space: normal !important;
    word-wrap: break-word;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.5;
}

/* Score styling — uses CSS custom properties for dark mode support */
:root {
    --score-5: #28a745;
    --score-4: #20c997;
    --score-3: #ffc107;
    --score-2: #fd7e14;
    --score-1: #dc3545;
}
[data-theme="dark"] {
    --score-5: #3fb950;
    --score-4: #2dd4a8;
    --score-3: #d29922;
    --score-2: #db6d28;
    --score-1: #f85149;
}

.score-1 { color: var(--score-1); font-weight: 600; }
.score-2 { color: var(--score-2); font-weight: 600; }
.score-3 { color: var(--score-3); font-weight: 600; }
.score-4 { color: var(--score-4); font-weight: 600; }
.score-5 { color: var(--score-5); font-weight: 600; }

.score-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-weight: 600;
    background-color: var(--surface-tertiary);
}

.score-badge.score-5 { background-color: var(--score-5); color: white; }
.score-badge.score-4 { background-color: var(--score-4); color: white; }
.score-badge.score-3 { background-color: var(--score-3); color: black; }
.score-badge.score-2 { background-color: var(--score-2); color: white; }
.score-badge.score-1 { background-color: var(--score-1); color: white; }

/* Status badges */
.status-pending { color: var(--dark-gray); }
.status-running {
    color: var(--secondary-color);
    font-weight: 600;
}
.status-completed {
    color: var(--success-color);
    font-weight: 600;
}
.status-failed {
    color: var(--danger-color);
    font-weight: 600;
}
.status-cancelled {
    color: var(--warning-color);
    font-weight: 600;
}

/* Evaluation status badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
}

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

.status-badge.status-failed {
    background-color: var(--danger-color);
    color: white;
}

.status-badge.status-warning {
    background-color: var(--warning-color);
    color: black;
}

/* Status code badges (HTTP-style) */
.status-code-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: var(--font-size-base);
    font-family: 'Courier New', monospace;
}

.status-code-badge.status-ok {
    background-color: var(--success-color);
    color: white;
}

.status-code-badge.status-warning {
    background-color: var(--warning-color);
    color: black;
}

.status-code-badge.status-error {
    background-color: var(--danger-color);
    color: white;
}

/* Prompt pills (small version for tables) */
.prompt-pill-small {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-xl);
    color: white;
    font-size: 0.8em;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filters select {
    padding: 8px 12px;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    min-width: 200px;
}

.filters button {
    padding: 8px 16px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: 500;
}

.filters button:hover {
    background-color: var(--secondary-color);
}

/* Buttons */
button, .button {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
    line-height: 1.4;
}

button:hover {
    opacity: 0.9;
}

.primary-button {
    background-color: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    font-weight: 600;
    padding: 8px 20px;
    border: 1px solid transparent;
}

.primary-button:hover {
    background-color: var(--btn-primary-hover);
    opacity: 1;
}

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

.secondary-button:hover {
    background-color: var(--interactive-hover);
    opacity: 1;
}

/* Small button variant for tables and compact layouts */
.btn-sm {
    padding: 4px 8px;
    font-size: var(--font-size-xs);
}

/* Icon button for table actions */
.btn-icon {
    background: transparent;
    border: 1px solid var(--border-default);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    line-height: 1;
}

.btn-icon:hover {
    background: var(--interactive-hover);
    opacity: 1;
}

.btn-icon.btn-danger {
    color: var(--status-danger);
    border-color: var(--status-danger);
}

.btn-icon.btn-danger:hover {
    background: rgba(220, 53, 69, 0.08);
}

.button-group, .btn-group {
    display: flex;
    gap: 8px;
    margin-top: 1rem;
}

/* Form sections */
.form-section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.form-section h3 {
    color: var(--text-primary);
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: 16px;
}

.form-section select {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    margin-bottom: 12px;
    background: var(--input-bg);
    color: var(--text-primary);
}

/* Global form input styles — ensure dark mode compatibility */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="tel"],
textarea,
select {
    background-color: var(--input-bg, var(--surface-primary));
    color: var(--text-primary);
    border-color: var(--input-border, var(--border-default));
}

/* Global form input focus styles */
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--input-focus-ring);
}

.selected-questions, .selected-answers {
    background: var(--light-gray);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.selected-questions h4, .selected-answers h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

#selected-list {
    max-height: 300px;
    overflow-y: auto;
}

#selected-list ul {
    list-style: none;
    padding: 0;
}

#selected-list li {
    padding: 4px 0;
    font-size: var(--font-size-base);
    color: var(--dark-gray);
}

.placeholder {
    color: var(--dark-gray);
    font-style: italic;
}

/* Job status */
.job-status {
    background: var(--light-gray);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--secondary-color);
    margin-top: 2rem;
}

.job-status h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.success {
    color: var(--success-color);
    font-weight: 600;
}

.error {
    color: var(--danger-color);
    font-weight: 600;
}

.info {
    color: var(--dark-gray);
    font-style: italic;
    margin-bottom: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
}

/* CSS class toggling support (new pattern) */
.modal.modal-open {
    display: block;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--modal-bg);
    margin: 5% auto;
    padding: 24px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-default);
}

.modal-large {
    max-width: 1200px;
}

.close {
    color: var(--text-tertiary);
    float: right;
    font-size: var(--font-size-3xl);
    font-weight: bold;
    cursor: pointer;
}

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

.detail-section {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--medium-gray);
}

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

.detail-section h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.question-full {
    font-size: var(--font-size-lg);
    line-height: 1.6;
    padding: 1rem;
    background: var(--light-gray);
    border-radius: var(--border-radius);
}

.answer-text, .rationale-text {
    padding: 1rem;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    white-space: pre-wrap;
    line-height: 1.6;
}

.rubric-section {
    margin-top: 1rem;
}

.rubric-section h5 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.rubric-section pre {
    background: var(--light-gray);
    padding: 1rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    white-space: pre-wrap;
    line-height: 1.5;
}

.all-questions-section, .answers-section {
    margin-top: 2rem;
}

/* Result files list (in job details) */
.result-files-list {
    list-style: none;
    padding: 0;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.result-files-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--medium-gray);
}

.result-files-list li:last-child {
    border-bottom: none;
}

.result-files-list a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.result-files-list a:hover {
    text-decoration: underline;
}

/* Admin page */
.admin-link {
    color: var(--warning-color) !important;
}

.warning-banner {
    background-color: var(--warning-bg);
    border: 2px solid var(--warning-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 2rem;
    color: var(--warning-text);
}

.admin-section {
    background: var(--surface-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.admin-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.admin-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.admin-action:last-child {
    margin-bottom: 0;
}

.warning-action {
    border-color: var(--warning-color);
    background-color: var(--warning-bg);
}

.danger-action {
    border-color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.08);
}

.action-info {
    flex: 1;
    margin-right: 2rem;
}

.action-info h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.action-info p {
    margin: 0;
    color: var(--dark-gray);
    font-size: var(--font-size-base);
}

.danger-button {
    background-color: var(--btn-danger-bg);
    color: var(--btn-danger-text);
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: background-color var(--transition-fast);
}

.danger-button:hover {
    background-color: var(--color-red-600);
    opacity: 1;
}

.danger-button-extreme {
    background-color: var(--danger-extreme);
    padding: 8px 20px;
    font-weight: 600;
}

.danger-button-extreme:hover {
    background-color: var(--danger-extreme-hover);
    opacity: 1;
}

/* Icon buttons (Tabler icons) */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: background var(--transition-fast), color var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    line-height: 1;
    vertical-align: middle;
}

.icon-btn:hover {
    background: var(--interactive-hover);
    color: var(--text-primary);
}

.icon-btn.danger:hover {
    background: var(--danger-bg, rgba(220, 53, 69, 0.1));
    color: var(--status-danger);
}

/* Kebab (overflow) menu */
.kebab-wrapper {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.kebab-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--surface-elevated, var(--surface-primary));
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg, 0 4px 16px rgba(0,0,0,0.12));
    min-width: 160px;
    z-index: 9999;
    padding: 4px;
}

.kebab-menu.show {
    display: block;
}

.kebab-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--radius-md);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background var(--transition-fast);
    white-space: nowrap;
}

.kebab-menu-item:hover {
    background: var(--interactive-hover);
}

.kebab-menu-item.danger {
    color: var(--status-danger);
}

.kebab-menu-item.danger:hover {
    background: var(--danger-bg, rgba(220, 53, 69, 0.1));
}

.kebab-menu-item i {
    font-size: var(--font-size-base);
    flex-shrink: 0;
}

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

.warning-text {
    color: var(--danger-color);
    padding: 1rem;
    background-color: rgba(220, 53, 69, 0.08);
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.danger-text {
    color: white;
    background-color: var(--danger-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    font-size: var(--font-size-lg);
    text-align: center;
}

.schema-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.schema-item {
    padding: 1rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    background-color: var(--light-gray);
    transition: all var(--transition-fast);
}

.schema-item.clickable {
    cursor: pointer;
}

.schema-item.clickable:hover {
    background-color: var(--info-bg);
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-md);
}

.schema-item h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.schema-path {
    font-family: 'Courier New', monospace;
    font-size: var(--font-size-base);
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.schema-description {
    color: var(--dark-gray);
    font-size: var(--font-size-base);
    margin: 0;
}

.status-message {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    z-index: 9999;
    font-weight: 500;
}

.status-info {
    background-color: var(--secondary-color);
    color: white;
}

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

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

/* Footer */
.footer {
    background-color: var(--surface-primary);
    color: var(--text-tertiary);
    border-top: 1px solid var(--border-default);
    padding: 1.5rem 0;
    margin-top: 3rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
}

.footer-brand h3 {
    font-size: var(--font-size-2xl);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.footer-brand p {
    color: var(--text-tertiary);
    font-size: var(--font-size-base);
}

.footer-links h4 {
    font-size: var(--font-size-base);
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: var(--font-size-base);
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
    }

    .filters select {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1rem;
    }
}

/* Builder Page - Stepper */
.stepper {
    display: flex;
    justify-content: space-between;
    margin: 2rem 0;
    padding: 0 1rem;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    opacity: 0.5;
}

.step::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 50%;
    height: 2px;
    background-color: var(--medium-gray);
    z-index: -1;
}

.step:first-child::before {
    display: none;
}

.step.active,
.step.completed {
    opacity: 1;
}

.step.completed .step-number {
    background-color: var(--success-color);
    color: white;
}

.step.completed::before {
    background-color: var(--success-color);
}

.step.active .step-number {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 0 0 4px rgba(0, 46, 93, 0.2);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background-color: var(--medium-gray);
    color: var(--dark-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-lg);
    margin-bottom: 0.5rem;
    transition: all var(--transition-normal);
}

.step-label {
    font-size: var(--font-size-sm);
    text-align: center;
    color: var(--text-color);
}

/* Builder Page - Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    font-family: inherit;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 46, 93, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--dark-gray);
    font-size: var(--font-size-sm);
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Builder Page - Questions List */
.questions-summary {
    margin-top: 2rem;
    padding: 1rem;
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
}

.questions-summary h4 {
    margin-bottom: 1rem;
}

#category-summary {
    margin-bottom: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--accent-color);
    color: white;
    border-radius: var(--radius-xl);
    font-size: var(--font-size-sm);
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.question-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: var(--surface-primary);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    border: 1px solid var(--medium-gray);
}

.question-item-content {
    flex: 1;
}

.small-button {
    padding: 0.25rem 0.75rem;
    font-size: var(--font-size-sm);
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
}

.small-button:hover {
    opacity: 0.9;
}

/* Builder Page - Progress Bar */
.progress-bar {
    width: 100%;
    height: 30px;
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent-color);
    transition: width var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

#generation-log {
    font-family: 'Courier New', monospace;
    font-size: var(--font-size-sm);
    background-color: var(--surface-secondary);
    padding: 1rem;
    border-radius: var(--border-radius);
    max-height: 200px;
    overflow-y: auto;
    margin-top: 1rem;
}

/* Builder Page - Detail Section */
.detail-section {
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
}

.detail-section h4 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Sortable table headers */
.data-table th[data-sort] {
    cursor: pointer;
    user-select: none;
    transition: background-color var(--transition-fast);
    white-space: nowrap;
}

.data-table th[data-sort]:hover {
    background-color: var(--secondary-color);
}

.data-table th.sorted-asc,
.data-table th.sorted-desc {
    background-color: var(--secondary-color);
    color: var(--text-on-emphasis);
}

.sort-indicator {
    font-size: 0.85em;
    margin-left: 0.25rem;
    display: inline-block;
    min-width: 1rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Collapsible sections */
.collapsible-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.75rem;
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
    margin: 1rem 0;
    user-select: none;
    transition: background-color var(--transition-fast);
}

.collapsible-header:hover {
    background-color: var(--medium-gray);
}

.collapsible-icon {
    margin-right: 0.5rem;
    font-size: 0.9em;
    transition: transform var(--transition-fast);
}

.collapsible-icon.open {
    transform: rotate(90deg);
}

.collapsible-content {
    display: none;
    margin: 0.5rem 0 1rem 0;
    padding: 1rem;
    background-color: var(--surface-secondary);
    border-radius: var(--border-radius);
    overflow-x: auto;
}

.collapsible-content.open {
    display: block;
}

.json-content {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Answer tables for job results */
.answer-table-container {
    margin-bottom: 2rem;
    background: var(--surface-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.answer-table-header {
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: var(--font-size-xl);
    font-weight: 600;
}

.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.answer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-base);
}

.answer-table th {
    background-color: var(--light-gray);
    padding: 0.75rem;
    text-align: center;
    border-bottom: 2px solid var(--medium-gray);
    font-weight: 600;
    position: sticky;
    top: 0;
    min-width: 100px;
}

.answer-table th.question-column {
    text-align: left;
}

.question-column {
    min-width: 250px;
    max-width: 400px;
}

.question-cell {
    padding: 0.75rem;
    border-bottom: 1px solid var(--medium-gray);
    vertical-align: top;
    white-space: normal;
    word-wrap: break-word;
    background-color: var(--surface-secondary);  /* Light gray background */
}

.question-cell em {
    font-style: italic;
    color: var(--dark-gray);
}

.answer-cell {
    padding: 0.75rem;
    border-bottom: 1px solid var(--medium-gray);
    border-left: 1px solid var(--medium-gray);
    vertical-align: middle;
    text-align: center;
    max-width: 400px;
    cursor: pointer;
    position: relative;
}

.answer-cell:hover {
    /* Darken slightly on hover without overriding score color */
    filter: brightness(0.95);
}

.answer-cell-content {
    /* Truncate to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
}

.answer-cell::after {
    content: '\ee05';
    font-family: 'tabler-icons';
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
    font-size: 0.9em;
}

.answer-cell:hover::after {
    opacity: 0.6;
}

/* Error cell styling for failed answer generation */
.error-cell {
    background-color: rgba(220, 53, 69, 0.08) !important;
    color: var(--status-danger);
    font-weight: 600;
    text-align: center;
}

.error-cell:hover {
    filter: brightness(0.95);
}

.error-cell .answer-cell-content {
    font-size: 0.9em;
    letter-spacing: 0.05em;
}

.answer-table tbody tr:hover {
    background-color: var(--light-gray);
}

.loading-tables {
    text-align: center;
    padding: 2rem;
    color: var(--dark-gray);
    font-style: italic;
}

.error-tables {
    padding: 1rem;
    background-color: var(--warning-bg);
    border: 1px solid var(--warning-color);
    border-radius: var(--border-radius);
    color: var(--warning-text);
    margin-bottom: 1rem;
}

/* Modal for full answer view */
.answer-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.answer-modal-content {
    position: relative;
    background-color: var(--surface-primary);
    margin: 5% auto;
    padding: 0;
    width: 80%;
    max-width: 800px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s;
}

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

.answer-modal-header {
    padding: 1.5rem;
    background-color: var(--accent-color);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.answer-modal-header h3 {
    margin: 0;
    font-size: var(--font-size-xl);
}

.answer-modal-close {
    color: white;
    font-size: var(--font-size-3xl);
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    transition: opacity var(--transition-fast);
}

.answer-modal-close:hover {
    opacity: 0.7;
}

.answer-modal-body {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.answer-modal-question {
    font-style: italic;
    color: var(--dark-gray);
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.answer-modal-answer {
    line-height: 1.6;
    color: var(--text-color);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Question modal specific styles */
.question-modal-content {
    max-width: 1200px;
}

.model-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--light-gray);
    border-bottom: 1px solid var(--medium-gray);
}

.model-selector-single {
    padding: 1rem;
    background-color: var(--light-gray);
    border-bottom: 1px solid var(--medium-gray);
    text-align: center;
}

.model-info-display {
    padding: 0.75rem 1rem;
    background-color: var(--light-gray);
    border-bottom: 1px solid var(--medium-gray);
    font-size: var(--font-size-base);
}

.model-nav-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: var(--font-size-xl);
    transition: background-color var(--transition-fast);
}

.model-nav-btn:hover {
    background-color: var(--accent-12);
}

.model-name-display {
    font-weight: 600;
    color: var(--text-color);
    min-width: 300px;
    text-align: center;
}

.model-counter {
    color: var(--dark-gray);
    font-size: 0.9em;
}

.question-detail-row-1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--medium-gray);
}

.question-detail-row-2 {
    margin-top: 1rem;
}

.question-detail-col h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    font-size: var(--font-size-lg);
}

.question-detail-row-2 h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    font-size: var(--font-size-lg);
}

.detail-content {
    line-height: 1.6;
    color: var(--text-color);
    white-space: pre-wrap;
    word-wrap: break-word;
    background-color: var(--surface-secondary);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--medium-gray);
}

/* Responsive layout for smaller screens */
@media (max-width: 768px) {
    .question-detail-row-1 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .question-modal-content {
        width: 95%;
        margin: 2% auto;
    }
}


/* User Profile Navigation */
.user-profile-nav {
    position: relative;
    margin-left: auto;
}

.user-avatar-container {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar-nav {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--border-default);
    transition: border-color var(--transition-fast);
}

.user-avatar-nav:hover {
    border-color: var(--primary-color);
}

.user-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--font-size-lg);
    line-height: 1;
    border: 2px solid var(--border-default);
    transition: background var(--transition-fast);
}

.admin-gear-icon {
    font-size: var(--font-size-3xl);
    line-height: 1;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.admin-gear-icon:hover {
    opacity: 0.8;
}

.user-avatar-placeholder:hover {
    background: var(--primary-dark);
}

/* User Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--surface-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 260px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 1000;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-dropdown-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

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

.user-dropdown-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-md);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-email {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

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


.user-dropdown-item {
    display: block;
    padding: 12px 16px;
    color: var(--text-primary) !important;
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-base);
    transition: background var(--transition-fast), color var(--transition-fast);
}

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

.user-dropdown-logout {
    display: block;
    padding: 12px 16px;
    color: var(--status-danger) !important;
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-base);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.user-dropdown-logout:hover {
    background: var(--status-danger-bg);
    color: var(--red-11) !important;
}

/* ========================================
   Login Page Styles
   ======================================== */

.login-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: var(--surface-secondary);
}

.login-box {
    background: var(--surface-primary);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    margin-top: 0;
    margin-bottom: 24px;
    color: var(--text-primary);
    font-size: var(--font-size-2xl);
    font-weight: 500;
}

/* Professional Google Button Styles */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    height: 48px;
    font-family: "Google Sans", arial, sans-serif;
    font-size: var(--font-size-base);
    font-weight: 500;
    text-decoration: none;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.btn-google:hover {
    background-color: var(--interactive-hover);
    border-color: var(--accent-6);
    box-shadow: var(--shadow-sm);
}

.btn-google:active {
    background-color: var(--interactive-active);
}

.google-icon {
    margin-right: 12px;
    width: 18px;
    height: 18px;
}

/* Multi-provider OAuth Button Styles */
.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    height: 48px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: var(--font-size-base);
    font-weight: 500;
    text-decoration: none;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.btn-oauth:hover {
    background-color: var(--interactive-hover);
    border-color: var(--accent-6);
    box-shadow: var(--shadow-sm);
}

.btn-oauth:active {
    background-color: var(--interactive-active);
}

.oauth-icon {
    margin-right: 12px;
    width: 20px;
    height: 20px;
}

/* Login Form Styles */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: var(--text-tertiary);
    font-size: var(--font-size-base);
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-default);
}

.divider::before { 
    margin-right: 10px; 
}

.divider::after { 
    margin-left: 10px; 
}

.login-box input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    box-sizing: border-box;
    background: var(--input-bg);
    color: var(--text-primary);
}

.login-box input[type="password"]:focus {
    border-color: var(--accent-color);
    outline: none;
}

.btn-submit {
    width: 100%;
    padding: 10px;
    background: var(--accent-color);
    color: var(--text-on-emphasis);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: var(--font-size-base);
}

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

.login-box .error {
    color: var(--red-11);
    background: var(--status-danger-bg);
    padding: 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: var(--font-size-base);
    text-align: center;
}

/* Password Login Form Styles */
.login-box input[type="email"],
.login-box input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    box-sizing: border-box;
    background: var(--input-bg);
    color: var(--text-primary);
}

.login-box input[type="email"]:focus,
.login-box input[type="text"]:focus {
    border-color: var(--accent-color);
    outline: none;
}

/* Remember Me Checkbox */
.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: var(--font-size-base);
    color: var(--text-tertiary);
    cursor: pointer;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Password Strength Meter */
.strength-meter {
    margin-top: 4px;
    margin-bottom: 16px;
}

.strength-bar {
    height: 4px;
    background: var(--gray-5);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: width var(--transition-normal), background-color var(--transition-normal);
    border-radius: var(--radius-sm);
}

.strength-text {
    display: block;
    margin-top: 4px;
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.strength-feedback {
    display: block;
    margin-top: 2px;
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

/* ============================================================================
   User Management Styles
   ============================================================================ */

.users-table-container {
    margin-top: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-base);
}

.users-table th,
.users-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.users-table th {
    background: var(--light-gray);
    font-weight: 600;
    color: var(--dark-gray);
}

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

.users-table .actions-cell {
    white-space: nowrap;
}

.users-table .actions-cell button {
    margin-right: 0.5rem;
}

.users-table .actions-cell button:last-child {
    margin-right: 0;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.badge-admin {
    background: var(--primary-color);
    color: white;
}

.badge-dev {
    background: #6f42c1;
    color: white;
}

.empty-text {
    color: var(--dark-gray);
    font-style: italic;
    margin: 0;
}

.loading-text {
    color: var(--dark-gray);
    margin: 0;
}

.error-text {
    color: var(--danger-color);
    margin: 0;
}

/* Small button variant */
.secondary-button.small,
.danger-button.small {
    padding: 0.35rem 0.75rem;
    font-size: var(--font-size-xs);
}

/* Admin action with vertical layout for user management */
.admin-action.invite-action {
    display: block;
}

.admin-action.invite-action .action-info {
    margin-right: 0;
}

.invite-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-top: 0.75rem;
}

.invite-email-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-default);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    background: var(--input-bg, var(--surface-primary));
    color: var(--text-primary);
    resize: vertical;
    font-family: inherit;
    min-height: 2.5rem;
}

.invite-email-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 46, 93, 0.1);
}

@media (max-width: 768px) {
    .admin-action {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-action .invite-form {
        width: 100%;
        min-width: auto;
        margin-top: 1rem;
    }

    .action-info {
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .users-table {
        font-size: var(--font-size-xs);
    }

    .users-table th,
    .users-table td {
        padding: 0.5rem;
    }
}

/* ============================================
   EDITOR MODAL STYLES
   ============================================ */

/* Editor Modal Structure */
.editor-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--light-bg);
    flex-shrink: 0;
}

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

.editor-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--light-bg);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    flex-shrink: 0;
}

/* Editor Category Styles */
.editor-category-item {
    margin-bottom: 1rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.editor-category-item.editor-new-item {
    border-left: 4px solid var(--success-color);
}

.editor-category-item.editor-deleted-item {
    opacity: 0.5;
    border-left: 4px solid var(--danger-color);
}

.editor-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--light-bg);
    cursor: pointer;
}

.editor-category-header:hover {
    background-color: var(--interactive-hover);
}

.editor-category-name {
    font-weight: 600;
    font-size: 1.1em;
    padding: 0.25rem 0.5rem;
    margin: -0.25rem -0.5rem;
    border-radius: var(--radius-sm);
    min-width: 100px;
}

.editor-category-name.editing,
.editor-category-name:focus {
    outline: 2px solid var(--primary-color);
    background-color: var(--surface-primary);
}

.editor-question-count {
    font-size: 0.85em;
    color: var(--dark-gray);
    margin-top: 0.25rem;
}

.editor-category-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.editor-questions-list {
    border-top: 1px solid var(--medium-gray);
    padding: 0.5rem;
    background-color: var(--surface-primary);
}

/* Editor Question Styles */
.editor-question-item {
    padding: 0.75rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    background-color: var(--surface-primary);
}

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

.editor-question-item.editor-deleted-item {
    opacity: 0.5;
    border-left: 4px solid var(--danger-color);
    text-decoration: line-through;
}

.editor-question-item.editor-modified-item {
    border-left: 4px solid var(--status-warning);
}

.editor-question-item.editor-new-item {
    border-left: 4px solid var(--success-color);
}

.editor-question-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    cursor: pointer;
}

.editor-question-text {
    font-weight: 500;
    line-height: 1.4;
}

.editor-question-meta {
    font-size: 0.8em;
    color: var(--dark-gray);
    margin-top: 0.25rem;
}

.editor-question-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--medium-gray);
}

/* Editor Helper Classes */
.editor-trash-icon {
    cursor: pointer;
    font-size: 1.2em;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.editor-trash-icon:hover {
    opacity: 1;
}

.editor-rubric-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-xl);
    color: white;
    font-size: 0.8em;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.editor-rubric-pill:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}


/* Small button variant */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.85em;
}

/* Nested modal z-index overrides */
#editor-add-category-modal,
#editor-add-question-modal,
#editor-delete-question-modal,
#editor-delete-category-modal,
#editor-preview-modal,
#editor-discard-modal {
    z-index: 1001;
}

/* Editor responsive styles */
@media (max-width: 768px) {
    #editor-modal .modal-content {
        width: 98%;
        height: 95vh;
        margin: 2.5vh auto;
    }

    .editor-modal-header,
    .editor-modal-body,
    .editor-modal-footer {
        padding: 1rem;
    }

    .editor-category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .editor-category-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* ============================================
   RE-RUN QUESTION STYLES
   ============================================ */

/* Modal header buttons container */
.modal-header-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Re-run button in modal header */
.rerun-button {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    padding: 0.4rem 0.75rem;
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.rerun-button:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.rerun-button:active {
    background-color: rgba(255, 255, 255, 0.35);
}

/* Re-run status indicator (replaces button during loading) */
.rerun-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.9);
}

/* Small spinner for header-based loading */
.rerun-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: var(--radius-full);
    animation: rerun-spin 1s linear infinite;
}

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

/* Timer display in header */
.rerun-timer {
    font-variant-numeric: tabular-nums;
    min-width: 3ch;
}

/* Stage text in header */
.rerun-stage {
    opacity: 0.9;
}

/* Cancel button in header (during loading) */
.rerun-cancel-btn {
    background: rgba(220, 53, 69, 0.8);
    border: 1px solid rgba(220, 53, 69, 0.9);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-xs);
    margin-left: 0.5rem;
}

.rerun-cancel-btn:hover {
    background: rgba(220, 53, 69, 1);
}

/* Header buttons container */
.header-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Ensure modal content has relative positioning */
.question-modal-content {
    position: relative;
}

/* ==========================================================================
   NEW LAYOUT SYSTEM — see docs/UI_DESIGN_SYSTEM.md section 8
   ========================================================================== */

/* --- Workspace Navigation --- */
.ws-nav {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Compact nav for immersive work screens */
.layout-workspace .ws-nav,
.layout-panels .ws-nav,
.layout-results .ws-nav {
    height: 48px;
}

.ws-nav-inner {
    max-width: var(--layout-max-width);
    margin: 0 auto;
    padding: 0 var(--layout-padding);
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    height: 100%;
}

.ws-nav-left {
    display: flex;
    align-items: stretch;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
}

.ws-nav-brand {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--nav-brand);
    text-decoration: none;
    margin-right: 16px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}

.ws-nav-brand:hover {
    color: var(--nav-brand);
    opacity: 0.85;
    text-decoration: none;
}

.ws-nav-brand-img {
    height: 40px;
    width: auto;
    display: block;
    /* Render the black-on-white source logo as white on the dark navbar */
    filter: brightness(0) invert(1);
}

.ws-nav-group {
    display: flex;
    align-items: stretch;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;          /* Firefox */
}
.ws-nav-group::-webkit-scrollbar {
    display: none;                  /* Chrome/Safari */
}

.ws-nav-link {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 0 12px;
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--nav-text);
    text-decoration: none;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition-fast), border-color var(--transition-fast);
    white-space: nowrap;
}

.ws-nav-link:hover {
    color: var(--nav-text-hover);
    text-decoration: none;
}

.ws-nav-link.ws-nav-active {
    color: var(--nav-text-active);
    border-bottom-color: var(--nav-text-active);
    font-weight: 600;
}

.ws-chevron {
    font-size: var(--font-size-xs);
    opacity: 0.85;
}

/* --- Dropdowns --- */
.ws-dropdown {
    position: relative;
    display: flex;
    align-items: stretch;
}

.ws-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 4px 0;
    z-index: 200;
    margin-top: 4px;
}

/* Invisible bridge to cover the margin-top gap so :hover doesn't break */
.ws-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 0;
    right: 0;
    height: 4px;
}

.ws-dropdown:hover > .ws-dropdown-menu,
.ws-dropdown:focus-within > .ws-dropdown-menu,
.ws-dropdown-menu.show {
    display: block;
}

.ws-dropdown-item {
    display: block;
    padding: 8px 14px;
    font-size: var(--font-size-base);
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}

.ws-dropdown-item:hover {
    background: var(--interactive-hover);
    color: var(--text-primary);
    text-decoration: none;
}

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

.ws-dropdown-item-danger:hover {
    background: rgba(220, 53, 69, 0.08);
}

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

.ws-dropdown-label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

/* --- User menu --- */
.ws-nav-right {
    display: flex;
    align-items: center;
    align-self: center;
    flex-shrink: 0;
    margin-left: 8px;
}

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

.ws-user-trigger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    border-radius: var(--radius-full);
    color: inherit;
}

.ws-user-trigger:hover {
    opacity: 0.85;
}

.ws-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.ws-user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.2);
    color: var(--nav-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-base);
    font-weight: 600;
}

.ws-user-dropdown {
    right: 0;
    left: auto;
    min-width: 264px;
}

.ws-user-dropdown.show {
    display: block;
}

.ws-user-info {
    padding: 10px 14px;
}

.ws-user-name {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
}

.ws-user-email {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* Theme controls */
.ws-theme-controls,
.ws-accent-control,
.ws-mode-control {
    padding: 8px 14px;
}

.ws-theme-toggle,
.ws-mode-toggle {
    display: flex;
    gap: 4px;
}

.ws-theme-btn,
.ws-mode-btn {
    flex: 1;
    padding: 4px 8px;
    font-size: var(--font-size-sm);
    background: var(--surface-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.ws-theme-btn:hover,
.ws-mode-btn:hover {
    background: var(--interactive-active);
}

.ws-theme-btn.ws-theme-active,
.ws-mode-btn.ws-mode-active {
    background: var(--accent-color);
    color: var(--text-on-emphasis);
    border-color: var(--accent-color);
}

.ws-accent-palette {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.ws-accent-swatch {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
    padding: 0;
}
.ws-accent-swatch:hover {
    transform: scale(1.15);
}
.ws-accent-swatch.ws-accent-active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--surface-primary);
}

.ws-landing-select {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--surface-primary);
    color: var(--text-primary);
    font-size: var(--font-size-xs);
    cursor: pointer;
}

/* --- Layout: Public --- */
.layout-public {
    background: var(--surface-secondary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.pub-nav {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    height: 64px;
}

.pub-nav-inner {
    max-width: var(--layout-max-width);
    margin: 0 auto;
    padding: 0 var(--layout-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.pub-nav-brand {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--nav-brand);
    text-decoration: none;
    letter-spacing: 0.5px;
}

.pub-nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pub-nav-link {
    font-size: var(--font-size-base);
    color: var(--nav-text);
    text-decoration: none;
    padding: 20px 12px 18px;
    border-bottom: 2px solid transparent;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.pub-nav-link:hover {
    color: var(--nav-text-hover);
}

.pub-nav-link.pub-nav-active {
    color: var(--nav-text-active);
    border-bottom-color: var(--nav-text-active);
    font-weight: 600;
}

.pub-nav-cta {
    background: rgba(255, 255, 255, 0.95);
    color: #002E5D;
    font-weight: 600;
    border-radius: var(--radius-md);
    padding: 6px 16px;
    border-bottom: none;
}

[data-theme="dark"] .pub-nav-cta {
    background: var(--accent-color);
    color: #0a1628;
}

.pub-nav-cta:hover {
    opacity: 0.9;
    text-decoration: none;
}

.pub-content {
    flex: 1;
    padding: 20px var(--layout-padding);
}

.pub-content-inner {
    max-width: var(--layout-max-width);
    margin: 0 auto;
}

.pub-footer {
    background: var(--surface-secondary);
    border-top: 1px solid var(--border-default);
    padding: 32px var(--layout-padding);
}

.pub-footer-inner {
    max-width: var(--layout-max-width);
    margin: 0 auto;
    display: flex;
    gap: 48px;
}

.pub-footer-brand h3 {
    font-size: var(--font-size-lg);
    color: var(--accent-color);
    margin-bottom: 4px;
}

.pub-footer-brand p {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
}

.pub-footer-links h4 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.pub-footer-links ul {
    list-style: none;
    padding: 0;
}

.pub-footer-links li {
    margin-bottom: 4px;
}

.pub-footer-links a {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    text-decoration: none;
}

.pub-footer-links a:hover {
    color: var(--text-primary);
}

/* --- Layout: Workspace --- */
.layout-workspace {
    background: var(--surface-secondary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.ws-content {
    flex: 1;
    padding: var(--layout-padding) 0;
}

.ws-content-inner {
    max-width: var(--layout-max-width);
    margin: 0 auto;
    padding: 0 var(--layout-padding);
}

.ws-footer {
    background: var(--surface-primary);
    border-top: 1px solid var(--border-default);
    padding: 12px 0;
    text-align: center;
}

.ws-footer-inner {
    max-width: var(--layout-max-width);
    margin: 0 auto;
    padding: 0 var(--layout-padding);
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ws-footer-inner a {
    color: var(--text-tertiary);
    text-decoration: none;
}

.ws-footer-inner a:hover {
    color: var(--text-secondary);
}

/* --- Layout: Panels (full viewport) --- */
.layout-panels {
    background: var(--surface-secondary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panels-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.panels-sidebar {
    width: 260px;
    min-width: 200px;
    background: var(--surface-primary);
    border-right: 1px solid var(--border-default);
    overflow-y: auto;
    flex-shrink: 0;
}

.panels-main {
    flex: 1;
    overflow-y: auto;
    padding: var(--layout-padding);
    max-width: var(--layout-max-width);
    margin: 0 auto;
}

.panels-right {
    width: 340px;
    min-width: 240px;
    background: var(--surface-primary);
    border-left: 1px solid var(--border-default);
    overflow-y: auto;
    flex-shrink: 0;
}

/* --- Layout: Results --- */
.layout-results {
    background: var(--surface-secondary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.results-content {
    flex: 1;
    padding: var(--layout-padding) 0;
}
.results-content-inner {
    max-width: var(--layout-max-width);
    margin: 0 auto;
    padding: 0 var(--layout-padding);
}

/* ==========================================================================
   Toast notifications (CSS classes instead of inline styles)
   ========================================================================== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: var(--font-size-base);
    z-index: 10000;
    box-shadow: var(--shadow-md);
    transition: opacity var(--transition-normal);
    max-width: 500px;
}

.toast-success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.toast-error {
    background-color: var(--red-3);
    color: var(--red-11);
    border: 1px solid var(--red-6);
}

.toast-info {
    background-color: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

/* ==========================================================================
   Badges / Pills
   ========================================================================== */
.badge {
    display: inline-block;
    font-size: var(--font-size-xs);
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    line-height: 1.5;
}

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

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--status-warning);
}

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

.badge-info {
    background: rgba(0, 98, 184, 0.12);
    color: var(--status-info);
}

.badge-neutral {
    background: var(--surface-tertiary);
    color: var(--text-secondary);
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-muted);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-default);
    margin-bottom: 16px;
}

.tab {
    padding: 8px 16px;
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

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

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

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    margin-top: 16px;
}

.pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-primary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--interactive-hover);
}

.pagination-btn.pagination-active {
    background: var(--accent-color);
    color: var(--text-on-emphasis);
    border-color: var(--accent-color);
}

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

/* ==========================================================================
   Empty States
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
}

.empty-state-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: var(--font-size-base);
    margin-bottom: 16px;
}

.empty-state-cta {
    margin-top: 12px;
}

/* ==========================================================================
   Badge Type & Role Variants
   ========================================================================== */
.badge-type-bank     { background: var(--badge-bank-bg);   color: var(--badge-bank-text); }
.badge-type-prompt   { background: var(--badge-prompt-bg); color: var(--badge-prompt-text); }
.badge-type-rubric   { background: var(--badge-rubric-bg); color: var(--badge-rubric-text); }
.badge-type-preset   { background: var(--badge-preset-bg); color: var(--badge-preset-text); }
.badge-role-admin    { background: var(--badge-admin-bg);  color: var(--badge-admin-text); }
.badge-role-dev      { background: var(--badge-dev-bg);    color: var(--badge-dev-text); }

/* ==========================================================================
   Action Buttons (table row actions)
   ========================================================================== */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-primary);
    border: 2px solid currentColor;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-base);
    line-height: 1;
    transition: background-color var(--transition-fast), opacity var(--transition-fast);
}

.btn-action:hover {
    opacity: 0.75;
}

.btn-action-edit   { color: var(--secondary-color); }
.btn-action-delete { color: var(--danger-color); }
.btn-action-view   { color: var(--accent-color); }
.btn-action-copy   { color: var(--status-info); }
.btn-action-add    { color: var(--success-color); }

/* ==========================================================================
   Table Form Controls
   ========================================================================== */
.table-select {
    background: var(--surface-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.table-select:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}

.table-input {
    background: var(--surface-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: var(--font-size-sm);
}

.table-input:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}

/* ==========================================================================
   Button Size Variants
   ========================================================================== */
.button-sm {
    font-size: var(--font-size-xs);
    padding: 4px 8px;
}

.button-lg {
    font-size: var(--font-size-lg);
    padding: 10px 20px;
}

/* ==========================================================================
   Loading / Spinner
   ========================================================================== */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 2rem;
    color: var(--text-tertiary);
    font-size: var(--font-size-base);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent-color);
    border-radius: var(--radius-full);
    animation: spin 0.6s linear infinite;
}

.spinner-sm {
    width: 14px;
    height: 14px;
}

.spinner-lg {
    width: 28px;
    height: 28px;
    border-width: 3px;
}

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

/* ==========================================================================
   Skeleton Loading
   ========================================================================== */
.skeleton {
    background: var(--surface-tertiary);
    border-radius: var(--radius-sm);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-text {
    height: 14px;
    width: 80%;
    margin-bottom: 8px;
}

.skeleton-text.skeleton-short {
    width: 40%;
}

.skeleton-rect {
    height: 120px;
    width: 100%;
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* ==========================================================================
   Third-party library dark mode overrides
   ========================================================================== */

/* jspreadsheet (used in wizard_basic) */
/* jspreadsheet dark mode — Notion-style minimal */
[data-theme="dark"] .jexcel_container {
    background: var(--surface-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .jexcel {
    background: var(--surface-primary);
    color: var(--text-primary);
    border-color: var(--border-muted);
}

[data-theme="dark"] .jexcel thead td,
[data-theme="dark"] .jexcel tbody td {
    border-color: var(--border-muted);
}

[data-theme="dark"] .jexcel thead td {
    background: var(--surface-primary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .jexcel td {
    background: var(--surface-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .jexcel td.jexcel_row {
    background: var(--surface-secondary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .jexcel td.readonly {
    background: var(--surface-secondary) !important;
}

[data-theme="dark"] .jexcel_content {
    background: var(--surface-primary);
}

[data-theme="dark"] .jexcel_pagination {
    background: var(--surface-secondary);
    color: var(--text-secondary);
}

[data-theme="dark"] .jexcel td.highlight {
    background: var(--accent-muted) !important;
}

[data-theme="dark"] .jexcel td.highlight-left,
[data-theme="dark"] .jexcel td.highlight-right,
[data-theme="dark"] .jexcel td.highlight-top,
[data-theme="dark"] .jexcel td.highlight-bottom {
    border-color: var(--accent-color) !important;
}

[data-theme="dark"] .jexcel .jexcel_selectall:hover,
[data-theme="dark"] .jexcel thead td:hover {
    background: var(--surface-tertiary) !important;
}

[data-theme="dark"] .jexcel .editor {
    background: var(--surface-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--accent-color) !important;
}

[data-theme="dark"] .jcontextmenu {
    background: var(--surface-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
}

[data-theme="dark"] .jcontextmenu > div:hover {
    background: var(--interactive-hover) !important;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--surface-inset);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-color);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

.favorite-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--font-size-base);
    padding: 2px 4px;
    line-height: 1;
}
.favorite-btn:hover { transform: scale(1.2); }

/* ── Inline Column Filters (inside <th>) ── */
/* ── Searchable column filter (th-filter) ── */
.th-filter-wrap {
    position: relative;
    display: block;
    margin-top: 4px;
}
.th-filter {
    display: block;
    width: 100%;
    padding: 2px 18px 2px 4px;
    font-size: var(--font-size-xs);
    font-weight: normal;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    background: var(--surface-primary);
    color: var(--text-color);
    box-sizing: border-box;
    cursor: text;
}
.th-filter:focus {
    border-color: var(--primary-color);
    outline: none;
}
.th-filter-clear {
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-size-xs);
    color: var(--dark-gray);
    cursor: pointer;
    line-height: 1;
    display: none;
    background: var(--surface-primary);
    padding: 0 2px;
}
.th-filter-wrap.has-value .th-filter-clear {
    display: block;
}
.th-filter-wrap.has-value .th-filter {
    background: var(--info-bg);
    border-color: var(--secondary-color);
}
.th-filter-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 180px;
    overflow-y: auto;
    background: var(--surface-primary);
    color: var(--text-color);
    border: 1px solid var(--medium-gray);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--shadow-md);
    font-size: var(--font-size-xs);
    font-weight: normal;
}
.th-filter-dropdown.open {
    display: block;
}
.th-filter-option {
    padding: 3px 6px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.th-filter-option:hover,
.th-filter-option.highlighted {
    background: var(--info-bg);
}
.th-filter-option.active {
    background: var(--info-bg);
    font-weight: 600;
}

/* Numeric range filter (min/max) */
.th-filter-numeric {
    position: relative;
    display: block;
    margin-top: 4px;
}
.th-filter-range {
    display: flex;
    gap: 3px;
}
.th-filter-min,
.th-filter-max {
    width: 50%;
    padding: 2px 4px;
    font-size: var(--font-size-xs);
    font-weight: normal;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    background: var(--surface-primary);
    color: var(--text-color);
    box-sizing: border-box;
    -moz-appearance: textfield;
}
.th-filter-min::-webkit-inner-spin-button,
.th-filter-max::-webkit-inner-spin-button,
.th-filter-min::-webkit-outer-spin-button,
.th-filter-max::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.th-filter-min:focus,
.th-filter-max:focus {
    border-color: var(--primary-color);
    outline: none;
}
.th-filter-numeric.has-value .th-filter-min,
.th-filter-numeric.has-value .th-filter-max {
    background: var(--info-bg);
    border-color: var(--secondary-color);
}
.th-filter-numeric .th-filter-clear {
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
}

/* Column sort indicator */
.th-sort {
    cursor: pointer;
    opacity: 0.5;
    font-size: 0.75em;
    margin-left: 4px;
    user-select: none;
    vertical-align: middle;
}
.th-sort:hover {
    opacity: 0.8;
}
.th-sort.sort-asc,
.th-sort.sort-desc {
    opacity: 1;
    color: var(--primary-color);
}

/* Action overflow menu (... button) */
.action-menu-btn {
    background: none;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    padding: 4px 8px;
    font-size: var(--font-size-lg);
    cursor: pointer;
    color: var(--text-color);
    letter-spacing: 2px;
    line-height: 1;
}
.action-menu-btn:hover {
    background: var(--light-gray);
}
.action-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 300;
    background: var(--surface-primary);
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    white-space: nowrap;
}
.action-menu.open {
    display: block;
}
.action-menu-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--text-color);
}
.action-menu-item:hover {
    background: var(--light-gray);
}
.action-menu-item:first-child {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.action-menu-item:last-child {
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Bank preview popover */
.bank-preview-popover {
    position: fixed;
    z-index: 1100;
    background: var(--surface-primary);
    border: 1px solid var(--medium-gray);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    max-width: 360px;
    min-width: 260px;
    font-size: var(--font-size-base);
    line-height: 1.5;
}
.bank-preview-popover .bp-title {
    font-weight: 700;
    font-size: var(--font-size-base);
    margin-bottom: 8px;
    color: var(--text-color);
}
.bank-preview-popover .bp-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-bottom: 8px;
    font-size: var(--font-size-sm);
    color: var(--dark-gray);
}
.bank-preview-popover .bp-desc {
    font-size: var(--font-size-sm);
    color: var(--text-color);
    margin-bottom: 8px;
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bank-preview-popover .bp-link {
    display: inline-block;
    font-size: var(--font-size-sm);
    color: var(--secondary-color);
    text-decoration: none;
    cursor: pointer;
}
.bank-preview-popover .bp-link:hover {
    text-decoration: underline;
}
.bank-name-link {
    color: var(--secondary-color);
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px dashed var(--secondary-color);
}
.bank-name-link:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* ==========================================================================
   DataTable Component (static/js/data-table.js)
   ========================================================================== */

.dt-root { overflow: hidden; }

/* Toolbar: search + pills + info */
.dt-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    flex-wrap: wrap;
}
.dt-search {
    padding: 6px 12px;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    background: var(--surface-primary);
    color: var(--text-color);
    font-size: var(--font-size-sm);
    width: 240px;
}
.dt-search:focus {
    border-color: var(--primary-color);
    outline: none;
}
.dt-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.dt-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: var(--radius-xl);
    font-size: var(--font-size-xs);
    background: var(--accent-color, var(--primary-color));
    color: #fff;
}
.dt-pill-x {
    cursor: pointer;
    font-weight: 700;
    opacity: 0.8;
    margin-left: 2px;
}
.dt-pill-x:hover { opacity: 1; }

/* Table wrapper */
.dt-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Sticky actions column — keeps last column visible during horizontal scroll */
.dt-table-wrap .data-table th:last-child,
.dt-table-wrap .data-table td:last-child {
    position: sticky;
    right: 0;
    background: var(--card-bg, var(--surface-primary));
    z-index: 1;
}
.dt-table-wrap .data-table th:last-child {
    background: var(--light-gray);
    z-index: 3;
}
/* Subtle shadow to indicate scrollable content behind sticky column */
.dt-table-wrap .data-table th:last-child::before,
.dt-table-wrap .data-table td:last-child::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    bottom: 0;
    width: 8px;
    background: linear-gradient(to right, transparent, rgba(0,0,0,0.04));
    pointer-events: none;
}
[data-theme="dark"] .dt-table-wrap .data-table th:last-child::before,
[data-theme="dark"] .dt-table-wrap .data-table td:last-child::before {
    background: linear-gradient(to right, transparent, rgba(0,0,0,0.15));
}
/* Ensure hover row background applies to sticky cell too */
.dt-table-wrap .data-table tbody tr:hover td:last-child {
    background: var(--table-row-hover);
}
.dt-table-wrap .data-table tbody tr.job-running td:last-child {
    background: var(--warning-bg);
}
.dt-table-wrap .data-table tbody tr.highlight td:last-child {
    background: var(--highlight-bg);
}

/* --- Dark mode component refinements --- */

/* Footer: bump text from tertiary to secondary for readability */
[data-theme="dark"] .ws-footer-inner {
    color: var(--text-secondary);
}
[data-theme="dark"] .ws-footer-inner a {
    color: var(--text-secondary);
}
[data-theme="dark"] .ws-footer-inner a:hover {
    color: var(--text-primary);
}

/* Wizard: inactive step circles need more contrast */
[data-theme="dark"] .step-number {
    background-color: var(--gray-4);
    color: var(--gray-10);
    border: 1px solid var(--gray-6);
}
[data-theme="dark"] .step.active .step-number {
    border-color: transparent;
    box-shadow: 0 0 0 4px rgba(90, 159, 212, 0.25);
}

/* Search/input borders: slightly more visible */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    border-color: var(--gray-6);
}

/* Header cells */
.dt-root .data-table th {
    padding: 0;
    background: var(--light-gray);
    border-bottom: 2px solid var(--medium-gray);
    white-space: nowrap;
    position: relative;
}
.dt-root .data-table th.dt-sticky {
    position: sticky;
    top: 0;
    z-index: 2;
}
.dt-th {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 6px;
}
.dt-th-label {
    flex: 1;
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.dt-th-sortable {
    cursor: pointer;
    user-select: none;
}
.dt-th-sortable:hover { color: var(--primary-color); }
.dt-th-sortable.dt-sorted { color: var(--primary-color); }

.dt-th-sort {
    font-size: 1em;
    opacity: 0.4;
    cursor: pointer;
    user-select: none;
}
.dt-th-sort:hover { opacity: 0.8; }
.dt-th-sort.dt-sort-active {
    opacity: 1;
    color: var(--primary-color);
}

/* Filter button in header */
.dt-th-filter-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--dark-gray);
    font-size: 1em;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    line-height: 1;
    opacity: 0.5;
}
.dt-th-filter-btn:hover {
    opacity: 1;
    border-color: var(--medium-gray);
}
.dt-th-filter-btn.dt-filter-active {
    opacity: 1;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Filter dropdown panel — uses position:fixed to escape overflow:auto wrappers */
.dt-filter-panel {
    display: none;
    position: fixed;
    min-width: 160px;
    z-index: 200;
    background: var(--surface-primary);
    border: 1px solid var(--medium-gray);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--shadow-lg);
}
.dt-filter-panel.open { display: block; }

.dt-filter-search {
    width: 100%;
    padding: 6px 8px;
    border: none;
    border-bottom: 1px solid var(--medium-gray);
    background: var(--surface-primary);
    color: var(--text-color);
    font-size: var(--font-size-xs);
    outline: none;
    box-sizing: border-box;
}
.dt-filter-options {
    max-height: 200px;
    overflow-y: auto;
}
.dt-filter-opt {
    padding: 5px 8px;
    cursor: pointer;
    font-size: var(--font-size-xs);
    font-weight: normal;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dt-filter-opt:hover { background: var(--light-gray); }
.dt-filter-opt.selected {
    color: var(--primary-color);
    font-weight: 600;
}

/* Range filter panel */
.dt-filter-range-panel { padding: 8px; }
.dt-filter-range-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
}
.dt-filter-range-sep {
    color: var(--dark-gray);
    font-size: var(--font-size-xs);
}
.dt-filter-min, .dt-filter-max {
    width: 70px;
    padding: 4px 6px;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    background: var(--surface-primary);
    color: var(--text-color);
    font-size: var(--font-size-xs);
    box-sizing: border-box;
}
.dt-filter-range-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}
.dt-filter-range-apply, .dt-filter-range-clear {
    padding: 3px 8px;
    font-size: var(--font-size-xs);
    border-radius: var(--border-radius);
    cursor: pointer;
    border: 1px solid var(--medium-gray);
    background: var(--surface-primary);
    color: var(--text-color);
}
.dt-filter-range-apply {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Row styles */
.dt-root .data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--light-gray);
}
.dt-root .data-table tbody tr.dt-row:hover td {
    background: var(--interactive-hover, var(--light-gray));
    box-shadow: inset 3px 0 0 var(--accent-color, var(--primary-color));
}
.dt-clickable { cursor: pointer; }

/* Empty state */
.dt-empty {
    text-align: center;
    padding: 2rem;
    color: var(--dark-gray);
    font-size: var(--font-size-base);
}
.dt-empty-row td {
    text-align: center;
    padding: 2rem !important;
    color: var(--dark-gray);
    font-style: italic;
}

/* DataTable Pagination */
.dt-pager:empty { display: none; }
.dt-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0;
    font-size: var(--font-size-sm);
    color: var(--dark-gray);
    flex-wrap: wrap;
}
.dt-page-info {
    white-space: nowrap;
}
.dt-page-buttons {
    display: flex;
    align-items: center;
    gap: 2px;
}
.dt-page-btn {
    background: var(--surface-primary);
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius, 6px);
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    min-width: 2rem;
    text-align: center;
    transition: var(--transition-fast, 0.15s ease);
}
.dt-page-btn:hover:not([disabled]):not(.dt-page-active) {
    background: var(--accent-bg-light, var(--light-gray));
    border-color: var(--accent-color, var(--primary-color));
}
.dt-page-btn.dt-page-active {
    background: var(--accent-color, var(--primary-color));
    color: var(--text-on-emphasis, #fff);
    border-color: var(--accent-color, var(--primary-color));
}
.dt-page-btn[disabled] {
    opacity: 0.4;
    cursor: default;
}
.dt-page-ellipsis {
    padding: 0.25rem 0.25rem;
    color: var(--dark-gray);
}
.dt-page-size {
    white-space: nowrap;
}
.dt-page-size-select {
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius, 6px);
    background: var(--surface-primary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* Tablet (768-1024px) */
@media (max-width: 1024px) {
    .workspace-content {
        padding: 1rem;
    }

    .dt-root .data-table {
        font-size: var(--font-size-sm);
    }

    .dt-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* Phone (max 768px) */
@media (max-width: 768px) {
    .workspace-content {
        padding: 0.75rem;
    }

    /* DataTable: horizontal scroll on small screens */
    .dt-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dt-root .data-table {
        font-size: var(--font-size-xs);
        min-width: 600px;
    }

    .dt-root .data-table th,
    .dt-root .data-table td {
        padding: 6px 8px;
    }

    .dt-search {
        width: 100%;
    }

    /* Action buttons: touch-friendly size */
    .btn-action {
        min-width: 36px;
        min-height: 36px;
        padding: 8px;
    }

    /* Primary/secondary buttons: full width on mobile */
    .primary-button,
    .secondary-button,
    .danger-button {
        min-height: 44px;
    }

    /* Cards stack */
    .card-grid {
        grid-template-columns: 1fr;
    }
}

/* Small phone (max 480px) */
@media (max-width: 480px) {
    .workspace-content {
        padding: 0.5rem;
    }

    .dt-root .data-table {
        min-width: 500px;
    }

    .btn-action {
        min-width: 44px;
        min-height: 44px;
    }

    .page-title {
        font-size: var(--font-size-xl);
    }

    .page-subtitle {
        font-size: var(--font-size-sm);
    }
}

/* Large desktop (min 1400px) */
@media (min-width: 1400px) {
    .workspace-content {
        max-width: 1400px;
        margin: 0 auto;
    }
}