/* style.css — helles, modernes und minimalistisches Design auf Basis von Design-Tokens */

:root {
  --color-bg: #f3f4f8;
  --color-dot: #d8dbe4;
  --color-surface: #ffffff;
  --color-border: #e4e6ec;
  --color-border-strong: #d3d6df;
  --color-text: #1a1d23;
  --color-text-muted: #6b7280;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-soft: #eaf0ff;
  --color-danger: #c0392b;
  --color-success: #2e7d32;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.16);

  /* Inhaltsbreite — umschaltbar über das Segmented Control neben der Überschrift.
     Der Wert wird per data-width am <html> gesetzt (siehe Regeln unten). */
  --content-width: 980px;
}

:root[data-width="compact"] { --content-width: 760px; }
:root[data-width="standard"] { --content-width: 980px; }
:root[data-width="wide"] { --content-width: 1280px; }
:root[data-width="full"] { --content-width: 100%; }

* {
  box-sizing: border-box;
}

/* Platz für die Scrollbar dauerhaft reservieren, damit der Content nicht springt,
   sobald ein langes Suchergebnis die Scrollbar erscheinen lässt. */
html {
  scrollbar-gutter: stable;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--color-bg);
  background-image: radial-gradient(circle, var(--color-dot) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--color-text);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
  /* Breitenwechsel als weiche Bewegung statt als harter Sprung. */
  transition: max-width 0.2s ease;
}

/* In der Vollbreite darf der Inhalt nicht am Fensterrand kleben. */
:root[data-width="full"] .container {
  padding-left: 2rem;
  padding-right: 2rem;
}

@media (prefers-reduced-motion: reduce) {
  .container { transition: none; }
}

/* Überschrift und Breitenumschalter teilen sich eine Zeile; auf schmalen Fenstern
   rutscht der Umschalter unter die Überschrift. */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.page-title-link {
  color: inherit;
  text-decoration: none;
}

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

.page-subtitle {
  font-weight: 400;
  font-size: 0.85em;
  color: var(--color-text-muted, #6b7280);
}

.page-subtitle::before {
  content: "– ";
}

/* Optik bewusst identisch zu den Ergebnis-Tabs (.tabs), damit beide als dieselbe
   Art Bedienelement gelesen werden. */
.width-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.width-switch-label {
  padding: 0 0.45rem 0 0.35rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.width-btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.width-btn:hover:not([aria-pressed="true"]) {
  color: var(--color-text);
  background: #f3f4f6;
}

.width-btn[aria-pressed="true"] {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

.width-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

/* Auf Touch-/Handy-Breiten ist die Umschaltung wirkungslos (der Viewport ist ohnehin
   schmaler als jede Stufe) — sie würde dort nur Platz kosten. */
@media (max-width: 640px) {
  .width-switch {
    display: none;
  }
}

/* Gemeinsame Button-Basis — alle Buttons der App teilen sich Größe, Radius und Verhalten,
   nur Farbe/Gewicht unterscheiden sich je nach Rolle (primary / secondary / utility). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

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

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-sm);
}

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

.btn-utility {
  background: var(--color-surface);
  color: var(--color-text-muted);
  border-color: var(--color-border);
  font-size: 0.82rem;
  padding: 0.45rem 0.9rem;
}

.btn-utility:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.search-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.search-form input {
  flex: 1;
  padding: 0.55rem 0.8rem;
  font-size: 1rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

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

.status {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 1.3rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.status.loading { color: var(--color-text-muted); }
.status.error { color: var(--color-danger); }
.status.success { color: var(--color-success); }

/* Solange eine Anfrage läuft, wird die Statuszeile zur Ladeanzeige: zentriert und größer,
   auf derselben Mittelachse und an derselben Stelle, an der gleich die Ergebnisse erscheinen. */
.status[aria-busy="true"] {
  flex-direction: column;
  justify-content: center;
  gap: 0.9rem;
  padding: 2.5rem 1rem;
  font-size: 1.05rem;
  text-align: center;
}

/* Throbber über dem Statustext — wird nur eingefügt, solange tatsächlich eine Anfrage läuft
   (setStatus(..., { busy: true })), nicht bei rein informativen "loading"-Meldungen. */
.status-spinner {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--color-border-strong);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: status-spin 0.7s linear infinite;
}

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

/* Rotation kann bei entsprechender Systemeinstellung stören — dann stattdessen sanftes Pulsieren. */
@media (prefers-reduced-motion: reduce) {
  .status-spinner {
    border-color: var(--color-primary);
    animation: status-pulse 1.2s ease-in-out infinite;
  }

  @keyframes status-pulse {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 1; }
  }
}

.search-form .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Trefferkopf: Karte über der Tabelle mit Modellname, Serien-/Modellnummer und Trefferzahlen.
   Der Modellname steht bewusst als Überschrift oben — er ist die Kontrolle, ob wirklich das
   erwartete Gerät gefunden wurde (siehe showResultSummary in app.js). */
.result-summary {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  /* Grüner Balken links: dieselbe Erfolgs-Farbe, die vorher die Statuszeile hatte. */
  border-left: 4px solid var(--color-success);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.result-summary.has-warning {
  border-left-color: var(--color-danger);
}

.result-summary-model {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.result-summary-icon {
  flex: none;
  margin-top: 0.15rem;
  color: var(--color-success);
}

.result-summary.has-warning .result-summary-icon {
  color: var(--color-danger);
}

.result-summary-names {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.result-summary-name {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}

.result-summary-name.is-unknown {
  color: var(--color-danger);
}

/* HPs Kurzschreibweise desselben Modells — nur als Beleg, deshalb klein und gedämpft. */
.result-summary-short {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.result-summary-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin: 0.9rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--color-border);
}

.summary-fact {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.summary-fact dt {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.summary-fact dd {
  margin: 0;
}

.summary-value {
  font-size: 0.98rem;
  font-weight: 600;
}

/* Serien- und Modellnummer sind Codes, die abgetippt/verglichen werden — dafür ist eine
   dicktengleiche Schrift deutlich besser lesbar (0/O, 1/l). */
.summary-value-code {
  font-family: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  letter-spacing: 0.02em;
}

.summary-copyable {
  border-radius: var(--radius-sm);
  cursor: pointer;
  /* Der eingefärbte Hover-Bereich soll den Text umschließen, nicht die ganze Zeilenbreite. */
  display: inline-block;
  padding: 0.1rem 0.35rem;
  margin-left: -0.35rem;
}

.summary-copyable:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

/* Fehlt der Wert in der HP-Antwort, steht dort ein Platzhalter — der ist nicht kopierbar. */
.summary-value.is-empty {
  color: var(--color-text-muted);
  font-weight: 500;
  cursor: default;
}

.summary-value.is-empty:hover {
  background: none;
  color: var(--color-text-muted);
}

.result-summary-warning {
  margin: 0.85rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-danger);
}

/* Modellauswahl: erscheint nur bei Seriennummern, die HP nicht eindeutig zuordnen kann. */
.product-select {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  padding: 0.9rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.product-select-label {
  font-size: 0.9rem;
  font-weight: 500;
}

.product-select-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.product-select-input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: #fafbfc;
}

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

/* Toolbar-Karte: fasst Filter, Trefferzahl und Utility-Buttons als eine visuelle Einheit zusammen. */
.filter-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.filter-wrapper input {
  flex: 1;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fafbfc;
}

.filter-wrapper input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.result-count {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.table-wrapper {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  font-size: 0.9rem;
}

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

.results-table th {
  background: #f8f9fb;
  font-weight: 600;
}

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

.results-table tbody tr:nth-child(even) {
  background: #fafbfc;
}

/* Nur Zellen mit kopierbarem Text hervorheben — die Kopier- und die Foto-Spalte haben
   ihre eigenen Buttons und werden nicht per Zellklick kopiert. */
.results-table tbody tr:not(.row-obsolete) td:not(.copy-cell):not(.photo-cell):hover {
  background-color: var(--color-primary-soft);
  box-shadow: inset 0 0 0 1px #b9cdfb;
  cursor: pointer;
}

/* Erste Spalte: schmaler Button, der Part Number + Beschreibung zusammen kopiert. */
.copy-col {
  width: 1%;
}

.copy-cell {
  width: 1%;
  text-align: center;
  padding-right: 0.35rem;
}

.copy-combo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.copy-combo-btn:hover {
  background: var(--color-primary-soft);
  border-color: #b9cdfb;
  color: var(--color-primary);
}

.copy-combo-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

/* Nur für Screenreader: die erste Spalte hat visuell absichtlich keine Überschrift. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.row-obsolete td {
  background: #fdecea;
}

.row-obsolete:hover td {
  background: #fbdad6;
  cursor: pointer;
}

.replacement-badge {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #a52714;
}

@keyframes flashHighlight {
  0%, 100% { background-color: transparent; }
  50% { background-color: #fff59d; }
}

.flash-highlight td {
  animation: flashHighlight 0.8s ease-in-out 2;
}

.copy-tooltip {
  position: fixed;
  z-index: 1200;
  background: #1e1e1e;
  color: white;
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  transition: background-color 0.2s;
}

.copy-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e1e1e;
}

.copy-tooltip.copied {
  background: #2e7d32;
  animation: tooltipPulse 0.4s ease;
}

.copy-tooltip.copied::after {
  border-top-color: #2e7d32;
}

@keyframes tooltipPulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.6); }
  100% { box-shadow: 0 0 0 8px rgba(46, 125, 50, 0); }
}

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

.photo-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: #2e7d32;
  border-radius: var(--radius-sm);
}

.photo-icon-btn:hover {
  background: #e8f5e9;
}

.photo-icon-broken {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  color: #c0392b;
}

.photo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1150;
  /* Eigener Scrollcontainer statt "body { overflow: hidden }": So bleibt die Scrollbar der
     Seite sichtbar (kein leerer Streifen im reservierten Gutter neben dem Overlay), und
     "contain" verhindert trotzdem, dass Mausrad-Scrollen an die Seite dahinter durchgereicht wird. */
  overflow: auto;
  overscroll-behavior: contain;
}

/* Trägt Pfeil – Modal – Pfeil in einer Reihe. Feste Höhe (statt auto), damit das
   max-height: 100% des Modals weiterhin einen definierten Bezug hat. */
.photo-modal-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.photo-modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 650px;
  height: 715px;
  min-width: 320px;
  min-height: 260px;
  /* Bezug ist das Overlay inkl. seines Innenabstands — dadurch bleibt rundherum immer ein
     sichtbarer Rand, ohne mit vw/vh am reservierten Scrollbar-Gutter vorbeizurechnen. */
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: auto;
  resize: both;
  box-shadow: var(--shadow-lg);
}

.photo-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.6rem 0.6rem 1.1rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.photo-modal-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.photo-modal-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.photo-modal-counter {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}

/* Zoom-Bedienung im Kopf: minus / Prozentwert (= Reset) / plus. */
.photo-modal-zoom {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.photo-zoom-btn,
.photo-zoom-level {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  line-height: 1;
}

.photo-zoom-btn {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 1.05rem;
}

.photo-zoom-level {
  height: 1.75rem;
  padding: 0 0.5rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
  min-width: 3.4rem;
}

.photo-zoom-btn:hover,
.photo-zoom-level:hover {
  background: #f3f4f6;
  color: var(--color-text);
}

.photo-zoom-btn:disabled {
  opacity: 0.4;
  cursor: default;
  background: var(--color-surface);
}

.photo-modal-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
  min-height: 0;
  /* Ausschnitt für den Zoom: Ein Klick vergrößert, im vergrößerten Zustand wird gezogen.
     touch-action: none, damit Wischen auf dem Touchscreen das Bild schiebt statt der Seite. */
  cursor: zoom-in;
  touch-action: none;
}

.photo-modal-body.is-zoomed {
  cursor: grab;
}

.photo-modal-body.is-panning {
  cursor: grabbing;
}

/* Blätter-Pfeile sitzen als eigene Spalten neben dem Modal und überdecken das Foto nicht.
   Das Modal darf dafür schrumpfen (flex-shrink) bis zu seiner min-width. */
.photo-modal-nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #1f2937;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.photo-modal-nav:hover {
  background: #fff;
  transform: scale(1.08);
}

.photo-modal-nav:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* Zu schmal für seitliche Spalten: Pfeile rücken zurück über die Bildränder. */
@media (max-width: 560px) {
  .photo-modal-stage {
    gap: 0;
    position: relative;
  }

  .photo-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    width: 2.5rem;
    height: 2.5rem;
  }

  .photo-modal-nav:hover {
    transform: translateY(-50%) scale(1.08);
  }

  .photo-modal-nav-prev {
    left: 0.5rem;
  }

  .photo-modal-nav-next {
    right: 0.5rem;
  }
}

.photo-modal img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  /* Zoom/Pan laufen über transform — das Layout bleibt davon unberührt, deshalb springt
     das Modal beim Zoomen nicht. Origin ist die Bildmitte (siehe Berechnung in app.js). */
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

/* Sanfter Übergang beim Zoomen per Klick/Knopf/Mausrad — beim Ziehen stört er
   (das Bild würde der Maus hinterherhinken) und wird darum abgeschaltet. */
.photo-modal img.is-animated {
  transition: transform 0.15s ease-out;
}

.photo-modal-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.photo-modal-close:hover {
  color: var(--color-text);
  background: #f3f4f6;
}

/* Galerie-Tab: normaler Seiteninhalt an der Stelle der Tabelle, kein Overlay mehr. */
.gallery-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1.1rem;
  align-content: start;
}

.gallery-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.65rem;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  font: inherit;
  color: inherit;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.gallery-item:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.gallery-item:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.gallery-item img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  pointer-events: none;
}

.gallery-item .gallery-part-number {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  word-break: break-all;
}

.gallery-empty {
  grid-column: 1 / -1;
  color: var(--color-text-muted);
  padding: 2rem;
}

/* Utility-Klasse: muss jede display-Regel schlagen, unabhängig davon, wo im Stylesheet
   die Regel des jeweiligen Elements steht (sonst gewinnt z.B. `.tabs { display: inline-flex }`). */
.hidden {
  display: none !important;
}

/* Tabellenspalten, die im aktuellen Datensatz durchgehend leer sind (HP liefert dort nur
   Platzhalter wie "-N/A-"). Eigene Klasse statt `.hidden`, damit Zeilen-Filter und
   Spalten-Sichtbarkeit sich nicht gegenseitig überschreiben. */
.results-table th.col-hidden,
.results-table td.col-hidden {
  display: none;
}

/* Segmented-Control-Optik statt einfacher Unterstreich-Tabs — wirkt als eine zusammenhängende Einheit. */
.tabs {
  display: inline-flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.tab-btn {
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tab-btn.active {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

.tab-btn:hover:not(.active) {
  color: var(--color-text);
  background: #f3f4f6;
}

/* Die Galerie zeigt dieselben Daten in einer anderen Darstellungsform als die beiden
   Tabellen-Tabs — deshalb bleibt sie Teil des Segmented Controls, wird davon aber durch
   einen schmalen Trennstrich abgesetzt. */
.tab-btn.tab-separated {
  position: relative;
  margin-left: 0.55rem;
}

.tab-btn.tab-separated::before {
  content: '';
  position: absolute;
  left: -0.4rem;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 1px;
  background: var(--color-border-strong);
}

.raw-json {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
  font-size: 0.8rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
