/* ============================================================
   中标吧 · user-facing UI
   Aesthetic: institutional, restrained, light, low-saturation
   No external CDN. System fonts only.
   ============================================================ */

:root {
  /* Color — warm-cool neutrals, deep institutional blue accent */
  --bg:           #f7f6f3;
  --bg-soft:      #efece6;
  --surface:      #ffffff;
  --surface-2:    #fbfaf7;
  --line:         #e6e2da;
  --line-strong:  #cfc9bd;
  --ink:          #15171a;
  --ink-2:        #3a3d42;
  --ink-3:        #6a6d72;
  --ink-4:        #9a9da3;

  --accent:       #1e3a8a;   /* deep institutional blue */
  --accent-2:     #2547a8;
  --accent-soft:  #e8edfa;
  --accent-ink:   #0d1f55;

  --ok:           #1f6b3a;
  --ok-soft:      #e4f0e7;
  --warn:         #8a5a00;
  --warn-soft:    #faefd6;
  --err:          #8e1d1d;
  --err-soft:     #f6e1e0;

  /* Type — system stack only */
  --font:         -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
                  "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  --mono:         ui-monospace, "SF Mono", Menlo, Consolas, "PingFang SC", monospace;

  /* Spacing */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  24px;
  --s-6:  32px;
  --s-7:  48px;
  --s-8:  64px;
  --s-9:  96px;

  /* Radii — modest */
  --r-1:  3px;
  --r-2:  6px;
  --r-3:  10px;

  /* Layout */
  --max:        1240px;
  --topbar-h:   60px;
  --js-tabs-h:  48px;   /* rendered height of .js-tabs strip (see v2.css:.js-tabs) */

  /* Motion */
  --ease:       cubic-bezier(.2,.7,.2,1);
}

/* Density tweak (Tweaks panel sets [data-density] on <html>) */
html[data-density="tight"]  { --s-3: 10px; --s-4: 12px; --s-5: 18px; --s-6: 24px; --s-7: 36px; }
html[data-density="loose"]  { --s-3: 14px; --s-4: 20px; --s-5: 30px; --s-6: 44px; --s-7: 64px; }

/* Accent tweak */
html[data-accent="navy"]    { --accent: #1e3a8a; --accent-2: #2547a8; --accent-soft: #e8edfa; --accent-ink: #0d1f55; }
html[data-accent="teal"]    { --accent: #115e59; --accent-2: #0f766e; --accent-soft: #def4f1; --accent-ink: #074240; }
html[data-accent="ink"]     { --accent: #2a2d33; --accent-2: #1c1e22; --accent-soft: #ebe9e3; --accent-ink: #0f1114; }
html[data-accent="rust"]    { --accent: #8a2f1a; --accent-2: #a3381f; --accent-soft: #f7e3dc; --accent-ink: #5a1f10; }

/* Reset */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "tnum" 1;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); color: var(--accent-ink); }

/* ====== Topbar ====== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(247,246,243,.86);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: var(--max);
  height: var(--topbar-h);
  margin: 0 auto;
  padding: 0 var(--s-5);
  display: flex;
  align-items: center;
  gap: var(--s-6);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 0;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink);
  font-size: 15px;
}
.brand__arrow {
  font-weight: 400;
  color: var(--accent);
  font-size: 13px;
  position: relative;
  top: -1px;
}
.brand__to { color: var(--accent); }
.brand__from { color: var(--accent); }
.topnav {
  display: flex;
  gap: var(--s-5);
  margin-left: var(--s-4);
}
.topnav__link {
  color: var(--ink-3);
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color .15s var(--ease);
}
.topnav__link:hover { color: var(--ink); }
.topnav__link.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.topnav__link[data-disabled="true"] { color: var(--ink-4); cursor: not-allowed; }
.topbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.env-tag {
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: var(--r-1);
}

/* ====== View shell ====== */
.view {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--s-7) var(--s-5) var(--s-9);
  min-height: calc(100vh - var(--topbar-h) - 80px);
}

/* ====== Footer ====== */
/* (公共合规页脚 .sitefoot lives in v7.css — rendered by site-footer.js) */

/* ====== Buttons ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 10px 16px;
  border-radius: var(--r-2);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s var(--ease), border-color .12s var(--ease), transform .12s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: #b6afa1; }
.btn:active { transform: translateY(1px); }
.btn[disabled],
.btn.is-disabled { opacity: .5; cursor: not-allowed; }
/* Brief visual ack while the OS file picker is mounting (PR-Z 2026-06-04, Bug 4). */
.btn.is-pressed {
  transform: scale(0.97);
  opacity: 0.85;
  transition: transform 0.12s var(--ease), opacity 0.12s var(--ease);
}
/* Button loading state — disabled visual + inline spinner (PR-Z 2026-06-04, Bug 4). */
.btn.is-loading {
  pointer-events: none;
  opacity: 0.75;
  cursor: progress;
}
.btn.is-loading .spinner {
  color: currentColor;
  margin-right: 6px;
  vertical-align: -2px;
}
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}
.btn--ghost:hover { background: var(--bg-soft); }
.btn--sm { padding: 6px 10px; font-size: 12px; border-radius: var(--r-1); }
.btn--lg { padding: 14px 22px; font-size: 14px; }
.btn__icon { width: 14px; height: 14px; }

/* ====== Cards ====== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
}
.card__head {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.card__title { font-size: 13px; font-weight: 600; letter-spacing: .04em; }
.card__body { padding: var(--s-5); }

/* ====== Common bits ====== */
.eyebrow {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.muted { color: var(--ink-3); }
.kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink-2);
}
.divider {
  height: 1px;
  background: var(--line);
  margin: var(--s-5) 0;
}

/* ============================================================
   PAGE: HOME
   ============================================================ */
.home__hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-7);
  margin-bottom: var(--s-7);
}
.home__title {
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -.01em;
  font-weight: 600;
  margin: 0 0 var(--s-3) 0;
  max-width: 720px;
  text-wrap: pretty;
}
.home__sub {
  color: var(--ink-3);
  font-size: 15px;
  max-width: 640px;
  margin: 0;
}

/* Upload zone */
.dropzone {
  position: relative;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-3);
  background: var(--surface);
  padding: var(--s-8) var(--s-6);
  text-align: center;
  transition: border-color .15s var(--ease), background .15s var(--ease);
  cursor: pointer;
}
.dropzone:hover { border-color: var(--accent); background: var(--surface-2); }
.dropzone.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone__icon {
  width: 44px;
  height: 44px;
  margin: 0 auto var(--s-4);
  color: var(--accent);
  display: block;
}
.dropzone__title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 var(--s-2);
  letter-spacing: -.005em;
}
.dropzone__hint {
  color: var(--ink-3);
  font-size: 13px;
  margin: 0 0 var(--s-5);
}
.dropzone__hint .kbd { margin: 0 2px; }
.dropzone__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.dropzone__meta {
  margin-top: var(--s-5);
  font-size: 12px;
  color: var(--ink-4);
  display: flex;
  justify-content: center;
  gap: var(--s-5);
}
.dropzone__meta-item { display: inline-flex; gap: 6px; align-items: center; }
/* Upload-in-progress state — replaces the default dropzone visual while the
   createJob + previewCost + getCredits chain runs (PR-Z 2026-06-04, Bug 4). */
.dropzone__uploading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--ink);
}
.dropzone__uploading .spinner {
  width: 28px; height: 28px;
  color: var(--accent);
}
.dropzone__uploading-name {
  font-size: 14px;
  font-weight: 500;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropzone__uploading-hint {
  font-size: 13px;
  color: var(--ink-3);
}

/* Recent jobs */
.recent {
  margin-top: var(--s-7);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--line);
}
.section-head__title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
}
.section-head__meta { font-size: 12px; color: var(--ink-3); }

.joblist { list-style: none; margin: 0; padding: 0; }
.joblist__item {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-2);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .12s var(--ease);
}
.joblist__item:hover { background: var(--surface); }
.joblist__item:last-child { border-bottom: 0; }
.joblist__status {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-4);
  margin-left: 6px;
}
.joblist__status--running { background: var(--accent); animation: pulse 1.6s infinite var(--ease); }
.joblist__status--done    { background: var(--ok); }
.joblist__status--failed  { background: var(--err); }
.joblist__main { min-width: 0; }
.joblist__name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.joblist__sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
  display: flex;
  gap: 12px;
}
.joblist__sub .sep { color: var(--ink-4); }
.joblist__time {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.joblist__action {
  font-size: 12px;
  color: var(--ink-3);
  opacity: 0;
  transition: opacity .12s var(--ease);
}
.joblist__item:hover .joblist__action { opacity: 1; color: var(--accent); }

.empty {
  padding: var(--s-7) var(--s-5);
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: var(--r-3);
  background: var(--surface-2);
}
.empty__title { font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }

/* Status pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: .04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pill--running { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.pill--done    { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill--failed  { background: var(--err-soft); color: var(--err); border-color: transparent; }
.pill--warn    { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  opacity: .8;
}

/* ============================================================
   PAGE: PROCESSING
   ============================================================ */
.proc {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-6);
}
.proc__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-5);
  flex-wrap: wrap;
}
.proc__filename {
  font-size: 22px;
  font-weight: 600;
  margin: 4px 0 6px;
  letter-spacing: -.005em;
  word-break: break-all;
}
.proc__sub {
  color: var(--ink-3);
  font-size: 13px;
  display: flex;
  gap: var(--s-4);
  flex-wrap: wrap;
}
.proc__sub .sep { color: var(--ink-4); }

.progress {
  margin-top: var(--s-3);
}
.progress__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.progress__pct {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.progress__phase {
  font-size: 13px;
  color: var(--ink-3);
}
.progress__bar {
  height: 4px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .6s var(--ease);
  position: relative;
}
.progress__fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  animation: shimmer 2.4s infinite linear;
}

/* 5-phase stepper */
.stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  position: relative;
  padding: var(--s-4) 0;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 0 8px;
  text-align: center;
}
.step::before, .step::after {
  content: "";
  position: absolute;
  top: 14px;
  height: 1px;
  background: var(--line);
  z-index: 0;
}
.step::before { left: 0; right: 50%; }
.step::after  { left: 50%; right: 0; }
.step:first-child::before { display: none; }
.step:last-child::after { display: none; }

.step__dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  transition: all .25s var(--ease);
  font-variant-numeric: tabular-nums;
}
.step__label {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  white-space: nowrap;
}
.step__hint {
  margin-top: 2px;
  font-size: 11px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
.step.is-active .step__dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 5px var(--accent-soft);
}
.step.is-active .step__label { color: var(--ink); font-weight: 600; }
.step.is-done .step__dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.step.is-done .step__label { color: var(--ink-2); }
.step.is-done::after,
.step.is-active::before { background: var(--accent); }
.step.is-failed .step__dot {
  background: var(--err);
  border-color: var(--err);
  color: #fff;
}

/* Live log */
.log {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: var(--s-4) var(--s-5);
  max-height: 280px;
  overflow-y: auto;
  color: var(--ink-2);
}
.log__line {
  display: grid;
  grid-template-columns: 80px 60px 1fr;
  gap: var(--s-3);
  padding: 2px 0;
  border-bottom: 1px dashed transparent;
}
.log__time { color: var(--ink-4); }
.log__tag {
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  font-size: 10px;
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-soft);
  color: var(--ink-3);
  height: 18px;
  align-self: center;
  text-align: center;
}
.log__tag--info  { color: var(--accent); background: var(--accent-soft); }
.log__tag--ok    { color: var(--ok); background: var(--ok-soft); }
.log__tag--warn  { color: var(--warn); background: var(--warn-soft); }
.log__tag--err   { color: var(--err); background: var(--err-soft); }
.log__msg { color: var(--ink-2); }

/* ============================================================
   PAGE: DETAIL
   ============================================================ */
.detail {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--s-6);
  align-items: start;
}
@media (max-width: 1100px) {
  .detail { grid-template-columns: 1fr; }
  .toc { position: static !important; max-height: none !important; }
}

.detail__head {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s-2);
}
.detail__title {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -.005em;
}
.detail__meta {
  display: flex;
  gap: var(--s-4);
  flex-wrap: wrap;
  align-items: center;
  color: var(--ink-3);
  font-size: 13px;
}
.detail__meta .sep { color: var(--ink-4); }
.detail__actions {
  display: flex;
  gap: var(--s-2);
  margin-left: auto;
}

/* Diagnostic banner */
.banner {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-3);
  background: var(--warn-soft);
  border: 1px solid #ecd9a8;
  color: #5c3d00;
}
.banner__icon { flex: 0 0 auto; color: var(--warn); margin-top: 2px; }
.banner__title { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: #4a3000; }
.banner__list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}
.banner__list li { margin: 2px 0; }
.banner__close {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--warn);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
}

/* ToC sidebar */
.toc {
  position: sticky;
  top: calc(var(--topbar-h) + var(--s-4));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: var(--s-4) 0;
  max-height: calc(100vh - var(--topbar-h) - var(--s-7));
  overflow-y: auto;
}
.toc__head {
  padding: 0 var(--s-4) var(--s-3);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s-3);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.toc__count {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-4);
  letter-spacing: 0;
}
.toc__list { list-style: none; margin: 0; padding: 0; }
.toc__item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: var(--s-2);
  align-items: center;
  padding: 8px var(--s-4);
  cursor: pointer;
  border-left: 2px solid transparent;
  font-size: 13px;
  color: var(--ink-2);
  transition: background .12s var(--ease);
}
.toc__item:hover { background: var(--surface-2); }
.toc__item.is-active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 500;
}
.toc__num { color: var(--ink-4); font-size: 11px; font-variant-numeric: tabular-nums; }
.toc__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc__flag {
  width: 6px; height: 6px; border-radius: 50%;
  background: transparent;
}
.toc__item[data-dirty="true"] .toc__flag { background: var(--accent); }
.toc__item[data-warn="true"] .toc__flag  { background: var(--warn); }

/* Editor area */
.editor {}
.editor__chapter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.editor__chapter-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -.005em;
}
.editor__chapter-num {
  color: var(--ink-4);
  font-size: 13px;
  font-weight: 500;
  margin-right: var(--s-2);
  font-variant-numeric: tabular-nums;
}
.editor__chapter-actions { display: flex; gap: var(--s-2); align-items: center; }
.save-state {
  font-size: 12px;
  color: var(--ink-4);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.save-state.is-dirty { color: var(--warn); }
.save-state.is-saving { color: var(--ink-3); }
.save-state.is-saved { color: var(--ok); }

/* Split pane */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--surface);
  overflow: hidden;
  min-height: 560px;
}
.split__pane { display: flex; flex-direction: column; min-width: 0; }
.split__pane + .split__pane { border-left: 1px solid var(--line); }
.split__pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--s-4);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  background: var(--surface-2);
}
.split__pane-head .muted { font-variant-numeric: tabular-nums; }

.editor__textarea {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  padding: var(--s-4) var(--s-5);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  min-height: 540px;
}
.editor__textarea::placeholder { color: var(--ink-4); }

.preview {
  flex: 1 1 auto;
  padding: var(--s-5) var(--s-6);
  overflow-y: auto;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.75;
  background: var(--surface);
  min-height: 540px;
}
.preview h1, .preview h2, .preview h3, .preview h4 {
  font-weight: 600;
  letter-spacing: -.005em;
  margin: 1.4em 0 .5em;
  color: var(--ink);
}
.preview h1 { font-size: 22px; margin-top: 0; }
.preview h2 { font-size: 18px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.preview h3 { font-size: 15px; }
.preview h4 { font-size: 13px; color: var(--ink-2); }
.preview p { margin: 0 0 1em; }
.preview ul, .preview ol { padding-left: 1.5em; margin: 0 0 1em; }
.preview li { margin: 4px 0; }
.preview blockquote {
  border-left: 3px solid var(--line-strong);
  padding: 4px 14px;
  margin: 1em 0;
  color: var(--ink-3);
  background: var(--surface-2);
  border-radius: 0 var(--r-2) var(--r-2) 0;
}
.preview code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bg-soft);
  padding: 1px 5px;
  border-radius: 3px;
}
.preview pre {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: var(--s-3) var(--s-4);
  overflow-x: auto;
  font-size: 12.5px;
}
.preview pre code { background: transparent; padding: 0; }
.preview hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 13px;
}
.preview th, .preview td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.preview th { background: var(--surface-2); font-weight: 600; }
.preview strong { font-weight: 600; }
.preview a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ============================================================
   Misc — toasts, loaders, tweaks panel
   ============================================================ */
.toast-host {
  position: fixed;
  right: var(--s-5);
  bottom: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--r-2);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  animation: rise .2s var(--ease);
  max-width: 360px;
}
.toast--ok { background: #1c4d2c; }
.toast--err { background: #6e1717; }

.spinner {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  display: inline-block;
  animation: spin .9s linear infinite;
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-soft), #f3f1ec, var(--bg-soft));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--r-2);
}

/* Segmented control — shared by /settings radioRow + /history filter.
   (The floating Tweaks panel that originally introduced .tweak-* was
   removed in C-1; only .tweak-seg survives, now reused here.) */
.tweak-seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: 2px;
  background: var(--bg-soft);
}
.tweak-seg button {
  flex: 1;
  white-space: nowrap;
  border: 0;
  background: transparent;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 3px;
  cursor: pointer;
  color: var(--ink-3);
}
.tweak-seg button.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.04); }

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.85); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.fadein { animation: fadein .25s var(--ease) forwards; opacity: 1; }

/* Mobile single-column */
@media (max-width: 720px) {
  :root { --s-7: 32px; --s-8: 40px; --s-9: 60px; }
  .topbar__inner { padding: 0 var(--s-4); gap: var(--s-4); }
  .topnav { display: none; }
  .view { padding: var(--s-5) var(--s-4) var(--s-7); }
  .home__title { font-size: 26px; }
  .stepper { grid-template-columns: 1fr; }
  .step { flex-direction: row; align-items: center; gap: 12px; padding: 10px 0; }
  .step::before, .step::after { display: none; }
  .step__label { margin-top: 0; }
  .split { grid-template-columns: 1fr; }
  .split__pane + .split__pane { border-left: 0; border-top: 1px solid var(--line); }
}
