.documents-main {
  width: min(100%, 960px);
  margin-inline: auto;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 4vw, 2.25rem);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.unlock-panel {
  max-width: 560px;
  margin-inline: auto;
}

.panel h2 {
  margin: 0 0 0.35rem;
  font-size: var(--step-2);
  line-height: 1.25;
}

.panel-intro,
.muted,
.message,
.search-status {
  color: var(--muted);
}

.panel-intro {
  margin: 0 0 1.25rem;
}

#unlock-form label,
.search-field label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 750;
}

.password-row {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
}

input {
  min-width: 0;
  min-height: 50px;
  border: 2px solid var(--border-strong);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
}

input:hover {
  border-color: var(--link);
}

.password-row input {
  flex: 1;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.message {
  margin-bottom: 0;
}

.message:empty,
.search-status:empty {
  display: none;
}

.message.error {
  color: var(--danger);
  font-weight: 750;
}

.archive-header {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.archive-header p {
  margin: 0;
}

.search-field {
  width: min(100%, 420px);
}

.search-field input {
  width: 100%;
}

.search-status {
  margin: 0.45rem 0 0;
  font-size: var(--step--1);
}

.requested-message {
  margin: 0 0 1rem;
  padding: 0.8rem 1rem;
  border-left: 5px solid var(--action-bg);
  border-radius: 8px;
  background: var(--accent-soft);
}

.file-tree,
.file-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-tree > ul {
  display: grid;
  gap: 0.65rem;
}

.folder {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.folder > summary {
  min-height: 54px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--surface-subtle);
  font-weight: 750;
  cursor: pointer;
}

.folder > summary:hover {
  background: var(--accent-soft);
}

.folder-name {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.folder-name::before {
  content: "📁";
  font-size: 1.05em;
}

.folder[open] > summary .folder-name::before {
  content: "📂";
}

.folder-meta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.folder-count {
  flex: 0 0 auto;
  padding: 0.08rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8em;
  font-weight: 700;
}

.folder-chevron {
  color: var(--link);
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1;
  transition: transform 140ms ease;
}

.folder[open] > summary .folder-chevron {
  transform: rotate(90deg);
}

.folder > ul {
  padding: 0 0.8rem 0.45rem;
}

.folder .folder {
  margin-top: 0.55rem;
}

.file-row {
  min-height: 64px;
  padding: 0.65rem 0.3rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.file-row:last-child {
  border-bottom: 0;
}

.file-row:hover {
  background: var(--surface-subtle);
}

.file-information {
  min-width: 0;
}

.file-heading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.file-icon {
  flex: 0 0 auto;
  font-size: 1.25em;
  line-height: 1;
}

.file-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.file-size {
  display: block;
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.82em;
}

.file-actions {
  display: flex;
  gap: 0.45rem;
}

.file-actions button {
  min-height: 42px;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
}

.file-actions .download-button {
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--link);
}

.file-actions .download-button:hover {
  border-color: var(--link);
  background: var(--surface-subtle);
  color: var(--link-hover);
}

.empty-state {
  padding: 2rem 1rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .archive-header {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field {
    width: 100%;
  }

  .file-row {
    grid-template-columns: 1fr;
  }

  .file-actions button {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .password-row {
    flex-direction: column;
  }

  .password-row button {
    width: 100%;
  }

  .folder > summary {
    padding-inline: 0.75rem;
  }

  .folder > ul {
    padding-inline: 0.45rem;
  }

  .file-actions {
    flex-direction: column;
  }
}
