.upload-workspace-grid {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(0, 2fr);
  gap: 18px;
  align-items: start;
  padding: 16px clamp(10px, 2vw, 24px) 24px;
}

.upload-panel,
.upload-data-status-panel,
.upload-disclosure {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(48, 48, 52, 0.96), rgba(31, 31, 34, 0.98));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

.upload-panel,
.upload-data-status-panel {
  padding: 18px;
}

.upload-panel-heading,
.upload-data-status-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.upload-panel-heading h2,
.upload-data-status-heading h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: 1;
}

.upload-eyebrow {
  margin: 0 0 5px;
  color: #ff7373;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.upload-panel-format,
.upload-data-status-summary {
  flex: 0 1 auto;
  border-radius: 999px;
  padding: 6px 9px;
  color: #d6d6d8;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  line-height: 1.2;
  text-align: right;
}

.upload-data-status-summary:empty {
  display: none;
}

.upload-panel .dropzone {
  margin: 0 0 12px;
  padding: 24px 12px;
}

.upload-panel .file-list {
  margin-top: 10px;
}

.upload-view-state {
  margin: 8px 0;
  border-radius: 8px;
  padding: 10px 12px;
  color: #d8d8da;
  background: rgba(255, 255, 255, 0.055);
  font-size: 0.84rem;
}

.upload-view-state:empty,
.upload-view-state[hidden] {
  display: none;
}

.upload-view-state[data-state='error'] {
  color: #ffd0d0;
  background: rgba(201, 45, 45, 0.2);
  border: 1px solid rgba(255, 101, 101, 0.45);
}

.upload-data-status-legend {
  margin: 0 0 11px;
  color: #aeb0b5;
  font-size: 0.68rem;
  line-height: 1.25;
}

.upload-data-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px 3px;
  align-items: stretch;
  min-height: 58px;
  padding: 7px 0 3px;
}

.upload-status-tile-wrap {
  position: relative;
  min-width: 0;
  padding-top: 6px;
}

.upload-status-tile-wrap--sop {
  grid-column: span 2;
}

.upload-status-tile {
  width: 100%;
  min-width: 44px;
  min-height: 48px;
  border: 1px solid #6e7278;
  border-radius: 7px;
  padding: 8px 4px 5px;
  color: #f5f5f5;
  background: linear-gradient(180deg, #414449, #292b2f);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.06),
    0 2px 5px rgba(0, 0, 0, 0.22);
  cursor: help;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.upload-status-tile--fresh {
  border-color: #53bd7c;
  background: linear-gradient(180deg, #27754a, #1c5537);
}

.upload-status-tile--stale,
.upload-status-tile--unknown {
  border-color: #74787e;
  background: linear-gradient(180deg, #44474c, #2d2f33);
}

.upload-status-tile--unknown {
  border-style: dashed;
}

.upload-status-tile:hover,
.upload-status-tile[aria-expanded='true'] {
  border-color: #9ec2ff;
  box-shadow:
    0 0 0 2px rgba(91, 157, 255, 0.22),
    0 5px 12px rgba(0, 0, 0, 0.32);
  transform: translateY(-1px);
}

.upload-status-tile:focus-visible {
  outline: 3px solid #75aaff;
  outline-offset: 2px;
}

.upload-status-tile-label {
  display: block;
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-status-tile-wrap--sop .upload-status-tile-label {
  letter-spacing: 0.03em;
}

.upload-status-date-badge {
  position: absolute;
  z-index: 2;
  top: -4px;
  right: -3px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  max-width: calc(100% + 2px);
  height: 18px;
  border: 2px solid #1f2023;
  border-radius: 10px;
  padding: 1px 4px 0;
  color: #fff;
  background: #666a70;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.upload-status-date-badge--fresh {
  background: #31895a;
}

.upload-status-date-badge--stale,
.upload-status-date-badge--unknown {
  background: #666a70;
}

.upload-status-tooltip {
  position: fixed;
  z-index: 65000;
  width: min(280px, calc(100vw - 16px));
  border: 1px solid rgba(132, 177, 255, 0.7);
  border-radius: 9px;
  padding: 10px 12px;
  color: #f5f5f6;
  background: rgba(25, 27, 31, 0.98);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.48);
  font-size: 0.75rem;
  line-height: 1.35;
  pointer-events: auto;
}

.upload-status-tooltip[hidden] {
  display: none;
}

.upload-status-tooltip-title {
  display: block;
  margin-bottom: 6px;
  color: #fff;
  font-size: 0.84rem;
}

.upload-status-tooltip p {
  margin: 3px 0;
  overflow-wrap: anywhere;
  color: #d5d8dd;
}

.upload-status-tooltip p strong {
  color: #aebfe0;
}

.upload-status-skeleton {
  min-height: 48px;
  border-radius: 7px;
  background: linear-gradient(100deg, #37393d 25%, #484b50 42%, #37393d 60%);
  background-size: 240% 100%;
  animation: upload-status-pulse 1.2s ease-in-out infinite;
}

@keyframes upload-status-pulse {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

.upload-history-table-wrap {
  width: 100%;
  min-width: 0;
}

.upload-history-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0 5px;
  color: #f0f0f1;
  font-size: 0.78rem;
}

.upload-history-table th {
  padding: 4px 7px;
  color: #9fa0a5;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
}

.upload-history-table td {
  overflow-wrap: anywhere;
  padding: 9px 7px;
  background: rgba(255, 255, 255, 0.055);
  vertical-align: top;
}

.upload-history-table tr td:first-child {
  border-radius: 7px 0 0 7px;
}

.upload-history-table tr td:last-child {
  border-radius: 0 7px 7px 0;
}

.upload-history-table tr[data-result='failed'] td,
.upload-history-table tr[data-result='abandoned'] td {
  background: rgba(188, 54, 54, 0.16);
}

.upload-status-primary {
  display: block;
  color: #fff;
  font-weight: 650;
}

.upload-history-table small {
  display: block;
  margin-top: 3px;
  color: #aeb0b5;
  font-size: 0.69rem;
  line-height: 1.25;
}

.upload-disclosure {
  overflow: clip;
}

.upload-history-disclosure {
  margin-top: 13px;
  border-radius: 10px;
  box-shadow: none;
}

.upload-help-disclosure {
  grid-column: 1 / -1;
}

.upload-disclosure > summary {
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  padding: 13px 16px;
  color: #f4f4f5;
  font-weight: 700;
}

.upload-disclosure > summary::-webkit-details-marker {
  display: none;
}

.upload-disclosure > summary::after {
  content: '+';
  float: right;
  color: #ff7373;
  font-size: 1.1rem;
}

.upload-disclosure[open] > summary::after {
  content: '−';
}

.upload-disclosure > summary:focus-visible,
.upload-history-more:focus-visible,
.upload-history-filters select:focus-visible {
  outline: 3px solid #75aaff;
  outline-offset: 2px;
}

.upload-disclosure-body {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px;
}

.upload-help-disclosure .import-guide-modern {
  margin: 0;
  border: 0;
  box-shadow: none;
}

.upload-history-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.upload-history-filters label {
  min-width: 0;
  color: #bfc0c4;
  font-size: 0.68rem;
}

.upload-history-filters select {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 3px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 7px 24px 7px 7px;
  color: #f4f4f5;
  background: #303034;
}

.upload-history-more {
  display: block;
  margin: 10px auto 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  padding: 8px 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.upload-history-more[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .upload-status-tile,
  .upload-status-skeleton {
    transition: none;
    animation: none;
  }
}

@media (max-width: 900px) {
  .upload-workspace-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .upload-help-disclosure {
    grid-column: 1;
  }
}

@media (max-width: 620px) {
  .upload-workspace-grid {
    gap: 10px;
    padding: 10px 7px 18px;
  }

  .upload-panel,
  .upload-data-status-panel {
    padding: 12px;
  }

  .upload-panel-heading,
  .upload-data-status-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .upload-data-status-summary {
    text-align: left;
  }

  .upload-history-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .upload-history-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .upload-history-table,
  .upload-history-table tbody,
  .upload-history-table tr {
    display: block;
    width: 100%;
  }

  .upload-history-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    margin-bottom: 9px;
    border-radius: 8px;
    overflow: hidden;
  }

  .upload-history-table td {
    display: block;
    border-radius: 0 !important;
    padding: 8px;
  }

  .upload-history-table td::before {
    display: block;
    margin-bottom: 3px;
    color: #94969b;
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .upload-history-table td:nth-child(1)::before {
    content: 'Typ';
  }
  .upload-history-table td:nth-child(2)::before {
    content: 'Datenstand';
  }
  .upload-history-table td:nth-child(3)::before {
    content: 'Abschluss';
  }
  .upload-history-table td:nth-child(4)::before {
    content: 'Admin';
  }
  .upload-history-table td:nth-child(5)::before {
    content: 'Ergebnis';
  }
  .upload-history-table td:nth-child(6)::before {
    content: 'Dateien';
  }
}

@media (max-width: 360px) {
  .upload-workspace-grid {
    padding-right: 72px;
  }

  .upload-data-status-panel {
    padding: 8px 2px;
  }

  .upload-data-status-grid {
    column-gap: 2px;
  }

  .upload-history-filters,
  .upload-history-table tr {
    grid-template-columns: minmax(0, 1fr);
  }

  .upload-panel-format,
  .upload-data-status-summary {
    white-space: normal;
  }
}
