:root {
  --bg: #09131a;
  --bg-strong: #10202b;
  --panel: rgba(16, 25, 35, 0.9);
  --panel-border: rgba(120, 151, 176, 0.16);
  --ink: #edf3f8;
  --muted: #96aab9;
  --accent: #d97941;
  --accent-strong: #f2a365;
  --accent-soft: rgba(217, 121, 65, 0.16);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
  --surface-1: rgba(18, 28, 38, 0.84);
  --surface-2: rgba(26, 39, 51, 0.94);
  --surface-3: rgba(9, 16, 23, 0.98);
  --field-bg: #0d1923;
  --field-border: rgba(123, 154, 178, 0.22);
  --field-border-strong: rgba(217, 121, 65, 0.38);
  --tag-bg: rgba(132, 160, 184, 0.12);
  --reader-bg: #071017;
  --graph-bg: linear-gradient(180deg, rgba(18, 28, 38, 0.98), rgba(11, 18, 25, 0.98));
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(217, 121, 65, 0.2), transparent 24%),
    radial-gradient(circle at top right, rgba(82, 122, 154, 0.16), transparent 28%),
    radial-gradient(circle at bottom left, rgba(49, 79, 103, 0.18), transparent 26%),
    linear-gradient(180deg, #0d1821 0%, var(--bg) 100%);
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 18px 72px;
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.hero-side {
  display: grid;
  gap: 10px;
}

.hero-copy,
.hero-stats,
.panel,
.session-card,
.login-card,
.password-card {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-copy {
  padding: 20px 22px;
  border-radius: 26px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-radius: 26px;
}

.session-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.68rem;
  color: var(--accent-strong);
}

.hero h1 {
  margin: 0;
  max-width: 18ch;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  line-height: 0.98;
}

.lede {
  max-width: 58ch;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.stat-card {
  padding: 10px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(31, 45, 58, 0.96), rgba(20, 30, 40, 0.94));
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.stat-card strong {
  font-size: 1.02rem;
  font-weight: 700;
}

.stat-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 18px;
}

.panel {
  border-radius: var(--radius);
  padding: 18px;
}

.panel-tools {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 10px;
}

.map-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.map-icon {
  position: relative;
  width: 28px;
  height: 20px;
  display: inline-block;
}

.map-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  box-shadow: 0 0 0 4px rgba(217, 121, 65, 0.12);
}

.map-dot-a {
  left: 0;
  top: 6px;
}

.map-dot-b {
  right: 0;
  top: 0;
}

.map-dot-c {
  right: 2px;
  bottom: 0;
}

.search-bar {
  margin-bottom: 12px;
}

.search-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
}

input[type="search"],
input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--field-border);
  border-radius: 18px;
  background: var(--field-bg);
  padding: 13px 16px;
  color: var(--ink);
  font-size: 0.96rem;
}

input[type="search"]:focus,
input[type="text"]:focus,
input[type="password"]:focus,
.admin-select:focus {
  outline: 2px solid rgba(217, 121, 65, 0.2);
  outline-offset: 1px;
  border-color: var(--field-border-strong);
}

button {
  border: 0;
  border-radius: 18px;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

button.secondary {
  background: rgba(132, 160, 184, 0.12);
  color: var(--ink);
}

.search-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.hint-chip {
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 8px 12px;
  border-radius: 999px;
}

.results-meta,
.reader-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
}

.reading-trail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 10px;
  align-items: start;
  margin: 0 0 12px;
}

.trail-summary,
.recent-window {
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--surface-1);
  border: 1px solid rgba(120, 151, 176, 0.12);
}

.trail-summary p {
  margin: 8px 0 0;
}

.recent-window-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.trail-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.82rem;
}

.recent-rfc-list {
  display: grid;
  gap: 8px;
}

.favorite-rfc-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.recent-rfc-button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(120, 151, 176, 0.12);
  background: rgba(132, 160, 184, 0.08);
  color: var(--ink);
  text-align: left;
}

.recent-rfc-button.active {
  border-color: rgba(217, 121, 65, 0.32);
  background: rgba(217, 121, 65, 0.12);
}

.recent-rfc-button:hover {
  transform: translateY(-1px);
}

.favorite-rfc-remove {
  padding: 10px 12px;
  border-radius: 14px;
  white-space: nowrap;
}

.reader-controls #favorite-toggle.active {
  background: rgba(217, 121, 65, 0.18);
  color: #fff2e8;
  box-shadow: inset 0 0 0 1px rgba(217, 121, 65, 0.24);
}

.recent-rfc-meta {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.recent-rfc-title {
  display: block;
  font-size: 0.9rem;
  line-height: 1.35;
}

.recent-rfc-empty {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.reader-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
}

.reader-stage-main {
  min-width: 0;
}

.reader-side-nav {
  width: 56px;
  min-height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-radius: 20px;
  font-size: 1.35rem;
  font-weight: 700;
}

.reader-side-nav:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.results-grid {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.result-card {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(120, 151, 176, 0.14);
  background: var(--surface-1);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.result-card:hover,
.result-card.active {
  transform: translateY(-2px);
  border-color: rgba(175, 79, 43, 0.35);
  box-shadow: 0 12px 28px rgba(80, 41, 9, 0.1);
}

.result-card h3 {
  margin: 6px 0 8px;
  font-size: 1rem;
}

.result-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.result-abstract {
  margin: 10px 0 0;
  color: #c5d3de;
  font-size: 0.92rem;
  line-height: 1.5;
}

.result-tags {
  margin-top: 12px;
}

.detail-empty {
  display: grid;
  place-items: center;
  min-height: 70vh;
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.detail-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.detail-doc {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.detail h2 {
  margin: 0;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: clamp(1.5rem, 2.4vw, 2.35rem);
  line-height: 1.04;
}

.detail-badge {
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.78rem;
}

.detail-abstract {
  margin: 12px 0 14px;
  max-width: 80ch;
  color: #d0ddea;
  line-height: 1.55;
  scroll-margin-top: 112px;
}

.detail-abstract-highlight {
  border-radius: 14px;
  background: rgba(217, 121, 65, 0.14);
  box-shadow: 0 0 0 1px rgba(217, 121, 65, 0.16);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.meta-grid div {
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--surface-1);
}

.meta-grid dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-grid dd {
  margin: 0;
  line-height: 1.35;
  font-size: 0.92rem;
}

.tag-row {
  margin-bottom: 12px;
}

.context-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 10px;
  margin: 0 0 14px;
}

.context-card {
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--surface-1);
}

.context-card-wide {
  min-width: 0;
}

.context-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.context-note {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.context-note-detail {
  font-size: 0.74rem;
  color: #b8c7d3;
}

.timeline-block {
  margin-bottom: 14px;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid rgba(120, 151, 176, 0.1);
  cursor: pointer;
}

.timeline-item.active {
  border-color: rgba(175, 79, 43, 0.35);
  box-shadow: 0 10px 24px rgba(80, 41, 9, 0.08);
}

.timeline-rfc {
  color: var(--accent-strong);
  font-weight: 700;
}

.timeline-title {
  font-size: 0.88rem;
  line-height: 1.35;
}

.timeline-version {
  color: var(--muted);
  font-size: 0.76rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  display: inline-block;
  max-width: min(100%, 24ch);
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--tag-bg);
  color: #d3e0ea;
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag.actionable {
  border: 0;
  cursor: pointer;
  font-weight: 600;
}

.reader-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.reader-head h3 {
  margin: 0 0 4px;
}

.reader-controls {
  display: flex;
  gap: 8px;
}

.reader {
  margin: 0;
  min-height: 480px;
  max-height: 76vh;
  overflow: auto;
  padding: 16px;
  border-radius: 20px;
  background: var(--reader-bg);
  color: #efe7d7;
  line-height: 1.5;
  font-size: 0.93rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(123, 154, 178, 0.08);
}

.reader-line {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  white-space: pre-wrap;
  scroll-margin-block: 112px;
}

.reader-line + .reader-line {
  margin-top: 2px;
}

.reader-line-highlight {
  border-radius: 12px;
  background: rgba(217, 121, 65, 0.12);
  box-shadow: 0 0 0 1px rgba(217, 121, 65, 0.14);
}

.reader-line-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(123, 154, 178, 0.08);
}

.reader-line-section .line-no {
  color: var(--accent-strong);
}

.line-no {
  color: #a8967b;
  text-align: right;
  user-select: none;
}

.line-text {
  min-width: 0;
}

.reader-ref,
.reader-term,
.page-link-chip {
  color: #ffbb8e;
  text-decoration: none;
  cursor: pointer;
}

.reader-ref:hover,
.reader-term:hover,
.page-link-chip:hover {
  color: #ffd2b2;
  text-decoration: underline;
}

.page-link-chip {
  padding: 8px 12px;
  display: inline-block;
  max-width: min(100%, 28ch);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-link-chip {
  border: 1px solid rgba(217, 121, 65, 0.18);
  background: rgba(217, 121, 65, 0.12);
  color: #ffd8b7;
}

.line-heading {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: #ffe1c5;
  font-weight: 700;
}

.section-anchor-link {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 700;
}

.section-anchor-link:hover {
  color: #ffd2b2;
}

.reader-term {
  color: #9fd6ff;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.16em;
}

.reader-term:hover {
  color: #c6e8ff;
}

.graph-head {
  margin: 20px 0 10px;
}

.graph-head h3 {
  margin: 0 0 4px;
}

.graph {
  width: 100%;
  min-height: 240px;
  border-radius: 20px;
  background: var(--graph-bg);
  border: 1px solid rgba(123, 154, 178, 0.14);
  scroll-margin-top: 112px;
}

.graph-highlight {
  box-shadow: 0 0 0 2px rgba(217, 121, 65, 0.24);
}

.session-role {
  margin-top: 8px;
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-dock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 10;
}

.admin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(18, 28, 38, 0.96);
  color: var(--ink);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
}

.admin-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  box-shadow: 0 0 0 4px rgba(175, 79, 43, 0.12);
}

.admin-panel {
  min-width: 250px;
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(120, 151, 176, 0.16);
  border-radius: 20px;
  background: rgba(18, 28, 38, 0.98);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(18px);
}

.admin-panel-head {
  display: grid;
  gap: 8px;
  align-items: center;
}

.admin-user-form {
  display: grid;
  gap: 10px;
}

.admin-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.admin-select {
  width: 100%;
  border: 1px solid var(--field-border);
  border-radius: 16px;
  background: var(--field-bg);
  padding: 12px 14px;
  color: var(--ink);
  font-size: 0.95rem;
}

.admin-user-result {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface-1);
  color: #d7e2eb;
  line-height: 1.45;
  border: 1px solid rgba(120, 151, 176, 0.12);
}

.admin-user-result code {
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.9rem;
}

.admin-kicker {
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.admin-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(132, 160, 184, 0.12);
  color: var(--ink);
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.88rem;
  font-weight: 700;
}

.admin-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.login-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 8, 13, 0.62);
  z-index: 20;
}

.login-card,
.password-card {
  width: min(100%, 460px);
  padding: 30px;
  border-radius: 30px;
}

.login-card h2,
.password-card h2 {
  margin: 0 0 10px;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.login-copy {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.6;
}

.password-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 8, 13, 0.68);
  z-index: 21;
}

.password-copy,
.password-account {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.protocol-map-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 7, 12, 0.8);
  z-index: 22;
}

.acronym-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 7, 12, 0.8);
  z-index: 22;
}

.study-preview-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(2, 7, 12, 0.72);
  z-index: 23;
}

.study-preview-card {
  width: min(92vw, 860px);
  max-height: min(86vh, 860px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  padding: 24px;
  border-radius: 30px;
  border: 1px solid rgba(120, 151, 176, 0.18);
  background:
    radial-gradient(circle at top right, rgba(217, 121, 65, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(10, 17, 24, 0.98), rgba(8, 14, 20, 0.98));
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.42);
}

.study-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.study-preview-head h2 {
  margin: 0 0 8px;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: clamp(1.5rem, 2.6vw, 2.5rem);
  line-height: 1.04;
}

.study-preview-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: end;
}

.study-preview-body {
  display: grid;
  gap: 16px;
  overflow: auto;
}

.study-preview-abstract {
  margin: 0;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(132, 160, 184, 0.12);
  border: 1px solid rgba(120, 151, 176, 0.12);
  color: #d9e5ef;
  line-height: 1.65;
}

.study-preview-abstract p {
  margin: 0;
}

.study-preview-reader {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(123, 154, 178, 0.14);
  background: rgba(12, 20, 27, 0.96);
}

.study-preview-line {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 8px 10px;
  border-radius: 14px;
  white-space: pre-wrap;
  color: #efe7d7;
}

.study-preview-line + .study-preview-line {
  margin-top: 2px;
}

.study-preview-line-target {
  background: rgba(217, 121, 65, 0.12);
  box-shadow: 0 0 0 1px rgba(217, 121, 65, 0.14);
}

.study-preview-line-no {
  color: #a8967b;
  text-align: right;
  user-select: none;
}

.study-preview-open {
  justify-self: start;
}

.protocol-map-card {
  width: min(96vw, 1320px);
  height: min(92vh, 900px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  padding: 24px;
  border-radius: 32px;
  border: 1px solid rgba(120, 151, 176, 0.16);
  background: rgba(10, 17, 24, 0.98);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
}

.protocol-map-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.protocol-map-head h2 {
  margin: 0 0 8px;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1;
}

.protocol-map-actions {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.protocol-map-detail {
  max-width: 34ch;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(132, 160, 184, 0.12);
  border: 1px solid rgba(120, 151, 176, 0.12);
  color: #d8e4ee;
  line-height: 1.5;
}

.protocol-map-svg {
  width: 100%;
  height: 100%;
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(217, 121, 65, 0.1), transparent 28%),
    radial-gradient(circle at bottom right, rgba(86, 127, 161, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(12, 20, 27, 0.98), rgba(8, 14, 20, 0.98));
  border: 1px solid rgba(120, 151, 176, 0.14);
}

.acronym-card {
  width: min(96vw, 1320px);
  height: min(92vh, 900px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  padding: 24px;
  border-radius: 32px;
  border: 1px solid rgba(120, 151, 176, 0.16);
  background:
    radial-gradient(circle at top right, rgba(217, 121, 65, 0.12), transparent 24%),
    radial-gradient(circle at bottom left, rgba(86, 127, 161, 0.12), transparent 28%),
    rgba(10, 17, 24, 0.98);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
}

.acronym-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
}

.acronym-head h2 {
  margin: 0 0 8px;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1;
}

.acronym-actions {
  width: min(100%, 430px);
  display: grid;
  gap: 12px;
  justify-items: stretch;
}

.acronym-search-form {
  display: grid;
  gap: 8px;
}

.acronym-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
}

.acronym-results,
.acronym-detail-panel {
  min-height: 0;
  overflow: auto;
  border-radius: 24px;
  border: 1px solid rgba(120, 151, 176, 0.14);
  background: rgba(10, 17, 24, 0.86);
}

.acronym-results {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
}

.acronym-result-card {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 14px 15px;
  border-radius: 18px;
  border: 1px solid rgba(120, 151, 176, 0.14);
  background: rgba(18, 29, 39, 0.94);
  color: #e7f0f8;
  text-align: left;
}

.acronym-result-card.active {
  border-color: rgba(217, 121, 65, 0.45);
  box-shadow: 0 0 0 1px rgba(217, 121, 65, 0.18);
  background:
    linear-gradient(180deg, rgba(36, 23, 16, 0.96), rgba(18, 29, 39, 0.96));
}

.acronym-result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.acronym-result-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.acronym-result-count {
  color: var(--muted);
  font-size: 0.82rem;
}

.acronym-result-meanings {
  display: grid;
  gap: 4px;
  color: #d3e1ee;
  font-size: 0.92rem;
  line-height: 1.45;
}

.acronym-result-rfcs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.acronym-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(120, 151, 176, 0.2);
  background: rgba(132, 160, 184, 0.1);
  color: #d8e7f4;
  font-size: 0.78rem;
  white-space: nowrap;
}

.acronym-detail-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
}

.acronym-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.acronym-detail-title {
  margin: 0;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: clamp(1.6rem, 2.7vw, 2.7rem);
  line-height: 1.04;
}

.acronym-detail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.acronym-search-link {
  justify-self: start;
}

.acronym-meaning-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(120, 151, 176, 0.14);
  background: rgba(18, 29, 39, 0.94);
}

.acronym-meaning-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.acronym-meaning-title {
  margin: 0;
  color: #f2f7fb;
  font-size: 1.05rem;
}

.acronym-rfc-list {
  display: grid;
  gap: 10px;
}

.acronym-rfc-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(120, 151, 176, 0.12);
  background: rgba(10, 17, 24, 0.9);
}

.acronym-rfc-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.acronym-rfc-link {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(217, 121, 65, 0.22);
  background: rgba(217, 121, 65, 0.12);
  color: #ffe8d6;
  font-size: 0.78rem;
}

.acronym-rfc-link:hover,
.acronym-rfc-link:focus-visible {
  border-color: rgba(217, 121, 65, 0.46);
  background: rgba(217, 121, 65, 0.2);
}

.acronym-rfc-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.acronym-rfc-snippet {
  margin: 0;
  color: #d3e1ee;
  line-height: 1.55;
}

.password-account code {
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
}

.login-form {
  display: grid;
  gap: 12px;
}

.password-form {
  display: grid;
  gap: 12px;
}

.login-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.field-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.text-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  box-shadow: none;
}

.text-action:hover {
  color: #ffe7d8;
  transform: none;
}

.reset-delivery {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(120, 151, 176, 0.18);
  background: rgba(10, 17, 24, 0.72);
}

.reset-delivery-link {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(132, 160, 184, 0.08);
  border: 1px solid rgba(120, 151, 176, 0.12);
}

.reset-delivery-link code {
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.84rem;
  white-space: break-spaces;
  overflow-wrap: anywhere;
}

.reset-delivery-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.login-error {
  min-height: 1.4em;
  margin: 14px 0 0;
  color: #ffb288;
  font-weight: 700;
}

.bundle-builder-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: start center;
  overflow: auto;
  padding: 28px 20px;
  background: rgba(3, 8, 13, 0.72);
  z-index: 24;
}

.bundle-builder-card {
  width: min(100%, 1080px);
  max-height: none;
  overflow: visible;
  display: grid;
  gap: 16px;
  padding: 24px;
  border-radius: 30px;
  border: 1px solid rgba(120, 151, 176, 0.18);
  background:
    radial-gradient(circle at top right, rgba(217, 121, 65, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(10, 17, 24, 0.98), rgba(8, 14, 20, 0.98));
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.42);
}

.bundle-builder-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.bundle-builder-head h2 {
  margin: 0 0 8px;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1;
}

.bundle-builder-form {
  display: grid;
  gap: 16px;
}

.bundle-builder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
}

.field-label-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.field-help {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #d8e5ef;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.field-help:hover,
.field-help:focus-visible {
  border-color: rgba(217, 121, 65, 0.58);
  background: rgba(217, 121, 65, 0.12);
  color: #f8efe8;
}

.field-help::after,
.field-help::before {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
}

.field-help::after {
  content: attr(data-tooltip);
  right: 0;
  bottom: calc(100% + 12px);
  width: min(320px, calc(100vw - 72px));
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(217, 121, 65, 0.28);
  background: rgba(12, 18, 25, 0.98);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.34);
  color: #edf3f8;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  transform: translateY(6px);
  z-index: 4;
}

.field-help::before {
  content: "";
  right: 8px;
  bottom: calc(100% + 4px);
  border-width: 8px 7px 0;
  border-style: solid;
  border-color: rgba(12, 18, 25, 0.98) transparent transparent;
  transform: translateY(6px);
  z-index: 4;
}

.field-help:hover::after,
.field-help:hover::before,
.field-help:focus-visible::after,
.field-help:focus-visible::before {
  opacity: 1;
  transform: translateY(0);
}

.bundle-builder-grid input,
.bundle-builder-grid select {
  width: 100%;
}

.bundle-builder-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.bundle-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #e7eef5;
  font-weight: 600;
}

.bundle-checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.bundle-protocol-section,
.bundle-builder-result {
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.bundle-protocol-section {
  display: grid;
  gap: 12px;
}

.bundle-protocol-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.bundle-protocol-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.bundle-protocol-chip {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.bundle-protocol-chip-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #f7f0e8;
}

.bundle-protocol-chip-note {
  display: grid;
  gap: 4px;
  color: #9eb3c3;
  font-size: 0.82rem;
  line-height: 1.4;
}

.bundle-protocol-chip-layer {
  color: #f4dfcf;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bundle-protocol-chip-reason {
  color: #c8d5df;
  font-size: 0.76rem;
}

.bundle-builder-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.bundle-builder-result {
  min-height: 96px;
  color: #e7eef5;
  white-space: pre-line;
}

.bundle-builder-download {
  display: flex;
  justify-content: flex-start;
}

.atlas-study-block {
  margin-top: 28px;
}

.atlas-study-toolbar,
.atlas-study-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}

.atlas-study-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

#atlas-study-filters {
  width: 100%;
}

#atlas-study-levels {
  width: 100%;
}

#atlas-study-progress {
  width: 100%;
  margin-right: 0;
}

.atlas-study-filter {
  appearance: none;
  border: 1px solid rgba(132, 160, 184, 0.28);
  border-radius: 999px;
  background: rgba(132, 160, 184, 0.12);
  color: #e6eef5;
  font: inherit;
  padding: 6px 12px;
  cursor: pointer;
}

.atlas-study-filter.active {
  background: rgba(217, 121, 65, 0.2);
  color: #fff3e8;
  border-color: rgba(217, 121, 65, 0.42);
}

.atlas-study-filter:hover,
.atlas-study-filter:focus-visible {
  background: rgba(132, 160, 184, 0.18);
  border-color: rgba(132, 160, 184, 0.38);
}

.atlas-study-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(212, 191, 165, 0.82);
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(248, 241, 230, 0.92));
  color: #102033;
  box-shadow: 0 16px 34px rgba(16, 32, 51, 0.08);
}

.atlas-study-card h3,
.atlas-study-card p,
.atlas-study-card strong {
  color: inherit;
}

.atlas-study-card .tag {
  background: rgba(16, 32, 51, 0.08);
  color: #163347;
}

.atlas-study-card button.secondary {
  background: rgba(16, 32, 51, 0.08);
  border: 1px solid rgba(16, 32, 51, 0.14);
  color: #102033;
}

.atlas-study-card button.secondary:hover {
  background: rgba(16, 32, 51, 0.12);
}

.atlas-study-card[data-study-state="known"] {
  border-color: rgba(31, 108, 79, 0.36);
}

.atlas-study-card[data-study-state="review"] {
  border-color: rgba(182, 90, 40, 0.36);
}

.atlas-study-card[data-study-state="review"] .atlas-study-kind {
  color: #8c3f18;
}

.atlas-study-card[data-study-state="known"] .atlas-study-kind {
  color: #185a40;
}

.atlas-study-media {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  min-height: 180px;
  background: rgba(16, 32, 51, 0.08);
}

.atlas-study-media img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.atlas-study-media-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(7, 16, 23, 0.74);
  color: #f9f6ef;
  font-size: 0.82rem;
}

.atlas-study-head,
.atlas-study-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.atlas-study-kind,
.atlas-study-source,
.atlas-study-hint,
.atlas-study-evidence,
.atlas-study-empty {
  color: #556779;
}

.atlas-study-kind {
  color: #8c3f18;
  font-weight: 700;
}

.atlas-study-level {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16, 32, 51, 0.08);
  color: #163347;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.atlas-study-answer {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(16, 32, 51, 0.05);
  border: 1px solid rgba(16, 32, 51, 0.08);
  color: #102033;
}

.atlas-study-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.atlas-study-resources {
  display: grid;
  gap: 4px;
  padding: 5px 7px;
  border-radius: 10px;
  background: rgba(16, 32, 51, 0.025);
  border: 1px solid rgba(16, 32, 51, 0.05);
}

.atlas-study-resource-title {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  margin: 0;
  color: #344a5b;
  font-size: 0.72rem;
  line-height: 1.2;
}

.atlas-study-resource-title strong {
  font-size: 0.7rem;
}

.atlas-study-resource-label,
.atlas-study-resource-group-label {
  color: #556779;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.atlas-study-resource-group {
  display: grid;
  gap: 3px;
}

.atlas-study-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.atlas-study-link-row > * {
  min-width: 0;
}

.atlas-study-inline-link {
  display: inline-flex;
  align-items: center;
  max-width: min(100%, 34ch);
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(16, 32, 51, 0.14);
  background: rgba(16, 32, 51, 0.08);
  color: #102033;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.atlas-study-external-link {
  display: inline-flex;
  align-items: center;
  max-width: min(100%, 18ch);
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(16, 32, 51, 0.14);
  background: rgba(255, 255, 255, 0.68);
  color: #18354b;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.atlas-study-inline-link:hover,
.atlas-study-inline-link:focus-visible,
.atlas-study-external-link:hover,
.atlas-study-external-link:focus-visible {
  background: rgba(16, 32, 51, 0.12);
  transform: translateY(-1px);
}

.atlas-study-controls button:disabled,
.atlas-study-actions button:disabled {
  opacity: 0.46;
  cursor: default;
  filter: none;
  transform: none;
}

.atlas-study-source-link,
.atlas-study-answer-link {
  text-align: left;
  max-width: min(100%, 42ch);
}

.atlas-study-evidence-link {
  margin-left: 8px;
  font-weight: 600;
  max-width: min(100%, 42ch);
}

.atlas-study-answer.hidden {
  display: none;
}

@media (max-width: 1100px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero-stats,
  .meta-grid,
  .context-strip,
  .reading-trail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 16px 12px 126px;
  }

  .hero-copy,
  .hero-stats,
  .panel,
  .session-card,
  .login-card,
  .password-card {
    border-radius: 24px;
  }

  .hero-stats,
  .meta-grid,
  .context-strip,
  .search-row,
  .reading-trail,
  .reader-stage {
    grid-template-columns: 1fr;
  }

  .session-card,
  .reader-head,
  .detail-top,
  .acronym-head,
  .protocol-map-head,
  .bundle-builder-head {
    flex-direction: column;
    align-items: stretch;
  }

  .field-help::after {
    right: auto;
    left: 0;
  }

  .field-help::before {
    right: auto;
    left: 8px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .reader-controls {
    width: 100%;
  }

  .reader-side-nav {
    min-height: auto;
    width: 100%;
  }

  .admin-dock {
    left: 12px;
    right: 12px;
    bottom: 12px;
    align-items: stretch;
  }

  .admin-panel,
  .admin-actions {
    width: 100%;
  }

  .admin-user-row {
    grid-template-columns: 1fr;
  }

  .protocol-map-card {
    height: min(94vh, 940px);
    padding: 18px;
  }

  .acronym-card {
    height: min(94vh, 980px);
    padding: 18px;
  }

  .acronym-body {
    grid-template-columns: 1fr;
  }

  .acronym-actions {
    width: 100%;
  }

  .protocol-map-actions {
    justify-items: stretch;
  }

  .bundle-builder-grid,
  .bundle-protocol-grid {
    grid-template-columns: 1fr;
  }

  .bundle-checkbox-row {
    width: 100%;
  }

  .field-label-row {
    justify-content: space-between;
  }

  .admin-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .reader-controls button,
  .admin-user-row button,
  .admin-actions button,
  .session-card button,
  .search-row button {
    width: 100%;
  }
}
