/* ==========================================================================
   LanTai 兰台 · 设计系统
   方向：档案/典籍馆式的编辑型界面（editorial archive），克制、精确、可长期阅读。
   命名：BEM 近似的扁平类名（.lt- 前缀用于组件）。
   ========================================================================== */

/* --- Design tokens ------------------------------------------------------- */
:root {
  color-scheme: light dark;

  /* palette · light (parchment + ink) */
  --bg: #f5f3ee;
  --bg-tint: #efece4;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --ink: #14161c;
  --ink-2: #4a4f5c;
  --ink-3: #777d8b;
  --rule: #e5e2d9;
  --rule-strong: #cfcbbb;

  --primary: #1e3a5f;
  --primary-hover: #16304f;
  --primary-ink: #ffffff;
  --primary-soft: #e8eef6;

  --seal: #b23a2e;
  --seal-soft: #fbeae7;
  --jade: #2e7d64;
  --jade-soft: #e6f2ee;
  --amber: #9a6612;
  --amber-soft: #fbf0dc;

  --focus: #1e3a5f;

  /* type */
  --font-sans:
    system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", sans-serif;
  --font-serif:
    "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", ui-serif, Georgia,
    "Times New Roman", serif;
  --font-mono:
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* space */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;

  /* radii + shadow */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(20, 22, 28, 0.05), 0 1px 3px rgba(20, 22, 28, 0.04);
  --shadow-2: 0 6px 24px rgba(20, 22, 28, 0.1), 0 2px 6px rgba(20, 22, 28, 0.06);

  --maxw: 1080px;
  --t: 160ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10131a;
    --bg-tint: #0c0f15;
    --surface: #171b23;
    --surface-2: #1d222c;
    --ink: #eef1f6;
    --ink-2: #a9b1c0;
    --ink-3: #7c8493;
    --rule: #2a303b;
    --rule-strong: #3a424f;

    --primary: #8fb4e0;
    --primary-hover: #a8c6ea;
    --primary-ink: #0d1620;
    --primary-soft: #1b2836;

    --seal: #e69086;
    --seal-soft: #33211f;
    --jade: #6cc3a4;
    --jade-soft: #16281f;
    --amber: #e0b169;
    --amber-soft: #2e2617;
    --focus: #8fb4e0;
  }
}

/* --- Reset / base -------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 var(--s3);
  text-wrap: balance;
}
h1 {
  font-size: clamp(1.6rem, 1.1rem + 2vw, 2.3rem);
}
h2 {
  font-size: 1.3rem;
  margin-top: var(--s6);
}
h3 {
  font-size: 1.05rem;
  margin-top: var(--s5);
}
p {
  margin: 0 0 var(--s3);
}
a {
  color: var(--primary);
  text-decoration-color: color-mix(in oklab, var(--primary) 35%, transparent);
  text-underline-offset: 2px;
}
a:hover {
  text-decoration-color: currentColor;
}
code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.86em;
}
hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--s5) 0;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
::selection {
  background: color-mix(in oklab, var(--primary) 24%, transparent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: var(--s4);
  top: -60px;
  z-index: 60;
  background: var(--surface);
  color: var(--ink);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-2);
  transition: top var(--t);
}
.skip-link:focus {
  top: var(--s4);
}

/* --- Layout -------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--s5);
}
.container--wide {
  max-width: 1240px;
}
.stack > * + * {
  margin-top: var(--s4);
}
.stack-lg > * + * {
  margin-top: var(--s6);
}
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
}
.spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
}
.muted {
  color: var(--ink-2);
}
.faint {
  color: var(--ink-3);
}
.mono {
  font-family: var(--font-mono);
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.num {
  font-variant-numeric: tabular-nums;
}
main {
  display: block;
}

/* --- Top bar ------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar__inner {
  display: flex;
  align-items: center;
  gap: var(--s5);
  min-height: 60px;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s2);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand__seal {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--seal);
  color: #fff;
  font-size: 0.72rem;
  font-family: var(--font-sans);
  font-weight: 700;
  translate: 0 -1px;
}
.brand__sub {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.topnav {
  display: flex;
  align-items: center;
  gap: var(--s1);
  margin-left: auto;
}
.topnav a {
  color: var(--ink-2);
  text-decoration: none;
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  font-weight: 500;
  white-space: nowrap;
  transition:
    background var(--t),
    color var(--t);
}
.topnav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.topnav a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.navtoggle {
  display: none;
}

@media (max-width: 760px) {
  .navtoggle {
    display: inline-flex;
    margin-left: auto;
  }
  .topnav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 60px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--s2) var(--s4) var(--s4);
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow-2);
  }
  .topnav.is-open {
    display: flex;
  }
  .topnav a {
    padding: var(--s3);
  }
}

/* --- Footer -------------------------------------------------------------- */
.sitefoot {
  border-top: 1px solid var(--rule);
  margin-top: var(--s8);
  padding: var(--s6) 0 var(--s7);
  color: var(--ink-3);
  font-size: 0.82rem;
}
.sitefoot__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4) var(--s6);
  justify-content: space-between;
}

/* --- Page header --------------------------------------------------------- */
.pagehead {
  padding: var(--s7) 0 var(--s5);
  border-bottom: 1px solid var(--rule);
}
.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--seal);
  margin: 0 0 var(--s3);
}
.lede {
  color: var(--ink-2);
  max-width: 68ch;
  font-size: 1.02rem;
}

/* --- Card ---------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: var(--shadow-1);
}
.card--flush {
  padding: 0;
  overflow: hidden;
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}
.card__head h2,
.card__head h3 {
  margin: 0;
  font-size: 1rem;
}
.card__body {
  padding: var(--s5);
}
.card__foot {
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface);
  --btn-ink: var(--ink);
  --btn-bd: var(--rule-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: 0 var(--s4);
  min-height: 38px;
  border: 1px solid var(--btn-bd);
  border-radius: var(--r);
  background: var(--btn-bg);
  color: var(--btn-ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background var(--t),
    border-color var(--t),
    color var(--t),
    transform var(--t);
}
.btn:hover {
  background: var(--surface-2);
  border-color: var(--ink-3);
}
.btn:active {
  transform: translateY(1px);
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn--primary {
  --btn-bg: var(--primary);
  --btn-ink: var(--primary-ink);
  --btn-bd: var(--primary);
}
.btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn--danger {
  --btn-bg: var(--seal);
  --btn-ink: #fff;
  --btn-bd: var(--seal);
}
.btn--danger:hover {
  background: color-mix(in oklab, var(--seal) 82%, #000);
  border-color: transparent;
}
.btn--ghost {
  --btn-bg: transparent;
  --btn-bd: transparent;
}
.btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--rule);
}
.btn--sm {
  min-height: 30px;
  padding: 0 var(--s3);
  font-size: 0.82rem;
}
.btn--block {
  width: 100%;
}
.btn__spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: lt-spin 0.7s linear infinite;
}
@keyframes lt-spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Tags / status ------------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--rule-strong);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}
.tag--plain::before {
  display: none;
}
.tag--frozen,
.tag--published {
  color: var(--jade);
  border-color: color-mix(in oklab, var(--jade) 40%, transparent);
  background: var(--jade-soft);
}
.tag--draft,
.tag--pending {
  color: var(--amber);
  border-color: color-mix(in oklab, var(--amber) 40%, transparent);
  background: var(--amber-soft);
}
.tag--staged {
  color: var(--primary);
  border-color: color-mix(in oklab, var(--primary) 38%, transparent);
  background: var(--primary-soft);
}
.tag--rejected,
.tag--error {
  color: var(--seal);
  border-color: color-mix(in oklab, var(--seal) 40%, transparent);
  background: var(--seal-soft);
}

/* --- Tables -------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table th,
.table td {
  text-align: left;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
.table th {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  background: var(--surface-2);
  position: sticky;
  top: 0;
}
.table tbody tr:hover {
  background: var(--surface-2);
}
.table td code {
  word-break: break-all;
}

/* --- Forms --------------------------------------------------------------- */
.field {
  display: block;
  margin-bottom: var(--s4);
}
.label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: var(--s2);
}
.hint {
  font-size: 0.78rem;
  color: var(--ink-3);
  margin-top: var(--s2);
}
.input,
.select,
.textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  transition:
    border-color var(--t),
    box-shadow var(--t);
}
.select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 52%,
    calc(100% - 13px) 52%;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--ink-3);
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 22%, transparent);
}
.input[aria-invalid="true"] {
  border-color: var(--seal);
}
input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}
.field__error {
  color: var(--seal);
  font-size: 0.8rem;
  margin-top: var(--s2);
}

/* --- Steps --------------------------------------------------------------- */
.steps {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  list-style: none;
  margin: 0 0 var(--s5);
  padding: 0;
  counter-reset: step;
}
.steps li {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: 0.84rem;
  color: var(--ink-3);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-pill);
  border: 1px solid transparent;
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 0.72rem;
  font-weight: 700;
}
.steps li[data-state="current"] {
  color: var(--primary);
  background: var(--primary-soft);
}
.steps li[data-state="done"] {
  color: var(--jade);
}
.steps li[data-state="done"]::before {
  content: "✓";
}

/* --- Callout / notes ----------------------------------------------------- */
.callout {
  display: flex;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--r);
  background: var(--surface-2);
  font-size: 0.88rem;
  color: var(--ink-2);
}
.callout--info {
  border-left-color: var(--primary);
  background: var(--primary-soft);
}
.callout--warn {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}
.callout--danger {
  border-left-color: var(--seal);
  background: var(--seal-soft);
}

/* --- Empty / loading ----------------------------------------------------- */
.empty {
  text-align: center;
  padding: var(--s7) var(--s5);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-lg);
  color: var(--ink-2);
  background: var(--surface-2);
}
.empty h3 {
  margin-top: 0;
}
.skeleton {
  display: block;
  height: 12px;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--rule) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: lt-shimmer 1.4s ease infinite;
}
@keyframes lt-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

/* --- Tabs ---------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: var(--s1);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--s5);
  overflow-x: auto;
}
.tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: var(--s3) var(--s3);
  color: var(--ink-2);
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--primary);
}
.tabs button:hover {
  color: var(--ink);
}

/* --- Key/value ----------------------------------------------------------- */
.kv {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: var(--s2) var(--s4);
  font-size: 0.88rem;
}
.kv dt {
  color: var(--ink-3);
}
.kv dd {
  margin: 0;
  word-break: break-word;
  min-width: 0;
}

/* --- Console shell ------------------------------------------------------- */
.console {
  display: grid;
  grid-template-columns: 232px 1fr;
  gap: var(--s6);
  align-items: start;
  padding: var(--s6) 0 var(--s8);
}
.sidenav {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidenav__group {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: var(--s4) var(--s3) var(--s2);
}
.sidenav a {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: var(--r);
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
}
.sidenav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.sidenav a[aria-current="page"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.console__main {
  min-width: 0;
}
@media (max-width: 900px) {
  .console {
    grid-template-columns: 1fr;
    gap: var(--s4);
  }
  .sidenav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--s2);
    border-bottom: 1px solid var(--rule);
    padding-bottom: var(--s3);
  }
  .sidenav__group {
    display: none;
  }
  .sidenav a[aria-current="page"] {
    box-shadow: inset 0 0 0 1px var(--primary);
  }
}

/* --- Auth chip ----------------------------------------------------------- */
.authchip {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin-left: var(--s2);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 0.8rem;
  color: var(--ink-2);
}
.authchip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
}
.authchip[data-state="in"] .authchip__dot {
  background: var(--jade);
}
.authchip[data-state="out"] .authchip__dot {
  background: var(--amber);
}

/* --- JSON editor --------------------------------------------------------- */
.lt-editor {
  border: 1px solid var(--rule-strong);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
}
.lt-editor__bar {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.lt-editor__bar .spacer {
  margin-left: auto;
}
.lt-editor__code {
  display: flex;
  max-height: 460px;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  tab-size: 2;
}
.lt-editor__gutter {
  flex: none;
  padding: var(--s3) var(--s2) var(--s3) var(--s3);
  text-align: right;
  color: var(--ink-3);
  background: var(--surface-2);
  border-right: 1px solid var(--rule);
  user-select: none;
  white-space: pre;
}
.lt-editor__stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.lt-editor__hl,
.lt-editor__input {
  margin: 0;
  padding: var(--s3);
  border: 0;
  font: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  tab-size: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-height: 100%;
}
.lt-editor__hl {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: var(--ink);
  overflow: hidden;
}
.lt-editor__input {
  position: relative;
  display: block;
  width: 100%;
  min-height: 220px;
  background: transparent;
  color: var(--ink);
  resize: none;
  outline: none;
  overflow: hidden;
}
.lt-editor.is-enhanced .lt-editor__input {
  color: transparent;
  caret-color: var(--ink);
}
.lt-editor__status {
  display: flex;
  gap: var(--s3);
  align-items: center;
  padding: var(--s2) var(--s3);
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
  font-size: 0.78rem;
  color: var(--ink-2);
  min-height: 34px;
}
.tok-key {
  color: var(--primary);
}
.tok-str {
  color: var(--jade);
}
.tok-num {
  color: var(--amber);
}
.tok-lit {
  color: var(--seal);
}
.tok-punc {
  color: var(--ink-3);
}
@media (prefers-color-scheme: dark) {
  .tok-key {
    color: #9ec5f0;
  }
  .tok-str {
    color: #7dd3b0;
  }
  .tok-num {
    color: #e6bd78;
  }
  .tok-lit {
    color: #ef9a90;
  }
}

/* --- JSON tree ----------------------------------------------------------- */
.tree {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
}
.tree details {
  margin-left: 4px;
}
.tree details > summary {
  cursor: pointer;
  color: var(--ink-3);
  list-style: none;
}
.tree details > summary::-webkit-details-marker {
  display: none;
}
.tree details > summary::before {
  content: "▸";
  display: inline-block;
  width: 1em;
  color: var(--ink-3);
  transition: transform var(--t);
}
.tree details[open] > summary::before {
  transform: rotate(90deg);
}
.tree-row {
  margin-left: 18px;
}
.tree-key {
  color: var(--primary);
  margin-right: 8px;
}
.tree-key::after {
  content: ":";
  color: var(--ink-3);
}
.tree-val {
  color: var(--ink-2);
}
.tree-val--null {
  color: var(--seal);
}

/* --- Diff ---------------------------------------------------------------- */
.diff {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.diff-row {
  border: 1px solid var(--rule);
  border-left-width: 3px;
  border-radius: var(--r);
  padding: var(--s3) var(--s4);
  font-size: 0.86rem;
  background: var(--surface-2);
}
.diff-row__head {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.diff-row__body {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin-top: var(--s2);
  word-break: break-all;
  color: var(--ink-2);
}
.diff--added {
  border-left-color: var(--jade);
}
.diff--removed {
  border-left-color: var(--seal);
}
.diff--changed {
  border-left-color: var(--amber);
}

/* --- Rendered fields ----------------------------------------------------- */
.render-field {
  border-left: 2px solid var(--rule);
  padding: var(--s1) 0 var(--s1) var(--s4);
  margin: var(--s2) 0;
}
.render-label {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.render-key {
  font-family: var(--font-mono);
  color: var(--primary);
  font-size: 0.85rem;
}
.render-title {
  font-weight: 600;
}
.render-children {
  margin-left: var(--s4);
}
.render-value {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-2);
  word-break: break-word;
}

/* --- Toast --------------------------------------------------------------- */
.toast-host {
  position: fixed;
  z-index: 80;
  right: var(--s5);
  bottom: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  max-width: min(380px, calc(100vw - 32px));
  padding-bottom: env(safe-area-inset-bottom);
}
.toast {
  display: flex;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r);
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-2);
  font-size: 0.88rem;
  animation: lt-rise var(--t);
}
.toast::before {
  content: "";
  flex: none;
  width: 4px;
  border-radius: 2px;
  background: var(--ink-3);
}
.toast--ok::before {
  background: var(--jade);
}
.toast--error::before {
  background: var(--seal);
}
.toast--warn::before {
  background: var(--amber);
}
@keyframes lt-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- Dialog -------------------------------------------------------------- */
dialog.lt-dialog {
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  width: min(480px, calc(100vw - 32px));
  box-shadow: var(--shadow-2);
  overscroll-behavior: contain;
}
dialog.lt-dialog::backdrop {
  background: rgba(10, 12, 16, 0.5);
  backdrop-filter: blur(2px);
}
.lt-dialog__body {
  padding: var(--s5);
}
.lt-dialog__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
}

/* --- Dataset cards ------------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s4);
}
.dcard {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s5);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-1);
  transition:
    border-color var(--t),
    transform var(--t),
    box-shadow var(--t);
}
.dcard:hover {
  border-color: var(--rule-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.dcard__slug {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-3);
}
.dcard__title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
}
.dcard__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: auto;
  padding-top: var(--s3);
}

/* --- Search input -------------------------------------------------------- */
.searchbar {
  display: flex;
  gap: var(--s3);
  align-items: center;
}
.searchbar .input {
  flex: 1;
}

/* --- Utility grids ------------------------------------------------------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s4);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s4);
}
.sidebar-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: var(--s5);
  align-items: start;
}
@media (max-width: 860px) {
  .grid-2,
  .grid-3,
  .sidebar-layout {
    grid-template-columns: 1fr;
  }
}

/* queue items */
.queue {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin-top: var(--s3);
  max-height: 60vh;
  overflow: auto;
}
.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  text-align: left;
  padding: var(--s3);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition:
    border-color var(--t),
    background var(--t);
}
.queue-item:hover {
  border-color: var(--rule-strong);
  background: var(--surface-2);
}
.queue-item[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.queue-item .slug {
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

/* result pre */
pre.result {
  margin: var(--s3) 0 0;
  padding: var(--s4);
  background: var(--bg-tint);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  overflow: auto;
  max-height: 320px;
  font-size: 0.8rem;
  color: var(--ink-2);
}

/* --- Hero (landing) ------------------------------------------------------ */
.hero {
  padding: var(--s8) 0 var(--s6);
  border-bottom: 1px solid var(--rule);
}
.hero h1 {
  max-width: 20ch;
}
.hero__lede {
  color: var(--ink-2);
  font-size: 1.08rem;
  max-width: 62ch;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-top: var(--s5);
}
.howto {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s4);
  margin-top: var(--s6);
}
@media (max-width: 760px) {
  .howto {
    grid-template-columns: 1fr;
  }
}
.howto__item {
  border-top: 2px solid var(--primary);
  padding-top: var(--s3);
}
.howto__num {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--seal);
}
