/*
 * custom.css – gemeinsames Design-System fuer creativShare
 *
 * An das Referenz-Designsystem des Inventory-Projekts angeglichen:
 *  - Primaerfarbe #52AD31, Signature-Radius 5px (Cards, Modals, Buttons,
 *    Inputs, Badges, Login-Box ...)
 *  - Schrift: Source Sans 3
 *  - Dark Mode ueber [data-bs-theme="dark"] auf <html>, Umschalter im
 *    Header, Zustand in localStorage
 *  - Cards: kein Rahmen, weicher Schatten, gruener Akzentstrich am Titel
 *  - Modals: gleiches Prinzip + sanfte Scale/Fade-Animation beim Oeffnen,
 *    Ghost-Style fuer "Abbrechen"
 *  - Formulare: Labels klein/uppercase/grau, Fokus-Zustand gruen
 *  - Responsive: Panels/Tabellen/Modals passen sich auf Mobile an
 */

:root {
  --bs-primary: #52AD31;
  --radius: 5px;
  --card-w: 420px;

  --page-bg: #ffffff;
  --wt-bg: #ffffff;
  --wt-border: #eef0f2;
  --wt-head-bg: #f4f8f3;
  --wt-shadow: 0 2px 14px rgba(0, 0, 0, 0.06);
  --text-secondary: #6c757d;
  --hover-tint: #f4f8f3;
}

[data-bs-theme="dark"] {
  --page-bg: #1a1d20;
  --wt-bg: #22262a;
  --wt-border: #33383d;
  --wt-head-bg: #262d24;
  --wt-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  --text-secondary: #9aa0a6;
  --hover-tint: rgba(82, 173, 49, 0.12);
}

html, body {
  height: 100%;
}

body {
  min-height: 100dvh;
  background: var(--page-bg);
  font-family: 'Source Sans 3', sans-serif;
}

/* ---------- Animationen ---------- */
/* Sanfter Uebergang beim Umschalten von Hell-/Dunkelmodus statt hartem Wechsel. */
body, .card, .wt-panel, .stat-tile, .siteHeader, .form-control, .form-select,
.theme-toggle, .badge-pill, .login-card {
  transition: background-color .25s ease, border-color .25s ease, color .25s ease, box-shadow .25s ease;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes markPulse {
  0%, 100% { box-shadow: 0 6px 16px rgba(82, 173, 49, 0.35); }
  50%      { box-shadow: 0 6px 22px rgba(82, 173, 49, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

[data-bs-theme="dark"] body {
  background: var(--page-bg);
  color: #e9ecef;
}

a { color: var(--bs-primary); }

/* ---------- Header / Branding ---------- */
/* Echte Header-Leiste wie das "app-header" im Referenzprojekt: weiss, fixiert
   oben, weicher Schatten statt harter Trennlinie. */
.siteHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--wt-bg);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
}
[data-bs-theme="dark"] .siteHeader {
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}
.siteHeader img {
  width: 240px;
  max-width: 50vw;
  height: auto;
}
.site-logo-link {
  display: inline-flex;
  line-height: 0;
  transition: opacity 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .site-logo-link:hover {
    opacity: 0.85;
  }
}
.theme-toggle {
  border: 1px solid var(--wt-border);
  background: var(--wt-bg);
  color: var(--text-secondary);
  border-radius: var(--radius);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.theme-toggle:hover { color: var(--bs-primary); border-color: var(--bs-primary); transform: translateY(-1px); }
.theme-toggle:active { transform: scale(.9) rotate(-10deg); }
.theme-toggle i { transition: transform .3s ease; }
.theme-toggle:hover i { transform: rotate(20deg); }
.theme-toggle .bi-moon-stars-fill { display: none; }
[data-bs-theme="dark"] .theme-toggle .bi-sun-fill { display: none; }
[data-bs-theme="dark"] .theme-toggle .bi-moon-stars-fill { display: inline-block; }

/* Auf der Login-Seite sitzt der Toggle frei schwebend oben rechts,
   da die Login-Card 1:1 der Referenz entspricht (ohne Kopfzeile). */
.login-page .theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
}

/* ---------- Card / Panel ---------- */
/* Breite relativ zum eigenen Elternelement (100%) statt zum Viewport (vw) -
   vw ignoriert das Padding des umgebenden Containers (z.B. die "p-3"-Huelle
   auf datapool.php) und fuehrt am Handy zu einem Panel, das breiter als der
   verfuegbare Platz ist und dadurch rechts ueberlaeuft/den rechten Abstand
   auffrisst. */
.wt-panel {
  width: min(100%, var(--card-w));
  border-radius: var(--radius);
  background: var(--wt-bg);
  box-shadow: var(--wt-shadow);
  border: 1px solid var(--wt-border);
  overflow: hidden;
  margin: 0 auto;
  animation: fadeSlideUp .5s ease both;
}
.wt-panel.wt-panel-wide { --card-w: 1280px; }
.wt-panel.wt-panel-wide ~ .wt-panel.wt-panel-wide,
.wt-panel + .wt-panel { animation-delay: .08s; }

.wt-head {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--wt-border);
  background: var(--wt-head-bg);
}
.brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .2px;
  position: relative;
  padding-left: 14px;
}
.brand::before {
  content: '';
  position: absolute;
  left: 0; top: 2px; bottom: 2px;
  width: 4px;
  border-radius: 2px;
  background: var(--bs-primary);
}

.wt-body { padding: 18px 18px 8px; }
.wt-form { padding: 14px 18px 18px; }
.wt-footer {
  padding: 16px 18px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--wt-border);
  background: var(--wt-head-bg);
}

/* ---------- Formulare ---------- */
.form-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
  color: var(--text-secondary);
}
.form-control, .form-select {
  border-radius: var(--radius);
  border: 1px solid var(--wt-border);
  background: var(--wt-bg);
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  color: #e9ecef;
}
.form-control:focus, .form-select:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.2rem rgba(82, 173, 49, 0.15);
}

/* Input-Group (z.B. Freigabe-Link + "Kopieren"-Button) an das 5px-Signature-
   Radius anpassen statt Bootstraps Standardrundung zu verwenden. */
.input-group > .form-control,
.input-group > .btn {
  border-radius: var(--radius) !important;
}
.input-group > :not(:last-child) {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
.input-group > :not(:first-child) {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  margin-left: -1px;
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: var(--radius);
  font-weight: 500;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.send-btn { padding: 10px 18px; }

/* Icon-only Buttons/Links (z.B. QR-Code, E-Mail, Teilen in den Tabellen):
   <a class="btn"> zentriert Inhalte per Default nicht wie <button>, deshalb
   hier explizit als Flex-Box zentrieren, damit z.B. das Envelope-Icon nicht
   schief/oben sitzt. */
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.btn-primary {
  background-color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
  box-shadow: 0 2px 8px rgba(82, 173, 49, 0.25);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: #459428 !important;
  border-color: #459428 !important;
  box-shadow: 0 4px 14px rgba(82, 173, 49, 0.35);
}
.btn-outline-primary {
  color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
}
.btn-outline-primary:hover, .btn-outline-primary:focus {
  background-color: var(--bs-primary) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(82, 173, 49, 0.3);
}
.btn-secondary {
  background-color: transparent !important;
  border-color: #ced4da !important;
  color: #495057 !important;
}
[data-bs-theme="dark"] .btn-secondary {
  border-color: #3a3f44 !important;
  color: #9aa0a6 !important;
}
.btn-secondary:hover, .btn-secondary:focus {
  background-color: var(--wt-head-bg) !important;
  border-color: #adb5bd !important;
  color: #495057 !important;
}
[data-bs-theme="dark"] .btn-secondary:hover,
[data-bs-theme="dark"] .btn-secondary:focus {
  color: #e9ecef !important;
}

/* ---------- Drop-Zone (Upload) ---------- */
.drop-zone {
  margin: 18px;
  border: 2px dashed #ced4da;
  border-radius: var(--radius);
  padding: 34px 20px;
  text-align: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color .2s, background-color .2s, color .2s, transform .08s ease;
  background: var(--wt-head-bg);
}
[data-bs-theme="dark"] .drop-zone { border-color: #3a3f44; }
.drop-zone:hover { transform: translateY(-1px); }
.drop-zone.dragover {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
  background: var(--hover-tint);
  transform: scale(1.015);
}
.drop-zone .icon {
  font-size: 48px;
  line-height: 1;
  display: block;
  margin-bottom: 8px;
  color: var(--bs-primary);
  opacity: .8;
  transition: transform .25s ease;
}
.drop-zone:hover .icon { transform: translateY(-3px); }
.drop-zone.dragover .icon { animation: dropBounce .6s ease infinite; }
@keyframes dropBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.hint { font-size: .92rem; color: #868e96; }

/* ---------- Datei-Liste ---------- */
.file-list { margin: 14px 18px 0; max-height: 180px; overflow: auto; }
.file-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--wt-head-bg);
  border: 1px solid var(--wt-border);
  margin-bottom: 10px;
}
.thumb {
  width: 36px; height: 36px; border-radius: var(--radius);
  background: rgba(82, 173, 49, 0.12); overflow: hidden; display: grid; place-items: center;
  font-size: 18px;
  color: var(--bs-primary);
  transition: width .2s ease, height .2s ease;
}
[data-bs-theme="dark"] .thumb { background: rgba(82, 173, 49, 0.18); }
/* Groessere Bild-Vorschau (statt generischem Icon) fuer Bild-Dateien beim Upload. */
.thumb.thumb-image { width: 48px; height: 48px; }
.thumb-img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.05);
  transition: opacity .3s ease, transform .3s ease;
}
.thumb-img.is-loaded { opacity: 1; transform: scale(1); }
.file-meta { flex: 1; min-width: 0; }
.file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: .85rem; color: #868e96; }
.remove-btn { border: 0; background: transparent; color: #adb5bd; }
.remove-btn:hover { color: #495057; }

/* ---------- Alert-/Hinweisbanner (ersetzt alert()) ---------- */
.alert-banner {
  margin: 0 18px 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: .9rem;
  display: none;
  align-items: flex-start;
  gap: 10px;
}
.alert-banner.show { display: flex; }
.alert-banner.variant-error { background: #fdecec; color: #7a1f1f; border: 1px solid #f5b5b5; }
.alert-banner.variant-warning { background: #fff6e5; color: #7a5a00; border: 1px solid #ffe1a3; }
.alert-banner.variant-offline { background: #eef1f5; color: #444; border: 1px solid #d7dce3; }
[data-bs-theme="dark"] .alert-banner.variant-error { background: rgba(220,53,69,0.15); color: #f5b5b5; border-color: rgba(220,53,69,0.4); }
[data-bs-theme="dark"] .alert-banner.variant-warning { background: rgba(255,193,7,0.12); color: #ffe1a3; border-color: rgba(255,193,7,0.35); }
[data-bs-theme="dark"] .alert-banner.variant-offline { background: rgba(255,255,255,0.05); color: #9aa0a6; border-color: #3a3f44; }
.alert-banner .bi { margin-top: 2px; }
.alert-banner .retry-btn {
  margin-left: auto;
  border: 1px solid currentColor;
  background: transparent;
  border-radius: var(--radius);
  padding: 2px 10px;
  font-size: .82rem;
  white-space: nowrap;
}

.errorDisplay {
  border: 1px solid #dc3545;
  border-radius: var(--radius);
  margin: 18px;
  margin-bottom: 0;
  padding: 15px;
  background-color: rgba(220, 53, 69, 0.08);
  color: #7a1f1f;
}
[data-bs-theme="dark"] .errorDisplay { background-color: rgba(220,53,69,0.15); color: #f5b5b5; }

.info {
  border: 1px solid var(--bs-primary);
  border-radius: var(--radius);
  padding: 15px;
  margin-bottom: 15px;
  background-color: rgba(82, 173, 49, 0.12);
}
.info.is-error {
  border-color: #dc3545;
  background-color: rgba(220, 53, 69, 0.12);
}

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-secondary); }
.empty-state .bi { color: var(--bs-primary); opacity: .55; }

/* ---------- Leer-Zustand-Illustration (statt reinem Icon) ---------- */
.empty-illustration { position: relative; width: 120px; height: 110px; margin: 0 auto; }
.empty-illustration-circle {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(82, 173, 49, 0.22), rgba(82, 173, 49, 0.05));
  display: grid;
  place-items: center;
  animation: floatY 3.4s ease-in-out infinite;
}
.empty-illustration-circle .bi {
  font-size: 42px;
  color: var(--bs-primary);
  opacity: .8;
}
.empty-illustration-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bs-primary);
  opacity: .3;
  animation: dotFloat 3s ease-in-out infinite;
}
.empty-illustration-dot.dot-1 { top: 2px; left: 10px; animation-delay: 0s; }
.empty-illustration-dot.dot-2 { top: 18px; right: 6px; animation-delay: .6s; }
.empty-illustration-dot.dot-3 { bottom: 6px; left: 32%; animation-delay: 1.2s; }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
@keyframes dotFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: .22; }
  50%      { transform: translateY(-10px) scale(1.3); opacity: .6; }
}

/* ---------- Download-Overlay (request_download.php / customLinkShare.php) ---------- */
/* Bugfix: hier stand vorher ein Klassen-Selektor (".dl-overlay"), das Element
   im Markup traegt aber nur "id=dl-overlay" - die Regel griff dadurch nie,
   das "Overlay" war in Wahrheit ein ganz normaler Block im Dokumentfluss
   (deshalb sass es "unten" statt als Vollbild). Jetzt echter ID-Selektor.
   Preloader gleichzeitig aufgehuebscht: dunkler Vollbild-Hintergrund mit
   gruenem Verlauf, zwei gegenlaeufige Ringe + ein sich ausdehnender
   "Pulsring" dahinter, schwebendes Icon in der Mitte. */
#dl-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 38%, rgba(82, 173, 49, 0.22), rgba(10, 12, 10, 0.94));
  backdrop-filter: blur(6px);
  transition: opacity .3s ease;
}
#dl-overlay.is-visible { opacity: 1; pointer-events: auto; }
.dl-card {
  text-align: center;
  animation: fadeSlideUp .45s ease both;
}
.dl-spinner {
  position: relative;
  width: 92px;
  height: 92px;
  margin: 0 auto 22px;
}
.dl-spinner-pulse {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 2px solid rgba(82, 173, 49, 0.45);
  animation: dlPulseRing 1.8s ease-out infinite;
}
.dl-spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--bs-primary);
  animation: dlSpin .9s linear infinite;
}
.dl-spinner-ring-inner {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-bottom-color: rgba(255, 255, 255, 0.85);
  animation: dlSpin 1.3s linear infinite reverse;
}
.dl-spinner .bi {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 28px;
  color: #fff;
  animation: floatY 2.2s ease-in-out infinite;
}
.dl-text {
  margin: 0;
  font-weight: 600;
  color: #fff;
  font-size: 1.05rem;
  letter-spacing: .2px;
}
@keyframes dlSpin {
  to { transform: rotate(360deg); }
}
@keyframes dlPulseRing {
  0%   { transform: scale(.75); opacity: .6; }
  100% { transform: scale(1.35); opacity: 0; }
}
/* Download-Button bleibt unsichtbar, waehrend die Lade-Meldung laeuft, und
   blendet sich erst danach sichtbar/animiert ein - macht den Zusammenhang
   "erst laden, dann herunterladen" eindeutig statt beides gleichzeitig
   anzuzeigen. */
.dl-pending { opacity: 0; pointer-events: none; }
.dl-ready { animation: fadeSlideUp .4s ease both; }

/* ---------- Code-Eingabe (Bestaetigungscode) ---------- */
.code-input { letter-spacing: 6px; font-weight: 700; text-align: center; font-size: 1.2rem; }
.resend-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.resend-row button { font-size: .85rem; }

/* ---------- Progress ---------- */
.progress { height: 8px; border-radius: 999px; background: #eef1f5; overflow: hidden; }
[data-bs-theme="dark"] .progress { background: #2c3034; }
.progress-bar {
  /* Bugfix: Markup nutzt Bootstraps ".bg-primary"-Utility-Klasse, die intern
     ueber die eigene Variable "--bs-primary-rgb" faerbt - die haben wir nie
     ueberschrieben (nur "--bs-primary" selbst, s.o.), deshalb blieb der
     Balken trotz gruenem CI-Design blau. Jetzt direkt mit der CI-Farbe
     ueberschrieben, unabhaengig von Bootstraps eigener Variable. */
  background-color: var(--bs-primary) !important;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  transition: width .3s ease;
}
/* Bewegte Diagonalstreifen ueber dem Fortschrittsbalken, damit ein Upload
   auch bei sehr grossen/langsamen Dateien sichtbar "lebendig" wirkt statt
   wie eingefroren zu erscheinen. */
.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(135deg, rgba(255,255,255,.35) 25%, transparent 25%, transparent 50%,
    rgba(255,255,255,.35) 50%, rgba(255,255,255,.35) 75%, transparent 75%, transparent);
  background-size: 26px 26px;
  animation: progressStripe .9s linear infinite;
}
@keyframes progressStripe {
  from { background-position: 0 0; }
  to   { background-position: 26px 0; }
}
#progressWrap { animation: fadeSlideUp .3s ease both; }
.progress-percent {
  text-align: right;
  font-size: .8rem;
  font-weight: 600;
  color: var(--bs-primary);
  margin-top: 4px;
}
.tiny { font-size: .85rem; color: #868e96; }

/* ---------- Upload-Feedback (Drop-Zone, Datei-Liste, Ergebnis-Ansicht) ---------- */
/* Datei-Karten fliegen beim Hinzufuegen sanft ein statt abrupt zu erscheinen. */
.file-item { animation: fadeSlideUp .3s ease both; }
/* Beim Entfernen (Klick auf X) spielt zuerst diese Animation, danach entfernt
   das JS das Element erst wirklich aus der Liste (siehe intranet.php). */
.file-item.removing {
  animation: fileItemOut .22s ease forwards;
  pointer-events: none;
}
@keyframes fileItemOut {
  to { opacity: 0; transform: translateX(14px) scale(.95); }
}
/* Kurzes "Pop", sobald Dateien erfolgreich per Klick/Drag hinzugefuegt wurden -
   gibt eine sofortige, spuerbare Rueckmeldung unabhaengig vom Dragover-Effekt. */
.drop-zone.file-added { animation: dropPop .35s ease; }
@keyframes dropPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.025); }
  100% { transform: scale(1); }
}
/* Kurzes Wackeln der Drop-Zone bei einem abgelehnten Upload (z.B. zu viele
   Dateien/Typ nicht erlaubt) - macht den Fehler auch visuell spuerbar statt
   nur textlich im Banner. */
.drop-zone.shake { animation: dropShake .4s ease; }
@keyframes dropShake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
.drop-zone .icon.icon-success { color: var(--bs-primary); animation: checkPop .4s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes checkPop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
/* Kurzes Wackeln des Fehlerbanners beim Erscheinen. */
.alert-banner.show { animation: dropShake .4s ease; }
/* Sanftes Ein-/Ausblenden zwischen Upload-Formular und Ergebnis-Ansicht statt
   hartem display:none/block-Sprung. */
#formupdate { animation: fadeSlideUp .35s ease both; }
.upload-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bs-primary);
  color: #fff;
  font-size: 13px;
  margin-right: 8px;
  vertical-align: -4px;
  animation: checkPop .45s cubic-bezier(.34,1.56,.64,1) both;
}
#shareLinkWrap { animation: fadeSlideUp .4s ease both; }

/* ---------- Tabellen (Datapool) – wie DataTables im Referenzprojekt ---------- */
.table-responsive {
  border: 1px solid var(--wt-border);
  border-radius: var(--radius);
  background: var(--wt-bg);
  overflow: hidden;
}
.table { margin-bottom: 0; }
.table thead th {
  white-space: nowrap;
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .03em;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--wt-head-bg);
  border-bottom: 2px solid var(--wt-border) !important;
  padding: .65rem .9rem;
}
.table td {
  border-bottom: 1px solid var(--wt-border);
  padding: .6rem .9rem;
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background-color .15s ease; }
/* Nur auf Geraeten mit echtem Maus-Hover anwenden - auf Touchscreens bleibt
   :hover nach dem Antippen sonst "haengen" und wirkt wie ein Darstellungsfehler
   (z.B. eine Datei-Zeile/-Karte, die dauerhaft gruen eingefaerbt bleibt). */
@media (hover: hover) and (pointer: fine) {
  .table tbody tr:hover { background: var(--hover-tint); }
}
.table td:last-child { white-space: nowrap; }
.table td .btn { font-size: .85rem; }
.name-col { max-width: 280px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Sortierbare Tabellen-Spalten ---------- */
.table thead th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.4rem;
  transition: color .15s ease;
}
.table thead th.sortable:hover { color: var(--bs-primary); }
.table thead th.sortable::after {
  content: '⇅';
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: .35;
  font-size: .8rem;
}
.table thead th.sortable[data-dir]::after { opacity: .9; color: var(--bs-primary); }
.table thead th.sortable[data-dir="asc"]::after { content: '↑'; }
.table thead th.sortable[data-dir="desc"]::after { content: '↓'; }

/* ---------- Suche + Pagination (Datenpool-Tabellen) ---------- */
.table tbody tr.d-none-filter,
.table tbody tr.d-none-page {
  display: none;
}
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 0 6px;
}
.page-btn {
  border: 1px solid var(--wt-border);
  background: var(--wt-bg);
  color: var(--text-secondary);
  border-radius: var(--radius);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .15s ease, border-color .15s ease, transform .15s ease;
}
.page-btn:hover:not(:disabled) {
  color: var(--bs-primary);
  border-color: var(--bs-primary);
  transform: translateY(-1px);
}
.page-btn:disabled { opacity: .35; cursor: default; }
.page-info {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.badge-expired { background: #dc3545; }
.badge-active { background: var(--bs-primary); }

.editTimeBtn {
  border: 1px solid var(--wt-border);
  border-radius: var(--radius);
  padding: 4px 10px;
  color: var(--text-secondary);
}
@media (hover: hover) and (pointer: fine) {
  .editTimeBtn:hover { color: #fff; background-color: var(--bs-primary); border-color: var(--bs-primary); }
}

/* Such-Feld über den Tabellen: gleiche runde Optik + Lupen-Icon wie im
   Referenzprojekt (DataTables-Suchfeld). */
#filter, #filter2 {
  min-width: 260px;
  padding-left: 2.2rem !important;
  background: var(--wt-bg) url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat .7rem center;
  background-size: 15px 15px;
}
[data-bs-theme="dark"] #filter, [data-bs-theme="dark"] #filter2 {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa0a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}

/* ---------- Modals ---------- */
.modal-content {
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  background: var(--wt-bg);
}
.modal-header {
  position: relative;
  padding-left: calc(1rem + 4px);
  border-bottom: 1px solid var(--wt-border);
  background: var(--wt-head-bg);
}
.modal-header::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--bs-primary);
}
.modal-footer { border-top: 1px solid var(--wt-border); }

/* Sanfte Scale/Fade-Animation statt Bootstraps Standard-Slide */
.modal.fade .modal-dialog {
  transform: scale(0.96);
  transition: transform .2s ease-out, opacity .2s ease-out;
}
.modal.show .modal-dialog {
  transform: scale(1);
}

/* ---------- Login-Seite (1:1 wie im Referenzprojekt) ---------- */
.login-page {
  background: var(--page-bg);
  display: flex;
  align-items: center;
  min-height: 100vh;
}

.login-box {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  padding: 24px;
  animation: fadeSlideUp .5s ease both;
}

.login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--bs-primary), #3d8a22);
  box-shadow: 0 6px 16px rgba(82, 173, 49, 0.35);
  color: #fff;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -.02em;
  animation: markPulse 3.2s ease-in-out infinite;
  transition: transform .25s ease;
}
.login-brand-mark:hover { transform: scale(1.06) rotate(-3deg); }
.login-brand-text {
  display: block;
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: .01em;
  color: var(--bs-primary);
}
.login-brand-divider {
  width: 28px;
  height: 2px;
  margin: 10px auto;
  background: var(--bs-primary);
  border-radius: 2px;
  opacity: .55;
}
.login-brand-sub {
  display: block;
  font-weight: 600;
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Generischer Card-Stil (Referenz-Signature: kein Rahmen, weicher Schatten, 5px) */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.06);
  background: var(--wt-bg);
}
[data-bs-theme="dark"] .card { box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35); }
.card-body { padding: 1.5rem; }

.login-card {
  border: 1px solid var(--wt-border);
  border-radius: var(--radius);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
}
.login-card .card-body { padding: 2rem; }

.login-box-msg {
  text-align: center;
  color: var(--text-secondary);
  font-size: .9rem;
  margin-bottom: 1.5rem;
}

.login-box .form-check-label {
  font-size: .85rem;
  color: var(--text-secondary);
}
.login-box .btn-primary {
  padding: .55rem 0;
  font-weight: 600;
}

.login-footer {
  text-align: center;
  color: #adb5bd;
  font-size: .8rem;
  margin-top: 1.25rem;
}
[data-bs-theme="dark"] .login-box-msg,
[data-bs-theme="dark"] .login-footer {
  color: #9aa0a6;
}

/* ---------- Kennzahlen-Kacheln (Datapool) ---------- */
.stat-tile {
  background: var(--wt-bg);
  border: 1px solid var(--wt-border);
  border-radius: var(--radius);
  box-shadow: var(--wt-shadow);
  padding: 1rem 1.25rem;
  text-align: center;
  animation: fadeSlideUp .5s ease both;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.1);
}
.stat-tile:nth-of-type(1) { animation-delay: 0s; }
.stat-tile:nth-of-type(2) { animation-delay: .07s; }
.stat-tile:nth-of-type(3) { animation-delay: .14s; }
.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--bs-primary);
  line-height: 1.2;
}
.stat-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: .2rem;
}

/* ---------- Verfalls-Badges (farbcodierte Dringlichkeit) ---------- */
.badge-pill {
  display: inline-block;
  padding: .25rem .6rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
}
.badge-success-soft { background: rgba(82, 173, 49, .15); color: #2f5720; }
.badge-warning-soft { background: rgba(255, 193, 7, .18); color: #7a5a00; }
.badge-danger-soft { background: rgba(220, 53, 69, .15); color: #7a1f1f; }
[data-bs-theme="dark"] .badge-success-soft { background: rgba(82, 173, 49, .2); color: #a8dd8f; }
[data-bs-theme="dark"] .badge-warning-soft { background: rgba(255, 193, 7, .18); color: #ffe1a3; }
[data-bs-theme="dark"] .badge-danger-soft { background: rgba(220, 53, 69, .2); color: #f0a8a6; }

/* ---------- Dateityp-Icons (Datei-Vorschau beim Upload) ---------- */
.thumb .bi-file-earmark-pdf { color: #d9534f; }
.thumb .bi-file-earmark-word { color: #2b579a; }
.thumb .bi-file-earmark-excel { color: #217346; }
.thumb .bi-file-earmark-ppt { color: #d35230; }
.thumb .bi-file-earmark-zip { color: #6c757d; }
.thumb .bi-file-earmark-music { color: #8a4fd1; }
.thumb .bi-file-earmark-play { color: #d1478a; }
.thumb .bi-file-earmark-text { color: var(--text-secondary); }

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .wt-body .btn-sm { padding: .25rem .5rem; font-size: .75rem; }
  .wt-body table td, .wt-body table th { font-size: .8rem; }
  .wt-footer { grid-template-columns: 1fr; }
  .siteHeader img { width: 198px; }
}

@media (max-width: 767.98px) {
  /* --card-w bleibt gross (1280px); width: min(100%, ...) begrenzt die
     tatsaechliche Breite ohnehin korrekt auf den verfuegbaren Platz. */

  /* Tabellen (Datapool): am Handy Karten statt horizontal scrollender Tabelle
     – gleiches Muster wie die Produktionslisten im Referenzprojekt. */
  .mobile-collapse-table { overflow-x: visible; border: none; background: transparent; }
  .mobile-card-table thead { display: none; }
  .mobile-card-table, .mobile-card-table tbody, .mobile-card-table tr, .mobile-card-table td {
    display: block;
    width: 100%;
  }
  .mobile-card-table tr {
    border: 1px solid var(--wt-border);
    border-radius: var(--radius);
    background: var(--wt-bg);
    box-shadow: var(--wt-shadow);
    margin-bottom: .75rem;
    padding: .75rem;
  }
  .mobile-card-table td {
    border: none;
    padding: .3rem 0;
    text-align: left;
    white-space: normal;
  }
  .mobile-card-table td center { display: block; text-align: left; }
  .mobile-card-table td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: .15rem;
  }
}
