.library {
  color: #17191a;
  --library-muted: #58616c;
  --library-line: #dfe2e7;
  --library-accent: #be4810;
  accent-color: var(--library-accent);
}
.library ::selection {
  background: #fff0df;
  color: #17191a;
}
.library :focus-visible {
  outline: 3px solid #be4810;
  outline-offset: 3px;
}
.library input,
.library textarea {
  caret-color: var(--library-accent);
}
.library-toolbar,
.library-filters,
.library-actions,
.library-detail-head,
.library-form-row {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.library-toolbar {
  margin-bottom: 24px;
}
.library-toolbar label {
  min-width: 180px;
}
.library-toolbar #lib-new {
  margin-left: auto;
}
.library-workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 26px;
}
.library-folders {
  align-self: start;
}
.library-folder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.library-folders h2 {
  font-size: 1rem;
  margin: 0;
}
.library-folders ul {
  list-style: none;
  padding-left: 12px;
  margin: 4px 0;
}
.library-folder {
  display: block;
  background: none;
  border: 0;
  box-shadow: none;
  color: #58616c;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  overflow-wrap: anywhere;
  min-height: 44px;
}
.library-folder:hover {
  background: #fff;
}
.library-folder.selected {
  background: #fff0df;
  color: #99350b;
  font-weight: 600;
}
.library-folders .ghost {
  font-size: 0.8rem;
  min-height: 44px;
}
.library-content {
  min-width: 0;
}
.library-filters {
  margin-bottom: 18px;
  align-items: end;
}
.library-search {
  flex: 1;
  min-width: 180px;
}
.library-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.library-check input {
  width: auto;
}
.library-material {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  text-align: left;
  padding: 18px 20px;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #dfe2e7;
  border-radius: 0;
  box-shadow: none;
  color: #17191a;
  min-height: 88px;
}
.library-material:first-child {
  border-radius: 15px 15px 0 0;
}
.library-material:hover {
  background: #f2f3f6;
}
.library-material strong {
  font-size: 0.96rem;
  overflow-wrap: anywhere;
}
.library-description {
  display: block;
  color: #58616c;
  font-size: 0.85rem;
  margin-top: 6px;
  max-width: 65ch;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.library-meta {
  color: #58616c;
  font-size: 0.76rem;
  min-width: 145px;
  max-width: 230px;
  text-align: right;
}
.library-badge {
  display: block;
  color: #99350b;
  font-size: 0.78rem;
  font-weight: 600;
  margin: 6px 0;
}
.library-detail,
.library-editor {
  margin-top: 26px;
  padding: 26px;
  background: #fff;
  border-radius: 16px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.library-detail h2,
.library-editor h2 {
  margin: 0 0 16px;
  font-size: 1.3rem;
  letter-spacing: -0.025em;
}
.library-detail-head {
  justify-content: space-between;
  align-items: start;
}
.library-detail p {
  max-width: 70ch;
}
.library-body {
  white-space: pre-wrap;
  line-height: 1.65;
  max-width: 75ch;
  font-size: 0.9rem;
  margin: 16px 0;
}
.library-file-list {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}
.library-file-list a {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #dfe2e7;
  color: #99350b;
  text-underline-offset: 4px;
}
.library-file-list span {
  font-size: 0.8rem;
  color: #58616c;
}
.library-actions {
  margin-top: 20px;
}
.library-detail details {
  margin-top: 26px;
}
.library-detail li {
  padding: 8px 0;
  font-size: 0.85rem;
}
.library-editor {
  display: grid;
  gap: 16px;
}
.library-editor label {
  display: grid;
  gap: 7px;
  min-width: 0;
}
.library-form-row > * {
  flex: 1;
  min-width: 160px;
}
.library-editor textarea {
  min-height: 90px;
}
.library-editor .library-long-text {
  min-height: 240px;
  line-height: 1.6;
}
.library-upload {
  display: grid;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid #dfe2e7;
}
.library-upload progress {
  width: 100%;
}
.library-upload input {
  max-width: 100%;
}
.library-attachment-edit {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #dfe2e7;
  padding: 12px 0;
}
.library-attachment-edit > span {
  flex: 1;
  overflow-wrap: anywhere;
  font-size: 0.85rem;
}
.library-attachment-edit select {
  min-width: 120px;
}
.library-identity-list {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.library-loading {
  padding: 40px;
  color: #58616c;
}
.library button:disabled {
  opacity: 0.55;
  cursor: wait;
}
#lib-more {
  margin-top: 16px;
}
@media (max-width: 850px) {
  .library-workspace {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .library-folders {
    border-bottom: 1px solid #dfe2e7;
    padding-bottom: 12px;
  }
  .library-folders > div:last-child {
    max-height: 180px;
    overflow: auto;
  }
  .library-toolbar #lib-new {
    margin-left: 0;
  }
  .library-detail,
  .library-editor {
    padding: 18px;
  }
  .library-material {
    padding: 16px;
    gap: 10px;
  }
  .library-meta {
    min-width: 110px;
  }
  .library-file-list a {
    flex-direction: column;
    gap: 6px;
  }
  .library-attachment-edit {
    flex-wrap: wrap;
  }
  .library-attachment-edit > span {
    flex-basis: 100%;
  }
  .library button {
    min-height: 44px;
  }
  .library-actions button {
    flex: 1;
  }
  .library-toolbar {
    gap: 8px;
  }
  .library-toolbar label {
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .library * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
.library-preview {
  display: block;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  margin: 12px 0;
  background: #f2f3f6;
  border-radius: 12px;
}
.library-file-list audio {
  max-width: 100%;
  width: 420px;
}
@media (max-width: 850px) {
  .library-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
  .library-actions button {
    min-width: 0;
    overflow-wrap: normal;
    word-break: normal;
    white-space: normal;
    padding: 12px 10px;
  }
  .library-detail-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
  .library-detail-head h2 {
    min-width: 0;
  }
}
