.pa-upload-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 90, 0, 0.28);
  background: rgba(255, 90, 0, 0.08);
  color: var(--accent, #ff5a00);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.pa-upload-btn:hover {
  background: rgba(255, 90, 0, 0.12);
  border-color: rgba(255, 90, 0, 0.35);
}

.pa-upload-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pa-folder-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.12));
  background: var(--surface, #fff);
  color: var(--text, #111);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.pa-folder-btn:hover {
  background: rgba(17, 17, 17, 0.04);
}

.pa-folder-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 0.92rem;
}

.pa-folder-bar[hidden] {
  display: none !important;
}

.pa-folder-crumb {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--blue, #0b5fff);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.pa-folder-crumb.is-current {
  color: var(--text, #111);
  cursor: default;
}

.pa-folder-card {
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.pa-move {
  max-width: 140px;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.12));
  background: var(--surface, #fff);
  font: inherit;
  font-size: 0.82rem;
  padding: 0 8px;
}

/* View switch — keep local so list page does not depend on my_reports.css */
.pa-wrap .mi-view-switch {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.12));
  border-radius: var(--radius-pill, 999px);
  overflow: hidden;
  background: var(--surface, #fff);
  flex: 0 0 auto;
}

.pa-wrap .mi-view-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted, rgba(17, 17, 17, 0.55));
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  padding: 8px 14px;
  min-height: 40px;
  cursor: pointer;
  line-height: 1;
}

.pa-wrap .mi-view-btn + .mi-view-btn {
  border-left: 1px solid var(--border, rgba(17, 17, 17, 0.12));
}

.pa-wrap .mi-view-btn.is-active {
  background: var(--blue-soft, rgba(11, 95, 255, 0.1));
  color: var(--blue, #0b5fff);
}

.pa-wrap .mi-view-btn:hover:not(.is-active) {
  background: rgba(17, 17, 17, 0.04);
  color: var(--text, #111);
}

.pa-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* Author `display: grid` otherwise beats the UA `[hidden]` rule. */
.pa-cards[hidden],
.pa-table-wrap[hidden] {
  display: none !important;
}

@media (min-width: 640px) {
  .pa-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.pa-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 12px);
  background: var(--surface, #fff);
}

.pa-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.pa-card__meta {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.pa-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.pa-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.pa-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(11, 95, 255, 0.08);
  color: var(--blue, #0b5fff);
  font-size: 0.78rem;
  font-weight: 600;
}

.pa-card__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.pa-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(180, 35, 24, 0.22);
  background: rgba(180, 35, 24, 0.06);
  color: #b42318;
  font: inherit;
  font-weight: 650;
  font-size: 0.88rem;
  cursor: pointer;
}

.pa-delete:hover:not(:disabled) {
  border-color: rgba(180, 35, 24, 0.4);
  background: rgba(180, 35, 24, 0.1);
}

.pa-delete:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pa-table__actions {
  white-space: nowrap;
}

.pa-table__actions .pa-delete {
  margin-right: 8px;
}

.pa-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--blue-border, rgba(11, 95, 255, 0.2));
  background: var(--blue-soft, rgba(11, 95, 255, 0.07));
  color: var(--blue, #0b5fff);
  font: inherit;
  font-weight: 650;
  font-size: 0.88rem;
  text-decoration: none;
  cursor: pointer;
}

.pa-open:hover {
  border-color: rgba(11, 95, 255, 0.35);
}

.pa-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}

.pa-empty__title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.pa-progress {
  height: 4px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.08);
  overflow: hidden;
}

.pa-progress__bar {
  height: 100%;
  width: 40%;
  background: var(--accent, #ff5a00);
  animation: pa-progress-slide 1s ease-in-out infinite;
}

@keyframes pa-progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}

.pa-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.1));
  border-radius: var(--radius-sm, 12px);
  background: var(--surface, #fff);
}

.pa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.pa-table th,
.pa-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.pa-table th {
  font-weight: 650;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.pa-table tr:last-child td {
  border-bottom: none;
}

/* Management library: rail stays open, pane lists PDFs only.
   Fill the viewport under the top bar so the rail hint stays at the
   bottom of the screen. The file list scrolls on its own. */
.mp-main:has(.pa-lib) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mp-main:has(.pa-lib) > .mp-topbar {
  flex: 0 0 auto;
}

.mp-main:has(.pa-lib) > .pa-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.pa-lib {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  flex: 1 1 auto;
  align-self: stretch;
  min-height: 0;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.1));
  border-radius: var(--radius-sm, 12px);
  background: var(--surface, #fff);
  overflow: hidden;
}

.pa-rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  background: var(--surface2, #f2f2f2);
  border-right: 1px solid var(--border, rgba(17, 17, 17, 0.1));
  overflow: hidden;
}

.pa-rail__label {
  padding: 8px 8px 4px;
  color: var(--muted, rgba(17, 17, 17, 0.55));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pa-rail__folders {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  overflow: auto;
}

.pa-rail__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text, #111);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.pa-rail__item:hover {
  background: rgba(17, 17, 17, 0.04);
}

.pa-rail__item.is-active {
  background: var(--accent-soft, rgba(255, 90, 0, 0.08));
  color: var(--accent, #ff5a00);
}

.pa-rail__item.is-drop {
  border-color: var(--accent, #ff5a00);
  background: var(--accent-soft, rgba(255, 90, 0, 0.08));
}

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

.pa-rail__count {
  margin-left: auto;
  color: var(--muted, rgba(17, 17, 17, 0.55));
  font-size: 12px;
  font-weight: 600;
}

.pa-rail__item.is-active .pa-rail__count {
  color: var(--accent, #ff5a00);
}

.pa-rail__new {
  align-self: flex-start;
  margin-top: 8px;
}

/* Folder tree: one row per folder, indented by depth. */
.pa-tree__row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: calc(var(--pa-depth, 0) * 14px);
}

.pa-tree__toggle {
  flex: 0 0 18px;
  width: 18px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted, rgba(17, 17, 17, 0.55));
  font: inherit;
  font-size: 11px;
  line-height: 24px;
  cursor: pointer;
}

span.pa-tree__toggle {
  cursor: default;
}

.pa-tree__item {
  flex: 1 1 auto;
  min-width: 0;
  padding: 5px 6px;
}

.pa-tree__row.is-system .pa-tree__item {
  font-weight: 600;
}

.pa-tree__add {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted, rgba(17, 17, 17, 0.55));
  font: inherit;
  font-size: 15px;
  line-height: 20px;
  cursor: pointer;
  opacity: 0;
}

.pa-tree__row:hover .pa-tree__add,
.pa-tree__add:focus-visible {
  opacity: 1;
}

.pa-tree__add:hover {
  border-color: var(--border, rgba(17, 17, 17, 0.1));
  color: var(--accent, #ff5a00);
}

@media (hover: none) {
  .pa-tree__add {
    opacity: 1;
  }
}

.pa-rail__form {
  flex-wrap: wrap;
  padding: 4px 0;
}

.pa-rail__form input {
  flex: 1 1 100%;
  min-width: 0;
}

.pa-rail__context {
  flex: 1 1 100%;
  margin: 0;
  color: var(--muted, rgba(17, 17, 17, 0.55));
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pa-lib__project {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text, #111);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pa-badge {
  display: inline-block;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft, rgba(255, 90, 0, 0.08));
  color: var(--accent, #ff5a00);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
}

.pa-lib__folder {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pa-lib-table tr.is-focus td {
  background: var(--accent-soft, rgba(255, 90, 0, 0.08));
}

.pa-rail__hint {
  flex: 0 0 auto;
  margin: auto 0 0;
  padding: 12px 8px 4px;
  color: var(--muted, rgba(17, 17, 17, 0.55));
  font-size: 12px;
  line-height: 1.4;
}

.pa-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  padding: 16px;
  overflow: hidden;
}

.pa-pane__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pa-pane__title-row[hidden],
.pa-pane__folder-actions[hidden],
.pa-inline-form[hidden],
.pa-selection[hidden],
.pa-confirm[hidden] {
  display: none !important;
}

.pa-pane__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.pa-pane__folder-actions,
.pa-inline-form,
.pa-confirm__actions,
.pa-pane__tools,
.pa-selection {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pa-pane__folder-actions,
.pa-inline-form,
.pa-confirm__actions {
  flex-wrap: wrap;
}

.pa-pane__title-row,
.pa-pane__subtitle,
.pa-pane__tools,
.pa-selection,
.pa-confirm,
.pa-status,
.pa-inline-form,
.pa-rail__new {
  flex-shrink: 0;
}

.pa-pane__subtitle,
.pa-status {
  margin: 0;
  color: var(--muted, rgba(17, 17, 17, 0.55));
  font-size: 0.86rem;
}

.pa-status.is-error {
  color: #b42318;
}

.pa-pane__tools {
  flex-wrap: wrap;
}

.pa-lib__search {
  flex: 1 1 180px;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.12));
  border-radius: 12px;
  background: var(--surface, #fff);
  color: var(--text, #111);
  font: inherit;
  font-size: 14px;
}

.pa-lib__search:focus {
  outline: none;
  border-color: var(--accent, #ff5a00);
}

.pa-sort {
  display: inline-flex;
  flex: 0 0 auto;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.12));
  border-radius: var(--radius-pill, 999px);
  overflow: hidden;
  background: var(--surface, #fff);
}

.pa-sort button {
  appearance: none;
  border: none;
  border-left: 1px solid var(--border, rgba(17, 17, 17, 0.12));
  background: transparent;
  color: var(--muted, rgba(17, 17, 17, 0.55));
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  padding: 8px 12px;
  min-height: 40px;
  cursor: pointer;
}

.pa-sort button:first-child {
  border-left: none;
}

.pa-sort button.is-active {
  background: var(--accent-soft, rgba(255, 90, 0, 0.08));
  color: var(--accent, #ff5a00);
}

.pa-lib .pa-folder-btn,
.pa-lib .pa-delete,
.pa-lib .pa-inline-form .pa-upload-btn {
  height: 36px;
  min-height: 36px;
}

.pa-inline-form input[type="text"] {
  flex: 1 1 160px;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.12));
  border-radius: 10px;
  background: var(--surface, #fff);
  color: var(--text, #111);
  font: inherit;
  font-size: 14px;
}

.pa-selection {
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface2, #f2f2f2);
}

.pa-selection__count {
  font-size: 0.86rem;
  font-weight: 700;
}

.pa-selection__spacer {
  flex: 1 1 auto;
}

.pa-lib .pa-move {
  max-width: none;
  min-width: 160px;
  height: 36px;
}

.pa-confirm {
  padding: 12px;
  border: 1px solid rgba(180, 35, 24, 0.28);
  border-radius: 8px;
  background: rgba(180, 35, 24, 0.06);
}

.pa-confirm__title {
  margin: 0 0 4px;
  font-weight: 700;
}

.pa-confirm__body {
  margin: 0 0 10px;
  color: var(--text, #111);
  font-size: 0.9rem;
}

.pa-file-list {
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--border, rgba(17, 17, 17, 0.1));
  border-radius: 8px;
  overflow: auto;
}

.pa-lib-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.pa-lib-table th,
.pa-lib-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border, rgba(17, 17, 17, 0.1));
  vertical-align: middle;
}

.pa-lib-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface, #fff);
  color: var(--muted, rgba(17, 17, 17, 0.55));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pa-lib-table tr:last-child td {
  border-bottom: none;
}

.pa-lib-table tr.is-selected td {
  background: var(--accent-soft, rgba(255, 90, 0, 0.08));
}

.pa-lib-table tr.is-dragging {
  opacity: 0.55;
}

.pa-lib-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent, #ff5a00);
}

.pa-lib__file {
  min-width: 0;
}

.pa-lib__name {
  display: block;
  max-width: 440px;
  overflow: hidden;
  color: var(--accent, #ff5a00);
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pa-lib__name:hover {
  text-decoration: underline;
}

.pa-lib__meta {
  margin-top: 2px;
  color: var(--muted, rgba(17, 17, 17, 0.55));
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pa-file-list .pa-empty {
  text-align: center;
}

@media (max-width: 860px) {
  .mp-main:has(.pa-lib) {
    overflow: auto;
  }

  .pa-lib {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(280px, 1fr);
    height: auto;
    min-height: calc(100dvh - 110px);
  }

  .pa-rail {
    border-right: none;
    border-bottom: 1px solid var(--border, rgba(17, 17, 17, 0.1));
    overflow: visible;
  }

  .pa-rail__hint {
    margin-top: 8px;
  }
}
