.library-enrichment {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .7rem;
  min-inline-size: 0;
  margin-block: .75rem 1.25rem;
  padding: clamp(.85rem, 3vw, 1.35rem);
  border: 1px solid var(--line, #ddd6ce);
  border-radius: .75rem;
  background: var(--paper, #fff);
  overflow-wrap: anywhere;
}
.library-enrichment :is(h3, p, ul) { margin: 0; }
.library-enrichment h3 { font-size: 1rem; }
.library-enrichment summary { cursor: pointer; font-weight: 600; }
.library-enrichment details > :not(summary) { margin-block-start: .55rem; }
.library-enrichment .enrichment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  min-width: 0;
  gap: .6rem;
}
.library-enrichment label { display: grid; gap: .25rem; min-width: 0; max-inline-size: 100%; }
.library-enrichment label[hidden] { display: none; }
.library-enrichment button.library-enrichment-button {
  display: inline-block;
  min-inline-size: 0;
  max-inline-size: 100%;
  min-block-size: 44px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
  text-align: center;
}
.library-enrichment :is(input, select) { inline-size: 100%; min-inline-size: 0; max-inline-size: 100%; }
.library-enrichment .enrichment-item :is(input[type="checkbox"]) { inline-size: 1rem; }
.library-enrichment .enrichment-feedback:empty { display: none; }
.library-enrichment .enrichment-results { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: .65rem; }
.library-enrichment .enrichment-results:empty { display: none; }
.library-enrichment .enrichment-status { font-weight: 650; }
.library-enrichment .enrichment-list { padding-inline-start: 1.15rem; }
.library-enrichment .enrichment-list li + li { margin-block-start: .3rem; }
.library-enrichment .enrichment-item {
  display: grid;
  gap: .3rem;
  justify-items: start;
  border-block-start: 1px solid var(--line, #ddd6ce);
  padding-block-start: .65rem;
}
.library-enrichment .enrichment-item:has(select) label { grid-template-columns: minmax(0, 1fr); }
.library-enrichment .enrichment-item label {
  grid-template-columns: auto 1rem;
  align-items: center;
  gap: .55rem;
  font-weight: 650;
}
.library-enrichment .enrichment-proof { border-inline-start: 1px solid var(--line, #ddd6ce); padding-inline-start: .65rem; }
.library-enrichment :is(details, summary, p, .enrichment-item, .enrichment-proof) { min-inline-size: 0; max-inline-size: 100%; white-space: normal; }
.enrichment-note { display: block; font-size: .82rem; margin-block-start: .25rem; color: #635040; }
[data-enrichment-preview]::placeholder { opacity: 1; color: #67574a; }
.activity-enrichment-host { display: inline-flex; min-width: 0; }
.activity-enrichment-trigger { white-space: nowrap !important; }
.library-enrichment-dialog {
  --le-terra: var(--wc-accent, #bb6b53);
  --le-terra-hover: var(--wc-accent-dark, #97513d);
  --le-terra-soft: var(--wc-accent-soft, #fbf0eb);
  --le-terra-line: #e2b9ab;
  --le-ink: #252c28;
  --le-sub: #627067;
  --le-dim: #95a198;
  --le-line: #e7ebe6;
  --le-paper: #f8f9f6;
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 0;
  width: min(765px, calc(100vw - 36px));
  max-width: none;
  max-height: min(750px, calc(100dvh - 36px));
  border: 0;
  border-radius: 20px;
  overflow: hidden;
  color: var(--le-ink);
  background: #fff;
  box-shadow: 0 24px 70px #17221b38, 0 4px 14px #17221b15;
}
.library-enrichment-dialog::backdrop { background: #202b246e; backdrop-filter: blur(3px); }
.library-enrichment-dialog .library-enrichment {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  box-sizing: border-box;
  width: 100%;
  max-height: min(750px, calc(100dvh - 36px));
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #fff;
  overflow-wrap: anywhere;
}
.library-enrichment-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 26px 19px;
  border-bottom: 1px solid var(--le-line);
}
.library-enrichment-icon {
  display: grid;
  place-items: center;
  flex: 0 0 39px;
  width: 39px;
  height: 39px;
  border-radius: 12px;
  color: var(--le-terra);
  background: var(--le-terra-soft);
}
.library-enrichment-icon svg { display: block; width: 21px; height: 21px; }
.library-enrichment-title { display: grid; min-width: 0; gap: 4px; }
.library-enrichment-title h2 { margin: 0; color: var(--le-ink); font-size: 1.12rem; line-height: 1.25; }
.library-enrichment-title p { margin: 0; color: var(--le-sub); font-size: .86rem; line-height: 1.45; }
.library-enrichment-close {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  margin-inline-start: auto;
  border: 1px solid var(--le-line);
  border-radius: 12px;
  color: var(--le-sub);
  background: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.library-enrichment-dialog :is(button, summary, input, select, a):focus-visible {
  outline: 3px solid #bb6b5355;
  outline-offset: 2px;
}
.library-enrichment-body { min-height: 0; padding: 20px 26px; overflow: auto; overscroll-behavior: contain; }
.library-enrichment-dialog .activity-enrichment-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.library-enrichment-dialog .activity-enrichment-fields label { gap: 7px; color: var(--le-sub); font-size: .82rem; }
.library-enrichment-dialog :is(input[type="text"], input[type="url"]) {
  box-sizing: border-box;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--le-line);
  border-radius: 11px;
  color: var(--le-ink);
  background: #fff;
  font: inherit;
}
.library-enrichment-dialog .activity-enrichment-fields :is(input[type="text"], input[type="url"]):focus { border-color: var(--le-terra); box-shadow: 0 0 0 3px var(--le-terra-soft); }
.library-enrichment-submit { display: flex; margin-block: 16px 10px; }
.library-enrichment-submit button {
  width: 100%;
  min-height: 47px;
  border: 1px solid var(--le-terra);
  border-radius: 11px;
  color: #fff;
  background: var(--le-terra);
  font-weight: 700;
  cursor: pointer;
}
.library-enrichment-submit button:hover:not(:disabled) { border-color: var(--le-terra-hover); background: var(--le-terra-hover); }
.library-enrichment-submit button:disabled { opacity: .55; cursor: not-allowed; }
.library-enrichment-dialog .library-enrichment-body > details { padding-block: 6px 13px; border-bottom: 1px solid var(--le-line); }
.library-enrichment-dialog .library-enrichment-body > details > summary { color: var(--le-terra-hover); font-size: .84rem; }
.library-enrichment-dialog .library-enrichment-body > details .enrichment-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
.library-enrichment-dialog .library-enrichment-body > details label { color: var(--le-sub); font-size: .82rem; }
.library-enrichment-dialog .enrichment-actions { align-items: stretch; }
.library-enrichment-dialog .enrichment-results { padding-block-start: 4px; }
.library-enrichment-dialog .enrichment-status { color: var(--le-ink); }
.library-enrichment-dialog .enrichment-item { padding-block-start: 12px; border-color: var(--le-line); }
.library-enrichment-dialog .enrichment-proof { border-color: var(--le-line); }
.activity-enrichment-preview {
  display: grid;
  gap: 12px;
  margin-block: 8px 2px;
  padding: 17px;
  border: 1px solid var(--le-line);
  border-radius: 14px;
  background: var(--le-paper);
}
.activity-enrichment-preview-kicker { color: var(--le-terra-hover); font-size: .67rem; font-weight: 750; letter-spacing: .08em; }
.activity-enrichment-preview h4 { margin: 0; color: var(--le-ink); font-family: Georgia, serif; font-size: 1.25rem; }
.activity-enrichment-preview h5 { margin: 0; color: var(--le-ink); font-size: .84rem; }
.activity-enrichment-preview :is(p, ul) { margin: 0; }
.activity-enrichment-preview-section { display: grid; gap: 7px; padding-block-start: 11px; border-top: 1px solid var(--le-line); }
.activity-enrichment-preview-section li + li { margin-block-start: 8px; }
.activity-enrichment-preview-section li p { margin-block-start: 3px; color: var(--le-sub); }
.library-enrichment-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 26px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--le-line);
  background: #fff;
}
.library-enrichment-footer-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.library-enrichment-footer-note { max-width: 520px; color: var(--le-dim); font-size: .78rem; line-height: 1.4; }
.library-enrichment-footer-actions > button {
  flex: 0 0 auto;
  min-width: 90px;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--le-line);
  border-radius: 10px;
  color: var(--le-ink);
  background: #fff;
  cursor: pointer;
}
.library-enrichment-footer-actions > button.primary { border-color: var(--le-terra); color: #fff; background: var(--le-terra); font-weight: 750; }
.library-enrichment-footer-actions > button.primary:hover:not(:disabled) { border-color: var(--le-terra-hover); background: var(--le-terra-hover); }
.library-enrichment-dialog .activity-search-history { margin-block-start: 18px; border: 1px solid var(--le-line); border-radius: 11px; overflow: hidden; }
.library-enrichment-dialog .activity-search-history > button { width: 100%; justify-content: flex-start; padding-inline: 13px; border: 0; border-radius: 0; color: var(--le-sub); background: var(--le-paper); text-align: start; }
.activity-search-history-list { padding: 0 13px; }
.activity-search-history-list:empty { display: none; }
.activity-search-history-list ul { margin: 0; padding: 10px 0 10px 18px; }
.activity-search-history-list button { min-height: 38px; border-color: var(--le-line); color: var(--le-sub); background: #fff; }
.activity-search-loading { display: grid; justify-items: center; gap: 12px; min-height: 245px; align-content: center; text-align: center; }
.activity-search-loading[hidden] { display: none; }
.activity-search-loading-icon { position: relative; display: grid; place-items: center; width: 62px; height: 62px; border-radius: 20px; color: var(--le-terra); background: var(--le-terra-soft); }
.activity-search-loading-icon::after { position: absolute; inset: -8px; border: 2px solid var(--le-terra-soft); border-right-color: var(--le-terra); border-radius: 25px; content: ''; animation: activity-search-spin 1s linear infinite; }
.activity-search-loading-icon svg { width: 25px; height: 25px; }
.activity-search-loading h3 { margin: 0; color: var(--le-ink); font-size: 1.05rem; }
.activity-search-loading p { margin: 0; color: var(--le-sub); font-size: .84rem; }
.activity-search-loading button { margin-block-start: 7px; }
@keyframes activity-search-spin { to { transform: rotate(360deg); } }
.activity-results-source-strip { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 11px 12px; border: 1px solid #edf0e9; border-radius: 11px; background: #f8faf7; }
.activity-results-source-icon { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 9px; color: #9eaa9d; background: #fff; font-size: 1.25rem; }
.activity-results-source-text { display: grid; flex: 1; min-width: 0; gap: 3px; }
.activity-results-source-text strong { color: var(--le-ink); font-size: .88rem; overflow-wrap: anywhere; }
.activity-results-source-text span { color: var(--le-dim); font-size: .73rem; }
.activity-results-new-search { min-height: 36px !important; padding: 6px 10px !important; border-color: var(--le-line) !important; border-radius: 8px !important; color: var(--le-sub) !important; background: #fff !important; font-size: .75rem !important; font-weight: 700; }
.activity-results-metrics { display: flex; flex-wrap: wrap; gap: 7px; margin-block: 13px; }
.activity-results-metric { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 7px; color: #7c897e; background: #f4f6f3; font-size: .69rem; font-weight: 700; white-space: nowrap; }
.activity-results-metric strong { color: currentColor; font-size: .76rem; }
.activity-results-metric.green { color: #328153; background: #edf8f0; }
.activity-results-metric.amber { color: #a86925; background: #fff5e6; }
.activity-results-metric.purple { color: #7954a4; background: #f4edfb; }
.activity-results-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 12px; }
.activity-results-tabs { display: flex; min-width: 0; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.activity-results-tabs::-webkit-scrollbar { display: none; }
.library-enrichment-dialog .activity-results-tab { min-height: 34px; padding: 6px 10px; border: 1px solid transparent; border-radius: 9px; color: #8b968d; background: transparent; font-size: .72rem; font-weight: 750; white-space: nowrap; }
.library-enrichment-dialog .activity-results-tab.active { border-color: var(--le-terra-line); color: var(--le-terra-hover); background: var(--le-terra-soft); }
.activity-results-search { display: flex !important; flex: 0 0 165px; align-items: center; min-height: 34px; padding-inline: 9px; border: 1px solid var(--le-line); border-radius: 9px; color: #a6b0a5; }
.library-enrichment-dialog .activity-results-search input { min-height: 30px; padding: 4px; border: 0; border-radius: 0; outline: 0; font-size: .72rem; }
.activity-results-caption { margin: 0 0 9px !important; color: #a3ada3; font-size: .7rem; }
.activity-results-notice { padding: 10px 12px; border-radius: 9px; color: #92512f; background: #fff3e9; font-size: .82rem; }
.activity-results-list { display: grid; gap: 8px; }
.activity-result-row { overflow: hidden; border: 1px solid #e9ede7; border-radius: 12px; background: #fff; }
.activity-result-row.accepted { border-color: #cfe8d7; background: #fcfffd; }
.activity-result-row.ignored { opacity: .62; }
.activity-result-head { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px; }
.activity-result-label { min-width: 0; }
.activity-result-label strong { display: block; margin-block-end: 5px; color: var(--le-ink); font-size: .8rem; line-height: 1.3; }
.activity-result-flag { display: inline-flex; align-items: center; padding: 4px 7px; border-radius: 6px; color: #a86925; background: #fff5e6; font-size: .65rem; font-weight: 800; white-space: nowrap; }
.activity-result-flag.kept { color: #328153; background: #edf8f0; }
.activity-result-flag.conflict { color: #7954a4; background: #f4edfb; }
.activity-result-flag.restricted { color: #a64242; background: #fff0f0; }
.activity-result-flag.missing, .activity-result-flag.ignored { color: #929c92; background: #f0f2ef; }
.activity-result-value { min-width: 0; line-height: 1.4; }
.activity-result-value strong { display: block; color: #445248; font-size: .76rem; font-weight: 650; overflow-wrap: anywhere; }
.activity-result-value small { display: block; margin-block-start: 3px; color: #98a39a; font-size: .68rem; overflow-wrap: anywhere; }
.activity-result-actions { display: flex; align-items: center; gap: 6px; }
.library-enrichment-dialog .activity-result-action { min-height: 32px; padding: 6px 9px; border: 1px solid #e6eae3; border-radius: 8px; color: #657166; background: #fff; font-size: .68rem; font-weight: 750; white-space: nowrap; }
.library-enrichment-dialog .activity-result-action.take { border-color: var(--le-terra-line); color: var(--le-terra-hover); background: var(--le-terra-soft); }
.library-enrichment-dialog .activity-result-action.approved { border-color: #c8e5d1; color: #287b50; background: #eef8f0; }
.library-enrichment-dialog .activity-result-action.reject { min-width: 32px; padding-inline: 7px; color: #8b968d; }
.activity-result-row > details { border-top: 1px solid #edf0ea; }
.activity-result-row > details > summary { padding: 9px 12px; color: #b17b4d; font-size: .7rem; font-weight: 650; }
.activity-result-proof { display: grid; gap: 5px; padding: 9px 13px 11px; border-top: 1px solid #edf0ea; color: #657267; background: #fafbf9; font-size: .72rem; }
.activity-result-proof p { overflow-wrap: anywhere; }
.activity-result-proof small { color: #9da79c; }
.activity-result-conflict { display: grid; gap: 7px; padding: 10px 13px; border-top: 1px solid #edf0ea; }
.activity-result-conflict strong { font-size: .74rem; }
.activity-result-conflict select { min-height: 40px; }
.activity-results-empty { display: grid; justify-items: center; gap: 8px; padding: 30px 20px; border: 1px dashed #dfe5dc; border-radius: 12px; color: #8f9b90; background: #fafbf8; text-align: center; font-size: .78rem; }
.activity-results-empty strong { color: #4c5b4e; font-size: .82rem; }
.activity-identity-choices { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--le-line); border-radius: 11px; }
.activity-identity-choices h3 { margin: 0; font-size: .9rem; }
.activity-results-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; margin-block: 13px; padding-block-start: 14px; border-top: 1px solid var(--le-line); }
.activity-results-actions label { flex: 1 1 190px; color: var(--le-sub); font-size: .75rem; }
.activity-results-actions > p { flex: 1 1 100%; color: var(--le-sub); font-size: .75rem; }
.activity-results-actions button { flex: 0 1 auto; }
@media (max-width: 460px) {
  .library-enrichment .enrichment-actions > :is(label, button) { inline-size: 100%; }
}
@media (max-width: 560px) {
  .activity-enrichment-host { min-width: max-content; }
  .library-enrichment-dialog {
    inset: auto 0 0;
    width: 100vw;
    max-width: none;
    max-height: 96dvh;
    border-radius: 20px 20px 0 0;
  }
  .library-enrichment-dialog .library-enrichment { max-height: 96dvh; }
  .library-enrichment-header { padding: 19px 18px 15px; gap: 11px; }
  .library-enrichment-body { padding: 17px 18px; }
  .library-enrichment-dialog .activity-enrichment-fields { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .library-enrichment-footer { padding-inline: 18px; }
  .library-enrichment-footer-note { font-size: .73rem; }
  .library-enrichment-footer-actions { gap: 6px; }
  .activity-results-source-strip { flex-wrap: wrap; }
  .activity-results-source-text { flex-basis: calc(100% - 48px); }
  .activity-results-new-search { width: 100%; }
  .activity-results-toolbar { display: grid; }
  .activity-results-tabs { width: 100%; }
  .activity-results-search { flex-basis: auto; }
  .activity-result-head { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; padding: 12px; }
  .activity-result-label { grid-column: 1; }
  .activity-result-value { grid-column: 1 / -1; grid-row: 2; }
  .activity-result-actions { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .activity-results-actions > label, .activity-results-actions > button { flex-basis: 100%; }
}
