/* ════════════════════════════════════════════════════════════════════
   librarium-lite.css - Librarium-lite, self-contained stylesheet
   Tokens + page chrome + link cards + Bibliotheca library + Timeline
   ════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/manrope-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/manrope-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  src: url("/static/UnifrakturMaguntia.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "P22StGSchriftOne";
  src: url("/static/P22StGSchriftOne.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ── */
:root {
  --bg:             #161616;
  --bg-high:        #1f1f1f;
  --bg-input:       #1a1a1a;
  --bg-wtw:         #1a1a1a;
  --bg-link-card:   #1a1a1a;
  --fg:             #f8f4eb;
  --fg-title:       #fffcf7;
  --fg-dim:         #b0aaa0;
  --fg-second:      #ddd8ce;
  --fg-second-dim:  #c0bab0;
  --fg-second-light:#ece7dd;
  --fg-green:       #b8de96;
  --fg-glow:        #ffffff;
  --link:           #acc4dc;
  --link-hover:     #d0e2f4;
  --border-red:     #5a3030;
  --border-red-dark:#3a2424;
  --border:         #3a3a3a;
  --border-subtle:  rgba(255,255,255,0.07);
  --border-glow:    #696969;
  --font-ui:        system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-monospace: ui-monospace, "Iosevka Nerd Font", "Iosevka", "Fira Code", Menlo, Consolas, monospace;
  --font-heading:   "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-inscription: "P22StGSchriftOne", serif;
  --font-prose:     serif;
  --font-serif-g:   Georgia, "Times New Roman", serif;
  --font-goth:      "Abordage", var(--font-ui), serif;
  --chip-flat-bg:     #c0c0c0;
  --chip-flat-border: #c0c0c0;
  --chip-flat-fg:     #1c1c1c;
  --chip-on-bg:       #e8e8e8;
  --chip-on-fg:       #1c1c1c;
  --chip-hover-bg:    #eaeaea;
  --ink-fill-bg:      #1a1a1a;
  --ink-fill-fg:      #fff;
  --ink-fill-hover-bg: #000;
  --ghost-fill-bg:    var(--chip-flat-bg);
  --ghost-fill-fg:    var(--chip-flat-fg);
  --star-gold:        #e8c547;
  --danger-fg:        #c00;
  --tl-comment-gold:  #fbbf24;
  --lib-nacht-d: #7b93ad;
  --lib-rubric-d: #b5442f;
  --lib-gold-d:   #a98c4b;
  --lib-nacht-l: #44607e;
  --lib-rubric-l: #8e2418;
  --lib-gold-l:   #7e6326;

}
[data-theme="dark"] {
  color-scheme: dark;
  --chip-flat-bg:     #c0c0c0;
  --chip-flat-border: #c0c0c0;
  --chip-flat-fg:     #1c1c1c;
  --chip-hover-bg:    #eaeaea;
  --chip-on-bg:       #e8e8e8;
  --chip-on-fg:       #1c1c1c;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
[data-theme="dark"] * {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
[data-theme="dark"] ::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
/* Light-mode base palette follows natur.css (clean white ground, neutral
   greys, blue links) - keep in sync with natur's [data-theme="light"]. */
[data-theme="light"] {
  color-scheme: light;
  --bg:             #ffffff;
  --bg-high:        #f0f0f0;
  --bg-input:       #ffffff;
  --bg-wtw:         #f0f0f0;
  --bg-link-card:   #f5f5f5;
  --fg:             #1c1c1c;
  --fg-title:       #1c1c1c;
  --fg-dim:         #6b6b6b;
  --fg-second:      #4a4a4a;
  --fg-second-dim:  #6b6b6b;
  --fg-second-light:#3a3a3a;
  --fg-green:       #08b94e;
  --fg-glow:        unset;
  --link:           #2864dd;
  --link-hover:     #4a90d9;
  --border-red:     #e0e0e0;
  --border-red-dark:#d0d0d0;
  --border-subtle:  rgba(0,0,0,0.08);
  --border-glow:    #d0d0d0;
  --tl-comment-gold: #e0ac00;
  --chip-flat-bg:     #e8e8e8;
  --chip-flat-border: #e8e8e8;
  --chip-flat-fg:     #1c1c1c;
  --chip-hover-bg:    #dcdcdc;
  --chip-on-bg:       #1a1a1a;
  --chip-on-fg:       #fff;
  --ghost-fill-bg:    #1a1a1a;
  --ghost-fill-fg:    #fff;
}

/* ── Base ── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--link); }
a:hover { color: var(--link-hover); }
main { max-width: 80rem; margin: 0 auto; padding: 0 1rem 3rem; }
main:has(.tl-merge-page) { max-width: none; padding: 0; }
main:has(.collections-page:not(.collections-page--pane)) { max-width: none; padding: 0 clamp(1rem, 2.5vw, 2.5rem) 3rem; }
main:has(.targets-page:not(.targets-page--pane)) { max-width: none; padding: 0 clamp(1rem, 2.5vw, 2.5rem) 3rem; }
body:has(.tl-merge-page) .librarium-lite-footer { display: none; }
.librarium-lite-footer { text-align: center; padding: 1rem; font-size: 0.72rem; color: var(--fg-second-dim); font-family: var(--font-monospace); }
.empty { color: var(--fg-second-dim); }
h1 { color: var(--fg-title); font-family: var(--font-inscription); font-weight: 400; letter-spacing: 0.04em; }
h2, h3 { color: var(--fg-title); font-family: var(--font-heading); font-weight: 600; }

/* ── Nav ── */
.librarium-lite-nav {
  display: flex; align-items: center; gap: 1.2em;
  max-width: 80rem; margin: 0 auto; padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border-red-dark);
  font-family: var(--font-monospace); font-size: 0.8rem;
}
body:has(.tl-merge-page) {
  --librarium-lite-nav-h: 3.15rem;
}
body:has(.tl-merge-page) .librarium-lite-nav {
  box-sizing: border-box;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0 1.25rem;
  height: var(--librarium-lite-nav-h);
  min-height: var(--librarium-lite-nav-h);
  max-height: var(--librarium-lite-nav-h);
  overflow: visible;
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
  background: var(--bg);
  --lib-nacht: var(--lib-nacht-d);
  --lib-rubric: var(--lib-rubric-d);
  --lib-ink: var(--fg);
  --lib-faint: var(--fg-second-dim);
  --lib-rule: var(--border-red-dark);
  --lib-card: var(--bg-high);
}
[data-theme="light"] body:has(.tl-merge-page) .librarium-lite-nav {
  --lib-nacht: var(--lib-nacht-l);
  --lib-rubric: var(--lib-rubric-l);
}
body:has(.tl-merge-page) .librarium-lite-brand {
  font-family: var(--font-inscription);
  font-weight: 400;
  font-size: 1.65rem;
  letter-spacing: 0.04em;
  line-height: 1;
}
.librarium-lite-brand-wrap {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.55em;
  flex: 0 1 auto;
  min-width: 0;
}
.librarium-lite-repo-links {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  flex-shrink: 0;
}
.librarium-lite-repo-link {
  display: inline-flex;
  line-height: 0;
  opacity: 0.8;
  transition: opacity 70ms;
}
.librarium-lite-repo-link:hover { opacity: 1; }
.librarium-lite-repo-icon {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}
body:has(.tl-merge-page) .librarium-lite-brand-wrap {
  position: relative;
  align-self: stretch;
  height: 100%;
  overflow: visible;
  z-index: 2;
  min-width: 0;
}
body:has(.tl-merge-page) .librarium-lite-nav--add-open {
  z-index: 50;
}
body:has(.tl-merge-page) .librarium-lite-nav--add-open .librarium-lite-brand-wrap {
  z-index: 60;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  background: var(--bg);
}
.librarium-lite-add-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  flex-shrink: 0;
  height: 100%;
  max-height: var(--librarium-lite-nav-h, 3.15rem);
  overflow: visible;
}
body:has(.tl-merge-page) .librarium-lite-nav--add-open .librarium-lite-add-launcher {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}
body:has(.tl-merge-page) .lib-add-box--nav:not([hidden]) {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  flex: 1 1 auto;
  min-width: 10rem;
  max-width: min(36rem, calc(100vw - 14rem));
  height: 100%;
  max-height: var(--librarium-lite-nav-h);
  margin: 0 0 0 0.55em;
  padding: 0;
  border: 0;
  background: transparent;
  box-sizing: border-box;
  overflow: visible;
}
body:has(.tl-merge-page) .lib-add-box--nav form {
  display: flex;
  align-items: center;
  gap: 0.55em;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  margin: 0;
  height: 100%;
}
body:has(.tl-merge-page) .lib-add-box--nav .lib-add-url {
  flex: 1 1 auto;
  min-width: 6rem;
  width: auto;
  font-size: 0.72rem;
  padding: 2px 0;
  text-align: left;
}
body:has(.tl-merge-page) .lib-add-box--nav .librarium-lite-chip-btn {
  flex-shrink: 0;
}
body:has(.tl-merge-page) .lib-add-box--nav #add-item-result {
  flex: 0 1 auto;
  max-width: 9rem;
  margin: 0 0 0 0.35em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  pointer-events: none;
}
.librarium-lite-brand-wrap .lib-add-toggle,
.librarium-lite-brand-wrap .librarium-lite-chip-btn {
  margin-left: 0;
  flex-shrink: 0;
  white-space: nowrap;
}
body:has(.tl-merge-page) .librarium-lite-nav--has-center > * {
  overflow: visible;
}
body:has(.tl-merge-page) .librarium-lite-nav-center {
  position: relative;
  z-index: 1;
}
body:has(.tl-merge-page) .librarium-lite-nav-right {
  position: relative;
  z-index: 1;
}
body:has(.tl-merge-page) .librarium-lite-nav--add-open .librarium-lite-nav-center {
  opacity: 0.35;
  pointer-events: none;
}
/* collections / targets merge - brand left, nav links + admin on the right */
body:has(.tl-merge-page) .librarium-lite-nav:not(.librarium-lite-nav--has-center) > nav {
  margin-left: auto;
  flex-shrink: 0;
}
body:has(.tl-merge-page) .librarium-lite-nav:not(.librarium-lite-nav--has-center) .librarium-lite-header-end {
  margin-left: 1em;
  flex-shrink: 0;
}
.librarium-lite-brand { font-family: var(--font-inscription); font-size: 1.45rem; font-weight: 400; letter-spacing: 0.04em; line-height: 1; color: var(--fg); text-decoration: none; }
.librarium-lite-nav nav { display: flex; gap: 1em; }
.librarium-lite-nav nav a {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--fg-second-dim);
  text-decoration: none;
  letter-spacing: -0.015em;
}
.librarium-lite-nav nav a:hover { color: var(--fg); }
.librarium-lite-header-end {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-left: auto;
}
.librarium-lite-nav--has-center {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 1.2em;
}
body:has(.tl-merge-page) .librarium-lite-nav--has-center {
  grid-template-columns: minmax(0, 1fr) auto auto;
  overflow: visible;
}
.librarium-lite-nav--has-center .librarium-lite-header-end { margin-left: 0; }
.librarium-lite-nav-center {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}
.librarium-lite-nav-right {
  display: flex;
  align-items: center;
  gap: 1em;
  justify-self: end;
}
.librarium-lite-nav-center .tl-stats-nav { width: 100%; }
.librarium-lite-nav-center .tl-stats-bar { display: none; }
.librarium-lite-nav-center .tl-stats-labels {
  margin: 0;
  gap: 0.55em;
  font-size: 0.62rem;
  flex-wrap: wrap;
  justify-content: center;
}
.librarium-lite-nav-center .tl-stats-label { padding: 1px 6px; }
@media (max-width: 960px) {
  body:has(.tl-merge-page) {
    --librarium-lite-nav-h: 5.35rem;
  }
  .librarium-lite-nav {
    --librarium-lite-nav-row-btn-h: 1.4rem;
    padding: 0.45rem 0.65rem;
    gap: 0.45em 0.65em;
  }
  .librarium-lite-nav .librarium-lite-brand-wrap .librarium-lite-chip-btn,
  .librarium-lite-nav .tl-nav-top-actions .librarium-lite-chip-btn,
  .librarium-lite-nav .tl-nav-top-actions .lib-quicknav button {
    box-sizing: border-box;
    height: var(--librarium-lite-nav-row-btn-h);
    min-height: var(--librarium-lite-nav-row-btn-h);
    padding: 0 6px;
    font-size: 0.62rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  body:has(.tl-merge-page) .librarium-lite-nav {
    height: auto;
    min-height: var(--librarium-lite-nav-h);
    max-height: none;
    align-items: flex-start;
  }
  .librarium-lite-repo-links { display: none; }
  body:has(.tl-merge-page) .librarium-lite-brand {
    font-size: 1.35rem;
  }
  body:has(.tl-merge-page) .librarium-lite-brand-wrap {
    align-self: auto;
    align-items: center;
    height: auto;
    flex-wrap: wrap;
    row-gap: 0.35em;
  }
  body:has(.tl-merge-page) .librarium-lite-add-launcher {
    height: auto;
    align-self: center;
  }
  body:has(.tl-merge-page) .lib-add-box--nav:not([hidden]) {
    flex: 1 1 100%;
    max-width: calc(100vw - 1.3rem);
    height: auto;
    max-height: none;
    margin: 0.15rem 0 0;
  }
  .librarium-lite-nav-center:has(.tl-stats-nav) { display: none; }
  .librarium-lite-nav--has-center {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    row-gap: 0.35rem;
    column-gap: 0.65rem;
  }
  body:has(.tl-merge-page) .librarium-lite-nav--has-center {
    grid-template-columns: unset;
  }
  .librarium-lite-nav--has-center .librarium-lite-brand-wrap {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
  }
  .librarium-lite-nav:not(.librarium-lite-nav--has-center) {
    flex-wrap: wrap;
  }
  body:has(.tl-merge-page) .librarium-lite-nav:not(.librarium-lite-nav--has-center) .librarium-lite-brand-wrap {
    flex: 1 1 100%;
  }
  body:has(.tl-merge-page) .librarium-lite-nav:not(.librarium-lite-nav--has-center) > nav {
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.4em 0.65em;
  }
  body:has(.tl-merge-page) .librarium-lite-nav:not(.librarium-lite-nav--has-center) .librarium-lite-header-end {
    margin-left: auto;
  }
  .librarium-lite-nav nav {
    flex-wrap: wrap;
    gap: 0.4em 0.65em;
  }
  .librarium-lite-nav nav a {
    font-size: 0.75rem;
    white-space: nowrap;
  }
  .librarium-lite-nav-right {
    flex: 1 1 100%;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    justify-self: stretch;
  }
  .librarium-lite-nav-right nav {
    flex: 0 0 auto;
    justify-content: flex-start;
    min-width: 0;
    width: 100%;
  }
  .librarium-lite-nav--has-center .librarium-lite-header-end,
  .librarium-lite-header-end {
    flex: 0 0 auto;
    width: 100%;
    margin-left: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5em;
  }
  .lib-quicknav {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
  }
  .lib-quicknav button {
    white-space: nowrap;
  }
  .librarium-lite-header-end .lib-quicknav button {
    font-size: 0.62rem;
    padding: 2px 6px;
  }
  #theme-toggle {
    display: none;
  }
}
@media (max-width: 540px) {
  body:has(.tl-merge-page) {
    --librarium-lite-nav-h: 6.1rem;
  }
  body:has(.tl-merge-page) .librarium-lite-brand {
    font-size: 1.2rem;
  }
  .librarium-lite-nav nav a {
    font-size: 0.7rem;
  }
}
#theme-toggle {
  font-size: 1rem; line-height: 1; padding: 2px 8px; cursor: pointer;
  background: transparent; border: none; border-radius: 0;
  color: var(--fg-second-dim);
  transition: background-color 70ms, color 70ms;
}
#theme-toggle:hover,
#theme-toggle:focus-visible {
  background: var(--ghost-fill-bg);
  color: var(--ghost-fill-fg);
}

/* ── Login / admin (flat - matches library controls) ── */
main:has(.admin-page),
main:has(.admin-login) {
  --lib-nacht: var(--lib-nacht-d);
  --lib-rubric: var(--lib-rubric-d);
  --lib-ink: var(--fg);
  --lib-faint: var(--fg-second-dim);
  --lib-card: var(--bg-high);
}
[data-theme="light"] main:has(.admin-page),
[data-theme="light"] main:has(.admin-login) {
  --lib-nacht: var(--lib-nacht-l);
  --lib-rubric: var(--lib-rubric-l);
}

.admin-page {
  max-width: min(64rem, 96vw);
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}
.admin-section--wide { grid-column: 1 / -1; }
@media (max-width: 720px) {
  .admin-grid { grid-template-columns: 1fr; }
}
.admin-header {
  text-align: center;
  margin-bottom: 1.75rem;
}
.admin-title {
  font-family: var(--font-inscription);
  font-size: 1.65rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--fg-title);
  margin: 0;
}
.admin-flashes {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}
.admin-flash {
  padding: 0.55rem 0.85rem;
  font-family: var(--font-monospace);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  line-height: 1.4;
}
.admin-flash--ok {
  background: color-mix(in srgb, var(--fg-green) 14%, var(--lib-card));
  color: var(--fg-green);
}
.admin-flash--err {
  background: color-mix(in srgb, var(--lib-rubric) 14%, var(--lib-card));
  color: var(--lib-rubric);
}
.admin-section {
  background: var(--lib-card);
  padding: 1.15rem 1.25rem 1.25rem;
  margin-bottom: 0;
}
.admin-section-title {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--fg-title);
  margin: 0 0 0.65rem;
}
.admin-hint {
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  line-height: 1.55;
  color: var(--lib-faint);
  margin: 0 0 0.85rem;
}
.admin-hint b { color: var(--lib-ink); font-weight: 600; }
.admin-field { margin: 0 0 0.95rem; }
.admin-field label {
  display: block;
  font-family: var(--font-monospace);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--lib-faint);
  margin-bottom: 0.35rem;
  line-height: 1.45;
}
.admin-field .admin-toggle {
  display: flex;
  color: var(--lib-ink);
  margin: 0.55rem 0 0.85rem;
}
.admin-field-meta { color: var(--lib-faint); }
.admin-field label code,
.admin-section code {
  font-family: var(--font-monospace);
  font-size: 0.92em;
  color: var(--fg-second);
}
.admin-input {
  display: block;
  width: 100%;
  padding: 6px 2px;
  font: 0.9rem var(--font-heading);
  background: transparent;
  color: var(--lib-ink);
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--lib-faint) 40%, transparent);
  border-radius: 0;
}
.admin-input::placeholder { color: var(--lib-faint); opacity: 0.85; }
.admin-input:focus {
  outline: none;
  border-bottom-color: var(--lib-rubric);
}
.admin-textarea {
  min-height: 5rem;
  resize: vertical;
  line-height: 1.45;
  padding-top: 0.35rem;
}
.admin-toggle {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.45rem 0;
  font-family: var(--font-monospace);
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--lib-ink);
  cursor: pointer;
  user-select: none;
}
.admin-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.admin-toggle-control {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.05em;
  border-radius: 0;
  background: color-mix(in srgb, var(--lib-faint) 16%, var(--lib-card));
  border: 1px solid color-mix(in srgb, var(--lib-faint) 28%, transparent);
  position: relative;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.admin-toggle:hover .admin-toggle-control {
  background: color-mix(in srgb, var(--lib-faint) 24%, var(--lib-card));
  border-color: color-mix(in srgb, var(--lib-faint) 38%, transparent);
}
.admin-toggle input:checked + .admin-toggle-control {
  background: var(--lib-rubric);
  border-color: var(--lib-rubric);
}
.admin-toggle input:checked + .admin-toggle-control::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 0.32rem;
  height: 0.56rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}
.admin-toggle input:focus-visible + .admin-toggle-control {
  outline: 2px solid color-mix(in srgb, var(--lib-rubric) 50%, transparent);
  outline-offset: 2px;
  border-radius: 0;
}
.admin-toggle-hint { color: var(--lib-faint); }
.admin-copy-ref-presets { display: flex; flex-direction: column; gap: 0.35rem; margin: 0 0 0.85rem; }
.admin-radio {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.45rem 0;
  font-family: var(--font-monospace);
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--lib-ink);
  cursor: pointer;
  user-select: none;
}
.admin-radio input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}
.admin-radio > span { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.admin-copy-ref-example {
  display: block;
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--lib-faint);
  white-space: pre-wrap;
  word-break: break-word;
}
.admin-textarea--mono { font-family: var(--font-monospace); font-size: 0.72rem; }
.admin-actions--rating-sync { margin-top: 0.35rem; }
.admin-toggle--sync-all { display: flex; margin: 0 0 0.85rem; }
.admin-rating-sync-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 2rem;
  margin-bottom: 0.35rem;
}
.admin-rating-sync-col { min-width: 0; }
.admin-rating-sync-col .admin-hint { margin: 0 0 0.35rem; }
@media (max-width: 720px) {
  .admin-rating-sync-cols { grid-template-columns: 1fr; gap: 0.75rem; }
}
.admin-rating-sync-panel {
  width: 100%;
  margin: 0.85rem 0 0.25rem;
  padding: 0.65rem 0.75rem;
  background: color-mix(in srgb, var(--lib-faint) 8%, var(--lib-card));
}
.admin-rating-sync-track {
  height: 3px;
  background: color-mix(in srgb, var(--lib-faint) 25%, transparent);
  overflow: hidden;
  margin-bottom: 0.55rem;
}
.admin-rating-sync-fill {
  height: 100%;
  width: 35%;
  background: var(--fg-green);
  animation: lib-media-sync-indeterminate 1.2s ease-in-out infinite;
}
.admin-rating-sync-panel.is-idle .admin-rating-sync-fill { width: 0; animation: none; }
.admin-rating-sync-panel.is-done .admin-rating-sync-fill { width: 100%; animation: none; background: var(--fg-green); }
.admin-rating-sync-panel.is-error .admin-rating-sync-fill { width: 100%; animation: none; background: var(--lib-rubric); }
.admin-rating-sync-status,
.admin-rating-sync-detail,
.admin-rating-sync-meta {
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  line-height: 1.45;
}
.admin-rating-sync-status {
  font-size: 0.72rem;
  color: var(--lib-ink);
  margin-bottom: 0.2rem;
}
.admin-rating-sync-panel.is-active .admin-rating-sync-status { color: var(--lib-nacht); }
.admin-rating-sync-panel.is-done .admin-rating-sync-status { color: var(--fg-green); }
.admin-rating-sync-panel.is-error .admin-rating-sync-status { color: var(--lib-rubric); }
.admin-rating-sync-detail {
  color: var(--lib-nacht);
  word-break: break-word;
}
.admin-rating-sync-meta {
  color: var(--lib-faint);
  margin-top: 0.25rem;
}
.admin-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.75rem;
  margin: 0 0 1rem;
}
.admin-metrics > div {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 4.5rem;
}
.admin-metrics > .admin-metric-wide {
  flex: 1 1 100%;
  min-width: 0;
}
.admin-metrics > .admin-metric-wide dd code {
  display: block;
  font-size: 0.68rem;
  font-weight: 400;
  line-height: 1.45;
  word-break: break-all;
}
.admin-metrics dt {
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  color: var(--lib-faint);
  margin: 0;
}
.admin-metrics dd {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--lib-ink);
  letter-spacing: -0.01em;
}
.admin-metrics dd code {
  font-size: 0.78rem;
  font-weight: 400;
}
.admin-badge { font-weight: 600; }
.admin-badge--ok { color: var(--fg-green); }
.admin-badge--bad { color: var(--lib-rubric); }
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.15rem;
}
.admin-login {
  max-width: 22rem;
  margin: 4rem auto;
  padding: 1.5rem 1.25rem 1.75rem;
  text-align: center;
  background: var(--lib-card);
}
.admin-login-title {
  font-family: var(--font-inscription);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--fg-title);
  margin: 0 0 1.25rem;
}
.admin-login-form .admin-input { text-align: center; margin-bottom: 1rem; }
.admin-login-form .admin-actions { justify-content: center; }

.admin-page .librarium-lite-chip-btn,
.admin-login .librarium-lite-chip-btn {
  font-size: 0.75rem;
}

/* ── Link cards (arXiv / DOI / lib) ── */
a.link-card,
div.link-card {
  display: block;
  margin: 0.75em 0;
  max-width: 28rem;
  overflow: hidden;
  background: var(--bg-link-card);
  text-decoration: none;
  color: inherit;
}

div.link-card { cursor: pointer; }

div.link-card:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }

.link-card-inner { padding: 12px 14px 10px; background: var(--bg-link-card); font-family: var(--font-prose); font-size: 10pt; line-height: 1.4; }

.link-card-title {
  color: var(--fg-title);
  font-family: var(--font-prose);
  font-size: 13pt;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.35em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.link-card-desc {
  color: var(--fg-second-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.link-card-footer {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px 10px;
  border-top: 1px solid var(--border-red-dark);
  background: var(--bg-link-card);
  font-family: var(--font-monospace);
  font-size: 9pt;
}

.link-card-itmens-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  line-height: 0;
  text-decoration: none;
  border-radius: 0;
  background: color-mix(in srgb, var(--fg) 6%, var(--bg-link-card));
  box-sizing: border-box;
  flex-shrink: 0;
}

.link-card-itmens-logo-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: color-mix(in srgb, var(--fg) 6%, var(--bg-link-card));
  box-sizing: border-box;
  flex-shrink: 0;
}

.link-card-itmens-logo { width: 16px; height: 16px; display: block; flex-shrink: 0; object-fit: contain; }

/* --- arXiv link cards --- */

.link-card--arxiv { position: relative; }

/* Faint arXiv logo watermark - cards have no og:image media */
.link-card--arxiv::before {
  content: "arXiv";
  position: absolute;
  top: 8px;
  right: 12px;
  /* font-family: system-ui, -apple-system, sans-serif; */
  font-size: 40px;
  font-weight: 700;
  color: var(--lib-rubric);
  opacity: 0.04;
  pointer-events: none;
  line-height: 1;
  user-select: none;
}

/* arXiv red wordmark badge - authentic identity in place of a favicon */
.link-card-arxiv-badge {
  flex-shrink: 0;
  padding: 2px 6px;
  background: var(--lib-rubric);
  color: #fff;
  font-family: var(--font-monospace);
  font-size: 8.5pt;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
a.link-card-arxiv-badge,
a.link-card-arxiv-badge:visited {
  text-decoration: none;
  color: #fff !important;
  background-color: var(--lib-rubric) !important;
  cursor: pointer;
}
a.link-card-arxiv-badge:hover,
a.link-card-arxiv-badge:focus-visible {
  background-color: color-mix(in srgb, var(--lib-rubric) 75%, #000) !important;
  color: #fff !important;
}

.link-card-arxiv-meta,
.link-card-cite-meta { color: var(--fg-second-dim); font-size: 9pt; margin-left: auto; white-space: nowrap; }

/* BibTeX copy button in arXiv card footer */
.link-card-bibtex-btn {
  flex-shrink: 0;
  margin-left: 8px;
  padding: 2px 6px;
  border: none;
  background: var(--lib-rubric);
  color: #fff;
  font-family: var(--font-monospace);
  font-size: 8pt;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.3;
  transition: background-color 70ms, color 70ms;
}

.link-card-bibtex-btn:hover,
.link-card-bibtex-btn:focus-visible { background: color-mix(in srgb, var(--lib-rubric) 75%, #000); color: #fff; }

/* --- DOI link cards: arXiv structure, nacht-blue identity --- */
.link-card--doi { position: relative; }
.link-card--doi::before {
  content: "DOI";
  position: absolute;
  top: 8px;
  right: 12px;
  font-family: var(--font-ui);
  font-size: 40px;
  font-weight: 700;
  color: var(--lib-nacht);
  opacity: 0.05;
  pointer-events: none;
  line-height: 1;
  user-select: none;
}
.link-card-doi-badge,
.link-card-site-badge {
  flex-shrink: 0;
  padding: 2px 6px;
  background: var(--lib-nacht);
  color: #fff;
  font-family: var(--font-monospace);
  font-size: 8.5pt;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
a.link-card-doi-badge,
a.link-card-doi-badge:visited,
a.link-card-site-badge,
a.link-card-site-badge:visited {
  text-decoration: none;
  color: #fff !important;
  background-color: var(--lib-nacht) !important;
  cursor: pointer;
}
a.link-card-doi-badge:hover,
a.link-card-doi-badge:focus-visible,
a.link-card-site-badge:hover,
a.link-card-site-badge:focus-visible {
  background-color: color-mix(in srgb, var(--lib-nacht) 70%, #000) !important;
  color: #fff !important;
}

.link-card-jstor-badge {
  flex-shrink: 0;
  padding: 2px 6px;
  background: #990000;
  color: #fff;
  font-family: var(--font-monospace);
  font-size: 8.5pt;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
a.link-card-jstor-badge,
a.link-card-jstor-badge:visited {
  text-decoration: none;
  color: #fff !important;
  background-color: #990000 !important;
  cursor: pointer;
}
a.link-card-jstor-badge:hover,
a.link-card-jstor-badge:focus-visible {
  background-color: #770000 !important;
  color: #fff !important;
}

.link-card-aeon-badge {
  flex-shrink: 0;
  padding: 2px 6px;
  background: #c62828;
  color: #fff;
  font-family: var(--font-serif-g), Georgia, "Times New Roman", serif;
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}
a.link-card-aeon-badge,
a.link-card-aeon-badge:visited {
  text-decoration: none;
  color: #fff !important;
  background-color: #c62828 !important;
  cursor: pointer;
}
a.link-card-aeon-badge:hover,
a.link-card-aeon-badge:focus-visible {
  background-color: #a02020 !important;
  color: #fff !important;
}

.link-card-biorxiv-badge {
  flex-shrink: 0;
  padding: 2px 6px;
  background: #005696;
  color: #fff;
  font-family: var(--font-monospace);
  font-size: 8.5pt;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
a.link-card-biorxiv-badge,
a.link-card-biorxiv-badge:visited {
  text-decoration: none;
  color: #fff !important;
  background-color: #005696 !important;
  cursor: pointer;
}
a.link-card-biorxiv-badge:hover,
a.link-card-biorxiv-badge:focus-visible {
  background-color: #004578 !important;
  color: #fff !important;
}


/* PDF link badge in arXiv card footer */
.link-card-pdf-badge {
  flex-shrink: 0;
  margin-left: 6px;
  padding: 2px 7px;
  background-color: var(--lib-rubric) !important;
  color: #fff !important;
  font-family: var(--font-monospace);
  font-size: 8.5pt;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.3;
  transition: background-color 0.2s ease;
}

.link-card-pdf-badge:hover,
.link-card-pdf-badge:focus-visible { background-color: color-mix(in srgb, var(--lib-rubric) 70%, #000) !important; color: #fff !important; }

.link-card-html-badge {
  flex-shrink: 0;
  margin-left: 4px;
  padding: 2px 7px;
  background-color: var(--lib-rubric) !important;
  color: #fff !important;
  font-family: var(--font-monospace);
  font-size: 8.5pt;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.3;
  transition: background-color 0.2s ease;
}

.link-card-html-badge:hover,
.link-card-html-badge:focus-visible { background-color: color-mix(in srgb, var(--lib-rubric) 70%, #000) !important; color: #fff !important; }

@keyframes ribbon-glide {
  0%   { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

.lib-file-dl-badge {
  position: relative;
  z-index: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  width: max-content;
  min-width: max-content;
  min-height: calc(8.5pt * 1.2 + 4px);
  padding: 2px 7px;
  font-family: var(--font-monospace);
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  isolation: isolate;
  vertical-align: middle;
  -webkit-appearance: none;
  appearance: none;
}
.lib-file-dl-badge::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: #000;
  border: 1px solid rgba(249, 115, 22, 0.3);
}
[data-theme="light"] .lib-file-dl-badge::before {
  background: #fff;
  border-color: rgba(249, 115, 22, 0.35);
}
.lib-file-dl-label {
  display: block;
  flex-shrink: 0;
  line-height: 1.2;
  white-space: nowrap;
  background: linear-gradient(90deg, #fbbf24 0%, #f97316 20%, #d4556a 40%, #ef4444 55%, #d4556a 70%, #f97316 85%, #fbbf24 100%) 0 0 / 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: ribbon-glide 2s ease-in-out infinite;
}
a.lib-file-dl-badge,
a.lib-file-dl-badge:visited {
  text-decoration: none;
  cursor: pointer;
}
a.lib-file-dl-badge:hover::before,
a.lib-file-dl-badge:focus-visible::before {
  background: #000;
  border-color: rgba(249, 115, 22, 0.55);
}
[data-theme="light"] a.lib-file-dl-badge:hover::before,
[data-theme="light"] a.lib-file-dl-badge:focus-visible::before {
  background: #fff;
  border-color: rgba(249, 115, 22, 0.65);
}

/* lib embed-card identity */
.link-card--lib .link-card-title { font-family: var(--font-goth); }

/* ════════════════════════════════════════════════════════════
   library.css - Bibliotheca + Timeline styles
   Loaded only on /library and /timeline (extracted from natur.css)
   ════════════════════════════════════════════════════════════ */

/* -- Library - BIBLIOTHECA -- */

/* One inscription (fraktur), one color (rubric red), the site's own ground.
   Sacredness as structure, not costume. No radius, no transition. */
.library-page, .timeline-page, .collections-page, .targets-page {
  --lib-nacht:  var(--lib-nacht-d);   /* die blaue Blume -- faded night blue */
  --lib-rubric: var(--lib-rubric-d);
  --lib-ink:    var(--fg);
  --lib-faint:  var(--fg-second-dim);
  --lib-gold:   var(--lib-gold-d);
  --lib-rule:   var(--border-red-dark);
  --lib-card:   var(--bg-high);
  --lib-muted:  var(--lib-faint);
}
[data-theme="light"] .library-page, [data-theme="light"] .timeline-page, [data-theme="light"] .collections-page, [data-theme="light"] .targets-page {
  --lib-nacht:  var(--lib-nacht-l);
  --lib-rubric: var(--lib-rubric-l);
  --lib-gold:   var(--lib-gold-l);
}

.library-page ::selection { background: color-mix(in srgb, var(--lib-nacht) 30%, transparent); }

/* add-item toggle + inline form */
.lib-add-toggle {
  font-family: var(--font-ui);
  font-size: 0.6rem;
  margin-left: 0.75em;
  text-decoration: underline;
  color: var(--lib-nacht);
  cursor: pointer;
}
.lib-add-toggle:hover { color: var(--lib-rubric); }
.lib-add-box[hidden] { display: none; }
.lib-add-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0.8rem auto 0;
  width: min(30rem, 90%);
}
.lib-add-box form {
  display: flex;
  gap: 0.55em;
  width: 100%;
  align-items: center;
}
.lib-add-box .lib-add-url {
  flex: 1;
  min-width: 0;
}
.lib-add-box .librarium-lite-chip-btn {
  flex-shrink: 0;
}
.lib-add-box .tl-compose-status {
  width: 100%;
  margin-top: 6px;
  text-align: center;
}

/* epigraph -- unattributed, under the rule */
.library-epigraph {
  font-family: var(--font-monospace);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-align: center;
  color: var(--lib-nacht);
  margin: 0.7rem 0 0;
}

/* Schlussstueck -- Bluethenstaub */
.library-page::after {
  content: "\2042"; /* asterism */
  display: block;
  text-align: center;
  font-size: 0.9rem;
  color: var(--lib-nacht);
  margin: 2.2rem 0 0.8rem;
}

/* ── The inscription ── */
.library-page h1,
[data-theme="light"] .library-page h1,
.collections-page:not(.collections-page--pane) h1,
[data-theme="light"] .collections-page:not(.collections-page--pane) h1 {
  font-family: var(--font-inscription);
  font-weight: 400;
  text-align: center;
  font-size: 2.3rem;
  letter-spacing: 0.04em;
  color: var(--lib-ink);
  margin: 1.4rem 0 0;
}
.library-page h1::before,
.library-page h1::after,
.collections-page:not(.collections-page--pane) h1::before,
.collections-page:not(.collections-page--pane) h1::after {
  content: "\2720"; /* ✠ */
  color: var(--lib-rubric);
  font-size: 0.5em;
  vertical-align: 0.3em;
  letter-spacing: 0;
  margin: 0 1.2em;
}

/* ── Controls: a single ledger rule ── */
.library-page--pane .library-controls {
  align-items: center;
  width: 100%;
  min-width: 0;
  margin-top: 0;
  margin-bottom: 0.45rem;
  padding-top: 0.15rem;
}
.library-page--pane .library-controls .lib-search-wrap {
  width: min(100%, 11.5rem);
  max-width: 11.5rem;
  box-sizing: border-box;
}
.library-page--pane .library-controls input {
  font-size: 0.72em;
}
.library-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 1.3rem;
  margin-bottom: 1.6rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.library-controls .lib-search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: min(34rem, 92%);
  max-width: min(34rem, 92%);
  box-sizing: border-box;
}
.library-controls .lib-search-wrap input {
  width: 100%;
  padding: 6px 1.6rem 6px 2px;
  font: 1rem var(--font-ui);
  text-align: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--lib-rule);
  border-radius: 0;
  color: var(--lib-ink);
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}
.library-controls .lib-search-wrap input::placeholder { color: var(--lib-faint); }
.library-controls .lib-search-wrap input:focus { outline: none; border-bottom-color: var(--lib-rubric); }
.lib-search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}
.lib-search-wrap input {
  -webkit-appearance: none;
  appearance: none;
}
.lib-search-wrap input::-webkit-search-decoration,
.lib-search-wrap input::-webkit-search-results-button,
.lib-search-wrap input::-webkit-search-results-decoration,
.lib-search-wrap input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.tl-controls .lib-search-wrap:has(#tl-search[hidden]),
.tl-feed-head--merge .lib-search-wrap:has(#tl-search[hidden]) {
  display: none;
}
.lib-search-clear {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--lib-faint);
  font-family: var(--font-monospace);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 70ms, color 70ms;
}
.lib-search-clear[hidden] { display: none !important; }
.lib-search-clear:hover,
.lib-search-clear:focus-visible {
  background: var(--ghost-fill-bg);
  color: var(--ghost-fill-fg);
}

.library-status--err { color: var(--lib-rubric); }

/* taxonomy */
.lib-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}
.lib-filter {
  font-family: var(--font-monospace);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 2px 9px;
  cursor: pointer;
  color: var(--lib-faint);
  background: var(--lib-card);
  border: none;
}
.lib-filter:hover { color: var(--lib-ink); }
.lib-filter-n {
  margin-left: 0.55em;
  font-size: 0.62rem;
  color: var(--lib-nacht);
}
.lib-filter.lib-filter-active {
  color: #fff;
  background: var(--g, var(--lib-rubric));
}
.lib-filter.lib-filter-active .lib-filter-n { color: rgba(255, 255, 255, 0.72); }

/* ── The folios ── */
.library-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  position: relative;
  padding-top: 1.05rem;
}

.library-status {
  position: absolute;
  top: 0.1rem;
  left: 0;
  z-index: 5;
  pointer-events: none;
  font-family: var(--font-monospace);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--lib-faint);
  line-height: 1;
  white-space: nowrap;
}

.library-card-wrap {
  position: relative;
  background: var(--lib-card);
  border: none;
}

.label-chip {
  display: inline-block;
  vertical-align: bottom;
  overflow: hidden;
  max-width: 100%;
}
.label-chip-text {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}
.label-chip.label-chip-overflow:hover .label-chip-text {
  text-overflow: clip;
  animation: label-chip-scroll 2.6s ease-in-out infinite alternate;
}
@keyframes label-chip-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-1 * var(--label-chip-scroll, 0px))); }
}

.library-card-wrap[data-grp="music"] a.lib-music-publisher-chip {
  position: absolute;
  top: 6px;
  right: 5px;
  z-index: 3;
  display: inline-block;
  max-width: min(12rem, calc(100% - 1rem));
  overflow: hidden;
  font-family: "P22StGSchriftOne", serif;
  font-weight: 400;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  line-height: 1.35;
  padding: 2px 8px;
  background: var(--chip-flat-bg);
  border: 1px solid var(--chip-flat-border);
  color: var(--chip-flat-fg);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 70ms, border-color 70ms, color 70ms;
}
.library-card-wrap[data-grp="music"] .library-coll-btn { top: 34px; }
.library-card-wrap[data-grp="music"] .library-copy-btn { top: 60px; }
.library-card-wrap[data-grp="music"] .library-open-btn { top: 86px; }
.library-card-wrap[data-grp="music"] .library-url-btn { top: 112px; }
.library-card-wrap[data-grp="music"] a.lib-music-publisher-chip:hover {
  border-color: var(--chip-hover-bg);
  color: var(--chip-flat-fg);
  background: var(--chip-hover-bg);
}
[data-theme="light"] .library-card-wrap[data-grp="music"] a.lib-music-publisher-chip {
  background: var(--ink-fill-bg);
  border-color: var(--ink-fill-bg);
  color: var(--ink-fill-fg);
}
[data-theme="light"] .library-card-wrap[data-grp="music"] a.lib-music-publisher-chip:hover {
  border-color: var(--ink-fill-hover-bg);
  color: var(--ink-fill-fg);
  background: var(--ink-fill-hover-bg);
}

.library-card-cover-frame {
  position: relative;
  display: inline-block;
  line-height: 0;
  vertical-align: top;
}

.library-card-cover--empty {
  position: relative;
  min-height: 2.5rem;
}

.lib-podcast-cover-play {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 70ms, visibility 70ms;
}
.library-card-cover-frame:hover .lib-podcast-cover-play,
.library-card-cover-frame:focus-within .lib-podcast-cover-play,
.timeline-cover--float:hover .lib-podcast-cover-play,
.timeline-cover--float:focus-within .lib-podcast-cover-play {
  opacity: 1;
  visibility: visible;
}
.lib-podcast-cover-play .lib-podcast-play-badges {
  pointer-events: none;
  line-height: 1;
}
.library-card-cover-frame:hover .lib-podcast-cover-play .lib-podcast-play-badges,
.library-card-cover-frame:focus-within .lib-podcast-cover-play .lib-podcast-play-badges,
.timeline-cover--float:hover .lib-podcast-cover-play .lib-podcast-play-badges,
.timeline-cover--float:focus-within .lib-podcast-cover-play .lib-podcast-play-badges {
  pointer-events: auto;
}
.lib-podcast-cover-play .lib-podcast-play-badge.librarium-lite-chip-btn {
  min-width: 2rem;
  min-height: 2rem;
  padding: 0 0.45rem;
  font-size: 0.82rem;
}

.lib-cover-badges {
  position: absolute;
  bottom: 4px;
  right: 4px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-wrap: nowrap;
  gap: 3px;
  width: max-content;
  max-width: calc(100% - 8px);
  line-height: 1.2;
}

.library-card-cover-frame .lib-cover-badges,
.library-card-cover--empty .lib-cover-badges {
  pointer-events: auto;
}

.library-card-cover-frame .lib-pdf-badges,
.library-card-cover-frame .lib-podcast-play-badges {
  position: relative;
  flex-shrink: 0;
  line-height: 1.2;
}

.library-card-cover-frame .lib-file-dl-badge {
  position: relative;
  flex-shrink: 0;
  line-height: 1.2;
}

/* legacy: direct pdf badges on cover frame (cite refresh paths) */
.library-card-cover-frame .lib-pdf-badges {
  position: absolute;
  bottom: 4px;
  right: 4px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-wrap: nowrap;
  gap: 3px;
  width: max-content;
  max-width: calc(100% - 8px);
  line-height: 1.2;
}

.library-card-cover-frame:has(.lib-cover-badges) .lib-pdf-badges {
  position: relative;
  bottom: auto;
  right: auto;
}

a.librarium-lite-chip-btn,
a.librarium-lite-chip-btn:visited {
  text-decoration: none;
}

.lib-podcast-play-badge.librarium-lite-chip-btn {
  flex-shrink: 0;
  box-sizing: border-box;
  font-size: 8.5pt;
  font-weight: 700;
  padding: 2px 7px;
  justify-content: center;
  min-width: calc(8.5pt * 1.2 + 4px);
  min-height: calc(8.5pt * 1.2 + 4px);
  border: none;
}
a.lib-podcast-play-badge.librarium-lite-chip-btn--on,
.lib-podcast-player-play.librarium-lite-chip-btn--on {
  background: var(--chip-on-bg);
  border: none;
  color: var(--chip-on-fg);
}

.lib-podcast-player {
  --lib-ink: var(--fg);
  --lib-faint: var(--fg-dim);
  --glass-podcasts: hsl(40, 80%, 46%);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  box-sizing: border-box;
  padding: 0.55rem clamp(0.75rem, 2vw, 1.25rem) calc(0.55rem + env(safe-area-inset-bottom, 0px));
  font-family: var(--font-monospace);
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--lib-ink);
  background-color: var(--bg-high);
  border-top: 1px solid var(--border-red-dark);
}
[data-theme="light"] .lib-podcast-player {
  --lib-ink: var(--fg);
  --lib-faint: var(--fg-dim);
  --glass-podcasts: hsl(38, 85%, 32%);
  background-color: var(--bg);
  border-top-color: var(--border-red-dark);
}
.lib-podcast-player-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: none;
}
.lib-podcast-player-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.lib-podcast-player-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}
.lib-podcast-player-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--lib-ink);
}
.lib-podcast-player-time {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  color: var(--lib-faint);
  white-space: nowrap;
}
.lib-podcast-player-sep {
  margin: 0 0.15rem;
  opacity: 0.55;
}
.lib-podcast-player-seek {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 0.35rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  --seek-pct: 0%;
}
.lib-podcast-player-seek:focus {
  outline: none;
}
.lib-podcast-player-seek:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--glass-podcasts) 55%, transparent);
  outline-offset: 2px;
}
.lib-podcast-player-seek::-webkit-slider-runnable-track {
  height: 0.35rem;
  background: linear-gradient(
    to right,
    var(--glass-podcasts) 0%,
    var(--glass-podcasts) var(--seek-pct, 0%),
    color-mix(in srgb, var(--lib-faint) 22%, transparent) var(--seek-pct, 0%),
    color-mix(in srgb, var(--lib-faint) 22%, transparent) 100%
  );
  border: 0;
  border-radius: 0;
}
.lib-podcast-player-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 0.85rem;
  height: 0.85rem;
  margin-top: calc((0.35rem - 0.85rem) / 2);
  border: 0;
  border-radius: 0;
  background: var(--glass-podcasts);
  cursor: grab;
}
.lib-podcast-player-seek:active::-webkit-slider-thumb {
  cursor: grabbing;
}
.lib-podcast-player-seek::-moz-range-track {
  height: 0.35rem;
  background: color-mix(in srgb, var(--lib-faint) 22%, transparent);
  border: 0;
  border-radius: 0;
}
.lib-podcast-player-seek::-moz-range-progress {
  height: 0.35rem;
  background: var(--glass-podcasts);
  border-radius: 0;
}
.lib-podcast-player-seek::-moz-range-thumb {
  width: 0.85rem;
  height: 0.85rem;
  border: 0;
  border-radius: 0;
  background: var(--glass-podcasts);
  cursor: grab;
}
.lib-podcast-player .librarium-lite-chip-btn {
  flex-shrink: 0;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  font-size: 0.78rem;
  border: none;
}
.lib-podcast-player-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
body.lib-podcast-player-open {
  padding-bottom: calc(3.75rem + env(safe-area-inset-bottom, 0px));
}

.lib-pdf-badges {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
  line-height: 1.2;
}

.link-card-footer .lib-pdf-badges { margin-left: 6px; flex-shrink: 0; }
.link-card-footer .lib-file-dl-badge { margin-left: 0; }

.library-card-cover {
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100px;
}

.library-card {
  position: relative;
  background: transparent;
  padding: 1rem 1.1rem 0.9rem;
  display: flex;
  flex-direction: row;
  gap: 0.9rem;
  text-decoration: none;
  color: inherit;
  height: 300px;
  overflow: hidden;
  box-sizing: border-box;
}

.library-card-cover-frame > img {
  width: 100px;
  height: auto;
  max-height: 210px;
  display: block;
  object-fit: cover;
  border: none;
  box-sizing: border-box;
}

.library-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, black 72%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 72%, transparent 100%);
}

.library-card-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--lib-ink);
  line-height: 1.3;
  word-break: break-word;
  margin-bottom: 0.15rem;
  -webkit-font-smoothing: antialiased;
}

.library-card-subtitle {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-style: italic;
  color: var(--lib-nacht);
  line-height: 1.35;
  margin-bottom: 0.3rem;
  word-break: break-word;
}

/* ── Fields: rubrics in the house goth ── */
.library-field {
  display: flex;
  gap: 0.5rem;
  font-size: 0.72rem;
  line-height: 1.45;
}
.library-field-name {
  flex-shrink: 0;
  font-family: var(--font-goth), var(--font-ui);
  letter-spacing: 0.025em;
  color: var(--lib-rubric);
  font-weight: 600;
  min-width: 4.25rem;
  -webkit-font-smoothing: antialiased;
}
.library-field-value {
  font-family: var(--font-ui);
  color: var(--lib-faint);
  word-break: break-word;
}

/* ── Foliation ── */
.library-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 1.4rem;
}
.library-controls .library-pagination { margin: 0; }

.library-results--loading {
  opacity: 0.55;
  pointer-events: none;
}

.library-page-btn {
  font-family: var(--font-monospace);
  font-size: 0.78rem;
  line-height: 1;
  width: 26px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  color: var(--lib-faint);
  background: var(--lib-card);
  border: none;
  border-radius: 0;
  transition: color 70ms;
}
.library-page-btn:hover:not(:disabled) { color: var(--lib-rubric); }
.library-page-btn:disabled {
  color: var(--lib-faint);
  cursor: default;
  opacity: 0.45;
}
.library-page-info {
  font-family: var(--font-monospace);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--lib-faint);
  font-variant-numeric: tabular-nums;
}

/* ── Copy + quick actions (top-right, flat ghost icons) ── */
.library-copy-btn,
.library-qa-btn {
  position: absolute; right: 5px; z-index: 2;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  font: 700 0.8em var(--font-ui); line-height: 1;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  border-radius: 0;
  outline: none;
  color: var(--lib-faint);
  cursor: pointer; opacity: 0; text-decoration: none;
  transition: background-color 70ms, color 70ms, opacity 0.12s ease;
}
.library-copy-btn { top: 31px; }
.library-copy-btn::before {
  content: "+";
  font: 700 0.8em var(--font-ui);
  line-height: 1;
}
.library-coll-btn { top: 5px; }
.library-open-btn { top: 57px; }
.library-url-btn { top: 83px; }
.library-goodreads-btn { top: 109px; font-family: var(--font-monospace); font-size: 0.72rem; font-weight: 600; text-transform: lowercase; }
.library-gutenberg-btn {
  top: 135px;
  width: auto;
  min-width: 22px;
  padding: 0 4px;
  font-family: var(--font-monospace);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: lowercase;
}
.library-card-wrap:hover .library-copy-btn,
.library-card-wrap:hover .library-qa-btn { opacity: 1; }
.library-qa-btn.library-coll-btn:active,
.library-qa-btn.library-coll-btn.is-loading,
.library-qa-btn.library-coll-btn.is-picker-open,
.library-qa-btn.library-coll-btn.is-in-collection {
  opacity: 1 !important;
}
.library-copy-btn:hover,
.library-copy-btn:focus-visible,
.library-qa-btn:hover,
.library-qa-btn:focus-visible {
  background: var(--ghost-fill-bg);
  color: var(--ghost-fill-fg);
}

/* shadow-lib - bottom-right flat ghost search + attach */
.lib-shadow-lib-btns {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 3;
  display: inline-flex;
  flex-direction: row;
  align-items: stretch;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  background: transparent;
  border: none;
}
.library-card-wrap:hover .lib-shadow-lib-btns,
.library-card-wrap:focus-within .lib-shadow-lib-btns,
.library-card-wrap--attach-open .lib-shadow-lib-btns {
  opacity: 1;
  pointer-events: auto;
}
.library-shadow-btn {
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--lib-faint);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 70ms, color 70ms;
}
.library-shadow-btn:hover,
.library-shadow-btn:focus-visible {
  background: var(--ink-fill-bg);
  color: var(--ink-fill-fg);
}
.library-shadow-attach {
  width: 24px;
  padding: 0;
}
.library-shadow-attach.is-open,
.library-card-wrap--attach-open .library-shadow-attach {
  background: var(--ink-fill-bg);
  color: var(--ink-fill-fg);
}
.library-shadow-icon {
  display: block;
  width: 13px;
  height: 13px;
}
@keyframes collection-btn-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes collection-picker-spin {
  from { transform: translateY(-50%) rotate(0deg); }
  to { transform: translateY(-50%) rotate(360deg); }
}
.library-coll-btn.is-loading,
.timeline-coll-btn.is-loading {
  color: transparent;
  opacity: 1 !important;
}
.library-coll-btn.is-loading::after,
.timeline-coll-btn.is-loading::after {
  content: "";
  display: block;
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--lib-rule);
  border-top-color: var(--lib-rubric);
  border-radius: 50%;
  transform-origin: center;
  animation: collection-btn-spin 0.7s linear infinite;
}
.library-coll-btn.is-in-collection,
.timeline-coll-btn.is-in-collection {
  opacity: 1 !important;
  color: var(--fg-green);
}
.library-qa-btn.library-coll-btn.is-in-collection:hover,
.library-qa-btn.library-coll-btn.is-in-collection:focus-visible {
  color: var(--fg-green);
}
.timeline-coll-btn:active,
.timeline-coll-btn.is-loading,
.timeline-coll-btn.is-picker-open,
.timeline-coll-btn.is-in-collection {
  opacity: 1 !important;
}

.lib-coll-compose {
  min-height: 100%;
}
.lib-coll-compose-for {
  margin: 0 0 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--lib-faint);
}
.lib-coll-compose-item {
  color: var(--lib-ink);
  font-weight: 500;
  word-break: break-word;
}
.lib-coll-compose-head-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.lib-coll-manage-link {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--lib-faint);
  text-decoration: none;
}
.lib-coll-manage-link:hover { color: var(--lib-rubric); text-decoration: underline; }
.lib-coll-compose-foot {
  margin-top: auto;
  padding-top: 0.35rem;
}
.lib-coll-compose-status:empty { display: none; }
.lib-coll-compose-status.is-error { color: var(--lib-rubric); }

.tl-compose-panel .lib-coll-picker-msg {
  padding: 0.35rem 0;
  color: var(--lib-rubric);
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  line-height: 1.35;
}
.tl-compose-panel .lib-coll-picker-list {
  list-style: none;
  margin: 0.1rem 0 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 6rem;
  overflow-y: auto;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  line-height: 1.25;
}
.tl-compose-panel .lib-coll-picker-item button,
.tl-compose-panel .lib-coll-picker-item span {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.15rem 0;
  border: none;
  background: none;
  color: var(--lib-ink);
  font: inherit;
  line-height: inherit;
  cursor: pointer;
}
.tl-compose-panel .lib-coll-picker-item button:hover:not(:disabled) {
  color: var(--lib-rubric);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tl-compose-panel .lib-coll-picker-item.is-member button {
  background-color: color-mix(in srgb, var(--fg-green) 16%, var(--lib-card));
}
.tl-compose-panel .lib-coll-picker-item.is-member button:hover:not(:disabled) {
  background-color: color-mix(in srgb, var(--lib-rubric) 14%, var(--lib-card));
  color: var(--lib-rubric);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tl-compose-panel .lib-coll-picker-item.is-dynamic span {
  color: var(--lib-faint);
  font-style: italic;
  cursor: default;
}
.tl-compose-panel .lib-coll-picker-item button.is-loading {
  color: transparent;
  position: relative;
}
.tl-compose-panel .lib-coll-picker-item button.is-loading::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--lib-rule);
  border-top-color: var(--lib-rubric);
  border-radius: 50%;
  transform-origin: center;
  animation: collection-picker-spin 0.7s linear infinite;
}
.tl-compose-panel .lib-coll-picker-empty {
  padding: 0.25rem 0;
  color: var(--lib-faint);
  font: inherit;
  font-style: italic;
  line-height: 1.25;
}

.tl-compose-panel .lib-coll-picker-create {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.tl-compose-panel .lib-coll-picker-create-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.tl-compose-panel .lib-coll-picker-create-form[hidden] { display: none; }
.tl-compose-panel .lib-coll-picker-create-status:empty { display: none; }
.tl-compose-panel .lib-coll-picker-create-status.is-error { color: var(--lib-rubric); }
.tl-compose-panel .lib-coll-picker-create-status:not(.is-error):not(:empty) { color: var(--fg-green); }

.library-card-wrap--attach-open { z-index: 4; overflow: visible; }
.lib-item-attach-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 5;
  margin-top: 2px;
  padding: 0.55rem 0.6rem;
  background: var(--bg-input);
  border: 2px solid #fff;
  color: var(--fg);
  font-family: var(--font-monospace);
  font-size: 0.72rem;
}
[data-theme="light"] .lib-item-attach-panel {
  background: #fff;
  border-color: #000;
  --fg: #1c1c1c;
  --fg-dim: #6b6b6b;
  --lib-faint: #6b6b6b;
  --lib-rule: #d0d0d0;
  --lib-nacht: #44607e;
  --lib-rubric: #8e2418;
  --chip-flat-bg: #e8e8e8;
  --chip-flat-border: #e8e8e8;
  --chip-flat-fg: #1c1c1c;
}
.lib-item-attach-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  gap: 0.45rem;
}
.lib-item-attach-title {
  font-family: var(--font-heading);
  letter-spacing: 0.02em;
  color: var(--fg-dim);
  font-size: 0.68rem;
}
.lib-item-attach-close {
  border: none;
  background: none;
  color: var(--fg-dim);
  font-family: var(--font-monospace);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.lib-item-attach-close:hover { color: var(--fg); }
.lib-item-attach-list {
  margin-bottom: 0.5rem;
  color: var(--fg-dim);
  line-height: 1.35;
}
.lib-item-attach-empty { font-style: italic; }
.lib-item-attach-list a {
  color: var(--lib-nacht);
  text-decoration: underline;
}
.lib-item-attach-list a:hover { color: var(--lib-rubric); }
.lib-item-attach-row + .lib-item-attach-row { margin-top: 0.2rem; }
.lib-item-attach-meta {
  font-size: 0.85em;
  color: var(--fg-dim);
}
.lib-item-attach-kind {
  display: inline-block;
  min-width: 2.2rem;
  color: var(--lib-faint);
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}
.lib-item-attach-file-form,
.lib-item-attach-link-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.45rem;
}
.lib-item-attach-file-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  min-width: 0;
  flex: 0 1 auto;
}
.lib-item-attach-file-label {
  position: relative;
  cursor: pointer;
  flex: 0 0 auto;
}
.lib-item-attach-file-label input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.lib-item-attach-file-label-text {
  white-space: nowrap;
}
.lib-item-attach-file-pick {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--lib-rubric);
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-item-attach-file-pick:empty { display: none; }
.lib-item-attach-comment,
.lib-item-attach-url,
.lib-item-attach-label {
  flex: 1 1 8rem;
  min-width: 0;
  padding: 0.25rem 0.1rem;
  border: 0;
  border-bottom: 1px solid var(--lib-rule);
  background: transparent;
  color: var(--fg);
  font-family: var(--font-monospace);
  font-size: 0.72rem;
  border-radius: 0;
}
.lib-item-attach-comment:focus,
.lib-item-attach-url:focus,
.lib-item-attach-label:focus { outline: none; border-bottom-color: var(--lib-rubric); }
.lib-item-attach-status {
  min-height: 1rem;
  margin-top: 0.35rem;
  color: var(--lib-rubric);
  font-size: 0.68rem;
}
.lib-item-attach-panel .librarium-lite-chip-btn {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
}
[data-theme="light"] .lib-item-attach-panel .librarium-lite-chip-btn:active {
  background: #000;
  border-color: #000;
  color: #fff;
}

/* ── Files browser (/files/:uuid · lib.itmens /files parity) ── */
.lib-files-page {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}
.lib-files-nav {
  font-family: var(--font-monospace);
  font-size: 0.72rem;
  color: var(--fg-dim);
  margin: 0 0 0.85rem;
}
.lib-files-nav a { color: var(--lib-nacht); text-decoration: none; }
.lib-files-nav a:hover { color: var(--lib-rubric); text-decoration: underline; }
.lib-files-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--fg-title);
  margin: 0 0 0.25rem;
}
.lib-files-author {
  font-family: var(--font-monospace);
  font-size: 0.78rem;
  color: var(--fg-dim);
  margin: 0 0 1.1rem;
}
.lib-files-page--all .lib-files-title { margin-bottom: 0.35rem; }
.lib-files-all-meta {
  font-family: var(--font-monospace);
  font-size: 0.72rem;
  color: var(--fg-dim);
  margin: 0 0 0.85rem;
}
.lib-files-section + .lib-files-section { margin-top: 1.35rem; }
.lib-files-section-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--fg-dim);
  margin: 0 0 0.45rem;
  text-transform: uppercase;
}
.lib-files-loading,
.lib-files-error,
.lib-files-empty {
  font-family: var(--font-monospace);
  font-size: 0.72rem;
  color: var(--fg-dim);
  margin: 0;
}
.lib-files-error { color: var(--lib-rubric); }
.lib-files-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--lib-rule);
  background: var(--bg-input);
}
.lib-files-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  line-height: 1.35;
}
.lib-files-table th,
.lib-files-table td {
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--lib-rule);
  vertical-align: top;
  text-align: left;
}
.lib-files-table th {
  color: var(--lib-faint);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.62rem;
  background: var(--bg-high);
}
.lib-files-table tbody tr:last-child td { border-bottom: none; }
.lib-files-col-name { min-width: 10rem; max-width: 18rem; }
.lib-files-col-item { min-width: 11rem; max-width: 20rem; }
.lib-files-item-link {
  display: block;
  color: var(--lib-nacht);
  text-decoration: underline;
  line-height: 1.35;
}
.lib-files-item-link:hover { color: var(--lib-rubric); }
.lib-files-item-people {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.92em;
  color: var(--fg-dim);
  line-height: 1.3;
}
.lib-files-item-files-link {
  margin-left: 0.35rem;
  font-size: 0.92em;
  color: var(--lib-nacht);
  text-decoration: underline;
}
.lib-files-item-files-link:hover { color: var(--lib-rubric); }
.lib-files-table--all .lib-files-col-dl { white-space: nowrap; }
.lib-files-col-ext,
.lib-files-col-size,
.lib-files-col-hash,
.lib-files-col-user { white-space: nowrap; }
.lib-files-col-comment { min-width: 8rem; max-width: 20rem; word-break: break-word; }
.lib-files-col-url { min-width: 10rem; word-break: break-all; }
.lib-files-col-url a,
.lib-files-name-link {
  color: var(--lib-nacht);
  text-decoration: underline;
}
.lib-files-col-url a:hover,
.lib-files-name-link:hover { color: var(--lib-rubric); }
.lib-files-name-sub {
  display: block;
  margin-top: 0.15rem;
  color: var(--lib-faint);
  font-size: 0.62rem;
  word-break: break-all;
}
.lib-files-muted { color: var(--lib-faint); }
.lib-files-dl-btn {
  font-size: 0.62rem !important;
  padding: 1px 6px !important;
}
.lib-item-attach-files-link {
  margin-left: auto;
  font-family: var(--font-monospace);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--lib-nacht);
  text-decoration: none;
}
.lib-item-attach-files-link:hover { color: var(--lib-rubric); text-decoration: underline; }
.library-qa-btn.library-files-btn {
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  min-width: 2.2rem;
}
.lib-files-inventory--compact .lib-files-section-title { font-size: 0.68rem; margin-bottom: 0.3rem; }
.lib-files-inventory--compact .lib-files-table { font-size: 0.62rem; }
.lib-files-inventory--compact .lib-files-col-comment,
.lib-files-inventory--compact .lib-files-col-when,
.lib-files-inventory--compact .lib-files-col-user { display: none; }
.lib-files-inventory--compact .lib-files-table--links .lib-files-col-comment { display: none; }

/* ── The shelf: VOLO · LEGO · LEGI ── */
.lib-shelf-btns {
  display: flex;
  gap: 4px;
  padding: 0 12px 10px;
}
.lib-shelf-btns button {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 5px 0;
  cursor: pointer;
  color: var(--lib-faint);
  background: transparent;
  border: none;
  border-radius: 0;
  transition: background-color 70ms, color 70ms;
}
.lib-shelf-btns button:hover:not(.lib-shelf-active),
.lib-shelf-btns button:focus-visible:not(.lib-shelf-active) {
  color: var(--ghost-fill-fg);
  background: var(--ghost-fill-bg);
}
.lib-shelf-btns button.lib-shelf-active::before { content: "\2720\00a0"; }
.lib-shelf-btns button[data-shelf="complete"].lib-shelf-active {
  color: #2a0c08;
  background: #e87860;
}
.lib-shelf-btns button[data-shelf="progress"].lib-shelf-active {
  color: #1a1408;
  background: var(--star-gold);
}
.lib-shelf-btns button[data-shelf="wishlist"].lib-shelf-active {
  color: #0a1820;
  background: #b8e8ff;
}
[data-theme="light"] .lib-shelf-btns button[data-shelf="complete"].lib-shelf-active {
  color: #fff;
  background: var(--lib-rubric);
}
[data-theme="light"] .lib-shelf-btns button[data-shelf="wishlist"].lib-shelf-active {
  color: #fff;
  background: var(--lib-nacht);
}
.lib-shelf-pending button { opacity: 0.45; pointer-events: none; }

/* ── Annotation ── */
.lib-comment-form {
  padding: 0 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.lib-comment-stars {
  display: inline-block; position: relative; white-space: nowrap;
  font-family: var(--font-monospace); letter-spacing: 0;
  font-size: 0.9em; flex-shrink: 0; color: var(--fg-second-dim);
}
.lib-comment-stars::before { content: "★★★★★"; }
.lib-comment-stars > span,
.timeline-stars > span {
  position: absolute; top: 0; left: 0; overflow: hidden; white-space: nowrap;
  color: var(--star-gold); pointer-events: none;
}
.lib-comment-stars > span::before { content: "★★★★★"; }
.lib-follow-ratings {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin: 0.1em 0 0.2em;
  pointer-events: none;
}
.library-card-cover .lib-follow-ratings {
  position: static;
  width: 100%;
  margin: 4px 0 0;
  gap: 3px;
  align-items: flex-start;
}
.lib-follow-rating-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px 1px 2px;
  font-family: var(--font-monospace);
  font-size: 0.68em;
  line-height: 1.35;
  background: hsl(var(--follow-hue, 200) 38% 22%) !important;
  color: #fff !important;
  border: none;
  max-width: 100%;
  pointer-events: auto;
  vertical-align: bottom;
}
.library-card-cover-frame .lib-follow-rating-chip,
.library-card-cover .lib-follow-rating-chip,
.library-page--pane .lib-follow-rating-chip {
  font-size: 0.72rem;
}
.lib-follow-rating-chip--link {
  cursor: pointer;
  transition: filter 70ms, transform 70ms;
}
.lib-follow-rating-chip--link:hover {
  filter: brightness(1.15);
}
.lib-follow-rating-chip--link:focus-visible {
  outline: 1px solid var(--lib-rubric);
  outline-offset: 2px;
}
[data-theme="light"] .lib-follow-rating-chip {
  background: hsl(var(--follow-hue, 200) 42% 38%) !important;
  color: #fff !important;
}
.lib-follow-rating-av {
  width: 14px;
  height: 14px;
  max-width: 14px;
  max-height: 14px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}
.library-card-cover .lib-follow-rating-av {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  border-radius: 50% !important;
}
.lib-follow-rating-av--ph {
  background: hsl(var(--follow-hue, 200) 30% 45%);
  border-radius: 50%;
}
.lib-follow-rating-num {
  font-family: var(--font-heading);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.02em;
  min-width: 0.85em;
  text-align: center;
}
.lib-comment-edit,
.lib-comment-delete { cursor: pointer; color: var(--fg-dim); font-family: var(--font-monospace); flex-shrink: 0; font-size: 0.82em; opacity: 0; transition: opacity 0.1s; }
.library-card-wrap:hover .lib-comment-edit,
.library-card-wrap:hover .lib-comment-delete { opacity: 0.5; }
.lib-comment-edit:hover { opacity: 1 !important; color: var(--lib-rubric); }
.lib-comment-delete:hover { opacity: 1 !important; color: var(--danger-fg); }
.lib-comment-preview.lib-editing .lib-comment-edit,
.lib-comment-preview.lib-editing .lib-comment-delete { display: none; }
.lib-edit-ok, .lib-edit-cancel {
  cursor: pointer; font-family: var(--font-monospace); font-size: 0.85em; line-height: 1;
  padding: 0 4px; background: none; border: none; flex-shrink: 0;
}
.lib-edit-ok { color: var(--lib-rubric); }
.lib-edit-cancel { color: var(--fg-dim); }
.lib-edit-ok:hover { color: var(--danger-fg); }
.lib-edit-cancel:hover { color: var(--fg); }
.lib-comment-text[contenteditable] { outline: none; border-bottom: 1px dashed color-mix(in srgb, var(--tl-comment-gold) 50%, transparent); min-width: 6em; }
.lib-comment-text[contenteditable]:empty::before,
.timeline-comment-text[contenteditable]:empty::before {
  content: attr(data-ph);
  color: var(--fg-dim);
  font-style: italic;
  opacity: 1;
}

/* ── Marginalia ── */
.lib-comment-preview {
  font-family: var(--font-prose);
  font-size: 0.82em;
  line-height: 1.4;
  margin: 0.2em 0 0.1em;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--tl-comment-gold);
  padding: 0 14px 10px;
}
.lib-comment-text {
  flex: 1;
  word-break: break-word;
}
.lib-comment-text::before,
.timeline-comment-text::before {
  content: "¶";
  padding-right: 0.45em;
  color: var(--tl-comment-gold);
  opacity: 0.85;
}
.lib-tag-chips { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.lib-tag-chips .tl-tag {
  font-size: 0.72em;
  font-weight: 600;
  line-height: 1.45;
  padding: 0 7px;
  white-space: nowrap;
}
.lib-comment-date {
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--lib-gold);
}

/* Citations → paper card: distinct "文献卡" identity in the bibliotheca palette */
.library-page .library-card-wrap[data-grp="papers"] { display: flex; flex-direction: column; min-width: 0; }
/* Inner card carries no border - flat wrap uses background only. */
.library-page [data-grp="papers"] .link-card { position: relative; background: var(--lib-card); border: none; flex: 1; display: flex; flex-direction: column; margin: 0; max-width: none; min-width: 0; }
.library-page [data-grp="papers"] .link-card .link-card-inner { padding: 1rem 1.1rem 0.8rem; flex: 1; min-width: 0; background: var(--lib-card); font-family: var(--font-ui); }
.library-page [data-grp="papers"] .link-card .link-card-footer { background: var(--lib-card); border-top-color: var(--lib-rule); padding: 0.55rem 1.1rem 0.7rem; flex-wrap: nowrap; }
/* id truncates so the badge + action stay aligned on one line, never pushed down */
.library-page [data-grp="papers"] .link-card .link-card-arxiv-meta,
.library-page [data-grp="papers"] .link-card .link-card-cite-meta { min-width: 0; flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; }
/* Title in the house goth, like book cards */
.library-page [data-grp="papers"] .link-card .link-card-title {
  font-family: var(--font-heading); font-size: 0.95rem; font-weight: 600; color: var(--lib-ink); margin-bottom: 0.35rem;
}
.library-page [data-grp="papers"] .link-card .library-field { display: inline-flex; gap: 4px; margin-right: 8px; font-size: 0.72em; }
.library-page [data-grp="papers"] .link-card .library-field-name { color: var(--fg-dim); }
.library-page [data-grp="papers"] .link-card .library-field-value { color: var(--fg); }
.library-page [data-grp="papers"] .link-card .link-card-desc { margin-top: 6px; font-style: italic; color: var(--lib-nacht); }
/* Shadow-lib + attach: own row above footer actions, not over the badge row */
.library-page [data-grp="papers"] .link-card .lib-shadow-lib-btns {
  position: static;
  bottom: auto;
  right: auto;
  align-self: flex-end;
  flex-shrink: 0;
  padding: 0.15rem 1.1rem 0.35rem;
  margin: 0;
}
.library-page [data-grp="papers"] .link-card-footer a.link-card-arxiv-badge,
.library-page [data-grp="papers"] .link-card-footer a.link-card-doi-badge,
.library-page [data-grp="papers"] .link-card-footer a.link-card-jstor-badge,
.library-page [data-grp="papers"] .link-card-footer a.link-card-aeon-badge,
.library-page [data-grp="papers"] .link-card-footer a.link-card-biorxiv-badge,
.library-page [data-grp="papers"] .link-card-footer a.link-card-site-badge,
.library-page [data-grp="papers"] .link-card-footer a.link-card-pdf-badge,
.library-page [data-grp="papers"] .link-card-footer a.link-card-html-badge,
.library-page [data-grp="papers"] .link-card-footer a.lib-file-dl-badge,
.library-page [data-grp="papers"] .link-card-footer a.link-card-itmens-logo-link {
  text-decoration: none;
}
.library-page [data-grp="papers"] .link-card-footer a.link-card-itmens-logo-link,
.library-page [data-grp="papers"] .link-card-footer .link-card-itmens-logo-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: color-mix(in srgb, var(--fg) 6%, var(--lib-card));
  box-sizing: border-box;
  flex-shrink: 0;
}
.library-page [data-grp="papers"] .link-card-itmens-logo {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}
.library-page [data-grp="papers"] .lib-shelf-btns { margin-top: auto; }

@media (max-width: 900px) {
  .library-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .library-page, .collections-page { padding: 1.75rem 0 2.5rem; }
  main:has(.collections-page) { padding: 0 1rem 3rem; }
  .library-results { grid-template-columns: 1fr; }
  .library-page h1, .collections-page:not(.collections-page--pane) h1 { font-size: 1.6rem; }
}


/* ── Stained glass - the Bleiband (lead-light spectrum) ── */
.library-page {
  --glass-books:     hsl(221, 70%, 48%);
  --glass-podcasts:  hsl(40,  80%, 46%);
  --glass-music:     hsl(275, 50%, 52%);
  --glass-film:      hsl(355, 72%, 46%);
  --glass-tv:        hsl(340, 65%, 48%);
  --glass-citations: hsl(152, 60%, 38%);
  --glass-games:     hsl(0, 0%, 58%);
}
[data-theme="light"] .library-page {
  --glass-books:     hsl(221, 70%, 33%);
  --glass-podcasts:  hsl(38,  85%, 32%);
  --glass-music:     hsl(275, 50%, 34%);
  --glass-film:      hsl(355, 72%, 31%);
  --glass-tv:        hsl(340, 65%, 34%);
  --glass-citations: hsl(152, 62%, 25%);
  --glass-games:     hsl(0, 0%, 42%);
}

/* every category-bearing element receives its pane color as --g */
.library-page [data-grp="books"],     .library-page [data-cls="books"]     { --g: var(--glass-books); }
.library-page [data-grp="podcasts"],  .library-page [data-cls="podcasts"]  { --g: var(--glass-podcasts); }
.library-page [data-grp="music"],     .library-page [data-cls="music"]     { --g: var(--glass-music); }
.library-page [data-grp="film"],      .library-page [data-cls="film"]      { --g: var(--glass-film); }
.library-page [data-grp="tv"],        .library-page [data-cls="tv"]        { --g: var(--glass-tv); }
.library-page [data-grp="papers"], .library-page [data-cls="papers"] { --g: var(--glass-citations); }
.library-page [data-grp="games"],     .library-page [data-cls="games"]     { --g: var(--glass-games); }

/* the strip: segments proportional to the current query's distribution */
.lib-bleiband {
  display: flex;
  height: 4px;
  width: min(34rem, 92%);
  margin: 0.9rem auto 0;
  gap: 1px;
}
.lib-bleiband span {
  background: var(--g, var(--lib-rule));
  flex-basis: 0;
  min-width: 2px;
  cursor: pointer;
}
.lib-bleiband span:hover { filter: brightness(1.3); }

/* one pane chosen: the rest of the window goes dark */
.library-page.lib-filtered .lib-bleiband span { opacity: 0.22; }
.library-page.lib-filtered .lib-bleiband span.on { opacity: 1; }

/* ── quick-nav (header, mods) ── */
/* display rules below would otherwise override the hidden attribute for non-mods */
.lib-quicknav[hidden] { display: none !important; }
.lib-quicknav {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 3px;
}
.lib-quicknav button {
  font-family: var(--font-monospace);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  cursor: pointer;
  text-align: center;
  color: var(--fg-second-dim);
  background: transparent;
  border: none;
  border-radius: 0;
  transition: background-color 70ms, color 70ms;
}
.lib-quicknav button:hover,
.lib-quicknav button:focus-visible {
  color: var(--ghost-fill-fg);
  background: var(--ghost-fill-bg);
}
.lib-quicknav button[data-on="1"] { color: #fff; background: #cc2222; border: none; position: relative; overflow: hidden; }
.lib-quicknav button[data-on="1"]::after {
  content: "\2720";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4em;
  color: rgba(255,255,255,0.12);
  pointer-events: none;
  line-height: 1;
}
[data-theme="light"] .lib-quicknav button[data-on="1"] { color: #fff; background: var(--lib-rubric-l); border: none; }

/* ── Timeline ─────────────────────────────────────────── */
.timeline-page {
  max-width: 52rem; margin: 0 auto; padding: 1rem 0;
}
.timeline-page--compact {
  padding-top: 0.35rem;
}
.timeline-page--compact .tl-controls {
  margin-top: 0;
}

/* merged timeline + library */
.tl-merge-page {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: calc(100vh - 7rem);
}
.tl-merge-library {
  flex: 0 0 40%;
  width: 40%;
  border-right: 1px solid var(--lib-rule);
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100vh - var(--librarium-lite-nav-h, 3.15rem));
  position: sticky;
  top: 0;
  align-self: flex-start;
  min-width: 0;
  /* anchor thread overlay without hiding library (instant Esc restore) */
  isolation: isolate;
}
.tl-merge-page:has(.timeline-page--compact) .tl-merge-library {
  border-right: none;
  scrollbar-width: none;
}
.tl-merge-page:has(.timeline-page--compact) .tl-merge-library::-webkit-scrollbar {
  display: none;
}
.tl-merge-timeline,
.tl-merge-sidebar {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  max-height: calc(100vh - var(--librarium-lite-nav-h, 3.15rem));
  background: var(--bg);
  --lib-nacht: var(--lib-nacht-d);
  --lib-rubric: var(--lib-rubric-d);
  --lib-ink: var(--fg);
  --lib-faint: var(--fg-second-dim);
  --lib-rule: var(--border-red-dark);
  --lib-card: var(--bg-high);
}
[data-theme="light"] .tl-merge-sidebar {
  --lib-nacht: var(--lib-nacht-l);
  --lib-rubric: var(--lib-rubric-l);
  --lib-gold: var(--lib-gold-l);
}
.library-page--pane {
  max-width: none;
  margin: 0;
  padding: 0.65rem 0.75rem 1rem;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}
.library-page--pane::after { display: none; }
.library-page--pane .library-results {
  grid-template-columns: 1fr;
  gap: 8px;
  overflow: visible;
  padding-top: 1.05rem;
}
.library-page--pane .library-status {
  top: 0.08rem;
  left: 0;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}
.library-page--pane .library-card {
  height: auto;
  max-height: 240px;
  padding: 0.65rem 0.75rem;
  gap: 0.65rem;
}
.library-page--pane .library-card-wrap--attach-open {
  overflow: visible;
  margin-bottom: 0.35rem;
}
.library-page--pane .lib-item-attach-panel {
  position: static;
  margin-top: 0.35rem;
}
.library-page--pane .library-card-cover { width: 72px; }
.library-page--pane .library-card-cover-frame > img { width: 72px; }
.library-page--pane .library-epigraph { font-size: 0.68rem; margin: 0 0 0.45rem; }
.timeline-page--merged {
  max-width: none;
  margin: 0;
  padding: 0.65rem 1rem 1rem;
}
.timeline-page--merged .tl-controls {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}
.tl-controls--merge {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.tl-controls--merge .tl-controls-filters {
  flex: none;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.tl-controls--merge .tl-controls-sync {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.35rem;
  align-self: stretch;
  width: 100%;
  margin-left: 0;
  padding-top: 0;
  font-family: var(--font-monospace);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--lib-nacht);
}
.tl-controls--merge .tl-controls-sync-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  flex: none;
  min-width: 0;
}
.tl-controls--merge .timeline-updated {
  opacity: 0.75;
  max-width: none;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  text-align: center;
}
.tl-controls--merge .timeline-updated-btn {
  margin-left: 0;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95em;
  line-height: 1;
  color: var(--lib-nacht);
  opacity: 0.75;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
@media (max-width: 960px) {
  .tl-merge-page { flex-direction: column; min-height: 0; }
  .tl-merge-library,
  .tl-merge-timeline,
  .tl-merge-sidebar {
    flex: none;
    width: 100%;
    max-width: 100%;
    max-height: none;
    position: static;
  }
  .tl-merge-library {
    border-right: none;
    border-bottom: 1px solid var(--lib-rule);
    max-height: 45vh;
    position: relative;
  }
  .tl-merge-page:has(.timeline-page--compact) .tl-merge-library {
    border-bottom: none;
  }
  /* /timeline merge: mobile shows feed only (no library pane) */
  .tl-merge-page:has(.tl-merge-timeline) .tl-merge-library {
    display: none;
  }
  .tl-merge-page:has(.tl-merge-timeline) {
    min-height: calc(100vh - var(--librarium-lite-nav-h, 3.15rem));
  }
  .tl-merge-page:has(.tl-merge-timeline) .tl-merge-timeline {
    flex: 1 1 auto;
    width: 100%;
    min-height: calc(100vh - var(--librarium-lite-nav-h, 3.15rem));
    max-height: calc(100vh - var(--librarium-lite-nav-h, 3.15rem));
  }
  body:has(#timeline-page) .librarium-lite-nav:has(.tl-nav-top-actions:not([hidden])) .librarium-lite-brand-wrap {
    padding-right: 12.5rem;
  }
  body:has(#timeline-page) .tl-nav-top-actions {
    position: absolute;
    top: 0.45rem;
    right: 0.65rem;
    z-index: 22;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    max-width: calc(100vw - 7rem);
    margin: 0;
  }
  body:has(#timeline-page) .tl-nav-top-actions .lib-quicknav {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 4px;
    flex: 0 1 auto;
    min-width: 0;
  }
  body:has(#timeline-page) .tl-nav-top-actions .tl-post-launcher {
    flex-shrink: 0;
  }
}
.timeline-page h1,
[data-theme="light"] .timeline-page h1 {
  font-family: var(--font-inscription);
  font-size: 2.3rem;
  font-weight: 400;
  text-align: center;
  letter-spacing: 0.04em;
  color: var(--fg);
  margin: 1.4rem 0 0;
}
.timeline-page h1::before,
.timeline-page h1::after { content: "\2720"; color: var(--lib-rubric); font-size: 0.5em; vertical-align: 0.3em; margin: 0 1.2em; }
.timeline-epigraph { font-family: var(--font-monospace); font-size: 0.7rem; letter-spacing: 0.06em; text-align: center; color: var(--lib-nacht); margin: 0.7rem 0 1.6rem; }
.timeline-updated { opacity: 0.7; }
@keyframes tl-updated-btn-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.timeline-updated-btn {
  margin-left: 0.5em;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95em;
  line-height: 1;
  vertical-align: -0.05em;
  color: var(--lib-nacht);
  opacity: 0.7;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.timeline-updated-btn:hover { opacity: 1; transform: rotate(45deg); }
.timeline-updated-btn:active { transform: rotate(90deg); }
.timeline-updated-btn--busy {
  animation: tl-updated-btn-spin 0.6s linear infinite;
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.15s ease;
  transform: none;
}
/* stats bar */
#timeline-stats { display: flex; flex-direction: column; align-items: center; }
.tl-stats-bar { display: flex; width: 100%; max-width: 28rem; height: 2px; margin: 0.6rem auto 0.3rem; overflow: hidden; background: var(--bg-high); }
.tl-stats-seg { height: 100%; transition: width 0.6s ease; }
.tl-seg-complete { background: var(--lib-rubric); }
.tl-seg-progress { background: var(--lib-gold); }
.tl-seg-wishlist { background: var(--lib-nacht); opacity: 0.45; }
.tl-seg-dropped { background: var(--fg-dim); opacity: 0.35; }
.tl-stats-labels { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6em; font-family: var(--font-monospace); font-size: 0.65rem; letter-spacing: 0.04em; margin-bottom: 1rem; }
.tl-stats-label { font: inherit; cursor: pointer; background: var(--bg-high); border: none; padding: 2px 8px; }
.tl-stats-label b { font-weight: 700; }
.tl-stats-label .tl-label-total { opacity: 0.5; }
.tl-stats-label.tl-seg-complete { color: #ff9870; }
.tl-stats-label.tl-seg-progress { color: #f0d078; }
.tl-stats-label.tl-seg-wishlist { color: #c8ecff; }
.tl-stats-label.tl-seg-dropped { color: var(--fg-dim); }
.tl-stats-label.tl-label-active.tl-seg-complete { color: #2a0c08; background: #e87860; }
.tl-stats-label.tl-label-active.tl-seg-progress { color: #1a1408; background: var(--star-gold); }
.tl-stats-label.tl-label-active.tl-seg-wishlist { color: #0a1820; background: #b8e8ff; }
.tl-stats-label.tl-label-active.tl-seg-dropped { color: #fff; background: var(--fg-dim); }
[data-theme="light"] .tl-stats-label.tl-seg-complete { color: var(--lib-rubric); }
[data-theme="light"] .tl-stats-label.tl-seg-progress { color: var(--lib-gold); }
[data-theme="light"] .tl-stats-label.tl-seg-wishlist { color: var(--lib-nacht); }
[data-theme="light"] .tl-stats-label.tl-label-active.tl-seg-complete { color: #fff; background: var(--lib-rubric); }
[data-theme="light"] .tl-stats-label.tl-label-active.tl-seg-wishlist { color: #fff; background: var(--lib-nacht); }
.tl-stats-label.tl-label-active .tl-label-total { opacity: 0.72; color: inherit; }
.tl-stats-label.tl-label-active::before { content: "\2720\00a0"; }

/* post launcher + edge-docked compose panel */
.tl-feed-head {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: 0 0 0.1rem;
  padding: 0;
}
.tl-feed-head + #timeline-list > .timeline-rubric:first-child {
  margin-top: 0.25rem;
}
.tl-feed-head--merge {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 0.15rem 0 0.35rem;
}
.tl-feed-head--merge #tl-search[hidden] { display: none; }
.tl-feed-head--merge .lib-search-wrap:has(#tl-search:not([hidden])) {
  display: block;
  width: min(32rem, 100%);
  max-width: min(32rem, 100%);
  min-width: 0;
  margin: 0 auto;
}
.tl-feed-head--merge .lib-search-wrap:has(#tl-search[hidden]) { display: none; }
.tl-feed-head--merge .tl-post-launcher {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}
.timeline-page--merged .tl-feed-head {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}
.tl-post-launcher {
  display: block;
}
button.librarium-lite-chip-btn,
label.librarium-lite-chip-btn,
a.librarium-lite-chip-btn,
.tl-compose-file-label .librarium-lite-chip-btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-monospace);
  font-size: 0.8em;
  letter-spacing: 0.02em;
  line-height: 1.35;
  padding: 2px 8px;
  margin: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: var(--chip-flat-bg);
  border: 1px solid var(--chip-flat-border);
  border-radius: 0;
  color: var(--chip-flat-fg);
  transition: background-color 70ms, border-color 70ms, color 70ms;
  vertical-align: middle;
}
button.librarium-lite-chip-btn:hover,
label.librarium-lite-chip-btn:hover,
a.librarium-lite-chip-btn:hover,
.tl-compose-file-label .librarium-lite-chip-btn:hover {
  background: var(--chip-hover-bg);
  border-color: var(--chip-hover-bg);
  color: var(--chip-flat-fg);
}
button.librarium-lite-chip-btn:active:not(:disabled):not(.librarium-lite-chip-btn--on),
label.librarium-lite-chip-btn:active:not(:disabled):not(.librarium-lite-chip-btn--on),
a.librarium-lite-chip-btn:active:not(:disabled):not(.librarium-lite-chip-btn--on),
.tl-compose-file-label .librarium-lite-chip-btn:active:not(:disabled):not(.librarium-lite-chip-btn--on) {
  background: var(--chip-on-bg);
  border-color: var(--chip-on-bg);
  color: var(--chip-on-fg);
}
button.librarium-lite-chip-btn.librarium-lite-chip-btn--on,
label.librarium-lite-chip-btn.librarium-lite-chip-btn--on,
a.librarium-lite-chip-btn.librarium-lite-chip-btn--on {
  background: var(--chip-on-bg);
  border-color: var(--chip-on-bg);
  color: var(--chip-on-fg);
}
button.librarium-lite-chip-btn:disabled {
  opacity: 0.45;
  cursor: default;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
}

button.librarium-lite-chip-btn.librarium-lite-chip-btn--danger:hover:not(:disabled),
button.librarium-lite-chip-btn.librarium-lite-chip-btn--danger.librarium-lite-chip-btn--on {
  background: var(--lib-rubric);
  border-color: var(--lib-rubric);
  color: #fff;
}

/* Self-contained tokens - panel may live on body (merge-thread reply), not under .timeline-page */
.tl-compose-panel,
.thread-reply-panel {
  --lib-card: var(--bg-high);
  --lib-ink: var(--fg);
  --lib-faint: var(--fg-dim);
  --lib-rule: var(--border-red-dark);
  --lib-nacht: var(--lib-nacht-d);
  --lib-rubric: var(--lib-rubric-d);
  --lib-gold: var(--lib-gold-d);
  position: fixed;
  top: 0;
  right: 0;
  z-index: 120;
  width: min(20rem, 92vw);
  height: 100dvh;
  overflow: auto;
  border-left: 2px solid #fff;
  background-color: var(--bg-high);
  color: var(--lib-ink);
  box-sizing: border-box;
}
.thread-reply-panel { width: min(22rem, 92vw); }
[data-theme="light"] .tl-compose-panel,
[data-theme="light"] .thread-reply-panel {
  --lib-card: var(--bg);
  --lib-ink: var(--fg);
  --lib-faint: var(--fg-dim);
  --lib-rule: var(--border-red-dark);
  --lib-nacht: var(--lib-nacht-l);
  --lib-rubric: var(--lib-rubric-l);
  --lib-gold: var(--lib-gold-l);
  border-left-color: var(--fg);
  background-color: var(--bg);
  color: var(--lib-ink);
}
.tl-compose-panel[hidden],
.thread-reply-panel[hidden] { display: none; }

.tl-compose-inner {
  padding: 1rem 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 100%;
  box-sizing: border-box;
  background-color: inherit;
}
.tl-compose-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--lib-rule);
}
.tl-compose-title {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-transform: none;
  color: var(--lib-ink);
}
.tl-compose-close {
  font-family: var(--font-monospace);
  font-size: 0.9em;
  line-height: 1;
  border: none;
  background: transparent;
  color: var(--fg-dim);
  cursor: pointer;
  padding: 0 0.15em;
}
.tl-compose-close:hover { color: var(--lib-rubric); }

.tl-compose-subject,
.tl-compose-panel textarea,
.tl-compose-alt,
.collections-page textarea.tl-compose-subject {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid var(--lib-rule);
  border-radius: 0;
  background: transparent;
  color: var(--lib-ink);
}
.tl-compose-subject:focus,
.tl-compose-panel textarea:focus,
.tl-compose-alt:focus,
.collections-page textarea.tl-compose-subject:focus {
  outline: none;
  border-bottom-color: var(--lib-rubric);
}
.tl-compose-subject::placeholder,
.tl-compose-panel textarea::placeholder,
.tl-compose-alt::placeholder,
.collections-page textarea.tl-compose-subject::placeholder {
  color: var(--lib-faint);
}
select.tl-compose-subject,
.collections-page select.tl-compose-subject,
.coll-manage-cover-font {
  background-color: var(--bg-input);
  color: var(--lib-ink);
  padding: 4px 6px;
  border: 1px solid var(--lib-rule);
  border-bottom: 1px solid var(--lib-rule);
  border-radius: 0;
  cursor: pointer;
}
select.tl-compose-subject:focus,
.collections-page select.tl-compose-subject:focus,
.coll-manage-cover-font:focus {
  outline: none;
  border-color: var(--lib-rubric);
  border-bottom-color: var(--lib-rubric);
}
[data-theme="dark"] select option {
  background-color: var(--bg-high);
  color: var(--fg);
}
.tl-compose-panel textarea {
  resize: vertical;
  min-height: 9rem;
  line-height: 1.45;
  padding: 6px 0;
  white-space: pre-wrap;
}

.tl-compose-vis {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tl-compose-vis label {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  line-height: 1.35;
  padding: 2px 8px;
  margin: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: var(--chip-flat-bg);
  border: 1px solid var(--chip-flat-border);
  border-radius: 0;
  color: var(--chip-flat-fg);
  transition: background-color 70ms, border-color 70ms, color 70ms;
}
.tl-compose-vis label:hover:not(:has(input:checked)) {
  background: var(--chip-hover-bg);
  border-color: var(--chip-hover-bg);
  color: var(--chip-flat-fg);
}
.tl-compose-vis label:active:not(:has(input:checked)) {
  background: var(--chip-on-bg);
  border-color: var(--chip-on-bg);
  color: var(--chip-on-fg);
}
.tl-compose-vis label:has(input:checked) {
  background: var(--chip-on-bg);
  border-color: var(--chip-on-bg);
  color: var(--chip-on-fg);
}
.tl-compose-vis input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.tl-compose-images { display: flex; flex-direction: column; gap: 0.35rem; }
.tl-compose-add-img {
  align-self: flex-start;
}
.tl-compose-image-row {
  display: flex;
  align-items: center;
  gap: 0.35em;
  font-family: var(--font-monospace);
  font-size: 0.68rem;
}
.tl-compose-file-label input[type="file"] { display: none; }
.tl-compose-file-label span {
  cursor: pointer;
}
.tl-compose-filename {
  flex: 1;
  min-width: 0;
  color: var(--lib-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-compose-alt { flex: 1.2; min-width: 0; font-size: 0.68rem; padding: 2px 0; }
.tl-compose-rm-img {
  font-family: var(--font-monospace);
  border: none;
  background: transparent;
  color: var(--fg-dim);
  cursor: pointer;
  padding: 0 0.25em;
  font-size: 0.9em;
}
.tl-compose-rm-img:hover { color: var(--lib-rubric); }

.tl-compose-actions {
  display: flex;
  align-items: center;
  gap: 0.65em;
  padding-top: 0.35rem;
  border-top: 1px solid var(--lib-rule);
}
.tl-compose-status {
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  color: var(--lib-faint);
}
.tl-compose-status:empty { display: none; }
.tl-compose-status.is-error { color: var(--lib-rubric); }

.mention-menu {
  position: fixed;
  z-index: 10050;
  min-width: 11rem;
  max-width: 22rem;
  max-height: 14rem;
  overflow-y: auto;
  background: var(--lib-card);
  border: 1px solid var(--lib-rule);
}
.mention-menu-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.35rem 0.55rem;
  border: none;
  background: transparent;
  color: var(--lib-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mention-menu-item:hover,
.mention-menu-item.is-active {
  background: var(--lib-rule);
}
.mention-menu-icon {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 0;
  overflow: hidden;
  background: var(--lib-rule);
}
.mention-menu-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mention-menu-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.mention-menu-slug {
  font-family: var(--font-monospace);
  font-size: 0.72rem;
  color: var(--lib-ink);
}
.mention-menu-title {
  font-size: 0.68rem;
  color: var(--lib-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-entry--post .timeline-post-body { flex: 1; min-width: 0; line-height: 1.45; }
.timeline-post-body p { margin: 0 0 0.35em; }
.timeline-post-body p:last-child { margin-bottom: 0; }
.timeline-post-body a { color: var(--lib-rubric); text-decoration: none; }
.timeline-post-body a:hover { text-decoration: underline; }
.timeline-post-body .mention, .timeline-post-body .h-card { font-weight: 600; }
.timeline-post-subject {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.92rem;
  margin: 0 0 0.25em;
}
.timeline-post-copy { flex: 1; min-width: 0; }
.timeline-comment--post { align-items: flex-start; }
.timeline-post-subject-edit[contenteditable] {
  display: block;
  outline: none;
  border-bottom: 1px dashed color-mix(in srgb, var(--lib-rubric) 35%, transparent);
  min-width: 8em;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.92rem;
  margin: 0 0 0.25em;
}
.timeline-post-subject-edit[contenteditable]:empty::before {
  content: attr(data-ph);
  color: var(--fg-dim);
  font-style: italic;
  font-weight: 400;
}
.timeline-post-media {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em;
  margin-top: 0.45em;
}
.timeline-post-media img.img-embed {
  max-width: 100%;
  max-height: 220px;
  border: 1px solid var(--lib-rule);
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
.timeline-post-media img.img-embed:hover { opacity: 0.82; }

.timeline-post-collapse-toggle {
  cursor: pointer;
  display: inline-block;
  position: relative;
  z-index: 2;
  font-family: var(--font-monospace);
  font-size: 0.72em;
  letter-spacing: 0.04em;
  color: var(--fg-dim);
  border: none;
  padding: 0;
  margin-left: 0.35em;
  background: none;
  line-height: 1.45;
  vertical-align: baseline;
}
.timeline-post-collapse-toggle::before { content: "+ expand"; color: var(--lib-rubric); }
.timeline-post-collapse-toggle[aria-expanded="true"]::before { content: "− collapse"; }
.timeline-post-collapse-toggle[aria-expanded="true"] { color: var(--fg); }
.timeline-entry--post-auto-collapsed:not(.timeline-entry--post-expanded) .timeline-post-body,
.timeline-entry--post-auto-collapsed:not(.timeline-entry--post-expanded) .timeline-post-media {
  display: none;
}

/* timeline post image lightbox */
.media-lb {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9990;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.media-lb.media-lb--open { display: flex; }
body.media-lb-open { overflow: hidden; }
.media-lb-img {
  display: block;
  max-width: min(92vw, 1200px);
  max-height: 92vh;
  object-fit: contain;
  border: 2px solid #000;
  background: #fff;
  border-radius: 0;
}
.media-lb-nav,
.media-lb-close {
  position: absolute;
  border: 1px solid var(--lib-rule);
  border-radius: 0;
  background: var(--bg-high);
  color: var(--fg);
  font-family: var(--font-monospace);
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.media-lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 2.4rem;
  height: 2.75rem;
  font-size: 1.75rem;
  z-index: 1;
}
.media-lb-nav:hover,
.media-lb-close:hover {
  background: var(--bg-input);
  color: var(--fg);
}
.media-lb-prev { left: 0.75rem; }
.media-lb-next { right: 0.75rem; }
.media-lb-close {
  top: 0.65rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  font-size: 1.25rem;
  z-index: 2;
}
.media-lb-count {
  position: absolute;
  bottom: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--fg-dim);
  font-family: var(--font-monospace);
  font-size: 0.72rem;
  pointer-events: none;
}
.media-lb-nav[hidden],
.media-lb-close[hidden] { display: none; }
.timeline-shelf-badge--post { color: var(--lib-nacht); }
.timeline-shelf-badge--reply { color: var(--lib-rubric); font-style: italic; }
.timeline-thread-link {
  margin-left: 0.35em;
  font-size: 0.82em;
  color: var(--lib-rubric);
  text-decoration: none;
  opacity: 0.55;
}
.timeline-entry:hover .timeline-thread-link { opacity: 0.85; }
.timeline-thread-link:hover { opacity: 1; text-decoration: underline; }

/* thread page - flat layout aligned with .timeline-page */
.timeline-thread-page { padding-bottom: 2rem; }
.timeline-page--compact.timeline-thread-page { padding-top: 0.35rem; }
.timeline-page--compact.timeline-thread-page > h1 { display: none; }
.timeline-page--compact.timeline-thread-page .timeline-thread-nav {
  text-align: left;
  margin: 0 0 0.5rem;
}
.timeline-thread-nav {
  font-family: var(--font-monospace);
  font-size: 0.72em;
  letter-spacing: 0.04em;
  text-align: center;
  margin: 0 0 0.35rem;
}
.timeline-thread-nav a { color: var(--lib-nacht); text-decoration: none; }
.timeline-thread-nav a:hover { color: var(--lib-rubric); }
.tl-merge-library-nav {
  padding: 0.65rem 0.75rem 0;
  margin: 0;
}
.tl-merge-library-back {
  font: inherit;
  font-family: var(--font-monospace);
  font-size: 0.72em;
  letter-spacing: 0.04em;
  padding: 0;
  border: none;
  background: none;
  color: var(--lib-nacht);
  cursor: pointer;
}
.tl-merge-library-back:hover { color: var(--lib-rubric); }
.tl-merge-library-thread {
  position: absolute;
  inset: 0;
  /* above .library-status (z-index: 5) so catalog counts don't bleed through */
  z-index: 6;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.65rem 0.75rem 1rem;
  background: var(--bg);
  box-sizing: border-box;
}
.tl-merge-library-thread[hidden] { display: none; }
.timeline-thread-page--pane {
  padding: 0;
  padding-bottom: 1rem;
}
.tl-merge-thread-back {
  font: inherit;
  font-family: var(--font-monospace);
  font-size: 0.72em;
  letter-spacing: 0.04em;
  padding: 0;
  border: none;
  background: none;
  color: var(--lib-nacht);
  cursor: pointer;
}
.tl-merge-thread-back:hover { color: var(--lib-rubric); }
.tl-merge-library-thread .timeline-thread-page .timeline-user-group { margin-left: 2rem; }
.tl-merge-library-thread .timeline-thread-branch { --thread-depth-scale: 1rem; }
.tl-merge-library-thread .timeline-post-subject { font-size: 0.92em; }
.tl-merge-library-thread .timeline-post-body { font-size: 0.88em; }
.timeline-thread-page > h1 { margin-bottom: 0.35rem; }
.timeline-thread-page .timeline-epigraph { margin: 0 0 1.2rem; }
.timeline-thread-lib a { color: var(--lib-nacht); text-decoration: none; }
.timeline-thread-lib a:hover { color: var(--lib-rubric); }
.timeline-thread-list { display: flex; flex-direction: column; gap: 0; }
.timeline-thread-branch { padding-left: calc(var(--thread-depth, 0) * 1.35rem); }
.timeline-thread-page .timeline-user-group { margin-left: 2.75rem; }
.timeline-thread-branch .timeline-user-group { margin-left: 2.75rem; }
.timeline-thread-page .timeline-user-group .timeline-thread-post:last-child { border-bottom: 1px solid var(--border-subtle); }
.timeline-thread-reply-to { font-family: var(--font-monospace); font-size: inherit; color: var(--lib-faint); }
.timeline-thread-reply-to a { color: var(--lib-nacht); text-decoration: none; }
.timeline-thread-reply-to a:hover { color: var(--lib-rubric); }
.timeline-entry--reply { margin-left: 1.1rem; border-left: 2px solid color-mix(in srgb, var(--lib-rubric) 35%, transparent); padding-left: 0.55rem; }
.timeline-open-btn {
  display: inline-block; margin-left: 0.4em; text-decoration: none;
  color: var(--fg-dim); font-size: 0.9em; opacity: 0; transition: opacity 120ms, color 120ms;
}
.timeline-entry:hover .timeline-open-btn { opacity: 0.45; }
.timeline-open-btn:hover { opacity: 1 !important; color: var(--lib-rubric); }
.timeline-thread-reply-btn {
  background: none; border: none; padding: 0; margin: 0 0.35em;
  font-family: var(--font-monospace); font-size: inherit; line-height: inherit;
  color: var(--lib-faint); cursor: pointer; opacity: 0;
  transition: opacity 120ms, color 120ms;
}
.timeline-entry:hover .timeline-thread-reply-btn { opacity: 0.55; }
.timeline-thread-reply-btn:hover { opacity: 1 !important; color: var(--lib-rubric); }
.thread-reply-context {
  margin: 0 0 0.45rem; font-family: var(--font-monospace); font-size: 0.72rem;
  color: var(--lib-faint);
}

.timeline-post-body .lib-book-link--has-local { margin-right: 0.05em; }
.lib-local-entry-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -0.1em;
  margin-left: 0.2em;
  padding: 0;
  background: none;
  border: none;
  color: var(--fg-green);
  text-decoration: none;
  line-height: 0;
  opacity: 0.82;
  transition: opacity 70ms ease, color 70ms ease;
}
.lib-local-open-icon {
  display: block;
  width: 0.95em;
  height: 0.95em;
  min-width: 14px;
  min-height: 14px;
}
.timeline-post-body a.lib-local-entry-pin,
.timeline-post-body a.lib-local-entry-pin:visited {
  color: var(--fg-green);
  text-decoration: none;
}
.lib-local-entry-pin:hover,
.lib-local-entry-pin:focus-visible {
  opacity: 1;
  color: color-mix(in srgb, var(--fg-green) 82%, #fff);
  border: none;
  outline: none;
}
.timeline-post-body a.lib-local-entry-pin:hover,
.timeline-post-body a.lib-local-entry-pin:focus-visible { text-decoration: none; }
.timeline-entry .lib-local-entry-pin { opacity: 0.72; }
.timeline-entry:hover .lib-local-entry-pin,
.timeline-thread-post:hover .lib-local-entry-pin { opacity: 1; }

/* month rubric - liturgical divider with fleurons */
.timeline-rubric { display: flex; align-items: center; gap: 0.8em; margin: 1.6rem 0 0.7rem; font-family: "UnifrakturMaguntia", serif; font-size: 1.05rem; color: var(--lib-rubric); letter-spacing: 0.04em; }
.timeline-rubric::before, .timeline-rubric::after { content: ""; flex: 1; border-top: 1px solid var(--border-red-dark); }
.timeline-rubric span::before { content: "☙ "; color: var(--lib-gold); font-size: 0.75em; }
.timeline-rubric span::after { content: " ❧"; color: var(--lib-gold); font-size: 0.75em; }

/* versal - drop-cap on the first entry of each month */
.timeline-rubric + .timeline-entry .timeline-title::first-letter {
  font-family: "UnifrakturMaguntia", serif;
  font-size: 1.7em;
  line-height: 0.85;
  color: var(--lib-rubric);
}

/* entries - neo-style border-left */
.timeline-entry { position: relative; border-left: 2px solid var(--border-red-dark); border-bottom: 1px solid var(--border-subtle); padding: 0.35em 0 0.35em 10px; margin: 0; overflow: hidden; transition: border-color 70ms, background 70ms; }
.timeline-entry--follow { border-left-color: var(--lib-nacht); }
.timeline-entry:hover { background: color-mix(in srgb, var(--bg-high) 50%, transparent); }

/* CiteItem - oversized typographic watermark, clipped inside entry */
.timeline-entry--cite {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.timeline-entry--cite.timeline-entry--user { overflow: hidden; }
.timeline-cite-wm {
  position: absolute;
  top: 0;
  right: 0;
  width: min(62%, 16rem);
  height: 72%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  line-height: 0.82;
}
.timeline-cite-wm::before {
  content: "\00b6";
  display: block;
  flex-shrink: 0;
  font-family: "UnifrakturMaguntia", var(--font-serif-g), serif;
  font-size: clamp(3.2rem, 11vw, 4.8rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  color: var(--fg-dim);
  opacity: 0.055;
  line-height: 0.78;
  user-select: none;
  transform: translate(14%, -10%) rotate(-11deg);
  transform-origin: 100% 0%;
}
.timeline-entry--cite:has(.lib-pdf-badges) .timeline-cite-wm,
.timeline-entry--cite:has(.lib-file-dl-badge) .timeline-cite-wm {
  width: min(62%, 16rem);
}
.timeline-entry--cite-wm-arxiv .timeline-cite-wm::before {
  content: "arXiv";
  font-family: system-ui, -apple-system, "Helvetica Neue", sans-serif;
  font-size: clamp(2.6rem, 10vw, 4.2rem);
  font-weight: 900;
  letter-spacing: -0.06em;
  color: var(--lib-rubric);
  opacity: 0.07;
  transform: translate(18%, -6%) rotate(-13deg);
}
.timeline-entry--cite-wm-doi .timeline-cite-wm::before {
  content: "DOI";
  font-family: var(--font-ui);
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.08em;
  color: var(--lib-nacht);
  opacity: 0.075;
  transform: translate(10%, -8%) rotate(-9deg);
}
.timeline-entry--cite-wm-jstor .timeline-cite-wm::before {
  content: "JSTOR";
  font-family: var(--font-ui);
  font-size: clamp(1.85rem, 7.5vw, 3.1rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--lib-nacht);
  opacity: 0.065;
  transform: translate(8%, -4%) rotate(-15deg);
}
.timeline-entry--cite-wm-aeon .timeline-cite-wm::before {
  content: "AEON";
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 9vw, 3.8rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #c62828;
  opacity: 0.06;
  transform: translate(12%, -5%) rotate(-12deg);
}
[data-theme="light"] .timeline-cite-wm::before { opacity: 0.045; }
[data-theme="light"] .timeline-entry--cite-wm-arxiv .timeline-cite-wm::before { opacity: 0.055; }
[data-theme="light"] .timeline-entry--cite-wm-doi .timeline-cite-wm::before { opacity: 0.06; }
[data-theme="light"] .timeline-entry--cite-wm-jstor .timeline-cite-wm::before,
[data-theme="light"] .timeline-entry--cite-wm-aeon .timeline-cite-wm::before { opacity: 0.05; }
.timeline-entry--cite .timeline-intro,
.timeline-entry--cite .timeline-title,
.timeline-entry--cite .timeline-people,
.timeline-entry--cite .timeline-comment,
.timeline-entry--cite .timeline-meta,
.timeline-entry--cite .timeline-cover--float {
  position: relative;
  z-index: 1;
}

/* ── followed-user entries: colour-coded bracket + single avatar ── */
/* Consecutive activity from one user is wrapped in a group and enclosed by a
   single '[' shaped bracket; a lone entry falls back to its own bracket. */
.timeline-entry--user { margin-left: 2.25rem; overflow: visible; display: flow-root; border-left-color: transparent; }
.timeline-entry--user::before { content: ""; position: absolute; left: -12px; top: 2px; bottom: 2px; width: 8px; border: 2px solid hsl(var(--timeline-user-hue) 72% 58%); border-right: none; border-radius: 8px 0 0 8px; }
.timeline-entry--user:hover::before { background: hsl(var(--timeline-user-hue) 82% 68%); }
.timeline-user-group { position: relative; margin-left: 2.75rem; overflow: visible; }
.timeline-user-group::before { content: ""; position: absolute; left: -14px; top: 3px; bottom: 3px; width: 9px; border: 2px solid hsl(var(--timeline-user-hue) 72% 58%); border-right: none; border-radius: 10px 0 0 10px; }
.timeline-user-group .timeline-entry--user { margin-left: 0; }
.timeline-user-group .timeline-entry--user::before { display: none; }
.timeline-user-group .timeline-user-gutter { position: absolute; left: -40px; top: 50%; width: 24px; height: 24px; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; }
.timeline-user-group .timeline-user-gutter .timeline-avatar { width: 24px; height: 24px; border-radius: 0; border: 2px solid hsl(var(--timeline-user-hue) 72% 58%); object-fit: contain; }
.timeline-intro { display: flex; align-items: baseline; gap: 0.5em; margin: 0 0 0.2em; font-family: var(--font-monospace); font-size: 0.72em; line-height: 1.4; }
.timeline-intro .timeline-time { margin-left: auto; color: var(--fg-dim); }
.tl-entry-del { background: none; border: none; padding: 0 0 0 0.4em; cursor: pointer; color: var(--fg-dim); font-size: 0.9em; opacity: 0; transition: opacity 120ms, color 120ms; }
.timeline-entry:hover .tl-entry-del { opacity: 0.45; }
.tl-entry-del:hover { opacity: 1 !important; color: var(--lib-rubric); }
.timeline-coll-btn {
  display: inline-block; margin-left: 0.4em; background: none; border: none; padding: 0;
  cursor: pointer; color: var(--fg-dim); font-size: 0.9em; opacity: 0; transition: opacity 120ms, color 120ms;
}
.timeline-entry .lib-cover-badges,
.timeline-entry .lib-pdf-badges {
  position: absolute;
  bottom: 0.35em;
  right: 0;
  top: auto;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  flex-wrap: nowrap;
  width: max-content;
  max-width: 100%;
  line-height: 1.2;
}
.timeline-entry .lib-podcast-play-badges,
.timeline-entry .lib-pdf-badges {
  position: relative;
}
.timeline-entry .lib-file-dl-badge {
  position: relative;
  flex-shrink: 0;
  line-height: 1.2;
}
.timeline-entry:has(.lib-cover-badges),
.timeline-entry:has(.lib-pdf-badges),
.timeline-entry:has(.lib-file-dl-badge) { padding-bottom: 1.5em; }
.timeline-pdf-icon { display: block; }
.timeline-entry:hover .timeline-coll-btn { opacity: 0.45; }
.timeline-coll-btn:hover { opacity: 1 !important; color: var(--lib-rubric); }
.timeline-shelf-badge { font: inherit; font-weight: 700; letter-spacing: 0.05em; background: transparent; border: none; padding: 0; cursor: pointer; }
.timeline-shelf-badge:hover { text-decoration: underline; }
/* followed users' shelf marks are read-only - no button affordance */
.timeline-shelf-badge--readonly { cursor: default; }
.timeline-shelf-badge--readonly:hover { text-decoration: none; }
.timeline-shelf-badge--complete { color: var(--lib-rubric); }
.timeline-shelf-badge--progress { color: var(--lib-gold); }
.timeline-shelf-badge--wishlist { color: var(--lib-nacht); }
.timeline-shelf-badge--dropped { color: var(--fg-dim); }
.tl-shelf-menu { display: inline-flex; gap: 4px; }
.tl-shelf-menu button { font: inherit; padding: 0 6px; cursor: pointer; background: var(--bg-high); border: none; color: var(--fg-second-dim); transition: color 70ms, background-color 70ms; }
.tl-shelf-menu button.tl-seg-complete { color: var(--lib-rubric); }
.tl-shelf-menu button.tl-seg-progress { color: var(--lib-gold); }
.tl-shelf-menu button.tl-seg-wishlist { color: var(--lib-nacht); }
.tl-shelf-menu button.tl-seg-dropped { color: var(--fg-dim); }
.tl-shelf-menu button:hover { color: var(--fg); }
.tl-shelf-menu .tl-shelf-del:hover { color: var(--lib-rubric); }
.tl-pending { opacity: 0.4; pointer-events: none; }

/* ── in-place editor: display styling IS the editor ── */
.timeline-entry.tl-editing { background: color-mix(in srgb, var(--bg-high) 50%, transparent); }
.timeline-entry.tl-editing:not(.timeline-entry--post) { border-left-color: var(--lib-rubric); }
.timeline-comment-text[contenteditable] { outline: none; border-bottom: 1px dashed color-mix(in srgb, var(--tl-comment-gold) 50%, transparent); min-width: 8em; white-space: pre-wrap; }
.tl-stars-live {
  display: inline-block; position: relative; white-space: nowrap;
  font-family: var(--font-monospace); letter-spacing: 0;
  cursor: pointer; user-select: none; color: transparent; font-size: 1.25em;
}
.tl-stars-live::before { content: "★★★★★"; }
.tl-stars-live > div {
  position: absolute; top: 0; left: 0; overflow: hidden; white-space: nowrap;
  color: var(--star-gold); pointer-events: none;
}
.tl-stars-live > div::before { content: "★★★★★"; }
.tl-edit-ok, .tl-edit-cancel {
  font: inherit; font-size: 0.85em; line-height: 1.2; padding: 0 6px; cursor: pointer;
  background: transparent; border: none; color: var(--fg-second-dim); flex-shrink: 0;
}
.tl-edit-ok:hover { color: var(--fg-green); }
.tl-edit-cancel:hover { color: var(--lib-rubric); }

/* tag chips - outlined, hue-coded, same node in display & edit */
.tl-tag {
  font-family: var(--font-monospace);
  font-size: 0.95em;
  line-height: 1.5;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  color: hsl(var(--th), 60%, 62%);
  border: 2px solid hsl(var(--th), 45%, 38%);
  background: transparent;
  transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}
[data-theme="light"] .tl-tag {
  color: hsl(var(--th), 65%, 32%);
  border-color: hsl(var(--th), 45%, 55%);
}
.tl-tag:not(.tl-tag--source):not(.tl-tag--active):is(:hover, :focus-within, :has(.tl-tag-link:focus-visible)),
a.tl-tag.tl-tag--catalog:not(.tl-tag--active):is(:hover, :focus-visible) {
  background: hsl(var(--th), 45%, 38%);
  border-color: hsl(var(--th), 45%, 38%);
}
.tl-tag:not(.tl-tag--source).tl-tag--active,
.tl-tag:not(.tl-tag--source).tl-tag--active:is(:hover, :focus-within, :has(.tl-tag-link:focus-visible)),
a.tl-tag.tl-tag--catalog.tl-tag--active,
a.tl-tag.tl-tag--catalog.tl-tag--active:is(:hover, :focus-visible) {
  background: hsl(var(--th), 45%, 38%);
  color: #fff;
  border-color: hsl(var(--th), 45%, 38%);
}
[data-theme="light"] .tl-tag:not(.tl-tag--source):not(.tl-tag--active):is(:hover, :focus-within, :has(.tl-tag-link:focus-visible)),
[data-theme="light"] a.tl-tag.tl-tag--catalog:not(.tl-tag--active):is(:hover, :focus-visible) {
  background: hsl(var(--th), 50%, 42%);
  border-color: hsl(var(--th), 50%, 42%);
}
[data-theme="light"] .tl-tag:not(.tl-tag--source).tl-tag--active,
[data-theme="light"] .tl-tag:not(.tl-tag--source).tl-tag--active:is(:hover, :focus-within, :has(.tl-tag-link:focus-visible)),
[data-theme="light"] a.tl-tag.tl-tag--catalog.tl-tag--active,
[data-theme="light"] a.tl-tag.tl-tag--catalog.tl-tag--active:is(:hover, :focus-visible) {
  background: hsl(var(--th), 50%, 42%);
  color: #fff;
  border-color: hsl(var(--th), 50%, 42%);
}
/* catalog fallback tags - read-only (no personal tag set on this mark); no × on hover is the only difference */
.tl-tag--catalog { cursor: pointer; }
a.tl-tag,
.tl-tag-link {
  color: inherit;
  text-decoration: none;
}
a.tl-tag:not(.tl-tag--active):hover,
a.tl-tag:not(.tl-tag--active):focus-visible,
.tl-tag-link:hover,
.tl-tag-link:focus-visible {
  color: inherit;
  text-decoration: none;
}
[data-theme="light"] a.tl-tag:not(.tl-tag--active):hover,
[data-theme="light"] a.tl-tag:not(.tl-tag--active):focus-visible {
  color: hsl(var(--th), 65%, 32%);
}
.timeline-meta .tl-tag:not(.tl-tag--source):not(.tl-tag--active):is(:hover, :focus-within, :has(.tl-tag-link:focus-visible)),
.timeline-meta a.tl-tag.tl-tag--catalog:not(.tl-tag--active):is(:hover, :focus-visible) {
  color: #fff;
}
.timeline-meta a.tl-tag:not(.tl-tag--active):hover,
.timeline-meta a.tl-tag:not(.tl-tag--active):focus-visible,
.timeline-meta .tl-tag-link:hover,
.timeline-meta .tl-tag-link:focus-visible,
.timeline-meta .tl-tag:not(.tl-tag--active):is(:hover, :focus-within) .tl-tag-link {
  color: #fff;
}
.tl-tag.tl-tag--source,
a.tl-tag.tl-tag--source,
.tl-tag[class*="tl-tag--source"] {
  cursor: default;
  background: #000 !important;
  color: #fff !important;
  border: none !important;
  font-size: 0.85em;
  text-transform: lowercase;
}
a.tl-tag.tl-tag--source,
a.tl-tag[class*="tl-tag--source"] {
  cursor: pointer;
  text-decoration: none;
}
.tl-tag.tl-tag--source:hover,
.tl-tag.tl-tag--source:active,
.tl-tag.tl-tag--source.tl-tag--active,
a.tl-tag.tl-tag--source:hover,
a.tl-tag.tl-tag--source:active,
a.tl-tag.tl-tag--source.tl-tag--active,
.tl-tag[class*="tl-tag--source"]:hover,
.tl-tag[class*="tl-tag--source"]:active,
.tl-tag[class*="tl-tag--source"].tl-tag--active {
  background: var(--chip-on-bg) !important;
  color: var(--chip-on-fg) !important;
}
[data-theme="light"] .tl-tag.tl-tag--source,
[data-theme="light"] a.tl-tag.tl-tag--source,
[data-theme="light"] .tl-tag[class*="tl-tag--source"] {
  background: #fff !important;
  color: #000 !important;
}
[data-theme="light"] .tl-tag.tl-tag--source:hover,
[data-theme="light"] .tl-tag.tl-tag--source:active,
[data-theme="light"] .tl-tag.tl-tag--source.tl-tag--active,
[data-theme="light"] a.tl-tag.tl-tag--source:hover,
[data-theme="light"] a.tl-tag.tl-tag--source:active,
[data-theme="light"] a.tl-tag.tl-tag--source.tl-tag--active,
[data-theme="light"] .tl-tag[class*="tl-tag--source"]:hover,
[data-theme="light"] .tl-tag[class*="tl-tag--source"]:active,
[data-theme="light"] .tl-tag[class*="tl-tag--source"].tl-tag--active {
  background: #000 !important;
  color: #fff !important;
}

.lib-source-tags {
  display: flex; flex-wrap: wrap; gap: 0.35em; margin: 0.15em 0 0.35em;
}
.lib-source-tag,
a.lib-source-tag,
[class*="lib-source-tag--"] {
  font-family: var(--font-monospace); font-size: 0.72em; line-height: 1.4;
  padding: 0 0.35em;
  max-width: 11rem;
  background: #000 !important;
  color: #fff !important;
  border: none;
  text-transform: lowercase;
  text-decoration: none;
}
a.lib-source-tag,
a.lib-source-tag:visited,
[class*="lib-source-tag--"]:is(a) {
  text-decoration: none;
  color: #fff !important;
  background-color: #000 !important;
  cursor: pointer;
}
a.lib-source-tag:hover,
a.lib-source-tag:focus-visible,
[class*="lib-source-tag--"]:is(a):hover {
  background-color: var(--chip-on-bg) !important;
  color: var(--chip-on-fg) !important;
}
[data-theme="light"] a.lib-source-tag,
[data-theme="light"] a.lib-source-tag:visited,
[data-theme="light"] [class*="lib-source-tag--"]:is(a) {
  background-color: #fff !important;
  color: #000 !important;
}
[data-theme="light"] a.lib-source-tag:hover,
[data-theme="light"] a.lib-source-tag:focus-visible,
[data-theme="light"] [class*="lib-source-tag--"]:is(a):hover {
  background-color: #000 !important;
  color: #fff !important;
}

/* In-place tag editing (always available, no edit toggle) */
.tl-tag-x {
  font: inherit; line-height: 1; cursor: pointer; background: transparent; border: none; padding: 0;
  color: inherit; margin-left: 4px; width: 0; overflow: hidden; opacity: 0;
  transition: width 0.1s, opacity 0.1s;
}
.tl-tag:hover .tl-tag-x { width: 1em; opacity: 0.7; }
.tl-tag-x:hover { opacity: 1; color: var(--lib-rubric); }
.tl-tag-add {
  font-family: var(--font-monospace); font-size: 1em; line-height: 1.4; cursor: pointer;
  background: transparent; border: 1px dashed var(--border-red-dark); color: var(--fg-dim);
  padding: 0 6px; opacity: 0.4; transition: opacity 0.1s, color 0.1s, border-color 0.1s;
}
.timeline-entry:hover .tl-tag-add { opacity: 0.75; }
.tl-tag-add:hover { opacity: 1; color: var(--lib-rubric); border-color: var(--lib-rubric); }

.tl-tag-entry { position: relative; display: inline-flex; flex: 1 1 auto; min-width: 0; }
.tl-tag-entry:has(.tl-tag-input) { flex: 1 1 100%; max-width: 100%; }
.tl-tag-input, .lib-tag-add {
  font-family: var(--font-monospace); font-size: 0.95em; min-width: 5em; width: auto; max-width: none;
  field-sizing: content; flex: 1 1 auto;
  padding: 0 4px;
  background: transparent; color: var(--fg); border: none; border-bottom: 1px dashed var(--border-red-dark); outline: none;
}
.tl-tag-input::placeholder, .lib-tag-add::placeholder { color: var(--fg-dim); }
.tl-tag-input:focus, .lib-tag-add:focus { border-bottom-color: var(--lib-rubric, #b5442f); }
.lib-tag-add { font-size: 0.78em; align-self: center; }

.tl-tag-drop {
  position: absolute; top: 100%; left: 0; z-index: 20; min-width: 9em; max-width: 16em;
  background: var(--bg-high); border: 1px solid var(--border-red-dark); margin-top: 2px;
  font-family: var(--font-monospace); font-size: 0.95em;
}
.tl-tag-opt {
  display: flex; justify-content: space-between; gap: 10px; padding: 2px 8px; cursor: pointer; color: var(--fg-second-light);
}
.tl-tag-opt--on, .tl-tag-opt:hover { background: color-mix(in srgb, var(--lib-rubric) 22%, transparent); color: var(--fg); }
.tl-tag-opt-n { color: var(--fg-dim); }
.timeline-item-class { color: var(--lib-nacht); }
.timeline-user { display: inline-flex; align-items: center; gap: 4px; }
.timeline-avatar { width: 18px; height: 18px; border-radius: 0; object-fit: cover; background: var(--bg-high); flex-shrink: 0; }
.timeline-username { color: var(--fg-dim); font-size: 0.9em; }
.timeline-people { font-family: var(--font-monospace); font-size: 0.72em; color: var(--fg-second-dim); margin: 0.1em 0; }
a.timeline-people-link {
  display: inline-block;
  max-width: min(14rem, 100%);
  padding: 2px 6px;
  margin: -2px -2px;
  color: var(--lib-nacht);
  text-decoration: none;
  border-radius: 0;
  position: relative;
  z-index: 2;
  transition: color 70ms;
}
a.timeline-people-link:hover {
  color: var(--fg);
  text-decoration: underline;
}
.timeline-title { font-family: var(--font-heading); font-weight: 600; font-size: 1.1em; line-height: 1.3; margin: 0.05em 0; letter-spacing: -0.015em; }
.timeline-title a { color: var(--fg); text-decoration: none; }
.timeline-title a:hover { color: var(--lib-gold); }
.timeline-cover--float { position: relative; float: left; margin: 2px 12px 4px 0; width: 42px; height: 58px; overflow: hidden; background: var(--bg-high); border: none; }
.timeline-cover--float img { width: 100%; height: 100%; object-fit: cover; }
.timeline-cover--float .lib-podcast-cover-play .lib-podcast-play-badge.librarium-lite-chip-btn {
  min-width: 1.35rem;
  min-height: 1.35rem;
  padding: 0 0.2rem;
  font-size: 0.62rem;
}
/* album art is square - show it whole, don't crop to the 3:4 book ratio */
.timeline-cover--float.timeline-cover--album { width: 58px; height: 58px; }
.timeline-cover--float.timeline-cover--album img { object-fit: contain; }
.timeline-comment { font-family: var(--font-prose); font-size: 0.82em; line-height: 1.4; margin: 0.2em 0 0.1em; display: flex; align-items: flex-start; gap: 4px; color: var(--tl-comment-gold); }
.timeline-comment-text { flex: 1; }
/* search-match highlight in title/comment text (Ctrl+K in-page search) */
mark.sh { background: #fef08a; color: #1a1a1a; padding: 0 1px; }
.timeline-stars {
  display: inline-block; position: relative; white-space: nowrap;
  font-family: var(--font-monospace); letter-spacing: 0;
  font-size: 1.25em; flex-shrink: 0; color: transparent;
}
.timeline-stars::before { content: "★★★★★"; }
.timeline-comment-edit { cursor: pointer; color: var(--fg-dim); font-family: var(--font-monospace); flex-shrink: 0; font-size: 0.82em; opacity: 0; transition: opacity 0.1s; }
.timeline-entry:hover .timeline-comment-edit { opacity: 0.5; }
.timeline-comment-edit:hover { opacity: 1 !important; color: var(--lib-rubric); }
.timeline-comment--empty { opacity: 1; }
.timeline-comment-add { cursor: pointer; font-family: var(--font-monospace); font-size: 0.72em; letter-spacing: 0.06em; color: var(--lib-nacht); opacity: 0.35; transition: opacity 0.1s, color 0.1s; }
.timeline-entry:hover .timeline-comment-add { opacity: 0.7; }
.timeline-comment-add:hover { opacity: 1 !important; color: var(--lib-rubric); }
.timeline-meta { font-size: 0.7em; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; }
.timeline-empty { text-align: center; color: var(--fg-second-dim); padding: 2rem 0; font-size: 0.9em; }
.tl-onboard {
  max-width: 34rem;
  margin: 1.5rem auto;
  padding: 1.6rem 1.8rem;
  text-align: left;
  background: var(--bg-high);
  color: var(--fg-second);
  font-size: 0.95em;
}
.tl-onboard-step { margin: 0 0 0.3rem; font: 0.7rem var(--font-monospace); color: var(--fg-dim); letter-spacing: 0.05em; }
.tl-onboard-title { margin: 0 0 0.7rem; font: 1.25rem var(--font-heading); color: var(--fg-title); }
.tl-onboard-text { margin: 0 0 1.2rem; line-height: 1.55; }
.tl-onboard-text a { color: var(--fg); text-decoration: underline; text-underline-offset: 2px; }
.tl-onboard-form { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.tl-onboard-input {
  flex: 1 1 16rem;
  min-width: 0;
  padding: 0.75rem 0.9rem;
  font: 1rem var(--font-monospace);
  color: var(--fg);
  background: var(--bg-input);
  border: 0;
  outline: none;
}
.tl-onboard-input:focus-visible { box-shadow: inset 0 -2px 0 var(--lib-rubric-d); }
.tl-onboard .tl-onboard-btn { align-self: stretch; padding: 0 1.1rem; font-size: 0.85rem; }
.tl-onboard div.tl-onboard-form .tl-onboard-btn { align-self: auto; padding: 0.75rem 1.1rem; }
.tl-onboard-status { margin: 0.7rem 0 0; min-height: 1.2em; font: 0.8rem var(--font-monospace); color: var(--fg-dim); }
.tl-onboard-form .tl-onboard-status { margin: 0; }
/* follows */
.tl-follows { margin: 0.4rem 0 0.8rem; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tl-follows--panel {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  box-sizing: border-box;
}
.tl-controls--merge .tl-follows--panel {
  margin: 0.1rem 0 0.35rem;
  align-self: stretch;
}
.timeline-page--compact .tl-controls .tl-follows--panel {
  margin: 0.35rem 0 0.5rem;
}
.tl-controls--merge .tl-controls-sync-main .tl-follow-open {
  flex: none;
}
.tl-controls--merge .tl-controls-sync .tl-follow-panel {
  margin-top: 0.35rem;
}
.tl-follow-form { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; }
.tl-follow-actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-items: center; }
.tl-follow-form input { font-family: var(--font-monospace); font-size: 0.8em; padding: 2px 0; background: transparent; border: 0; border-bottom: 1px solid var(--lib-rule); border-radius: 0; color: var(--fg); }
.tl-follow-form input:focus { outline: none; border-bottom-color: var(--lib-rubric); }
.tl-follow-panel { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 2px; }
.tl-follow-panel[hidden] { display: none; }
.tl-since-form { display: flex; gap: 4px; margin-top: 4px; align-items: center; font-family: var(--font-monospace); font-size: 0.78em; color: var(--fg-dim); }
.tl-since-form input { font-family: var(--font-monospace); font-size: 0.8em; padding: 2px 0; background: transparent; border: 0; border-bottom: 1px solid var(--lib-rule); border-radius: 0; color: var(--fg); }
.tl-since-form input:focus { outline: none; border-bottom-color: var(--lib-rubric); }
.tl-follow-list { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.tl-follow-item { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-monospace); font-size: 0.78em; color: var(--fg-dim); background: var(--bg-high); border: none; padding: 2px 8px; cursor: pointer; }
.tl-follow-item:hover { color: var(--fg); }
.tl-follow-item.tl-follow-item--on { color: #fff; background: hsl(var(--tl-chip-hue) 45% 42%); }
.tl-follow-color { width: 11px; height: 11px; padding: 0; border: 1px solid hsl(var(--tl-chip-hue) 55% 45%); border-radius: 0; background: hsl(var(--tl-chip-hue) 72% 58%); cursor: pointer; flex-shrink: 0; }
.tl-follow-color:hover { outline: 1px solid var(--fg-dim); }
.tl-follow-rm { background: none; border: none; color: var(--fg-dim); cursor: pointer; padding: 0 2px; font-size: 1em; line-height: 1; }
.tl-follow-rm:hover { color: var(--danger-fg); }
.tl-sync-status { margin-left: 0.6em; color: var(--fg-dim); font-family: var(--font-monospace); font-size: 0.72em; }
.tl-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin: 8px 0 12px; }
#timeline-load-more { text-align: center; margin-top: 12px; }
.timeline-more-btn {
  font: inherit;
  font-size: 0.8em;
  padding: 4px 20px;
  cursor: pointer;
  background: var(--bg-high);
  border: none;
  border-radius: 0;
  color: var(--fg-dim);
  transition: color 70ms, background-color 70ms;
}
.timeline-more-btn:hover { color: var(--fg); }

/* Follow list + shelf stats + user/star filters - wider band (90% viewport) */
.timeline-page .tl-follows:not(.tl-follows--panel),
.timeline-page #timeline-stats,
.timeline-page .tl-controls {
  box-sizing: border-box;
  width: 90vw;
  max-width: 90vw;
  margin-left: calc(50% - 45vw);
  margin-right: calc(50% - 45vw);
}
.timeline-page--merged .tl-follows--panel {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}
/* +Post stays on the feed column (same width as month rubric / entries) */
.timeline-page .tl-feed-head {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}
#tl-search {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-family: var(--font-monospace);
  font-size: 0.78em;
  padding: 4px 1.5rem 4px 2px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--lib-rule);
  border-radius: 0;
  color: var(--fg);
  text-align: center;
}
.tl-controls .lib-search-wrap {
  width: min(32rem, 100%);
  max-width: min(32rem, 100%);
}
.tl-controls .lib-search-wrap:has(#tl-search[hidden]) { display: none; }
.tl-controls .lib-search-wrap:has(#tl-search:not([hidden])) {
  flex: 0 0 100%;
  margin-left: auto;
  margin-right: auto;
}
#tl-search::placeholder { color: var(--fg-dim); }
#tl-search:focus { outline: none; border-bottom-color: var(--lib-rubric); }
#tl-user-filters, #tl-star-filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; width: 100%; }
.tl-user-chip { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-monospace); font-size: 0.75em; padding: 2px 8px; cursor: pointer; background: var(--bg-high); border: none; color: var(--fg-dim); transition: color 70ms, background-color 70ms; }
.tl-user-chip:hover { color: var(--fg); }
.tl-user-chip--on { color: #fff !important; background: hsl(var(--tl-chip-hue) 45% 42%) !important; }
.tl-user-avatar { width: 16px; height: 16px; border-radius: 0; object-fit: cover; }
.tl-user-count { color: var(--fg-second-dim); font-size: 0.9em; }
.tl-user-chip--on .tl-user-count { color: #fff; opacity: .7; }
.tl-star-chip { display: inline-flex; align-items: center; font-family: var(--font-monospace); font-size: 0.8em; letter-spacing: 0.02em; padding: 2px 8px; cursor: pointer; background: var(--bg-high); border: none; color: var(--fg-dim); transition: background-color 70ms, color 70ms; }
.tl-star-chip:hover { color: var(--fg); }
.tl-star-chip--on { background: var(--star-gold) !important; color: #2a2205 !important; }
/* asterism - finis */
.timeline-page::after { content: "\2042"; display: block; text-align: center; font-size: 0.9rem; color: var(--lib-nacht); margin: 2rem 0 0.5rem; }
@media (max-width: 540px) {
  .timeline-page { padding: 0.5rem; }
  .timeline-entry { padding: 0.3em 0 0.3em 8px; }
  .timeline-title { font-size: 1.2em; }
  .timeline-comment { font-size: 0.95em; }
  .timeline-intro { font-size: 0.85em; }
  .timeline-people { font-size: 0.85em; }
  .timeline-username { font-size: 1em; }
  .timeline-meta { font-size: 0.82em; }
  .timeline-cover--float { width: 72px; height: 100px; margin: 2px 16px 4px 0; }
  .timeline-cover--float.timeline-cover--album { width: 96px; height: 96px; }
  .timeline-avatar { width: 22px; height: 22px; }
  /* Stars get their own line above the tag row instead of squeezing into
     the note text's line. Force-wrap the *text* to full width (not the
     stars box) - the star fill overlay is a percentage of .timeline-stars'
     own width, and stretching that box to flex-basis:100% would blow the
     fill width out to the whole row while the ★★★★★ glyphs stay at their
     tiny intrinsic width, painting every star gold regardless of rating. */
  .timeline-comment { flex-wrap: wrap; }
  .timeline-comment-text { flex: 1 1 100%; }
  .timeline-stars { font-size: 1.75em; margin: 3px 0 0; }
}
/* ── Touch input: the desktop hover-to-reveal affordances (note edit
   pencil) are unreachable without hover, and the hit target is too small
   for a finger. Show it plainly and size it up. ── */
@media (pointer: coarse) {
  .timeline-comment-edit {
    opacity: 0.55; font-size: 1.3em; padding: 6px 8px; margin: -6px -8px;
  }
  .timeline-comment-edit:active { opacity: 1; color: var(--lib-rubric); }
  .timeline-comment-add {
    opacity: 0.55; font-size: 1em; padding: 6px 8px; margin: -6px -8px; display: inline-block;
  }
  .timeline-comment-add:active { opacity: 1; color: var(--lib-rubric); }
  /* Star rating: gradeAt() reads getBoundingClientRect(), so a bigger
     font-size directly grows the tappable/draggable width, not just the
     glyphs - this is what makes half-star precision reachable by thumb.
     No padding here: the fill overlay is an absolutely-positioned child
     positioned against the *padding* box (top/left: 0), while the dim
     base layer is the parent's own ::before content flowing inside the
     *content* box - padding pushes those two layers out of alignment
     and the fill visibly detaches from the outline ("ghosting"). */
  .tl-stars-live { font-size: 2.25em; }
  .tl-edit-ok, .tl-edit-cancel { font-size: 1.15em; padding: 8px 14px; }
}

.lib-media-sync-panel {
  display: none;
  width: 100%;
  margin: 0.65rem 0 0.85rem;
  padding: 0.65rem 0.75rem;
  background: color-mix(in srgb, var(--lib-faint) 8%, var(--lib-card));
}
.lib-media-sync-panel.is-active,
.lib-media-sync-panel.is-done,
.lib-media-sync-panel.is-error { display: block; }
.lib-media-sync-track {
  height: 3px;
  background: color-mix(in srgb, var(--lib-faint) 25%, transparent);
  overflow: hidden;
  margin-bottom: 0.45rem;
}
.lib-media-sync-fill {
  height: 100%;
  width: 35%;
  background: var(--fg-green);
  animation: lib-media-sync-indeterminate 1.2s ease-in-out infinite;
}
.lib-media-sync-panel.is-done .lib-media-sync-fill { width: 100%; animation: none; background: var(--fg-green); }
.lib-media-sync-panel.is-error .lib-media-sync-fill { width: 100%; animation: none; background: var(--lib-rubric); }
.lib-media-sync-msg {
  font-size: 0.68rem;
  color: var(--lib-faint);
  font-family: var(--font-monospace);
  letter-spacing: 0.03em;
}
@keyframes lib-media-sync-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(280%); } }

/* ── Collections management (/collections) - flat, same ledger as compose/library ── */
.collections-page,
.collections-page--pane,
.tl-merge-sidebar.tl-merge-collections {
  --lib-ink: var(--fg);
  --lib-faint: var(--fg-dim);
  --lib-muted: var(--fg-dim);
}
.collections-page {
  padding: 1.75rem 0 2.5rem;
  width: 100%;
  max-width: none;
  margin: 0;
  box-sizing: border-box;
}
.collections-page ::selection { background: color-mix(in srgb, var(--lib-nacht) 30%, transparent); }
.coll-manage-layout {
  display: grid;
  grid-template-columns: minmax(11rem, 15rem) minmax(14rem, 20rem) minmax(0, 1fr);
  gap: 0 1.75rem;
  align-items: start;
  margin-top: 1.2rem;
  width: 100%;
}
.coll-manage-sidebar,
.coll-manage-edit,
.coll-manage-sort {
  min-width: 0;
}
.coll-manage-edit,
.coll-manage-sort {
  border-left: 1px solid var(--lib-rule);
  padding-left: 1.75rem;
}
.coll-manage-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--lib-rule);
}
.coll-manage-panel-label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: -0.015em;
  color: var(--lib-faint);
  text-transform: lowercase;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.coll-manage-panel-title {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  min-width: 0;
}
.coll-manage-sync-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.85em;
  line-height: 1;
  padding: 0;
  color: var(--lib-faint);
  opacity: 0.75;
  transition: transform 0.15s ease, opacity 0.15s ease, color 0.15s ease;
}
.coll-manage-sync-btn:hover {
  opacity: 1;
  color: var(--lib-rubric);
  transform: rotate(45deg);
}
.coll-manage-sync-btn:active { transform: rotate(90deg); }
.coll-manage-sync-btn--busy {
  animation: tl-updated-btn-spin 0.6s linear infinite;
  opacity: 1;
  color: var(--lib-rubric);
  pointer-events: none;
  transform: none;
}
.coll-manage-panel-meta {
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  color: var(--lib-faint);
}
.coll-manage-panel-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  justify-content: flex-end;
}
.coll-manage-panel-actions--export {
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}
.coll-manage-sort-head {
  align-items: baseline;
}
.coll-manage-sort-head-meta {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin-left: auto;
  justify-content: flex-end;
}
.coll-copy-text-head-btn {
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
}
.coll-copy-img-toggle {
  border: none;
  background: none;
  padding: 0;
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  color: var(--lib-faint);
  cursor: pointer;
  user-select: none;
}
.coll-copy-img-toggle:hover {
  color: var(--lib-rubric);
}
.coll-copy-img-toggle::before {
  content: "+ ";
  color: var(--lib-rubric);
}
.coll-copy-img-toggle[aria-expanded="true"]::before {
  content: "− ";
}
.coll-copy-img-toggle[aria-expanded="true"] {
  color: var(--fg);
  font-weight: 600;
}
.coll-copy-img-panel {
  margin-bottom: 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--lib-rule);
}
.coll-copy-img-panel[hidden] {
  display: none;
}
.coll-manage-panel-actions-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  justify-content: flex-end;
  align-items: center;
}
.coll-manage-panel-actions .librarium-lite-chip-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.coll-copy-bg-thumb {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 2px;
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lib-rule) 70%, transparent);
}
.coll-copy-bg-clear {
  padding-inline: 0.45rem;
}
.coll-copy-bg-clear[hidden] {
  display: none;
}
.coll-copy-blur-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.62rem;
  color: var(--lib-faint);
  white-space: nowrap;
  flex: 0 0 auto;
}
.coll-copy-blur-label output {
  min-width: 1rem;
  font-size: 0.62rem;
  text-align: right;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.coll-copy-blur-label input[type="range"] {
  width: 2.75rem;
  height: 0.85rem;
  accent-color: var(--lib-rubric);
}
.coll-copy-bg-status {
  font-size: 0.62rem;
  color: var(--fg-dim);
  max-width: 5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 0 auto;
}
.coll-copy-bg-status.is-error {
  color: var(--lib-rubric);
}
.coll-copy-bg-status:empty {
  display: none;
}
.coll-copy-text-colors-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}
.coll-copy-text-colors-label {
  font-size: 0.68rem;
  color: var(--lib-faint);
  white-space: nowrap;
}
.coll-copy-text-colors {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}
.coll-copy-text-color {
  width: 1.05rem;
  height: 1.05rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--lib-rule) 80%, transparent);
  border-radius: 50%;
  cursor: pointer;
  flex: 0 0 auto;
  background: transparent;
}
.coll-copy-text-color--auto {
  background: linear-gradient(135deg, #f2f2f2 50%, #141414 50%);
}
.coll-copy-text-color[data-copy-text-color="white"] {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.coll-copy-text-color.is-active {
  box-shadow: 0 0 0 2px var(--lib-rubric);
}
.coll-copy-text-color[data-copy-text-color="white"].is-active {
  box-shadow: 0 0 0 2px var(--lib-rubric), inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.coll-manage-copy-colors-row {
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.coll-copy-orient-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}
.coll-copy-orient {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.coll-copy-orient-btn {
  padding: 0.2rem 0.45rem;
  font-size: 0.62rem;
  line-height: 1.2;
}
.coll-copy-orient-btn.is-active {
  background: var(--lib-rubric);
  color: #fff;
}
.coll-manage-sort .coll-manage-panel-head {
  align-items: flex-start;
}
.coll-manage-panel-body {
  min-height: 4rem;
}
@media (min-width: 960px) {
  .coll-manage-layout {
    grid-template-columns: minmax(13rem, 17rem) minmax(16rem, 22rem) minmax(0, 1fr);
    gap: 0 2rem;
  }
  .coll-manage-edit,
  .coll-manage-sort {
    padding-left: 2rem;
  }
  .coll-manage-sidebar,
  .coll-manage-edit,
  .coll-manage-sort {
    position: sticky;
    top: 0.75rem;
    align-self: start;
    max-height: calc(100vh - 5rem);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  .coll-manage-sidebar .coll-manage-panel-head,
  .coll-manage-edit .coll-manage-panel-head,
  .coll-manage-sort .coll-manage-panel-head {
    flex-shrink: 0;
  }
  .coll-manage-sidebar .coll-manage-list,
  .coll-manage-edit .coll-manage-panel-body,
  .coll-manage-sort .coll-manage-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .coll-manage-item-title {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
}
@media (max-width: 959px) {
  .coll-manage-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .coll-manage-edit,
  .coll-manage-sort {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--lib-rule);
    padding-top: 1.25rem;
  }
}
.coll-manage-list { list-style: none; margin: 0.1rem 0 0; padding: 0; }
.coll-manage-list li { margin: 0; padding: 0; }
.coll-manage-list-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem;
}
.coll-manage-list-row button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.15rem 0;
  margin: 0;
  border: none;
  background: none;
  color: var(--lib-ink);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.25;
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.coll-manage-list-open {
  flex-shrink: 0;
  font-size: 0.62rem;
  white-space: nowrap;
}
.coll-manage-list-row button:hover {
  color: var(--lib-rubric);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.coll-manage-list-item.is-active button {
  color: var(--lib-rubric);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.coll-manage-tag {
  font-family: var(--font-monospace);
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  color: var(--lib-faint);
  font-style: italic;
}
.coll-manage-list-empty,
.coll-manage-empty {
  font-family: var(--font-monospace);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--lib-faint);
  padding: 0.15rem 0;
}
.coll-manage-empty.is-error,
.coll-manage-list-empty.is-error { color: var(--lib-rubric); }
.coll-manage-edit-inner,
.coll-manage-sort-inner {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.coll-manage-edit-head { margin-bottom: 0.15rem; }
.coll-manage-field-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--lib-rule);
}
.coll-manage-field-bracket {
  font-family: var(--font-monospace);
  font-size: 0.95rem;
  line-height: 1;
  color: var(--lib-faint);
  flex-shrink: 0;
}
.coll-manage-field-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: -0.015em;
  color: var(--lib-ink);
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.coll-manage-field-edit {
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--fg-dim);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 70ms, color 70ms;
}
.coll-manage-field-row:hover .coll-manage-field-edit,
.coll-manage-field-edit:focus-visible {
  opacity: 1;
}
.coll-manage-field-edit:hover {
  color: var(--lib-rubric);
  opacity: 1;
}
.coll-manage-field-row.is-editing {
  border-bottom-color: var(--lib-rubric);
}
.coll-manage-cover-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}
.coll-manage-cover {
  flex-shrink: 0;
  width: 4.5rem;
  height: 4.5rem;
  line-height: 0;
  background: color-mix(in srgb, var(--lib-faint) 12%, transparent);
}
.coll-manage-cover--empty {
  border: 1px dashed color-mix(in srgb, var(--lib-faint) 35%, transparent);
}
.coll-manage-cover-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.coll-manage-cover-actions {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  padding-top: 0.15rem;
}
.coll-manage-cover-actions .coll-manage-featured-btn {
  margin: 0;
}
.coll-manage-featured-btn.is-loading {
  opacity: 0.45;
  pointer-events: none;
}
.coll-manage-cover-opts {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0 0;
  border-top: 1px dashed color-mix(in srgb, var(--lib-faint) 25%, transparent);
}
.coll-manage-cover-opts-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.45rem;
}
.coll-manage-cover-opts-row--top {
  align-items: flex-start;
}
.coll-manage-cover-opts-row--font {
  align-items: center;
}
.coll-manage-cover-opt {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 3.5rem;
}
.coll-manage-cover-letter {
  width: 3.25rem;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.2;
  padding: 0.15rem 0.25rem;
}
.coll-manage-cover-preview {
  flex-shrink: 0;
  width: 4.5rem;
  height: 4.5rem;
  image-rendering: auto;
  border: 1px solid color-mix(in srgb, var(--lib-faint) 30%, transparent);
}
.coll-manage-cover-palettes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.coll-manage-cover-palette {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--lib-faint) 35%, transparent);
  background: transparent;
  position: relative;
  overflow: hidden;
}
.coll-manage-cover-palette.is-active {
  border-color: var(--lib-rubric);
  box-shadow: 0 0 0 1px var(--lib-rubric);
}
.coll-manage-cover-palette[data-palette-id="white"] {
  border-color: color-mix(in srgb, var(--lib-faint) 50%, transparent);
}
.coll-manage-cover-palette[data-palette-id="white"] .coll-manage-cover-palette-bg {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #000 14%, transparent);
}
.coll-manage-cover-palette-bg {
  position: absolute;
  inset: 0;
}
.coll-manage-cover-palette-fg {
  position: relative;
  z-index: 1;
  font-family: var(--font-monospace);
  font-size: 0.72rem;
  line-height: 1;
  pointer-events: none;
}
.coll-manage-cover-font {
  min-width: 8rem;
  max-width: 100%;
  flex: 1 1 8rem;
}
.coll-manage-cover-font-upload {
  margin: 0;
  cursor: pointer;
}
.coll-manage-cover-font-status {
  font-family: var(--font-monospace);
  font-size: 0.62rem;
  color: var(--lib-faint);
  flex: 1 1 100%;
}
.coll-manage-field-title-edit {
  outline: none;
  border-bottom: 1px dashed color-mix(in srgb, var(--lib-rubric) 55%, transparent);
  min-width: 0;
}
.coll-manage-title-edit-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.coll-manage-title-edit-actions .tl-edit-ok,
.coll-manage-title-edit-actions .tl-edit-cancel {
  cursor: pointer;
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  line-height: 1.35;
  padding: 2px 8px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: var(--chip-flat-bg);
  border: 1px solid var(--chip-flat-border);
  border-radius: 0;
  color: var(--lib-faint);
  transition: background-color 70ms, border-color 70ms, color 70ms;
}
.coll-manage-title-edit-actions .tl-edit-ok:hover,
.coll-manage-title-edit-actions .tl-edit-ok:focus-visible {
  background: var(--ink-fill-bg);
  border-color: var(--ink-fill-bg);
  color: var(--ink-fill-fg);
}
.coll-manage-title-edit-actions .tl-edit-cancel:hover,
.coll-manage-title-edit-actions .tl-edit-cancel:focus-visible {
  background: var(--chip-hover-bg);
  border-color: var(--chip-hover-bg);
  color: var(--chip-flat-fg);
}
.coll-manage-sort-hint { margin-bottom: 0.15rem; }
.coll-manage-sort-foot { margin-top: 0.25rem; }
.coll-manage-item .coll-manage-note.timeline-comment {
  grid-column: 2;
  grid-row: auto;
  margin: 0.12rem 0 0;
  min-width: 0;
  width: 100%;
}
.coll-manage-item:hover .timeline-comment-edit { opacity: 0.5; }
.coll-manage-item:hover .timeline-comment-add { opacity: 0.7; }
.coll-manage-item.tl-editing {
  background: color-mix(in srgb, var(--bg-high) 50%, transparent);
}
.coll-manage-item .timeline-comment-text[contenteditable] {
  outline: none;
  border-bottom: 1px dashed color-mix(in srgb, var(--tl-comment-gold) 50%, transparent);
  min-width: 8em;
  white-space: pre-wrap;
}
.coll-manage-item-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  align-self: start;
  padding-top: 0.1rem;
}
.coll-manage-item-actions .coll-manage-item-rm {
  flex-shrink: 0;
}
.coll-manage-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin: 0.15rem 0 0.35rem;
  font-family: var(--font-monospace);
  font-size: 0.65rem;
  color: var(--lib-faint);
}
.coll-manage-stats-bar {
  flex: 1 1 6rem;
  min-width: 5rem;
  height: 4px;
  border: none;
  background: var(--bg-high);
}
.coll-manage-stats-bar::-webkit-progress-bar { background: var(--bg-high); }
.coll-manage-stats-bar::-webkit-progress-value { background: var(--lib-rubric); }
.coll-manage-stats-bar::-moz-progress-bar { background: var(--lib-rubric); }
.coll-manage-meta {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}
.coll-manage-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.coll-manage-label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: -0.015em;
  color: var(--lib-faint);
  text-transform: lowercase;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.collections-page textarea.coll-manage-brief {
  min-height: 10rem;
  resize: vertical;
  line-height: 1.45;
  padding: 6px 0;
  white-space: pre-wrap;
}
.coll-manage-vis-field .tl-compose-vis {
  margin-top: 0.05rem;
}
.coll-manage-add {
  position: relative;
  width: 100%;
  margin-bottom: 0.15rem;
}
.coll-manage-add-results {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 20;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--lib-rule);
  max-height: 12rem;
  overflow-y: auto;
}
.coll-manage-add-results li button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.25rem 0.45rem;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--lib-ink);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  cursor: pointer;
}
.coll-manage-add-results li button:hover {
  color: var(--lib-rubric);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.coll-manage-add-empty {
  padding: 0.25rem 0.45rem;
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  color: var(--lib-faint);
}
.coll-manage-hint {
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--lib-faint);
}
.coll-manage-items-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  line-height: 1.25;
  border-top: 1px solid var(--lib-rule);
}
.coll-manage-items-empty {
  padding: 0.35rem 0;
  font-family: var(--font-monospace);
  font-size: 0.68rem;
  color: var(--lib-faint);
}
.coll-manage-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 0.45rem;
  padding: 0.28rem 0;
  border-bottom: 1px solid var(--lib-rule);
}
.coll-manage-item.is-moving {
  background: color-mix(in srgb, var(--lib-nacht) 12%, transparent);
}
.coll-manage-move {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  width: 1.1rem;
}
.coll-manage-move-btn {
  font-family: var(--font-monospace);
  font-size: 0.62rem;
  line-height: 1;
  padding: 0.12rem 0.2rem;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--lib-faint);
  cursor: pointer;
}
.coll-manage-move-btn:hover:not(:disabled) { color: var(--lib-rubric); }
.coll-manage-move-btn:active:not(:disabled) { color: var(--lib-ink); }
.coll-manage-move-btn:disabled { opacity: 0.22; cursor: default; }
.coll-manage-rank {
  font-family: var(--font-monospace);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--lib-faint);
  flex-shrink: 0;
  min-width: 1.35rem;
}
.coll-manage-item-body {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-auto-rows: auto;
  column-gap: 0.45rem;
  row-gap: 0.05rem;
  align-items: baseline;
}
.coll-manage-item-body .coll-manage-rank {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  padding-top: 0.1rem;
}
.coll-manage-item-title {
  grid-column: 2;
  grid-row: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--lib-ink);
  text-decoration: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.coll-manage-item-title:hover {
  color: var(--lib-rubric);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.coll-manage-item-sub {
  grid-column: 2;
  font-family: var(--font-monospace);
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  color: var(--lib-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coll-manage-item-meta {
  grid-column: 2;
  grid-row: auto;
  display: flex;
  align-items: baseline;
  min-width: 0;
  overflow: hidden;
}
.coll-manage-item-meta .coll-manage-item-sub {
  grid-column: auto;
  min-width: 0;
}
.coll-manage-item-class {
  flex-shrink: 0;
  font-family: var(--font-monospace);
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  color: var(--lib-nacht);
}
.coll-manage-item-sep {
  flex-shrink: 0;
  font-family: var(--font-monospace);
  font-size: 0.62rem;
  color: var(--lib-faint);
}
@media (pointer: coarse) {
  .coll-manage-move { width: 1.55rem; }
  .coll-manage-move-btn {
    font-size: 0.82rem;
    padding: 0.28rem 0.25rem;
  }
}

/* ── Current Targets (/targets) - flat ledger, same as collections ── */
.targets-page {
  padding: 1.75rem 0 2.5rem;
  width: 100%;
  max-width: none;
  margin: 0;
  box-sizing: border-box;
}
.targets-page ::selection { background: color-mix(in srgb, var(--lib-nacht) 30%, transparent); }
.targets-page h1 {
  font-family: var(--font-inscription);
  font-size: 2.3rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--lib-ink);
  margin: 1.4rem 0 0;
}
.targets-page h1::before,
.targets-page h1::after {
  content: "\2720";
  color: var(--lib-rubric);
  font-size: 0.5em;
  vertical-align: 0.3em;
  margin: 0 1.2em;
}
.targets-toolbar {
  margin-bottom: 0.85rem;
}
.targets-toolbar.coll-manage-panel-head {
  margin-top: 0.35rem;
}
.targets-status:empty { display: none; }
.targets-status.is-error { color: var(--lib-rubric); }
.targets-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 0.85rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--lib-rule);
}
.targets-user {
  margin-bottom: 1.15rem;
}
.targets-user-head.coll-manage-panel-head {
  margin-bottom: 0.35rem;
}
.targets-user-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.targets-user-avatar {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.targets-user-name {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--lib-ink);
}
.targets-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.targets-row {
  margin: 0;
  padding: 0.35rem 0 0.45rem;
  border-bottom: 1px solid var(--lib-rule);
}
.targets-row:last-child { border-bottom: none; }
.targets-row-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
  position: relative;
  z-index: 1;
}
.targets-row.is-open .targets-row-head { margin-bottom: 0.22rem; }
.targets-progress-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-left: 1.35rem;
  margin-bottom: 0.12rem;
}
.targets-row-count {
  flex-shrink: 0;
  min-width: 2.85rem;
  font-size: 0.68rem;
  font-family: var(--font-monospace);
  letter-spacing: 0.03em;
  line-height: 1;
  text-align: right;
  color: hsl(var(--targets-hue, 0) 32% 52%);
  font-variant-numeric: tabular-nums;
}
.targets-row-count-sep {
  opacity: 0.45;
  padding: 0 0.08em;
}
.targets-row--complete .targets-row-count {
  color: hsl(var(--targets-hue, 0) 42% 42%);
}
.targets-progress {
  flex: 1 1 auto;
  min-width: 0;
  height: 4px;
  background: color-mix(in srgb, var(--lib-ink) 8%, var(--lib-rule));
  overflow: hidden;
}
.targets-progress-fill {
  display: block;
  height: 100%;
  min-width: 0;
  background: linear-gradient(90deg, #fbbf24 0%, #f97316 20%, #d4556a 40%, #ef4444 55%, #d4556a 70%, #f97316 85%, #fbbf24 100%) 0 0 / 200% 100%;
  animation: ribbon-glide 2.8s ease-in-out infinite;
}
.targets-row--complete .targets-progress-fill {
  filter: brightness(1.1);
}
[data-theme="light"] .targets-progress {
  background: color-mix(in srgb, var(--lib-ink) 6%, var(--lib-rule));
}
.targets-row-main-btn {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  margin: 0;
  padding: 0.12rem 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.targets-row-main-btn:hover .targets-row-title {
  color: var(--lib-rubric);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.targets-row-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
  color: var(--lib-faint);
}
.targets-row-caret::before {
  content: "";
  display: block;
  width: 0.34rem;
  height: 0.34rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
  transition: transform 70ms, border-color 70ms;
}
.targets-row-main-btn[aria-expanded="true"] .targets-row-caret::before {
  transform: rotate(45deg) translateY(-1px);
}
.targets-row-main-btn:hover .targets-row-caret,
.targets-row-main-btn[aria-expanded="true"] .targets-row-caret {
  color: var(--lib-rubric);
}
.targets-row-title {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  line-height: 1.25;
  color: var(--lib-ink);
  min-width: 0;
}
.targets-row-main-btn .coll-manage-tag {
  flex-shrink: 0;
}
.targets-row-open {
  flex-shrink: 0;
}
.targets-set-btn {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--lib-rule);
  border-radius: 0;
  background: transparent;
  color: var(--lib-faint);
  cursor: pointer;
  transition: border-color 70ms, color 70ms, background-color 70ms;
}
.targets-set-btn-dot {
  display: block;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 0;
  background: transparent;
  transition: background-color 70ms, transform 70ms;
}
.targets-set-btn:hover {
  background: color-mix(in srgb, var(--lib-faint) 14%, transparent);
  color: var(--lib-rubric);
}
.targets-set-btn:hover .targets-set-btn-dot {
  background: var(--lib-rubric);
}
.targets-set-btn.is-active {
  border-color: var(--lib-rubric);
  color: var(--lib-rubric);
}
.targets-set-btn.is-active .targets-set-btn-dot {
  background: var(--lib-rubric);
}
.targets-set-btn.is-loading {
  opacity: 0.45;
  pointer-events: none;
}
.targets-items-panel {
  margin: 0.35rem 0 0;
  padding-left: 0.85rem;
  border-left: 1px solid var(--lib-rule);
}
.targets-items-panel[hidden] {
  display: none;
  content-visibility: hidden;
}
.targets-items-actions {
  margin: 0.1rem 0 0.35rem;
  justify-content: flex-start;
}
.targets-items-status {
  margin: 0.15rem 0 0.35rem;
}
.targets-items-list {
  margin: 0.1rem 0 0.15rem;
}
.targets-item.coll-manage-item {
  padding: 0.22rem 0;
}
.targets-item .coll-manage-item-title.label-chip,
.targets-item .coll-manage-item-sub.label-chip {
  display: inline-block;
  max-width: 100%;
  text-decoration: none;
}
.targets-item .coll-manage-item-title.label-chip {
  color: var(--lib-ink);
  font-size: 0.8rem;
}
.targets-item .coll-manage-item-sub.label-chip {
  color: var(--lib-faint);
  font-size: 0.62rem;
}
.targets-item .coll-manage-item-title.label-chip:hover,
.targets-item .coll-manage-item-sub.label-chip:hover {
  color: var(--lib-rubric);
}
.targets-item-catalog {
  align-self: start;
  padding-top: 0.08rem;
}
@media (max-width: 640px) {
  main:has(.targets-page:not(.targets-page--pane)) { padding: 0 1rem 3rem; }
  .targets-page:not(.targets-page--pane) { padding: 1.75rem 0 2.5rem; }
}

/* merge sidebar: collections + targets */
.tl-merge-sidebar.tl-merge-collections,
.tl-merge-sidebar.tl-merge-targets {
  overflow: hidden;
}
.collections-page--pane,
.targets-page--pane {
  max-width: none;
  margin: 0;
  padding: 0.65rem 1rem 1.25rem;
  box-sizing: border-box;
}
.collections-page--pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.targets-page--pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.targets-page--pane h1 {
  font-family: var(--font-inscription);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-align: left;
  margin: 0 0 0.35rem;
  flex-shrink: 0;
}
.targets-page--pane h1::before,
.targets-page--pane h1::after {
  display: none;
}
.targets-page--pane .targets-toolbar {
  flex-shrink: 0;
}
.targets-page--pane .targets-root {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.collections-page--pane h1,
[data-theme="light"] .collections-page--pane h1,
[data-theme="dark"] .collections-page--pane h1 {
  font-family: var(--font-inscription);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--lib-ink);
  margin: 0 0 0.35rem;
  flex-shrink: 0;
}
.collections-page--pane h1::before,
.collections-page--pane h1::after {
  content: "\2720";
  color: var(--lib-rubric);
  font-size: 0.5em;
  vertical-align: 0.3em;
  letter-spacing: 0;
  margin: 0 1.2em;
}
.collections-page--pane .coll-manage-layout {
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 0.65rem;
  flex: 1 1 auto;
  min-height: 0;
}
.collections-page--pane .coll-manage-sidebar {
  grid-row: auto;
}
.collections-page--pane .coll-manage-edit,
.collections-page--pane .coll-manage-sort {
  border-left: none;
  padding-left: 0;
  border-top: 1px solid var(--lib-rule);
  padding-top: 0.75rem;
  margin-top: 0;
}
@media (min-width: 960px) {
  .collections-page--pane .coll-manage-layout {
    grid-template-columns: minmax(10.5rem, 12.5rem) minmax(13rem, 17rem) minmax(0, 1fr);
    grid-template-rows: auto;
    gap: 0 0.65rem;
  }
  .collections-page--pane .coll-manage-sidebar .coll-manage-panel-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .collections-page--pane .coll-manage-sidebar .coll-manage-panel-label {
    flex: 1 1 100%;
  }
  .collections-page--pane .coll-manage-sidebar .coll-manage-panel-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
  }
  .collections-page--pane .coll-manage-edit {
    border-left: 1px solid var(--lib-rule);
    padding-left: 0.65rem;
    border-top: none;
    padding-top: 0;
  }
  .collections-page--pane .coll-manage-sort {
    grid-column: auto;
    border-left: 1px solid var(--lib-rule);
    padding-left: 0.65rem;
    border-top: none;
    padding-top: 0;
  }
  .collections-page--pane .coll-manage-sidebar,
  .collections-page--pane .coll-manage-edit,
  .collections-page--pane .coll-manage-sort {
    position: sticky;
    top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--librarium-lite-nav-h, 3.15rem) - 3.25rem);
    min-height: 0;
    overflow: hidden;
    background: var(--bg);
  }
  .collections-page--pane .coll-manage-sidebar .coll-manage-panel-body,
  .collections-page--pane .coll-manage-edit .coll-manage-panel-body,
  .collections-page--pane .coll-manage-sort .coll-manage-panel-body,
  .collections-page--pane .coll-manage-sidebar .coll-manage-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .collections-page--pane .coll-manage-panel-head {
    flex-shrink: 0;
  }
}
.collections-page--pane .coll-manage-item-sub.tl-lib-search-link {
  display: inline-block;
  max-width: 100%;
  text-decoration: none;
}
.collections-page--pane .coll-manage-item-title.tl-lib-search-link {
  display: inline-block;
  max-width: 100%;
  text-decoration: none;
}
.collections-page--pane .coll-manage-item-title.tl-lib-search-link:hover,
.collections-page--pane .coll-manage-item-sub.tl-lib-search-link:hover {
  color: var(--lib-rubric);
}
@media (max-width: 960px) {
  .collections-page--pane .coll-manage-layout {
    grid-template-columns: 1fr;
  }
}
