:root {
  /* Light mode color palette */
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --border-color: #dee2e6;
  --accent-primary: #0066cc;
  --accent-hover: #0052a3;
  --accent-light: #e7f3ff;
  --success: #28a745;
  --success-light: #d4edda;
  --warning: #ffc107;
  --warning-light: #fff3cd;
  --error: #dc3545;
  --error-light: #f8d7da;
  --input-bg: #ffffff;
  --input-text: #212529;
  --input-border: #dee2e6;
  --input-placeholder: #6c757d;

  /* Spacing scale - 8px base unit */
  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 1rem;      /* 16px */
  --spacing-lg: 1.5rem;    /* 24px */
  --spacing-xl: 2rem;      /* 32px */
  --spacing-2xl: 3rem;     /* 48px */

  /* Border radius scale */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  /* Max heights for transitions */
  --max-height-detail: 800px;
  --max-height-article: 600px;

  /* Typography */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  line-height: 1.6;
}

[data-theme="dark"] {
  /* Dark mode color palette */
  --bg-primary: #1a1d23;
  --bg-secondary: #22252b;
  --bg-tertiary: #2a2e35;
  --text-primary: #e9ecef;
  --text-secondary: #adb5bd;
  --text-muted: #6c757d;
  --border-color: #3a3e45;
  --accent-primary: #4f9eff;
  --accent-hover: #6bb0ff;
  --accent-light: #1e3a5f;
  --success: #4ade80;
  --success-light: #1e3a2a;
  --warning: #fbbf24;
  --warning-light: #3a2e1a;
  --error: #f87171;
  --error-light: #3a1e1e;
  --input-bg: #2a2e35;
  --input-text: #e9ecef;
  --input-border: #3a3e45;
  --input-placeholder: #6c757d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: #f8f9fa; /* Fallback */
  background-color: var(--bg-primary);
  color: #212529; /* Fallback */
  color: var(--text-primary);
  font-size: 16px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.site-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.site-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s;
}

.site-logo:hover {
  color: var(--accent-primary);
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.site-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.site-nav a:hover {
  color: var(--accent-primary);
}

.site-nav a.active {
  color: var(--accent-primary);
  font-weight: 600;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, border-color 0.2s;
  line-height: 1;
}

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

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

.page-header h1 {
  margin: 0 0 0.5rem 0;
  font-size: 2rem;
  font-weight: 700;
}

.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

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

.section-heading h1,
.section-heading h2 {
  margin: 0.5rem 0;
  color: var(--text-primary);
}

.section-heading h1 {
  font-size: 2rem;
}

.section-heading h2 {
  font-size: 1.5rem;
}

/* Metrics */
.metrics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  transition: box-shadow 0.2s;
  flex: 1 1 120px;
  min-width: 120px;
}

.metric-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.metric-card.primary {
  background: var(--accent-light);
  border-color: var(--accent-primary);
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.metric-label {
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0 0 0.25rem 0;
  font-weight: 600;
}

.metric-value {
  font-size: 1.5rem;
  margin: 0 0 0.125rem 0;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.metric-value.small {
  font-size: 1rem;
  word-break: break-word;
}

.metric-subtitle {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Cards */
.summary-card,
.body-card,
.meta-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
}

.summary-card h3,
.body-card h3,
.meta-card h3 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.summary-card h4 {
  margin: 1rem 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-primary);
}

.summary-card h4:first-child {
  margin-top: 0;
}

.summary-content p {
  margin: 0 0 1rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.summary-content ul {
  padding-left: 1.5rem;
  margin: 0 0 1rem;
}

.summary-content li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.article-body {
  white-space: pre-wrap;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  max-height: var(--max-height-article);
  overflow-y: auto;
  line-height: 1.7;
  font-size: 0.95rem;
  color: var(--text-primary);
}

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

.small {
  font-size: 0.875rem;
}

/* Buttons */
.button {
  background: #0066cc; /* Fallback */
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  transition: background-color 0.2s, box-shadow 0.2s;
}

.button:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 6px rgba(0, 102, 204, 0.2);
}

.button.full-width {
  width: 100%;
  justify-content: center;
}

.button.ghost {
  background: transparent;
  color: var(--accent-primary);
  border: 1px solid var(--border-color);
}

.button.ghost:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
  box-shadow: none;
}

.button.slim {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

.shared-controls {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}

.shared-input-label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  min-width: 200px;
}

.shared-input-label input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--input-text);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.shared-input-label input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

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

.control-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.control-card h3 {
  margin: 0;
  color: var(--text-primary);
}

.ingestion-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
}

.ingestion-form input,
.ingestion-form input[type="number"],
.ingestion-form input[type="url"] {
  width: 100%;
  margin-top: 0.35rem;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  padding: 0.5rem 0.75rem;
  background: var(--input-bg);
  color: var(--input-text);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ingestion-form input::placeholder {
  color: var(--input-placeholder);
}

.ingestion-form input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.input-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0.2rem 0 0;
}

.notification {
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin: 1rem 0 0;
  border: 1px solid transparent;
  font-size: 0.9rem;
}

.notification-success {
  background: rgba(30, 119, 97, 0.25);
  border-color: rgba(30, 119, 97, 0.5);
}

.notification-error {
  background: rgba(180, 53, 59, 0.25);
  border-color: rgba(180, 53, 59, 0.5);
}

.notification-warning {
  background: rgba(202, 140, 15, 0.25);
  border-color: rgba(202, 140, 15, 0.5);
}

.jobs-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  overflow: hidden;
}

.jobs-table th,
.jobs-table td {
  padding: 0.85rem;
  text-align: left;
  font-size: 0.85rem;
}

.jobs-table th {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
}

.jobs-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.jobs-table tbody tr:last-child {
  border-bottom: none;
}

.jobs-table a {
  color: #9ad1ff;
  text-decoration: none;
}

.jobs-table a:hover {
  text-decoration: underline;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-badge.status-pending {
  background: rgba(255, 195, 57, 0.2);
  color: #ffc339;
}

.status-badge.status-running {
  background: rgba(115, 174, 255, 0.2);
  color: #73aeff;
}

.status-badge.status-succeeded {
  background: rgba(79, 209, 155, 0.2);
  color: #7af1bf;
}

.status-badge.status-failed {
  background: rgba(255, 107, 122, 0.2);
  color: #ff6b7a;
}

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

.detail-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 1.25rem;
}

.detail-card h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.detail-list {
  margin: 0;
}

.detail-list dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
  margin-top: 0.8rem;
}

.detail-list dt:first-child {
  margin-top: 0;
}

.detail-list dd {
  margin: 0.3rem 0 0;
  font-size: 0.95rem;
}

.detail-list code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  font-size: 0.8rem;
}

.params-card,
.error-card {
  grid-column: 1 / -1;
}

.error-card {
  border-color: rgba(255, 107, 122, 0.5);
}

.error-message {
  background: rgba(255, 107, 122, 0.08);
  padding: 0.9rem;
  border-radius: 8px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  margin: 0;
  color: #ffb3bd;
}

.refresh-button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  color: #f5f6ff;
  cursor: pointer;
}

.refresh-button:hover {
  border-color: #f5f6ff;
}

/* Filters and Forms */
.filters {
  display: flex;
  gap: var(--spacing-md);
  align-items: flex-end;
  flex-wrap: wrap;
  margin: 0 0 var(--spacing-xl) 0;
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.filters label {
  display: flex;
  flex-direction: column;
  font-size: 0.875rem;
  gap: 0.375rem;
  font-weight: 500;
  color: var(--text-primary);
}

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

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

.filters select,
.filters input[type="number"],
.filters input[type="url"],
.filters input[type="text"] {
  padding: var(--spacing-sm) 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.filters select:focus,
.filters input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.items-table th {
  padding: 1rem 1.25rem;
  border-bottom: 2px solid var(--border-color);
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.items-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

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

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

.items-table a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
}

.items-table a:hover {
  text-decoration: underline;
}

/* Ensure button links keep their white text */
.items-table a.button {
  color: white;
}

.items-table a.button.ghost {
  color: var(--accent-primary);
}

.item-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.item-summary {
  margin: 0.5rem 0 0;
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 0.9rem;
}

/* Inline Details */
.inline-detail-row {
  background: var(--bg-primary);
}

.inline-detail-row td {
  padding: 0 !important;
  border-bottom: none !important;
}

.inline-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.inline-detail.expanded {
  max-height: var(--max-height-detail);
}

.inline-detail-content {
  padding: var(--spacing-lg);
  background: var(--bg-tertiary);
  margin: 0 var(--spacing-lg) var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.inline-detail h4 {
  margin-top: 0;
  color: var(--accent-primary);
}

.inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.inline-summary-list {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.inline-actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.75rem;
}

/* Badges */
.badge {
  display: inline-flex;
  padding: var(--spacing-xs) 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state {
  margin: var(--spacing-2xl) 0;
  text-align: center;
  padding: var(--spacing-2xl) var(--spacing-xl);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

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

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

.empty-state code {
  background: var(--bg-tertiary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
}

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

/* Item Detail Page */
.item-detail {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.detail-header {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
}

.detail-header h2 {
  margin: 0.5rem 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.detail-header .meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0.5rem 0 0 0;
}

.detail-controls {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-shrink: 0;
}

.detail-body {
  display: grid;
  grid-template-columns: minmax(0, 2.5fr) minmax(280px, 1fr);
  gap: var(--spacing-lg);
  align-items: flex-start;
}

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

.meta-card h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.meta-card p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
}

.meta-card.thumbnail {
  padding: 0;
  overflow: hidden;
}

.meta-card.thumbnail img {
  max-width: 100%;
  display: block;
  border-radius: var(--radius-lg);
}

.score-pill {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--warning-light);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
}

/* New compact item layout */
.item-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.item-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.item-title-link {
  font-weight: 600;
  font-size: 1.05rem;
  flex: 1;
  text-align: left;
}

/* Style button.item-title-link to look like a link */
button.item-title-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-primary);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  line-height: inherit;
}

button.item-title-link:hover {
  text-decoration: underline;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

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

.item-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.metric-list {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0 0;
  font-size: 0.75rem;
}

.metric-list li {
  padding: 0.125rem 0;
  color: var(--text-secondary);
}

.metric-list strong {
  color: var(--text-primary);
}

.git-version {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Footer */
.site-footer {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem 0;
  font-size: 0.875rem;
}

/* Jobs Page Specific Styles */
.page-header p.muted a {
  color: var(--accent-primary);
  text-decoration: none;
}

.page-header p.muted a:hover {
  text-decoration: underline;
}

.ingestion-controls {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.ingestion-controls h2 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

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

.control-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
}

.control-card h3 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.ingestion-form label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.ingestion-form input {
  width: 100%;
  padding: var(--spacing-sm) 0.75rem;
  margin-top: var(--spacing-xs);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
}

.ingestion-form input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.ingestion-form button {
  width: 100%;
  margin-top: var(--spacing-md);
  padding: 0.625rem var(--spacing-md);
  background: #0066cc; /* Fallback */
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background-color 0.2s;
}

.ingestion-form button:hover:not(:disabled) {
  background: var(--accent-hover);
}

.ingestion-form button:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

.notification {
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
}

.notification-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success);
}

.notification-error {
  background: var(--error-light);
  color: var(--error);
  border: 1px solid var(--error);
}

.jobs-list h2 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.jobs-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-secondary);
}

.jobs-table th,
.jobs-table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.jobs-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

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

.status-badge {
  display: inline-block;
  padding: var(--spacing-xs) 0.625rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  /* Fallback/default styling for unknown status types */
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.status-badge.status-pending {
  background: var(--warning-light);
  color: #856404;
  border-color: var(--warning);
}

.status-badge.status-running {
  background: var(--accent-light);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.status-badge.status-succeeded {
  background: var(--success-light);
  color: var(--success);
  border-color: var(--success);
}

.status-badge.status-failed {
  background: var(--error-light);
  color: var(--error);
  border-color: var(--error);
}

.jobs-table a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
}

.jobs-table a:hover {
  text-decoration: underline;
}

/* Job Detail Page */
.job-detail {
  max-width: 1000px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.detail-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
}

.detail-card h3 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.detail-list {
  margin: 0;
}

.detail-list dt {
  font-weight: 600;
  margin-top: 0.875rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.detail-list dt:first-child {
  margin-top: 0;
}

.detail-list dd {
  margin: 0.375rem 0 0 0;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.detail-list code {
  background: var(--bg-tertiary);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-size: 0.85rem;
}

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

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

.status-message {
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  background: var(--accent-light);
  border: 1px solid var(--accent-primary);
}

.status-message p {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.status-message p:last-child {
  margin-bottom: 0;
}

.refresh-button {
  padding: var(--spacing-sm) var(--spacing-md);
  background: #0066cc; /* Fallback */
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.2s;
}

.refresh-button:hover {
  background: var(--accent-hover);
}

.params-card,
.error-card {
  grid-column: 1 / -1;
}

.error-message {
  background: var(--bg-tertiary);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-size: 0.85rem;
  margin: 0;
  color: var(--error);
  line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

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

  .site-nav {
    gap: 1rem;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filters label {
    width: 100%;
  }

  .detail-body {
    grid-template-columns: 1fr;
  }

  .detail-controls {
    flex-direction: column;
    width: 100%;
  }

  .detail-controls .button {
    width: 100%;
    justify-content: center;
  }

  .metrics-grid {
    flex-direction: column;
  }

  .metric-card {
    flex: 1 1 auto;
  }

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

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

  /* Mobile-specific: Hide table, show card layout */
  .table-wrapper {
    border: none;
    background: transparent;
  }

  .items-table thead {
    display: none;
  }

  .items-table,
  .items-table tbody,
  .items-table tbody tr {
    display: block;
  }

  .items-table tbody tr {
    margin-bottom: var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
  }

  .items-table tbody td {
    display: block;
    padding: 0.5rem 0;
    border: none;
  }

  .items-table tbody td:first-child {
    padding-top: 0;
  }

  .items-table tbody td:last-child {
    padding-bottom: 0;
  }

  /* Badge positioning for mobile cards */
  .items-table tbody tr > td:first-child {
    margin-bottom: var(--spacing-sm);
  }

  /* Title and actions in mobile cards */
  .item-title {
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
  }

  .item-title a {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1 1 auto;
  }

  .item-title .button.ghost.slim {
    display: none;
  }

  /* Source and date in mobile cards */
  .items-table tbody tr > td:nth-child(3),
  .items-table tbody tr > td:nth-child(4) {
    font-size: 0.875rem;
    color: var(--text-secondary);
  }

  .items-table tbody tr > td:nth-child(3)::before {
    content: "Source: ";
    font-weight: 600;
    color: var(--text-primary);
  }

  .items-table tbody tr > td:nth-child(4)::before {
    content: "Published: ";
    font-weight: 600;
    color: var(--text-primary);
  }

  /* Show inline detail rows on mobile for quick view */
  .inline-detail-row {
    display: block;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
  }

  .inline-detail-row > td {
    padding: 0;
  }

  .inline-detail-content {
    padding: var(--spacing-sm) var(--spacing-md);
    margin: 0 0 var(--spacing-md) 0;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
  }

  /* Reduce padding in item cards on mobile */
  .items-table tbody tr {
    padding: var(--spacing-sm);
  }

  .items-table .item-summary {
    margin: var(--spacing-xs) 0 0;
    font-size: 0.85rem;
    line-height: 1.4;
  }

  /* Better touch targets */
  .button {
    min-height: 44px;
    padding: 0.75rem 1.25rem;
  }

  .button.slim {
    min-height: 38px;
    padding: 0.5rem 1rem;
  }

  /* Improve header on mobile */
  .detail-header {
    flex-direction: column;
  }

  .detail-header h2 {
    font-size: 1.5rem;
  }

  /* Better spacing for mobile */
  .page-header h1 {
    font-size: 1.75rem;
  }

  /* Pagination */
  .pagination {
    flex-direction: row;
    gap: 0.75rem;
  }

  .pagination .button {
    flex: 1;
  }
}

/* Tags */
.tags-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.tags-display {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  min-height: 24px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background-color: var(--accent-light);
  color: var(--accent-primary);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.4;
}

.tag-remove {
  background: none;
  border: none;
  color: var(--accent-primary);
  cursor: pointer;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.tag-remove:hover {
  opacity: 1;
}

.tags-edit {
  display: flex;
  gap: var(--spacing-xs);
}

.tag-input {
  flex: 1;
  padding: var(--spacing-xs) var(--spacing-sm);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background-color: var(--input-bg);
  color: var(--input-text);
  font-size: 0.875rem;
}

.tag-input::placeholder {
  color: var(--input-placeholder);
}

.tag-add-btn {
  padding: var(--spacing-xs) var(--spacing-md);
  background-color: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  transition: background-color 0.15s ease;
}

.tag-add-btn:hover {
  background-color: var(--accent-hover);
}

.tag.small {
  font-size: 0.75rem;
  padding: 2px 6px;
}

/* Article tracking styles */
.tracking-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

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

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

.tracking-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.875rem;
  cursor: pointer;
  user-select: none;
}

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

.rating-buttons {
  display: flex;
  gap: var(--spacing-sm);
}

.rating-btn {
  width: 48px;
  height: 48px;
  background-color: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.rating-btn:hover {
  background-color: var(--accent-light);
  border-color: var(--accent-primary);
}

.rating-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.rating-btn[aria-pressed="true"],
.rating-btn.active {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.rating-btn.thumbs-up[aria-pressed="true"],
.rating-btn.thumbs-up.active {
  background-color: var(--success);
  border-color: var(--success);
}

.rating-btn.thumbs-down[aria-pressed="true"],
.rating-btn.thumbs-down.active {
  background-color: var(--error);
  border-color: var(--error);
}

/* Inline tracking controls in quick view (inside .inline-actions) */
.inline-actions .tracking-btn {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-secondary);
}

.inline-actions .tracking-btn:hover {
  background-color: var(--accent-light);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.inline-actions .tracking-btn.active {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}


/* ============================================
   Quick View (QV) - Redesigned Inline Detail
   ============================================ */

.qv-container {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--spacing-xl);
  padding: var(--spacing-lg);
}

@media (max-width: 900px) {
  .qv-container {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }
}

.qv-main {
  min-width: 0;
}

.qv-summary {
  line-height: 1.7;
}

.qv-summary h4 {
  color: var(--accent-primary);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.qv-summary h4:first-child {
  margin-top: 0;
}

.qv-summary p {
  color: var(--text-primary);
  margin: 0 0 0.75rem;
}

.qv-summary ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.qv-summary li {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.qv-summary li::marker {
  color: var(--accent-primary);
}

.qv-body-preview {
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
}

.qv-body-preview details {
  font-size: 0.9rem;
}

.qv-body-preview summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
  padding: var(--spacing-sm) 0;
  user-select: none;
}

.qv-body-preview summary:hover {
  color: var(--accent-primary);
}

.qv-body-preview p {
  margin-top: var(--spacing-sm);
  padding: var(--spacing-md);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

/* Sidebar */
.qv-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.qv-meta {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.qv-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qv-meta-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.qv-meta-value {
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* HN Section */
.qv-hn-section {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-left: 4px solid #ff6600;
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.qv-score {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ff6600;
}

.qv-hn-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

.qv-hn-link:hover {
  text-decoration: underline;
}

/* Voting */
.qv-voting {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
  padding: var(--spacing-sm) 0;
}

.qv-vote-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.qv-vote-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: scale(1.05);
}

.qv-vote-btn.qv-upvote.active {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.qv-vote-btn.qv-neutral.active {
  background: var(--text-muted);
  border-color: var(--text-muted);
  color: white;
}

.qv-vote-btn.qv-downvote.active {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

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

/* Tags in quick view */
.inline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin: 0 !important;
}

.inline-tags .tag {
  font-size: 0.75rem;
  padding: 3px 8px;
  background: var(--accent-light);
  color: var(--accent-primary);
  border-radius: var(--radius-sm);
}

/* Action Buttons */
.qv-actions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-top: auto;
}

.qv-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.qv-btn-primary {
  background: var(--accent-primary);
  color: #ffffff !important;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.qv-btn-primary:hover {
  background: var(--accent-hover);
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

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

.qv-btn-secondary:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

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

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

.qv-btn-ghost.active {
  background: var(--warning-light);
  border-color: var(--warning);
  color: var(--text-primary);
}

/* Improve inline detail container */
.inline-detail-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin: var(--spacing-sm) 0 var(--spacing-md);
  overflow: hidden;
}

.inline-detail-content .muted {
  padding: var(--spacing-lg);
}
