/* Case Law Sources — reading room palette
   Warm parchment/paper neutrals for reading; steel blue for interaction only;
   gold reserved for commerce (buy). */
@import url("https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap");

:root {
  /* Ink on paper — warm charcoal, not blue-slate */
  --ink: #1c1917;
  --ink-soft: #44403c;
  --parchment: #f0ebe2;
  --paper: #faf7f2;
  /* Footnote / marginalia gray — stone, not UI chrome */
  --muted: #78716c;
  --border: #ddd8d3;
  /* Steel blue — links, buttons, focus, quote rules only */
  --accent: #2f5f8a;
  --accent-hover: #244a6c;
  --accent-dark: #244a6c;
  --highlight: #3d6d8c;
  /* Filled CTAs — darker than --accent so white labels stay readable */
  --btn-primary: #1e4a73;
  --btn-primary-hover: #16375a;
  --btn-on-primary: #fff;
  --victory-gold: #a67c2a;
  --victory-gold-hover: #8c6820;
  --control-idle: #8b7355;
  --control-idle-hover: #7a6549;
  /* Anchor hit vs expanded context segments */
  --quote-context-rule: #b8aea3;
  --quote-anchor-rule: #8b5e34;
  --quote-anchor-bg: rgba(139, 94, 52, 0.07);
  --shadow: none;
  --ui: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Lamp at the desk — warm dark paper, not IDE gray */
    --ink: #f5f0e8;
    --ink-soft: #d6cfc4;
    --parchment: #1a1814;
    --paper: #242019;
    --muted: #a8a29e;
    --border: #3d3830;
    --accent: #6b9ec4;
    --accent-hover: #8bb4d4;
    --accent-dark: #8bb4d4;
    --highlight: #7eb0d6;
    --btn-primary: #1e4a73;
    --btn-primary-hover: #16375a;
    --btn-on-primary: #fff;
    --victory-gold: #d4a84b;
    --victory-gold-hover: #e0b85c;
    --control-idle: #9a8468;
    --control-idle-hover: #b09878;
    --quote-context-rule: #5c5348;
    --quote-anchor-rule: #c49a5c;
    --quote-anchor-bg: rgba(196, 154, 92, 0.1);
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

/* Ranked buttons use display:inline-flex; keep the HTML hidden attribute clerkitative
   so Never mind (and other toggled controls) truly disappear when not recording. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.125rem;
  background: var(--parchment);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100vh;
}

body.desk-mode {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

body.desk-mode .site-main {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 1.5rem;
}

.site-header {
  padding: 2rem 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  max-width: 52rem;
  margin: 0 auto;
}

.site-header.desk-header {
  padding: 0.85rem 1.5rem 0.75rem;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.account-gear {
  flex-shrink: 0;
  margin-left: auto;
  padding: 0.35rem;
  color: var(--ink);
  border-radius: 0.4rem;
  line-height: 0;
}

.account-gear:hover,
.account-gear:focus-visible {
  color: var(--accent, #2a4a6e);
  background: color-mix(in srgb, var(--border) 45%, transparent);
  outline: none;
}

.site-header-notice {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.78rem;
  line-height: 1.4;
  max-width: 28rem;
}

.header-links {
  margin: 0;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.site-header.desk-header .site-title {
  font-size: clamp(1.35rem, 3vw, 1.65rem);
}

.site-header.desk-header .brand-mark {
  width: 32px;
  height: 32px;
}

.header-links a {
  font-size: 1.05rem;
  font-family: var(--ui);
  color: var(--accent);
  text-decoration: none;
}

.header-links a:hover,
.header-links a:focus-visible {
  text-decoration: underline;
}

a.brand-home {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
}

a.brand-home:hover .site-title,
a.brand-home:focus-visible .site-title {
  color: var(--accent);
}

a.brand-home:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  border-radius: 8px;
  flex-shrink: 0;
}

.site-title {
  margin: 0;
  font-family: var(--ui);
  font-size: clamp(1.9rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.site-release-badge {
  margin-left: 0.35rem;
  font-size: 0.42em;
  font-weight: 400;
  font-style: normal;
  color: var(--muted);
  letter-spacing: 0.02em;
  vertical-align: super;
  line-height: 1;
  white-space: nowrap;
}

.site-tagline {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 36rem;
}

.site-nav, .auth-nav {
  margin-top: 0.85rem;
  font-family: var(--ui);
  font-size: 1rem;
}

.site-nav a, .auth-nav a {
  color: var(--accent);
  margin-right: 1rem;
  text-decoration: none;
}

.site-nav a:hover, .auth-nav a:hover { text-decoration: underline; }

.auth-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.auth-status { color: var(--muted); font-size: 0.85rem; }

.logout-form button, .context-btn, button.primary, button.secondary {
  font-family: var(--ui);
  cursor: pointer;
}

.site-main {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Landing */
.landing {
  padding: 1.5rem 0 2.5rem;
  animation: rise 0.55s ease-out;
}

.site-header.landing-header {
  padding-bottom: 1rem;
  border-bottom: none;
}

.landing-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem 1.75rem;
  box-shadow: 0 1px 0 rgba(28, 25, 23, 0.04);
}

.landing-brand {
  font-family: var(--ui);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.landing-headline {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  max-width: 18ch;
}

.landing-support {
  margin: 1rem 0 0;
  color: var(--ink-soft);
  font-size: 1.1rem;
  max-width: 38rem;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
  font-family: var(--ui);
}

/* r[impl tenant.case_law.ui.control_language] */
button.primary,
a.primary,
a.cta-signin,
a.cta-library {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-family: var(--ui);
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.2;
  min-height: 44px;
  padding: 0.7rem 1.35rem;
  border: none;
  border-radius: 6px;
  background: var(--btn-primary);
  color: var(--btn-on-primary) !important;
  text-decoration: none !important;
  cursor: pointer;
  box-shadow: var(--shadow);
}

button.primary:hover,
a.primary:hover,
a.cta-signin:hover,
a.cta-library:hover {
  background: var(--btn-primary-hover);
  color: var(--btn-on-primary) !important;
  text-decoration: none !important;
}

button.secondary,
a.button.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-family: var(--ui);
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1.2;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

button.secondary:hover,
a.button.secondary:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  text-decoration: none;
}

a.secondary {
  display: inline-block;
  padding: 0.75rem 1.1rem;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--ui);
  font-weight: 500;
}

a.dev-login {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  color: var(--accent);
  text-decoration: none !important;
  font-family: var(--ui);
  font-weight: 600;
}

a.dev-login:hover {
  background: rgba(30, 58, 95, 0.06);
}

.landing-meta {
  margin: 1.5rem 0 0;
  font-family: var(--ui);
  font-size: 0.95rem;
}

.landing-meta a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Quota footer — always visible at bottom of desk */
.quota-footer {
  flex-shrink: 0;
  background: var(--paper);
  border-top: 1px solid var(--border);
  padding: 0.35rem 1.5rem 0.45rem;
  max-width: none;
  margin: 0;
}

.quota-footer-inner {
  max-width: 52rem;
  margin: 0 auto;
  font-family: var(--ui);
}

.quota-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  font-size: 0.78rem;
  min-width: 0;
}

.footer-link {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-family: var(--ui);
}

.footer-link:hover {
  color: var(--ink-soft);
}

.footer-link-muted {
  opacity: 0.45;
  text-decoration: underline;
  cursor: default;
}

.quota-footer-bar .quota-pct {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.quota-bar {
  height: 0.3rem;
  background: color-mix(in srgb, var(--border) 55%, var(--paper));
  border-radius: 4px;
  overflow: hidden;
}

.quota-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.quota-upgrade {
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Search */
.query-form label {
  display: block;
  font-family: var(--ui);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.query-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.query-form-header label {
  margin-bottom: 0;
}

a.view-library {
  font-family: var(--ui);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

a.view-library:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.query-form textarea {
  width: 100%;
  min-height: 9.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  resize: vertical;
}

.dictation {
  margin-top: 0.65rem;
}

.dictation-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

button.dictation-start:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.dictation-status {
  margin: 0.35rem 0 0;
  font-family: var(--ui);
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.2em;
}

.query-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin-top: 1rem;
}

/* Search scope segmented control: All results vs Rhetorical Contours™
   Segmented secondary — 6px / 44px / 1.2rem; selected is wash, not filled blue. */
.search-scope {
  display: inline-flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  margin: 0;
  padding: 0;
  min-inline-size: 0;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  font-family: var(--ui);
}

.search-scope-option {
  display: inline-flex;
  align-items: stretch;
  cursor: pointer;
  margin: 0;
}

.search-scope-option + .search-scope-option {
  border-left: 1px solid var(--border);
}

.search-scope-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.search-scope-option span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--accent);
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.search-scope-option:first-child span {
  border-radius: 5px 0 0 5px;
}

.search-scope-option:last-child span {
  border-radius: 0 5px 5px 0;
}

.search-scope-option input[type="radio"]:checked + span {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.search-scope-option input[type="radio"]:focus-visible + span {
  box-shadow: 0 0 0 2px var(--parchment), 0 0 0 4px var(--accent);
}

.search-scope-option input[type="radio"]:checked:focus-visible + span {
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 2px var(--parchment), 0 0 0 4px var(--accent);
}

.search-scope-option:hover input[type="radio"]:not(:checked) + span {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.search-scope-hint {
  margin: 0.55rem 0 0;
  font-family: var(--ui);
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted);
}

.htmx-indicator {
  opacity: 0;
  font-family: var(--ui);
  color: var(--muted);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
}
.htmx-request .htmx-indicator,
.htmx-indicator.htmx-request {
  opacity: 1;
}

.search-pending-indicator {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.55rem;
  max-width: 100%;
}

.search-spinner {
  display: inline-block;
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  border: 2px solid var(--rule, #ccc);
  border-top-color: var(--accent, #8b4513);
  border-radius: 50%;
  animation: search-spin 0.7s linear infinite;
}

@keyframes search-spin {
  to {
    transform: rotate(360deg);
  }
}

.search-pending-label {
  font-family: var(--ui);
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.45;
}

.search-wait-hint {
  margin: 0.55rem 0 0;
  font-family: var(--ui);
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted);
}

.research-block-pending .search-pending {
  margin: 0.75rem 0 0;
  display: flex;
  align-items: center;
}

.research-block-pending .search-pending,
.search-timeout,
.search-unavailable {
  margin: 0;
  font-family: var(--ui);
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.5;
}

.research-block-pending .search-pending {
  margin-top: 0.75rem;
}

button.retry-search {
  margin-top: 0.75rem;
}

div.research-block-body {
  margin-top: 0.25rem;
}

.query-display {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.query-display-label {
  margin: 0 0 0.35rem;
  font-family: var(--ui);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.query-display-text {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.45;
  color: var(--ink);
}

.desk-workspace .follow-up {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.research-feed {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.research-block {
  position: relative;
  padding-top: 0.25rem;
}

.family-shape-panel {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--paper) 92%, var(--ink) 8%);
}

.family-shape-heading {
  margin: 0 0 0.6rem;
  font-family: var(--ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.family-shape-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .family-shape-columns {
    grid-template-columns: 1fr;
  }
}

.family-shape-col h4 {
  margin: 0 0 0.35rem;
  font-family: var(--ui);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.family-shape-expected h4 {
  color: color-mix(in srgb, var(--accent) 70%, var(--ink) 30%);
}

.family-shape-excluded h4 {
  color: var(--muted);
}

.family-shape-col ul {
  margin: 0;
  padding-left: 1.1rem;
  font-family: var(--ui);
  font-size: 0.88rem;
  line-height: 1.4;
}

.family-shape-col li {
  margin: 0.15rem 0;
}

.family-shape-empty {
  margin: 0;
  font-family: var(--ui);
  font-size: 0.85rem;
  color: var(--muted);
}

.search-results-slot {
  min-height: 2.5rem;
}

.toggle-deselect {
  position: absolute;
  bottom: 0.65rem;
  right: 0.75rem;
  padding: 0.15rem 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--ui);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.toggle-deselect:hover {
  color: var(--ink-soft);
}

.desk-deleted {
  opacity: 0.42;
  filter: grayscale(0.35);
}

.desk-deleted .toggle-deselect {
  color: var(--accent);
}

.desk-tail {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.copy-all-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  font-family: var(--ui);
}

button.reset-desk {
  margin-left: auto;
}

.results-meta { margin-bottom: 1.5rem; }
.query-echo { font-family: var(--ui); font-size: 1.05rem; }
.context-hint { color: var(--muted); font-size: 1rem; }
.empty-results {
  padding: 1.25rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--ink-soft);
}

.citation-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Citation slip */
.citation {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.35rem 1.45rem 2.35rem;
  animation: rise 0.4s ease-out;
}

.citation-layout {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.citation-main {
  flex: 1;
  min-width: 0;
}

.citation-sidebar {
  flex-shrink: 0;
  width: 4.5rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.citation-head h3 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

/* Citation text blocks — index-card paper */
.citation-text-block {
  padding: 1rem 1.1rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.citation-quote-flow {
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
}

.quote-block {
  display: block;
  border-left: 3px solid var(--quote-context-rule);
  padding: 0.15rem 0 0.15rem 0.75rem;
  margin-bottom: 0.35rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-soft);
}

.quote-block:last-child {
  margin-bottom: 0;
}

.quote-block-anchor {
  border-left-width: 4px;
  border-left-color: var(--quote-anchor-rule);
  background: var(--quote-anchor-bg);
  padding: 0.35rem 0 0.35rem 0.85rem;
  margin-top: 0.2rem;
  margin-bottom: 0.2rem;
  color: var(--ink);
  font-weight: 600;
}

.quote-block-boundary {
  border-left-color: var(--muted);
  color: var(--muted);
  font-style: italic;
  font-family: var(--ui);
  font-size: 0.95rem;
}

.expand-rail {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.expand-rail-heading {
  margin: 0 0 0.15rem;
  font-family: var(--ui);
  font-size: 0.62rem;
  line-height: 1.2;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: center;
}

.expand-rail-divider {
  height: 1px;
  background: var(--border);
  margin: 0.15rem 0;
}

.expand-btn {
  width: 100%;
  height: 2.1rem;
  padding: 0;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  font-family: var(--ui);
  border: none;
}

.expand-btn.expand-active {
  position: relative;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.expand-btn.expand-active:hover:not(:disabled) {
  background: var(--accent-hover);
}

.expand-btn.expand-active.htmx-request,
.expand-btn.expand-pending {
  opacity: 0.9;
  cursor: wait;
}

/* Center with margins so search-spin's transform: rotate does not fight translate. */
.expand-btn .expand-spinner {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.25rem;
  height: 1.25rem;
  margin: -0.625rem 0 0 -0.625rem;
  box-sizing: border-box;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 1;
  pointer-events: none;
  animation: search-spin 0.7s linear infinite;
}

.expand-btn.htmx-request .expand-spinner,
.expand-btn.expand-pending .expand-spinner {
  display: block;
}

.expand-btn.htmx-request .expand-glyph,
.expand-btn.htmx-request .expand-undo-glyph,
.expand-btn.expand-pending .expand-glyph,
.expand-btn.expand-pending .expand-undo-glyph {
  visibility: hidden;
}

.expand-btn.expand-undo .expand-undo-glyph {
  display: block;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  -webkit-text-stroke: 0.6px currentColor;
  paint-order: stroke fill;
}

.expand-btn.expand-idle:disabled {
  background: color-mix(in srgb, var(--control-idle) 35%, transparent);
  color: rgba(255, 255, 255, 0.45);
  opacity: 1;
  cursor: default;
  box-shadow: none;
}

.citation-line-quote,
.citation-line-ref,
.citation-line-buy {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.citation-line-ref,
.citation-line-buy {
  margin-top: 0.85rem;
}

.citation-line-buy {
  color: var(--ink-soft);
}

.citation-meta,
.citation-dev-meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.95rem;
}

.citation-dev-meta {
  font-size: 0.85rem;
  line-height: 1.45;
}

.quote-wrap {
  position: relative;
  margin: 1rem 0 0.75rem;
}

.citation-oversized-banner {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  border-left: 3px solid var(--accent, #8b6914);
  background: rgba(139, 105, 20, 0.08);
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text-muted, #4a4035);
}

.download-book {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--text, #2c2416);
  background: var(--surface, #faf6ef);
}

.download-book:hover {
  border-color: var(--accent, #8b6914);
}

.expand-rail-disabled {
  opacity: 0.45;
}

.citation-quote,
.citation-quote-flow,
.quote-block {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.citation-quote {
  margin: 0;
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--parchment) 60%, var(--paper));
  font-size: 1.125rem;
}

.quote-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: transparent;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.verification-badge {
  display: inline-block;
  font-family: var(--ui);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.citation-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  font-family: var(--ui);
}

.buy-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.buy-book {
  display: inline-block;
  background: var(--victory-gold);
  color: #fff;
  border: none;
  text-decoration: none;
  font-weight: 700;
  padding: 0.7rem 1.15rem;
  border-radius: 8px;
  letter-spacing: 0.01em;
  font-family: var(--ui);
  font-size: 1rem;
  cursor: pointer;
}

.buy-book:hover { background: var(--victory-gold-hover); }

.buy-unavailable {
  display: inline-block;
  padding: 0.7rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.copy-citation {
  margin-left: auto;
  flex-shrink: 0;
}

.copy-citation.copy-capped,
.copy-citation.copy-unavailable,
.copy-citation:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.context-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.context-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0.35rem 0.15rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.context-btn:hover { color: var(--accent); }

.validation-medallion {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: color-mix(in srgb, var(--parchment) 55%, var(--paper));
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-family: var(--ui);
  font-weight: 600;
  color: var(--ink);
}

.medallion-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
}

.validation-process {
  margin: 0 0 1rem;
  font-size: 0.98rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.source-metadata {
  margin: 0;
  font-family: var(--ui);
  font-size: 0.92rem;
}

.source-metadata dt {
  margin-top: 0.65rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.source-metadata dt:first-child {
  margin-top: 0;
}

.source-metadata dd {
  margin: 0.2rem 0 0;
  color: var(--ink);
  word-break: break-word;
}

.source-metadata code {
  font-size: 0.82rem;
  word-break: break-all;
}

.citation-provenance {
  margin-top: 0.85rem;
  font-family: var(--ui);
  font-size: 0.85rem;
  color: var(--muted);
}

.landing-notice {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.78rem;
}

.landing-rights a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.landing-footer {
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

.landing-footer .desk-powered {
  color: var(--muted);
  text-decoration: none;
}

.powered-by {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--ui);
  font-size: 0.85rem;
}

.powered-by-prefix {
  font-size: 0.62rem;
  font-weight: 400;
  line-height: 1;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  margin-right: -0.1rem;
}

.powered-by img {
  align-self: center;
}

.powered-by:hover {
  color: var(--accent);
  text-decoration: underline;
}

.powered-by img {
  display: block;
  flex-shrink: 0;
}

.powered-by-text {
  line-height: 1;
}

.trademark-notice {
  margin: 0.5rem 0 0;
  max-width: 42rem;
  font-family: var(--ui);
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
}

.context-hint {
  margin: 0.75rem 0 0.5rem;
  font-family: var(--ui);
  font-size: 0.85rem;
  color: var(--muted);
}

.landing-footer .desk-powered:hover {
  color: var(--accent);
  text-decoration: underline;
}

.how-intro {
  font-size: 1.1rem;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}

.how-it-works section {
  margin-bottom: 1.5rem;
}

.account-page p {
  max-width: 40rem;
}

.account-section {
  margin: 1.5rem 0 2rem;
}

.account-user-type {
  font-size: 1.05rem;
  margin: 0 0 1rem;
}

.account-email {
  margin: 1rem 0 1.25rem;
}

.account-email-label {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.account-email-hint {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
}

.account-email-status {
  margin: 0.35rem 0;
}

.account-email-pending {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.account-email-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0;
}

.account-email-form input[type="email"] {
  min-width: 16rem;
  padding: 0.4rem 0.55rem;
}

.account-flash-error {
  color: #8b1e1e;
}

.account-providers {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}

.account-providers li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.35rem 0;
}

.account-books {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.account-book-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.account-book-pct {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.account-book-bar {
  height: 0.4rem;
  background: color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 999px;
  margin: 0.45rem 0;
  overflow: hidden;
}

.account-book-bar-fill {
  height: 100%;
  background: var(--accent, #2a4a6e);
}

.account-book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.9rem;
}

/* Account back link sits above the page title */
.account-back {
  margin: 0 0 0.65rem;
  font-family: var(--ui);
  font-size: 0.95rem;
}

.account-back a {
  color: var(--accent);
  text-decoration: none;
}

.account-back a:hover {
  text-decoration: underline;
}

.account-back a::before {
  content: "← ";
}

/* Clerk Manage cases form / workspace */
.account-page:has(.clerk-cases-panel),
.account-page:has(.clerk-case-workspace) {
  max-width: 80rem;
}

.clerk-case-workspace {
  margin-top: 0.25rem;
}

.clerk-case-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 52rem) {
  .clerk-case-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.clerk-case-form,
.clerk-case-side {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.clerk-case-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem 1.25rem;
  margin: 0;
  min-width: 0;
  max-width: 100%;
  background: var(--paper);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 6%, transparent);
}

.clerk-case-card legend,
.clerk-case-card h3 {
  font-family: var(--ui);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0 0.35rem;
  margin: 0 0 0.35rem;
}

.clerk-case-card-muted {
  background: color-mix(in srgb, var(--border) 18%, var(--paper));
}

.clerk-case-card-muted p {
  margin: 0.5rem 0 0;
  color: var(--ink-soft);
  max-width: none;
}

.clerk-case-form label,
.clerk-link-form label {
  display: block;
  font-family: var(--ui);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0.85rem 0 0;
}

.clerk-case-form input[type="text"],
.clerk-case-form input[type="number"],
.clerk-case-form input[type="url"],
.clerk-case-form select,
.clerk-link-form input[type="url"],
.clerk-link-form select {
  display: block;
  width: 100%;
  max-width: none;
  margin-top: 0.3rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 1rem;
}

.clerk-case-form input[type="number"] {
  max-width: 8rem;
}

.clerk-case-form .tier-detail,
.clerk-case-card .tier-detail {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
  max-width: 100%;
  overflow-wrap: break-word;
}

.clerk-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.clerk-case-status {
  margin: 0 0 1rem;
}

.clerk-nightly-note {
  margin: 1.25rem 0 0;
  max-width: 46rem;
}

/* Clerk books list + shared button styles */

.clerk-cases-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin: 0 0 1rem;
  font-family: var(--ui);
}

.clerk-cases-count {
  margin: 0;
  font-weight: 600;
  color: var(--ink-soft);
}

.clerk-cases-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 6%, transparent);
  overflow: hidden;
}

.clerk-cases-scroll {
  overflow-x: auto;
}

.clerk-cases-table {
  width: 100%;
  min-width: 44rem;
  border-collapse: collapse;
  font-family: var(--ui);
  font-size: 0.95rem;
  table-layout: fixed;
}

.clerk-cases-col-title {
  width: 42%;
  min-width: 16rem;
}

.clerk-cases-col-court {
  width: 9%;
  max-width: 7rem;
}

.clerk-cases-col-year {
  width: 5%;
  max-width: 4.5rem;
}

.clerk-cases-col-upload {
  width: 9%;
  max-width: 6.5rem;
}

.clerk-cases-col-limits {
  width: 11%;
  max-width: 8rem;
}

.clerk-cases-col-status {
  width: 11%;
  max-width: 7.5rem;
}

.clerk-cases-col-actions {
  width: 14%;
  min-width: 12rem;
}

.clerk-cases-table td.clerk-cases-col-title {
  word-break: break-word;
}

.clerk-cases-table td.clerk-cases-col-court {
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clerk-case-limits {
  font-size: 0.88rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.clerk-cases-table thead {
  background: color-mix(in srgb, var(--border) 35%, var(--paper));
}

.clerk-cases-table th,
.clerk-cases-table td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  text-align: left;
}

.clerk-cases-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.clerk-cases-table tbody tr:last-child td {
  border-bottom: none;
}

.clerk-cases-table th {
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sort-header:hover {
  color: var(--accent);
}

.sort-header::after {
  content: "↕";
  font-size: 0.75rem;
  opacity: 0.45;
}

.sort-header[data-sort-dir="asc"]::after {
  content: "↑";
  opacity: 1;
  color: var(--accent);
}

.sort-header[data-sort-dir="desc"]::after {
  content: "↓";
  opacity: 1;
  color: var(--accent);
}

.clerk-cases-th-actions,
.clerk-case-row-actions {
  text-align: right;
}

.clerk-case-row-actions {
  display: flex;
  flex-wrap: nowrap;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  white-space: nowrap;
}

.clerk-case-title-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.clerk-case-title-link:hover {
  text-decoration: underline;
}

.clerk-case-muted {
  color: var(--muted);
}

.clerk-cases-sort-hint {
  margin: 0;
  padding: 0.65rem 0.85rem;
  font-family: var(--ui);
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--border) 20%, var(--paper));
}

.status-badge,
.pdf-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

.status-badge.status-live,
.pdf-badge.pdf-yes {
  background: color-mix(in srgb, #1a7f37 14%, transparent);
  color: #1a7f37;
}

.status-badge.status-indexing,
.pdf-badge.pdf-no {
  background: color-mix(in srgb, var(--muted) 18%, transparent);
  color: var(--ink-soft);
}

.clerk-case-year {
  color: var(--muted);
  font-weight: 400;
}

.clerk-pdf-name {
  margin: 0 0 0.75rem;
  max-width: none;
}

.clerk-pdf-dest {
  margin: 0 0 0.75rem;
  max-width: none;
  font-size: 0.9rem;
}

.clerk-pdf-dest code {
  font-size: 0.85em;
  word-break: break-all;
}

.clerk-pdf-upload {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.clerk-pdf-upload .clerk-pdf-status {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: none;
  font-size: 0.85rem;
  line-height: 1.4;
}

.clerk-pdf-upload .clerk-pdf-status.is-error {
  color: #b42318;
}

a.button,
button.secondary,
button.danger,
button.small {
  font-family: var(--ui);
  cursor: pointer;
  border-radius: 6px;
  text-decoration: none;
}

button.secondary.small,
a.button.secondary.small {
  padding: 0.4rem 0.75rem;
  font-size: 1rem;
  min-height: 44px;
}

button.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  font-size: 1.1rem;
  font-weight: 600;
  background: #b42318;
  border: 1px solid #9a1c12;
  color: #fff;
  padding: 0.55rem 1.1rem;
}

button.danger:hover {
  background: #991b1b;
  border-color: #7f1616;
}

form.inline-delete {
  display: inline;
  margin: 0;
}

.clerk-link-form button {
  margin-top: 0.85rem;
}

.clerk-links {
  list-style: none;
  margin: 0.5rem 0 0.75rem;
  padding: 0;
}

.clerk-links li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  word-break: break-word;
}

.clerk-links li:last-child {
  border-bottom: none;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  font-family: var(--ui);
}

.tier-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.tier-card-coming-soon {
  position: relative;
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}

.tier-card-coming-soon.tier-card-featured {
  box-shadow: none;
  border-color: var(--border);
}

.tier-coming-soon {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 1;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--parchment, #f5f0e6);
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 1;
}

.tier-card-featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}

.tier-card-current {
  background: color-mix(in srgb, var(--accent) 6%, var(--paper));
}

.tier-price {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0.35rem 0 0.75rem;
}

.tier-features {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.tier-cta {
  display: inline-block;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
}

.tier-cta.primary {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
}

.tier-cta-muted {
  opacity: 0.55;
}

.premium-dialog,
.how-it-works-dialog {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  font-family: var(--ui);
  box-shadow: var(--shadow);
}

.premium-dialog {
  max-width: 24rem;
}

.premium-dialog h3 {
  margin-top: 0;
  color: var(--ink);
}

.premium-dialog p {
  color: var(--ink-soft);
  line-height: 1.55;
}

.premium-dialog::backdrop,
.how-it-works-dialog::backdrop {
  background: color-mix(in srgb, var(--ink) 40%, transparent);
}

.how-it-works-dialog {
  padding-bottom: 1rem;
  max-width: 36rem;
  width: calc(100vw - 2rem);
  max-height: calc(100vh - 3rem);
  overflow: auto;
}

.how-it-works-dialog .how-it-works h2 {
  margin-top: 0;
  color: var(--ink);
}

.how-it-works-dialog .how-it-works p {
  color: var(--ink-soft);
  line-height: 1.6;
}

.how-it-works-dialog .how-it-works .how-intro {
  color: var(--ink-soft);
}

.how-it-works-dialog .how-it-works h3 {
  color: var(--ink);
}

.how-it-works-close {
  margin-top: 1rem;
  text-align: right;
}

.how-it-works-close button,
.premium-dialog form[method="dialog"] button {
  font-family: var(--ui);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink-soft);
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}

.how-it-works-close button:hover,
.premium-dialog form[method="dialog"] button:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.footer-link-button {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-link-button:hover {
  color: var(--accent);
}

.content-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.content-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.inline-remove {
  display: inline;
}

.upload-file-label input[type="file"] {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--ui);
}

.account-nav-links {
  margin-top: 1.5rem;
  font-family: var(--ui);
  font-size: 0.95rem;
}

.account-nav-links a {
  color: var(--accent);
}

.empty-list {
  color: var(--muted);
  font-style: italic;
}

.premium-notice {
  font-weight: 600;
  color: var(--ink);
}

.delegated-roles {
  list-style: none;
  padding: 0;
}

.share-count {
  font-family: var(--ui);
  color: var(--muted);
}

.subscription-intro {
  font-family: var(--ui);
}

.citation-provenance summary::before {
  content: "▸ ";
  display: inline-block;
  width: 1em;
}

.citation-provenance[open] summary::before {
  content: "▾ ";
}

.citation-provenance summary {
  cursor: pointer;
  list-style: none;
}

.citation-provenance summary::-webkit-details-marker { display: none; }

.receipt-panel {
  margin-top: 0.65rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.copy-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--ink);
  color: var(--parchment);
  font-family: var(--ui);
  font-size: 0.9rem;
  padding: 0.7rem 1.1rem;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
}

.copy-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.quota-upgrade {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.site-footer.desk-legal {
  max-width: none;
  margin: 1.5rem 0 0;
  padding: 0.75rem 1.5rem 1rem;
  border-top: 1px solid var(--border);
}

.desk-legal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 52rem;
  margin: 0 auto;
  font-family: var(--ui);
  font-size: 0.78rem;
  color: var(--muted);
}

.desk-powered {
  color: var(--muted);
  white-space: nowrap;
}

.site-footer {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1rem 1.5rem 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: none;
  font-family: var(--ui);
  flex-shrink: 0;
}

body.landing-mode {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.landing-mode .site-main {
  flex: 1;
}

.how-it-works section { margin-bottom: 1.75rem; }
.how-it-works h2 { font-size: 1.75rem; letter-spacing: -0.02em; }
.how-it-works h3 {
  font-family: var(--ui);
  font-size: 1.05rem;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.library-table th a.sort-header {
  color: inherit;
  text-decoration: none;
}

.library-table th a.sort-header:hover {
  color: var(--ink);
  text-decoration: underline;
}

.library-table th a.sort-header.sort-active {
  color: var(--ink);
}

.library-table-wrap {
  overflow-x: auto;
  margin-bottom: 2rem;
}

.library-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--ui);
  font-size: 0.95rem;
}

.library-table th,
.library-table td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.library-table th {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.library-title {
  font-weight: 600;
}

.library-links a {
  white-space: nowrap;
}

.library-license {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  max-width: 18rem;
}

.library-empty {
  color: var(--ink-soft);
  margin: 1rem 0 2rem;
}

.library-recommend {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.library-recommend h3 {
  font-family: var(--ui);
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.admin-page {
  max-width: 72rem;
}

.admin-section {
  margin-bottom: 2rem;
}

.admin-facts {
  display: grid;
  grid-template-columns: minmax(10rem, 16rem) 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
}

.admin-fact {
  display: contents;
}

.admin-facts dt {
  font-family: var(--ui);
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

.admin-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.admin-facts code,
.admin-uris {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
}

.admin-uris {
  max-height: 70vh;
  overflow: auto;
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--border) 35%, var(--paper));
  border: 1px solid var(--border);
  white-space: pre;
}

.admin-empty {
  color: var(--muted);
}

.admin-error {
  color: #8b1e1e;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(0.4rem); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .site-header, .site-main, .site-footer { padding-left: 1rem; padding-right: 1rem; }
  .landing-headline { max-width: none; }
  .citation-actions { align-items: flex-start; }
  .copy-citation { margin-left: auto; }
  .buy-book { text-align: center; }
}
