/* ============================================================
   GitCafe — component kit
   Class-based design system. Every view composes from these.
   All font sizes are >= 13px.
   ============================================================ */

/* ---------- App shell ---------- */
.app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  height: var(--topbar-h); min-height: var(--topbar-h);
  padding: 0 16px; border-bottom: 1px solid var(--border);
  background: var(--bg); z-index: var(--z-topbar);
}
.body { display: flex; flex: 1; min-height: 0; position: relative; }
.rail {
  position: relative; width: var(--rail-w); min-width: var(--rail-w);
  display: flex; flex-direction: column; background: var(--bg);
  border-right: 1px solid var(--border);
}
.main { flex: 1; min-width: 0; overflow-y: auto; background: var(--bg); }
.scrim { display: none; position: fixed; inset: var(--topbar-h) 0 0 0; background: var(--overlay); z-index: var(--z-scrim); }
.view { animation: gc-up .3s ease; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px clamp(18px,4vw,42px) 64px; }
.wrap--wide { max-width: 1240px; }

/* mobile rail as drawer */
.app.is-mobile .rail {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: 272px;
  z-index: var(--z-rail); transition: transform .25s var(--ease); transform: translateX(-110%);
}
.app.is-mobile.sidebar-open .rail { transform: translateX(0); }
.app.is-mobile.sidebar-open .scrim { display: block; }

/* chromeless routes (home / signin / admin) render their own full-screen layout */
.app.chromeless > .topbar,
.app.chromeless .rail,
.app.chromeless .scrim { display: none !important; }
.app.chromeless .body { min-height: 0; }
.app.chromeless .main { background: var(--bg); }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 9px; user-select: none; cursor: pointer; }
.brand-dot { width: 9px; height: 9px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 0 4px var(--accent-dim); }
.brand-name { font-family: var(--font-dot); font-weight: 900; font-size: 21px; letter-spacing: 1px; line-height: 1; position: relative; padding-right: 0.62em; }
/* ™ on the wordmark — one rule covers every brand mark (topbar, nav, footer,
   sign-in). Rendered in the sans face (the pixel brand font has no ™ glyph),
   accent red. Absolutely anchored to the wordmark's top-right corner (the
   reserved padding-right gives it room) so it sits flush on the text instead
   of floating above it — its top aligns with the top of the letters. */
.brand-name::after {
  content: '\2122';                 /* ™ */
  position: absolute;
  top: -0.04em;
  right: -0.06em;                   /* nudge it snug against the last letter */
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.82em;                /* clearly visible, not tiny */
  line-height: 1;
  letter-spacing: 0;
  color: var(--accent);
}

/* ---------- Typography helpers ---------- */
.mono { font-family: var(--font-mono); }
.dot  { font-family: var(--font-dot); }
.eyebrow { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 2px; color: var(--text-faint); text-transform: uppercase; }
.label { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 1.5px; color: var(--text-faint); text-transform: uppercase; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.h1 { font-size: clamp(26px,4vw,38px); font-weight: 600; letter-spacing: -1px; }
.h2 { font-size: clamp(22px,3.4vw,30px); font-weight: 600; letter-spacing: -.5px; }
.title { font-size: var(--fs-md); font-weight: 600; }
.stat-num { font-family: var(--font-dot); font-weight: 700; font-size: 34px; line-height: 1; letter-spacing: 1px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Horizontally scrollable strip with no painted scrollbar — used for inline
   command chips so one long command doesn't visually desync a card from its
   row. Content stays scrollable by wheel, trackpad, touch and keyboard. */
.scroll-x { overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.scroll-x::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border: 1px solid var(--border-strong);
  background: var(--panel); color: var(--text); border-radius: var(--r-1);
  font-size: var(--fs-sm); font-weight: 500; cursor: pointer;
  transition: border-color .12s, background .12s, transform .05s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; }
.btn--sm { height: 30px; padding: 0 11px; font-size: var(--fs-sm); }
.btn--lg { height: 42px; padding: 0 20px; }
.btn--block { width: 100%; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn--primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn--solid { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }
.btn--solid:hover { border-color: var(--text); opacity: .92; }
.btn--ghost { background: transparent; border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--panel-2); }
.btn--accent-soft { background: var(--accent-dim); border-color: var(--accent); color: var(--text); }
.btn--dashed { border-style: dashed; background: none; color: var(--text-dim); }
.btn--dashed:hover { color: var(--text); border-color: var(--text-faint); }
.btn--icon { width: 34px; height: 34px; padding: 0; border-color: var(--border); background: var(--panel); flex: none; }
.btn--icon:hover { border-color: var(--border-strong); }
.btn--link { border: none; background: none; color: var(--text-dim); padding: 0; height: auto; font-family: var(--font-mono); font-size: var(--fs-sm); }
.btn--link:hover { color: var(--accent); }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--border); border-radius: var(--r-2); background: var(--panel); }
.card--2 { background: var(--panel-2); }
.card--pad { padding: 16px; }
.card--hover { transition: border-color .12s, transform .12s; cursor: pointer; }
.card--hover:hover { border-color: var(--border-strong); }
.card--lift:hover { border-color: var(--accent); transform: translateY(-2px); }
.card--accent { border-color: var(--accent); background: var(--accent-dim); }
.card-grid-bg { background-image: radial-gradient(var(--grid) 1px, transparent 1px); background-size: 16px 16px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }

/* ---------- Badges / chips / tags ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .5px;
  border: 1px solid var(--border-strong); border-radius: var(--r-1); color: var(--text-dim);
  text-transform: uppercase; white-space: nowrap;
}
.badge--accent { border-color: var(--accent); color: var(--accent); }
.badge--ok { border-color: var(--ok); color: var(--ok); }
.badge--warn { border-color: var(--warn); color: var(--warn); }
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 13px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text-dim);
  border-radius: var(--r-1); font-family: var(--font-mono); font-size: var(--fs-sm); cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip--pill { border-radius: var(--r-pill); height: 30px; }
.chip--pill.is-active { background: var(--accent-dim); border-color: var(--accent); color: var(--text); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: var(--fs-sm); font-weight: 500; }
.field-hint { font-size: var(--fs-sm); color: var(--text-faint); line-height: 1.45; }
.input, .textarea, .select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-1); color: var(--text); padding: 10px 12px;
  font-size: var(--fs-base); outline: none; transition: border-color .12s;
}
.input { height: 40px; }
.input.mono, .textarea.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
.textarea { min-height: 72px; resize: vertical; line-height: 1.55; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--border-strong); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.select { height: 40px; appearance: none; cursor: pointer; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.checkbox { width: 18px; height: 18px; border: 1.5px solid var(--text-faint); background: transparent; border-radius: var(--r-1);
  display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; cursor: pointer; }
.checkbox.is-on { background: var(--accent); border-color: var(--accent); }

/* toggle switch */
.switch { position: relative; width: 40px; height: 22px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: var(--panel-3); cursor: pointer; flex: none; transition: background .15s, border-color .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-dim); transition: transform .15s, background .15s; }
.switch.is-on { background: var(--accent-dim); border-color: var(--accent); }
.switch.is-on::after { transform: translateX(18px); background: var(--accent); }

/* segmented control */
.segmented { display: inline-flex; gap: 6px; }
.segmented .seg { height: 30px; padding: 0 12px; display: inline-flex; align-items: center; border: 1px solid var(--border); background: transparent; color: var(--text-faint); border-radius: var(--r-1); font-family: var(--font-mono); font-size: var(--fs-sm); cursor: pointer; }
.segmented .seg.is-active { border-color: var(--border-strong); background: var(--panel-3); color: var(--text); }

/* ---------- Rows / lists ---------- */
.list { border: 1px solid var(--border); border-radius: var(--r-2); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 15px; background: var(--panel); border: none; border-bottom: 1px solid var(--border); text-align: left; color: var(--text); }
.row:last-child { border-bottom: none; }
.row--btn { cursor: pointer; transition: background .12s; }
.row--btn:hover { background: var(--panel-2); }

/* ---------- Stat tiles ---------- */
.stats { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-2); overflow: hidden; }
.stat { background: var(--panel); padding: 18px; }
.stat .stat-label { margin-top: 10px; font-size: var(--fs-sm); font-weight: 500; }
.stat .stat-sub { margin-top: 3px; font-size: var(--fs-sm); color: var(--text-faint); }

/* ---------- Terminal / code ---------- */
.terminal { border: 1px solid var(--border); border-radius: var(--r-2); background: var(--bg-2); overflow: hidden; }
.terminal-bar { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.terminal-dot { width: 9px; height: 9px; border-radius: 50%; }
.terminal-body { padding: 15px; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.9; color: var(--text-dim); }
.terminal-body .prompt { color: var(--accent); }
.terminal-body .out { color: var(--text-faint); }
.caret::after { content: "▊"; animation: gc-blink 1s step-end infinite; margin-left: 2px; }
.code { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-2); padding: 13px 15px; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.7; color: var(--text-dim); overflow-x: auto; }
.kbd { border: 1px solid var(--border-strong); border-radius: var(--r-1); padding: 1px 6px; font-family: var(--font-mono); font-size: var(--fs-label); }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--border); border: none; margin: 0; }
.spinner { width: 15px; height: 15px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: gc-spin .7s linear infinite; display: inline-block; }
.live-dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; animation: gc-pulse 2s infinite; flex: none; }
.empty { border: 1px dashed var(--border-strong); border-radius: var(--r-2); padding: 40px 20px; text-align: center; color: var(--text-dim); }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 14px; }
.cols-auto-320 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.cols-auto-280 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cols-auto-260 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cols-auto-210 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.cols-auto-160 { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); gap: 20px; align-items: start; }
/* minmax(0,1fr) not 1fr: a bare 1fr track is minmax(auto,1fr), so wide/
   non-shrinkable content pushes the column past the viewport on mobile. */
.app.is-mobile .split, .app.is-mobile .split-repo, .app.is-mobile .split-actions { grid-template-columns: minmax(0, 1fr); }
/* On narrow screens, let space-between rows and tab strips wrap instead of overflow. */
.app.is-mobile .between { flex-wrap: wrap; }
.app.is-mobile .segmented { flex-wrap: wrap; }
.split-repo { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(0,1fr); gap: 22px; align-items: start; }
.split-actions { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; }
.row-flex { display: flex; align-items: center; }
.wrap-flex { display: flex; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ml-auto { margin-left: auto; }

/* ---------- Rail nav ---------- */
.rail-scroll { padding: 16px 12px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.rail-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: none; background: transparent; color: var(--text-dim); border-left: 2px solid transparent; border-radius: 0 var(--r-1) var(--r-1) 0; text-align: left; font-size: var(--fs-sm); transition: background .12s, color .12s; cursor: pointer; }
.rail-item:hover { background: var(--panel-2); color: var(--text); }
.rail-item.is-active { background: var(--panel-2); color: var(--text); border-left-color: var(--accent); }
.rail-item .glyph { width: 8px; height: 8px; background: var(--text-faint); flex: none; transition: background .12s; }
.rail-item.is-active .glyph { background: var(--accent); }
.rail-item .n { font-family: var(--font-mono); font-size: var(--fs-label); color: var(--text-faint); width: 16px; }
.rail-item .lbl { flex: 1; }
.rail-item.is-active .lbl { font-weight: 600; }
.rail-foot { padding: 12px; border-top: 1px solid var(--border); }

/* ---------- Modal ---------- */
.modal-scrim { position: fixed; inset: 0; background: var(--overlay); z-index: var(--z-modal); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; animation: gc-in .18s ease; overflow-y: auto; }
.modal { width: 100%; max-width: 520px; background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--r-3); box-shadow: var(--shadow-lg); animation: gc-pop .2s var(--ease); }
.modal--wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: center; max-width: 92vw; }
.toast { display: flex; align-items: center; gap: 11px; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: var(--r-2); font-size: var(--fs-sm); font-family: var(--font-mono); box-shadow: var(--shadow-md); animation: gc-toast .25s ease; max-width: 92vw; }
.toast .tdot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.toast--ok .tdot { background: var(--ok); }
.toast--warn .tdot { background: var(--warn); }

/* ---------- disclaimer marquee ----------
   A thin scrolling ticker linking to the full independence notice. The track
   holds 4 identical segments and travels exactly -50% (2 segments), so the
   loop is seamless. Hover/focus pauses it, and reduced-motion users get a
   static, manually scrollable strip instead of moving text. */
.marquee {
  position: relative; overflow: hidden; width: 100%;
  background: var(--panel-2); border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
.marquee:hover { background: var(--panel); }
.marquee:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.marquee-track {
  display: inline-flex; align-items: center; white-space: nowrap;
  padding: 7px 0; will-change: transform;
  animation: gc-marquee 42s linear infinite;
}
.marquee:hover .marquee-track,
.marquee:focus-visible .marquee-track { animation-play-state: paused; }
.marquee-seg {
  display: inline-flex; align-items: center; gap: 10px; flex: none;
  padding-right: 44px; font-size: var(--fs-sm);
}
@keyframes gc-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee { overflow-x: auto; }
  .marquee-track { animation: none; }
}

/* ---------- AI slide-over + chat ---------- */
.ai-panel { position: fixed; top: var(--topbar-h); right: 0; bottom: 0; width: min(420px, 94vw); background: var(--panel); border-left: 1px solid var(--border); z-index: var(--z-panel); display: flex; flex-direction: column; animation: gc-slide .28s var(--ease); box-shadow: var(--shadow-lg); }
/* Pixel-café motif on the sign-in brand panel — a faint, transparent background
   wash that blends with the panel; steam pixels drift upward. */
.cafe-art {
  position: absolute; right: clamp(-24px, -2vw, 8px); bottom: 6%;
  width: min(360px, 58%); height: auto; opacity: .1; pointer-events: none;
  z-index: 0; filter: saturate(.9);
}
/* Home-page variants: same motif tuned for the marketing sections it sits
   behind (denser than the sign-in panel, so a touch fainter and smaller). */
.cafe-art--hero { right: clamp(-48px, -4vw, -8px); bottom: -12px; width: min(300px, 30vw); opacity: .07; }
.cafe-art--cta  { right: clamp(-40px, -3vw,  0px); bottom: -16px; width: min(240px, 26vw); opacity: .08; }
.cafe-steam { animation: gc-steam 3.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes gc-steam {
  0%, 100% { opacity: .18; transform: translateY(3px); }
  50%      { opacity: .6;  transform: translateY(-9px); }
}

/* Backdrop for the AI slide-over — hidden on desktop, tap-to-dismiss on mobile. */
.ai-scrim { display: none; }
.app.is-mobile .ai-scrim { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: var(--overlay); z-index: calc(var(--z-panel) - 1); animation: gc-in .2s ease; }
.ai-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.ai-thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.ai-foot { padding: 12px 16px; border-top: 1px solid var(--border); }
.bubble { max-width: 88%; white-space: pre-wrap; line-height: 1.55; font-size: var(--fs-sm); padding: 11px 13px; border-radius: var(--r-2); }
.bubble--ai { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 1px; align-self: flex-start; }
.bubble--user { background: var(--accent); color: #fff; border-bottom-right-radius: 1px; align-self: flex-end; }
.bubble--tool { background: var(--bg-2); border: 1px dashed var(--border-strong); color: var(--text-dim); font-family: var(--font-mono); font-size: var(--fs-sm); align-self: stretch; max-width: 100%; }
.bubble pre { margin: 8px 0 0; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-1); font-family: var(--font-mono); font-size: var(--fs-sm); overflow-x: auto; white-space: pre; }
.bubble--user pre { background: rgba(0,0,0,.18); border-color: rgba(255,255,255,.25); }

/* ---------- utility ---------- */
.hidden { display: none !important; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.flex-1 { flex: 1; min-width: 0; }
.center { display: flex; align-items: center; justify-content: center; }

/* ============================================================
   Overflow & fit hardening — nothing escapes its box.
   Applied globally so long paths / URLs / commit hashes / commands
   wrap or clamp instead of spilling over neighbours. Larger type
   (see theme.css) makes these guards load-bearing.
   ============================================================ */
/* Long unbroken tokens (URLs, hashes, paths) wrap instead of overflowing. */
.wrap, .modal-body, .bubble, .card { overflow-wrap: anywhere; }
/* Grid/flex children must be allowed to shrink below their content width. */
.card, .stat, .row, .between, .row-flex { min-width: 0; }
/* Media & preformatted blocks never exceed their container. */
img, svg, video, canvas { max-width: 100%; }
pre, .code, .terminal-body { max-width: 100%; }
.code, pre.code { overflow-wrap: normal; }   /* code keeps its own horizontal scroll */
/* Multi-line ellipsis helpers. */
.clamp-1, .clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }
/* Force-wrap helper for command/path text that must stay inside its box. */
.break-anywhere { overflow-wrap: anywhere; word-break: break-word; white-space: normal; }

/* Component fit adjustments for the +2px type scale. */
.badge { height: 24px; }
.rail-item .n { width: 22px; }          /* two-digit nav numbers (…10) no longer clip */
.page-body-x { overflow-x: hidden; }    /* opt-in horizontal clamp for full-bleed sections */

/* ---------- rendered Markdown ----------
   Used by the repo file viewer. Content is built as DOM nodes by
   src/ui/markdown.js (never innerHTML), so nothing here has to escape. */
.md-body { line-height: 1.7; font-size: var(--fs-base); color: var(--text-dim); }
.md-body > *:first-child { margin-top: 0; }
.md-h { color: var(--text); font-weight: 600; letter-spacing: -.3px; margin: 22px 0 10px; line-height: 1.3; }
.md-h1 { font-size: 1.7em; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.md-h2 { font-size: 1.4em; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.md-h3 { font-size: 1.18em; } .md-h4 { font-size: 1.05em; }
.md-h5, .md-h6 { font-size: 1em; color: var(--text-dim); }
.md-p { margin: 0 0 13px; }
.md-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md-code-inline {
  font-family: var(--font-mono); font-size: .9em; padding: 2px 6px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-1);
  overflow-wrap: anywhere;
}
.md-pre {
  margin: 0 0 15px; padding: 13px 15px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--r-1); overflow-x: auto;
}
.md-code-block { font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.6; white-space: pre; }
.md-list { margin: 0 0 13px; padding-left: 24px; }
.md-list li { margin: 4px 0; }
.md-list .md-list { margin-bottom: 0; }
.md-quote {
  margin: 0 0 14px; padding: 3px 0 3px 14px;
  border-left: 3px solid var(--accent); color: var(--text-faint);
}
.md-quote > *:last-child { margin-bottom: 0; }
.md-hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.md-img { max-width: 100%; height: auto; border-radius: var(--r-1); }
.md-table-wrap { overflow-x: auto; margin: 0 0 15px; }
.md-table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 7px 11px; text-align: left; }
.md-table th { background: var(--panel-2); color: var(--text); font-weight: 600; }
