/* =============================================================================
   Grader App Styles
   Cyera Brand Theme
   ============================================================================= */

:root {
  /* ==========================================================================
     Cyera Brand Palette
     ========================================================================== */

  /* Core - Primary Brand */
  --cyera-black: #160923;
  --cyera-deep-purple: #441363;
  --cyera-aubergine: #6D2D93;
  --cyera-lilac: #D28EFF;
  --cyera-haze: #E8C6FF;
  --cyera-whisper: #F6E8FF;

  /* Accent - Use Sparingly */
  --cyera-pistachio: #7BF583;
  --cyera-lime: #BFFFA2;

  /* Neutral */
  --cyera-ash: #56544E;
  --cyera-stone: #787771;
  --cyera-clay: #D4D2C8;
  --cyera-natural: #EEEDE7;
  --cyera-shell: #F6F5F1;
  --cyera-offwhite: #FBFBFB;

  /* ==========================================================================
     Semantic Color Mappings
     ========================================================================== */

  /* Primary / Brand */
  --color-primary: var(--cyera-aubergine);
  --color-primary-dark: var(--cyera-deep-purple);
  --color-primary-light: var(--cyera-lilac);
  --color-primary-subtle: var(--cyera-haze);
  --color-brand-black: var(--cyera-black);

  /* Background */
  --color-background: var(--cyera-offwhite);
  --color-background-alt: var(--cyera-natural);

  /* Surface (cards, panels) */
  --color-surface: var(--cyera-shell);
  --color-surface-elevated: #FFFFFF;
  --color-surface-muted: var(--cyera-whisper);

  /* Text */
  --color-text-primary: var(--cyera-black);
  --color-text-secondary: var(--cyera-ash);
  --color-text-muted: var(--cyera-stone);
  --color-text-inverse: var(--cyera-offwhite);

  /* Borders */
  --color-border: var(--cyera-clay);
  --color-border-light: var(--cyera-natural);
  --color-border-focus: var(--cyera-lilac);

  /* Accent / Status - use sparingly, badges only */
  --color-accent: var(--cyera-pistachio);
  --color-accent-light: var(--cyera-lime);
  --color-success: #16a34a;
  --color-success-light: #f0fdf4;
  --color-success-badge: #dcfce7;
  --color-warning: #d97706;
  --color-warning-light: #fffbeb;
  --color-warning-badge: #fef3c7;
  --color-error: #dc2626;
  --color-error-light: #fef7f7;
  --color-error-badge: #fee2e2;

  /* Legacy mappings for compatibility */
  --color-gray-50: var(--cyera-offwhite);
  --color-gray-100: var(--cyera-shell);
  --color-gray-200: var(--cyera-natural);
  --color-gray-300: var(--cyera-clay);
  --color-gray-500: var(--cyera-stone);
  --color-gray-700: var(--cyera-ash);
  --color-gray-900: var(--cyera-black);
}

/* =============================================================================
   Dark Theme
   ============================================================================= */

[data-theme="dark"] {
  /* Background - restrained dark grays with subtle warmth */
  --color-background: #1a1a1d;
  --color-background-alt: #222226;

  /* Surface (cards, panels) - slightly elevated from background */
  --color-surface: #28282d;
  --color-surface-elevated: #2e2e34;
  --color-surface-muted: #353540;

  /* Text - high contrast but not pure white */
  --color-text-primary: #f0f0f2;
  --color-text-secondary: #b8b8bd;
  --color-text-muted: #8a8a92;
  --color-text-inverse: #1a1a1d;

  /* Borders - subtle definition */
  --color-border: #404048;
  --color-border-light: #353540;
  --color-border-focus: var(--cyera-lilac);

  /* Primary - keep brand purple but adjust for dark context */
  --color-primary: #a855f7;
  --color-primary-dark: #9333ea;
  --color-primary-light: #c084fc;
  --color-primary-subtle: rgba(168, 85, 247, 0.15);

  /* Status colors - adjust for dark backgrounds */
  --color-success: #4ade80;
  --color-success-light: rgba(74, 222, 128, 0.1);
  --color-success-badge: rgba(74, 222, 128, 0.2);
  --color-warning: #fbbf24;
  --color-warning-light: rgba(251, 191, 36, 0.1);
  --color-warning-badge: rgba(251, 191, 36, 0.2);
  --color-error: #f87171;
  --color-error-light: rgba(248, 113, 113, 0.1);
  --color-error-badge: rgba(248, 113, 113, 0.2);

  /* Legacy gray mappings for dark */
  --color-gray-50: #2e2e34;
  --color-gray-100: #353540;
  --color-gray-200: #404048;
  --color-gray-300: #4a4a54;
  --color-gray-500: #8a8a92;
  --color-gray-700: #b8b8bd;
  --color-gray-900: #f0f0f2;
}

/* Dark theme specific overrides */
[data-theme="dark"] .topbar {
  background: linear-gradient(to right, #252530, var(--color-surface-elevated));
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .sidebar {
  background: var(--color-surface-elevated);
  border-right-color: var(--color-border);
}

[data-theme="dark"] .sidebar-item.active {
  background: var(--color-primary-subtle);
  color: var(--color-primary-light);
}

[data-theme="dark"] .sidebar-item.active::before {
  background: var(--color-primary);
}

[data-theme="dark"] .env-local {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

[data-theme="dark"] .env-dev {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
}

[data-theme="dark"] .env-staging {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.3);
}

[data-theme="dark"] .data-table {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .data-table tr:hover td {
  background: var(--color-surface);
}

[data-theme="dark"] .status-card,
[data-theme="dark"] .report-header,
[data-theme="dark"] .setting-item,
[data-theme="dark"] .report-section,
[data-theme="dark"] .stat-card {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder {
  color: var(--color-text-muted);
}

[data-theme="dark"] .mode-option {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme="dark"] .mode-option:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
}

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

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

[data-theme="dark"] .sidebar-item[data-tooltip]:hover::after {
  background: var(--color-surface-elevated);
  color: var(--color-text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

[data-theme="dark"] .locale-selector select {
  background-color: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%238a8a92' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
}

/* Page-specific dark mode overrides for inline styles */
[data-theme="dark"] .card,
[data-theme="dark"] .content-box,
[data-theme="dark"] .meta-section,
[data-theme="dark"] .asset-meta,
[data-theme="dark"] .content-section,
[data-theme="dark"] .create-form-section .card {
  background: var(--color-surface-elevated);
  border-color: var(--color-border);
}

[data-theme="dark"] .card-header,
[data-theme="dark"] .section-header {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme="dark"] .markdown-body {
  color: var(--color-text-primary);
}

[data-theme="dark"] .markdown-body h2 {
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .markdown-body code {
  background: var(--color-surface);
}

[data-theme="dark"] .markdown-body pre {
  background: var(--color-surface);
}

[data-theme="dark"] .markdown-body blockquote {
  border-left-color: var(--color-border);
  color: var(--color-text-muted);
}

[data-theme="dark"] .markdown-body th,
[data-theme="dark"] .markdown-body td {
  border-color: var(--color-border);
}

[data-theme="dark"] .markdown-body th {
  background: var(--color-surface);
}

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

[data-theme="dark"] .view-toggle {
  background: var(--color-surface);
}

[data-theme="dark"] .view-toggle-btn {
  color: var(--color-text-muted);
}

[data-theme="dark"] .view-toggle-btn:hover {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .view-toggle-btn.active {
  background: var(--color-surface-elevated);
  color: var(--color-text-primary);
}

[data-theme="dark"] .editor-tabs {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme="dark"] .editor-tab {
  color: var(--color-text-muted);
}

[data-theme="dark"] .editor-tab.active {
  background: var(--color-surface-elevated);
  color: var(--color-text-primary);
  border-bottom-color: var(--color-primary);
}

[data-theme="dark"] .editor-container {
  border-color: var(--color-border);
}

[data-theme="dark"] .editor-preview {
  background: var(--color-surface-elevated);
}

/* Filter bar dark mode */
[data-theme="dark"] .filter-bar {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme="dark"] .filter-bar input,
[data-theme="dark"] .filter-bar select {
  background: var(--color-surface-elevated);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

/* Badges in dark mode - preserve visibility */
[data-theme="dark"] .type-badge.ci {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

[data-theme="dark"] .type-badge.methodology {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

[data-theme="dark"] .type-badge.reference {
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

[data-theme="dark"] .status-badge.active {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

[data-theme="dark"] .status-badge.inactive {
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

[data-theme="dark"] .status-badge.archived {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

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

/* Mode badges (fast/thinking) */
[data-theme="dark"] .mode-badge.fast {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

[data-theme="dark"] .mode-badge.thinking {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
}

/* Grade badges */
[data-theme="dark"] .grade-badge.pass {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

[data-theme="dark"] .grade-badge.fail {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

/* Analytics page dark mode */
[data-theme="dark"] .analytics-section {
  background: var(--color-surface-elevated);
  border-color: var(--color-border);
}

[data-theme="dark"] .stat-card.highlight {
  background: var(--color-primary-subtle);
  border-color: var(--color-primary);
}

[data-theme="dark"] .stat-card.highlight .stat-value {
  color: var(--color-primary-light);
}

[data-theme="dark"] .analytics-table th {
  background: var(--color-surface);
  color: var(--color-text-muted);
}

[data-theme="dark"] .analytics-table td {
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .category-badge {
  background: var(--color-surface-muted);
}

[data-theme="dark"] .failure-item {
  background: var(--color-surface);
}

[data-theme="dark"] .failure-count {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

[data-theme="dark"] .score-badge.poor {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

/* Submissions table dark mode */
[data-theme="dark"] .score-compact.passed {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

[data-theme="dark"] .score-compact.failed {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

[data-theme="dark"] .issue-chip {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

[data-theme="dark"] .level-badge.level-strict {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

[data-theme="dark"] .level-badge.level-guided {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

[data-theme="dark"] .level-badge.level-suggestive {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

/* Failure summary dark mode */
[data-theme="dark"] .failure-summary {
  background: var(--color-surface-elevated);
  border-color: var(--color-border);
}

[data-theme="dark"] .failure-stat {
  background: rgba(248, 113, 113, 0.1);
}

/* Operations / Queue status dark mode */
[data-theme="dark"] .queue-stat {
  background: var(--color-surface-elevated);
}

[data-theme="dark"] .queue-stat.alert {
  background: rgba(248, 113, 113, 0.1);
  border-color: var(--color-error);
}

/* Empty states */
[data-theme="dark"] .empty-state,
[data-theme="dark"] .no-data {
  color: var(--color-text-muted);
}

/* Warning section dark mode */
[data-theme="dark"] .warning-section {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.4);
}

[data-theme="dark"] .warning-section h2 {
  color: #fbbf24;
}

[data-theme="dark"] .warning-item {
  background: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .warning-hint {
  color: var(--color-text-muted);
}

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

/* Stage badges dark mode */
[data-theme="dark"] .stage-badge {
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .stage-badge.stage-upload {
  background: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
}

[data-theme="dark"] .stage-badge.stage-parse {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

[data-theme="dark"] .stage-badge.stage-deterministic_grading {
  background: rgba(129, 140, 248, 0.2);
  color: #818cf8;
}

[data-theme="dark"] .stage-badge.stage-ai_grading {
  background: var(--color-primary-subtle);
  color: var(--color-primary-light);
}

[data-theme="dark"] .stage-badge.stage-report_generation {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

/* Count badge dark mode */
[data-theme="dark"] .count-badge {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

/* Operations table dark mode */
[data-theme="dark"] .operations-table .time-cell .date {
  color: var(--color-text-muted);
}

[data-theme="dark"] .operations-table .error-message {
  color: var(--color-text-secondary);
}

/* Status badges in tables (completed, pending, etc.) */
[data-theme="dark"] .status-pending {
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .status-processing,
[data-theme="dark"] .status-parsing,
[data-theme="dark"] .status-grading {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

[data-theme="dark"] .status-parsed {
  background: var(--color-primary-subtle);
  color: var(--color-primary-light);
}

[data-theme="dark"] .status-completed {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

[data-theme="dark"] .status-failed {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

/* Pagination dark mode */
[data-theme="dark"] .pagination a {
  color: var(--color-primary-light);
}

[data-theme="dark"] .pagination span {
  color: var(--color-text-muted);
}

/* Report page dark mode */
[data-theme="dark"] .report-section {
  background: var(--color-surface-elevated);
  border-color: var(--color-border);
}

[data-theme="dark"] .report-header {
  background: var(--color-surface-elevated);
  border-color: var(--color-border);
}

[data-theme="dark"] .score-summary {
  background: var(--color-surface-elevated);
  border-color: var(--color-border);
}

[data-theme="dark"] .score-summary.passed {
  border-color: #4ade80;
}

[data-theme="dark"] .score-summary.passed .grade {
  color: #4ade80;
}

[data-theme="dark"] .score-summary.passed .status {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

[data-theme="dark"] .score-summary.failed {
  border-color: #f87171;
}

[data-theme="dark"] .score-summary.failed .grade {
  color: #f87171;
}

[data-theme="dark"] .score-summary.failed .status {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

[data-theme="dark"] .criteria-table th {
  background: var(--color-surface);
  color: var(--color-text-muted);
}

[data-theme="dark"] .criteria-table td {
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .criteria-table .reason {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .check-status.pass {
  color: #4ade80;
}

[data-theme="dark"] .check-status.fail {
  color: #f87171;
}

[data-theme="dark"] .issue-item {
  color: var(--color-text-primary);
}

[data-theme="dark"] .issue-item::before {
  color: #f87171;
}

[data-theme="dark"] .criteria-category h3 {
  color: var(--color-text-secondary);
}

/* AI insights / insight blocks dark mode */
[data-theme="dark"] .insight-block {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme="dark"] .insight-block.strengths {
  border-left-color: #4ade80;
}

[data-theme="dark"] .insight-block.weaknesses {
  border-left-color: #fb923c;
}

[data-theme="dark"] .insight-block.risks {
  border-left-color: #f87171;
}

[data-theme="dark"] .insight-block h3 {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .insight-block ul {
  color: var(--color-text-secondary);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--color-text-primary);
  background: var(--color-background);
}

/* =============================================================================
   Layout - Sidebar Navigation
   ============================================================================= */

/* Layout Variables */
:root {
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 64px;
  --topbar-height: 56px;
}

/* Disable transitions on initial page load to prevent flash */
.no-sidebar-transition .sidebar,
.no-sidebar-transition .main-wrapper,
.no-sidebar-transition .sidebar-section-title,
.no-sidebar-transition .sidebar-label {
  transition: none !important;
}

/* Top Bar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: linear-gradient(to right, var(--cyera-whisper), var(--color-surface-elevated));
  border-bottom: 2px solid var(--cyera-haze);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 1000;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar .logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.topbar .logo-image {
  height: 28px;
  width: auto;
}

.topbar .logo-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  border-left: 1px solid var(--color-border);
  padding-left: 0.75rem;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: background 0.15s, color 0.15s;
}

.sidebar-toggle:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-surface-elevated);
  border-right: 1px solid var(--color-border-light);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 900;
  transition: width 0.2s ease, transform 0.2s ease;
}

.sidebar-nav {
  padding: 1rem 0;
}

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

.sidebar-section-title {
  padding: 0.5rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  position: relative;
}

.sidebar-item:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.sidebar-item.active {
  background: var(--cyera-whisper);
  color: var(--cyera-deep-purple);
  font-weight: 600;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--cyera-aubergine);
}

.sidebar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

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

.sidebar-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 850;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

/* Main Content Wrapper */
.main-wrapper {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
  transition: margin-left 0.2s ease;
  display: flex;
  flex-direction: column;
}

.main-wrapper main {
  flex: 1;
  padding: 2rem;
}

.main-wrapper footer {
  text-align: center;
  padding: 1rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* Collapsed State (Desktop) */
.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
  overflow: visible; /* Allow tooltips to overflow */
}

.sidebar-collapsed .sidebar-section-title {
  opacity: 0;
  height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.sidebar-collapsed .sidebar-label {
  opacity: 0;
  width: 0;
}

.sidebar-collapsed .sidebar-item {
  justify-content: center;
  padding: 0.75rem;
}

.sidebar-collapsed .main-wrapper {
  margin-left: var(--sidebar-collapsed-width);
}

/* Tooltips for Collapsed State */
.sidebar-collapsed .sidebar-item[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  padding: 0.5rem 0.75rem;
  background: var(--color-text-primary);
  color: var(--color-surface-elevated);
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 0.375rem;
  white-space: nowrap;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Locale Selector */
.locale-selector select {
  padding: 0.4rem 1.8rem 0.4rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 0.25rem;
  font-size: 0.8rem;
  background: var(--color-surface-elevated);
  color: var(--color-text-secondary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23787771' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.locale-selector select:hover {
  border-color: var(--color-primary-light);
}

.locale-selector select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 2px var(--color-primary-subtle);
}

/* Profile Menu */
.profile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
}

.profile-menu-btn:hover {
  background: var(--color-surface-elevated);
  border-color: var(--color-primary-light);
  color: var(--color-text-primary);
}

.profile-menu-btn[aria-expanded="true"] {
  background: var(--color-primary-subtle);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

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

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
  z-index: 1100;
  padding: 0.5rem 0;
}

[data-theme="dark"] .profile-menu {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.profile-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.topbar-right {
  position: relative;
}

.profile-menu-section {
  padding: 0.5rem 0.75rem;
}

.profile-menu-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.profile-menu-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: 0.25rem 0;
}

/* Theme Options */
.theme-options {
  display: flex;
  gap: 0.25rem;
}

.theme-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.25rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.375rem;
  color: var(--color-text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-option:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.theme-option.active {
  background: var(--color-primary-subtle);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

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

/* Language Select in Menu */
.profile-menu-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  font-size: 0.85rem;
  background: var(--color-surface);
  color: var(--color-text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23787771' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

[data-theme="dark"] .profile-menu-select {
  background-color: var(--color-surface);
  border-color: var(--color-border);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%238a8a92' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
}

.profile-menu-select:hover {
  border-color: var(--color-primary-light);
}

.profile-menu-select:focus {
  outline: none;
  border-color: var(--color-border-focus);
}

/* Menu Item (login/logout link) */
.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.profile-menu-item:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.profile-menu-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Legacy Admin Status - keep for backwards compat but hide */
.admin-status {
  display: none;
}

.env-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.env-local {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.env-dev {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #3b82f6;
}

.env-staging {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #a855f7;
}

.login-link,
.logout-link {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-decoration: none;
}

.login-link:hover,
.logout-link:hover {
  color: var(--color-primary);
}

/* Content Containers */
.container {
  max-width: 800px;
  margin: 0 auto;
}

.container-lg {
  max-width: 1200px;
  margin: 0 auto;
}

/* =============================================================================
   Responsive - Tablet/Mobile Sidebar
   ============================================================================= */

/* Tablet - Collapsed by default */
@media (max-width: 1023px) {
  .sidebar {
    width: var(--sidebar-collapsed-width);
    overflow: visible; /* Allow tooltips to overflow */
  }

  .sidebar-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
  }

  .sidebar-label {
    opacity: 0;
    width: 0;
  }

  .sidebar-item {
    justify-content: center;
    padding: 0.75rem;
  }

  .main-wrapper {
    margin-left: var(--sidebar-collapsed-width);
  }

  /* Tooltips always on at tablet */
  .sidebar-item[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 8px;
    padding: 0.5rem 0.75rem;
    background: var(--color-text-primary);
    color: var(--color-surface-elevated);
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 0.375rem;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }
}

/* Mobile - Overlay drawer */
@media (max-width: 899px) {
  .sidebar {
    width: 280px;
    transform: translateX(-100%);
  }

  .sidebar-section-title {
    opacity: 1;
    height: auto;
    padding: 0.5rem 1rem;
  }

  .sidebar-label {
    opacity: 1;
    width: auto;
  }

  .sidebar-item {
    justify-content: flex-start;
    padding: 0.625rem 1rem;
  }

  /* No tooltips on mobile - full labels visible */
  .sidebar-item[data-tooltip]:hover::after {
    display: none;
  }

  .main-wrapper {
    margin-left: 0;
  }

  /* Open state */
  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
  }

  .topbar .logo-text {
    display: none;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .topbar {
    padding: 0 0.75rem;
  }

  .topbar-right {
    gap: 0.5rem;
  }

  .main-wrapper main {
    padding: 1rem;
  }

  /* Profile menu adjustments for small screens */
  .profile-menu {
    right: -0.5rem;
    width: 200px;
  }

  .profile-menu-btn {
    width: 32px;
    height: 32px;
  }

  .profile-menu-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* Typography */
h1 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--color-text-primary);
}

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

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

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  font-size: 1rem;
  background: var(--color-surface-elevated);
  color: var(--color-text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.form-group small {
  display: block;
  margin-top: 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* Mode Selector (Fast/Thinking toggle) */
.mode-selector {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: 0.375rem;
  background: var(--color-surface-elevated);
  transition: all 0.15s ease;
}

.mode-option:hover {
  border-color: var(--color-primary-light);
}

.mode-option:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
}

.mode-option input[type="radio"] {
  width: auto;
  margin: 0;
}

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

/* Mode Option Tooltips - Custom fast tooltips */
.mode-option {
  position: relative;
}

.mode-option[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.625rem 0.875rem;
  background: var(--color-text-primary);
  color: var(--color-surface-elevated);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  border-radius: 0.375rem;
  white-space: normal;
  width: max-content;
  max-width: 280px;
  text-align: center;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
}

/* Arrow pointing down */
.mode-option[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--color-text-primary);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
}

/* Show on hover - fast 150ms delay */
.mode-option[data-tooltip]:hover::after,
.mode-option[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
  transition-delay: 0.15s;
}

/* Show on focus-within (keyboard navigation) */
.mode-option[data-tooltip]:focus-within::after,
.mode-option[data-tooltip]:focus-within::before {
  opacity: 1;
  visibility: visible;
  transition-delay: 0.15s;
}

/* Help icon styling */
.mode-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.125rem;
  height: 1.125rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border-radius: 50%;
  margin-left: 0.25rem;
  flex-shrink: 0;
}

.mode-option:hover .mode-help,
.mode-option:focus-within .mode-help {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}

/* Dark mode tooltip adjustments */
[data-theme="dark"] .mode-option[data-tooltip]::after {
  background: var(--color-surface-elevated);
  color: var(--color-text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

[data-theme="dark"] .mode-option[data-tooltip]::before {
  border-top-color: var(--color-surface-elevated);
}

/* Source Selector (Upload/Google Link tabs) */
.source-selector {
  margin-bottom: 1rem;
}

.source-tabs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.source-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: 2px solid var(--color-border);
  border-radius: 0.375rem;
  background: var(--color-surface-elevated);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
}

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

.source-tab.active {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
  color: var(--color-primary-dark);
}

.source-icon {
  font-size: 1.1rem;
}

.form-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* URL Validation States */
.url-status {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.url-status:empty {
  display: none;
}

.url-checking {
  color: var(--color-text-muted);
}

.url-valid {
  color: #059669;
  background: #ecfdf5;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
}

.url-valid .artifact-type {
  font-weight: 600;
  color: #047857;
}

.url-invalid {
  color: #dc2626;
  background: #fef2f2;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
}

/* Dark mode for source selector */
[data-theme="dark"] .source-tab {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .source-tab:hover {
  border-color: var(--color-primary-light);
  color: var(--color-text-primary);
}

[data-theme="dark"] .source-tab.active {
  border-color: var(--color-primary);
  background: rgba(109, 45, 147, 0.2);
  color: var(--color-primary-light);
}

[data-theme="dark"] .url-valid {
  background: rgba(5, 150, 105, 0.15);
  color: #34d399;
}

[data-theme="dark"] .url-valid .artifact-type {
  color: #6ee7b7;
}

[data-theme="dark"] .url-invalid {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.15s ease;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

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

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

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn.loading {
  opacity: 0.7;
  cursor: wait;
  position: relative;
}

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

/* Cards */
.status-card,
.report-header,
.setting-item {
  background: var(--color-surface-elevated);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(22, 9, 35, 0.08);
  border: 1px solid var(--color-border-light);
}

/* Status Page */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.timing-hint {
  color: var(--color-text-tertiary);
  font-size: 0.875rem;
  margin-top: 1.5rem;
  text-align: center;
}

/* Report Page */
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.file-info {
  color: var(--color-text-secondary);
}

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

.score-summary {
  text-align: center;
  padding: 1rem 2rem;
  border-radius: 0.5rem;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-light);
}

.score-summary.passed {
  border-color: var(--color-success);
}

.score-summary.passed .grade {
  color: var(--color-success);
}

.score-summary.failed {
  border-color: var(--color-error);
}

.score-summary.failed .grade {
  color: var(--color-error);
}

.score-summary .grade {
  font-size: 3rem;
  font-weight: bold;
  line-height: 1;
}

.score-summary .score {
  font-size: 1.5rem;
  margin: 0.5rem 0;
  color: var(--color-text-primary);
}

.score-summary .status {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  display: inline-block;
}

.score-summary.passed .status {
  background: var(--color-success-badge);
  color: var(--color-success);
}

.score-summary.failed .status {
  background: var(--color-error-badge);
  color: var(--color-error);
}

.report-section {
  background: var(--color-surface-elevated);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(22, 9, 35, 0.08);
  border: 1px solid var(--color-border-light);
}

.score-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.score-item {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--color-surface);
  border-radius: 0.25rem;
}

.score-item .label {
  color: var(--color-text-secondary);
}

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

.score-item .value.ai-unavailable {
  color: var(--color-text-muted);
  font-weight: 400;
}

/* AI Failure Details (admin only) */
.ai-failure-details {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--color-error-light);
  border: 1px solid var(--color-error-badge);
  border-radius: 0.25rem;
  font-size: 0.85rem;
}

.ai-failure-details strong {
  color: var(--color-error);
}

.ai-failure-details .ai-error-message {
  display: block;
  margin-top: 0.25rem;
  color: var(--color-text-secondary);
  font-family: monospace;
  font-size: 0.8rem;
  word-break: break-word;
}

.ai-failure-details .ai-timing {
  display: block;
  margin-top: 0.25rem;
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

/* Admin */
.admin-nav {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.admin-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.admin-nav a:hover,
.admin-nav a.active {
  color: var(--color-primary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--color-surface-elevated);
  padding: 1.5rem;
  border-radius: 0.5rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(22, 9, 35, 0.08);
  border: 1px solid var(--color-border-light);
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--color-primary);
}

.stat-label {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface-elevated);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(22, 9, 35, 0.08);
  border: 1px solid var(--color-border-light);
}

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

.data-table th {
  background: var(--color-surface);
  font-weight: 600;
  color: var(--color-text-secondary);
}

.data-table td {
  color: var(--color-text-primary);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--color-surface);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-pending { background: var(--color-surface); color: var(--color-text-secondary); }
.status-processing, .status-parsing, .status-grading { background: var(--color-warning-badge); color: var(--color-warning); }
.status-parsed { background: var(--cyera-haze); color: var(--color-primary); }
.status-completed { background: var(--color-success-badge); color: var(--color-success); }
.status-failed { background: var(--color-error-badge); color: var(--color-error); }

/* Table actions */
.actions-cell a {
  margin-right: 0.75rem;
  color: var(--color-primary);
  text-decoration: none;
}

.actions-cell a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

.actions-cell a:last-child {
  margin-right: 0;
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  background: var(--color-surface-elevated);
}

.alert-error {
  color: var(--color-error);
  border-left: 4px solid var(--color-error);
}

.alert-success {
  color: var(--color-success);
  border-left: 4px solid var(--color-success);
}

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

/* Settings */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.setting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.setting-description {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

/* Login */
.login-form {
  max-width: 400px;
  margin: 4rem auto;
  background: var(--color-surface-elevated);
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(22, 9, 35, 0.08);
  border: 1px solid var(--color-border-light);
}

.login-form h1 {
  text-align: center;
  color: var(--color-primary);
}

/* Error Page */
.error-page {
  text-align: center;
  padding: 4rem 2rem;
}

.error-page h1 {
  color: var(--color-error);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.pagination a {
  color: var(--color-primary);
  text-decoration: none;
}

.pagination a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

.pagination span {
  color: var(--color-text-muted);
}

/* Actions */
.actions {
  margin-top: 2rem;
}

/* =============================================================================
   Report Page - Detailed Styles
   ============================================================================= */

/* Issues Section */
.issues-section {
  background: var(--color-surface-elevated);
  border-left: 4px solid var(--color-error);
}

.issues-section h2 {
  color: var(--color-error);
}

.issues-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.issue-item {
  padding: 0.5rem 0;
  color: var(--color-text-primary);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.issue-item::before {
  content: "⚠";
  color: var(--color-error);
  flex-shrink: 0;
}

/* Criteria Tables */
.criteria-category {
  margin-bottom: 1.5rem;
}

.criteria-category h3 {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border-light);
}

.criteria-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

.criteria-table th {
  background: var(--color-surface);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.criteria-table tr.passed {
  background: var(--color-surface-elevated);
}

.criteria-table tr.failed {
  background: var(--color-surface-elevated);
}

.status-col {
  width: 60px;
  text-align: center;
}

.points-col {
  width: 80px;
  text-align: right;
}

.check-status {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  font-weight: bold;
}

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

.check-status.fail {
  background: var(--color-error-badge);
  color: var(--color-error);
}

.reason {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* AI Section Styles */
.ai-section {
  background: var(--color-surface-elevated);
  border-left: 4px solid var(--color-primary);
}

.ai-section h2 {
  color: var(--color-primary);
}

.ai-dimensions h3,
.ai-insights h3 {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
}

.dimension-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dimension-card {
  background: var(--color-surface-elevated);
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(22, 9, 35, 0.05);
  border: 1px solid var(--color-border-light);
}

.dimension-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.dimension-name {
  font-weight: 600;
  color: var(--color-text-primary);
}

.dimension-score {
  font-weight: bold;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.dimension-score.good {
  background: var(--color-success-badge);
  color: var(--color-success);
}

.dimension-score.moderate {
  background: var(--color-warning-badge);
  color: var(--color-warning);
}

.dimension-score.poor {
  background: var(--color-error-badge);
  color: var(--color-error);
}

.dimension-reasoning {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.4;
}

.ai-insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.insight-block {
  background: var(--color-surface-elevated);
  border-radius: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--color-border-light);
}

.insight-block h3 {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.insight-block ul {
  margin: 0;
  padding-left: 1.25rem;
}

.insight-block li {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.insight-block.strengths {
  border-left: 3px solid var(--color-success);
}

.insight-block.strengths h3 {
  color: var(--color-success);
}

.insight-block.weaknesses {
  border-left: 3px solid var(--color-warning);
}

.insight-block.weaknesses h3 {
  color: var(--color-warning);
}

.insight-block.risks {
  border-left: 3px solid var(--color-error);
}

.insight-block.risks h3 {
  color: var(--color-error);
}

/* =============================================================================
   Admin Parsed Page
   ============================================================================= */

.submission-info {
  background: var(--color-surface-elevated);
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(22, 9, 35, 0.08);
  border: 1px solid var(--color-border-light);
}

.submission-info p {
  margin: 0.5rem 0;
  color: var(--color-text-secondary);
}

.parsed-summary {
  background: var(--color-surface-elevated);
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(22, 9, 35, 0.08);
  border: 1px solid var(--color-border-light);
}

.parsed-summary h3 {
  margin-top: 1rem;
  font-size: 1rem;
}

.slide-card {
  background: var(--color-surface-elevated);
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(22, 9, 35, 0.08);
  border: 1px solid var(--color-border-light);
}

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

.slide-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--color-text-primary);
}

.slide-content,
.slide-notes {
  margin-top: 1rem;
}

.slide-content h4,
.slide-notes h4 {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.slide-notes {
  background: var(--color-warning-light);
  padding: 1rem;
  border-radius: 0.25rem;
  border-left: 3px solid var(--color-warning);
}

.text-content {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--color-surface);
  padding: 1rem;
  border-radius: 0.25rem;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
  color: var(--color-text-primary);
}

.no-content {
  color: var(--color-text-muted);
}

.badge {
  background: var(--cyera-haze);
  color: var(--color-primary);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

/* =============================================================================
   My Submissions Page
   ============================================================================= */

.my-submissions-header {
  margin-bottom: 1.5rem;
}

.my-submissions-header h1 {
  margin-bottom: 0.5rem;
}

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

.submissions-summary {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--color-surface-elevated);
  border-radius: 0.5rem;
  border: 1px solid var(--color-border-light);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state h2 {
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

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

.submission-card {
  background: var(--color-surface-elevated);
  border-radius: 0.5rem;
  padding: 1.25rem;
  border: 1px solid var(--color-border-light);
  box-shadow: 0 1px 3px rgba(22, 9, 35, 0.08);
}

.submission-card-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.submission-file {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.file-icon {
  font-size: 1.5rem;
}

.file-details {
  display: flex;
  flex-direction: column;
}

.filename {
  font-weight: 600;
  color: var(--color-text-primary);
}

.submitted-date {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.submission-status-score {
  text-align: right;
}

.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
}

.score-display.passed {
  background: var(--color-success-light);
}

.score-display.failed {
  background: var(--color-error-light);
}

.score-display .score-value {
  font-size: 1.5rem;
  font-weight: bold;
}

.score-display.passed .score-value {
  color: var(--color-success);
}

.score-display.failed .score-value {
  color: var(--color-error);
}

.score-display .grade-label {
  font-size: 0.75rem;
  font-weight: 600;
}

.submission-card-actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border-light);
  display: flex;
  justify-content: flex-end;
}


.setting-value {
  color: var(--color-text-secondary);
  font-style: italic;
}

/* =============================================================================
   Enhanced Admin Submissions Table
   ============================================================================= */

/* Page-specific styles (width controlled by container class) */
.submissions-dashboard {
  /* max-width now controlled by .container-lg */
}

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

.submissions-table {
  font-size: 0.85rem;
}

.submissions-table th,
.submissions-table td {
  padding: 0.5rem 0.75rem;
  vertical-align: middle;
  /* With table-layout:fixed, cells must handle overflow */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Visual feedback during resize */
.submissions-table th.resizing {
  background: var(--color-primary-subtle) !important;
}

/* Filename cell - JS controls width, CSS handles truncation */
.filename-cell {
  /* Width controlled by JS - no CSS width constraints */
}

.filename-cell .filename-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owner-cell .owner-badge {
  display: block;
  background: var(--color-surface);
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* No max-width - inherits column width */
}

.owner-cell .owner-badge.unknown {
  color: var(--color-text-muted);
  font-style: italic;
}

.score-cell .score-compact {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.8rem;
}

.score-compact.passed {
  background: var(--color-success-badge);
  color: var(--color-success);
}

.score-compact.failed {
  background: var(--color-error-badge);
  color: var(--color-error);
}

.score-compact .grade {
  font-size: 0.7rem;
  opacity: 0.8;
}

.scores-detail .score-split {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.scores-detail .ai-status-indicator {
  font-size: 0.7rem;
  font-weight: 600;
  cursor: help;
}

.scores-detail .ai-status-indicator.ai-failed {
  color: var(--color-error);
  text-decoration: underline dotted;
}

.scores-detail .ai-status-indicator.ai-skipped {
  color: var(--color-text-muted);
}

.slides-cell {
  text-align: center;
}

.level-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
}

.level-badge.level-strict {
  background: var(--color-error-badge);
  color: var(--color-error);
}

.level-badge.level-guided {
  background: var(--color-warning-badge);
  color: var(--color-warning);
}

.level-badge.level-suggestive {
  background: var(--color-success-badge);
  color: var(--color-success);
}

/* Issues cell - JS controls width, CSS handles truncation */
.issues-cell {
  /* Width controlled by JS - no CSS width constraints */
}

.issues-preview {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.issue-chip {
  display: block;
  background: var(--color-error-light);
  color: var(--color-error);
  padding: 0.15rem 0.4rem;
  border-radius: 0.2rem;
  font-size: 0.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* No max-width - inherits column width */
}

.no-issues {
  color: var(--color-success);
  font-size: 0.8rem;
}

.date-cell {
  white-space: nowrap;
}

.date-cell .time-detail {
  display: block;
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

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

/* =============================================================================
   Frozen Columns (Sticky Left/Right)
   ============================================================================= */

/*
 * Frozen Columns Sizing Model:
 *
 * 1. table-layout: fixed — JS controls exact column widths
 * 2. Each column (including frozen) has independent explicit width stored in localStorage
 * 3. Table width = sum of all column widths (no auto-distribution)
 * 4. Scroll container has overflow-x: auto
 * 5. Frozen columns use position: sticky to stay in place during scroll
 * 6. Content that exceeds column width truncates (text-overflow: ellipsis)
 */

/* Scroll container */
.table-frozen-cols {
  overflow-x: auto;
  /* Border radius on container since table can't have it with separate borders */
  border-radius: 0.5rem;
  border: 1px solid var(--color-border-light);
  box-shadow: 0 1px 3px rgba(22, 9, 35, 0.08);
}

/* Table setup for fixed layout + sticky columns */
.table-frozen-cols .submissions-table {
  /* JS sets table-layout: fixed and explicit width */
  border-collapse: separate;
  border-spacing: 0;
  overflow: visible;           /* Override .data-table overflow:hidden */
  border-radius: 0;            /* Container handles border-radius */
  border: none;                /* Container handles border */
  box-shadow: none;            /* Container handles shadow */
}

/* Cell borders with separate border-collapse */
.table-frozen-cols .submissions-table th,
.table-frozen-cols .submissions-table td {
  border-bottom: 1px solid var(--color-border-light);
}

/* Left frozen column (File) */
.col-frozen-left {
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--color-surface-elevated);
}

/* Right frozen column (Actions) */
.col-frozen-right {
  position: sticky;
  right: 0;
  z-index: 10;
  background: var(--color-surface-elevated);
}

/* Header frozen cells need higher z-index */
.submissions-table thead th.col-frozen-left,
.submissions-table thead th.col-frozen-right {
  z-index: 11;
  background: var(--color-surface);
}

/* Shadow indicators showing more content exists */
.col-frozen-left::after {
  content: '';
  position: absolute;
  top: 0;
  right: -6px;
  bottom: 0;
  width: 6px;
  background: linear-gradient(to right, rgba(0,0,0,0.08), transparent);
  pointer-events: none;
}

.col-frozen-right::before {
  content: '';
  position: absolute;
  top: 0;
  left: -6px;
  bottom: 0;
  width: 6px;
  background: linear-gradient(to left, rgba(0,0,0,0.08), transparent);
  pointer-events: none;
}

/* Row hover - frozen cells must update background */
.submissions-table tbody tr:hover td.col-frozen-left,
.submissions-table tbody tr:hover td.col-frozen-right {
  background: var(--color-surface);
}

/* Dark mode */
[data-theme="dark"] .table-frozen-cols {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] td.col-frozen-left,
[data-theme="dark"] td.col-frozen-right {
  background: var(--color-surface-elevated);
}

[data-theme="dark"] th.col-frozen-left,
[data-theme="dark"] th.col-frozen-right {
  background: var(--color-surface);
}

[data-theme="dark"] .submissions-table tbody tr:hover td.col-frozen-left,
[data-theme="dark"] .submissions-table tbody tr:hover td.col-frozen-right {
  background: var(--color-surface);
}

[data-theme="dark"] .col-frozen-left::after {
  background: linear-gradient(to right, rgba(0,0,0,0.2), transparent);
}

[data-theme="dark"] .col-frozen-right::before {
  background: linear-gradient(to left, rgba(0,0,0,0.2), transparent);
}

/* Resizable Column Handles */
.col-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  background: transparent;
  z-index: 1;
}

.col-resize-handle:hover,
.col-resize-handle:active {
  background: var(--color-primary-light);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-light);
  border-radius: 0.5rem;
}

.filter-bar .filter-search {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  font-size: 0.85rem;
  background: var(--color-surface-elevated);
  color: var(--color-text-primary);
}

.filter-bar .filter-search:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 2px var(--color-primary-subtle);
}

.filter-bar .filter-search::placeholder {
  color: var(--color-text-muted);
}

.filter-bar .filter-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  font-size: 0.85rem;
  background: var(--color-surface-elevated);
  color: var(--color-text-primary);
  cursor: pointer;
  min-width: 100px;
}

.filter-bar .filter-select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 2px var(--color-primary-subtle);
}

.filter-bar .filter-apply {
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: 0.375rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-inverse);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.filter-bar .filter-apply:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.filter-bar .filter-clear {
  padding: 0.5rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.filter-bar .filter-clear:hover {
  background: var(--color-surface-muted);
  border-color: var(--color-border-focus);
}

.filter-bar .filter-results {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-left: auto;
}

/* =============================================================================
   Date Range Picker
   ============================================================================= */

.date-range-picker {
  position: relative;
}

.date-range-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  font-size: 0.85rem;
  background: var(--color-surface-elevated);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.date-range-trigger:hover {
  border-color: var(--color-primary-light);
  color: var(--color-text-primary);
}

.date-range-trigger.has-value {
  background: var(--color-primary-subtle);
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

.date-range-trigger.open {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-subtle);
}

.date-range-label {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.date-range-chevron {
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.date-range-trigger.open .date-range-chevron {
  transform: rotate(180deg);
}

.date-range-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 280px;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
}

.date-range-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.date-range-header {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border-light);
}

.date-range-inputs {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
}

.date-input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.date-input-group label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.date-input-group input[type="date"] {
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  font-size: 0.85rem;
  background: var(--color-surface);
  color: var(--color-text-primary);
  width: 100%;
}

.date-input-group input[type="date"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-subtle);
}

.date-range-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1rem 1rem;
}

.date-preset {
  padding: 0.35rem 0.625rem;
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  font-size: 0.75rem;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.date-preset:hover {
  background: var(--color-primary-subtle);
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

.date-range-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface);
  border-radius: 0 0 0.5rem 0.5rem;
}

.date-clear-btn {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  font-size: 0.8rem;
  background: var(--color-surface-elevated);
  color: var(--color-text-secondary);
  cursor: pointer;
}

.date-clear-btn:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.date-apply-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  cursor: pointer;
}

.date-apply-btn:hover {
  background: var(--color-primary-dark);
}

/* Dark mode for date picker */
[data-theme="dark"] .date-range-dropdown {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .date-range-trigger.has-value {
  background: var(--color-primary-subtle);
  color: var(--color-primary-light);
}

[data-theme="dark"] .date-input-group input[type="date"] {
  color-scheme: dark;
}

/* Filter bar responsive */
@media (max-width: 768px) {
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar .filter-search {
    max-width: none;
  }

  .filter-bar .filter-results {
    margin-left: 0;
    text-align: center;
  }

  .date-range-dropdown {
    left: auto;
    right: 0;
  }
}

/* =============================================================================
   Analytics Page
   ============================================================================= */

.analytics-container {
  /* max-width now controlled by .container-lg */
}

.analytics-section {
  background: var(--color-surface-elevated);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--color-border-light);
  box-shadow: 0 1px 3px rgba(22, 9, 35, 0.08);
}

.analytics-section h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--color-text-primary);
}

.section-subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

.analytics-grid .analytics-section {
  margin-bottom: 0;
}

.stat-card.highlight {
  background: var(--cyera-whisper);
  border-color: var(--color-primary-light);
}

.stat-card.highlight .stat-value {
  color: var(--color-primary-dark);
}

.score-range {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border-light);
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.stat-detail {
  color: var(--color-text-muted);
}

/* Timeline Chart */
.timeline-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
  padding: 0.5rem 0;
}

.timeline-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.timeline-bar .bar-fill {
  width: 100%;
  background: var(--color-primary);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}

.timeline-bar .bar-label {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

/* Analytics Tables */
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

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

.analytics-table th {
  background: var(--color-surface);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.analytics-table tr:last-child td {
  border-bottom: none;
}

.category-badge {
  display: inline-block;
  background: var(--color-surface);
  padding: 0.15rem 0.4rem;
  border-radius: 0.2rem;
  font-size: 0.7rem;
  color: var(--color-text-secondary);
}

.score-badge {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.score-badge.good {
  background: var(--color-success-badge);
  color: var(--color-success);
}

.score-badge.moderate {
  background: var(--color-warning-badge);
  color: var(--color-warning);
}

.score-badge.poor {
  background: var(--color-error-badge);
  color: var(--color-error);
}

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

.failure-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--color-surface);
  border-radius: 0.25rem;
}

.failure-stage {
  text-transform: capitalize;
  font-weight: 500;
}

.failure-count {
  background: var(--color-error-badge);
  color: var(--color-error);
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 600;
  font-size: 0.85rem;
}

.no-data {
  color: var(--color-text-muted);
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

/* =============================================================================
   Settings Page - Typed Controls
   ============================================================================= */

.settings-page {
  /* max-width now controlled by .container-lg */
}

.settings-group {
  background: var(--color-surface-elevated);
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--color-border-light);
  box-shadow: 0 1px 3px rgba(22, 9, 35, 0.08);
  overflow: hidden;
}

.settings-group-header {
  background: var(--color-surface);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border-light);
}

.settings-group-header h2 {
  font-size: 1rem;
  margin: 0;
  color: var(--color-text-primary);
}

.settings-group-description {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0.25rem 0 0 0;
}

.settings-group-items {
  padding: 0;
}

.setting-row {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border-light);
}

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

.setting-form {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}

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

.setting-label {
  display: block;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0.25rem;
}

.setting-description {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.4;
}

.setting-control {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

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

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-border);
  border-radius: 26px;
  transition: background-color 0.2s ease;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

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

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

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

/* Select Dropdown */
.setting-select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  background: var(--color-surface-elevated);
  color: var(--color-text-primary);
  cursor: pointer;
  min-width: 200px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23787771' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

.setting-select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

/* Number Input */
.number-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.setting-number {
  width: 100px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  background: var(--color-surface-elevated);
  color: var(--color-text-primary);
  text-align: right;
}

.setting-number:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

/* Text Input */
.text-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.setting-text {
  width: 200px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  background: var(--color-surface-elevated);
  color: var(--color-text-primary);
}

.setting-text:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

/* JSON Textarea */
.json-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.setting-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  font-size: 0.8rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  background: var(--color-surface);
  color: var(--color-text-primary);
  resize: vertical;
  line-height: 1.5;
}

.setting-textarea:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

/* Advanced settings take full width */
.settings-group:last-child .setting-form {
  flex-direction: column;
  gap: 1rem;
}

.settings-group:last-child .setting-control {
  width: 100%;
}

.settings-group:last-child .json-input-group {
  align-items: flex-start;
}

.settings-group:last-child .json-input-group .btn {
  align-self: flex-end;
}

/* =============================================================================
   Operations Page
   ============================================================================= */

.operations-dashboard {
  /* max-width now controlled by .container-lg */
}

/* Model fallback warnings */
.warning-section {
  background: var(--color-warning-light, #fff9e6);
  border: 1px solid var(--color-warning, #f5a623);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.warning-section h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--color-warning-dark, #8a6d3b);
}

.warning-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.warning-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.warning-time {
  color: var(--color-text-muted);
  font-family: monospace;
  font-size: 0.75rem;
}

.warning-mode {
  font-weight: 500;
}

.warning-reason {
  color: var(--color-warning-dark, #8a6d3b);
}

.warning-fallback {
  color: var(--color-text-secondary);
  font-style: italic;
}

.warning-hint {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin: 0;
}

.warning-hint code {
  background: rgba(0, 0, 0, 0.1);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
}

.failure-summary {
  background: var(--color-surface-elevated);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--color-border-light);
}

.failure-summary h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--color-text-primary);
}

.failure-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.failure-stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-error-light);
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid var(--color-error-badge);
}

.failure-stat .count {
  font-weight: 600;
  color: var(--color-error);
}

.stage-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: lowercase;
  background: var(--color-surface);
  color: var(--color-text-secondary);
}

.stage-badge.stage-upload {
  background: #dbeafe;
  color: #1d4ed8;
}

.stage-badge.stage-parse {
  background: #fef3c7;
  color: #d97706;
}

.stage-badge.stage-deterministic_grading {
  background: #e0e7ff;
  color: #4f46e5;
}

.stage-badge.stage-ai_grading {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}

.stage-badge.stage-report_generation {
  background: #dcfce7;
  color: #16a34a;
}

.operations-table .time-cell {
  white-space: nowrap;
}

.operations-table .time-cell .date {
  display: block;
  font-size: 0.8rem;
}

.operations-table .time-cell .time {
  display: block;
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.operations-table .error-cell {
  max-width: 300px;
}

.operations-table .error-message {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.75rem;
  color: var(--color-error);
  word-break: break-word;
}

.count-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: var(--color-error-badge);
  color: var(--color-error);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 0.5rem;
}

.empty-state {
  background: var(--color-success-light);
  border: 1px solid var(--color-success-badge);
  border-radius: 0.5rem;
  padding: 2rem;
  text-align: center;
  color: var(--color-success);
}

/* =============================================================================
   Toast Notifications
   ============================================================================= */

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-success {
  background: var(--color-success-light, #dcfce7);
  color: var(--color-success, #16a34a);
  border: 1px solid var(--color-success-badge, #86efac);
}

.toast-error {
  background: var(--color-error-light, #fee2e2);
  color: var(--color-error, #dc2626);
  border: 1px solid var(--color-error-badge, #fecaca);
}

.toast-info {
  background: var(--cyera-whisper, #F6E8FF);
  color: var(--cyera-deep-purple, #441363);
  border: 1px solid var(--cyera-haze, #E8C6FF);
}

/* =============================================================================
   Spaceship Cursor Effect (Labs Feature)
   ============================================================================= */

.spaceship-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 56px;
  height: 56px;
  pointer-events: none;
  z-index: 99999;
  will-change: transform;
}

.spaceship-cursor video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* User toggle button */
.spaceship-toggle {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--cyera-haze, #E8C6FF);
  background: var(--cyera-whisper, #F6E8FF);
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.spaceship-toggle:hover {
  background: var(--cyera-haze, #E8C6FF);
  transform: scale(1.1);
}

.spaceship-toggle:active {
  transform: scale(0.95);
}

.spaceship-toggle-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.spaceship-toggle-off {
  opacity: 0.5;
  background: #f0f0f0;
  border-color: #ccc;
}

.spaceship-toggle-off:hover {
  opacity: 0.8;
  background: #e0e0e0;
}

/* Hide on mobile/touch devices via CSS as fallback */
@media (pointer: coarse), (hover: none) {
  .spaceship-cursor,
  .spaceship-toggle {
    display: none !important;
  }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .spaceship-cursor,
  .spaceship-toggle {
    display: none !important;
  }
}

/* Spaceship tooltip */
.spaceship-tooltip {
  position: fixed;
  bottom: 3.5rem;
  right: 1rem;
  background: var(--cyera-deep-purple, #441363);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  max-width: 200px;
  text-align: center;
  z-index: 9998;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.spaceship-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 14px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--cyera-deep-purple, #441363);
}

.spaceship-tooltip-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (pointer: coarse), (hover: none) {
  .spaceship-tooltip {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spaceship-tooltip {
    display: none !important;
  }
}

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

/* --------------------------------------------------------------------------
   Tablet and below (≤900px)
   Sidebar collapses to icons, main content uses more space
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .container,
  .container-lg {
    padding: 0 0.5rem;
  }

  h1 {
    font-size: 1.6rem;
    margin-bottom: 1rem;
  }

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

  .mode-selector {
    flex-direction: column;
    gap: 0.75rem;
  }

  .mode-option {
    padding: 0.75rem 1rem;
    justify-content: flex-start;
  }

  .btn {
    padding: 0.875rem 1.25rem;
    width: 100%;
  }

  .btn-secondary {
    width: 100%;
    text-align: center;
  }

  /* Report header */
  .report-header {
    flex-direction: column;
    gap: 1rem;
  }

  .score-summary {
    width: 100%;
    padding: 1rem;
  }

  /* Tables */
  .table-responsive {
    margin: 0 -1rem;
    padding: 0 1rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem;
    font-size: 0.85rem;
  }

  /* Stats */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --------------------------------------------------------------------------
   Small tablet / Large phone (≤510px)
   -------------------------------------------------------------------------- */
@media (max-width: 510px) {
  .main-wrapper main {
    padding: 1rem 0.75rem;
  }

  h1 {
    font-size: 1.4rem;
  }

  .subtitle {
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
  }

  /* Form */
  .form-group label {
    font-size: 0.9rem;
  }

  .form-group input,
  .form-group select {
    padding: 0.625rem;
    font-size: 0.95rem;
  }

  .form-group small {
    font-size: 0.8rem;
  }

  .mode-option {
    padding: 0.625rem 0.875rem;
  }

  .mode-label {
    font-size: 0.9rem;
  }

  .mode-tooltip {
    width: 1.125rem;
    height: 1.125rem;
    font-size: 0.7rem;
  }

  .btn {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }

  /* Cards */
  .status-card,
  .report-section {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  /* Score summary */
  .score-summary .grade {
    font-size: 2.5rem;
  }

  .score-summary .score {
    font-size: 1.25rem;
  }

  /* Score breakdown */
  .score-breakdown {
    grid-template-columns: 1fr;
  }

  /* Analytics */
  .analytics-grid {
    grid-template-columns: 1fr;
  }

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

  .stat-card {
    padding: 1rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  /* Footer */
  footer {
    padding: 0.75rem;
    font-size: 0.8rem;
  }
}

/* --------------------------------------------------------------------------
   Small phone (≤416px)
   -------------------------------------------------------------------------- */
@media (max-width: 416px) {
  .main-wrapper main {
    padding: 0.75rem 0.5rem;
  }

  .container,
  .container-lg {
    padding: 0;
  }

  h1 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
  }

  .subtitle {
    font-size: 0.85rem;
    line-height: 1.4;
  }

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

  .form-group label {
    font-size: 0.85rem;
    margin-bottom: 0.375rem;
  }

  .form-group input,
  .form-group select {
    padding: 0.5rem;
    font-size: 0.9rem;
  }

  /* File input styling */
  .form-group input[type="file"] {
    font-size: 0.85rem;
  }

  .mode-selector {
    gap: 0.5rem;
  }

  .mode-option {
    padding: 0.5rem 0.75rem;
    gap: 0.375rem;
  }

  .mode-option input[type="radio"] {
    width: 16px;
    height: 16px;
  }

  .mode-label {
    font-size: 0.85rem;
  }

  .mode-tooltip {
    width: 1rem;
    height: 1rem;
    font-size: 0.65rem;
  }

  .btn {
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
  }

  /* Cards and sections */
  .status-card,
  .report-section {
    padding: 0.75rem;
    border-radius: 0.375rem;
  }

  .report-section h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }

  /* Score summary */
  .score-summary {
    padding: 0.75rem;
  }

  .score-summary .grade {
    font-size: 2rem;
  }

  .score-summary .score {
    font-size: 1.1rem;
  }

  .score-summary .status {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }

  /* Stats */
  .stats-grid {
    gap: 0.5rem;
  }

  .stat-card {
    padding: 0.75rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  /* Tables - make horizontally scrollable */
  .criteria-table,
  .data-table {
    font-size: 0.8rem;
  }

  .criteria-table th,
  .criteria-table td,
  .data-table th,
  .data-table td {
    padding: 0.375rem 0.5rem;
  }

  .status-col {
    width: 40px;
  }

  .check-status {
    width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 0.75rem;
  }

  /* Empty state */
  .empty-state {
    padding: 2rem 1rem;
  }

  .empty-state-icon {
    font-size: 2rem;
  }

  .empty-state h2 {
    font-size: 1.1rem;
  }

  /* My submissions cards */
  .submission-card {
    padding: 1rem;
  }

  .submission-card-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .submission-status-score {
    width: 100%;
    text-align: left;
  }

  .score-display {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    width: fit-content;
  }

  .submission-card-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
  }

  /* Toast */
  .toast {
    left: 0.5rem;
    right: 0.5rem;
    transform: translateX(0) translateY(100px);
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
  }

  .toast.show {
    transform: translateX(0) translateY(0);
  }
}

/* --------------------------------------------------------------------------
   Touch device enhancements
   -------------------------------------------------------------------------- */
@media (pointer: coarse) {
  /* Larger tap targets */
  .sidebar-item {
    min-height: 44px;
  }

  .mode-option {
    min-height: 48px;
  }

  .btn {
    min-height: 48px;
  }

  .locale-selector select {
    min-height: 40px;
  }

  .admin-console-link,
  .login-link,
  .logout-link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }
}

/* --------------------------------------------------------------------------
   Slack Channel Browse
   -------------------------------------------------------------------------- */
.slack-or-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.slack-or-divider::before,
.slack-or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.slack-browse-header {
  margin-bottom: 1rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  padding: 0;
  font-size: 0.875rem;
  text-decoration: none;
}

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

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

.slack-search-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.slack-search-row input {
  flex: 1;
}

.slack-results {
  margin-top: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.slack-results:empty {
  display: none;
}

.slack-loading,
.slack-empty,
.slack-error {
  padding: 1rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

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

.slack-channel-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-light);
  transition: background 0.15s;
}

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

.slack-channel-item:hover {
  background: var(--color-surface-elevated);
}

.slack-channel-name {
  font-weight: 500;
  color: var(--color-text-primary);
}

.slack-channel-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.slack-selected-channel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.slack-artifact-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-light);
  transition: background 0.15s;
}

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

.slack-artifact-item:hover:not(.disabled) {
  background: var(--color-surface-elevated);
}

.slack-artifact-item.selected {
  background: var(--cyera-whisper);
}

.slack-artifact-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.slack-artifact-radio {
  display: flex;
  align-items: flex-start;
  padding-top: 0.125rem;
}

.slack-artifact-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  flex: 1;
  min-width: 0;
}

.slack-artifact-name {
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slack-artifact-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.slack-artifact-type {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.artifact-disabled-reason {
  font-size: 0.75rem;
  color: var(--color-warning);
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Print styles
   -------------------------------------------------------------------------- */
@media print {
  header,
  footer,
  .btn,
  .spaceship-toggle,
  .spaceship-cursor {
    display: none !important;
  }

  main {
    padding: 0;
  }

  .container,
  .container-lg {
    max-width: none;
  }
}

/* --------------------------------------------------------------------------
   Print Mode (for PDF export via ?print=true)
   -------------------------------------------------------------------------- */
body.print-mode {
  background: #fff !important;
  color: #1a202c !important;
}

body.print-mode main {
  padding: 1rem;
}

body.print-mode .container,
body.print-mode .container-lg {
  max-width: none;
  padding: 0;
}

/* Hide interactive elements in print mode */
body.print-mode .expand-all-btn,
body.print-mode .version-comparison-actions,
body.print-mode .btn-secondary:not(#download-pdf-btn),
body.print-mode .theme-toggle,
body.print-mode .nav-tabs,
body.print-mode .toast-container {
  display: none !important;
}

/* Force light theme colors */
body.print-mode .report-section,
body.print-mode .dimension-card,
body.print-mode .insight-card,
body.print-mode .structured-summary,
body.print-mode .structured-dimensions {
  background: #fff !important;
  border-color: #e2e8f0 !important;
  color: #1a202c !important;
}

body.print-mode .summary-text,
body.print-mode .dimension-name,
body.print-mode .score-pct,
body.print-mode .detail-block p,
body.print-mode .rec-text {
  color: #2d3748 !important;
}

body.print-mode .insight-list,
body.print-mode .score-raw {
  color: #4a5568 !important;
}

/* Ensure all dimensions are expanded and visible */
body.print-mode .dimension-details {
  display: block !important;
}

body.print-mode .dimension-details[hidden] {
  display: block !important;
}

/* Remove hover effects */
body.print-mode .dimension-card:hover {
  box-shadow: none !important;
}

/* Page break handling */
body.print-mode .dimension-card {
  page-break-inside: avoid;
  break-inside: avoid;
}

body.print-mode .report-section {
  page-break-inside: avoid;
  break-inside: avoid;
}

body.print-mode .insight-card {
  page-break-inside: avoid;
  break-inside: avoid;
}

/* Print header styling */
body.print-mode .print-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e2e8f0;
}

body.print-mode .print-header .logo {
  height: 32px;
}

body.print-mode .print-header .report-meta {
  text-align: right;
  font-size: 0.875rem;
  color: #718096;
}

/* Print footer styling */
body.print-mode .print-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.75rem;
  color: #a0aec0;
  text-align: center;
}

/* Version comparison in print mode */
body.print-mode .version-comparison-section {
  page-break-before: always;
}

body.print-mode .version-history-section .btn,
body.print-mode .version-history-section button {
  display: none !important;
}

/* Evidence details - open by default in print */
body.print-mode .evidence-details {
  display: block !important;
}

body.print-mode .evidence-details[open] summary,
body.print-mode .evidence-details summary {
  list-style: none;
}

body.print-mode .evidence-details summary::-webkit-details-marker {
  display: none;
}

/* A4 print sizing hints */
@media print {
  body.print-mode {
    font-size: 11pt;
    line-height: 1.5;
  }

  body.print-mode .print-header {
    position: running(header);
  }

  @page {
    size: A4;
    margin: 1.5cm;
  }
}
