:root {
  /* Dark - near-black, blue accent matching the logo */
  --bg-deep: #0B0D10;
  --bg-surface: #12151A;
  --bg-hover: #1A1E25;
  --border: #22262E;
  --text-muted: #7A8090;
  --text-secondary: #8791A5;
  --text-primary: #C4C9D4;
  --text-heading: #E6EAF2;
  --accent: #3B82F6;
  --accent-dim: #3B82F614;
  --accent-green: #22C55E;
  --accent-green-dim: #22C55E14;

  /* Panel type colors - aligned with logo blue/green */
  --panel-IPS: #22C55E;
  --panel-VA: #3B82F6;
  --panel-TN: #64748B;
  --panel-OLED: #DB2777;
}

[data-theme="light"] {
  /* Light - clean white, blue anchor matching the logo */
  --bg-deep: #FAFAF8;
  --bg-surface: #FFFFFF;
  --bg-hover: #F0F1F5;
  --border: #E2E3E8;
  --text-muted: #6A6E7A;
  --text-secondary: #5F6270;
  --text-primary: #1A1C24;
  --text-heading: #0E1018;
  --accent: #2563EB;
  --accent-dim: #2563EB14;
  --accent-green: #16A34A;
  --accent-green-dim: #16A34A14;

  --panel-dot-stroke: #FFFFFF;
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Skip link ─────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}
.skip-link:focus {
  left: 0;
  outline: none;
}

/* ── Focus visibility ───────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Header ─────────────────────────────────────────────── */
header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
header .logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}
header .logo {
  height: 48px;
  width: auto;
  transition: opacity 0.15s;
}
header .logo-link:hover .logo { opacity: 0.85; }

/* ── Theme toggle ─────────────────────────────────────── */
.theme-toggle-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.theme-label {
  font-size: 12px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
  color: var(--text-secondary);
  letter-spacing: 0;
  user-select: none;
  line-height: 24px;
}
.theme-label::after {
  content: 'Dark';
}
[data-theme="light"] .theme-label::after {
  content: 'Light';
}
.theme-toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--border);
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: color-mix(in srgb, var(--border) 70%, var(--text-primary)); }
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.theme-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-heading);
  transition: transform 0.2s;
}
[data-theme="light"] .theme-toggle::after {
  transform: translateX(20px);
}

/* ── Layout ─────────────────────────────────────────────── */
.container { display: flex; min-height: calc(100vh - 48px); }

/* ── Filters sidebar ────────────────────────────────────── */
.filters {
  width: 220px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  flex-shrink: 0;
  overflow-y: auto;
}
.filter-group { margin-bottom: 22px; }
.filter-group h3 {
  font-size: 11px;
  font-weight: 700;
  font-family: system-ui, -apple-system, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* Checkboxes */
.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-primary);
  transition: color 0.15s;
}
.checkbox-list label:hover { color: var(--text-heading); }
.checkbox-list input[type="checkbox"] {
  accent-color: var(--accent);
  width: 13px;
  height: 13px;
  cursor: pointer;
}
.checkbox-list .count {
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  margin-left: auto;
}

/* Range number inputs */
.range-inputs { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.range-sep {
  font-size: 12px;
  color: var(--text-muted);
  user-select: none;
}
.range-num {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 500;
  text-align: center;
  background: var(--bg-deep);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}
[data-theme="light"] .range-num {
  background: #FFFFFF;
}
.range-num:focus { border-color: var(--accent); }
.range-num::-webkit-outer-spin-button,
.range-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.range-num[type=number] { -moz-appearance: textfield; }
.range-unit { font-size: 12px; color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

/* Range toggle */
.range-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}
.range-toggle input { accent-color: var(--accent); width: 12px; height: 12px; cursor: pointer; }

/* Reset button */
.reset-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}
.reset-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Intro strip ────────────────────────────────────────── */
.intro-strip {
  padding: 10px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--text-secondary);
  text-align: left;
}
.intro-strip .price-note {
  color: var(--text-muted);
  font-style: italic;
}

/* ── Results bar ────────────────────────────────────────── */
.results-info {
  padding: 10px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 500;
  color: var(--text-muted);
}
.results-info span { color: var(--accent-green); font-weight: 700; }

/* ── Table ──────────────────────────────────────────────── */
.table-wrap { flex: 1; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  position: sticky;
  top: 0;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  font-family: system-ui, -apple-system, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.15s;
}
th:hover { color: var(--text-heading); }
th .sort-arrow { margin-left: 4px; font-size: 9px; }

td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.1s;
}
tr:hover td { background: var(--bg-hover); }

/* Spec cells - monospace */
td.spec {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Price column */
td.price {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-heading);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Amazon link */
td a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  transition: color 0.15s;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
td a:hover { color: var(--accent); }
td a .ext-link {
  color: var(--text-muted);
  font-size: 11px;
  margin-left: 2px;
}

/* Panel type dot indicator */
.panel-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}
td.spec .panel-dot { width: 6px; height: 6px; }
[data-theme="light"] .panel-dot {
  stroke: var(--panel-dot-stroke);
  stroke-width: 1.5px;
}

/* Specialty badge */
.specialty-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 1px 4px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 32px;
  color: var(--border);
  margin-bottom: 12px;
}
.empty-title {
  font-size: 14px;
  font-weight: 600;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.empty-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Inline error state ─────────────────────────────────── */
.error-state { padding: 48px 24px; }
.error-icon { color: var(--panel-OLED); }
.error-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin: 12px auto 0;
  max-width: 480px;
  word-break: break-all;
}
.error-btn {
  display: inline-block;
  margin-top: 16px;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: system-ui, -apple-system, sans-serif;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: none;
  color: var(--accent);
  transition: all 0.15s;
}
.error-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ── About page ─────────────────────────────────────────── */
.about-content {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px;
}
.about-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 32px;
  transition: color 0.15s;
}
.about-back:hover { color: var(--text-heading); }
.about-content h1 {
  font-size: 26px;
  font-weight: 700;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text-heading);
  margin-bottom: 12px;
}
.about-lead {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 36px;
}
.about-content section {
  margin-bottom: 36px;
}
.about-content h2 {
  font-size: 16px;
  font-weight: 700;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text-heading);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.about-content p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.about-content a {
  color: var(--accent);
  text-decoration: none;
}
.about-content a:hover {
  text-decoration: underline;
}
.about-values {
  list-style: none;
  padding: 0;
}
.about-values li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-left: 0;
}
.about-values li strong {
  color: var(--text-heading);
}
.about-cta {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.15s;
}
.about-cta:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Privacy page ───────────────────────────────────────── */
.privacy-content {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 24px;
}
.privacy-content h1 {
  font-size: 26px;
  font-weight: 700;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text-heading);
  margin-bottom: 12px;
}
.privacy-content .updated {
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.privacy-content p,
.privacy-content ul {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}
.privacy-content ul {
  padding-left: 20px;
}
.privacy-content li {
  margin-bottom: 4px;
}
.privacy-content a {
  color: var(--accent);
  text-decoration: none;
}
.privacy-content a:hover {
  text-decoration: underline;
}
.privacy-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 24px;
  transition: color 0.15s;
}
.privacy-back:hover {
  color: var(--text-heading);
}
.privacy-content h2 {
  font-size: 16px;
  font-weight: 700;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text-heading);
  margin-top: 32px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.privacy-content h2:first-of-type {
  margin-top: 32px;
}
.privacy-content p:last-child {
  margin-bottom: 0;
}

/* ── Footer ─────────────────────────────────────────────── */
.footer-note {
  padding: 14px 24px 12px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footer-copyright {
  font-weight: 600;
  color: var(--text-secondary);
}
.footer-disclaimer {
  font-size: 10px;
  color: var(--text-muted);
}
.footer-meta {
  font-size: 11px;
}
.footer-meta a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-meta a:hover {
  color: var(--text-heading);
  text-decoration: underline;
}

/* ── Responsive / Mobile ────────────────────────────────── */
@media (max-width: 768px) {
  header { padding: 0 12px; }
  header .logo { height: 42px; }

  .container { flex-direction: column; }
  .filters {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
    padding: 12px 12px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: flex-start;
  }

  .filter-group {
    margin-bottom: 0;
    flex: 1 1 auto;
    min-width: 140px;
  }
  .filter-group h3 {
    margin-bottom: 6px;
    padding-bottom: 4px;
    font-size: 11px;
    color: var(--text-secondary);
  }

  .range-num {
    width: 64px;
    font-size: 16px;
    padding: 6px 4px;
  }
  .range-toggle {
    color: var(--text-secondary);
  }

  .checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .checkbox-list label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-deep);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
  }
  .checkbox-list label:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--text-heading);
  }
  .checkbox-list input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
  }

  .reset-btn {
    width: 100%;
    margin-top: 8px;
    padding: 12px 16px;
    font-size: 13px;
    min-height: 44px;
  }

  .results-info {
    padding: 8px 12px;
    font-size: 12px;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
  .table-wrap::-webkit-scrollbar {
    height: 6px;
  }
  .table-wrap::-webkit-scrollbar-track {
    background: transparent;
  }
  .table-wrap::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
  }
  table { min-width: 540px; }
  th {
    padding: 10px 10px;
    font-size: 11px;
    color: var(--text-secondary);
  }
  td {
    padding: 8px 10px;
    font-size: 12px;
  }
  td.price {
    font-size: 12px;
  }
  td.spec {
    font-size: 11px;
  }
  td a {
    max-width: none;
    font-size: 12px;
  }

  .theme-toggle-group {
    gap: 6px;
  }
  .theme-label {
    font-size: 12px;
  }
}

/* ── Very small screens ─────────────────────────────────── */
@media (max-width: 480px) {
  .filters {
    flex-direction: column;
    gap: 12px;
  }
  .filter-group {
    min-width: 0;
    width: 100%;
  }
  .range-inputs {
    justify-content: flex-start;
  }
  .range-num {
    width: 72px;
  }
  table { min-width: 480px; }
}
