/* ──────────────────────────────────────────────────────────
   Variation B — TERMINAL styles
   3-col docs layout: nav 280 · doc 1fr · toc 240
   ────────────────────────────────────────────────────────── */

.sw.term {
  display: grid;
  grid-template-columns: 290px 1fr 240px;
  height: 100%;
  width: 100%;
  background: var(--bg-0);
  overflow: hidden;
}

/* ── Nav ─────────────────────────────────────────────── */
.term-nav {
  background: var(--bg-1);
  border-right: 1px solid var(--bd);
  overflow-y: auto;
  padding: 14px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.term-brand {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bd);
}
.term-prompt { color: var(--accent-strong); }

/* ── Ask-AI researcher ────────────────────────── */
.term-ask {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px 10px;
  background:
    linear-gradient(180deg, oklch(0.78 0.14 165 / 0.06), oklch(0.78 0.14 165 / 0.02)),
    var(--bg-2);
  border: 1px solid oklch(0.78 0.14 165 / 0.28);
  border-radius: 6px;
  position: relative;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.term-ask:focus-within {
  border-color: oklch(0.78 0.14 165 / 0.6);
  box-shadow: 0 0 0 3px oklch(0.78 0.14 165 / 0.10);
}
.term-ask.is-loading { border-color: oklch(0.78 0.14 165 / 0.6); }
.term-ask.is-error   { border-color: oklch(0.72 0.18 28 / 0.6); }
.term-ask.is-success { border-color: oklch(0.78 0.14 165 / 0.55); }

.term-ask-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-2);
}
.term-ask-spark { color: var(--accent); font-size: 11px; animation: termAskSpark 3s ease-in-out infinite; }
@keyframes termAskSpark {
  0%, 100% { opacity: 0.6; transform: scale(1) rotate(0deg); }
  50%      { opacity: 1;   transform: scale(1.15) rotate(180deg); }
}
.term-ask-label { color: var(--accent-strong); letter-spacing: 0.08em; }
.term-ask-badge {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 1px 5px;
  border: 1px solid oklch(0.78 0.14 165 / 0.35);
  background: oklch(0.78 0.14 165 / 0.1);
  color: var(--accent-strong);
  border-radius: 3px;
  text-transform: lowercase;
}

.term-ask-row {
  display: grid;
  grid-template-columns: 14px 1fr 26px;
  align-items: center;
  gap: 6px;
}
.term-ask-prompt { color: var(--accent); font-size: 13px; }
.term-ask-input {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-0);
  background: transparent;
  border: 0;
  outline: 0;
  padding: 4px 0;
  width: 100%;
  caret-color: var(--accent);
}
.term-ask-input::placeholder { color: var(--fg-3); }
.term-ask-input:disabled { color: var(--fg-2); }

.term-ask-go {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 4px;
  font-size: 13px;
  background: var(--accent);
  color: var(--bg-0);
  border: 0;
  cursor: pointer;
  transition: background var(--duration) var(--ease), opacity var(--duration) var(--ease);
}
.term-ask-go:disabled { background: var(--bg-3); color: var(--fg-3); cursor: not-allowed; }
.term-ask-go:not(:disabled):hover { background: var(--accent-strong); }

.term-ask-spin {
  width: 11px; height: 11px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 999px;
  animation: termAskSpin 0.7s linear infinite;
}
@keyframes termAskSpin { to { transform: rotate(360deg); } }

.term-ask-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-1);
  padding: 2px 0 0 2px;
}
.term-ask-status.is-success { color: var(--accent-strong); }
.term-ask-status.is-dup     { color: oklch(0.82 0.14 70); }
.term-ask-status.is-error   { color: oklch(0.78 0.16 28); }

.term-ask-dots { display: inline-flex; gap: 3px; }
.term-ask-dots i {
  width: 4px; height: 4px;
  border-radius: 999px;
  background: var(--accent);
  display: block;
  animation: termAskDot 1.2s ease-in-out infinite;
}
.term-ask-dots i:nth-child(2) { animation-delay: 0.15s; }
.term-ask-dots i:nth-child(3) { animation-delay: 0.30s; }
@keyframes termAskDot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40%           { opacity: 1;   transform: scale(1.2); }
}
.term-ask-error-x {
  margin-left: auto;
  font-size: 10px;
  color: var(--fg-2);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.term-ask-error-x:hover { color: var(--fg-0); }

.term-queue-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin-top: -4px;
  background: transparent;
  border: 1px dashed var(--bd);
  border-radius: 4px;
  color: var(--fg-2);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: border-color var(--duration) var(--ease), color var(--duration) var(--ease), background var(--duration) var(--ease);
}
.term-queue-link:hover {
  color: var(--accent-strong);
  border-color: oklch(0.78 0.14 165 / 0.45);
  background: oklch(0.78 0.14 165 / 0.06);
}
.term-queue-link span:first-child { color: var(--accent); }

.term-search {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  background: var(--bg-2);
  border: 1px solid var(--bd-2);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  transition: border-color var(--duration) var(--ease);
}
.term-search:focus-within { border-color: oklch(0.78 0.14 165 / 0.55); }
.term-search > span:first-child { color: var(--accent); }
.term-search input { font-family: var(--font-mono); font-size: 12px; }
.term-search input::placeholder { color: var(--fg-3); }
.term-search-x { color: var(--fg-2); font-size: 11px; padding: 0 2px; }
.term-search-x:hover { color: var(--fg-0); }

.term-nav-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--fg-2);
  padding: 0 2px;
}

.term-tree { display: flex; flex-direction: column; gap: 12px; }
.term-tree-cat-head {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 4px 4px;
}
.term-tree-marker { font-size: 10px; }
.term-tree-cat-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-1);
}
.term-tree-cat-n { font-size: 10px; color: var(--fg-2); }

.term-tree-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-left: 1px solid var(--bd);
  margin-left: 6px;
  padding-left: 6px;
}
.term-tree-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  align-items: baseline;
}
.term-tree-item:hover { background: var(--bg-2); }
.term-tree-item.is-selected {
  background: var(--accent-soft);
}
.term-tree-item.is-selected .term-tree-title { color: var(--accent-strong); font-weight: 600; }
.term-tree-id { font-size: 10.5px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-tree-title { color: var(--fg-0); }
.term-tree-empty { font-size: 10.5px; color: var(--fg-3); padding: 4px 6px; }

/* tag groups */
.term-groups { display: flex; flex-direction: column; gap: 6px; }
.term-groups-head {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 2px 4px;
  border-bottom: 1px solid var(--bd);
}
.term-groups-hint { color: var(--fg-3); text-transform: none; letter-spacing: 0; }

.term-group {
  border: 1px dashed var(--bd);
  border-radius: 5px;
  padding: 8px;
  transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease);
}
.term-group.is-drop {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.term-group-head {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 10.5px;
  color: var(--fg-2);
  margin-bottom: 6px;
}
.term-group-bracket { color: var(--fg-3); }
.term-group-label { color: var(--accent); letter-spacing: 0.04em; }
.term-group-n { margin-left: auto; }
.term-group-tags { display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; }
.term-group-empty { font-size: 10.5px; color: var(--fg-3); padding: 2px 0; }

/* ── Doc column ───────────────────────────────────────── */
.term-doc {
  overflow-y: auto;
  padding: 0;
  background: var(--bg-0);
}
.term-doc-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 36px 80px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.term-crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-2);
  padding: 16px 36px 0;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
.term-crumb-sep { color: var(--fg-3); }
.term-crumb-current { color: var(--fg-0); }

.term-doc-head { display: flex; flex-direction: column; gap: 6px; }
.term-doc-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--fg-2);
}
.term-doc-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: var(--r-tag);
  border: 1px solid;
}
.term-doc-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.022em;
  margin: 6px 0 0;
  line-height: 1.1;
  text-wrap: balance;
}
.term-doc-title-id {
  font-size: 16px;
  color: var(--fg-3);
  font-weight: 400;
  letter-spacing: 0;
}
.term-doc-aka { font-size: 12px; color: var(--fg-2); }

.term-callout {
  background: var(--bg-1);
  border: 1px solid var(--bd);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.term-callout-head {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.term-callout-body {
  font-size: 14px;
  color: var(--fg-0);
  text-wrap: pretty;
  line-height: 1.55;
}

.term-section { display: flex; flex-direction: column; gap: 10px; }
.term-h2 {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-2);
  text-transform: lowercase;
  letter-spacing: 0.02em;
  margin: 0;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--bd);
}
.term-disclose {
  display: flex; align-items: center; gap: 6px;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.term-disclose-caret { color: var(--accent); }

.term-body {
  font-size: 14px;
  color: var(--fg-1);
  line-height: 1.6;
  margin: 0;
  text-wrap: pretty;
}

.term-empty { color: var(--fg-3); font-size: 12px; }

/* code block */
.term-code {
  background: var(--bg-1);
  border: 1px solid var(--bd);
  border-radius: 6px;
  overflow: hidden;
}
.term-code-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--bd);
  font-size: 11px;
  color: var(--fg-2);
}
.term-code-actions { color: var(--fg-2); cursor: pointer; }
.term-code-actions:hover { color: var(--accent-strong); }
.term-code-body {
  margin: 0;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--fg-0);
  white-space: pre;
  overflow-x: auto;
}

.term-tags { display: flex; flex-wrap: wrap; gap: 5px; }

.term-sources { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.term-sources li {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 6px 10px;
  background: var(--bg-1);
  border: 1px solid var(--bd);
  border-radius: 5px;
  font-size: 12.5px;
}
.term-sources li:hover { background: var(--bg-2); }
.term-src-idx { color: var(--fg-3); font-size: 11px; }
.term-src-label { color: var(--fg-0); }
.term-src-host { color: var(--fg-2); font-size: 11px; }

.term-history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.term-history li {
  display: grid;
  grid-template-columns: 100px 14px 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 4px 0;
}
.term-hist-date { color: var(--fg-2); font-size: 11px; }
.term-hist-arrow { color: var(--accent); font-size: 11px; }
.term-hist-note { color: var(--fg-1); font-size: 13px; text-wrap: pretty; }

.term-doc-foot {
  display: flex; gap: 8px; align-items: center;
  font-size: 11px; color: var(--fg-3);
  padding-top: 16px;
  border-top: 1px solid var(--bd);
}

/* ── TOC ─────────────────────────────────────────────── */
.term-toc {
  border-left: 1px solid var(--bd);
  background: var(--bg-0);
  padding: 18px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

/* ── Pending queue panel ─────────────────────────────── */
.term-queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px 8px;
  background:
    linear-gradient(180deg, oklch(0.78 0.14 165 / 0.05), transparent 60%),
    var(--bg-1);
  border: 1px solid var(--bd);
  border-radius: 6px;
  position: relative;
}
.term-queue.is-empty {
  background: transparent;
  border-style: dashed;
  border-color: var(--bd);
}

.term-queue-head {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-2);
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--bd);
  margin-bottom: 2px;
}
.term-queue.is-empty .term-queue-head { border-bottom-color: transparent; padding-bottom: 0; margin-bottom: 0; }

.term-queue-dot {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--bd-2);
}
.term-queue-dot.is-active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px oklch(0.78 0.14 165 / 0.18);
  animation: termQueuePulse 1.6s ease-in-out infinite;
}
@keyframes termQueuePulse {
  0%, 100% { box-shadow: 0 0 0 3px oklch(0.78 0.14 165 / 0.18); }
  50%      { box-shadow: 0 0 0 5px oklch(0.78 0.14 165 / 0.08); }
}

.term-queue-n {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--fg-1);
  letter-spacing: 0;
}
.term-queue.is-empty .term-queue-n { background: transparent; color: var(--fg-3); padding: 0; }

.term-queue-empty {
  font-size: 11px;
  color: var(--fg-3);
  padding: 6px 2px 0;
}
.term-queue-hint {
  font-size: 10.5px;
  color: var(--fg-3);
  padding: 0 2px 2px;
}

.term-queue-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }

.term-queue-item {
  display: grid;
  grid-template-columns: 18px 14px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 6px;
  border-radius: 4px;
  background: var(--bg-2);
  border: 1px solid var(--bd);
  position: relative;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease), opacity 240ms var(--ease), transform 240ms var(--ease);
  animation: termQueueIn 220ms var(--ease);
}
@keyframes termQueueIn {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}
.term-queue-item.is-checking,
.term-queue-item.is-loading {
  border-color: oklch(0.78 0.14 165 / 0.45);
  background: oklch(0.78 0.14 165 / 0.06);
}
.term-queue-item.is-complete {
  border-color: oklch(0.76 0.14 145 / 0.5);
  background: oklch(0.76 0.14 145 / 0.06);
}
.term-queue-item.is-error,
.term-queue-item.is-rejected {
  border-color: oklch(0.72 0.18 28 / 0.55);
  background: oklch(0.72 0.18 28 / 0.08);
}

.term-queue-idx { font-size: 10px; color: var(--fg-3); text-align: right; }

.term-queue-state {
  width: 14px; height: 14px;
  display: grid; place-items: center;
  color: var(--fg-2);
}
.term-queue-item.is-checking .term-queue-state,
.term-queue-item.is-loading .term-queue-state { color: var(--accent); }
.term-queue-item.is-complete .term-queue-state { color: oklch(0.78 0.14 145); }
.term-queue-item.is-error   .term-queue-state,
.term-queue-item.is-rejected .term-queue-state { color: oklch(0.78 0.16 28); }

.term-queue-pending-glyph { font-size: 13px; line-height: 1; letter-spacing: 0; }
.term-queue-ok-glyph      { font-size: 11px; }
.term-queue-err-glyph     { font-size: 11px; }

.term-queue-spin {
  width: 10px; height: 10px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 999px;
  animation: termAskSpin 0.7s linear infinite;
}

.term-queue-keyword-wrap { display: flex; flex-direction: column; min-width: 0; }
.term-queue-keyword {
  font-size: 12px;
  color: var(--fg-0);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-queue-sub {
  font-size: 10px;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-queue-item.is-checking .term-queue-sub,
.term-queue-item.is-loading .term-queue-sub { color: var(--accent-strong); }
.term-queue-item.is-complete .term-queue-sub { color: oklch(0.80 0.14 145); }
.term-queue-item.is-error   .term-queue-sub,
.term-queue-item.is-rejected .term-queue-sub { color: oklch(0.78 0.16 28); }
.term-queue-loading-text {
  display: inline-block;
  position: relative;
  padding-right: 10px;
}
.term-queue-loading-text::after {
  content: '';
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 3px;
  border-radius: 999px;
  background: var(--accent);
  animation: termQueueDot 0.9s ease-in-out infinite;
}
@keyframes termQueueDot { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

.term-queue-actions { display: flex; gap: 2px; }
.term-queue-btn {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 3px;
  background: transparent;
  color: var(--fg-2);
  font-size: 11px;
  border: 0;
  cursor: pointer;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.term-queue-btn:hover { background: var(--bg-3); color: var(--fg-0); }
.term-queue-item.is-error .term-queue-btn:hover,
.term-queue-item.is-rejected .term-queue-btn:hover { background: oklch(0.72 0.18 28 / 0.15); color: oklch(0.86 0.10 28); }
.term-toc-head {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-2);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--bd);
}
.term-toc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.term-toc-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--fg-1);
  border-left: 1px solid var(--bd);
  border-radius: 0 4px 4px 0;
}
.term-toc-link:hover { color: var(--fg-0); background: var(--bg-2); border-left-color: var(--bd-3); }
.term-toc-marker { color: var(--fg-3); }

.term-toc-related { display: flex; flex-direction: column; gap: 2px; }
.term-toc-related-item {
  display: grid;
  grid-template-columns: 8px auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
}
.term-toc-related-item:hover { background: var(--bg-2); }
.term-toc-related-dot { width: 6px; height: 6px; border-radius: 999px; }
.term-toc-related-id { color: var(--fg-2); font-size: 10.5px; }
.term-toc-related-title { color: var(--fg-0); font-size: 12px; }

.term-toc-shortcuts { display: flex; flex-direction: column; gap: 6px; }
.term-toc-kbd-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--fg-2);
}

.term-manager-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.term-toc-num {
  color: var(--fg-3);
  font-size: 10px;
  letter-spacing: 0.04em;
  min-width: 16px;
  font-family: var(--font-mono);
}
.term-toc-link:hover .term-toc-num { color: var(--accent); }

/* ──────────────────────────────────────────────────────
   Restructured doc blocks (01 · 02 · 03 · 04 · 05)
   ────────────────────────────────────────────────────── */

.term-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-margin-top: 16px;
}
.term-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--bd);
}
.term-block-head-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.term-block-num {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--accent-strong);
  padding: 2px 6px;
  border-radius: 3px;
  background: oklch(0.78 0.14 165 / 0.12);
  border: 1px solid oklch(0.78 0.14 165 / 0.3);
  line-height: 1;
}
.term-block-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-0);
  margin: 0;
  letter-spacing: -0.01em;
}
.term-block-hint {
  font-size: 11px;
  color: var(--fg-3);
  text-align: right;
}
.term-block-body { display: flex; flex-direction: column; gap: 12px; }

.term-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}
.term-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: var(--bg-1);
  border: 1px solid var(--bd);
  border-radius: 5px;
}
.term-metric-k {
  font-size: 10px;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.term-metric-v {
  font-size: 13.5px;
  color: var(--fg-0);
  font-weight: 500;
  letter-spacing: -0.005em;
}

.term-suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.term-suggestion {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--bd);
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--duration) var(--ease),
              background var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}
.term-suggestion:hover {
  background: var(--bg-2);
  border-color: oklch(0.78 0.14 165 / 0.4);
}
.term-suggestion:active { transform: translateY(1px); }
.term-suggestion.is-queued {
  border-color: oklch(0.78 0.14 165 / 0.6);
  background: oklch(0.78 0.14 165 / 0.06);
}
.term-suggestion.is-dup {
  border-color: oklch(0.78 0.13 70 / 0.6);
  background: oklch(0.78 0.13 70 / 0.05);
}
.term-suggestion-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.term-suggestion-glyph {
  color: var(--accent);
  font-size: 13px;
  width: 12px;
}
.term-suggestion.is-existing .term-suggestion-glyph { color: var(--fg-2); }
.term-suggestion-keyword {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg-0);
  letter-spacing: -0.005em;
}
.term-suggestion-pill {
  margin-left: auto;
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-3);
  color: var(--fg-2);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}
.term-suggestion-reason {
  font-size: 11px;
  color: var(--fg-2);
  text-wrap: pretty;
}
.term-suggestion-foot {
  font-size: 10.5px;
  color: var(--fg-3);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.term-suggestion.is-queued .term-suggestion-foot { color: var(--accent-strong); }
.term-suggestion.is-dup .term-suggestion-foot { color: oklch(0.86 0.13 70); }

.term-notes {
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border: 1px solid var(--bd);
  border-radius: 7px;
  overflow: hidden;
}
.term-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-2);
  border-bottom: 1px solid var(--bd);
  overflow-x: auto;
  scrollbar-width: none;
}
.term-tabs::-webkit-scrollbar { display: none; }
.term-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 9px;
  font-size: 11.5px;
  color: var(--fg-2);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: color var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              background var(--duration) var(--ease);
}
.term-tab:hover {
  color: var(--fg-0);
  background: oklch(0.78 0.14 165 / 0.04);
}
.term-tab.is-active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
  background: var(--bg-1);
}
.term-tab-glyph { font-size: 11px; color: var(--fg-3); }
.term-tab.is-active .term-tab-glyph { color: var(--accent); }
.term-tab-label { font-family: var(--font-mono); }
.term-tab-n {
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--fg-2);
}
.term-tab.is-active .term-tab-n {
  background: oklch(0.78 0.14 165 / 0.18);
  color: var(--accent-strong);
}
.term-tab-panel {
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.term-tab-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--fg-3);
}
.term-tab-meta .sep { color: var(--bd-3); }

.term-web-results,
.term-papers {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.term-web-results { gap: 10px; }
.term-papers { gap: 8px; }
.term-web-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-0);
  border: 1px solid var(--bd);
  border-radius: 5px;
}
.term-web-result:hover { border-color: var(--bd-2); }
.term-web-result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.term-web-result-title {
  font-size: 13.5px;
  color: oklch(0.82 0.12 250);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.term-web-result-host {
  font-size: 10.5px;
  color: var(--fg-2);
  white-space: nowrap;
}
.term-web-result-snippet {
  font-size: 12px;
  color: var(--fg-1);
  margin: 0;
  line-height: 1.5;
  text-wrap: pretty;
}
.term-paper {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--bg-0);
  border: 1px solid var(--bd);
  border-left: 2px solid oklch(0.76 0.11 250);
  border-radius: 5px;
}
.term-paper-venue {
  font-size: 10.5px;
  color: oklch(0.78 0.10 250);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.term-paper-title {
  font-size: 13.5px;
  color: var(--fg-0);
  font-weight: 500;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}
.term-paper-authors {
  font-size: 11px;
  color: var(--fg-2);
  font-style: italic;
}

.term-wiki-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.term-wiki-textarea {
  width: 100%;
  min-height: 260px;
  padding: 14px 16px;
  background: var(--bg-0);
  border: 1px solid var(--bd);
  border-radius: 6px;
  color: var(--fg-0);
  font-size: 12.5px;
  line-height: 1.65;
  resize: vertical;
  outline: none;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.term-wiki-textarea:focus {
  border-color: oklch(0.78 0.14 165 / 0.55);
  box-shadow: 0 0 0 3px oklch(0.78 0.14 165 / 0.08);
}
.term-wiki-textarea::placeholder { color: var(--fg-3); }
.term-wiki-rendered {
  min-height: 260px;
  padding: 16px 18px;
  background: var(--bg-0);
  border: 1px solid var(--bd);
  border-radius: 6px;
  color: var(--fg-1);
  line-height: 1.68;
  overflow-x: auto;
}
.term-wiki-rendered h1,
.term-wiki-rendered h2,
.term-wiki-rendered h3,
.term-wiki-rendered h4 {
  margin: 0 0 10px;
  color: var(--fg-0);
  font-weight: 650;
  letter-spacing: 0;
}
.term-wiki-rendered h1 { font-size: 24px; }
.term-wiki-rendered h2 {
  margin-top: 20px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--bd);
  font-size: 19px;
}
.term-wiki-rendered h3 { margin-top: 18px; font-size: 16px; }
.term-wiki-rendered h4 { margin-top: 16px; font-size: 14px; color: var(--fg-1); }
.term-wiki-rendered p {
  margin: 0 0 12px;
  font-size: 13.5px;
  text-wrap: pretty;
}
.term-wiki-rendered hr {
  margin: 18px 0;
  border: 0;
  border-top: 1px dashed var(--bd-2);
}
.term-wiki-rendered ul,
.term-wiki-rendered ol {
  margin: 0 0 14px;
  padding-left: 22px;
}
.term-wiki-rendered li {
  margin: 4px 0;
  font-size: 13.5px;
}
.term-wiki-rendered blockquote {
  margin: 0 0 14px;
  padding: 9px 12px;
  border-left: 2px solid var(--accent);
  background: var(--bg-1);
  color: var(--fg-1);
}
.term-wiki-rendered code {
  padding: 1px 5px;
  border: 1px solid var(--bd);
  border-radius: 4px;
  background: var(--bg-2);
  color: var(--accent-strong);
  font-family: inherit;
  font-size: 12px;
}
.term-wiki-rendered pre {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--bd);
  border-radius: 6px;
  overflow-x: auto;
}
.term-wiki-rendered pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg-0);
  white-space: pre;
}
.term-wiki-rendered a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.term-wiki-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.term-wiki-status {
  font-size: 10.5px;
  color: var(--fg-3);
}
.term-wiki-status.is-saving { color: var(--accent-strong); }
.term-wiki-status.is-saved { color: oklch(0.80 0.14 145); }
.term-wiki-status.is-error { color: oklch(0.78 0.16 28); }
.term-wiki-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}
.term-wiki-save {
  height: 28px;
  padding: 0 10px;
  border-radius: 4px;
  border: 1px solid oklch(0.78 0.14 165 / 0.35);
  background: oklch(0.78 0.14 165 / 0.12);
  color: var(--accent-strong);
  font-size: 11px;
}
.term-wiki-save:not(:disabled):hover {
  background: oklch(0.78 0.14 165 / 0.18);
  border-color: oklch(0.78 0.14 165 / 0.55);
}
.term-wiki-save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 980px) {
  .term-suggestions { grid-template-columns: 1fr; }
  .term-block-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .term-block-hint { text-align: left; }
}
