:root {
  --ink: #152e36;
  --ink-mid: #3a5560;
  --accent: #16746b;
  --accent-dark: #0f5851;
  --accent-soft: #e3f1ed;
  --amber: #c9731e;
  --amber-soft: #fbf0df;
  --coral: #be442b;
  --coral-soft: #fae4df;
  --paper: #f9f7f1;
  --bg: #eef2f0;
  --white: #ffffff;
  --border: #ccd8d6;
  --focus: #0b57d0;
  --radius: 10px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.muted {
  color: var(--ink-mid);
  font-size: 0.875rem;
}

.kicker {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}

/* --- Login View --- */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  width: min(440px, 100%);
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 6px solid var(--accent);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 12px 32px rgba(21, 46, 54, 0.08);
}

.login-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
}

.login-card .lead {
  margin: 0 0 1.5rem;
  color: var(--ink-mid);
}

/* --- Forms & Controls --- */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-block-end: 1rem;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

label {
  font-weight: 600;
  font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  font: inherit;
  font-size: max(1rem, 1em);
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid #8ea3a8;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  min-height: 44px;
}

textarea {
  resize: vertical;
  min-height: 84px;
}

input:user-invalid,
textarea:user-invalid,
select:user-invalid {
  border-color: var(--coral);
  background: #fff9f8;
}

input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--accent);
}

button, .ghost-btn, .primary-btn, .accent-btn, .danger-btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1.5px solid transparent;
}

.primary-btn {
  background: var(--accent);
  color: var(--white);
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.accent-btn {
  background: var(--amber-soft);
  color: #7c4209;
  border-color: #e4b67c;
}

.accent-btn:hover {
  background: #f5dfb8;
}

.danger-btn {
  background: var(--coral-soft);
  color: #8b2611;
  border-color: #e1a396;
}

.danger-btn:hover {
  background: #f4cdc5;
}

.ghost-btn {
  background: var(--white);
  color: var(--ink);
  border-color: var(--border);
}

.ghost-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.ghost-btn.small, .select-compact.small {
  min-height: 32px;
  padding: 0.2rem 0.6rem;
  font-size: 0.82rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  min-height: 28px;
  padding: 0 0.3rem;
  font-size: 0.84rem;
}

.full {
  width: 100%;
}

.error-banner {
  background: var(--coral-soft);
  color: #8b2611;
  border: 1px solid #e1a396;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
}

/* --- App Topbar --- */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--ink);
  color: var(--white);
  padding: 0.65rem 1.1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.topbar-left, .topbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.brand-mark {
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #b7e4da;
  font-size: 0.98rem;
  margin-inline-end: 0.35rem;
}

.select-compact {
  min-height: 36px;
  padding: 0.25rem 0.6rem;
  font-size: 0.88rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.policy-badge {
  background: #234955;
  color: #d6f1ea;
  border: 1px solid #3c707e;
}

.user-pill {
  font-size: 0.85rem;
  color: #d5e5e7;
  padding-inline: 0.4rem;
}

.segmented {
  display: inline-flex;
  background: #22444f;
  padding: 3px;
  border-radius: 9px;
}

.seg-btn {
  min-height: 34px;
  padding: 0.25rem 0.65rem;
  font-size: 0.82rem;
  background: transparent;
  color: #cfe3e5;
  border: none;
  border-radius: 6px;
}

.seg-btn.active {
  background: var(--white);
  color: var(--ink);
}

/* --- Preview Banner --- */
.preview-banner {
  background: var(--amber-soft);
  border-bottom: 2px solid #e4b67c;
  padding: 0.7rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.preview-actions {
  display: flex;
  gap: 0.5rem;
}

/* --- 3-Column Workspace --- */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 360px;
  min-height: 0;
}

.page-sidebar {
  background: var(--white);
  border-inline-end: 1px solid var(--border);
  padding: 1rem 0.75rem;
  overflow-y: auto;
  max-height: calc(100vh - 64px);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-block-end: 0.6rem;
  padding-inline: 0.35rem;
}

.sidebar-header h2, .panel-header h2 {
  margin: 0;
  font-size: 1rem;
}

.page-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.page-nav-btn {
  width: 100%;
  justify-content: space-between;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  padding: 0.45rem 0.55rem;
  min-height: 36px;
  font-size: 0.84rem;
  font-weight: 500;
}

.page-nav-btn:hover {
  background: var(--accent-soft);
}

.page-nav-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 700;
}

.page-nav-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.count-pill {
  background: var(--amber);
  color: var(--white);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.08rem 0.45rem;
  min-width: 1.35rem;
  text-align: center;
}

/* --- Center Reader --- */
.reader-main {
  padding: 1.1rem 1.4rem 2.5rem;
  overflow-y: auto;
  max-height: calc(100vh - 64px);
}

.reader-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-block-end: 1rem;
}

.reader-nav-btns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-indicator {
  font-weight: 700;
  font-size: 0.92rem;
  min-width: 96px;
  text-align: center;
}

.reader-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-mid);
}

.reader-grid {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

.reader-grid.mode-blocks {
  grid-template-columns: minmax(0, 720px);
  justify-content: center;
}

.reader-grid.mode-pdf {
  grid-template-columns: minmax(0, 660px);
  justify-content: center;
}

.reader-grid.mode-split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Archival Booklet Page Sheet */
.book-sheet {
  background: var(--paper);
  border: 1px solid #d9d3c3;
  border-radius: 12px;
  padding: 2rem 2.2rem;
  box-shadow: 0 8px 24px rgba(21, 46, 54, 0.08);
}

.book-sheet.is-cover {
  border-top: 12px solid var(--accent);
}

.sheet-title {
  margin: 0.2rem 0 0.75rem;
  font-size: 1.85rem;
  line-height: 1.18;
  color: var(--ink);
}

.sheet-subtitle {
  margin: 0 0 1.25rem;
  font-size: 1.15rem;
  color: var(--accent);
  font-weight: 500;
}

.block-card {
  position: relative;
  border: 1.5px solid transparent;
  border-radius: 9px;
  padding: 0.65rem 0.75rem;
  margin-block-end: 0.55rem;
  cursor: text;
  user-select: text;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.block-meta-bar {
  cursor: pointer;
  user-select: none;
}

/* Floating Selection Toolbar */
.selection-toolbar {
  position: fixed;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.45rem;
  background: var(--ink);
  border: 1px solid #355d6d;
  border-radius: 10px;
  box-shadow: 0 10px 26px rgba(15, 34, 41, 0.28);
}

/* CSS Custom Highlight API (with accessible contrast & underline indicator) */
::highlight(commented-excerpts) {
  background-color: #f8e3ba;
  color: #152e36;
  text-decoration: underline dotted #b56515;
}

::highlight(active-selection) {
  background-color: #ffd98a;
  color: #152e36;
  text-decoration: underline solid #16746b;
}

mark.excerpt-mark {
  background-color: #f8e3ba;
  color: #152e36;
  text-decoration: underline dotted #b56515;
  padding: 0 2px;
  border-radius: 3px;
}

mark.excerpt-mark-active {
  background-color: #ffd98a;
  color: #152e36;
  text-decoration: underline solid #16746b;
  padding: 0 2px;
  border-radius: 3px;
}

.block-card:hover {
  background: rgba(22, 116, 107, 0.06);
  border-color: #9ec8c2;
}

.block-card.selected {
  background: #e6f4f0;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(22, 116, 107, 0.18);
}

.block-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-block-end: 0.25rem;
  font-size: 0.74rem;
  color: var(--ink-mid);
}

.block-id-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  color: #54707a;
}

.block-paragraph {
  margin: 0;
  font-size: 1rem;
  line-height: 1.62;
  white-space: pre-line;
}

.block-subheading {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--accent);
}

.block-question {
  background: #eef6f4;
  border-inline-start: 4px solid var(--accent);
  padding: 0.75rem 0.9rem;
  border-radius: 6px;
}

.block-question .q-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin: 0 0 0.25rem;
}

.block-question p {
  margin: 0;
  font-weight: 700;
  font-size: 0.98rem;
}

.block-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.block-figure figcaption {
  margin-top: 0.45rem;
  font-size: 0.84rem;
  color: var(--ink-mid);
}

.rendered-sheet {
  margin: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  box-shadow: 0 8px 24px rgba(21, 46, 54, 0.08);
}

.rendered-sheet img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  border: 1px solid #e3e8e6;
}

.rendered-sheet figcaption {
  margin-top: 0.5rem;
  text-align: center;
}

/* --- Right Feedback Panel --- */
.feedback-panel {
  background: var(--white);
  border-inline-start: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.comment-composer {
  background: #f5f8f7;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
}

.target-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.86rem;
  margin-block-end: 0.35rem;
}

.target-excerpt {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  color: var(--ink-mid);
  background: var(--white);
  border-inline-start: 3px solid var(--accent);
  padding: 0.35rem 0.55rem;
  border-radius: 4px;
}

.category-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 0.75rem;
}

.category-fieldset legend {
  font-weight: 600;
  font-size: 0.84rem;
  margin-block-end: 0.35rem;
}

.radio-pills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem;
}

.radio-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.35rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.comment-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: var(--white);
}

.comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-block-end: 0.35rem;
}

.comment-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.status-open { background: #e8eef5; color: #244a72; }
.status-approved { background: var(--accent-soft); color: #0e544d; }
.status-addressed { background: #dff1e1; color: #195d27; }
.status-declined { background: #efefef; color: #555; }
.status-conflict { background: var(--coral-soft); color: #8b2611; }
.status-in_progress { background: var(--amber-soft); color: #7c4209; }

.cat-badge {
  background: #f0f3f4;
  color: var(--ink);
  text-transform: uppercase;
  font-size: 0.7rem;
}

.comment-body {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.92rem;
  white-space: pre-wrap;
}

.comment-meta {
  font-size: 0.78rem;
  color: var(--ink-mid);
}

.agent-note-box {
  margin-top: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: #eff8f1;
  border-inline-start: 3px solid #2b8a3e;
  border-radius: 5px;
  font-size: 0.84rem;
}

.triage-actions {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* --- Native Modal Dialog (Modern Web Guidance compliant) --- */
dialog {
  padding: 0;
  border: none;
  border-radius: 14px;
  width: min(860px, calc(100vw - 2rem));
  max-height: calc(100vh - 2.5rem);
  box-shadow: 0 24px 64px rgba(10, 26, 32, 0.35);
  background: var(--bg);
  color: var(--ink);
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(15, 34, 41, 0.55);
  backdrop-filter: blur(2px);
  overflow: hidden;
  overscroll-behavior: contain;
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2.5rem);
}

.dialog-header {
  background: var(--ink);
  color: var(--white);
  padding: 1rem 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-header h1 {
  margin: 0;
  font-size: 1.2rem;
}

.dialog-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
}

.admin-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.admin-card h3 {
  margin: 1rem 0 0.45rem;
  font-size: 0.92rem;
  color: var(--ink-mid);
}

.policy-fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  margin: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.policy-fieldset legend {
  font-weight: 700;
  padding-inline: 0.35rem;
}

.policy-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: #fafcfb;
  cursor: pointer;
}

.policy-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.policy-option span {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.policy-option small {
  font-weight: 400;
  color: var(--ink-mid);
  line-height: 1.4;
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.status-inline {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent);
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.full-span {
  grid-column: 1 / -1;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.simple-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.simple-list li, .override-item, .preview-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.88rem;
}

.token-reveal {
  margin: 0.65rem 0 0;
  padding: 0.7rem 0.85rem;
  background: #142a31;
  color: #dff5ee;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 180px minmax(0, 1fr) 310px;
  }
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .page-sidebar, .reader-main, .feedback-panel {
    max-height: none;
    border: none;
  }
  .grid-form {
    grid-template-columns: 1fr;
  }
}

/* --- Right Panel Tabs & Book Requests --- */
.panel-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--paper-alt);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 0.75rem;
}

.panel-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-mid);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.panel-tab-btn.active {
  background: var(--white);
  color: var(--ink);
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(21, 46, 54, 0.08);
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 0;
  flex: 1;
}

.small-note {
  font-size: 0.8rem;
  margin: 0;
  line-height: 1.4;
}

.compact-dialog {
  max-width: 620px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
  margin-top: 0.25rem;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.status-preview_ready {
  background: #e9e4f8;
  color: #462c85;
}

.status-published {
  background: #d7f2ea;
  color: #105c4a;
}

.spinoff-bar {
  margin-top: 0.65rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.spinoff-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #e1f3ef;
  color: #0e594d;
  border: 1px solid #9bd1c5;
  border-radius: 999px;
  padding: 0.24rem 0.68rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.spinoff-link-btn:hover {
  background: #cdece5;
  border-color: #16746b;
}

.spinoff-pending-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #f5efe3;
  color: #6d4a13;
  border: 1px solid #dfcca5;
  border-radius: 999px;
  padding: 0.2rem 0.62rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

/* --- Go Deeper / Optional Micro-Glossary Cards --- */
.page-nav-pills {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.deep-dive-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45rem;
  height: 1.25rem;
  padding: 0 0.36rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 1px solid #b5dad2;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.deep-dives-section {
  margin-top: 1.35rem;
  padding-top: 1rem;
  border-top: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.deep-dives-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.15rem;
}

.deep-dives-eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-dark);
  text-transform: uppercase;
}

.deep-dives-hint {
  font-size: 0.78rem;
  color: var(--ink-mid);
}

.deep-dive-card {
  background: #f3f9f7;
  border: 1px solid #bfd9d3;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.deep-dive-card[open] {
  background: var(--white);
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(22, 116, 107, 0.08);
}

.deep-dive-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  user-select: none;
  font-weight: 650;
  font-size: 0.9rem;
  color: var(--ink);
}

.deep-dive-summary::-webkit-details-marker {
  display: none;
}

.deep-dive-summary:hover {
  background: rgba(22, 116, 107, 0.06);
}

.deep-dive-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
}

.deep-dive-title {
  flex: 1;
}

.deep-dive-chevron {
  font-size: 0.9rem;
  color: var(--accent-dark);
  transition: transform 0.16s ease;
}

.deep-dive-card[open] .deep-dive-chevron {
  transform: rotate(180deg);
}

.deep-dive-body {
  padding: 0.25rem 0.95rem 0.85rem 2.75rem;
  border-top: 1px solid #e1efec;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.deep-dive-question {
  margin: 0.35rem 0 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent-dark);
}

.deep-dive-answer {
  margin: 0.25rem 0 0;
  font-size: 0.89rem;
  line-height: 1.55;
  color: var(--ink);
}

.deep-dive-source {
  margin: 0.2rem 0 0;
  font-size: 0.79rem;
  color: var(--ink-mid);
}

.deep-dive-link {
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.deep-dive-link:hover {
  color: var(--accent);
}

/* --- Topbar Reader Group & Dashboard Nav --- */
.topbar-reader-group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.topbar-reader-group[hidden] {
  display: none;
}

.active-nav {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
}

/* --- Reviewer & Catalog Dashboard (Modern Web Guidance Card Grid) --- */
.dashboard-shell {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dashboard-shell[hidden] {
  display: none;
}

.dashboard-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.dashboard-header h1 {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.65rem;
  color: var(--ink);
}

.dashboard-header .muted {
  margin: 0;
}

.dashboard-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.dash-filter-btn {
  border: none;
  background: transparent;
  color: var(--ink-mid);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.4rem 0.72rem;
  border-radius: 7px;
  cursor: pointer;
}

.dash-filter-btn.active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 34, 41, 0.12);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
  gap: 1.25rem;
  align-items: stretch;
}

.book-card-wrap {
  container-type: inline-size;
  display: flex;
}

.book-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(15, 34, 41, 0.05);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.book-card:hover {
  transform: translateY(-2px);
  border-color: #9ec8bf;
  box-shadow: 0 10px 26px rgba(15, 34, 41, 0.1);
}

.book-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #102a31 0%, #194d4c 60%, #16746b 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.book-card-placeholder {
  color: #e6f4f0;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 1rem;
  text-align: center;
  letter-spacing: 0.03em;
}

.book-card-edition-chip {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  background: rgba(15, 34, 41, 0.84);
  color: #f0f9f7;
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.book-card-status-chip {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.book-card-status-chip.status-not-started {
  background: #edf2f4;
  color: #2f4b54;
}

.book-card-status-chip.status-in-progress {
  background: #fff2d6;
  color: #7c4d03;
}

.book-card-status-chip.status-completed {
  background: #d7f2ea;
  color: #0e5a49;
}

.book-card-body {
  padding: 1rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
}

.book-card-title {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.3;
  color: var(--ink);
}

.book-card-subtitle {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--ink-mid);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card-progress {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.35rem;
}

.book-card-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--ink-mid);
}

.progress-track {
  width: 100%;
  height: 7px;
  background: #e6eeef;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.book-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid #ecf2f3;
}

.book-card-metrics {
  font-size: 0.78rem;
  color: var(--ink-mid);
}

.dashboard-empty {
  background: var(--white);
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.dashboard-empty h2 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

/* --- Superadmin Book Assignments UI --- */
.assign-fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  background: #fafcfb;
  margin: 0;
}

.assign-fieldset legend {
  font-weight: 700;
  font-size: 0.86rem;
  padding-inline: 0.35rem;
  color: var(--ink);
}

.assign-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.assign-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.35rem 0.75rem;
}

.assign-checkbox-grid.is-disabled {
  opacity: 0.52;
  pointer-events: none;
}

.user-assign-list li {
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
}

.user-row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.user-assign-details {
  border-top: 1px dashed var(--border);
  padding-top: 0.45rem;
}

.user-assign-details summary {
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--accent-dark);
  user-select: none;
  -webkit-user-select: none;
}

.user-assign-editor {
  margin-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: #f7faf9;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}

/* --- Superadmin Drag-and-Drop Book Order (Modern Web Guidance Pattern) --- */
.admin-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.order-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  position: relative;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: box-shadow 0.14s ease, border-color 0.14s ease;
}

.order-item:hover {
  border-color: #a9ccc5;
}

.order-item[data-dragging] {
  position: relative;
  z-index: 4;
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(15, 34, 41, 0.18);
  background: #f5fbf9;
}

.order-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #f5f8f8;
  color: var(--ink-mid);
  font-size: 1rem;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.order-drag-handle:active,
.order-item[data-dragging] .order-drag-handle {
  cursor: grabbing;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: var(--accent);
}

.order-position {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  background: var(--paper-alt);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.order-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.order-item-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-item-slug {
  font-size: 0.76rem;
  color: var(--ink-mid);
}

.order-move-btns {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Drop target insertion indicator (Modern Web Guidance drag-and-drop) */
.order-list[data-drop]::after {
  content: '';
  position: fixed;
  pointer-events: none;
  z-index: 6;
  left: var(--drop-x, 0px);
  top: var(--drop-y, 0px);
  width: var(--drop-w, 0px);
  height: var(--drop-h, 3px);
  background: var(--accent);
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(22, 116, 107, 0.2);
}

@media (prefers-reduced-motion: reduce) {
  .book-card,
  .order-item,
  .progress-fill {
    transition: none;
  }
}
