/* ============================================
   CaseMirror Admin Dashboard Styles
   Financial Times-Inspired Color Palette
   ============================================ */

/* FT-Inspired Admin Variables */
:root {
  --ft-cream: #fff1e5;
  --ft-paper: #fdf8f4;
  --ft-salmon: #f2dfce;
  --ft-blush: #f5c9c6;
  --ft-maroon: #990f3d;
  --ft-maroon-dark: #660a2a;
  --ft-maroon-light: #cc1d5b;
  --ft-wheat: #f2e5da;
  --ft-text: #33302e;
  --ft-text-muted: #605953;
  --ft-text-light: #807973;
  --ft-border: #e5d9ce;
  --ft-border-light: #f0e6dd;
  --ft-success: #0d7680;
  --ft-warning: #c77b00;
  --ft-error: #cc0000;
  --ft-info: #0f5499;
  --ft-card-shadow: 0 2px 8px rgba(51, 48, 46, 0.08);
  --ft-card-shadow-hover: 0 4px 16px rgba(51, 48, 46, 0.12);
}

/* Warm editorial theme for admin */
.admin-body {
  background: var(--ft-cream);
  color: var(--ft-text);
  min-height: 100vh;
}

.admin-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Admin Header - Editorial bar style */
.admin-header {
  background: var(--ft-paper);
  border-bottom: 2px solid var(--ft-maroon);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(51, 48, 46, 0.05);
}

.admin-header .header-content {
  max-width: 1400px;
}

.admin-header .logo-link {
  color: var(--ft-text);
}

.admin-header .logo-link:hover {
  color: var(--ft-maroon);
}

.admin-tagline {
  color: var(--ft-maroon) !important;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.admin-header .nav-link {
  color: var(--ft-text-muted);
  font-weight: 500;
}

.admin-header .nav-link:hover {
  color: var(--ft-maroon);
  background: var(--ft-salmon);
}

.admin-header .nav-link-active {
  color: var(--ft-maroon);
  border-bottom: 2px solid var(--ft-maroon);
}

/* Admin Main */
.admin-main {
  flex: 1;
  /* No max-width - allow full width on ultrawide displays */
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  width: 100%;
  /* Grid layout for tiling dashboard sections at ultrawide widths */
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  /* Cards fit content height - don't stretch to fill row */
  align-items: start;
}

/* Ultrawide: tile dashboard sections in 2 columns */
@media (min-width: 2000px) {
  .admin-main {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Title row spans full width - should appear above all tiled sections */
  .admin-title-row {
    grid-column: 1 / -1;
  }

  /* Two-column layouts span full width - they contain their own internal 2:1 grid */
  .dashboard-columns {
    grid-column: 1 / -1;
  }
}

/* Extra-wide: tile in 3 columns */
@media (min-width: 3000px) {
  .admin-main {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Title Row */
.admin-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--ft-border);
}

.admin-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--ft-text);
  margin: 0;
  letter-spacing: -0.01em;
}

.admin-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  color: var(--ft-text-muted);
  background: var(--ft-paper);
  padding: var(--space-xs) var(--space-md);
  border-radius: 20px;
  border: 1px solid var(--ft-border);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.status-dot-loading {
  background: var(--ft-warning);
}

.status-dot-connected {
  background: var(--ft-success);
}

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

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

/* Ingestion Section - Featured section with maroon accent */
.ingestion-section {
  background: linear-gradient(135deg, var(--ft-paper) 0%, var(--ft-wheat) 100%);
  border: 2px solid var(--ft-maroon);
  box-shadow: var(--ft-card-shadow);
}

.section-title-ingestion {
  border-bottom-color: var(--ft-maroon);
  color: var(--ft-maroon-dark);
}

.section-icon {
  margin-right: var(--space-sm);
}

.ingestion-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-xl);
}

.ingestion-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.ingestion-progress-container {
  padding: var(--space-md) 0;
}

.ingestion-progress-bar {
  height: 28px;
  background: var(--ft-salmon);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--space-sm);
  border: 1px solid var(--ft-border);
}

.ingestion-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ft-maroon), var(--ft-maroon-light));
  border-radius: 3px;
  transition: width 0.5s ease;
  min-width: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.ingestion-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
}

.ingestion-progress-text {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ft-text);
}

.ingestion-eta,
.extraction-eta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--ft-paper);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
  border: 1px solid var(--ft-border);
}

.eta-label {
  color: var(--ft-text-muted);
  font-weight: 500;
}

.eta-duration {
  color: var(--ft-maroon);
  font-weight: 600;
}

.eta-time {
  color: var(--ft-text-muted);
  font-size: 0.75rem;
  margin-left: var(--space-xs);
}

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

.eta-paused {
  color: var(--ft-warning);
  font-weight: 500;
}

.ingestion-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.ingestion-stat {
  background: var(--ft-paper);
  border-radius: 6px;
  padding: var(--space-md);
  text-align: center;
  border: 1px solid var(--ft-border);
  transition: all 0.2s ease;
}

.ingestion-stat:hover {
  border-color: var(--ft-maroon);
  box-shadow: var(--ft-card-shadow);
}

.ingestion-stat-value {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ft-maroon);
  margin-bottom: var(--space-xs);
}

.ingestion-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ft-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ingestion-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--ft-paper);
  border-radius: 6px;
  border: 1px solid var(--ft-border);
}

.ingestion-status-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--ft-wheat);
  border-radius: 4px;
  border: 1px solid var(--ft-border-light);
}

.ingestion-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ft-text-light);
}

.ingestion-status-dot.ingestion-status-active {
  background: var(--ft-success);
  animation: pulse 1s ease-in-out infinite;
}

.ingestion-status-dot.ingestion-status-idle {
  background: var(--ft-warning);
}

.ingestion-status-dot.ingestion-status-complete {
  background: var(--ft-info);
}

.ingestion-status-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ft-text);
}

.ingestion-last-update {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--ft-text-muted);
}

.ingestion-sources {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.ingestion-sources-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ft-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.ingestion-source-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  background: var(--ft-wheat);
  border-radius: 4px;
  font-size: 0.75rem;
  border: 1px solid var(--ft-border-light);
}

.ingestion-source-name {
  color: var(--ft-text-muted);
}

.ingestion-source-count {
  font-family: "JetBrains Mono", monospace;
  color: var(--ft-maroon);
  font-weight: 500;
}

@media (max-width: 900px) {
  .ingestion-grid {
    grid-template-columns: 1fr;
  }

  .ingestion-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .ingestion-stats-row {
    grid-template-columns: 1fr;
  }
}

/* Metrics Row */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

/* When metrics-row is inside ingestion-section, adjust spacing */
.ingestion-section .metrics-row {
  margin-top: var(--space-lg);
  margin-bottom: 0;
}

.metric-card {
  background: var(--ft-paper);
  border: 1px solid var(--ft-border);
  border-radius: 8px;
  padding: var(--space-lg);
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: var(--ft-card-shadow);
}

.metric-card:hover {
  border-color: var(--ft-maroon);
  box-shadow: var(--ft-card-shadow-hover);
  transform: translateY(-2px);
}

.metric-card-primary {
  background: linear-gradient(135deg, var(--ft-blush) 0%, var(--ft-salmon) 100%);
  border: 2px solid var(--ft-maroon);
}

.metric-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--ft-text);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.metric-card-primary .metric-value {
  color: var(--ft-maroon-dark);
}

.metric-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ft-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-subtitle {
  font-size: 0.75rem;
  color: var(--ft-text-light);
  margin-top: var(--space-xs);
}

/* Dashboard Sections */
.dashboard-section {
  background: var(--ft-paper);
  border: 1px solid var(--ft-border);
  border-radius: 8px;
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  box-shadow: var(--ft-card-shadow);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ft-text);
  margin: 0 0 var(--space-lg) 0;
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--ft-maroon);
}

/* Queue Grid */
.queue-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.queue-card {
  background: var(--ft-cream);
  border-radius: 6px;
  padding: var(--space-md);
  text-align: center;
  border: 1px solid var(--ft-border);
  transition: all 0.2s ease;
}

.queue-card:hover {
  box-shadow: var(--ft-card-shadow);
}

.queue-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.queue-card-complete .queue-value {
  color: var(--ft-success);
}
.queue-card-processing .queue-value {
  color: var(--ft-info);
}
.queue-card-pending .queue-value {
  color: var(--ft-text-muted);
}
.queue-card-failed .queue-value {
  color: var(--ft-error);
}

.queue-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ft-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}

.queue-bar {
  height: 4px;
  background: var(--ft-salmon);
  border-radius: 2px;
  overflow: hidden;
}

.queue-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width var(--transition-base);
}

.queue-bar-complete {
  background: var(--ft-success);
}
.queue-bar-processing {
  background: var(--ft-info);
}
.queue-bar-pending {
  background: var(--ft-text-muted);
}
.queue-bar-failed {
  background: var(--ft-error);
}

/* Overall Progress */
.progress-overall {
  margin-top: var(--space-md);
}

.progress-bar-container {
  height: 12px;
  background: var(--ft-salmon);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: var(--space-sm);
  border: 1px solid var(--ft-border);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ft-maroon), var(--ft-maroon-light));
  border-radius: 5px;
  transition: width var(--transition-base);
}

.progress-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
}

.progress-text {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  color: var(--ft-text-muted);
}

/* Two Column Layout */
.dashboard-columns {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-xl);
}

/* Model Throughput */
.model-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.model-item {
  background: var(--ft-cream);
  border-radius: 6px;
  padding: var(--space-md);
  border: 1px solid var(--ft-border);
  transition: all 0.2s ease;
}

.model-item:hover {
  border-color: var(--ft-maroon);
  box-shadow: var(--ft-card-shadow);
}

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

.model-name {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ft-text);
}

.model-count {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  color: var(--ft-maroon);
  font-weight: 600;
}

.model-bar-container {
  height: 6px;
  background: var(--ft-salmon);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.model-bar {
  height: 100%;
  border-radius: 3px;
  transition: width var(--transition-base);
}

.model-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ft-text-muted);
  gap: var(--space-sm);
}

.model-epm {
  color: var(--ft-accent-primary);
  font-weight: 600;
  background: rgba(var(--ft-accent-primary-rgb), 0.1);
  padding: 1px 6px;
  border-radius: 3px;
}

.model-workers {
  color: var(--ft-info);
  font-weight: 600;
  background: rgba(15, 84, 153, 0.1);
  padding: 1px 6px;
  border-radius: 3px;
}

.model-epm-per-worker {
  color: var(--ft-success);
  font-weight: 600;
  background: rgba(13, 118, 128, 0.1);
  padding: 1px 6px;
  border-radius: 3px;
}

.model-empty,
.failures-empty,
.trend-empty {
  padding: var(--space-xl);
  text-align: center;
  color: var(--ft-text-muted);
  font-style: italic;
  background: var(--ft-wheat);
  border-radius: 6px;
}

.model-loading,
.failures-loading,
.trend-loading {
  padding: var(--space-lg);
  text-align: center;
  color: var(--ft-text-muted);
}

/* Failures List */
.failures-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.failure-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  background: linear-gradient(135deg, #ffeaea 0%, #fff5f5 100%);
  border: 1px solid #ffcccc;
  border-left: 4px solid var(--ft-error);
  border-radius: 4px;
  padding: var(--space-sm) var(--space-md);
}

.failure-count {
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ft-error);
  min-width: 40px;
}

.failure-error {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--ft-text-muted);
  word-break: break-word;
  line-height: 1.4;
}

/* Trend Chart */
.trend-chart {
  min-height: 200px;
}

.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
  padding: var(--space-md) 0;
  border-bottom: 2px solid var(--ft-border);
}

.trend-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-width: 30px;
}

.trend-bar-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.625rem;
  color: var(--ft-text-muted);
  margin-bottom: var(--space-xs);
}

.trend-bar-fill {
  width: 80%;
  background: linear-gradient(180deg, var(--ft-maroon), var(--ft-blush));
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  margin-top: auto;
  transition: height 0.3s ease;
}

.trend-bar-item:hover .trend-bar-fill {
  background: linear-gradient(180deg, var(--ft-maroon-dark), var(--ft-maroon));
}

.trend-bar-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.625rem;
  color: var(--ft-text-muted);
  margin-top: var(--space-xs);
}

/* Admin Footer */
.admin-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--ft-border);
  font-size: 0.75rem;
  color: var(--ft-text-muted);
}

.last-updated {
  font-family: "JetBrains Mono", monospace;
}

.refresh-info {
  color: var(--ft-text-light);
}

/* ============================================
   Data Quality Section Styles
   ============================================ */

.data-quality-section {
  background: linear-gradient(135deg, var(--ft-paper) 0%, #f5f9f6 100%);
  border: 2px solid var(--ft-success);
}

.section-title-data-quality {
  border-bottom-color: var(--ft-success);
  color: #0a5960;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--ft-success);
}

.section-header-row .section-title {
  margin: 0;
  padding: 0;
  border: none;
}

.section-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ft-success);
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.section-link:hover {
  background: rgba(13, 118, 128, 0.1);
  color: #0a5960;
}

/* Data Quality Overview Stats */
.dq-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.dq-stat {
  background: var(--ft-paper);
  border-radius: 6px;
  padding: var(--space-md);
  text-align: center;
  border: 1px solid var(--ft-border);
  transition: all 0.2s ease;
}

.dq-stat:hover {
  box-shadow: var(--ft-card-shadow);
}

.dq-stat-good {
  border-color: var(--ft-success);
  background: linear-gradient(135deg, #e8f5f5 0%, var(--ft-paper) 100%);
}

.dq-stat-warn {
  border-color: var(--ft-warning);
  background: linear-gradient(135deg, #fff8e8 0%, var(--ft-paper) 100%);
}

.dq-stat-value {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ft-text);
  margin-bottom: var(--space-xs);
}

.dq-stat-good .dq-stat-value {
  color: var(--ft-success);
}

.dq-stat-warn .dq-stat-value {
  color: var(--ft-warning);
}

.dq-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ft-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Data Quality Issues Grid */
.dq-issues-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.dq-loading {
  grid-column: 1 / -1;
  padding: var(--space-xl);
  text-align: center;
  color: var(--ft-text-muted);
  background: var(--ft-wheat);
  border-radius: 6px;
}

.dq-issue-card {
  background: var(--ft-cream);
  border-radius: 6px;
  padding: var(--space-md);
  border: 1px solid var(--ft-border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dq-issue-card:hover {
  border-color: var(--ft-maroon);
  box-shadow: var(--ft-card-shadow);
  transform: translateY(-2px);
}

.dq-issue-card.dq-issue-high {
  border-left: 4px solid var(--ft-error);
}

.dq-issue-card.dq-issue-medium {
  border-left: 4px solid var(--ft-warning);
}

.dq-issue-card.dq-issue-low {
  border-left: 4px solid var(--ft-info);
}

.dq-issue-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
}

.dq-issue-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ft-text);
  margin: 0;
  line-height: 1.3;
}

.dq-issue-count {
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  min-width: 40px;
  text-align: center;
}

.dq-issue-high .dq-issue-count {
  background: rgba(204, 0, 0, 0.1);
  color: var(--ft-error);
}

.dq-issue-medium .dq-issue-count {
  background: rgba(199, 123, 0, 0.1);
  color: var(--ft-warning);
}

.dq-issue-low .dq-issue-count {
  background: rgba(15, 84, 153, 0.1);
  color: var(--ft-info);
}

.dq-issue-meta {
  display: flex;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--ft-text-muted);
}

.dq-issue-confidence {
  font-weight: 500;
}

/* Data Quality Detail Panel */
.dq-detail-panel {
  margin-top: var(--space-lg);
  background: var(--ft-cream);
  border-radius: 6px;
  border: 1px solid var(--ft-border);
  overflow: hidden;
}

.dq-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background: var(--ft-wheat);
  border-bottom: 1px solid var(--ft-border);
}

.dq-detail-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ft-text);
  margin: 0;
}

.dq-detail-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--ft-text-muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.dq-detail-close:hover {
  background: var(--ft-paper);
  color: var(--ft-text);
}

.dq-detail-content {
  padding: var(--space-md);
  max-height: 300px;
  overflow-y: auto;
}

.dq-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.dq-detail-table th,
.dq-detail-table td {
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--ft-border-light);
}

.dq-detail-table th {
  font-weight: 600;
  color: var(--ft-text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  background: var(--ft-wheat);
}

.dq-detail-table td {
  font-family: "JetBrains Mono", monospace;
  color: var(--ft-text);
}

.dq-detail-table tr:hover td {
  background: var(--ft-paper);
}

/* ============================================
   Collapsible Sections
   ============================================ */

.section-header-collapsible {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--ft-maroon);
}

.section-header-collapsible:hover {
  opacity: 0.85;
}

.section-header-collapsible .section-title {
  margin: 0;
  padding: 0;
  border: none;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.collapse-toggle {
  background: none;
  border: 1px solid var(--ft-border);
  border-radius: 4px;
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ft-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.collapse-toggle:hover {
  background: var(--ft-wheat);
  border-color: var(--ft-maroon);
  color: var(--ft-text);
}

.collapse-icon {
  transition: transform 0.2s ease;
}

.section-collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.section-content {
  transition: all 0.3s ease;
}

.section-collapsed .section-content {
  display: none;
}

/* Collapsed dashboard sections shrink to title size */
.dashboard-section.section-collapsed {
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  height: auto;
  /* In grid layouts, don't stretch to fill cell */
  align-self: start;
}

.dashboard-section.section-collapsed .section-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.dashboard-section.section-collapsed .section-header-collapsible {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* Special styling for collapsible data quality section */
.data-quality-section .section-header-collapsible {
  border-bottom-color: var(--ft-success);
}

/* Ingestion section collapsible */
.ingestion-section .section-header-collapsible {
  border-bottom-color: var(--ft-maroon);
}

/* Data Quality Responsive */
@media (max-width: 1200px) {
  .dq-issues-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dq-overview {
    grid-template-columns: repeat(2, 1fr);
  }

  .dq-issues-grid {
    grid-template-columns: 1fr;
  }

  .section-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
}

@media (max-width: 480px) {
  .dq-overview {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Web Scraping Sections
   ============================================ */

.scraping-columns {
  margin-top: var(--space-lg);
}

.scraping-section {
  border-left: 3px solid var(--ft-info);
}

.section-title-scraping {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.scraping-overview {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  align-items: center;
}

.scraping-overview-title {
  width: 100%;
  margin: 0 0 var(--space-xs) 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.scraping-stat {
  display: flex;
  flex-direction: column;
  padding: var(--space-sm) var(--space-md);
  background: var(--ft-paper);
  border-radius: var(--radius-sm);
  min-width: 80px;
  text-align: center;
}

.scraping-stat-primary {
  background: var(--ft-info);
  color: white;
}

.scraping-stat-primary .scraping-stat-label {
  color: rgba(255, 255, 255, 0.85);
}

.scraping-stat-success {
  background: var(--ft-success);
  color: white;
}

.scraping-stat-success .scraping-stat-label {
  color: rgba(255, 255, 255, 0.85);
}

.scraping-stat-warning {
  background: var(--ft-warning);
  color: white;
}

.scraping-stat-warning .scraping-stat-label {
  color: rgba(255, 255, 255, 0.85);
}

.scraping-stat-error {
  background: var(--ft-error);
  color: white;
}

.scraping-stat-error .scraping-stat-label {
  color: rgba(255, 255, 255, 0.85);
}

.scraping-stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
}

.scraping-stat-label {
  font-size: 0.75rem;
  color: var(--ft-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.scraping-sources {
  margin-bottom: var(--space-md);
}

.scraping-source-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--ft-border-light);
}

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

.scraping-source-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.scraping-source-count {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ft-info);
}

.scraping-progress-container {
  margin-bottom: var(--space-md);
}

.scraping-progress-bar {
  height: 8px;
  background: var(--ft-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--space-xs);
}

.scraping-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ft-success), var(--ft-info));
  border-radius: var(--radius-sm);
  transition: width 0.3s ease;
  width: 0%;
}

.scraping-progress-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ft-text-muted);
  text-align: right;
}

.scraping-by-year {
  margin-bottom: var(--space-md);
  border: 1px solid var(--ft-border-light);
  border-radius: var(--radius-sm);
  padding: var(--space-xs);
}

/* Incomplete year indicator */
.scraping-year-row.year-incomplete {
  background: rgba(204, 0, 0, 0.05);
  border-left: 3px solid var(--ft-error);
  padding-left: var(--space-sm);
  margin-left: -3px;
}

.scraping-year-row.year-incomplete .scraping-year-label {
  color: var(--ft-error);
  font-weight: 600;
}

.scraping-year-incomplete-badge {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ft-error);
  background: rgba(204, 0, 0, 0.1);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: var(--space-xs);
}

.scraping-year-expected {
  font-size: 0.6875rem;
  color: var(--ft-text-light);
  margin-left: var(--space-xs);
}

.scraping-year-coverage {
  font-size: 0.6875rem;
  font-weight: 600;
  margin-left: var(--space-xs);
}

.scraping-year-coverage.coverage-good {
  color: var(--ft-success);
}

.scraping-year-coverage.coverage-warning {
  color: var(--ft-warning);
}

.scraping-year-coverage.coverage-error {
  color: var(--ft-error);
}

/* Scraping section collapsible header */
.scraping-section .section-header-collapsible {
  border-bottom-color: var(--ft-info);
}

.scraping-year-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--ft-border-light);
}

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

.scraping-year-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  width: 50px;
  flex-shrink: 0;
}

.scraping-year-bar-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  height: 20px;
}

.scraping-year-bar {
  flex: 1;
  height: 100%;
  background: var(--ft-border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
}

.scraping-year-bar-matched {
  height: 100%;
  background: var(--ft-success);
}

.scraping-year-bar-missing {
  height: 100%;
  background: var(--ft-warning);
}

.scraping-year-stats {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ft-text-muted);
  white-space: nowrap;
  min-width: 90px;
  text-align: right;
}

.scraping-last-activity {
  font-size: 0.85rem;
  color: var(--ft-text-muted);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--ft-border-light);
}

.scraping-loading {
  color: var(--ft-text-muted);
  font-style: italic;
  padding: var(--space-md);
  text-align: center;
}

/* ============================================
   Research Coverage Section
   ============================================ */

.research-coverage-section {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 2px solid var(--ft-info);
}

.research-coverage-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ft-info);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.research-progress-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.research-stat {
  text-align: center;
  padding: var(--space-sm);
  background: var(--ft-paper);
  border-radius: var(--radius-sm);
  border: 1px solid var(--ft-border-light);
}

.research-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--ft-info);
}

.research-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--ft-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-xs);
}

.research-sources {
  margin-bottom: var(--space-md);
}

.research-source-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--ft-border-light);
}

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

.research-source-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ft-text);
}

.research-source-stats {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.research-source-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ft-text-muted);
}

.research-source-coverage {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 50px;
  text-align: right;
}

.research-source-coverage.coverage-good {
  color: var(--ft-success);
}

.research-source-coverage.coverage-warning {
  color: var(--ft-warning);
}

.research-source-coverage.coverage-error {
  color: var(--ft-error);
}

.research-recent-years {
  margin-top: var(--space-md);
}

.research-recent-title {
  font-size: 0.8rem;
  color: var(--ft-text-muted);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.research-year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-xs);
}

.research-year-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs);
  background: var(--ft-paper);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.research-year-label {
  color: var(--ft-text);
}

.research-year-coverage {
  font-weight: 600;
}

.research-loading {
  color: var(--ft-text-muted);
  font-style: italic;
  padding: var(--space-sm);
  text-align: center;
}

/* Justia Year Grid */
.justia-by-year {
  margin-top: var(--space-sm);
}

.justia-year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-xs);
}

.justia-year-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs);
  background: var(--ft-paper);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.justia-year-label {
  color: var(--ft-text);
  font-weight: 600;
}

.justia-year-stats {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

.justia-year-count {
  color: var(--ft-text-muted);
  font-size: 0.7rem;
}

.justia-year-coverage {
  font-weight: 600;
  min-width: 2.5rem;
  text-align: right;
}

/* Responsive */
@media (max-width: 1200px) {
  .dashboard-columns {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 900px) {
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .queue-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .metrics-row {
    grid-template-columns: 1fr;
  }

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

  .admin-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .metric-value {
    font-size: 2rem;
  }

  .trend-bars {
    overflow-x: auto;
  }
}

/* ============================================
   API Credits Section
   ============================================ */

.api-credits-section {
  background: linear-gradient(135deg, var(--ft-paper) 0%, #f5f3ff 100%);
  border: 2px solid #7c3aed;
}

.section-title-credits {
  border-bottom-color: #7c3aed;
  color: #5b21b6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-drag-handle {
  cursor: grab;
  padding: var(--space-xs) var(--space-sm);
  color: var(--ft-text-muted);
  font-size: 1rem;
  letter-spacing: 2px;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.section-drag-handle:hover {
  opacity: 1;
}

.credits-subsection {
  margin-bottom: var(--space-lg);
}

.credits-subsection:last-child {
  margin-bottom: 0;
}

.credits-subsection-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ft-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 var(--space-md) 0;
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--ft-border);
}

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

.credit-card {
  background: var(--ft-paper);
  border-radius: 8px;
  border: 1px solid var(--ft-border);
  overflow: hidden;
  transition: all 0.2s ease;
}

.credit-card:hover {
  box-shadow: var(--ft-card-shadow-hover);
  transform: translateY(-2px);
}

.credit-card-active {
  border-color: #7c3aed;
  background: linear-gradient(135deg, #f5f3ff 0%, var(--ft-paper) 100%);
}

.credit-card-available {
  border-style: dashed;
  opacity: 0.85;
}

.credit-card-available:hover {
  opacity: 1;
  border-color: #7c3aed;
}

.credit-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--ft-wheat);
  border-bottom: 1px solid var(--ft-border-light);
}

.credit-service-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--ft-text);
}

.credit-status {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 10px;
}

.credit-status-active {
  background: rgba(124, 58, 237, 0.15);
  color: #7c3aed;
}

.credit-status-exhausted {
  background: rgba(204, 0, 0, 0.15);
  color: var(--ft-error);
}

.credit-status-available {
  background: rgba(13, 118, 128, 0.15);
  color: var(--ft-success);
}

.credit-card-exhausted {
  border-color: var(--ft-error);
  background: linear-gradient(135deg, #fff5f5 0%, var(--ft-paper) 100%);
}

.credit-card-exhausted .credit-progress-fill {
  background: linear-gradient(90deg, var(--ft-error), #ff6b6b);
}

.credit-card-exhausted .credit-remaining {
  color: var(--ft-error);
}

.credit-card-body {
  padding: var(--space-md);
}

/* Workers row for services with coordinator workers */
.credit-workers-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  margin: calc(-1 * var(--space-md));
  margin-bottom: var(--space-sm);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, rgba(167, 139, 250, 0.05) 100%);
  border-bottom: 1px solid var(--ft-border-light);
}

.credit-workers-row.workers-none {
  background: var(--ft-wheat);
}

.credit-workers-row.workers-active {
  background: linear-gradient(135deg, rgba(13, 118, 128, 0.1) 0%, rgba(13, 118, 128, 0.05) 100%);
}

.credit-workers-icon {
  font-size: 1rem;
}

.credit-workers-count {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ft-text);
}

.credit-workers-count.workers-active {
  color: var(--ft-success);
}

.credit-workers-count.workers-warning {
  color: var(--ft-warning, #f59e0b);
}

.credit-workers-label {
  font-size: 0.75rem;
  color: var(--ft-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.credit-progress-container {
  margin-bottom: var(--space-sm);
}

.credit-progress-bar {
  height: 8px;
  background: var(--ft-border);
  border-radius: 4px;
  overflow: hidden;
}

.credit-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.credit-stats {
  display: flex;
  justify-content: space-between;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8125rem;
  margin-bottom: var(--space-sm);
}

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

.credit-remaining {
  color: #7c3aed;
  font-weight: 600;
}

.credit-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ft-text-muted);
}

.credit-tier {
  font-weight: 500;
}

.credit-rate {
  font-family: "JetBrains Mono", monospace;
}

/* Available service cards */
.credit-offer {
  text-align: center;
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-sm);
}

.credit-offer-amount {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ft-success);
  display: block;
}

.credit-offer-label {
  font-size: 0.75rem;
  color: var(--ft-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.credit-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.credit-feature {
  font-size: 0.75rem;
  color: var(--ft-text-muted);
  padding-left: var(--space-sm);
  position: relative;
}

.credit-feature::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--ft-success);
}

.credit-card-footer {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--ft-cream);
  border-top: 1px solid var(--ft-border-light);
}

.credit-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ft-info);
  text-decoration: none;
  transition: color 0.2s ease;
}

.credit-link:hover {
  color: #0a4070;
}

.credit-link-signup {
  color: var(--ft-success);
}

.credit-link-signup:hover {
  color: #0a5960;
}

/* ============================================
   Blocked Service Card (e.g., Browserbase)
   ============================================ */

.credit-card-blocked {
  border-color: var(--ft-warning);
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  opacity: 0.85;
}

.credit-card-blocked .credit-card-header {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.credit-status-blocked {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.credit-warning-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: var(--space-xs);
  color: white;
  cursor: help;
}

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

.credit-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  right: -8px;
  width: 280px;
  padding: var(--space-sm) var(--space-md);
  background: var(--ft-ink);
  color: var(--ft-paper);
  font-size: 0.8rem;
  line-height: 1.5;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s ease;
}

.credit-tooltip::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 16px;
  width: 12px;
  height: 12px;
  background: var(--ft-ink);
  transform: rotate(45deg);
}

.credit-warning-icon:hover .credit-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.credit-tooltip strong {
  display: block;
  margin-bottom: var(--space-xs);
  color: #fcd34d;
}

.credit-tooltip em {
  display: block;
  margin-top: var(--space-xs);
  color: #d1d5db;
  font-style: normal;
}

.credit-tooltip ul {
  margin: var(--space-xs) 0 0 0;
  padding-left: var(--space-md);
  color: #e5e7eb;
}

.credit-tooltip ul li {
  margin-bottom: 2px;
}

.credit-blocked-message {
  padding: var(--space-xs) var(--space-sm);
  margin-bottom: var(--space-sm);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #92400e;
  text-align: center;
}

/* ============================================
   Drag and Drop for Dashboard Tiles
   ============================================ */

.dashboard-section[draggable="true"] {
  cursor: grab;
}

.dashboard-section[draggable="true"]:active {
  cursor: grabbing;
}

.dashboard-section.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.dashboard-section.drag-over {
  border-top: 3px solid #7c3aed;
}

.dashboard-section.drag-over-bottom {
  border-bottom: 3px solid #7c3aed;
}

/* Responsive API Credits */
@media (max-width: 768px) {
  .credits-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 480px) {
  .credits-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Settings Button
   ============================================ */

.settings-btn {
  background: transparent;
  border: 1px solid var(--ft-border);
  border-radius: 6px;
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ft-text-muted);
  transition: all 0.2s ease;
  margin-left: var(--space-sm);
}

.settings-btn:hover {
  background: var(--ft-wheat);
  border-color: var(--ft-maroon);
  color: var(--ft-maroon);
}

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

/* ============================================
   Layout Mode Toggle
   ============================================ */

.layout-mode-toggle {
  background: transparent;
  border: 1px solid var(--ft-border);
  border-radius: 6px;
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ft-text-muted);
  transition: all 0.2s ease;
  margin-left: var(--space-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  gap: var(--space-xs);
}

.layout-mode-toggle:hover {
  background: var(--ft-wheat);
  border-color: var(--ft-maroon);
  color: var(--ft-maroon);
}

.layout-mode-toggle.layout-mode-auto {
  background: var(--ft-success-bg);
  border-color: var(--ft-success);
  color: var(--ft-success);
}

.layout-mode-toggle.layout-mode-auto:hover {
  background: var(--ft-success);
  color: white;
}

/* ============================================
   Settings Modal
   ============================================ */

.settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.settings-modal.settings-modal-visible {
  opacity: 1;
  pointer-events: auto;
}

.settings-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.settings-modal-content {
  position: relative;
  background: var(--ft-paper);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.2s ease;
}

.settings-modal-visible .settings-modal-content {
  transform: translateY(0);
}

.settings-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  color: white;
}

.settings-modal-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.settings-modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.settings-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.settings-modal-body {
  padding: var(--space-lg);
}

.settings-description {
  font-size: 0.875rem;
  color: var(--ft-text-muted);
  margin: 0 0 var(--space-lg) 0;
  line-height: 1.5;
}

.settings-services {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background: var(--ft-cream);
  border-radius: 8px;
  border: 1px solid var(--ft-border);
  transition: all 0.2s ease;
}

.settings-row:hover {
  border-color: #7c3aed;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.1);
}

.settings-row-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.settings-row-name {
  font-weight: 600;
  color: var(--ft-text);
  font-size: 0.9375rem;
}

.settings-row-desc {
  font-size: 0.75rem;
  color: var(--ft-text-muted);
}

/* Settings Sections */
.settings-section {
  margin-bottom: var(--space-lg);
}

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

.settings-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ft-text);
  margin: 0 0 var(--space-md) 0;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--ft-border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Settings Select */
.settings-select {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  color: var(--ft-text);
  background: var(--ft-paper);
  border: 1px solid var(--ft-border);
  border-radius: 6px;
  cursor: pointer;
  min-width: 100px;
  transition: all 0.2s ease;
}

.settings-select:hover {
  border-color: var(--ft-maroon);
}

.settings-select:focus {
  outline: none;
  border-color: var(--ft-maroon);
  box-shadow: 0 0 0 2px rgba(128, 0, 32, 0.1);
}

/* Toggle Switch */
.settings-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

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

.settings-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--ft-border);
  border-radius: 26px;
  transition: all 0.3s ease;
}

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

.settings-toggle input:checked + .settings-toggle-slider {
  background-color: #7c3aed;
}

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

.settings-toggle input:focus + .settings-toggle-slider {
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.3);
}

/* WebSocket Status */
.settings-ws-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--ft-border);
  font-size: 0.8125rem;
  color: var(--ft-text-muted);
}

.settings-ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.settings-ws-connected {
  background: var(--ft-success);
  box-shadow: 0 0 6px var(--ft-success);
}

.settings-ws-disconnected {
  background: var(--ft-error);
  box-shadow: 0 0 6px var(--ft-error);
}

/* Status indicator enhancements for WebSocket */
.status-dot-warning {
  background: var(--ft-warning);
  box-shadow: 0 0 6px var(--ft-warning);
}

@media (max-width: 480px) {
  .settings-modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .settings-toggle {
    align-self: flex-end;
  }
}

/* ============================================
   Error Modal
   ============================================ */

.error-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.2s ease;
}

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

.error-modal-content {
  position: relative;
  background: var(--ft-paper);
  border-radius: 12px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.error-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, var(--ft-error) 0%, #990000 100%);
  color: white;
  flex-shrink: 0;
}

.error-modal-title {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.error-modal-service {
  text-transform: capitalize;
}

.error-modal-count {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
}

.error-modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  line-height: 1;
}

.error-modal-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.error-modal-summary {
  padding: var(--space-md) var(--space-lg);
  background: var(--ft-wheat);
  border-bottom: 1px solid var(--ft-border);
  flex-shrink: 0;
}

.error-summary-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ft-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}

.error-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.error-summary-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--ft-paper);
  border-radius: 6px;
  border: 1px solid var(--ft-border);
  font-size: 0.8125rem;
}

.error-summary-item-count {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: var(--ft-error);
  min-width: 28px;
}

.error-summary-item-text {
  color: var(--ft-text-muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.error-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  background: var(--ft-cream);
}

.error-modal-loading {
  padding: var(--space-xl);
  text-align: center;
  color: var(--ft-text-muted);
  font-style: italic;
}

.error-modal-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.error-modal-item {
  background: var(--ft-paper);
  border-radius: 8px;
  border: 1px solid var(--ft-border);
  border-left: 4px solid var(--ft-error);
  padding: var(--space-md);
  transition: all 0.2s ease;
}

.error-modal-item:hover {
  box-shadow: var(--ft-card-shadow);
  border-color: var(--ft-error);
}

.error-modal-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
  gap: var(--space-md);
}

.error-modal-item-case {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.error-modal-item-docket {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ft-maroon);
}

.error-modal-item-name {
  font-size: 0.8125rem;
  color: var(--ft-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.error-modal-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.error-modal-item-year {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8125rem;
  color: var(--ft-text-muted);
}

.error-modal-item-attempts {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--ft-warning);
  font-weight: 500;
}

.error-modal-item-error {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8125rem;
  color: var(--ft-error);
  background: rgba(204, 0, 0, 0.05);
  padding: var(--space-sm);
  border-radius: 4px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.error-modal-item-time {
  font-size: 0.75rem;
  color: var(--ft-text-light);
  margin-top: var(--space-xs);
}

.error-modal-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--ft-text-muted);
}

.error-modal-empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.error-modal-empty-text {
  font-size: 1rem;
  font-weight: 500;
}

/* Clickable error counts in service cards */
.credit-remaining.clickable-errors {
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 2px 6px;
  border-radius: 4px;
  margin: -2px -6px;
}

.credit-remaining.clickable-errors:hover {
  background: rgba(204, 0, 0, 0.1);
  color: var(--ft-error);
  text-decoration: underline;
}

.credit-remaining.clickable-errors.has-errors {
  color: var(--ft-error);
}

/* Error modal responsive */
@media (max-width: 768px) {
  .error-modal-content {
    width: 95%;
    max-height: 90vh;
    margin: var(--space-md);
  }

  .error-modal-header {
    padding: var(--space-sm) var(--space-md);
  }

  .error-modal-title {
    font-size: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }

  .error-modal-body {
    padding: var(--space-md);
  }

  .error-summary-item-text {
    max-width: 120px;
  }
}

@media (max-width: 480px) {
  .error-modal-item-header {
    flex-direction: column;
    gap: var(--space-xs);
  }

  .error-modal-item-meta {
    align-items: flex-start;
    flex-direction: row;
    gap: var(--space-sm);
  }
}

/* ============================================
   Workers Modal
   ============================================ */

.workers-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.workers-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.2s ease;
}

.workers-modal-content {
  position: relative;
  background: var(--ft-paper);
  border-radius: 12px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}

.workers-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  flex-shrink: 0;
}

.workers-modal-title {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.workers-modal-service {
  text-transform: capitalize;
}

.workers-modal-status {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
}

.workers-modal-status-stopped {
  background: rgba(239, 68, 68, 0.3);
}

.workers-modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  line-height: 1;
}

.workers-modal-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.workers-modal-summary {
  padding: var(--space-md) var(--space-lg);
  background: var(--ft-wheat);
  border-bottom: 1px solid var(--ft-border);
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.workers-summary-stat {
  text-align: center;
}

.workers-summary-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ft-ink);
}

.workers-summary-value-success {
  color: var(--ft-success);
}

.workers-summary-value-error {
  color: var(--ft-error);
}

.workers-summary-value-warning {
  color: var(--ft-warning, #f59e0b);
}

.workers-summary-label {
  font-size: 0.75rem;
  color: var(--ft-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.workers-modal-loading {
  text-align: center;
  padding: var(--space-xl);
  color: var(--ft-text-muted);
}

.workers-modal-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.worker-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--ft-cream);
  border-radius: 8px;
  border: 1px solid var(--ft-border-light);
  transition: all 0.2s ease;
}

.worker-item:hover {
  border-color: var(--ft-success);
  background: white;
}

.worker-item-index {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ft-text-muted);
  width: 24px;
  text-align: center;
}

.worker-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.worker-item-case {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ft-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.worker-item-case-idle {
  color: var(--ft-text-muted);
  font-style: italic;
}

.worker-item-id {
  font-size: 0.7rem;
  color: var(--ft-text-muted);
  font-family: "JetBrains Mono", monospace;
}

.worker-item-stats {
  display: flex;
  gap: var(--space-md);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8125rem;
}

.worker-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.worker-stat-value {
  font-weight: 600;
}

.worker-stat-success {
  color: var(--ft-success);
}

.worker-stat-error {
  color: var(--ft-error);
}

.worker-stat-label {
  color: var(--ft-text-muted);
  font-size: 0.75rem;
}

.worker-item-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.worker-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ft-success);
  animation: pulse 2s ease-in-out infinite;
}

.worker-status-dot-idle {
  background: var(--ft-text-muted);
  animation: none;
}

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

.worker-status-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ft-success);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.worker-status-text-idle {
  color: var(--ft-text-muted);
}

.workers-modal-empty {
  text-align: center;
  padding: var(--space-xl);
  color: var(--ft-text-muted);
}

.workers-modal-empty-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-sm);
}

.workers-modal-empty-text {
  font-size: 0.9375rem;
}

.credit-link-workers {
  color: var(--ft-success);
  font-weight: 600;
}

.credit-link-workers:hover {
  color: #059669;
}

/* Workers Modal Responsive */
@media (max-width: 640px) {
  .workers-modal-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .worker-item {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }

  .worker-item-stats {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .worker-item-status {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
}

/* Workers Modal Footer */
.workers-modal-footer {
  padding: var(--space-md) var(--space-lg);
  background: var(--ft-cream);
  border-top: 1px solid var(--ft-border);
  flex-shrink: 0;
}

.workers-add-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.workers-add-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ft-text-muted);
}

.workers-add-input {
  width: 60px;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--ft-border);
  border-radius: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  text-align: center;
  background: var(--ft-paper);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.workers-add-input:focus {
  outline: none;
  border-color: var(--ft-success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.workers-add-btn {
  padding: var(--space-xs) var(--space-md);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
}

.workers-add-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
}

.workers-add-btn:active {
  transform: translateY(0);
}

.workers-add-btn:disabled {
  background: var(--ft-text-muted);
  cursor: not-allowed;
  transform: none;
}

.workers-add-btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.workers-add-status {
  margin-top: var(--space-sm);
  font-size: 0.8125rem;
  min-height: 1.25em;
}

.workers-add-status-success {
  color: var(--ft-success);
}

.workers-add-status-error {
  color: var(--ft-error);
}

/* ============================================
   Case Requests Section
   ============================================ */

.case-requests-section {
  background: var(--ft-bg-secondary);
  border-radius: 12px;
  padding: var(--space-lg);
  margin-top: var(--space-lg);
}

.section-title-case-requests {
  color: var(--ft-text-primary);
}

.case-requests-filters {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.case-requests-filter-select {
  padding: var(--space-xs) var(--space-sm);
  background: var(--ft-bg-tertiary);
  border: 1px solid var(--ft-border);
  border-radius: 6px;
  color: var(--ft-text-primary);
  font-size: 0.875rem;
  cursor: pointer;
}

.case-requests-filter-select:focus {
  outline: none;
  border-color: var(--ft-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.case-requests-refresh-btn {
  padding: var(--space-xs) var(--space-sm);
  background: var(--ft-bg-tertiary);
  border: 1px solid var(--ft-border);
  border-radius: 6px;
  color: var(--ft-text-secondary);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.case-requests-refresh-btn:hover {
  background: var(--ft-bg-hover);
  color: var(--ft-text-primary);
}

/* Overview Stats */
.case-requests-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: var(--space-md);
  margin: var(--space-md) 0;
}

.case-requests-stat {
  background: var(--ft-bg-tertiary);
  padding: var(--space-md);
  border-radius: 8px;
  text-align: center;
}

.case-requests-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ft-text-primary);
}

.case-requests-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--ft-text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.case-requests-stat-pending .case-requests-stat-value {
  color: var(--ft-warning);
}

.case-requests-stat-progress .case-requests-stat-value {
  color: var(--ft-accent);
}

.case-requests-stat-fulfilled .case-requests-stat-value {
  color: var(--ft-success);
}

.case-requests-stat-contributions .case-requests-stat-value {
  color: #a855f7;
}

/* Bulk Actions */
.case-requests-bulk-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
  padding: var(--space-sm) var(--space-md);
  background: rgba(59, 130, 246, 0.1);
  border-radius: 8px;
}

.bulk-selected-count {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ft-accent);
  margin-right: auto;
}

.bulk-action-btn {
  padding: var(--space-xs) var(--space-sm);
  border: none;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bulk-action-progress {
  background: var(--ft-accent);
  color: white;
}

.bulk-action-progress:hover {
  background: #2563eb;
}

.bulk-action-fulfilled {
  background: var(--ft-success);
  color: white;
}

.bulk-action-fulfilled:hover {
  background: #059669;
}

.bulk-action-rejected {
  background: var(--ft-error);
  color: white;
}

.bulk-action-rejected:hover {
  background: #dc2626;
}

/* Table Container */
.case-requests-table-container {
  margin-top: var(--space-md);
}

.case-requests-loading {
  text-align: center;
  padding: var(--space-xl);
  color: var(--ft-text-muted);
}

.case-requests-empty {
  text-align: center;
  padding: var(--space-xl);
  color: var(--ft-text-muted);
  font-style: italic;
}

/* Table Styles */
.case-requests-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.case-requests-table thead {
  background: var(--ft-bg-tertiary);
}

.case-requests-table th {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-weight: 600;
  color: var(--ft-text-secondary);
  border-bottom: 2px solid var(--ft-border);
  white-space: nowrap;
}

.case-requests-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--ft-border);
  color: var(--ft-text-primary);
}

.case-request-row:hover {
  background: var(--ft-bg-hover);
}

.case-request-contrib-row {
  background: rgba(168, 85, 247, 0.05);
}

.contrib-details {
  padding: var(--space-sm) var(--space-md) var(--space-sm) var(--space-xl);
  font-size: 0.8125rem;
}

.contrib-item {
  display: block;
  margin: 4px 0;
  color: var(--ft-text-secondary);
}

.contrib-item a {
  color: var(--ft-accent);
  text-decoration: none;
}

.contrib-item a:hover {
  text-decoration: underline;
}

/* Citation Link */
.citation-link {
  color: var(--ft-accent);
  text-decoration: none;
  font-weight: 500;
}

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

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

/* Status Badge */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--ft-warning);
}

.status-in-progress {
  background: rgba(59, 130, 246, 0.15);
  color: var(--ft-accent);
}

.status-fulfilled {
  background: rgba(16, 185, 129, 0.15);
  color: var(--ft-success);
}

.status-rejected {
  background: rgba(239, 68, 68, 0.15);
  color: var(--ft-error);
}

/* Priority Badge */
.priority-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.priority-low {
  background: rgba(107, 114, 128, 0.15);
  color: var(--ft-text-muted);
}

.priority-medium {
  background: rgba(245, 158, 11, 0.15);
  color: var(--ft-warning);
}

.priority-high {
  background: rgba(239, 68, 68, 0.15);
  color: var(--ft-error);
}

/* Status Update Select */
.status-update-select {
  padding: 4px 8px;
  background: var(--ft-bg-tertiary);
  border: 1px solid var(--ft-border);
  border-radius: 4px;
  color: var(--ft-text-primary);
  font-size: 0.75rem;
  cursor: pointer;
}

.status-update-select:focus {
  outline: none;
  border-color: var(--ft-accent);
}

/* Pagination */
.case-requests-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.pagination-btn {
  padding: var(--space-xs) var(--space-md);
  background: var(--ft-bg-tertiary);
  border: 1px solid var(--ft-border);
  border-radius: 6px;
  color: var(--ft-text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--ft-bg-hover);
  border-color: var(--ft-accent);
}

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

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