/* ==========================================================================
   Instrumentenverwaltung – Harmonie Useldange
   Aufbau: 1 Grundlagen · 2 Kopf · 3 Layout · 4 Tabellen · 5 Badges & Status
           6 Formulare & Knöpfe · 7 Meldungen · 8 Seiten-Bausteine · 9 Mobil · 10 Druck
   ========================================================================== */

/* 1 Grundlagen ------------------------------------------------------------ */
:root {
  --akzent: #7a1f2b;
  --akzent-hell: #f6e9eb;
  --logo-orange: #f2a93b;
  --text: #1f2328;
  --leise: #6a737d;
  --rand: #dfe2e6;
  --flaeche: #ffffff;
  --hinter: #f4f5f7;
  --gruen: #1f7a3d;  --gruen-bg: #e5f4ea;
  --rot: #b42318;    --rot-bg: #fdecea;
  --gelb: #8a5a00;   --gelb-bg: #fff4d6;
  --blau: #1d4f91;   --blau-bg: #e6eefa;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--hinter); }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0 .6rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
small, .klein { font-size: .85em; }
.leise { color: var(--leise); }
.rechts { text-align: right; }
.nowrap { white-space: nowrap; }
section[id] { scroll-margin-top: 1rem; }

/* 2 Kopf ------------------------------------------------------------------ */
.kopf { background: var(--akzent); color: #fff; border-bottom: 3px solid var(--logo-orange); }
.kopf-innen { max-width: 1200px; margin: 0 auto; padding: .55rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem; }
.marke { color: #fff; display: flex; align-items: center; gap: .7rem; }
.marke:hover { text-decoration: none; }
.marke-zeichen { font-size: 1.7rem; line-height: 1; }
.marke-logo-feld { background: #fff; border-radius: 8px; padding: 3px 6px; line-height: 0; }
.marke-logo { height: 44px; width: auto; }
.marke strong { display: block; font-size: 1.05rem; }
.marke small { display: block; opacity: .85; font-size: .8rem; }
.schnellsuche { margin-left: auto; }
.kopf .schnellsuche input[type=search][name] { width: 200px; padding: .35rem .6rem; border: none; border-radius: 6px; background: rgba(255,255,255,.18); color: #fff; }
.schnellsuche input::placeholder { color: rgba(255,255,255,.75); }
.kopf .schnellsuche input[type=search][name]:focus { background: #fff; color: var(--text); outline: none; }
.kopf nav { display: flex; flex-wrap: wrap; gap: .15rem; flex-basis: 100%; }
.kopf nav a { color: #fff; padding: .4rem .7rem; border-radius: 6px; opacity: .9; }
.kopf nav a:hover, .kopf nav a.aktiv { background: rgba(255,255,255,.16); opacity: 1; text-decoration: none; }
.kopf nav a.abmelden { opacity: .7; font-size: .9em; margin-left: auto; }

/* 3 Layout ---------------------------------------------------------------- */
main { max-width: 1200px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.karte.leer { text-align: center; padding: 2rem; }
.karte.gefahr { border-color: #f1c4c0; }
.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 1rem; align-items: start; }
.seitenkopf { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .6rem; }
.brotkrumen { margin: 0; color: var(--leise); font-size: .9rem; }
.nr-gross { color: var(--akzent); font-variant-numeric: tabular-nums; margin-right: .3rem; }
.gross { font-size: 1.25rem; margin: 0 0 .5rem; }
.notiz { background: var(--hinter); border-radius: 6px; padding: .6rem .8rem; margin-top: .8rem; font-size: .92em; }
.trenner { border-top: 1px solid var(--rand); padding-top: .9rem; margin-top: 1rem; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.kachel { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: .8rem 1rem; color: var(--text); }
a.kachel:hover { border-color: var(--akzent); text-decoration: none; }
.kachel b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kachel span { color: var(--leise); font-size: .88rem; }
.kachel.warnung { border-color: #f0c36d; background: var(--gelb-bg); }
.druck-kacheln .kachel b { font-size: 1.4rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; border-bottom: 2px solid var(--rand); margin: 0 0 1rem; }
.tabs a { padding: .5rem .9rem; border-radius: 7px 7px 0 0; color: var(--leise); margin-bottom: -2px; border-bottom: 2px solid transparent; }
.tabs a.aktiv { color: var(--akzent); border-bottom-color: var(--akzent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--akzent); }

/* 4 Tabellen & Listen ----------------------------------------------------- */
.tabelle-rahmen { overflow-x: auto; background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); }
.karte .tabelle-rahmen { border: none; margin: 0 -1.2rem -1.1rem; border-radius: 0 0 var(--radius) var(--radius); border-top: 1px solid var(--rand); }
.karte .tabelle-rahmen + p { margin-top: 1.8rem; }
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th, .tabelle td { padding: .55rem .75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rand); }
.tabelle th { background: #fafbfc; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--leise); white-space: nowrap; }
.tabelle th a { color: inherit; }
.tabelle th a.sortiert { color: var(--akzent); }
.tabelle th a.sortiert::after { content: " ▾"; }
.tabelle tbody tr:last-child td { border-bottom: none; }
.tabelle tr.klickbar { cursor: pointer; }
.tabelle tr.klickbar:hover td { background: var(--akzent-hell); }
.tabelle tr.inaktiv td { color: var(--leise); }
.tabelle td.nr { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
tr.summe td { font-weight: 700; border-top: 2px solid var(--rand); }
.anzahl { color: var(--leise); font-size: .88rem; margin: .2rem 0 .5rem; }
.daten { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.daten dt { color: var(--leise); }
.daten dd { margin: 0; }
.liste { list-style: none; padding: 0; margin: 0; }
.liste li { padding: .45rem 0; border-bottom: 1px solid var(--rand); }
.liste li:last-child { border-bottom: none; }
.verlauf { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.verlauf li { padding: .35rem 0; border-bottom: 1px solid var(--rand); }
.verlauf li:last-child { border-bottom: none; }
.verlauf .leise { display: inline-block; min-width: 13rem; }
.nr-link { font-variant-numeric: tabular-nums; white-space: nowrap; margin-right: .3rem; }

/* 5 Badges & Status ------------------------------------------------------- */
.badge { display: inline-block; padding: .08rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.badge.klein { font-size: .7rem; padding: 0 .4rem; }
.badge.gruen { background: var(--gruen-bg); color: var(--gruen); }
.badge.rot   { background: var(--rot-bg);   color: var(--rot); }
.badge.gelb  { background: var(--gelb-bg);  color: var(--gelb); }
.badge.blau  { background: var(--blau-bg);  color: var(--blau); }
.badge.grau  { background: #eceef1; color: #4b535c; }
.rev-faellig { color: var(--rot); font-weight: 600; }
.rev-bald { color: var(--gelb); font-weight: 600; }

/* 6 Formulare & Knöpfe ---------------------------------------------------- */
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid #c9ced4; border-radius: 7px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: -1px; border-color: transparent; }
input.schmal, select.schmal { width: auto !important; padding: .25rem .4rem !important; } /* überschreibt die Standardbreite */
.filterleiste { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.filterleiste input, .filterleiste select { width: auto; }
.filterleiste input[type=search] { flex: 1 1 260px; }
.formular label { display: block; margin-bottom: .8rem; font-size: .9rem; color: #3b4148; }
.formular label > input, .formular label > select, .formular label > textarea { margin-top: .25rem; }
.formular.kompakt label { margin-bottom: .6rem; }
.zeile { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 .8rem; }
.groessen { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.checkbox { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; }
.knopfleiste { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.eingerueckt { margin-top: .8rem; padding: .9rem; background: var(--hinter); border-radius: 8px; }
details { margin-bottom: 1rem; }
details > summary { list-style: none; display: inline-block; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.inline-details { display: inline-block; margin: 0; }
.inline-details[open] { display: block; width: 100%; }
form.inline { display: inline; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.inline-form input { max-width: 320px; }
.ohne-abstand { margin: 0; }
.knopf { display: inline-block; padding: .5rem .95rem; border-radius: 7px; border: 1px solid #c9ced4; background: #fff; cursor: pointer; color: var(--text); font-weight: 500; white-space: nowrap; }
.knopf:hover { border-color: var(--akzent); text-decoration: none; }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.primaer:hover { filter: brightness(1.1); }
.knopf.leise { border-color: transparent; background: transparent; color: var(--leise); }
.knopf.gefahr { color: var(--rot); border-color: #f1c4c0; }
.knopf.klein-knopf { padding: .25rem .6rem; font-size: .85rem; }
.knopf:disabled { opacity: .6; cursor: wait; }
.knopf-mini { display: inline-block; border: 1px solid var(--rand); background: #fff; border-radius: 5px; padding: 0 .4rem; cursor: pointer; font-size: .85rem; color: var(--leise); line-height: 1.6; }
.knopf-mini:hover { color: var(--rot); border-color: currentColor; text-decoration: none; }
.knopf-mini.ok { color: var(--gruen); border-color: #b7e0c3; }

/* 7 Meldungen ------------------------------------------------------------- */
.meldung { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.meldung.ok { background: var(--gruen-bg); border-color: #b7e0c3; color: #14532d; }
.meldung.fehler { background: var(--rot-bg); border-color: #f1c4c0; color: #7a1a12; }
.meldung.warnung { background: var(--gelb-bg); border-color: #f0c36d; color: #5c3d00; }
.meldung ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.hinweis { color: var(--leise); }

/* 8 Seiten-Bausteine ------------------------------------------------------ */
/* Anmeldung */
.login-box { max-width: 400px; margin: 2rem auto 3rem; }
.login-logo { display: block; width: 260px; max-width: 80%; height: auto; margin: 2rem auto 0; }
/* Startseite */
.handlungsbedarf { border-color: #f1c4c0; }
.handlungsbedarf summary { cursor: pointer; }
.todo-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 1.5rem; margin-top: .5rem; }
.todo-raster h3 { margin: .8rem 0 .2rem; font-size: .95rem; }
/* Artikelseite */
.titelbild { float: right; margin: 0 0 .6rem .9rem; }
.titelbild img { width: 140px; height: 105px; object-fit: cover; border-radius: 8px; border: 1px solid var(--rand); }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.galerie figure { margin: 0; }
.galerie img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--rand); display: block; background: var(--hinter); }
.galerie figcaption { font-size: .8rem; color: var(--leise); margin-top: .3rem; }
.pruef-karte { border-color: #b7cdf0; background: var(--blau-bg); }
.pruef-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
/* Mitgliedsseite */
.rueckgabe-zeile { display: grid; grid-template-columns: auto 1fr auto auto; gap: .6rem; align-items: center; }
.auswahl-liste { max-height: 420px; overflow-y: auto; margin: .5rem 0 .9rem; }
.auswahl-liste tr.passend td { background: var(--gruen-bg); }
.auswahl-liste label { cursor: pointer; }
/* Bestandsprüfung */
.fortschritt { height: 12px; background: var(--hinter); border-radius: 99px; overflow: hidden; margin-bottom: .6rem; }
.fortschritt div { height: 100%; background: var(--gruen); border-radius: 99px; transition: width .3s; }
.pruef-knoepfe { display: flex; gap: .25rem; }
.pruef-knoepfe .knopf-mini { font-size: 1rem; padding: .1rem .5rem; }
/* Uniformen */
.matrix td { min-width: 7rem; font-size: .88rem; }
.zelle-ok { background: var(--gruen-bg); }
.zelle-verfuegbar { background: var(--blau-bg); }
.zelle-kein { background: var(--rot-bg); }
.zelle-unbekannt { background: #f7f7f8; }
/* Verwaltung */
.benutzer-zeile { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.rollen { padding-left: 1.1rem; margin: 0; }
.rollen li { margin-bottom: .4rem; }
pre.code, pre.vorschau { padding: .7rem .9rem; border-radius: 8px; overflow-x: auto; font-size: .82rem; white-space: pre-wrap; }
pre.code { background: #1f2328; color: #e6edf3; word-break: break-all; }
pre.vorschau { background: var(--hinter); color: var(--text); font-family: ui-monospace, Consolas, monospace; }
/* Hilfe */
.hilfe .inhalt ol { columns: 2; margin: .5rem 0 0; }
.hilfe section h2 { color: var(--akzent); }
.hilfe p, .hilfe li { max-width: 75ch; }
.faq dt { font-weight: 600; margin-top: .7rem; }
.faq dd { margin: .2rem 0 0 0; color: #3b4148; }
.pdf-hinweis { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }

/* 9 Mobil ----------------------------------------------------------------- */
@media (max-width: 900px) {
  .kopf-innen { gap: .4rem .8rem; }
  .marke-logo { height: 36px; }
  .schnellsuche { order: 2; flex: 1 1 100%; margin-left: 0; }
  .kopf .schnellsuche input[type=search][name] { width: 100%; }
  .kopf nav { order: 3; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .kopf nav a { white-space: nowrap; }
  .kopf nav a.abmelden { margin-left: 0; }
  .hilfe .inhalt ol { columns: 1; }
  .rueckgabe-zeile { grid-template-columns: auto 1fr; }
  .rueckgabe-zeile select, .rueckgabe-zeile .knopf-mini { grid-column: 2; justify-self: start; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.3rem; }
  .raster { grid-template-columns: 1fr; }
  .tabelle th, .tabelle td { padding: .45rem .5rem; }
  .marke strong { font-size: .95rem; }
}

/* 10 Druck ---------------------------------------------------------------- */
@media print {
  .kopf, .filterleiste, .knopf, .knopf-mini, .tabs, .schnellsuche, .hilfe .inhalt { display: none !important; }
  body { background: #fff; }
  .karte, .tabelle-rahmen { border: none; }
  .hilfe section { break-inside: avoid; }
}
