/* Tool-Finder – mobil zuerst, eine Spalte, Schrift ab 16 px, Knöpfe ab 44 px (DEV_SPEC 14.5) */

:root {
  --text: #0f172a;
  --text-leise: #475569;
  --grund: #eef2f9;
  --flaeche: #ffffff;
  --rand: #d6dde8;
  --primaer: #1d4ed8;
  --primaer-dunkel: #1e3a8a;
  --primaer-hell: #e0e9ff;
  --verlauf: linear-gradient(120deg, #1e3a8a 0%, #1d4ed8 55%, #0e7490 100%);
  --mikrofon: #c2410c;
  --mikrofon-hell: #ffedd5;
  --fokus: #f59e0b;
  --fehler: #9b1c1c;
  --fehler-grund: #fdecea;
  --gruen: #166534;
  --gruen-grund: #dcfce7;
  --gelb: #854d0e;
  --gelb-grund: #fef3c7;
  --rot: #991b1b;
  --rot-grund: #fee2e2;
  --grau: #374151;
  --grau-grund: #e5e7eb;
  --radius: 14px;
  --schatten: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 14px rgba(15, 23, 42, 0.07);
  --nav-hoehe: 4.75rem;
  --gross: clamp(1.75rem, 7.5vw, 2.25rem); /* Bezeichnung und Lagerplatz gleich groß */
  /* Farben der drei Bereiche */
  --farbe-chat: #1d4ed8;
  --farbe-chat-hell: #e0e9ff;
  --farbe-suche: #0f766e;
  --farbe-suche-hell: #ccfbf1;
  --farbe-entnahmen: #c2410c;
  --farbe-entnahmen-hell: #ffedd5;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.125rem;
  line-height: 1.45;
  color: var(--text);
  background: var(--grund);
}

body.mit-navigation {
  padding-bottom: calc(var(--nav-hoehe) + env(safe-area-inset-bottom, 0px));
}

h1,
h2 {
  line-height: 1.2;
}

h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0.5rem 0 0.75rem;
}

h1:focus {
  outline: none;
}

a {
  color: var(--primaer);
}

:focus-visible {
  outline: 3px solid var(--fokus);
  outline-offset: 2px;
}

/* Symbole: Linien in Textfarbe */
.symbole {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* Kopfzeile */
.kopf {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  padding-top: calc(0.6rem + env(safe-area-inset-top, 0px));
  color: #fff;
  background: var(--primaer-dunkel);
  background: var(--verlauf);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.2);
}

.kopf p {
  margin: 0;
}

.kopf-titel {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.15;
  white-space: nowrap;
}

.kopf-logo {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.35rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  stroke-width: 2.4;
}

.kopf-ort {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  opacity: 0.85;
}

.kopf-kuerzel {
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.kopf .knopf-leise {
  min-height: 2.75rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.95rem;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}

@media (max-width: 22.5rem) {
  .kopf-ort {
    display: none;
  }
}

/* Inhalt */
.inhalt {
  flex: 1;
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0.9rem 1rem 1.5rem;
}

.hinweis,
.status-zeile {
  color: var(--text-leise);
  margin: 0.5rem 0;
}

.status-zeile {
  font-weight: 600;
}

.status-zeile:empty {
  display: none;
}

.meldung,
.fehler {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--fehler-grund);
  color: var(--fehler);
  border: 1px solid #f3b8b4;
  font-weight: 600;
}

/* Anmeldung */
.anmelde-karte {
  margin-top: 1rem;
  padding: 1.25rem 1.25rem 1.5rem;
  border-radius: 20px;
  background: var(--flaeche);
  box-shadow: var(--schatten);
  border-top: 6px solid var(--primaer);
}

/* Formulare */
.formular {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feld-label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.feld {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.6rem 0.9rem;
  font: inherit;
  color: var(--text);
  background: var(--flaeche);
  border: 2px solid var(--rand);
  border-radius: var(--radius);
}

.feld:focus-visible {
  border-color: var(--primaer);
  outline-offset: 0;
}

.feld-kuerzel {
  max-width: 12rem;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.kontrollkaestchen {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  cursor: pointer;
}

.kontrollkaestchen input {
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  accent-color: var(--primaer);
}

/* Suche */
.such-zeile {
  display: flex;
  gap: 0.5rem;
}

.such-feld {
  position: relative;
  flex: 1;
  min-width: 0;
}

.such-feld .feld {
  padding-left: 2.75rem;
  border-color: #b9c3d3;
  box-shadow: var(--schatten);
}

.such-feld .feld:focus-visible {
  border-color: var(--farbe-suche);
}

.such-feld:has(.knopf-im-feld:not([hidden])) .feld {
  padding-right: 3.5rem;
}

.such-symbol {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--farbe-suche);
  pointer-events: none;
}

.knopf-im-feld {
  position: absolute;
  right: 0.3rem;
  top: 50%;
  transform: translateY(-50%);
}

#ansicht-suche h1 {
  color: var(--farbe-suche);
}

#ansicht-suche .knopf {
  background: var(--farbe-suche);
  border-color: var(--farbe-suche);
}

#ansicht-suche .knopf:hover {
  background: #115e59;
}

#ansicht-entnahmen h1 {
  color: var(--farbe-entnahmen);
}

/* Knöpfe */
.knopf {
  min-height: 3rem;
  padding: 0.6rem 1.25rem;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--primaer);
  border: 2px solid var(--primaer);
  border-radius: var(--radius);
  cursor: pointer;
}

.knopf:hover {
  background: var(--primaer-dunkel);
}

.knopf:disabled {
  opacity: 0.6;
  cursor: progress;
}

.such-zeile .knopf {
  min-height: 3.25rem;
}

.formular .knopf {
  align-self: flex-start;
  min-width: 10rem;
}

.knopf-leise {
  min-height: 2.75rem;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primaer);
  background: transparent;
  border: 2px solid currentColor;
  border-radius: var(--radius);
  cursor: pointer;
}

.knopf-zweit {
  min-height: 3rem;
  padding: 0.6rem 1.25rem;
  font: inherit;
  font-weight: 700;
  color: var(--primaer);
  background: var(--flaeche);
  border: 2px solid var(--primaer);
  border-radius: var(--radius);
  cursor: pointer;
}

.knopf-zweit:hover {
  background: var(--primaer-hell);
}

.knopf-zweit:disabled {
  opacity: 0.5;
  cursor: default;
}

.knopf-rund {
  display: inline-grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  color: #fff;
  background: var(--primaer);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.knopf-rund:hover {
  background: var(--primaer-dunkel);
}

.knopf-rund:disabled {
  opacity: 0.55;
  cursor: progress;
}

.knopf-rund svg {
  stroke-width: 2.4;
}

.knopf-mikrofon {
  color: var(--mikrofon);
  background: var(--mikrofon-hell);
}

.knopf-mikrofon:hover {
  background: #fed7aa;
}

.knopf-im-feld {
  width: 2.6rem;
  height: 2.6rem;
}

/* Aufnahme läuft */
.knopf-mikrofon[aria-pressed="true"] {
  color: #fff;
  background: var(--mikrofon);
  animation: hoeren 1.2s ease-in-out infinite;
}

@keyframes hoeren {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(194, 65, 12, 0.45);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(194, 65, 12, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .knopf-mikrofon[aria-pressed="true"] {
    animation: none;
    box-shadow: 0 0 0 4px rgba(194, 65, 12, 0.35);
  }
}

/* Karten */
.karten {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.karte {
  position: relative;
  overflow: hidden;
  padding: 1rem 1.1rem 1.1rem 1.4rem;
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: 18px;
  box-shadow: var(--schatten);
}

.karte::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: var(--status, var(--grau));
}

.karte-kopf {
  margin-bottom: 0.6rem;
}

.karte-titel {
  margin: 0;
  font-size: var(--gross);
  font-weight: 800;
  line-height: 1.1;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.karte-meta {
  margin: 0.3rem 0 0;
  font-size: 1rem;
  color: var(--text-leise);
}

.karte-eigenschaften {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  color: var(--text);
}

.karte-ort {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.85rem;
  margin: 0.6rem 0 0.75rem;
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
  background: var(--primaer-hell);
  color: var(--primaer-dunkel);
}

.karte-code {
  margin: 0;
  font-size: var(--gross);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.karte-ort-text {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.karte-zustand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
}

.karte-zustand p {
  margin: 0;
}

.karte-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  font-weight: 700;
  color: var(--status-text, var(--grau));
  background: var(--status-grund, var(--grau-grund));
}

.status-punkt {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: currentColor;
}

.karte-menge,
.karte-seit,
.karte-seit {
  flex-basis: 100%;
}

.karte-knoepfe:empty {
  display: none;
}

.karte-knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.karte-knoepfe .knopf,
.karte-knoepfe .knopf-zweit {
  flex: 1 1 auto;
  min-height: 2.75rem;
  padding: 0.4rem 0.9rem;
  font-size: 1rem;
}

.status-verfuegbar,
.status-vorraetig {
  --status: #16a34a;
  --status-text: var(--gruen);
  --status-grund: var(--gruen-grund);
}

.status-teilweise_verfuegbar {
  --status: #d97706;
  --status-text: var(--gelb);
  --status-grund: var(--gelb-grund);
}

.status-ausgeliehen,
.status-nicht_am_platz {
  --status: #dc2626;
  --status-text: var(--rot);
  --status-grund: var(--rot-grund);
}

.status-nicht_verfuegbar,
.status-aufgebraucht,
.status-unbekannt {
  --status: #6b7280;
  --status-text: var(--grau);
  --status-grund: var(--grau-grund);
}

.leer {
  margin: 0.5rem 0;
  padding: 1.25rem 1rem;
  text-align: center;
  font-weight: 700;
  color: var(--text-leise);
  background: var(--flaeche);
  border: 2px dashed var(--rand);
  border-radius: var(--radius);
}

/* Chat (V2) */
.nur-vorleser {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.chat-start {
  margin: 0.75rem 0 1rem;
  padding: 1.1rem 1.1rem 1.2rem;
  border-radius: 18px;
  background: var(--flaeche);
  box-shadow: var(--schatten);
  border-top: 6px solid var(--farbe-chat);
}

.chat-start-titel {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--farbe-chat);
}

.chat-start .optionen {
  margin-top: 0.75rem;
}

.chat-verlauf {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding-bottom: 0.5rem;
}

.chat-beitrag {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.blase {
  max-width: 85%;
  margin: 0;
  padding: 0.7rem 1rem;
  border-radius: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.blase-nutzer {
  align-self: flex-end;
  color: #fff;
  background: var(--primaer);
  background: var(--verlauf);
  border-bottom-right-radius: 6px;
}

.blase-assistent {
  align-self: flex-start;
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-bottom-left-radius: 6px;
  box-shadow: var(--schatten);
}

.blase-warten {
  color: var(--text-leise);
  font-style: italic;
}

.optionen,
.aktionen {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.knopf-option {
  min-height: 2.75rem;
  padding: 0.4rem 1rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primaer);
  background: var(--primaer-hell);
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}

.knopf-option:hover {
  border-color: var(--primaer);
}

.knopf-option:disabled {
  opacity: 0.5;
  cursor: default;
}

.chat-form {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 0.75rem -1rem 0;
  padding: 0.6rem 1rem 0.5rem;
  background: linear-gradient(to bottom, rgba(238, 242, 249, 0), var(--grund) 0.75rem);
}

.mit-navigation .chat-form {
  bottom: calc(var(--nav-hoehe) + env(safe-area-inset-bottom, 0px));
}

.chat-zeile {
  display: flex;
  gap: 0.4rem;
  align-items: flex-end;
  padding: 0.35rem 0.35rem 0.35rem 0.5rem;
  background: var(--flaeche);
  border: 2px solid #b9c3d3;
  border-radius: 26px;
  box-shadow: var(--schatten);
}

.chat-zeile:focus-within {
  border-color: var(--farbe-chat);
}

.chat-eingabe {
  flex: 1;
  min-width: 0;
  min-height: 3rem;
  max-height: 9rem;
  padding: 0.65rem 0.5rem;
  font: inherit;
  color: var(--text);
  background: transparent;
  border: none;
  resize: none;
  overflow-y: hidden;
}

.chat-eingabe:focus-visible {
  outline: none;
}

.chat-hinweis {
  margin: 0.4rem 0.5rem 0;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--text-leise);
}

/* Fußzeile und Navigation */
.fuss {
  padding: 1rem;
  text-align: center;
  font-size: 1rem;
}

.navigation {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  min-height: var(--nav-hoehe);
  padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  background: var(--flaeche);
  border-top: 1px solid var(--rand);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
}

.nav-knopf {
  --farbe: var(--farbe-chat);
  --farbe-hell: var(--farbe-chat-hell);
  flex: 1;
  max-width: 11rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.2rem 0.25rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-leise);
  background: none;
  border: none;
  border-radius: 16px;
  cursor: pointer;
}

.nav-suche {
  --farbe: var(--farbe-suche);
  --farbe-hell: var(--farbe-suche-hell);
}

.nav-entnahmen {
  --farbe: var(--farbe-entnahmen);
  --farbe-hell: var(--farbe-entnahmen-hell);
}

.nav-symbol {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 2.1rem;
  border-radius: 999px;
  color: var(--farbe);
  transition: background-color 0.15s;
}

.nav-symbol svg {
  width: 1.6rem;
  height: 1.6rem;
}

.nav-knopf:hover .nav-symbol {
  background: var(--farbe-hell);
}

.nav-knopf[aria-current="page"] {
  color: var(--farbe);
}

.nav-knopf[aria-current="page"] .nav-symbol {
  color: #fff;
  background: var(--farbe);
}

.nav-knopf[aria-current="page"] .nav-symbol svg {
  stroke-width: 2.4;
}

/* Dialoge */
.dialog {
  width: min(32rem, calc(100vw - 2rem));
  padding: 1.25rem;
  border: none;
  border-radius: 20px;
  color: var(--text);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.dialog h2 {
  margin-top: 0;
}

.dialog .knopf {
  width: 100%;
  margin-top: 0.5rem;
}

.dialog-inhalt p {
  margin: 0.4rem 0;
}

.dialog-code {
  margin: 0.25rem 0 0;
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  color: var(--primaer-dunkel);
}

.dialog-leise {
  color: var(--text-leise);
}

.dialog-hervor {
  margin-top: 0.75rem;
  font-weight: 700;
}

.dialog-knoepfe {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.dialog-knoepfe .knopf,
.dialog-knoepfe .knopf-zweit {
  width: 100%;
  margin: 0;
}

.menge-zeile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.menge-zeile .feld {
  width: 6rem;
  text-align: center;
  font-weight: 700;
}

.auswahl {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.5rem 0;
  padding: 0;
  border: none;
}

.auswahl label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  cursor: pointer;
}

.auswahl input {
  width: 1.4rem;
  height: 1.4rem;
  margin: 0;
  accent-color: var(--primaer);
}

.auswahl-frage {
  padding: 0;
  margin-bottom: 0.25rem;
  font-weight: 700;
}

/* Kurze Optionen nebeneinander, z. B. „Genug · Wenig · Leer“ */
.auswahl-quer {
  flex-direction: row;
  flex-wrap: wrap;
  column-gap: 1rem;
}

.auswahl-quer label {
  gap: 0.5rem;
}

.dialog textarea.feld {
  min-height: 5rem;
  resize: vertical;
}

.toast {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  max-width: 38rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  color: #fff;
  background: #0f172a;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  font-weight: 600;
}

.mit-navigation .toast {
  bottom: calc(var(--nav-hoehe) + 1rem + env(safe-area-inset-bottom, 0px));
}

/* Seite Datenschutz */
.text-seite h2 {
  font-size: 1.2rem;
  margin-top: 1.5rem;
}

@media (min-width: 40rem) {
  .inhalt {
    padding-top: 1.25rem;
  }
}
