.project-file-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
}

.project-file-actions > .btn,
#b-files {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
}

.project-file-actions svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

#project-file-menu {
  position: relative;
}

#b-files {
  list-style: none;
}

#b-files::-webkit-details-marker {
  display: none;
}

#project-file-menu[open] > summary {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.project-file-popover {
  position: absolute;
  inset: calc(100% + 8px) 0 auto auto;
  z-index: 25;
  width: min(278px, calc(100vw - 24px));
  display: grid;
  gap: 8px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 32px #243c5a24;
}

.project-file-popover > button {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.project-file-popover small {
  color: var(--muted);
}

.project-file-popover fieldset {
  display: grid;
  min-width: 0;
  gap: 6px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.project-file-popover legend {
  padding: 0 4px;
  font-size: 12px;
  color: var(--muted);
}

#export-scope {
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
}

.project-export-formats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-export-formats .btn {
  flex: 1;
}

.project-replace {
  width: min(440px, calc(100vw - 32px));
  padding: 20px;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 40px #18202c44;
}

.project-replace::backdrop {
  background: #18202c60;
}

.project-replace h2 {
  margin: 0;
  font-size: 17px;
}

.project-replace p {
  margin: 8px 0 16px;
  overflow-wrap: anywhere;
}

.project-replace-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.project-library {
  width: min(630px, calc(100vw - 32px));
  max-height: min(680px, calc(100dvh - 32px));
  overflow: auto;
}

.project-library-head,
.project-library-actions,
.saved-project-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-library-head {
  justify-content: space-between;
}

.project-library-actions {
  flex-wrap: wrap;
  margin-block: 12px;
}

.saved-project-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
}

.saved-project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.saved-project strong {
  color: var(--fg);
  overflow-wrap: anywhere;
}

.saved-project small {
  grid-column: 1;
}

.saved-project-actions {
  grid-column: 2;
  grid-row: 1 / 3;
}

#project-library-message,
#project-replace-message {
  color: var(--muted);
  overflow-wrap: anywhere;
}

#project-replace-message {
  min-height: 1.3em;
  margin-top: 4px;
}

.project-replace .fld input {
  width: 100%;
}

@media (max-width: 680px) {
  .project-file-popover {
    position: fixed;
    inset: 52px 10px auto auto;
  }
}

@media (max-width: 540px) {
  .documentbar #document-title {
    flex: 1 1 64px;
    min-width: 56px;
    padding-inline: 8px;
  }

  .documentbar .spacer {
    display: none;
  }

  .project-file-actions > .btn,
  #b-files {
    min-width: 36px;
  }

  .project-file-actions .file-label {
    display: none;
  }
}
