.library-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 24px 0;
}
.library-tabs [aria-pressed='true'] {
  background: #dce9dc;
  color: #244c3b;
  border-radius: 8px;
}
.library-tabs #library-refresh {
  margin-left: auto;
}
.library-filters {
  display: grid;
  grid-template-columns: 1.2fr 1.3fr 0.8fr 0.9fr 1.2fr;
  gap: 14px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--border, #d8e2d5);
  border-radius: 14px;
}
.library-filters label,
#library-editor label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
}
.library-filters input,
.library-filters select,
#library-editor input,
#library-editor select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #cbd9cb;
  border-radius: 7px;
  background: #fff;
  color: #273c32;
  font: inherit;
}
.library-selection {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 22px 0;
}
.library-selection > div {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}
.library-selection p {
  margin: 0;
  font-size: 14px;
}
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(166px, 1fr));
  gap: 16px;
}
.library-grid[aria-busy='true'] {
  opacity: 0.65;
  pointer-events: none;
}
.library-card {
  position: relative;
  padding: 17px 13px 12px;
  background: white;
  border: 1px solid #d8e2d5;
  border-radius: 13px;
  min-width: 0;
  text-align: center;
}
.library-card:has(input:checked) {
  border-color: #42755c;
  box-shadow: 0 0 0 1px #42755c;
}
.library-card label {
  display: block;
  cursor: pointer;
}
.library-card input {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 18px;
  height: 18px;
  accent-color: #35684e;
}
.library-card img {
  display: block;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin: 4px auto 13px;
  background: #edf3eb;
}
.library-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.4;
}
.library-card small {
  display: block;
  font-size: 11px;
  color: #65766b;
  margin-top: 5px;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.library-card-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 12px;
  align-items: center;
  font-size: 12px;
}
.library-card-actions button {
  font-size: 12px;
  padding: 5px;
}
.library-card-actions a {
  color: #366447;
}
.library-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 28px 0;
  font-size: 13px;
}
.library-empty {
  grid-column: 1/-1;
  background: white;
  padding: 36px;
  border: 1px dashed #cbd9cb;
  border-radius: 14px;
  text-align: center;
}
#library-editor {
  width: min(530px, calc(100% - 32px));
  box-sizing: border-box;
  max-height: 90vh;
}
#library-editor form {
  display: grid;
  gap: 17px;
}
#library-editor .dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
#library-editor h2 {
  margin: 0;
  font-size: 22px;
}
#library-editor .library-editor-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: auto;
}
.library-editor-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
#library-editor-error {
  color: #a33434;
  margin: 0;
  font-size: 13px;
}
@media (max-width: 1000px) {
  .library-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 800px) {
  .sidebar {
    height: auto;
    flex-wrap: wrap;
    gap: 10px;
  }
  .sidebar nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
  }
  .sidebar .nav-link {
    padding: 8px;
    font-size: 12px;
  }
  .sidebar .nav-link > [data-icon] {
    display: none;
  }
}
@media (max-width: 540px) {
  .library-filters {
    grid-template-columns: 1fr 1fr;
    padding: 14px;
    gap: 12px;
  }
  .library-filters label:last-child {
    grid-column: 1/-1;
  }
  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .library-card {
    padding: 15px 9px 12px;
  }
  .library-card img {
    width: 88px;
    height: 88px;
  }
  .library-pagination {
    gap: 12px;
  }
  .library-selection .button {
    padding: 10px;
  }
}
