/* ============================================================
   MIWE Upload-Tool — Phase 3 App-Styles (Redesign nach Figma)
   Design-Quelle: Figma SyYu4oIDDsUnjDFyOvjbRd, Freeze docs/design/
   ============================================================ */

/* ---- Fonts (selbst gehostet, kein CDN) ---- */

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/roboto-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/roboto-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/roboto-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/roboto-700.woff2') format('woff2');
}

/* ---- Design-Tokens (aus Figma-Variablen + Spec Teil 7) ---- */

:root {
  /* Farben */
  --miwe-gelb-500: #ffcc00;
  --miwe-blau-50: #edf4ff;
  --miwe-blau-200: #c4daf9;
  --miwe-blau-400: #6ba2ef;
  --miwe-blau-600: #3060dc;
  --miwe-blau-700: #2b4fca;
  --grau-50: #fbfbfb;
  --grau-100: #f7f7f7;
  --grau-200: #ebebeb;
  --grau-300: #dfdfdf;
  --grau-400: #c2c2c2;
  --grau-500: #999999;
  --grau-600: #808080;
  --grau-700: #666666;
  --grau-950: #1a1a1a;
  --error-400: #ff1111;
  --error-500: #d50000;
  --success-50: #f3fae5;
  --success-600: #78a224;
  --warning-50: #fff8e1;
  --warning-700: #8a6d00;
  --white: #ffffff;

  /* Typografie */
  --font-ui: 'Roboto', system-ui, -apple-system, sans-serif;
  --font-brand: 'VAG Rounded LT CYR', 'VAG Rounded', ui-rounded, var(--font-ui);
  /* Skala +~20% ggue. Figma (Operator-Entscheidung 21.07., Lesbarkeit
     am Geraet; Orientierung Apple HIG: Body 17, Minimum 11) */
  --text-2xs: 12px;
  --text-xs: 14px;
  --text-sm: 17px;
  --text-base: 19px;
  --text-lg: 22px;
  --text-xl: 24px;
  --text-2xl: 29px;
  --text-3xl: 36px;

  /* Radien (Spec Teil 7) */
  --radius-control: 8px;   /* Buttons, Inputs */
  --radius-card: 16px;     /* Cards, Popups, Sheets */
  --radius-modal: 24px;    /* Modals, grosse Container */

  /* Schatten (Figma Effect Styles, Korrektur-Runde 1) */
  --shadow-card: 0 0 20px rgba(0, 0, 0, 0.2);                                    /* "Shadows" — Cards */
  --shadow-0: 0 1px 5px -1px rgba(0, 0, 0, 0.15), 0 1px 6px rgba(0, 0, 0, 0.03); /* Shadow 0 — Buttons */
  --shadow-link: 0 1px 2.5px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.03); /* Links */
  --shadow-bar: 0 -10px 20px rgba(0, 0, 0, 0.1);                                 /* Sticky-Bar */

  --sticky-bar-height: 76px;
}

/* ---- Reset / Grundlagen ---- */

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--grau-950);
  background: var(--white);
  min-height: 100vh;
}

[x-cloak] { display: none !important; }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea {
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--grau-950);
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
}

img { max-width: 100%; display: block; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Layout ---- */

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-content {
  flex: 1;
  /* Vertikale Skala (Nachschärfung 21.07.): 32px Grund-Padding + 16px
     Titel-Margin = 48px Header→erster Titel, auf ALLEN Screens */
  padding: 32px 24px calc(var(--sticky-bar-height) + 32px + env(safe-area-inset-bottom, 0px));
}

/* Screens ohne eigenen Header (Detail, Metadaten, ...): Safe-Area oben
   zentral hier — Block D, systematisch statt pro Screen */
.app-content--no-header {
  padding-top: calc(32px + env(safe-area-inset-top, 0px));
}

/* ---- Gelber Header-Banner (Brand-Komponente, Teil 7) ---- */

.brand-header {
  background: var(--miwe-gelb-500);
  padding: 24px;
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
}

/* ---- Kompakte Kopfleiste (Korrektur-Runde 2, Block C) ----
   Stil der Bottom-Bar: gleiches Material/Blur — visuell ein Paar.
   Leise: rechtsbuendig, klein, keine Titel-Inszenierung. */

.compact-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between; /* Name links, Version rechts (Abnahme 21.07.) */
  align-items: baseline;
  gap: 8px;
  background: rgba(247, 247, 247, 0.92); /* Grau-100-Basis, Paar zur Bottom-Bar */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  padding: 10px 24px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
}

.compact-header-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--grau-700);
}

.compact-header-version {
  font-size: var(--text-2xs);
  color: var(--grau-500);
}

.brand-header .brand-mark {
  font-family: var(--font-brand);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-header h1 {
  font-family: var(--font-brand);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-top: 2px;
}

.brand-header .brand-claim {
  font-size: var(--text-sm);
  margin-top: 4px;
  max-width: 280px;
}

/* ---- Ueberschriften ---- */

.screen-title {
  font-family: var(--font-brand);
  font-size: var(--text-xl);
  font-weight: 700;
  margin: 16px 0 20px;
}

.screen-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 0 24px;
}

/* Runde 3 Block C: Zurueck als sekundaerer Box-Button (blauer Rahmen, Figma 276:5433) */
.screen-head .back-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-control);
  background: var(--white);
  border: 2px solid var(--miwe-blau-600);
  box-shadow: var(--shadow-0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.screen-head .screen-head-text { flex: 1; min-width: 0; }

.screen-head .screen-head-title {
  font-size: var(--text-xl);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.screen-head .screen-head-sub {
  font-size: var(--text-sm);
  color: var(--grau-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-control);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 10px 20px;
  min-height: 44px;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--miwe-blau-600);
  color: var(--white);
  box-shadow: var(--shadow-0);
}
.btn-primary:active { background: var(--miwe-blau-700); }
.btn-primary:disabled {
  background: var(--grau-100);
  color: var(--grau-500);
  cursor: default;
}

.btn-outline {
  background: var(--white);
  color: var(--grau-950);
  border: 1.5px solid var(--grau-300);
  box-shadow: var(--shadow-0);
}

/* Sekundaer im Box-Stil: blauer 2px-Rahmen (Runde 3, Figma Button-Variante) */
.btn-outline-blue {
  background: var(--white);
  color: var(--miwe-blau-600);
  border: 2px solid var(--miwe-blau-600);
  box-shadow: var(--shadow-0);
}

.btn-danger {
  background: var(--error-500);
  color: var(--white);
}

.btn-block { width: 100%; }

.btn-link {
  color: var(--miwe-blau-600);
  font-size: var(--text-sm);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  -webkit-tap-highlight-color: transparent;
}

.btn-link { filter: drop-shadow(var(--shadow-link)); cursor: pointer; }
/* Destruktiver Link (Runde 3 Block C: "Bilder loeschen" in Rot 500, Figma 276:5494) */
.btn-link--danger { color: var(--error-500); }

/* Hinweiszeile in der Sticky-Bar (Resume-Fall auf der Uebersicht) */
.bar-hint {
  font-size: var(--text-xs);
  color: var(--grau-700);
  margin: 0 2px 10px;
}
.btn-link:disabled,
.btn-link--disabled { color: var(--grau-500); cursor: default; filter: none; pointer-events: none; }

.btn.btn-disabled { background: var(--grau-100); color: var(--grau-500); cursor: default; pointer-events: none; }

/* Grosse Flaechen-Buttons (Neue Sammlung hinzufuegen) */
.btn-tile {
  width: 100%;
  background: var(--miwe-blau-50);
  border: 1px solid var(--miwe-blau-200);
  border-radius: var(--radius-card);
  color: var(--miwe-blau-600);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
}
.btn-tile:disabled { color: var(--grau-500); border-color: var(--grau-300); background: var(--grau-100); }

/* ---- Cards ---- */

.card {
  background: var(--white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
  margin-bottom: 16px;
}

/* Formular-Karte (Metadaten, Runde 3 Block A): flacherer shadow-lg +
   Grau-200-Rahmen nach Figma 276:4864, Padding 24 */
.card--form {
  border: 1px solid var(--grau-200);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1);
  padding: 24px;
}

.card--accent {
  background: var(--miwe-blau-50);
  box-shadow: none;
}

.card--success {
  background: var(--success-50);
  box-shadow: none;
  color: var(--success-600);
}

/* ---- Empty State (Start leer, 228:4271) ---- */

.empty-state {
  text-align: center;
  border-radius: var(--radius-modal);
  padding: 24px 16px;
}

.empty-state .empty-title {
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--grau-950);
  margin-bottom: 64px;
}

.empty-state .empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
}

.empty-state .empty-text {
  color: var(--miwe-blau-400);
  font-size: var(--text-sm);
  margin-bottom: 64px;
}

/* ---- Sammlungs-Card (228:4471) ---- */

.section-title {
  font-size: var(--text-xl);
  font-weight: 500;
  margin: 16px 0 20px;
}

.collection-card {
  background: var(--white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
  margin-bottom: 24px; /* Rhythmus innerhalb der Sektion (Figma: 24px) */
}

.collection-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--miwe-gelb-500);
  color: var(--grau-950);
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: var(--text-base);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.collection-card-info { flex: 1; min-width: 0; }

.collection-card-name {
  font-size: var(--text-lg);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-card-sub {
  font-size: var(--text-sm);
  color: var(--grau-600);
}

.card-menu-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grau-600);
  font-size: var(--text-xl);
  letter-spacing: 1px;
  flex-shrink: 0;
}

/* Thumbnail-Stapel (max 6 sichtbar, letzte Kachel +N) */
.thumb-stack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.thumb-stack .thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--grau-100);
}

.thumb-stack .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-stack .thumb .thumb-more {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  font-weight: 500;
}

.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grau-400);
}

/* ---- Historie (Erledigt-Liste) ---- */

/* Sektionswechsel: deutlich mehr Luft als innerhalb einer Sektion (48px) */
.history-section { margin-top: 48px; }

.history-item {
  background: var(--grau-50);
  border-radius: var(--radius-card);
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--grau-600);
}

.history-item .avatar {
  background: var(--grau-100);
  color: var(--grau-500);
}

.history-info { flex: 1; min-width: 0; }

.history-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--grau-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-sub { font-size: var(--text-xs); }

/* Server-Batch-ID: klein, kopierbar (user-select: all = ein Tap markiert alles) */
.history-batch-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: var(--grau-500);
  user-select: all;
  -webkit-user-select: all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--success-50);
  color: var(--success-600);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: 999px;
  padding: 3px 10px;
  flex-shrink: 0;
}

/* ---- Bilder-Grid (Sammlung verwalten, 228:5347 / 228:5596) ---- */

.image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.image-grid .grid-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--grau-100);
}

.image-grid .grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-grid .grid-item.selected {
  outline: 2px solid var(--error-500);
  outline-offset: -2px;
}

.image-grid .grid-item .select-mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.25);
}

/* Auswahl-Badge: roter Kreis 24px + weisses X (Figma 276:5437) */
.image-grid .grid-item .select-mark .mark-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--error-500);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
}

/* Upload-Status-Overlay pro Bild (2A-Kriterium) */
.image-grid .grid-item .upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-grid .grid-item .upload-overlay .upload-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--success-600);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
}

.select-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.select-header .check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-base);
}

.select-header .check-label input {
  width: 22px;
  height: 22px;
  accent-color: var(--miwe-blau-600);
}

.select-header .select-count {
  color: var(--miwe-blau-600);
  font-size: var(--text-sm);
  font-weight: 500;
}

/* ---- Sticky-Bottom-Bar (verbindliches Aktions-Pattern, Teil 9) ---- */

.sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  /* iOS-Tastatur-Nachfuehrung via visualViewport (Teil 9.8) */
  transform: translateY(calc(-1 * var(--kb-offset, 0px)));
  background: rgba(247, 247, 247, 0.92); /* Grau-100-Basis (Abnahme 21.07., 2. Runde) */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-bar);
  padding: 14px 24px calc(14px + env(safe-area-inset-bottom, 0px));
}

.sticky-bar-inner {
  max-width: 432px;
  margin: 0 auto;
}

.sticky-bar .bar-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.sticky-bar .bar-row .btn { flex: 1; font-size: var(--text-base); }

.sticky-bar .bar-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

/* Groessere Schrift darf enge Zeilen nicht ueberlappen lassen:
   Links schrumpfen mit Ellipsis statt uebereinander zu laufen */
.sticky-bar .bar-links .btn-link {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Bottom-Sheets ---- */

.overlay {
  position: fixed;
  inset: 0;
  /* Runde 3 (Design-Review Paul): dunkler Backdrop, ein Wert fuer die
     ganze Dialog-Familie (Sende-Popup, Namens-Dialog, Loesch-Dialoge) —
     Figma 276:4815 / 276:5536 / 276:5702 */
  background: rgba(0, 0, 0, 0.9);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.overlay--center { align-items: center; padding: 24px; }

.sheet {
  background: var(--white);
  border-radius: var(--radius-modal) var(--radius-modal) 0 0;
  width: 100%;
  max-width: 480px;
  padding: 12px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  animation: sheet-up 0.2s ease;
}

@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet .grabber {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--grau-300);
  margin: 0 auto 16px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sheet-head .sheet-cancel {
  color: var(--miwe-blau-600);
  font-size: var(--text-sm);
}

.sheet-head .sheet-title {
  font-size: var(--text-sm);
  font-weight: 500;
}

.sheet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--grau-100);
  width: 100%;
  text-align: left;
  font-size: var(--text-base);
}

.sheet-row:first-of-type { border-top: none; }
.sheet-row.row-blue { color: var(--miwe-blau-600); }
.sheet-row.row-danger { color: var(--error-500); }

/* ---- Modal (Lösch-Bestätigung, 228:4802 / Sende-Popup, 228:3663) ---- */

.modal {
  background: var(--white);
  border-radius: var(--radius-modal);
  width: 100%;
  max-width: 360px;
  padding: 24px;
  animation: sheet-up 0.15s ease;
}

/* Runde 3: Dialog-Familie nach Figma (Titel Bold 20 → xl-Token, Body 14 → sm) */
.modal .modal-title {
  font-size: var(--text-xl);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.modal .modal-title-icon { width: 32px; height: 32px; flex-shrink: 0; }

.modal .modal-text {
  font-size: var(--text-sm);
  color: var(--grau-950);
  margin-bottom: 24px;
}

.modal .modal-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal .modal-actions .btn-outline { border-width: 2px; }

/* Stat-Kacheln im Sende-Popup (gelb) */
.stat-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.stat-tile {
  background: var(--miwe-gelb-500);
  border-radius: var(--radius-card);
  padding: 16px;
}

.stat-tile .stat-value {
  /* Bewusst xl statt 2xl: der Wert muss wie im Figma EINZEILIG in die
     Kachel passen ("≈38,6 MB" bricht mit der +20%-Skala um) — xl (24px)
     entspricht exakt dem Figma-Literalwert (Bold 24). Geraete-Befund 26.07. */
  font-size: var(--text-xl);
  font-weight: 700;
  white-space: nowrap;
}

.stat-tile .stat-label { font-size: var(--text-sm); }

.hint-box {
  background: var(--grau-100);
  border-radius: var(--radius-card);
  padding: 16px 24px;
  font-size: var(--text-sm);
  color: var(--grau-950);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.hint-box img { flex-shrink: 0; margin-top: 4px; }

/* ---- Formulare (Metadaten, 228:3825) ---- */

.field {
  border: 1px solid var(--grau-400);
  border-radius: var(--radius-control);
  background: var(--white);
  padding: 8px 14px 10px;
  margin-bottom: 24px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Fokus: 2px Blau (Figma "Default Form (Text)" 276:4866 — border-2 #3060DC) */
.field:focus-within {
  border-color: var(--miwe-blau-600);
  box-shadow: inset 0 0 0 1px var(--miwe-blau-600);
}

.field label {
  display: block;
  font-size: var(--text-xs);
  color: var(--grau-700);
}

/* Pflichtfeld-Sternchen (Figma: Error/500) */
.field label .req { color: var(--error-500); }

.field input, .field textarea {
  font-size: var(--text-base);
  padding: 2px 0 0;
}

.field textarea { resize: vertical; min-height: 48px; }

.field-counter {
  font-size: var(--text-xs);
  color: var(--grau-950);
  margin: -20px 2px 24px 16px;
}

/* Karten-Ueberschrift "Metadaten hinzufuegen" (Runde 3 Block A, Medium 16 → base) */
.card-heading {
  font-size: var(--text-base);
  font-weight: 500;
  margin-bottom: 24px;
}

.fw-medium { font-weight: 500; }

/* Produkt-Auswahl */
.product-wrap { position: relative; }

.product-dropdown {
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  background: var(--white);
  border: 1px solid var(--grau-300);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-card);
  z-index: 30;
  max-height: 200px;
  overflow-y: auto;
}

.product-dropdown-item {
  padding: 10px 14px;
  font-size: var(--text-sm);
}

.product-dropdown-item:active { background: var(--miwe-blau-50); }

.chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--miwe-blau-50);
  color: var(--miwe-blau-600);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: var(--text-sm);
}

.chip .chip-remove { font-size: var(--text-base); padding: 0 2px; }

/* Divider innerhalb der Metadaten-Karte (Block C) */
.card-divider {
  border: none;
  border-top: 1px solid var(--grau-100);
  margin: 4px -16px 4px;
}

/* Paket-Auswahl (Block E, ohne Figma-Vorlage — siehe DEVIATIONS) */
.pick-card { cursor: pointer; }
.pick-card--selected { outline: 2px solid var(--miwe-blau-600); outline-offset: -2px; }
.pick-card .collection-card-head { margin-bottom: 0; }

.radio-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--grau-400);
  flex-shrink: 0;
  position: relative;
}

.radio-mark--on { border-color: var(--miwe-blau-600); }
.radio-mark--on::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--miwe-blau-600);
}

/* ---- Status / Banner ---- */

.banner {
  border-radius: var(--radius-card);
  padding: 12px 16px;
  font-size: var(--text-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.banner--warn { background: var(--warning-50); color: var(--warning-700); }
.banner--error { background: #fdecea; color: var(--error-500); }
.banner--info { background: var(--miwe-blau-50); color: var(--miwe-blau-600); }
.banner--offline {
  background: var(--grau-950);
  color: var(--white);
  border-radius: 0;
  margin: 0;
  justify-content: center;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}

.banner .banner-action {
  margin-left: auto;
  font-weight: 700;
  text-decoration: underline;
  flex-shrink: 0;
}

/* ---- Upload-Fortschritt (Sende-Ansicht) ---- */

/* Status-Karte im Sende-Screen: bleibt beim Scrollen unter der Kopfleiste
   angeheftet (Geraete-Befund 27.07. — lange Dateilisten schoben den
   Fortschritt aus dem Bild). Offset = Kopfleisten-Hoehe + Safe-Area. */
.send-progress {
  position: sticky;
  top: calc(52px + env(safe-area-inset-top, 0px));
  z-index: 20;
}

.progress-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--grau-100);
  overflow: hidden;
  margin: 12px 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--miwe-blau-600);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.upload-list { margin-top: 8px; }

.upload-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--grau-100);
  font-size: var(--text-sm);
}

.upload-item .upload-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-item .upload-state { color: var(--grau-600); flex-shrink: 0; }
.upload-item.state-uploaded .upload-state { color: var(--success-600); }
.upload-item.state-failed .upload-state { color: var(--error-500); }
.upload-item.state-uploading .upload-state { color: var(--miwe-blau-600); }

/* ---- Success (228:3761) ---- */

/* Gruene Kachel mittig im sichtbaren Bereich (Abnahme 21.07.):
   dvh beruecksichtigt die dynamische Safari-Leiste */
.success-center {
  min-height: calc(100vh - 260px);
  min-height: calc(100dvh - 260px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.success-screen {
  text-align: center;
  padding: 32px 20px;
  margin-bottom: 0;
}

.success-screen .success-title {
  font-family: var(--font-brand);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: 8px;
}

.success-screen .success-sub {
  font-size: var(--text-sm);
  margin-bottom: 32px;
}

.success-screen .success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 32px;
}

.success-screen .success-note {
  font-size: var(--text-sm);
  margin-bottom: 32px;
}

/* ---- Fataler Fehler-Screen (Teil 13) ---- */

.fatal-screen {
  padding: 48px 24px;
  padding-top: calc(48px + env(safe-area-inset-top, 0px));
  text-align: center;
}

.fatal-screen .fatal-icon { font-size: 40px; margin-bottom: 16px; }

.fatal-screen h2 {
  font-size: var(--text-xl);
  margin-bottom: 12px;
}

.fatal-screen p { color: var(--grau-700); font-size: var(--text-sm); }

/* ---- Utilities ---- */

.text-muted { color: var(--grau-600); }
.text-center { text-align: center; }
.text-sm { font-size: var(--text-sm); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

/* Icons (inline SVG) */
.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; }

/* ============================================================
   Admin-Bereich (Design-Angleichung an den Client, 27.07.2026)
   admin.html nutzt app.css; IDs/Verhalten unveraendert.
   ============================================================ */

.hidden { display: none !important; }

.app-content--admin {
  padding-bottom: 48px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

#msg { margin-bottom: 16px; }

.banner--success { background: var(--success-50); color: var(--success-600); }

.btn-small {
  padding: 8px 14px;
  min-height: 36px;
  font-size: var(--text-xs);
}

/* Stat-Kacheln: 2x2 (mobil), 4 nebeneinander ab Desktop */
.stat-tiles--admin { grid-template-columns: 1fr 1fr; margin: 0 0 8px; }
.stat-tiles--admin .stat-value { font-size: var(--text-xl); white-space: nowrap; }

.section-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
}
.section-bar .section-title { margin: 0; }

/* Status-/Mail-Badges in Client-Tokens */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: var(--text-2xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.badge-success { background: var(--success-50); color: var(--success-600); }
.badge-danger { background: #fdecea; color: var(--error-500); }
.badge-warn { background: var(--warning-50); color: var(--warning-700); }
.badge-muted { background: var(--grau-100); color: var(--grau-700); }

/* Batch-ID / PIN: monospace, ein Tap markiert alles */
.mono-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-2xs);
  color: var(--grau-500);
  user-select: all;
  -webkit-user-select: all;
  word-break: break-all;
}

.pin-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-xs);
  background: var(--grau-100);
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 1px;
  user-select: all;
  -webkit-user-select: all;
}

.dl-link { color: var(--miwe-blau-600); font-weight: 500; text-decoration: underline; }

/* Batch-Karten (mobil) */
.batch-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}
.batch-card-header strong { font-size: var(--text-base); font-weight: 500; }
.batch-card-header .text-muted { font-size: var(--text-xs); color: var(--grau-500); }

.batch-card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 6px 0;
  font-size: var(--text-sm);
  border-top: 1px solid var(--grau-100);
}
.batch-card-row:first-child { border-top: none; }
.batch-card-label {
  color: var(--grau-700);
  font-size: var(--text-xs);
  flex-shrink: 0;
}
.batch-card-row > span:last-child { text-align: right; min-width: 0; }

.batch-card-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}
.batch-card-actions .btn { flex: 1; }

/* Tabelle (Desktop) */
.batch-table-wrapper { overflow-x: auto; }
.batch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}
.batch-table th {
  text-align: left;
  color: var(--grau-700);
  font-weight: 500;
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--grau-300);
  white-space: nowrap;
}
.batch-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--grau-100);
  vertical-align: top;
}
.batch-table .batch-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 160px;
}
.batch-table .batch-actions .btn { width: 100%; }

/* Mobil Karten, Desktop Tabelle */
.batch-desktop { display: none; }
@media (min-width: 760px) {
  .batch-cards { display: none; }
  .batch-desktop { display: block; }
  .stat-tiles--admin { grid-template-columns: repeat(4, 1fr); }
}

/* Admin darf breiter als die Client-App (Desktop-Tabelle) */
.app--admin { max-width: 1024px; }
.app--admin .compact-header { align-items: center; }
.app--admin #logout-btn { min-height: 32px; padding: 4px 14px; }

.section-bar-actions { display: flex; gap: 10px; }
