/* Zellbild Analyse — die eine Stilvorlage der Plattform.
   Identität der heutigen App: Papier, Tinte, LCD-Grün, Oliv; IBM Plex Sans und Mono; Glas-Paneele mit 26 px Ecken.
   Jede Seite benutzt nur diese Bausteine. Hell und dunkel; am Handy eine Spalte. */

:root {
  --bg: #f1f0ea;
  --bg-alt: #e8e6de;
  --bg-top: #f8f7f2;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --panel-rand: rgba(255, 255, 255, 0.7);
  --ink: #101010;
  --muted: #545454;
  --line: rgba(16, 16, 16, 0.12);
  --lcd: #cdd8bc;
  --lcd-hell: #e4ebd6;
  --lcd-ink: #263022;
  --accent: #87956a;
  --knopf: #111111;
  --knopf-ink: #f9f8f3;
  --warn: #b7791f;
  --warn-bg: #f6ead2;
  --fehler: #9b2c2c;
  --fehler-bg: #f6dcdc;
  --ziel: #6fbf3f;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.09);
  --radius: 26px;
  --radius-klein: 16px;
  --abstand: 16px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --tempo: 180ms;
  color-scheme: light;
}

:root[data-thema="dunkel"] {
  --bg: #151714;
  --bg-alt: #10120f;
  --bg-top: #1b1e1a;
  --panel: rgba(32, 36, 31, 0.78);
  --panel-strong: rgba(38, 42, 37, 0.94);
  --panel-rand: rgba(255, 255, 255, 0.06);
  --ink: #eceee6;
  --muted: #a5a99d;
  --line: rgba(236, 238, 230, 0.12);
  --lcd: #3c4a32;
  --lcd-hell: #2a3324;
  --lcd-ink: #d6e4c2;
  --accent: #a3b37f;
  --knopf: #e9ebe2;
  --knopf-ink: #131512;
  --warn: #e0b05a;
  --warn-bg: #3a3020;
  --fehler: #f0a0a0;
  --fehler-bg: #3e2424;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) {
    --bg: #151714;
    --bg-alt: #10120f;
    --bg-top: #1b1e1a;
    --panel: rgba(32, 36, 31, 0.78);
    --panel-strong: rgba(38, 42, 37, 0.94);
    --panel-rand: rgba(255, 255, 255, 0.06);
    --ink: #eceee6;
    --muted: #a5a99d;
    --line: rgba(236, 238, 230, 0.12);
    --lcd: #3c4a32;
    --lcd-hell: #2a3324;
    --lcd-ink: #d6e4c2;
    --accent: #a3b37f;
    --knopf: #e9ebe2;
    --knopf-ink: #131512;
    --warn: #e0b05a;
    --warn-bg: #3a3020;
    --fehler: #f0a0a0;
    --fehler-bg: #3e2424;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(135, 149, 106, 0.14), transparent 28%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 48%, var(--bg-alt) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  line-height: 1.5;
}

body::before {               /* die feine Rasterung des Papiers */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
  background-size: 20px 20px;
}

a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1; letter-spacing: -0.05em; }
h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); letter-spacing: -0.03em; }
h3 { font-size: 1.05rem; }
.mono { font-family: var(--mono); }
.leise { color: var(--muted); }
.klein { font-size: 0.86rem; }

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
}

/* ── Seite ── */
.seite {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 12px 0 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}
.seite > *, .raster > * { min-width: 0; }

/* ── Barra: Logo und Menü ── */
.barra {
  position: sticky;
  top: 8px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  flex-wrap: wrap;
}
.barra .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; }
.barra .logo img { width: 32px; height: 32px; }
.barra .logo strong { font-size: 1.05rem; letter-spacing: -0.02em; }
.barra .logo span { display: block; font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.barra nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; min-width: 0; max-width: 100%; scrollbar-width: none; }
.barra nav a, .barra nav button {
  font-family: var(--mono);
  font-size: 0.8rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  color: var(--muted);
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background var(--tempo), color var(--tempo);
}
.barra nav a:hover, .barra nav button:hover { color: var(--ink); background: var(--line); }
.barra nav a[aria-current="page"] { background: var(--knopf); color: var(--knopf-ink); }

/* ── Paneele, Karten ── */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-rand);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}
.karte { padding: 20px; display: grid; gap: 14px; align-content: start; }
.kopf { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.raster { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .raster.zwei { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); } }

/* ── Das Gerät: «Diagnostik Terminal» mit drei Lämpchen ── */
.geraet { padding: 16px; display: grid; gap: 14px; }
.geraet-kopf {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.85rem;
  gap: 12px;
}
.lichter { display: flex; gap: 8px; }
.lichter span { width: 11px; height: 11px; border-radius: 50%; background: var(--ink); opacity: 0.8; }
.lichter span:nth-child(2) { opacity: 0.5; }
.lichter span:nth-child(3) { opacity: 0.3; }
.lichter.an span:first-child { background: var(--ziel); opacity: 1; animation: puls 1.4s ease-in-out infinite; }
@keyframes puls { 50% { opacity: 0.35; } }

/* ── Bildschirm mit Vorschau ── */
.vorschau {
  position: relative;
  min-height: 300px;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--panel-strong), var(--bg-alt));
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  touch-action: manipulation;
}
.vorschau.ziehen { outline: 3px dashed var(--accent); outline-offset: -10px; }
.vorschau .flaeche { position: relative; width: 100%; line-height: 0; }
.vorschau .flaeche img { width: 100%; height: auto; display: block; user-select: none; -webkit-user-drag: none; }
.platzhalter { display: grid; gap: 8px; text-align: center; padding: 28px; }
.platzhalter p { font-size: 1.15rem; font-weight: 600; }
.platzhalter span { color: var(--muted); }

.rahmen {
  position: absolute;
  border: 2px solid var(--ziel);
  border-radius: 6px;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.12);
  touch-action: none;
  cursor: move;
  transition: box-shadow var(--tempo);
}
.rahmen .griff {
  position: absolute;
  right: -14px;
  bottom: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ziel);
  border: 3px solid #fff;
  cursor: nwse-resize;
}
.rahmen.fest { box-shadow: none; cursor: default; }
.nachbarin {
  position: absolute;
  border: 2px solid rgba(110, 110, 110, 0.95);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  padding: 0;
  min-width: 24px;
  min-height: 24px;
}
.nachbarin.aus { border-style: dashed; opacity: 0.45; }
.kernumriss { position: absolute; border: 1.5px dotted var(--ziel); border-radius: 50%; pointer-events: none; }

/* ── Knöpfe: ein Knopf ist ein Verb; mindestens 44 px ── */
.knopf {
  appearance: none;
  font-family: var(--mono);
  font-size: 0.92rem;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--knopf);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--tempo), background var(--tempo), color var(--tempo), opacity var(--tempo);
}
.knopf:hover { transform: translateY(-1px); }
.knopf:active { transform: scale(0.98); }
.knopf:focus-visible, .barra nav a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.knopf:disabled { cursor: not-allowed; opacity: 0.45; transform: none; }
.knopf.primaer { background: var(--knopf); color: var(--knopf-ink); }
.knopf.lcd { background: var(--lcd); border-color: rgba(38, 48, 34, 0.2); color: var(--lcd-ink); }
.knopf.leise { border-color: var(--line); background: var(--panel-strong); }
.knopf.klein { min-height: 44px; padding: 6px 14px; font-size: 0.82rem; }
.knopfreihe { display: flex; gap: 10px; flex-wrap: wrap; }
.knopfreihe > .knopf { flex: 1 1 140px; }

/* ── Chips (Herkunft, Art; ein Tipp ändert) ── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-family: var(--mono);
  font-size: 0.8rem;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
}
select.chip { cursor: pointer; }
.marke {
  font-family: var(--mono);
  font-size: 0.74rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--line);
  white-space: nowrap;
}
.marke.geeignet { background: var(--lcd); color: var(--lcd-ink); }
.marke.eingeschraenkt { background: var(--warn-bg); color: var(--warn); }
.marke.ungeeignet { background: var(--fehler-bg); color: var(--fehler); }

/* ── Terminal (LCD) ── */
.terminal {
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--lcd-hell) 0%, var(--lcd) 100%);
  border: 1px solid rgba(38, 48, 34, 0.16);
  color: var(--lcd-ink);
  font-family: var(--mono);
}
.terminal-kopf {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.25);
  border-bottom: 1px solid rgba(38, 48, 34, 0.12);
  font-size: 0.85rem;
}
.terminal-kopf .pille { border-radius: 999px; padding: 4px 10px; background: rgba(38, 48, 34, 0.1); }
.terminal-koerper { display: grid; gap: 8px; padding: 14px 16px; min-height: 64px; }
.zeile {
  display: flex;
  gap: 12px;
  align-items: start;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(38, 48, 34, 0.2);
  font-size: 0.9rem;
  animation: auf 260ms ease-out both;
}
.zeile:last-child { border-bottom: 0; }
.zeile > span { flex: 0 0 150px; opacity: 0.72; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }
.zeile > strong, .zeile > p { flex: 1; font-weight: 500; }
.zeile.ungeeignet > strong { color: var(--fehler); }
.zeile.eingeschraenkt > strong { color: var(--warn); }
.zeile.laeuft > strong::after { content: "▍"; animation: puls 1s steps(2) infinite; }
@keyframes auf { from { opacity: 0; transform: translateY(4px); } }
.balken { position: relative; height: 2px; overflow: hidden; background: rgba(38, 48, 34, 0.12); }
.balken::after { content: ""; position: absolute; left: -60%; width: 60%; height: 100%; background: var(--lcd-ink); animation: scan 1.6s ease-in-out infinite; }
@keyframes scan { to { left: 110%; } }

/* ── Formulare: jedes Feld mit Beschriftung ── */
.formular { display: grid; gap: 14px; }
.feld { display: grid; gap: 6px; }
.feld label { font-weight: 600; font-size: 0.92rem; }
.feld .hilfe { color: var(--muted); font-size: 0.82rem; }
.feld .fehler, .formfehler { color: var(--fehler); font-size: 0.86rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"], select, textarea {
  font: inherit;
  min-height: 44px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
}
.haken { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.haken input { width: 22px; height: 22px; accent-color: var(--accent); }
.suche { display: flex; gap: 8px; flex-wrap: wrap; }
.suche input { flex: 1 1 200px; }

/* ── Tabellen in einer Box, die waagrecht scrollt ── */
.tabelle-box { overflow-x: auto; border-radius: var(--radius-klein); border: 1px solid var(--line); background: var(--panel-strong); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-family: var(--mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
td.daumen { width: 64px; }
td.daumen img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; display: block; }

/* ── Fallliste als Karten am Handy ── */
.faelle { display: grid; gap: 10px; }
.fallzeile {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius-klein);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: transform var(--tempo);
}
.fallzeile:hover { transform: translateY(-1px); }
.fallzeile img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; background: var(--bg-alt); }
.fallzeile .titel { font-family: var(--mono); font-weight: 600; }

/* ── Leere Zustände und Meldungen ── */
.leer { text-align: center; padding: 28px 16px; display: grid; gap: 10px; justify-items: center; color: var(--muted); }
.leer strong { color: var(--ink); font-size: 1.05rem; }
.meldungen { display: grid; gap: 8px; }
.meldung {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-radius: var(--radius-klein);
  background: var(--lcd);
  color: var(--lcd-ink);
  animation: auf 260ms ease-out both;
}
.meldung.error { background: var(--fehler-bg); color: var(--fehler); }
.meldung.warning { background: var(--warn-bg); color: var(--warn); }
.meldung form { margin: 0; }
.hinweisbox { padding: 12px 16px; border-radius: var(--radius-klein); background: var(--warn-bg); color: var(--ink); }
.hinweisbox a { font-weight: 600; }

/* ── Der Hinweis unten auf jeder Seite ── */
.fuss { padding: 14px 20px; background: var(--panel-strong); }
.fuss p { max-width: 900px; margin: 0 auto; text-align: center; font-size: 0.86rem; line-height: 1.6; color: var(--muted); }

.liste-kurz { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.zentriert { width: min(460px, 100%); margin: 6vh auto 0; }
.versteckt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 600px) {
  .seite { width: calc(100% - 16px); gap: 12px; }
  .karte, .geraet { padding: 14px; }
  .zeile { flex-direction: column; gap: 2px; }
  .zeile > span { flex: none; }
  .barra .logo span { display: none; }
  .barra nav { margin-left: 0; flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
