/* Manzar — library, submission, and review (owner) pages.
 *
 * Light, somber, app-side, on the Manzar tokens (base.css) + .btn primitives.
 * Straight-edged containers; rounding only on controls; one accent. */

.library-page { background: var(--surface-canvas); color: var(--text-body); min-height: 100vh; }
/* Always reserve the scrollbar gutter so filtering (which changes page height,
   and thus whether a scrollbar is shown) never shifts the centred layout
   sideways. Scoped to the light app pages so it can't touch the presenter. */
html:has(body.library-page) { scrollbar-gutter: stable; }

/* The top bar is now the shared .site-header (base.css + templates/_header.html). */

/* --- Homepage hub --- */
.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}
@media (max-width: 720px) { .home-actions { grid-template-columns: 1fr; } }
.home-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-container);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease-calm), box-shadow var(--dur) var(--ease-calm);
}
.home-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-raised); }
.home-card__icon { display: inline-flex; color: var(--text-muted); transition: color var(--dur) var(--ease-calm); }
.home-card__icon svg { width: 22px; height: 22px; }
.home-card:hover .home-card__icon { color: var(--accent); }
.home-card__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
  letter-spacing: var(--ls-tight);
  color: var(--text-strong);
}
.home-card__desc { font-family: var(--font-ui); font-size: var(--fs-body-sm); line-height: var(--lh-body); color: var(--text-muted); }
.home-card__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  border: var(--bw-hair) solid var(--border-default);
  font-family: var(--font-ui);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
}
.home-card__count--marker { background: var(--marker-tint); border-color: var(--ember-600); color: var(--ember-700); }
.home-recents__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.home-recents__head .lib__eyebrow { margin: 0; }
.home-recents__all { font-family: var(--font-ui); font-size: var(--fs-body-sm); color: var(--accent-text); text-decoration: none; white-space: nowrap; }
.home-recents__all:hover { color: var(--accent-hover); }

/* --- Page frame --- */
.lib { max-width: var(--maxw); margin: 0 auto; padding: var(--space-7) var(--space-6) var(--space-9); }
.lib--narrow { max-width: var(--measure); }
.lib__head { margin-bottom: var(--space-6); }
.lib__eyebrow {
  margin: 0 0 var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--text-faint);
}
.lib__title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: var(--fw-regular);
  font-size: var(--fs-display);
  letter-spacing: var(--ls-tight);
  line-height: 1.1;
  color: var(--text-strong);
}
.lib__lead { margin: var(--space-3) 0 0; color: var(--text-muted); font-size: var(--fs-body); line-height: var(--lh-body); max-width: 60ch; }

/* --- Section tabs (Qur'an / Poetry) — a segmented control: one filled
   segment makes the active section unmistakable, and switching visibly
   moves the fill from one to the other. --- */
.lib-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: var(--space-6);
  padding: 5px;
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: 999px;
}
.lib-tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: var(--space-2) var(--space-5);
  border-radius: 999px;
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
  letter-spacing: var(--ls-tight);
  line-height: 1.2;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--dur) var(--ease-calm), background var(--dur) var(--ease-calm);
}
.lib-tab:hover { color: var(--text-strong); }
.lib-tab.is-active,
.lib-tab.is-active:hover { color: #fff; background: var(--accent); }

.lib-panel[hidden] { display: none; }

/* --- Qur'an: the 114 surahs as rows; two columns on wide screens to cut scroll --- */
.surah-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-2) var(--space-5); }
@media (min-width: 760px) { .surah-grid { grid-template-columns: 1fr 1fr; } }
.surahrow {
  display: flex;
  align-items: stretch;
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-container);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease-calm), box-shadow var(--dur) var(--ease-calm);
}
.surahrow:hover { border-color: var(--border-strong); box-shadow: var(--shadow-raised); }
.surahrow__main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  text-decoration: none;
}
/* The "Present" action — shared by the Qur'an surah rows and the Poetry rows so
   the headline action reads identically across both sections. A contained,
   outlined indigo pill (a control, not a full-height band) that fills on hover,
   so it's clearly tied to its own row and distinct from the solid nav tab. */
.surahrow__present,
.poemrow__present {
  flex-shrink: 0;
  align-self: center;                 /* contained, not stretched full height */
  margin-right: var(--space-5);       /* sit inside the card, off the edge */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--space-2) var(--space-4);
  border: var(--bw-hair) solid var(--accent);
  border-radius: var(--radius-control);
  font-family: var(--font-ui);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
  color: var(--accent);
  background: transparent;
  text-decoration: none;
  transition: color var(--dur) var(--ease-calm), background var(--dur) var(--ease-calm),
              border-color var(--dur) var(--ease-calm);
}
.surahrow__present svg,
.poemrow__present svg { width: 15px; height: 15px; flex-shrink: 0; }
.surahrow__present:hover,
.poemrow__present:hover { color: #fff; background: var(--accent); border-color: var(--accent); }
.surahrow__present:active,
.poemrow__present:active { background: var(--accent-press); border-color: var(--accent-press); }
.surahrow__num {
  flex-shrink: 0;
  width: 32px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: var(--fs-body-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.surahrow__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.surahrow__name {
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
  letter-spacing: var(--ls-tight);
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.surahrow__meaning {
  font-family: var(--font-ui);
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.surahrow__arabic {
  flex-shrink: 0;
  font-family: var(--font-serif);
  font-size: var(--fs-h2);
  color: var(--text-strong);
}
.surahrow__count {
  flex-shrink: 0;
  width: 84px;
  text-align: right;
  font-family: var(--font-ui);
  font-size: var(--fs-caption);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 600px) {
  .surahrow__count { display: none; }
  .surahrow__main { padding-left: var(--space-4); padding-right: var(--space-4); }
  .surahrow__present span { display: none; }
  .surahrow__present { padding: 0 var(--space-3); }
}

/* --- Surah reading: centred header (Arabic name + transliteration · meaning) --- */
.seclink { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-ui); font-size: var(--fs-body-sm); color: var(--accent); text-decoration: none; }
.seclink svg { width: 14px; height: 14px; }
.seclink:hover { color: var(--accent-press); }
.surah-head { text-align: center; margin-bottom: var(--space-6); }
.surah-present-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-4);
  padding: var(--space-2) var(--space-5);
  font-family: var(--font-ui);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius-control);
  text-decoration: none;
  transition: background var(--dur) var(--ease-calm);
}
.surah-present-btn svg { width: 15px; height: 15px; }
.surah-present-btn:hover { background: var(--accent-press); }
.surah-head__eyebrow {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--text-faint);
}
.surah-head__arabic {
  margin: var(--space-3) 0 var(--space-2);
  font-family: "Amiri Quran", var(--font-serif);
  font-weight: var(--fw-regular);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  line-height: 1.5;
  color: var(--text-strong);
}
.surah-head__name {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--fs-h2);
  letter-spacing: var(--ls-tight);
  color: var(--text-strong);
}
.surah-head__meaning { color: var(--text-muted); }
.surah-head__facts { margin: var(--space-2) 0 0; font-family: var(--font-ui); font-size: var(--fs-body-sm); color: var(--text-faint); }

/* --- Surah reading: prev / index / next nav --- */
.surah-nav {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
  margin: var(--space-6) 0;
}
.surah-nav__btn,
.surah-nav__index {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-container);
  text-decoration: none;
  color: var(--text-body);
  font-family: var(--font-ui);
  font-size: var(--fs-body-sm);
  transition: border-color var(--dur) var(--ease-calm), box-shadow var(--dur) var(--ease-calm);
}
.surah-nav__btn { flex: 1; min-width: 0; }
.surah-nav__btn--next { justify-content: flex-end; text-align: right; }
.surah-nav__index { flex-shrink: 0; color: var(--accent); }
.surah-nav__btn:hover,
.surah-nav__index:hover { border-color: var(--border-strong); box-shadow: var(--shadow-raised); }
.surah-nav__btn.is-empty { flex: 1; background: none; border: 0; box-shadow: none; pointer-events: none; }
.surah-nav__btn svg,
.surah-nav__index svg { width: 18px; height: 18px; flex-shrink: 0; }
.surah-nav__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.surah-nav__dir { font-size: var(--fs-caption); color: var(--text-faint); }
.surah-nav__name { font-family: var(--font-serif); color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) {
  .surah-nav__index { padding-left: var(--space-3); padding-right: var(--space-3); }
  .surah-nav__index span, .surah-nav__dir { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* --- Surah reading page: toggles, verses, tajweed --- */
.verse-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-6);
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-container);
  font-family: var(--font-ui);
  font-size: var(--fs-body-sm);
  color: var(--text-body);
}
.verse-toggles label { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.verse-toggles input { accent-color: var(--accent); }

/* Amiri Quran — a Quran-grade Naskh designed for the COMPLETE Uthmani text with
   correct positioning of every annotation mark (the small-high signs like U+06DF,
   dagger-alef, etc.). Self-hosted. We switched to it from KFGQPC Uthmanic Hafs
   V18, which couldn't position several of those marks and drew dotted-circle
   placeholders. See PROJECT_BRAIN "Qur'an verses". */
@font-face {
  font-family: "Amiri Quran";
  src: url("../fonts/quran/AmiriQuran-Regular.woff2") format("woff2");
  font-display: swap;
}

.verse-bismillah {
  margin: 0 0 var(--space-6);
  font-family: "Amiri Quran", var(--font-serif);
  font-size: var(--fs-h1);
  line-height: 2.2;
  text-align: center;
  color: var(--text-strong);
}

.verse-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.verse {
  padding: var(--space-5);
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-container);
}
.verse__num {
  display: inline-block;
  margin-bottom: var(--space-3);
  font-family: var(--font-ui);
  font-size: var(--fs-caption);
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.verse__arabic {
  margin: 0;
  font-family: "Amiri Quran", var(--font-serif);
  font-size: var(--fs-display);
  line-height: 2.4;
  color: var(--text-strong);
  text-align: right;
}
/* The end-of-ayah ornament (۝ + number). Amiri draws it a touch wide; squeeze
   it horizontally so it reads as a round medallion. */
.verse__end { display: inline-block; transform: scaleX(0.78); transform-origin: center; }
.verse__translit {
  margin: var(--space-4) 0 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-muted);
}
.verse__translation {
  margin: var(--space-5) 0 0;
  font-family: var(--font-serif);
  font-size: var(--fs-body-lg);
  line-height: var(--lh-reading);
  color: var(--text-body);
}

/* Tajweed colour map (conventional palette). Applied to <tajweed class="..."> spans
   that the API returns inside text_tajweed; shown only when Tajweed is toggled on. */
.verse__tajweed tajweed { color: inherit; }
.verse__tajweed tajweed.ham_wasl,
.verse__tajweed tajweed.slnt,
.verse__tajweed tajweed.laam_shamsiyah { color: #AAAAAA; }
.verse__tajweed tajweed.madda_normal { color: #537FFF; }
.verse__tajweed tajweed.madda_permissible { color: #4050FF; }
.verse__tajweed tajweed.madda_necessary,
.verse__tajweed tajweed.madda_obligatory { color: #000EBC; }
.verse__tajweed tajweed.qalqalah { color: #DD0008; }
.verse__tajweed tajweed.ikhafa,
.verse__tajweed tajweed.ikhafa_shafawi { color: #9400A8; }
.verse__tajweed tajweed.idgham_ghunnah,
.verse__tajweed tajweed.idgham_with_ghunnah,
.verse__tajweed tajweed.idgham_wo_ghunnah,
.verse__tajweed tajweed.idgham_shafawi { color: #169777; }
.verse__tajweed tajweed.iqlab { color: #26BFFD; }
.verse__tajweed tajweed.ghunnah { color: #FF7E1E; }

/* --- Filter bar --- */
.lib-filter {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
.lib-search { position: relative; flex: 1; min-width: 240px; }
.lib-search input { width: 100%; height: 44px; }
.lib-sort { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--fs-body-sm); color: var(--text-muted); }
.lib-count { margin-left: auto; font-size: var(--fs-body-sm); color: var(--text-faint); white-space: nowrap; }
.lib-topic { position: relative; min-width: 200px; }
.lib-topic input { height: 44px; }
/* Type pill filter sits on its own line beneath the search row. */
.lib-types { margin-bottom: var(--space-6); }

/* --- Recitation list: two-column grid of compact cards (mirrors the Qur'an
   surah grid), each with a trailing coloured Present button. --- */
.lib-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-2) var(--space-5); }
@media (min-width: 760px) { .lib-grid { grid-template-columns: 1fr 1fr; } }

.poemrow {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-container);
  transition: border-color var(--dur) var(--ease-calm), box-shadow var(--dur) var(--ease-calm);
}
.poemrow:hover { border-color: var(--border-strong); box-shadow: var(--shadow-raised); }
/* When a row's ⋯ menu is open, lift it above later cards so the dropdown
   (which escapes the card — no overflow clip here) isn't covered. */
.poemrow:has(.row-menu.is-open) { z-index: 30; }

/* Content area = the Read link. Two rows: head (topic · title) and sub
   (snippet · date). */
.poemrow__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
}
.poemrow__head { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.poemrow__topic { flex-shrink: 0; }              /* pill hugs content, inline before title */
/* Type tag — accent-tinted, so the poetic form reads distinct from the topic. */
.poemrow__type {
  flex-shrink: 0;
  background: var(--accent-tint-weak);
  border-color: var(--accent-tint-border);
  color: var(--accent);
}
.poemrow__title {
  margin: 0;
  min-width: 0;
  font-family: var(--font-serif);
  font-weight: var(--fw-regular);
  font-size: var(--fs-h3);
  letter-spacing: var(--ls-tight);
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.poemrow__sub { display: flex; align-items: baseline; gap: var(--space-3); min-width: 0; }
.poemrow__snippet {
  flex: 1;
  min-width: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.poemrow__date {
  flex-shrink: 0;
  margin-left: auto;            /* pin the date to the right when there's no snippet */
  font-family: var(--font-ui);
  font-size: var(--fs-caption);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
/* The ⋯ menu sits between the content and the Present button. */
.poemrow__menu { display: inline-flex; align-items: center; flex-shrink: 0; padding-right: var(--space-2); }
.poemrow__menu .row-menu__btn { border-color: transparent; background: transparent; }
/* --- Row overflow menu (the "⋯" trigger + dropdown on library and saved-list
   rows). Shared with the Lists hub; opened/closed by static/js/row-menu.js.
   Keeps secondary/owner actions (Add to list, Edit, Delete) out of the row so
   only Read + Present compete for attention. --- */
.row-menu { position: relative; display: inline-flex; }
.row-menu__btn { padding-left: var(--space-3); padding-right: var(--space-3); }
.row-menu__btn svg { width: 18px; height: 18px; }
.row-menu__panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 188px;
  z-index: 20;                 /* above the stretched row link + actions */
  display: none;
  flex-direction: column;
  padding: var(--space-2);
  background: var(--surface-raised);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-control-lg);
  box-shadow: var(--shadow-pop);
}
.row-menu.is-open .row-menu__panel { display: flex; }
.row-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 0;
  background: transparent;
  border-radius: var(--radius-control);
  color: var(--text-strong);
  font: inherit;
  font-size: var(--fs-body-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.row-menu__item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.row-menu__item:hover { background: var(--accent-tint-weak); }
/* Add-to-list "queued" state, shown inside the menu. */
.row-menu__item.act-add.is-in { color: var(--accent); }
/* Delete: quiet red, tinted on hover; solid red once armed (awaiting confirm). */
.row-menu__item.act-delete { color: #a23b34; }
.row-menu__item.act-delete:hover { background: rgba(162, 59, 52, 0.08); }
.row-menu__item.act-delete.is-armed { background: #a23b34; color: #fff; }
.row-menu__item.act-delete.is-armed svg { opacity: 1; }
@media (max-width: 600px) {
  /* icon-only Present on the narrowest screens, matching the surah rows */
  .poemrow__present span { display: none; }
  .poemrow__present { padding: 0 var(--space-3); }
}

.poemcard {
  display: flex;
  flex-direction: column;
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-container);
  transition: border-color var(--dur) var(--ease-calm), box-shadow var(--dur) var(--ease-calm);
}
.poemcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow-raised); }
.poemcard__body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); flex: 1; }
.poemcard__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.poemcard__date { font-family: var(--font-ui); font-size: var(--fs-caption); color: var(--text-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.poemcard__title { margin: 0; font-family: var(--font-serif); font-weight: var(--fw-regular); font-size: var(--fs-h2); letter-spacing: var(--ls-tight); line-height: var(--lh-heading); color: var(--text-strong); }
.poemcard__hint { margin: 0; font-family: var(--font-serif); font-style: italic; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--text-muted); text-wrap: pretty; }
.poemcard__meta { margin: 0; font-family: var(--font-ui); font-size: var(--fs-body-sm); color: var(--text-muted); }
.poemcard__by { color: var(--text-faint); }
.poemcard__count { margin-top: auto; font-family: var(--font-ui); font-size: var(--fs-caption); color: var(--text-faint); }
.poemcard__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: var(--bw-hair) solid var(--border-subtle);
}
.poemcard__actions .add-to-set { margin-left: auto; }

/* Topic tag (pill — a chip, so rounded is fine) */
.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  background: var(--surface-sunken);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  letter-spacing: 0.02em;
  color: var(--text-muted);
  white-space: nowrap;
}

.lib-empty { color: var(--text-muted); font-size: var(--fs-body); }
.lib-empty a { color: var(--accent-text); }

/* --- Form fields (editor.css isn't loaded on these pages, so define here) --- */
.field { display: flex; flex-direction: column; gap: var(--space-2); border: 0; padding: 0; margin: 0; }
.field__label {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--text-faint);
}
.field input,
.field textarea { width: 100%; }

/* --- Submission form --- */
.field__opt { font-weight: var(--fw-regular); letter-spacing: 0; text-transform: none; color: var(--text-faint); }
.save-meta { display: flex; flex-direction: column; gap: var(--space-4); margin: 0 0 var(--space-5); }
.submit-form { display: flex; flex-direction: column; gap: var(--space-5); }
.submit-form .field { margin: 0; }
.submit-poem { width: 100%; min-height: 240px; resize: vertical; line-height: var(--lh-reading); }
.form-error {
  margin: 0 0 var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--marker-tint);
  border: var(--bw-hair) solid var(--ember-600);
  border-left-width: 3px;
  color: var(--ember-700);
  font-size: var(--fs-body-sm);
}
.submit-done { padding: var(--space-7) 0; }
.submit-done h1 { margin: 0 0 var(--space-3); font-family: var(--font-serif); font-weight: var(--fw-regular); font-size: var(--fs-h1); color: var(--text-strong); }
.submit-done p { margin: 0 0 var(--space-5); color: var(--text-muted); line-height: var(--lh-body); max-width: 56ch; }
.submit-done .btn { margin-right: var(--space-2); }

/* --- Review queue (owner) --- */
.auth-note {
  margin: 0 0 var(--space-6);
  padding: var(--space-3) var(--space-4);
  background: var(--accent-tint-weak);
  border: var(--bw-hair) solid var(--accent-tint-border);
  border-left-width: 3px;
  color: var(--accent);
  font-size: var(--fs-body-sm);
}
.review-card {
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-container);
  margin-bottom: var(--space-5);
}
.review-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-5);
  border-bottom: var(--bw-hair) solid var(--border-subtle);
}
.review-card__head .poemcard__title { margin: var(--space-2) 0 var(--space-1); }
.review-card__actions { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.review-card__actions form { margin: 0; }
.review-preview {
  padding: var(--space-5) var(--space-6);
  max-height: 320px;
  overflow-y: auto;
}
.review-stanza { padding: var(--space-3) 0; }
.review-stanza + .review-stanza { border-top: var(--bw-hair) solid var(--border-subtle); }
.review-roman { margin: 0; font-family: var(--font-serif); font-size: var(--fs-body-lg); line-height: 1.65; color: var(--text-strong); }
.review-en { margin-top: var(--space-2); }
.review-en p { margin: 0; font-family: var(--font-serif); font-style: italic; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--text-muted); }

/* ============================================================
   Lists — the queue pill, the hub (queue + checkout + saved), the landing
   ============================================================ */

/* "+ List" toggle on rows / reading bar: tinted once the poem is queued. */
.poemrow__actions .act-add.is-in,
.act-add.is-in {
  color: var(--accent);
  background: var(--accent-tint-weak);
  border-color: var(--accent-tint-border);
}
/* --- Lists hub: stacked sections (queue / checkout / saved) --- */
.hub-section { margin-bottom: var(--space-8); }
.hub-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-3); }
.hub-section__title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: var(--fw-regular);
  font-size: var(--fs-h2);
  color: var(--text-strong);
}

/* Checkout panel: choose new vs existing, then a primary action. */
.checkout {
  margin-top: var(--space-5);
  padding: var(--space-5);
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-container);
}
.checkout__choice { border: 0; padding: 0; margin: 0 0 var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.checkout__choice legend { padding: 0; margin-bottom: var(--space-3); }
.checkout__opt { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--fs-body); color: var(--text-body); cursor: pointer; }
.checkout__opt input { accent-color: var(--accent); }

/* Settings page (/settings) — reuses .checkout as the card + .checkout__choice. */
.setting-card { max-width: 620px; }
.setting-card__hint { margin: var(--space-2) 0 var(--space-4); color: var(--text-muted); font-size: var(--fs-body-sm); line-height: var(--lh-body); }
.setting-modes { gap: var(--space-3); }
.setting-modes .checkout__opt { align-items: flex-start; font-size: var(--fs-body); line-height: var(--lh-body); }
.setting-modes .checkout__opt input { margin-top: 4px; flex-shrink: 0; }
.setting-modes .checkout__opt b { color: var(--text-strong); }
.checkout__panel { margin-bottom: var(--space-2); max-width: 520px; }

/* "Add to existing list" picker: filter on top, scrollable large rows, full-row
   click to select, with a created-date column. */
.listpick { display: flex; flex-direction: column; gap: var(--space-2); max-width: 520px; }
.listpick__filter { width: 100%; }
.listpick__rows {
  max-height: 320px;            /* fits ~5 large rows; scrolls beyond */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-container);
  background: var(--surface-card);
}
.listpick__row {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  width: 100%;
  text-align: left;
  padding: var(--space-4);
  background: transparent;
  border: 0;
  border-bottom: var(--bw-hair) solid var(--border-subtle);
  cursor: pointer;
  font: inherit;
  color: var(--text-body);
}
.listpick__row:last-child { border-bottom: 0; }
.listpick__row:hover { background: var(--surface-raised); }
.listpick__row.is-selected { background: var(--accent-tint-weak); box-shadow: inset 3px 0 0 var(--accent); }
.listpick__title { flex: 1; min-width: 0; font-family: var(--font-serif); font-size: var(--fs-h3); color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.listpick__count { flex-shrink: 0; font-family: var(--font-ui); font-size: var(--fs-body-sm); color: var(--text-muted); }
.listpick__date { flex-shrink: 0; width: 96px; text-align: right; font-family: var(--font-ui); font-size: var(--fs-caption); color: var(--text-faint); font-variant-numeric: tabular-nums; }
.listpick__empty { margin: 0; font-size: var(--fs-body-sm); color: var(--text-faint); }

/* Status line + small select (defined here so the hub doesn't load editor.css). */
.status { min-height: 1.3em; margin-top: var(--space-3); font-size: var(--fs-body-sm); color: var(--text-muted); }
.status--error { color: var(--marker); }
.status--ok { color: var(--accent); }
.select--sm { height: 32px; padding: 0 8px; font-size: var(--fs-body-sm); }
.btn.is-off { opacity: 0.4; pointer-events: none; }

/* List landing (/l/<slug>) */
.list-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-6); }
.list-pieces { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.list-piece {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-container);
}
.list-piece__n { flex-shrink: 0; width: 22px; text-align: center; font-family: var(--font-ui); font-size: var(--fs-caption); color: var(--text-faint); font-variant-numeric: tabular-nums; }
.list-piece__text { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: var(--space-3); }
.list-piece__title { font-family: var(--font-serif); font-size: var(--fs-h3); color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-piece__actions { display: flex; gap: var(--space-2); flex-shrink: 0; }

/* Queue / edit item rows on the hub (/lists) */
.builder-items { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-4) 0; }
.builder-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-card);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-container);
}
.builder-item.is-unavailable { opacity: 0.55; }
.builder-item__n { flex-shrink: 0; width: 20px; text-align: center; font-family: var(--font-ui); font-size: var(--fs-caption); color: var(--text-faint); font-variant-numeric: tabular-nums; }
.builder-item__text { flex: 1; min-width: 0; }
.builder-item__title { font-family: var(--font-serif); font-size: var(--fs-body-lg); color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.builder-item__flag { font-family: var(--font-ui); font-size: var(--fs-caption); color: var(--marker); }
.builder-item__controls { display: inline-flex; align-items: center; gap: var(--space-1); flex-shrink: 0; }
.builder-item__controls .icon-btn--small svg { width: 15px; height: 15px; }
.builder-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-5); }
.builder-actions .builder-actions__sp { flex: 1; }
