/* ==========================================================================
   SecondHandBasar -- gemeinsame Gestaltungsgrundlage
   Wird NACH dem seiteneigenen <style> geladen und ersetzt dessen Grundregeln.
   Aendern Sie die Farbidentitaet an EINER Stelle: --akzent (und --akzent-dunkel/-tint).
   Schrift: Atkinson Hyperlegible Next (SIL OFL 1.1), lokal ausgeliefert.
   ========================================================================== */

@import url("/css/tokens.css?v=e077d81c");

/* --- Grundlage ----------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--t-m); line-height: 1.5; color: var(--tinte); background: var(--papier);
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
p { margin-block: 0.6em; }
.bereich-kopf p, .card > p, .hinweis, .intro p { max-width: 75ch; }
.intro p { margin-inline: auto; }
a { color: var(--akzent); text-underline-offset: 3px; }
a:hover { color: var(--akzent-dunkel); }
::selection { background: #C9D9F2; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--fokus); border-radius: var(--r-1); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--akzent); }
.muted { color: var(--tinte-2); font-size: var(--t-s); }

/* --- Kopfzeile ------------------------------------------------------------ */
header {
  background: var(--flaeche); color: var(--tinte);
  border-top: 4px solid var(--akzent); border-bottom: 1px solid var(--linie);
  padding: 14px 28px;
}
header h1 { margin: 0; font-size: var(--t-xl); font-weight: 700; color: var(--tinte); }
header p { max-width: none; margin: 2px 0 0; opacity: 1; font-size: var(--t-s); color: var(--tinte-2); }
header a { color: var(--akzent); }
#benutzer-label { color: var(--tinte-2) !important; opacity: 1 !important; font-size: var(--t-s) !important; margin-top: 2px !important; display: flex; align-items: center; gap: 12px; justify-content: flex-end; }
.abmelden, #btn-logout {
  margin: 0 !important; min-height: 32px !important; padding: 0 12px !important; font-size: var(--t-xs) !important;
  background: var(--flaeche) !important; color: var(--akzent) !important; border: 1px solid var(--linie-stark) !important; border-radius: var(--r-1) !important;
}
.abmelden:hover, #btn-logout:hover { background: var(--akzent-tint) !important; }

/* --- Seitengeruest (Verwaltung/Admin) ------------------------------------- */
.app-layout { max-width: none; margin: 0; padding: 0; }   /* Seitenleiste buendig links, Inhalt fuellt den Rest */
.sidebar { background: var(--flaeche); border-right: 1px solid var(--linie); width: 236px; padding: 16px 0 24px; min-height: calc(100vh - 90px); }
.sidebar-titel { text-transform: none; letter-spacing: 0; font-size: var(--t-xs); font-weight: 600; color: var(--tinte-2); padding: 6px 24px; margin-top: 18px; }
.sidebar-link { font-size: var(--t-m); padding: 11px 20px; color: var(--tinte); gap: 12px; min-height: 44px; border-left: 4px solid transparent; font-weight: 500; }
.sidebar-link:hover { background: var(--flaeche-2); }
.sidebar-link.aktiv { background: var(--akzent-tint); border-left-color: var(--akzent); color: var(--akzent-dunkel); font-weight: 700; }
.sidebar-link svg { opacity: 0.8; }
.content-area { padding: 26px 28px 48px; }   /* gleicher Rand wie die Kopfzeile (28px) */
.bereich-kopf { margin-bottom: 22px; }
.bereich-kopf h2 { font-size: var(--t-2xl); margin: 0 0 4px; }
.bereich-kopf p { font-size: var(--t-m); color: var(--tinte-2); }

/* --- Flaechen -------------------------------------------------------------- */
.card { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-2); box-shadow: none; padding: 22px 26px; margin-bottom: 22px; }
.card h2 { font-size: var(--t-l); font-weight: 700; margin: 0 0 12px; }
.card h3 { font-size: var(--t-m); font-weight: 700; }
.card-kopf { cursor: pointer; border-radius: var(--r-1); }
.card-kopf:hover h2 { color: var(--akzent-dunkel); }
.card-kopf:focus-visible { box-shadow: var(--fokus); }
.box { border-radius: var(--r-3); }
.hinweis { background: var(--akzent-tint); border-left: 4px solid var(--akzent); border-radius: var(--r-1); padding: 10px 14px; font-size: var(--t-s); }

/* --- Formulare -------------------------------------------------------------- */
.row { gap: 14px; }
.field { gap: 5px; }
.field label, label { font-size: var(--t-s); font-weight: 600; color: var(--tinte); }
input, select, textarea {
  font: inherit; font-size: var(--t-m); color: var(--tinte); background: var(--flaeche);
  min-height: 42px; padding: 8px 12px; border: 1px solid var(--linie-stark); border-radius: var(--r-1);
}
textarea { min-height: 88px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #7A8790; }
select { padding-right: 34px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231F2A33' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 18px; height: 18px; accent-color: var(--akzent); }
input[type="file"] { padding: 6px 8px; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; font-size: var(--t-s); margin-right: 12px; padding: 6px 12px; border: 1px solid var(--linie-stark); border-radius: var(--r-1); background: var(--flaeche-2); color: var(--tinte); cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--akzent-tint); }
input:disabled, select:disabled { background: var(--flaeche-2); color: var(--tinte-2); }
input[readonly] { background: var(--flaeche-2); }

/* --- Schaltflaechen --------------------------------------------------------- */
button {
  font: inherit; font-weight: 600; font-size: var(--t-m); min-height: 42px; padding: 0 18px;
  background: var(--akzent); color: #fff; border: 1px solid var(--akzent); border-radius: var(--r-1); cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease;
}
button:hover { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); }
button.secondary { background: var(--flaeche); color: var(--akzent-dunkel); border-color: var(--linie-stark); }
button.secondary:hover { background: var(--akzent-tint); border-color: var(--akzent); }
button.danger { background: var(--flaeche); color: var(--fehler); border-color: #D9A19B; }
button.danger:hover { background: var(--fehler-tint); border-color: var(--fehler); }
button.small { min-height: 32px; padding: 0 11px; font-size: var(--t-xs); }
button:disabled, button[disabled] { opacity: 0.45; cursor: not-allowed; }
.tabs { gap: 8px; }
.tabs button { background: var(--flaeche); color: var(--tinte); border: 1px solid var(--linie-stark); font-weight: 500; }
.tabs button:hover { background: var(--akzent-tint); }
.tabs button.active { background: var(--akzent); color: #fff; border-color: var(--akzent); font-weight: 600; }

/* --- Tabellen --------------------------------------------------------------- */
.table-scroll { border: 1px solid var(--linie); border-radius: var(--r-1); }
table { border-collapse: separate; border-spacing: 0; }
.table-scroll table { margin-top: 0; }
td, th { font-variant-numeric: tabular-nums; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--linie); font-size: var(--t-s); white-space: normal; vertical-align: middle; }
th { text-transform: none; letter-spacing: 0; font-size: var(--t-xs); font-weight: 700; color: var(--tinte-2); background: var(--flaeche-2); white-space: nowrap; border-bottom: 1px solid var(--linie-stark); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #F3F6FB; }
td.betrag, td.r, th.r, td.nr, td.zahl { text-align: right; white-space: nowrap; }
td.aktionen { display: table-cell; white-space: nowrap; }
td.aktionen > button, td button.small + button.small { margin-left: 6px; }
td.aktionen > button:first-child { margin-left: 0; }
th.sortierbar:hover { color: var(--akzent-dunkel); }
#tbl-verfuegbarkeit-raster th, #tbl-verfuegbarkeit-raster td { white-space: nowrap; }
#tbl-verfuegbarkeit-raster thead tr:first-child th, #tbl-verfuegbarkeit-raster thead tr:nth-child(2) th,
#tbl-verfuegbarkeit-raster tbody td:first-child, #tbl-verfuegbarkeit-raster thead th:first-child { background: var(--flaeche); }

/* --- Status ------------------------------------------------------------------ */
.badge { font-size: var(--t-xs); font-weight: 700; padding: 3px 10px; border-radius: 999px; letter-spacing: 0; }
.badge.eingegangen { background: #E5E9F0; color: #44505F; }
.badge.dublettenverdacht { background: var(--warn-tint); color: var(--warn); }
.badge.freigegeben { background: var(--ok-tint); color: var(--ok); }
.badge.abgelehnt { background: var(--fehler-tint); color: var(--fehler); }
.badge.helfer { background: #F0E7F7; color: #6B3FA0; }
.msg { font-size: var(--t-s); margin-top: 10px; }
.msg:empty { display: none; }
.msg.ok { color: #14532D; background: var(--ok-tint); border-left: 4px solid var(--ok); padding: 8px 12px; border-radius: var(--r-1); }
.msg.err { color: #7A1A12; background: var(--fehler-tint); border-left: 4px solid var(--fehler); padding: 8px 12px; border-radius: var(--r-1); }

/* --- Dialoge ------------------------------------------------------------------ */
.overlay, .ergebnis-overlay { background: rgba(31, 42, 51, 0.55); }
.modal, .ergebnis-box { border-radius: var(--r-3); box-shadow: 0 16px 40px rgba(31, 42, 51, 0.3); background: var(--flaeche); }
.modal h3 { font-size: var(--t-l); }
.modal-actions { gap: 10px; }

/* --- Bewegung nur auf Wunsch ----------------------------------------------- */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* --- Schmale Bildschirme ------------------------------------------------------- */
@media (max-width: 900px) {
  header { padding: 8px 16px; }
  header h1 { font-size: var(--t-l); }
  .content-area { padding: 18px 16px 40px; }
  .sidebar-link { min-height: 40px; padding: 8px 14px; }
  .sidebar-link.aktiv { border-left-color: transparent; border-bottom: 3px solid var(--akzent); }
}

/* --- Startseite ------------------------------------------------------------ */
.kachel { border: 1px solid var(--linie); border-radius: var(--r-2); background: var(--flaeche); transform: none !important; box-shadow: none !important; transition: border-color .12s ease, background-color .12s ease; }
.kachel:hover { border-color: var(--akzent); background: var(--akzent-tint); }
.kachel .icon { color: var(--akzent); line-height: 0; margin-bottom: 4px; }
.kachel h3 { font-size: var(--t-l); }
.kachel .pfeil { font-size: var(--t-m); color: var(--akzent-dunkel); text-decoration: underline; text-underline-offset: 4px; }
.intro h2 { font-size: var(--t-2xl); }

/* --- Anmeldung ------------------------------------------------------------- */
.box { border-radius: var(--r-3); padding: 36px 36px 32px; box-shadow: 0 1px 2px rgba(31,42,51,.06); }
.box h1 { font-size: var(--t-xl); }
.box input { min-height: 46px; border-radius: var(--r-1); }
.box button { min-height: 48px; border-radius: var(--r-1); }
.fehler { font-size: var(--t-s); color: var(--fehler); background: var(--fehler-tint); border-left: 4px solid var(--fehler); border-radius: var(--r-1); padding: 8px 12px; text-align: left; }

.fehler:empty { display: none; }
header select { border: 1px solid var(--linie-stark); background-color: var(--flaeche); color: var(--tinte); min-height: 40px; }
header .status { opacity: 1; color: var(--tinte-2); font-size: var(--t-xs); }

/* --- Statistik: Kennzahlen nach Sinn gruppiert ------------------------------ */
.kennzahlen { display: grid; grid-template-columns: 1.5fr 1fr 1.2fr; gap: 20px; margin-bottom: 22px; align-items: stretch; }
.kz-gruppe { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-2); padding: 18px 22px 20px; }
.kz-gruppe h2 { font-size: var(--t-s); font-weight: 700; color: var(--tinte-2); margin: 0 0 14px; letter-spacing: 0; }
.kz-gruppe .kacheln { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin: 0; }
.kz-gruppe .kachel { display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 2px; background: none; border: none; border-radius: 0; padding: 0; text-align: left; }
.kz-gruppe .kachel .label { color: var(--tinte-2); font-size: var(--t-s); margin: 0; }
.kz-gruppe .kachel .wert { font-size: var(--t-xl); font-weight: 700; color: var(--tinte); line-height: 1.2; }
.kz-gruppe .kachel:first-child .wert { font-size: var(--t-2xl); color: var(--akzent-dunkel); }
@media (max-width: 1100px) { .kennzahlen { grid-template-columns: 1fr; } }

/* Balken in Tabellen */
.bar-bg { background: #E6EAF0; border-radius: 4px; height: 8px; }
.bar-fill { border-radius: 4px; }
.farbpunkt { width: 12px; height: 12px; border-radius: 3px; }
header select { min-width: 220px; }
#tbl-kasse .bar-fill { background: var(--akzent) !important; }

/* Tabellen: Kurzes bleibt auf einer Zeile, nur Namen und Anschriften duerfen umbrechen */
td.nw { white-space: nowrap; }
/* Verfeinerung: nur Browser mit :has() (Chrome ab 105); aelteren genuegt td.nw oben */
td:has(.badge), td:has(> input[type="checkbox"]), td:has(select), td:has(> input) { white-space: nowrap; }
td:first-child, td:nth-child(2) { white-space: nowrap; }

td select, td input:not([type="checkbox"]) { min-height: 34px; padding: 4px 28px 4px 8px; min-width: 64px; font-size: var(--t-s); background-position: right 8px center; }
td input:not([type="checkbox"]) { padding-right: 8px; }
.card { padding: 22px 24px; }
td.aktionen button.small, td button.small { white-space: nowrap; }

/* Aktionsspalte bleibt bei waagerechtem Scrollen am rechten Rand erreichbar */
.table-scroll table:has(tbody td:last-child button) :is(th, td):last-child { position: sticky; right: 0; background: var(--flaeche); box-shadow: -10px 0 10px -10px rgba(31, 42, 51, 0.28); z-index: 2; }
.table-scroll table:has(tbody td:last-child button) th:last-child { background: var(--flaeche-2); }
.table-scroll table:has(tbody td:last-child button) tbody tr:hover td:last-child { background: #F3F6FB; }

/* Statistik: Karten fuellen die Breite, Tabellen darin bleiben gut lesbar (Zahlen nicht weit von ihren Namen) */
main > .card > table { max-width: 1100px; }

/* Programmstand in der Kopfzeile (zeigt, welches Paket wirklich laeuft) */
.stand { font-size: var(--t-xs); color: var(--tinte-2); white-space: nowrap; }

/* Erklaerungstexte, die als <label> ausgezeichnet sind, sowie Haken-/Auswahltexte: normale Schrift statt fett */
label.beschreibung, .field label.beschreibung { font-weight: 400; font-size: var(--t-s); line-height: 1.5; color: var(--tinte); }
label.gruppe-zeile { font-weight: 400; }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { font-weight: 400; }

/* ===== Touch (iPad Pro, Toughbook-Touchscreen): Tipp-Flaechen ===== */
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
a.small.secondary, a.small {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 11px; border: 1px solid var(--linie-stark); border-radius: var(--r-1);
  font-size: var(--t-xs); font-weight: 600; text-decoration: none; color: var(--akzent-dunkel); background: var(--flaeche);
}
a.small.secondary:hover, a.small:hover { background: var(--akzent-tint); border-color: var(--akzent); }
@media (pointer: coarse) {
  input[type="checkbox"], input[type="radio"] { width: 28px; height: 28px; }
  th:has(> input[type="checkbox"]), td:has(> input[type="checkbox"]) { padding-left: 14px; padding-right: 14px; }
  button.small, a.small, a.small.secondary { min-height: 40px; }
  header a { display: inline-block; padding: 9px 5px; margin: -9px 0; }   /* groessere Tipp-Flaeche, ohne die Kopfzeile hoeher zu machen */
  header p { line-height: 1.15; }
  .tabs button, .sidebar-link { min-height: 46px; }
}

/* ===== Niedrige Fenster (Toughbook mit Browserleiste: 610-760 px Hoehe) ===== */
@media (max-height: 760px) {
  header { padding: 8px 20px; }
  header h1 { font-size: var(--t-l); }
  header p { margin: 0; font-size: var(--t-xs); }
  .bereich-kopf { margin-bottom: 12px; }
  .bereich-kopf h2 { font-size: var(--t-xl); }
  .content-area { padding-top: 16px; }
}

/* Programmstand & Aenderungsprotokoll, Notfall-Befehle (Version 2026-10-25b) */
details.aenderung { border-top: 1px solid var(--border); padding: 8px 0; }
details.aenderung:last-child { border-bottom: 1px solid var(--border); }
details.aenderung summary { cursor: pointer; color: var(--akzent-dunkel); font-size: 0.98rem; list-style: none; }
details.aenderung summary::-webkit-details-marker { display: none; }
details.aenderung summary::before { content: "▶"; display: inline-block; width: 1.1em; font-size: 0.75em; color: var(--akzent-dunkel); }
details.aenderung[open] summary::before { content: "▼"; }
details.aenderung summary:focus-visible { box-shadow: var(--fokus); border-radius: 4px; }
details.aenderung ul { margin: 6px 0 4px 1.4em; padding: 0; }
details.aenderung li { margin: 3px 0; font-size: 0.92rem; line-height: 1.4; }
.notfall-liste { display: flex; flex-direction: column; gap: 10px; }
.notfall-zeile { display: grid; grid-template-columns: minmax(0, 3fr) max-content minmax(200px, 2fr); align-items: center; gap: 10px; }
.notfall-zeile > code { background: var(--flaeche-2); border-radius: 6px; padding: 6px 10px; font-size: 0.86rem; word-break: break-all; }
.notfall-zeile .muted { font-size: 0.85rem; }
@media (max-width: 760px) { .notfall-zeile { grid-template-columns: minmax(0, 1fr) max-content; } .notfall-zeile .muted { grid-column: 1 / -1; } }
