.documents-workspace {
  min-width: 0;
  padding: 14px;
  border: 1px solid #e1e5de;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(40, 48, 41, 0.06);
}

#workspace-content:has(.documents-workspace) > .project-picker {
  display: flex;
  align-items: center;
  width: min(100%, 680px);
  min-height: 0;
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: none;
}

#workspace-content:has(.documents-workspace) > .project-picker label {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  color: #5d685e;
  font-size: 13px;
  font-weight: 700;
}

#workspace-content:has(.documents-workspace) > .project-picker select {
  min-height: 42px;
  margin: 0;
  background: #f7f8f5;
}

.documents-workspace > .functional-tabs {
  margin: 0 0 14px;
  padding: 5px;
  border: 0;
  border-radius: 12px;
  background: #eef1eb;
  scrollbar-width: none;
}

.documents-workspace > .functional-tabs::-webkit-scrollbar { display: none; }

.documents-workspace > .functional-tabs [role='tab'] {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #59645a;
  box-shadow: none;
}

.documents-workspace > .functional-tabs [role='tab'][aria-selected='true'] {
  background: #fff;
  color: #1c4f2e;
  box-shadow: 0 2px 8px rgba(33, 47, 36, 0.09);
}

.documents-workspace [data-functional-panel] { min-width: 0; }

.documents-registry,
.documents-history-card,
.documents-publication-card,
.documents-upload-card {
  margin: 0;
  border-color: #e1e5de;
  border-radius: 16px;
  box-shadow: none;
}

.documents-history-card,
.documents-publication-card { margin-top: 14px; }

.documents-header,
.documents-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
}

.documents-header h2,
.documents-detail-header h2 {
  margin: 4px 0 7px;
  color: #242924;
  line-height: 1.15;
  text-wrap: balance;
}

.documents-header h2 { font-size: clamp(25px, 3vw, 34px); }

.documents-header p,
.documents-detail-header p {
  max-width: 760px;
  margin: 0;
  color: #657067;
  text-wrap: pretty;
}

.documents-header-actions,
.document-row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.documents-header-actions { justify-content: flex-end; }

.documents-header-actions button,
.document-row-actions button,
.document-row-actions .button-link,
.documents-empty button,
.documents-pagination button,
.documents-filter > button {
  min-height: 42px;
  transition-property: background-color, border-color, color, transform, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.documents-header-actions button:active,
.document-row-actions button:active,
.document-row-actions .button-link:active,
.documents-empty button:active,
.documents-pagination button:active { transform: scale(0.97); }

.documents-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0 14px;
}

.documents-summary > div {
  display: grid;
  gap: 3px;
  min-height: 78px;
  padding: 14px 16px;
  border: 1px solid #e4e8e1;
  border-radius: 12px;
  background: #f8f9f6;
}

.documents-summary strong {
  color: #2c392e;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.documents-summary span {
  color: #718074;
  font-size: 12px;
}

.documents-security-note {
  margin: 0 0 14px;
  padding: 0 14px;
  border: 1px solid #e4e8e1;
  border-radius: 12px;
  background: #fbfcfa;
}

.documents-security-note summary {
  min-height: 44px;
  padding: 12px 0;
  color: #4d5c50;
  font-weight: 700;
  cursor: pointer;
}

.documents-security-note p {
  margin: 0 0 14px;
  color: #67736a;
  font-size: 13px;
  line-height: 1.55;
}

.documents-filter {
  display: flex;
  align-items: end;
  gap: 10px;
  margin: 0 0 14px;
}

.documents-filter #document-search {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 10px;
  flex: 1 1 auto;
  margin: 0;
}

.documents-filter #document-search h2 {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 16px;
}

.documents-filter #document-search label { margin: 0; }
.documents-filter #document-search input { min-height: 44px; margin: 5px 0 0; }
.documents-filter #document-search button { min-height: 44px; }

.documents-table {
  width: 100%;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

.documents-table th:first-child { width: 40%; }
.documents-table th:nth-child(2) { width: 10%; }
.documents-table th:nth-child(3) { width: 12%; }
.documents-table th:nth-child(4) { width: 13%; }
.documents-table th:last-child { width: 25%; }

.documents-table th {
  padding: 11px 12px;
  background: #f0f3ed;
  color: #5f6b61;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.documents-table td {
  padding: 14px 12px;
  vertical-align: middle;
  border-bottom-color: #e8ebe6;
}

.documents-table tbody tr:last-child td { border-bottom: 0; }

.document-identity {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.document-identity > strong,
.document-identity > small {
  overflow-wrap: anywhere;
}

.document-identity > small { color: #778078; }

.document-identity .status-tag {
  justify-self: start;
  margin-top: 2px;
}

.document-version {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf2e9;
  color: #3e5943;
}

.documents-empty {
  display: grid;
  justify-items: start;
  gap: 8px;
  min-height: 220px;
  padding: clamp(28px, 6vw, 58px);
  border: 1px dashed #cbd3c7;
  border-radius: 14px;
  background: #fafbf8;
}

.documents-empty h3 { margin: 3px 0 0; font-size: 24px; text-wrap: balance; }
.documents-empty p { max-width: 580px; margin: 0 0 8px; color: #68736a; text-wrap: pretty; }

.documents-pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.documents-pagination > :last-child { justify-self: end; }
.documents-pagination > span { color: #69746b; font-size: 13px; font-variant-numeric: tabular-nums; }

.documents-count {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef2eb;
  color: #516255;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.documents-version-form {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  background: #f7f9f5;
}

.documents-version-form form,
.documents-publication-card form,
.documents-upload-card form { margin: 0; }

.documents-version-form form h2,
.documents-publication-card form h2,
.documents-upload-card form h2 { font-size: 18px; }

.documents-upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 18px;
  margin-top: 20px;
}

.documents-upload-layout > div,
.documents-upload-layout aside {
  padding: 18px;
  border: 1px solid #e2e6df;
  border-radius: 13px;
}

.documents-upload-layout aside { background: #f6f8f3; }
.documents-upload-layout aside h3 { margin-top: 0; }
.documents-upload-layout aside ul { margin: 0; padding-left: 20px; color: #616d63; }
.documents-upload-layout aside li + li { margin-top: 9px; }

.documents-upload-progress:not(:empty) {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #ccd7c8;
  border-radius: 12px;
  background: #f3f7f0;
}

.documents-footnote {
  margin: 12px 4px 0;
  color: #7a837c;
  font-size: 12px;
}

@media (max-width: 720px) {
  .documents-workspace { padding: 9px; border-radius: 15px; }
  #workspace-content:has(.documents-workspace) > .project-picker { width: 100%; }
  #workspace-content:has(.documents-workspace) > .project-picker label { grid-template-columns: 1fr; gap: 5px; }
  .documents-workspace > .functional-tabs { flex-wrap: nowrap; }
  .documents-workspace > .functional-tabs [role='tab'] { flex: 0 0 auto; }
  .documents-registry,
  .documents-history-card,
  .documents-publication-card,
  .documents-upload-card { padding: 16px; border-radius: 13px; }
  .documents-header,
  .documents-detail-header { display: grid; gap: 14px; }
  .documents-header-actions { justify-content: stretch; }
  .documents-header-actions button { flex: 1 1 150px; }
  .documents-summary { grid-template-columns: 1fr; }
  .documents-summary > div { min-height: 62px; }
  .documents-filter { display: grid; }
  .documents-filter #document-search { grid-template-columns: 1fr; }
  .documents-filter #document-search h2 { grid-column: auto; }
  .documents-filter #document-search button,
  .documents-filter > button { width: 100%; }
  .documents-table { min-width: 760px; }
  .document-row-actions { align-items: stretch; }
  .document-row-actions > * { flex: 1 1 120px; text-align: center; }
  .documents-pagination { grid-template-columns: 1fr 1fr; }
  .documents-pagination > span:nth-child(2) { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
  .documents-upload-layout { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .documents-header-actions button,
  .document-row-actions button,
  .document-row-actions .button-link,
  .documents-empty button,
  .documents-pagination button,
  .documents-filter > button { transition-duration: 0.01ms; }
}
