:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-soft: #eef4f2;
  --surface-warm: #fff8ee;
  --ink: #15201d;
  --muted: #66736f;
  --line: #dbe3e0;
  --line-strong: #c0cfca;
  --teal: #0f766e;
  --teal-strong: #0b5f59;
  --blue: #2563eb;
  --amber: #b45309;
  --red: #b42318;
  --shadow: 0 16px 42px rgba(21, 32, 29, 0.08);
  --radius: 8px;
  --radius-sm: 6px;
  --rail: 232px;
  --context: 312px;
  font-family: "Inter", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  overflow-x: hidden;
  scroll-padding-bottom: 92px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.04), transparent 360px),
    var(--bg);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--teal);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--context);
  min-height: 100vh;
}

.side-rail {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  padding: 22px 18px;
  backdrop-filter: blur(16px);
}

.brand {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  color: var(--ink);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius);
  background: #103d39;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

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

.nav-item,
.mobile-tab,
.mode-button,
.ghost-button,
.solid-button,
.chip-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
}

.nav-item {
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active,
.mobile-tab.active {
  border-color: rgba(15, 118, 110, 0.18);
  background: var(--surface-soft);
  color: var(--teal-strong);
}

.main {
  min-width: 0;
  padding: 28px 30px 42px;
}

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: -28px -30px 22px;
  border-bottom: 1px solid rgba(219, 227, 224, 0.82);
  background: rgba(245, 247, 246, 0.9);
  padding: 18px 30px;
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

#pageTitle {
  margin: 0;
  font-size: 32px;
  letter-spacing: 0;
  line-height: 1.18;
}

.topbar-actions {
  display: flex;
  min-width: min(570px, 58%);
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.search-box {
  display: flex;
  min-width: 260px;
  max-width: 420px;
  flex: 1;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px 10px;
  box-shadow: 0 6px 18px rgba(21, 32, 29, 0.04);
}

.search-box span {
  color: var(--muted);
  font-size: 13px;
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.mode-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 3px;
}

.language-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 3px;
}

.mode-button,
.language-button {
  min-height: 34px;
  padding: 0 13px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
}

.mode-button.active,
.language-button.active {
  background: var(--teal);
  color: #ffffff;
}

.view {
  display: grid;
  gap: 18px;
}

.context-panel {
  position: sticky;
  top: 0;
  display: grid;
  height: 100vh;
  align-content: start;
  gap: 14px;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  padding: 22px 18px;
}

.panel-card,
.card,
.doc-card,
.role-card,
.template-card,
.task-card,
.audit-card,
.path-card,
.graph-card,
.reader-shell,
.empty-state,
.stat-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(21, 32, 29, 0.04);
}

.panel-card {
  padding: 16px;
}

.panel-card h2 {
  margin-bottom: 12px;
  font-size: 15px;
}

.compact-list,
.path-list {
  display: grid;
  gap: 8px;
}

.compact-item {
  display: block;
  border-radius: var(--radius-sm);
  padding: 8px;
  color: var(--ink);
}

.compact-item:hover {
  background: var(--surface-soft);
  text-decoration: none;
}

.compact-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: stretch;
}

.hero-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.09), rgba(37, 99, 235, 0.04)),
    var(--surface);
  padding: 24px;
  box-shadow: var(--shadow);
}

.hero-panel h2 {
  margin-bottom: 12px;
  font-size: clamp(26px, 4vw, 44px);
  letter-spacing: 0;
  line-height: 1.08;
}

.hero-panel p {
  max-width: 720px;
  color: #394642;
  font-size: 17px;
  line-height: 1.75;
}

.quick-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
}

.quick-step {
  min-height: 78px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.78);
  padding: 10px;
}

.quick-step strong {
  display: block;
  margin-bottom: 6px;
  color: var(--teal-strong);
  font-size: 13px;
}

.quick-step span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.chain-map {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.chain-map.large {
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(21, 32, 29, 0.04);
}

.chain-map-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.chain-map-head strong {
  color: var(--ink);
  font-size: 16px;
}

.chain-map-head span {
  color: var(--muted);
  font-size: 13px;
}

.chain-track {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.chain-map:not(.large) .chain-track {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.chain-node {
  position: relative;
  display: grid;
  min-height: 118px;
  align-content: start;
  gap: 6px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.chain-node:not(:last-child)::after {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: -10px;
  width: 12px;
  height: 12px;
  border-top: 2px solid var(--line-strong);
  border-right: 2px solid var(--line-strong);
  content: "";
  transform: translateY(-50%) rotate(45deg);
}

.chain-map:not(.large) .chain-node::after {
  display: none;
}

.chain-node:hover {
  border-color: rgba(15, 118, 110, 0.42);
  background: #f6fbfa;
  box-shadow: 0 8px 20px rgba(21, 32, 29, 0.08);
}

.chain-node small {
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.chain-node strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.chain-node span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.judgment-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.judgment-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.judgment-item strong,
.judgment-item span {
  display: block;
}

.judgment-item strong {
  margin-bottom: 7px;
  color: var(--teal-strong);
  font-size: 15px;
}

.judgment-item span {
  color: var(--muted);
  line-height: 1.58;
}

.status-panel {
  display: grid;
  gap: 12px;
}

.stat-card {
  padding: 18px;
}

.stat-card strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.stat-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.section-heading h2 {
  margin-bottom: 4px;
  font-size: 22px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
}

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

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.doc-card,
.role-card,
.template-card,
.task-card,
.audit-card,
.path-card,
.graph-card,
.card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.doc-card {
  position: relative;
  min-height: 170px;
  align-content: start;
  color: var(--ink);
}

.doc-card:hover,
.role-card:hover,
.graph-card:hover,
.path-card:hover {
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: var(--shadow);
  text-decoration: none;
  transform: translateY(-1px);
}

.doc-card h3,
.role-card h3,
.template-card h3,
.task-card h3,
.audit-card h3,
.graph-card h3,
.path-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.doc-card p,
.role-card p,
.template-card p,
.task-card p,
.audit-card p,
.graph-card p,
.path-card p,
.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
}

.role-card {
  align-content: start;
  min-height: 210px;
}

.role-card.active {
  border-color: rgba(15, 118, 110, 0.36);
  background: #f6fbfa;
}

.role-card small {
  display: block;
  color: var(--muted);
  line-height: 1.5;
}

.role-link {
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fbfcfc;
  padding: 8px;
}

.role-link code {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card pre {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #12211f;
  color: #eef9f6;
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
}

.template-card code {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

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

.audit-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px;
}

.audit-item a {
  color: var(--ink);
  font-weight: 750;
}

.audit-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.45;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.health-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfc;
  padding: 10px;
}

.health-grid strong,
.health-grid span {
  display: block;
}

.health-grid strong {
  font-size: 24px;
}

.health-grid span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.meta-row,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tag,
.mode-pill,
.read-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.tag {
  background: var(--surface-soft);
  color: var(--teal-strong);
}

.mode-pill {
  background: #eef2ff;
  color: #3346a3;
}

.mode-pill.pro {
  background: #fff1db;
  color: var(--amber);
}

.read-pill {
  background: #ecfdf3;
  color: #027a48;
}

.ghost-button,
.solid-button,
.chip-button,
.icon-button {
  display: inline-flex;
  max-width: 100%;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  text-align: center;
}

.ghost-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.ghost-button:hover,
.chip-button:hover {
  border-color: rgba(15, 118, 110, 0.32);
  background: var(--surface-soft);
}

.solid-button {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.chip-button {
  min-height: 30px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 12px;
}

.filter-button.active,
.filter-button:hover {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--surface-soft);
  color: var(--teal-strong);
}

.icon-button {
  width: 36px;
  padding: 0;
  border-color: var(--line);
  background: var(--surface);
  font-weight: 800;
}

.icon-button.active {
  border-color: rgba(180, 83, 9, 0.32);
  background: var(--surface-warm);
  color: var(--amber);
}

.progress-bar {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e8eeeb;
}

.progress-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.path-items {
  display: grid;
  gap: 8px;
}

.path-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px;
}

.path-item a {
  color: var(--ink);
  font-weight: 650;
}

.path-item small {
  display: block;
  color: var(--muted);
}

.check-dot {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: transparent;
  font-size: 12px;
}

.check-dot.done {
  border-color: #12b76a;
  background: #12b76a;
  color: #ffffff;
}

.questions {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.questions li {
  border-left: 3px solid var(--teal);
  padding-left: 9px;
  color: #34413d;
  line-height: 1.5;
}

.quiz-box {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius-sm);
  background: #f8fbfa;
  padding: 12px;
}

.quiz-box strong {
  color: var(--teal-strong);
}

.outcome-card {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: var(--radius-sm);
  background: #f8fbff;
  padding: 10px;
}

.outcome-card strong {
  color: var(--blue);
  font-size: 13px;
}

.outcome-card span {
  color: #35423f;
  font-size: 13px;
  line-height: 1.5;
}

.graph-board {
  display: grid;
  gap: 16px;
}

.graph-card {
  overflow: hidden;
}

.graph-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.node-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfc;
  padding: 4px 10px;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.node-chip:hover {
  border-color: rgba(15, 118, 110, 0.4);
  background: var(--surface-soft);
  text-decoration: none;
}

.line-visual {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.line-step {
  position: relative;
  display: block;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfc;
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.line-step:not(:last-child)::after {
  position: absolute;
  top: 50%;
  right: -12px;
  width: 16px;
  height: 1px;
  background: var(--line-strong);
  content: "";
}

.line-step strong {
  display: block;
  margin-bottom: 5px;
  color: var(--teal-strong);
  font-size: 13px;
}

.line-step span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.line-step:hover {
  border-color: rgba(15, 118, 110, 0.38);
  background: var(--surface-soft);
}

.role-graph-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1fr) minmax(220px, 0.55fr);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(21, 32, 29, 0.04);
}

.role-graph-info,
.role-graph-lines,
.role-graph-docs {
  display: grid;
  align-content: start;
  gap: 10px;
}

.role-graph-info h3 {
  margin: 0;
}

.role-graph-info p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.graph-line-pill {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfc;
  padding: 10px;
  color: var(--ink);
}

.graph-line-pill:hover {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--surface-soft);
  text-decoration: none;
}

.graph-line-pill strong,
.graph-line-pill span {
  display: block;
}

.graph-line-pill strong {
  margin-bottom: 4px;
  font-size: 14px;
}

.graph-line-pill span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.search-panel {
  display: grid;
  gap: 14px;
}

.large-search {
  display: flex;
  gap: 10px;
}

.large-search input {
  min-height: 48px;
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 14px;
  outline: 0;
}

.large-search input:focus {
  border-color: rgba(15, 118, 110, 0.6);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

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

.assistant-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.5fr);
  gap: 14px;
  align-items: start;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: var(--radius);
  background: #f8fbff;
  padding: 16px;
}

.assistant-card h3 {
  margin: 8px 0 6px;
}

.assistant-card p {
  margin: 0 0 8px;
  color: #35423f;
  line-height: 1.62;
}

.assistant-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  color: var(--ink);
}

.result-item:hover {
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 8px 24px rgba(21, 32, 29, 0.06);
  text-decoration: none;
}

.result-item h3 {
  margin: 0;
  font-size: 17px;
}

.result-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

.reader-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  padding: 0;
  overflow: hidden;
}

.reader-main {
  min-width: 0;
  padding: 24px;
}

.reader-aside {
  border-left: 1px solid var(--line);
  background: #fbfcfc;
  padding: 18px;
}

.reader-header {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.reader-header h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.16;
}

.reader-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.mode-lens {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mode-lens > div {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfc;
  padding: 10px;
}

.mode-lens strong,
.mode-lens span {
  display: block;
}

.mode-lens strong {
  margin-bottom: 5px;
  color: var(--teal-strong);
  font-size: 13px;
}

.mode-lens span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.bilingual-aid {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: var(--radius);
  background: #f8fbff;
  padding: 12px;
}

.bilingual-aid h3 {
  margin: 0;
  font-size: 15px;
}

.term-pair-grid {
  display: grid;
  gap: 8px;
}

.term-pair {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 9px;
}

.term-pair strong,
.term-pair span,
.term-pair small {
  display: block;
}

.term-pair span {
  color: var(--teal-strong);
  font-weight: 750;
}

.term-pair small {
  color: var(--muted);
  line-height: 1.45;
}

.english-abstract {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: var(--radius-sm);
  background: #f8fbff;
  padding: 10px;
}

.english-abstract strong,
.english-abstract span {
  display: block;
}

.english-abstract strong {
  color: var(--blue);
  font-size: 13px;
}

.english-abstract span,
.english-abstract.compact {
  color: #3d4b48;
  font-size: 13px;
  line-height: 1.5;
}

.english-abstract.compact {
  border: 0;
  background: transparent;
  padding: 0;
}

.learning-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 18px;
}

.learning-main-card,
.learning-side-card,
.maintenance-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
  box-shadow: 0 8px 24px rgba(21, 32, 29, 0.04);
}

.learning-main-card {
  display: grid;
  align-content: start;
  gap: 12px;
}

.learning-main-card h2,
.learning-side-card h3 {
  margin: 0;
}

.learning-main-card p,
.learning-side-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
}

.learning-side-card {
  display: grid;
  align-content: start;
  gap: 12px;
}

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

.maintenance-panel {
  display: grid;
  gap: 14px;
}

.maintenance-panel summary {
  cursor: pointer;
  color: var(--teal-strong);
  font-weight: 800;
}

.doc-body {
  color: #22302c;
  font-size: 16px;
  line-height: 1.78;
}

.doc-body h1,
.doc-body h2,
.doc-body h3,
.doc-body h4 {
  margin: 1.5em 0 0.55em;
  color: var(--ink);
  letter-spacing: 0;
  line-height: 1.25;
}

.doc-body h1 {
  font-size: 30px;
}

.doc-body h2 {
  font-size: 23px;
}

.doc-body h3 {
  font-size: 19px;
}

.doc-body p,
.doc-body ul,
.doc-body ol,
.doc-body blockquote,
.doc-body table,
.doc-body pre {
  margin-bottom: 16px;
}

.doc-body ul,
.doc-body ol {
  padding-left: 1.4em;
}

.doc-body li {
  margin: 4px 0;
}

.doc-body blockquote {
  border-left: 4px solid var(--teal);
  margin-left: 0;
  padding: 10px 12px;
  background: var(--surface-soft);
  color: #32403c;
}

.doc-body code {
  border-radius: 4px;
  background: #edf2f1;
  padding: 2px 5px;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

.doc-body pre {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #12211f;
  color: #eef9f6;
  padding: 14px;
}

.doc-body pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.doc-body table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  margin: 0;
  background: var(--surface);
}

.doc-body th,
.doc-body td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.doc-body th {
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 750;
}

.diagram-block {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fbfcfc;
  padding: 12px;
}

.diagram-block strong {
  display: block;
  margin-bottom: 8px;
  color: var(--teal-strong);
}

.aside-block {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.aside-block h3 {
  margin: 0;
  font-size: 15px;
}

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

.aside-link {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 9px;
  color: var(--ink);
}

.aside-link:hover {
  border-color: rgba(15, 118, 110, 0.35);
  text-decoration: none;
}

.aside-link small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.toc-list {
  display: grid;
  gap: 6px;
}

.toc-link {
  display: block;
  width: 100%;
  border-left: 2px solid transparent;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
}

.toc-link:hover {
  border-left-color: var(--teal);
  background: var(--surface-soft);
  text-decoration: none;
}

.toc-link.level-2 {
  padding-left: 14px;
}

.toc-link.level-3 {
  padding-left: 22px;
  color: var(--muted);
}

.term-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px;
}

.term-details summary {
  cursor: pointer;
  color: var(--teal-strong);
  font-weight: 750;
}

.term-details .aside-list {
  margin-top: 10px;
}

.next-read {
  margin-top: 32px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.next-read h2 {
  margin-top: 0;
}

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

.empty-state {
  padding: 28px;
  text-align: center;
}

.empty-state p {
  margin: 8px auto 0;
  max-width: 560px;
  color: var(--muted);
  line-height: 1.65;
}

.loading {
  border-radius: var(--radius);
  background: linear-gradient(90deg, #eef2f1, #fbfcfc, #eef2f1);
  background-size: 240% 100%;
  animation: shimmer 1.25s infinite linear;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -100% 0;
  }
}

.mobile-tabs {
  display: none;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 214px minmax(0, 1fr);
  }

  .context-panel {
    display: none;
  }

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

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

@media (max-width: 860px) {
  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .app-shell {
    display: block;
  }

  .side-rail {
    display: none;
  }

  .main {
    padding: 18px 14px 34px;
  }

  .topbar {
    position: static;
    display: grid;
    margin: -18px -14px 16px;
    padding: 16px 14px;
  }

  #pageTitle {
    font-size: 24px;
    line-height: 1.22;
  }

  .topbar-actions {
    min-width: 0;
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: stretch;
  }

  .search-box {
    min-width: 100%;
    min-height: 46px;
  }

  .mode-toggle {
    width: 100%;
  }

  .language-toggle {
    width: 100%;
  }

  .mode-button,
  .language-button {
    flex: 1;
  }

  .hero-grid,
  .grid.two,
  .grid.three,
  .grid.four,
  .grid.five,
  .reader-shell,
  .mode-lens,
  .next-read-grid,
  .assistant-card,
  .chain-track,
  .judgment-strip,
  .role-graph-panel,
  .learning-dashboard,
  .saved-split {
    grid-template-columns: 1fr;
  }

  .quick-steps,
  .line-visual,
  .health-grid {
    grid-template-columns: 1fr;
  }

  .chain-map.large {
    padding: 12px;
  }

  .chain-map-head {
    display: grid;
  }

  .line-step:not(:last-child)::after {
    display: none;
  }

  .chain-node {
    min-height: 92px;
  }

  .chain-node:not(:last-child)::after {
    top: auto;
    right: 50%;
    bottom: -10px;
    transform: translateX(50%) rotate(135deg);
  }

  .reader-main {
    padding: 18px;
  }

  .reader-aside {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .path-item {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .path-item .ghost-button {
    grid-column: 2;
    justify-self: start;
  }

  .large-search {
    display: grid;
  }

  .large-search .solid-button {
    width: 100%;
  }

  .meta-row,
  .card-actions,
  .filter-row,
  .graph-nodes,
  .assistant-links {
    gap: 7px;
  }

  .card-actions > .ghost-button,
  .card-actions > .solid-button {
    flex: 1 1 148px;
  }

  .result-item {
    padding: 12px;
  }

  .task-result .card-actions > .ghost-button,
  .task-result .card-actions > .solid-button {
    flex-basis: 100%;
  }

  .doc-body table,
  .doc-body thead,
  .doc-body tbody,
  .doc-body tr,
  .doc-body td {
    display: block;
  }

  .doc-body table {
    min-width: 0;
  }

  .doc-body thead {
    display: none;
  }

  .doc-body tr {
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }

  .doc-body td {
    border-bottom: 0;
    padding: 7px 10px;
  }

  .doc-body td::before {
    display: block;
    margin-bottom: 3px;
    color: var(--teal-strong);
    content: attr(data-label);
    font-size: 12px;
    font-weight: 750;
  }

  .mobile-tabs {
    position: fixed;
    z-index: 10;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    backdrop-filter: blur(18px);
  }

  .mobile-tab {
    min-height: 44px;
    color: var(--muted);
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .hero-panel {
    padding: 18px;
  }

  .hero-panel h2 {
    font-size: 28px;
  }

  #pageTitle {
    font-size: 22px;
  }

  .eyebrow {
    font-size: 11px;
  }

  .doc-card,
  .role-card,
  .template-card,
  .audit-card,
  .path-card,
  .graph-card,
  .card {
    padding: 14px;
  }

  .doc-body {
    font-size: 15px;
  }

  .reader-header h2 {
    font-size: 26px;
  }

  .ghost-button,
  .solid-button,
  .chip-button,
  .filter-button {
    min-height: 38px;
  }

  .chip-button,
  .filter-button {
    padding: 0 10px;
  }

  .node-chip {
    border-radius: var(--radius-sm);
  }
}

@media (max-width: 380px) {
  .main {
    padding-right: 12px;
    padding-left: 12px;
  }

  .topbar {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .mode-button,
  .language-button {
    padding: 0 9px;
  }

  .mobile-tabs {
    padding-right: 6px;
    padding-left: 6px;
  }

  .mobile-tab {
    font-size: 12px;
  }
}
