/* Upload-Fortschritt und kompakte Dateiaktionen */

.uploadFields {
  grid-template-columns: minmax(145px, .8fr) minmax(190px, 1fr) minmax(240px, 1.35fr) minmax(150px, .8fr) auto;
  align-items: end;
}

.supplierDocumentName {
  min-width: 0;
}

.supplierDocumentName span {
  display: block;
}

@media (max-width: 980px) {
  .uploadFields {
    grid-template-columns: 1fr 1fr;
  }

  .uploadFields button {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .uploadFields {
    grid-template-columns: 1fr;
  }
}

.uploadProgress {
  margin: 10px 0 14px;
  padding: 11px 13px;
  border: 1px solid #c8d7ca;
  border-radius: 10px;
  background: #f4f8f2;
  color: #244b35;
}

.uploadProgress[hidden] {
  display: none;
}

.uploadProgressHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 750;
}

.uploadProgressLabel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uploadProgressValue {
  flex: 0 0 auto;
  min-width: 3.5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.uploadProgressTrack {
  position: relative;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce5dc;
}

.uploadProgressBar {
  display: block;
  width: var(--upload-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2e6c48, #75a659);
  box-shadow: 0 0 8px #4c855659;
  transition: width .18s ease-out;
}

.uploadProgressBar::after {
  content: "";
  display: block;
  width: 45%;
  height: 100%;
  margin-left: auto;
  background: linear-gradient(90deg, transparent, #ffffffb8);
  animation: uploadShimmer 1.05s linear infinite;
}

.uploadProgress.isIndeterminate .uploadProgressValue {
  visibility: hidden;
}

.uploadProgress.isIndeterminate .uploadProgressBar {
  width: 34%;
  animation: uploadIndeterminate 1.15s ease-in-out infinite;
}

.uploadForm.isUploading,
.projectUploadForm.isUploading,
.offerUploadForm.isUploading {
  cursor: wait;
}

.uploadForm.isUploading .dropzone,
.projectUploadForm.isUploading .dropzone,
.offerUploadForm.isUploading .dropzone {
  border-color: #72a27b;
  background: #f0f7ed;
  box-shadow: 0 0 0 3px #4f8b5a17;
}

.uploadForm.isUploading :is(input, select, button),
.projectUploadForm.isUploading :is(input, select, button),
.offerUploadForm.isUploading :is(input, select, button) {
  cursor: wait;
}

@keyframes uploadShimmer {
  from { transform: translateX(-180%); }
  to { transform: translateX(210%); }
}

@keyframes uploadIndeterminate {
  0% { transform: translateX(-115%); }
  50% { transform: translateX(95%); }
  100% { transform: translateX(300%); }
}

/* Das Symbol wird als Vektor gezeichnet und bleibt auch bei kleiner Größe scharf. */
.deleteDocumentButton {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #e3c5c1;
  border-radius: 9px;
  background: #fff8f7;
  color: #a64135;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.deleteDocumentButton::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 3h6l1 2h4v2H4V5h4l1-2Zm-2 6h10l-1 12H8L7 9Zm3 2v7h2v-7h-2Zm4 0v7h2v-7h-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 3h6l1 2h4v2H4V5h4l1-2Zm-2 6h10l-1 12H8L7 9Zm3 2v7h2v-7h-2Zm4 0v7h2v-7h-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.deleteDocumentButton:hover {
  border-color: #ca7167;
  background: #fae3df;
  color: #862e25;
  transform: translateY(-1px);
}

.deleteDocumentButton:focus-visible {
  outline: 3px solid #d68b8266;
  outline-offset: 2px;
}

.deleteDocumentButton:disabled {
  opacity: .58;
  cursor: wait;
  transform: none;
}

/* Dateizeilen behalten ihre bisherige Spaltenaufteilung; die Aktion sitzt rechts. */
.documents article:has(> .deleteDocumentButton) {
  position: relative;
  padding-right: 64px;
}

.documents article > .deleteDocumentButton {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
}

.documents article > .deleteDocumentButton:hover {
  transform: translateY(calc(-50% - 1px));
}

/* Foto-Karten erhalten eine unaufdringliche Aktion oben rechts. */
.photoCardWrap,
.offerPhotoWrap {
  position: relative;
  min-width: 0;
}

.photoCardWrap > .photoCard,
.offerPhotoWrap > .offerPhoto {
  display: block;
  height: 100%;
}

.photoCardWrap > .deleteDocumentButton,
.offerPhotoWrap > .deleteDocumentButton {
  position: absolute;
  z-index: 2;
  top: 7px;
  right: 7px;
  width: 32px;
  height: 32px;
  border-color: #ffffffcc;
  background: #fffffff0;
  box-shadow: 0 2px 10px #13251c40;
}

@media (max-width: 700px) {
  .uploadProgress {
    margin-bottom: 12px;
  }

  .documents article:has(> .deleteDocumentButton) {
    padding-right: 56px;
  }

  .documents article > .deleteDocumentButton {
    right: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .uploadProgressBar,
  .deleteDocumentButton {
    transition: none;
  }

  .uploadProgressBar::after,
  .uploadProgress.isIndeterminate .uploadProgressBar {
    animation-duration: 2.4s;
  }
}

/* Gemeinsamer Mehrfach-Foto-Upload für Angebote und Aufträge. */
.photoUploadLauncher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 17px 18px;
  border: 2px dashed #94a69a;
  border-radius: 12px;
  background: #f8faf7;
}

.photoUploadLauncher strong,
.photoUploadLauncher span {
  display: block;
}

.photoUploadLauncher strong {
  color: #244b35;
}

.photoUploadLauncher span {
  margin-top: 4px;
  color: #69736d;
  font-size: 13px;
}

.photoUploadLauncher button,
.cameraActions button,
#finishPhotoUpload {
  flex: 0 0 auto;
  border: 0;
  border-radius: 10px;
  padding: 12px 17px;
  background: #dfeeb8;
  color: #173724;
  font-weight: 750;
}

#photoCaptureDialog {
  width: min(1120px, 96vw);
  max-width: none;
  height: min(850px, 94dvh);
  max-height: 94dvh;
}

.photoCapturePanel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px;
  overflow: hidden;
}

.photoCaptureEyebrow {
  color: #688073;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.photoCapturePanel .dialogHead h2 {
  margin: 3px 0 16px;
}

.photoCaptureWorkspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, .8fr);
  gap: 18px;
  min-height: 0;
  flex: 1;
}

.photoCameraStage,
.photoSelection {
  min-height: 0;
  border: 1px solid #d8e0d9;
  border-radius: 13px;
  background: #f7f9f6;
}

.photoCameraStage {
  display: flex;
  flex-direction: column;
  padding: 12px;
}

#photoCaptureVideo {
  display: block;
  width: 100%;
  min-height: 0;
  flex: 1;
  border-radius: 11px;
  background: #142019;
  object-fit: cover;
}

#photoCaptureVideo[hidden] {
  display: none;
}

#photoCaptureMessage {
  margin: 10px 0 0;
  min-height: 2.8em;
  text-align: center;
}

.cameraActions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.cameraActions .secondary {
  padding: 11px 15px;
}

.photoSelection {
  display: flex;
  flex-direction: column;
  padding: 14px;
  overflow: hidden;
}

.photoSelectionHead {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.photoSelectionHead span {
  color: #69736d;
  font-size: 12px;
}

.photoCaptureQueue {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 10px;
  min-height: 120px;
  overflow: auto;
}

.photoCaptureQueue:empty::before {
  content: "Die Vorschaubilder erscheinen hier.";
  grid-column: 1 / -1;
  padding: 34px 14px;
  border: 1px dashed #bdc8be;
  border-radius: 10px;
  color: #748078;
  text-align: center;
}

.queuedPhoto {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d4ddd5;
  border-radius: 10px;
  background: white;
}

.queuedPhoto img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e7ece7;
}

.queuedPhoto span {
  display: block;
  padding: 8px;
  overflow: hidden;
  color: #526159;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.removeQueuedPhoto {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #ffffffd9;
  border-radius: 50%;
  background: #fffffff2;
  color: #8d3029;
  box-shadow: 0 2px 9px #14251c55;
  font-size: 23px;
  line-height: 1;
}

.photoCaptureFinish {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
}

.photoCaptureFinish span {
  color: #68766e;
  font-size: 12px;
}

#finishPhotoUpload {
  min-width: 220px;
}

#finishPhotoUpload:disabled,
.photoUploadLauncher button:disabled,
.cameraActions button:disabled,
.removeQueuedPhoto:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* PDF-Dateien bleiben in AVTL und werden fast bildschirmfüllend angezeigt. */
.documentPreviewLink {
  cursor: pointer;
}

#documentPreviewDialog {
  width: min(1180px, 96vw);
  max-width: none;
  height: 94dvh;
  max-height: 94dvh;
}

.documentPreviewPanel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px 18px 18px;
}

.documentPreviewHead {
  align-items: center;
  gap: 14px;
}

.documentPreviewHead h2 {
  margin: 0;
  overflow: hidden;
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#documentPreviewFrame {
  width: 100%;
  min-height: 0;
  flex: 1;
  margin-top: 12px;
  border: 1px solid #ccd5cd;
  border-radius: 10px;
  background: #f2f4f0;
}

@media (max-width: 760px) {
  .photoUploadLauncher,
  .photoCaptureFinish,
  .cameraActions {
    align-items: stretch;
    flex-direction: column;
  }

  .photoUploadLauncher button,
  #finishPhotoUpload {
    width: 100%;
  }

  #photoCaptureDialog {
    width: 98vw;
    height: 96dvh;
    max-height: 96dvh;
  }

  .photoCapturePanel {
    padding: 14px;
    overflow: auto;
  }

  .photoCaptureWorkspace {
    display: flex;
    flex: none;
    flex-direction: column;
  }

  #photoCaptureVideo {
    min-height: min(54vh, 440px);
  }

  .photoSelection {
    min-height: 230px;
  }

  .photoCaptureQueue {
    max-height: 45vh;
  }

  #documentPreviewDialog {
    width: 98vw;
    height: 96dvh;
    max-height: 96dvh;
  }

  .documentPreviewPanel {
    padding: 12px;
  }
}
/* Outlook-Nachrichten werden als unveränderte Originaldateien gespeichert. */
.emailUploadForm { margin-bottom: 18px; }
.emailDropzone { min-height: 112px; background: #f3f8f2; }
.emailDropzone:focus-within { outline: 3px solid #557b43; outline-offset: 3px; }
.emailUploadHint, .emailUploadHelp { font-size: 12px; color: #586751; }
.emailUploadHint { margin: 10px 0; line-height: 1.6; }
.emailUploadStatus { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.emailUploadStatus:empty, .emailUploadErrors:empty { display: none; }
.emailUploadErrors { padding-left: 20px; color: #9b3228; font-size: 13px; overflow-wrap: anywhere; }
.emailUploadActions { display: flex; flex-wrap: wrap; gap: 8px; }
.emailUploadHelp { margin-top: 12px; }
.emailUploadHelp summary { cursor: pointer; padding: 5px 0; }
.emailUploadHelp p { line-height: 1.6; max-width: 760px; }
.emailSection .projectDocument > div { min-width: 0; }
.emailSection .projectDocument b, .emailSection .projectDocument span { overflow-wrap: anywhere; }
