/* ============================================================
   SYNESISHUB — Synesis design system (Notion-inspired warm minimalism)
   Tokens adapted from synesis-HCM/colors_and_type.css
   ============================================================ */

/* Inter, self-hosted (no external Google Fonts call — keeps CSP connect-src 'self'
   and lets the hub run in air-gapped/locked-down environments). */
@import url('/fonts/inter.css');

:root {
  --font-primary: 'Inter', -apple-system, system-ui, 'Segoe UI', Helvetica, Arial, sans-serif;

  --color-notion-black: rgba(0, 0, 0, 0.95);
  --color-white: #ffffff;

  /* Brand palette: navy + orange (accent only; theme stays white) */
  --color-navy: #1f2d5c;
  --color-navy-hover: #172448;
  --color-orange: #dd5b00;
  --color-orange-soft: #f4a06a;

  --color-warm-white: #f6f5f4;
  --color-warm-dark: #31302e;
  --color-warm-gray-500: #615d59;
  --color-warm-gray-300: #a39e98;

  --color-teal: #2a9d99;
  --color-green: #1aae39;
  --color-purple: #391c57;

  --color-link: #1f2d5c;
  --color-focus: #2f4380;
  --color-badge-bg: #eef1f8;
  --color-badge-text: #1f2d5c;

  --color-border: rgba(0, 0, 0, 0.1);
  --border-whisper: 1px solid rgba(0, 0, 0, 0.1);

  --shadow-card:
    rgba(0, 0, 0, 0.04)  0px 4px 18px,
    rgba(0, 0, 0, 0.027) 0px 2.025px 7.847px,
    rgba(0, 0, 0, 0.02)  0px 0.8px 2.925px,
    rgba(0, 0, 0, 0.01)  0px 0.175px 1.041px;
  --shadow-deep:
    rgba(0, 0, 0, 0.01) 0px 1px 3px,
    rgba(0, 0, 0, 0.02) 0px 3px 7px,
    rgba(0, 0, 0, 0.02) 0px 7px 15px,
    rgba(0, 0, 0, 0.04) 0px 14px 28px,
    rgba(0, 0, 0, 0.05) 0px 23px 52px;

  --radius-micro: 4px;
  --radius-comfortable: 12px;
  --radius-large: 16px;
  --radius-pill: 9999px;

  --space-4: 8px; --space-5: 12px; --space-6: 16px; --space-7: 24px;
  --space-8: 32px; --space-9: 48px; --space-10: 64px;

  --bg-page: var(--color-white);
  --bg-surface: var(--color-warm-white);
  --fg-primary: var(--color-notion-black);
  --fg-secondary: var(--color-warm-gray-500);
  --fg-muted: var(--color-warm-gray-300);
  --accent: var(--color-navy);
  --accent-hover: var(--color-navy-hover);
  --accent-2: var(--color-orange);

  /* aliases for the shared component palette (admin, dialogs, tables) */
  --panel: var(--color-white);
  --panel2: var(--color-warm-white);
  --line: var(--color-border);
  --linestrong: #b9bcb5;
  --navy: var(--color-navy);
  --navy-tint: #eef1f8;
  --orange: var(--color-orange);
  --orange-tint: #fbede3;
  --agent: var(--color-teal);
  --agent-tint: #e2f1ed;
  --danger: #b3261e;
  --danger-tint: #fbeae9;
  --code-bg: #23262d;
  --code-ink: #d9dce2;
  --space-1: 2px; --space-2: 4px; --space-3: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--fg-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 var(--space-7); }

/* ── Topbar (three zones: brand · centered nav · user) ── */
.topbar {
  border-bottom: var(--border-whisper);
  background: rgba(255,255,255,0.82);
  backdrop-filter: saturate(1.2) blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 64px;
}
.brand {
  justify-self: start;
  display: flex; align-items: center; gap: 10px;
  font-size: 1rem; font-weight: 700; letter-spacing: -0.2px; color: var(--fg-primary);
}
.brand:hover { text-decoration: none; }
.brand svg { display: block; }

.nav {
  justify-self: center;
  display: flex; gap: 4px;
  background: var(--bg-surface);
  border: var(--border-whisper);
  border-radius: var(--radius-pill);
  padding: 4px;
}
.nav a {
  font-size: 0.9375rem; font-weight: 600; color: var(--fg-secondary);
  padding: 6px 18px; border-radius: var(--radius-pill);
  transition: color 0.12s ease, background 0.12s ease;
}
.nav a:hover { color: var(--fg-primary); text-decoration: none; }
.nav a.active {
  color: #fff; background: var(--accent);
  box-shadow: 0 1px 2px rgba(31,45,92,0.25);
}

.who {
  justify-self: end;
  display: flex; align-items: center; gap: 8px;
  font-size: 0.875rem; font-weight: 600; color: var(--fg-primary);
}
.who-avatar {
  width: 26px; height: 26px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--color-navy), var(--color-orange));
}
.who-name { color: var(--fg-secondary); }
.who-link { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: var(--radius-pill); border: 1px solid transparent; }
.who-link:hover { text-decoration: none; border-color: var(--line); background: var(--bg-surface); }
.who-admin { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--orange); background: var(--orange-tint); border-radius: 4px; padding: 2px 6px; }

/* ── Admin page ── */
.admin-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-5); margin: var(--space-6) 0 var(--space-8); }
.admin-tile { background: var(--panel); border: var(--border-whisper); border-radius: var(--radius-comfortable); box-shadow: var(--shadow-card); padding: var(--space-6); }
.admin-tile .num { font-size: 2rem; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.admin-tile .lbl { font-size: 0.8125rem; color: var(--fg-secondary); font-weight: 500; margin-top: 2px; }

.tok-table { width: 100%; border-collapse: collapse; }
.tok-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-muted); font-weight: 600; padding: 10px 14px 10px 0; border-bottom: 1.5px solid var(--linestrong); }
.tok-table td { padding: 12px 14px 12px 0; border-bottom: var(--border-whisper); font-size: 0.9375rem; vertical-align: middle; }
.tok-status { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: var(--radius-pill); }
.tok-status.active { background: var(--agent-tint); color: var(--agent); }
.tok-status.disabled { background: var(--panel2); color: var(--fg-muted); }
.tok-role { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: var(--radius-pill); }
.tok-role.admin { background: var(--orange-tint); color: var(--orange); }
.tok-role.user { background: var(--navy-tint); color: var(--navy); }
.tok-actions { display: flex; gap: 6px; justify-content: flex-end; }
.tok-btn { font: inherit; font-size: 0.8125rem; font-weight: 600; padding: 5px 11px; cursor: pointer; border: var(--border-whisper); border-radius: var(--radius-micro); background: var(--bg-page); color: var(--fg-primary); }
.tok-btn:hover { border-color: var(--navy); color: var(--navy); }
.tok-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* create-token dialog + reveal */
.dialog-back { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; background: rgba(31,45,92,0.28); }
.dialog { width: min(460px, calc(100vw - 48px)); background: var(--panel); border: var(--border-whisper); border-radius: var(--radius-large); box-shadow: var(--shadow-deep); padding: var(--space-8); }
.dialog h3 { margin: 0 0 var(--space-5); }
.dialog label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--fg-secondary); margin: var(--space-5) 0 4px; }
.dialog .input { width: 100%; }
.dialog .row { display: flex; gap: var(--space-6); margin-top: var(--space-5); align-items: center; }
.dialog .row label { margin: 0; }
.dialog .actions { display: flex; gap: var(--space-4); justify-content: flex-end; margin-top: var(--space-7); }
.reveal { background: var(--code-bg); color: var(--code-ink); border-radius: var(--radius-micro); padding: 12px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; word-break: break-all; margin: var(--space-5) 0; }
.reveal-note { font-size: 0.8125rem; color: var(--color-orange); font-weight: 500; }
input[type=checkbox] { accent-color: var(--navy); width: 16px; height: 16px; }

.danger-btn { background: var(--danger); }
.danger-btn:hover { background: var(--danger); filter: brightness(0.92); }

/* ── Motion system (admin) ── */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes row-in {
  from { opacity: 0; transform: translateX(-10px); background: var(--navy-tint); }
  60%  { background: var(--navy-tint); }
  to   { opacity: 1; transform: translateX(0); background: transparent; }
}
@keyframes row-flash {
  0% { background: var(--orange-tint); }
  100% { background: transparent; }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dialog-back { animation: fade-in 0.16s ease-out; }
.dialog { animation: pop-in 0.22s cubic-bezier(0.2, 0.8, 0.3, 1); }
.dialog-back.closing { opacity: 0; transition: opacity 0.15s ease; }
.dialog-back.closing .dialog { transform: translateY(8px) scale(0.97); opacity: 0; transition: all 0.15s ease; }

#tok-body tr { transition: opacity 0.26s ease, transform 0.26s ease; }
#tok-body tr.row-new { animation: row-in 0.6s ease-out; }
#tok-body tr.row-flash { animation: row-flash 0.9s ease-out; }
#tok-body tr.row-exit { opacity: 0; transform: translateX(14px); }

.admin-tile { animation: pop-in 0.3s ease-out backwards; }
.admin-tile:nth-child(2) { animation-delay: 0.04s; }
.admin-tile:nth-child(3) { animation-delay: 0.08s; }
.admin-tile:nth-child(4) { animation-delay: 0.12s; }
.admin-tile:nth-child(5) { animation-delay: 0.16s; }
.admin-tile:nth-child(6) { animation-delay: 0.2s; }

/* toasts */
.toast-wrap {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--color-warm-dark); color: #fff;
  font-size: 0.875rem; font-weight: 500;
  padding: 10px 18px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow-deep);
  animation: toast-in 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.toast.out { opacity: 0; transform: translateY(8px); transition: all 0.25s ease; }
.toast svg { color: var(--color-teal); flex: none; }

/* token reveal inline (Show button) */
.tok-reveal-row td { padding: 0 14px 14px 0; border-bottom: var(--border-whisper); }
.tok-reveal {
  display: flex; align-items: center; gap: 10px;
  background: var(--code-bg); color: var(--code-ink);
  border-radius: var(--radius-micro); padding: 10px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem;
  word-break: break-all;
  animation: pop-in 0.2s ease-out;
}
.tok-reveal .copybtn2 {
  flex: none; font: inherit; font-size: 0.75rem; font-weight: 600;
  padding: 4px 10px; cursor: pointer; border: none; border-radius: var(--radius-micro);
  background: rgba(255,255,255,0.12); color: #fff;
}
.tok-reveal .copybtn2:hover { background: rgba(255,255,255,0.22); }

@media (prefers-reduced-motion: reduce) {
  .dialog-back, .dialog, #tok-body tr, .admin-tile, .toast, .tok-reveal { animation: none !important; transition: none !important; }
}

/* ── Hero ── */
.hero { padding: var(--space-10) 0 var(--space-8); }
.hero h1 {
  margin: 0 0 var(--space-5);
  font-size: 2.5rem; font-weight: 700; line-height: 1.04;
  letter-spacing: -1.5px;
}
.hero p { margin: 0; font-size: 1.25rem; color: var(--fg-secondary); font-weight: 400; }

/* ── Search & filters ── */
.searchbar { display: flex; gap: var(--space-5); margin: var(--space-7) 0 var(--space-6); }
.input {
  flex: 1;
  font: inherit; font-size: 1rem;
  padding: 10px 14px;
  border: var(--border-whisper);
  border-radius: var(--radius-micro);
  background: var(--bg-page);
  color: var(--fg-primary);
}
.input::placeholder { color: var(--fg-muted); }
.input:focus { border-color: var(--color-focus); outline: none; box-shadow: 0 0 0 2px rgba(47,67,128,0.18); }

.pills { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-7); }
.pill {
  font: inherit; font-size: 0.875rem; font-weight: 500;
  padding: 4px 14px; cursor: pointer;
  border: var(--border-whisper); border-radius: var(--radius-pill);
  background: var(--bg-page); color: var(--fg-secondary);
  transition: background 0.12s ease, color 0.12s ease;
}
.pill:hover { background: var(--bg-surface); }
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Buttons ── */
.btn {
  font: inherit; font-size: 0.9375rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: var(--space-4);
  padding: 8px 16px; cursor: pointer;
  border: none; border-radius: var(--radius-micro);
  background: var(--accent); color: #fff;
  transition: background 0.12s ease, transform 0.08s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.96); }
.btn-ghost {
  background: transparent; color: var(--fg-primary);
  border: var(--border-whisper);
}
.btn-ghost:hover { background: var(--bg-surface); }

/* ── Cards ── */
.grid {
  display: grid; gap: var(--space-6);
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  padding-bottom: var(--space-10);
}
.card {
  display: flex; flex-direction: column; gap: var(--space-4);
  min-height: 208px;
  background: var(--bg-page);
  border: var(--border-whisper);
  border-radius: var(--radius-comfortable);
  box-shadow: var(--shadow-card);
  padding: var(--space-7);
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-deep); border-color: var(--accent); text-decoration: none; }
.card h3 {
  margin: 0;
  font-size: 1.25rem; font-weight: 700; line-height: 1.27;
  letter-spacing: -0.25px; color: var(--fg-primary);
  /* clamp to 1 line so headers align */
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card p {
  margin: 0; color: var(--fg-secondary); font-size: 0.9375rem; line-height: 1.45;
  /* Clamp to 3 lines AND reserve that height, so a short (1–2 line) description still
     occupies the full 3-line block. Otherwise the divider that follows floats up on
     shorter cards and the row's dividers don't align. 3 × 1.45em = 4.35em. */
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  line-clamp: 3; overflow: hidden;
  min-height: 4.35em;
}
.card-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.card-top h3 { min-width: 0; }
.card .flame {
  flex: none;
  font-size: 0.75rem; font-weight: 700; color: var(--color-orange);
  background: rgba(221,91,0,0.08); border-radius: var(--radius-pill);
  padding: 2px 9px; white-space: nowrap;
}
/* Category tag row — sits in the CONTENT area, ABOVE the divider, right after the
   description. Placing it here (not in the footer) keeps the divider separating
   "content" from "stats" on EVERY card, so all dividers align across a row. The row is
   always present (even with no category) so its height is reserved and the divider that
   follows lands at the same Y whether or not a card has a tag. */
.card .card-tags {
  display: flex; flex-wrap: wrap; gap: var(--space-4);
  min-height: 22px; /* one badge's height — reserved even when empty */
}
.card .meta {
  /* Fixed two-line byline — stats row, then date row — identical on every card so the
     divider above always lands at the same height. No whole-row wrapping (that was what
     made some cards' footers taller and their dividers float up). */
  margin-top: auto; padding-top: var(--space-5);
  display: flex; flex-direction: column; gap: 6px;
  font-size: 0.8125rem; color: var(--fg-muted);
  border-top: var(--border-whisper);
}
.card .meta-stats {
  display: flex; align-items: center; gap: var(--space-5);
  flex-wrap: nowrap; min-width: 0;           /* never wrap to a second line */
}
.card .meta-date { color: var(--fg-muted); }
.card .mi { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
/* publisher can be long — let it (and only it) truncate so the row stays one line */
.card .mi-pub { min-width: 0; overflow: hidden; }
.card .mi-pub { text-overflow: ellipsis; display: inline-flex; }
.card .mi-pub svg { flex: none; }
.card .mi svg { color: var(--fg-muted); }

/* list toolbar: category pills left, sort right */
.listbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-6);
  flex-wrap: wrap; margin: var(--space-6) 0 var(--space-7);
}
.listbar .pills { margin: 0; }
.sortgroup {
  display: inline-flex; gap: 2px;
  background: var(--bg-surface); border: var(--border-whisper);
  border-radius: var(--radius-pill); padding: 3px;
}
.sortbtn {
  font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--fg-secondary);
  background: none; border: none; cursor: pointer;
  padding: 5px 13px; border-radius: var(--radius-pill);
  transition: background 0.12s ease, color 0.12s ease;
}
.sortbtn:hover { color: var(--fg-primary); }
.sortbtn.active { background: var(--bg-page); color: var(--fg-primary); box-shadow: var(--shadow-card); }

.resultcount {
  font-size: 0.8125rem; color: var(--fg-muted); font-weight: 500;
  margin-bottom: var(--space-5);
}
.loadmore-wrap { display: flex; justify-content: center; padding: var(--space-7) 0 0; }
#loadmore {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.9375rem; font-weight: 600;
  padding: 11px 26px; cursor: pointer;
  color: var(--accent); background: var(--bg-page);
  border: 1.5px solid var(--accent); border-radius: var(--radius-pill);
  transition: background 0.12s ease, color 0.12s ease, transform 0.08s ease;
}
#loadmore:hover { background: var(--accent); color: #fff; }
#loadmore:active { transform: scale(0.97); }
#loadmore svg { transition: transform 0.15s ease; }
#loadmore:hover svg { transform: translateY(2px); }
#loadmore.loading { opacity: 0.6; pointer-events: none; }

/* ── Badges ── */
.badge {
  display: inline-block;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.125px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-badge-bg); color: var(--color-badge-text);
}
.badge-neutral { background: var(--bg-surface); color: var(--fg-secondary); }

/* ── Detail page ── */
.detail { padding: var(--space-9) 0 var(--space-10); max-width: 860px; }
.detail .crumbs { font-size: 0.875rem; color: var(--fg-muted); margin-bottom: var(--space-6); }
.detail h1 {
  margin: 0 0 var(--space-5);
  font-size: 2.5rem; font-weight: 700; letter-spacing: -1.5px; line-height: 1.04;
}
.detail .lead { font-size: 1.25rem; color: var(--fg-secondary); margin: 0 0 var(--space-6); }
.detail .badges { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-8); }

.panel {
  background: var(--bg-surface);
  border-radius: var(--radius-comfortable);
  padding: var(--space-7);
  margin-bottom: var(--space-8);
}
.panel h2 { margin: 0 0 var(--space-5); font-size: 1.375rem; letter-spacing: -0.25px; }
.copyblock { position: relative; margin: var(--space-5) 0 0; }
.copyblock pre {
  margin: 0; padding: 14px 52px 14px 16px;
  background: var(--color-warm-dark); color: #f6f5f4;
  border-radius: var(--radius-micro);
  font-size: 0.85rem; line-height: 1.55;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.copyblock .copybtn {
  position: absolute; top: 8px; right: 8px;
  font-size: 0.75rem; font-weight: 600;
  padding: 4px 10px; cursor: pointer;
  border: none; border-radius: var(--radius-micro);
  background: rgba(255,255,255,0.12); color: #fff;
}
.copyblock .copybtn:hover { background: rgba(255,255,255,0.22); }
.copyblock .lbl { font-size: 0.875rem; font-weight: 500; color: var(--fg-secondary); }

/* Caption ABOVE a copyblock. It must sit outside .copyblock: the Copy button is
   absolutely positioned against .copyblock, and a label inside it pushes the pre
   down so the button lands on the light panel background instead of the dark
   <pre> — white-on-white, invisible, and overlapping the caption text. */
.copy-label {
  display: block;
  margin: var(--space-6) 0 calc(var(--space-4) * -1);
  font-size: 0.875rem; font-weight: 500; color: var(--fg-secondary);
}

/* Long blocks (the setup prompt) scroll inside themselves. Without this the <pre>
   grows to full height and the absolutely-positioned Copy button ends up far above
   the viewport — present, but unreachable without scrolling back up. */
.copyblock.scrollable pre { max-height: 400px; overflow-y: auto; }

/* Callout for a step that needs a human action rather than a command to run. */
.step-note {
  margin: var(--space-5) 0 0;
  padding: 12px 14px;
  background: var(--bg-surface);
  border-left: 3px solid var(--color-orange);
  border-radius: var(--radius-micro);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--fg-secondary);
}
.step-note b { color: var(--fg-primary); }

/* ── Rendered markdown ── */
.md { line-height: 1.5; }
.md h1, .md h2, .md h3 { letter-spacing: -0.25px; margin: var(--space-7) 0 var(--space-5); }
.md h1 { font-size: 1.625rem; } .md h2 { font-size: 1.375rem; } .md h3 { font-size: 1.125rem; }
.md p, .md li { color: var(--fg-primary); }
.md code {
  background: var(--bg-surface); border: var(--border-whisper);
  border-radius: var(--radius-micro); padding: 1px 5px;
  font-size: 0.85em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.md pre {
  background: var(--color-warm-dark); color: #f6f5f4;
  border-radius: var(--radius-micro); padding: 14px 16px; overflow-x: auto;
}
.md pre code { background: none; border: none; color: inherit; padding: 0; }
.md blockquote {
  margin: var(--space-5) 0; padding: var(--space-2) var(--space-6);
  border-left: 3px solid var(--color-border); color: var(--fg-secondary);
}
.md img { max-width: 100%; border: var(--border-whisper); border-radius: var(--radius-comfortable); }
.md table { border-collapse: collapse; }
.md th, .md td { border: var(--border-whisper); padding: 6px 12px; font-size: 0.9375rem; }

/* ── Dashboard ── */
.section-title {
  margin: var(--space-8) 0 var(--space-6);
  font-size: 1.375rem; font-weight: 700; letter-spacing: -0.25px;
}
.tiles {
  display: grid; gap: var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.tile {
  background: var(--bg-page); border: var(--border-whisper);
  border-radius: var(--radius-comfortable); box-shadow: var(--shadow-card);
  padding: var(--space-6) var(--space-7);
}
.tile .num {
  font-size: 2.5rem; font-weight: 700; letter-spacing: -1.5px; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.tile .lbl { font-size: 0.875rem; font-weight: 500; color: var(--fg-secondary); }

.bars { display: flex; flex-direction: column; gap: var(--space-5); }
.bar-row { display: grid; grid-template-columns: 200px 1fr 48px; gap: var(--space-5); align-items: center; }
.bar-row .name { font-size: 0.9375rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--bg-surface); border-radius: var(--radius-pill); height: 12px; }
.bar-fill { background: var(--accent); border-radius: var(--radius-pill); height: 12px; min-width: 4px; }
.bar-row .val { font-size: 0.875rem; color: var(--fg-secondary); text-align: right; font-variant-numeric: tabular-nums; }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.125px;
  color: var(--fg-muted); padding: 8px 12px 8px 0;
  border-bottom: var(--border-whisper);
}
.table td { padding: 10px 12px 10px 0; border-bottom: var(--border-whisper); font-size: 0.9375rem; }
.table td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }

/* ── Token gate overlay ── */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(246,245,244,0.92);
}
/* class display rules beat the [hidden] UA style — restore hidden's meaning */
.gate[hidden], [hidden] { display: none !important; }
.gate-card {
  width: min(420px, calc(100vw - 48px));
  background: var(--bg-page);
  border: var(--border-whisper); border-radius: var(--radius-large);
  box-shadow: var(--shadow-deep);
  padding: var(--space-8);
  text-align: center;
}
.gate-card h2 { margin: var(--space-5) 0 var(--space-3); font-size: 1.375rem; letter-spacing: -0.25px; }
.gate-card p { margin: 0 0 var(--space-6); color: var(--fg-secondary); font-size: 0.9375rem; }
.gate-card .input { width: 100%; margin-bottom: var(--space-5); }
.gate-card .btn { width: 100%; justify-content: center; }
.gate-card .err { color: var(--color-orange); font-size: 0.875rem; margin-top: var(--space-4); }

.empty {
  padding: var(--space-9) 0; text-align: center; color: var(--fg-muted);
}

footer.site {
  border-top: var(--border-whisper);
  padding: var(--space-7) 0 var(--space-9);
  font-size: 0.875rem; color: var(--fg-muted);
}

@media (max-width: 760px) {
  .topbar-inner { grid-template-columns: auto 1fr auto; gap: var(--space-5); }
  .nav { justify-self: center; }
  .nav a { padding: 6px 12px; }
  .brand span { display: none; }
  .who-name { display: none; }
}
@media (max-width: 640px) {
  .hero h1 { font-size: 2rem; letter-spacing: -1px; }
  .bar-row { grid-template-columns: 120px 1fr 40px; }
}

/* ============================================================
   Engagement layer — hero grid, stat band, float cards,
   detail sidebar, tabs, sparkline
   ============================================================ */

/* ── Eyebrow ── */
.eyebrow {
  display: flex; align-items: center; gap: var(--space-5);
  font-size: 0.75rem; font-weight: 600; letter-spacing: 1.5px;
  color: var(--fg-muted); text-transform: uppercase;
  margin-bottom: var(--space-6);
}
.eyebrow::before { content: ""; width: 40px; height: 1px; background: var(--color-orange); opacity: 0.6; }

/* ── Hero grid + big display type ── */
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px;
  gap: var(--space-9); align-items: center;
  padding: var(--space-10) 0 var(--space-8);
}
.hero-grid h1 {
  margin: 0 0 var(--space-6);
  font-size: clamp(2.5rem, 6vw, 3.375rem);
  font-weight: 700; line-height: 1.04; letter-spacing: -1.875px;
}
.hl { background: linear-gradient(transparent 58%, rgba(221,91,0,0.18) 58%); }
.hero-grid .sub {
  margin: 0; padding-left: var(--space-6);
  border-left: 2px solid var(--color-border);
  font-size: 1.25rem; color: var(--fg-secondary); line-height: 1.4;
  max-width: 34em;
}

/* ── Stat band ── */
.statband {
  display: flex; align-items: baseline; gap: var(--space-5);
  border-top: var(--border-whisper); border-bottom: var(--border-whisper);
  padding: var(--space-6) 0; margin: var(--space-7) 0;
}
.statband::before {
  content: ""; align-self: center;
  width: 10px; height: 10px; background: var(--color-orange); opacity: 0.85;
}
.statband .big {
  font-size: 2.5rem; font-weight: 700; letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums; line-height: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.statband .cap { color: var(--fg-secondary); font-size: 0.9375rem; }

/* ── Floating card cluster (hero right) ── */
.float-panel { position: relative; }
.float-panel::before {
  content: ""; position: absolute; inset: 24px -24px -24px 24px;
  border: var(--border-whisper); border-radius: var(--radius-large);
  background: linear-gradient(135deg, rgba(246,245,244,0.6), rgba(242,249,255,0.5));
}
.float-cards {
  position: relative;
  display: flex; flex-direction: column; gap: var(--space-5);
  background: var(--bg-page);
  border: var(--border-whisper); border-radius: var(--radius-large);
  box-shadow: var(--shadow-deep);
  padding: var(--space-6);
}
.fcard {
  display: flex; align-items: center; gap: var(--space-5);
  border: var(--border-whisper); border-radius: var(--radius-comfortable);
  padding: var(--space-5) var(--space-6);
  color: var(--fg-primary); cursor: pointer; background: var(--bg-page);
  font: inherit; text-align: left;
  transition: box-shadow 0.15s ease;
}
.fcard:hover { box-shadow: var(--shadow-card); border-color: var(--accent); text-decoration: none; }
.fcard .ic {
  flex: none; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: var(--border-whisper); border-radius: var(--radius-micro);
  color: var(--fg-secondary);
  transition: color 0.12s ease, border-color 0.12s ease;
}
.fcard .ic svg { stroke-width: 1.5; transition: stroke-width 0.12s ease; }
.fcard:hover .ic { color: var(--accent); border-color: var(--accent); }
.fcard:hover .ic svg { stroke-width: 2.25; }
.fcard b {
  display: block; font-size: 0.9375rem; font-weight: 600;
  color: var(--fg-primary); transition: font-weight 0.12s ease;
}
.fcard:hover b { font-weight: 700; color: var(--accent); }
.fcard span { display: block; font-size: 0.8125rem; color: var(--fg-muted); }
.fcard .arrow { margin-left: auto; color: var(--fg-muted); transition: transform 0.12s ease, color 0.12s ease; }
.fcard:hover .arrow { color: var(--accent); transform: translateX(3px); }

/* ── Search row with CTA ── */
.searchrow { display: flex; gap: var(--space-5); margin: var(--space-7) 0 var(--space-6); }
.searchrow .input { flex: 1; padding: 12px 16px; font-size: 1.0625rem; }

/* ── Detail: two-column with sticky sidebar ── */
.detail-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-9); align-items: start;
  padding: var(--space-9) 0 var(--space-10);
}
.sidebar { position: sticky; top: 84px; display: flex; flex-direction: column; }
.side-card {
  border: var(--border-whisper); border-radius: var(--radius-comfortable);
  box-shadow: var(--shadow-card); background: var(--bg-page);
  overflow: hidden;
}
.side-row { padding: var(--space-5) var(--space-6); border-bottom: var(--border-whisper); }
.side-row:last-child { border-bottom: none; }
.side-row .k {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--fg-muted); margin-bottom: 2px;
}
.side-row .v { font-size: 1rem; font-weight: 600; }
.side-row .v.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875rem; }
.side-row .range { float: right; display: flex; gap: var(--space-4); }
.side-row .range button {
  font: inherit; font-size: 0.75rem; font-weight: 600; color: var(--fg-muted);
  background: none; border: none; cursor: pointer; padding: 0 2px;
}
.side-row .range button.active { color: var(--fg-primary); box-shadow: inset 0 -2px 0 var(--accent); }
.spark { display: block; width: 100%; height: 44px; margin-top: var(--space-4); }
.audit { display: flex; gap: var(--space-3); margin-top: var(--space-3); }
.audit i { flex: 1; height: 5px; border-radius: var(--radius-pill); background: var(--color-green); opacity: 0.85; }

/* ── Tabs ── */
.tabs {
  display: flex; gap: var(--space-7);
  border-bottom: var(--border-whisper); margin: var(--space-8) 0 var(--space-6);
}
.tab {
  font: inherit; font-size: 0.9375rem; font-weight: 600; color: var(--fg-muted);
  background: none; border: none; cursor: pointer;
  padding: 0 0 10px;
}
.tab:hover { color: var(--fg-primary); }
.tab.active { color: var(--fg-primary); box-shadow: inset 0 -2px 0 var(--accent); }

.minitabs { display: flex; gap: var(--space-5); margin-bottom: var(--space-4); }
.minitab {
  font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--fg-muted);
  background: none; border: var(--border-whisper); border-radius: var(--radius-pill);
  padding: 3px 12px; cursor: pointer;
}
.minitab.active { color: #fff; background: var(--accent); border-color: var(--accent); }

.files-table td:first-child { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }

/* ── Skill Card ── */
.cardnote {
  background: var(--bg-surface);
  border-left: 3px solid var(--color-border);
  border-radius: 0 var(--radius-micro) var(--radius-micro) 0;
  padding: var(--space-5) var(--space-6);
  font-size: 0.9375rem; color: var(--fg-secondary);
}
.cardnote b { display: block; color: var(--fg-primary); margin-bottom: 2px; }
.license-box { border: 1px solid var(--color-border); border-radius: var(--radius-small); overflow: hidden; }
.license-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-surface); border-bottom: 1px solid var(--color-border);
  padding: 8px 14px;
}
.license-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8125rem; font-weight: 600; color: var(--fg-secondary); }
.license-bar .copybtn {
  background: var(--color-navy); color: #fff; border: none; border-radius: var(--radius-micro);
  padding: 4px 12px; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
}
.license-bar .copybtn:hover { opacity: 0.9; }
.license-text {
  margin: 0; max-height: 320px; overflow: auto;
  padding: 14px 16px; background: var(--color-white);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem;
  line-height: 1.5; color: var(--fg-secondary); white-space: pre-wrap; word-break: break-word;
}
.cardfields {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-6);
  border-top: var(--border-whisper); border-bottom: var(--border-whisper);
  padding: var(--space-6) 0; margin: var(--space-6) 0;
}
.cardfields .k {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--fg-muted); margin-bottom: 3px;
}
.cardfields .v { font-size: 1rem; }

/* ── SKILL.md framed doc ── */
.doc {
  border: var(--border-whisper); border-radius: var(--radius-comfortable);
  box-shadow: var(--shadow-card); background: var(--bg-page); overflow: hidden;
}
.doc-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: var(--border-whisper); background: var(--bg-surface);
}
.doc-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8125rem; font-weight: 600; color: var(--fg-secondary); }
.doc-flag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; color: var(--fg-muted); }
.doc-body { padding: var(--space-7); }

/* frontmatter key/value table — navy label rail, orange keys */
.fm-table {
  width: 100%; border-collapse: collapse; margin-bottom: var(--space-8);
  border: var(--border-whisper); border-radius: var(--radius-micro); overflow: hidden;
}
.fm-table td { padding: 12px 16px; vertical-align: top; border-bottom: var(--border-whisper); }
.fm-table tr:last-child td { border-bottom: none; }
.fm-table td.k {
  width: 150px; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875rem; font-weight: 600; color: var(--color-orange);
  background: rgba(221,91,0,0.05);
  border-right: 2px solid rgba(221,91,0,0.25);
}
.fm-table td.v { color: var(--fg-secondary); }
.fm-table tr.hl-row td { background: rgba(31,45,92,0.03); }
.fm-table tr.hl-row td.k { background: rgba(221,91,0,0.05); }

/* ── Versions ── */
.versions-panel {
  border: var(--border-whisper); border-radius: var(--radius-comfortable);
  box-shadow: var(--shadow-card); overflow: hidden; background: var(--bg-page);
}
.versions-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-6);
  padding: var(--space-6) var(--space-7); border-bottom: var(--border-whisper); background: var(--bg-surface);
}
.versions-head b { display: block; font-size: 1.0625rem; }
.versions-table { width: 100%; margin: 0; }
.versions-table th { padding: 12px 20px; }
.versions-table td { padding: 16px 20px; vertical-align: top; border-bottom: var(--border-whisper); }
.versions-table tr:last-child td { border-bottom: none; }
.versions-table td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; white-space: nowrap; }
.versions-table td.mono .badge { margin-left: 8px; }
.versions-table tr:first-child td { background: rgba(31,45,92,0.02); }

/* download button */
.dlbtn {
  font: inherit; font-size: 0.8125rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; cursor: pointer;
  border: var(--border-whisper); border-radius: var(--radius-micro);
  background: var(--bg-page); color: var(--fg-primary);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.dlbtn:hover { border-color: var(--accent); color: var(--accent); background: var(--bg-surface); }
.dlbtn:active { transform: scale(0.96); }
.dlbtn:disabled, .dlbtn.loading { opacity: 0.5; cursor: default; }
.dlbtn.loading span { visibility: hidden; }
.viewlink {
  display: inline-block; margin-left: 8px; padding: 4px 8px;
  color: var(--fg-muted); font-size: 1rem;
}
.viewlink:hover { color: var(--accent); text-decoration: none; }

/* ── Scroll to top ── */
.scrolltop {
  position: fixed; bottom: 28px; right: 28px; z-index: 20;
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--fg-secondary);
  padding: 8px 14px; cursor: pointer;
  border: var(--border-whisper); border-radius: var(--radius-pill);
  background: var(--bg-page); box-shadow: var(--shadow-deep);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, color 0.12s ease, border-color 0.12s ease;
}
.scrolltop.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.scrolltop:hover { color: var(--accent); border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .scrolltop { transition: opacity 0.18s ease; } }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .float-panel { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Admin control panel — sidebar app shell (all classes namespaced .adm-)
   ════════════════════════════════════════════════════════════════════════════ */
.adm-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.adm-side {
  position: sticky; top: 0; align-self: start; height: 100vh;
  border-right: var(--border-whisper); background: var(--panel2);
  display: flex; flex-direction: column; padding: 20px 14px; gap: 4px;
}
.adm-brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 16px; font-weight: 700; letter-spacing: -0.3px; font-size: 1.05rem; }
.adm-brand svg { flex: none; }
.adm-brand .tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--orange); background: var(--orange-tint); border-radius: 4px; padding: 2px 6px; margin-left: auto; }
.adm-navitem {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border-radius: 9px; border: 1px solid transparent;
  background: none; cursor: pointer; text-align: left;
  font: inherit; font-size: 0.9rem; font-weight: 550; color: var(--fg-secondary);
  transition: background 0.14s ease, color 0.14s ease;
}
.adm-navitem svg { flex: none; opacity: 0.85; }
.adm-navitem:hover { background: var(--bg-page); color: var(--fg-primary); }
.adm-navitem.active { background: var(--navy); color: #fff; box-shadow: var(--shadow-card); }
.adm-navitem.active svg { opacity: 1; }
.adm-navitem .badge-count {
  margin-left: auto; font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums;
  min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 999px;
  background: var(--orange-tint); color: var(--orange);
}
.adm-navitem.active .badge-count { background: rgba(255,255,255,0.22); color: #fff; }
.adm-side-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.adm-who { font-size: 0.8rem; color: var(--fg-secondary); padding: 0 8px; display: flex; align-items: center; gap: 7px; }
.adm-who .dot { width: 22px; height: 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--color-navy), var(--color-orange)); flex: none; }

.adm-main { min-width: 0; padding: 34px 40px 80px; }
.adm-sec { display: none; animation: fade-in 0.2s ease-out; }
.adm-sec.active { display: block; }
.adm-sec-head { margin-bottom: 22px; }
.adm-sec-head h1 { font-size: 1.7rem; letter-spacing: -0.8px; margin: 0 0 4px; }
.adm-sec-head p { color: var(--fg-secondary); margin: 0; font-size: 0.95rem; max-width: 74ch; }
.adm-sec-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.adm-sec-toolbar .spacer { margin-left: auto; }

.adm-block { margin-bottom: 30px; }
.adm-block > h2 { font-size: 1.05rem; letter-spacing: -0.3px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.adm-block > h2 .hint { font-size: 0.8rem; font-weight: 400; color: var(--fg-muted); }
.adm-card { background: var(--panel); border: var(--border-whisper); border-radius: var(--radius-comfortable); box-shadow: var(--shadow-card); padding: 20px; }

/* mobile: collapse sidebar to a top strip */
@media (max-width: 820px) {
  .adm-shell { grid-template-columns: 1fr; }
  .adm-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; gap: 6px; }
  .adm-brand { padding: 0 8px 0 4px; }
  .adm-navitem { width: auto; }
  .adm-navitem .badge-count { margin-left: 6px; }
  .adm-side-foot { margin: 0 0 0 auto; flex-direction: row; }
  .adm-who { display: none; }
  .adm-main { padding: 24px 18px 64px; }
}

/* ── Merge Requests ── */
.mr-list { display: flex; flex-direction: column; gap: 10px; }
.mr-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: var(--border-whisper); border-radius: var(--radius-comfortable); background: var(--panel); cursor: pointer; transition: border-color 0.14s ease, box-shadow 0.14s ease; }
.mr-row:hover { border-color: var(--navy); box-shadow: var(--shadow-card); }
.mr-row .mr-main { flex: 1; min-width: 0; }
.mr-row .mr-title { font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; }
.mr-row .mr-sub { font-size: 0.8rem; color: var(--fg-muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.mr-branch { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; background: var(--panel2); border-radius: 5px; padding: 1px 7px; }
.mr-state { font-family: ui-monospace, monospace; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 9px; border-radius: 999px; }
.mr-state.opened { background: var(--agent-tint); color: var(--agent); }
.mr-state.merged { background: var(--navy-tint); color: var(--navy); }
.mr-state.closed { background: var(--danger-tint); color: var(--danger); }
.mr-state.draft { background: var(--panel2); color: var(--fg-muted); }
.mr-mergeable { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.mr-mergeable.ok { background: var(--agent-tint); color: var(--agent); }
.mr-mergeable.blocked { background: var(--orange-tint); color: var(--orange); }

.mr-detail-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.mr-detail-head .mr-title { font-size: 1.2rem; font-weight: 650; letter-spacing: -0.4px; }
.diff-file { border: var(--border-whisper); border-radius: var(--radius-comfortable); margin-bottom: 14px; overflow: hidden; }
.diff-file-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel2); border-bottom: var(--border-whisper); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; cursor: pointer; }
.diff-file-head .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diff-file-head .ftag { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 6px; border-radius: 4px; }
.diff-file-head .ftag.new { background: var(--agent-tint); color: var(--agent); }
.diff-file-head .ftag.del { background: var(--danger-tint); color: var(--danger); }
.diff-file-head .ftag.ren { background: var(--navy-tint); color: var(--navy); }
.diff-body { overflow-x: auto; background: var(--panel); }
.diff-body pre { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; line-height: 1.5; }
.diff-line { display: block; padding: 0 14px; white-space: pre; }
.diff-line.add { background: rgba(37,145,110,0.12); color: #1a6b4f; }
.diff-line.del { background: rgba(179,38,30,0.10); color: #a12019; }
.diff-line.hunk { background: var(--navy-tint); color: var(--navy); font-weight: 600; }
.diff-line.ctx { color: var(--fg-secondary); }

/* ── SQL console ── */
.sql-editor {
  width: 100%; min-height: 130px; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9rem; line-height: 1.55;
  padding: 14px 16px; border: 1.5px solid var(--line); border-radius: var(--radius-comfortable);
  background: var(--code-bg); color: var(--code-ink); tab-size: 2;
}
.sql-editor:focus { outline: none; border-color: var(--navy); }
.sql-bar { display: flex; align-items: center; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.sql-writetoggle { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--fg-secondary); padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); }
.sql-writetoggle.on { border-color: var(--danger); background: var(--danger-tint); color: var(--danger); font-weight: 600; }
.sql-samples { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.sql-samples button { font-size: 0.78rem; padding: 4px 10px; border: var(--border-whisper); border-radius: 999px; background: var(--panel2); cursor: pointer; color: var(--fg-secondary); }
.sql-samples button:hover { border-color: var(--navy); color: var(--navy); }
.sql-schema { display: flex; flex-direction: column; gap: 2px; }
.sql-schema .tbl { padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 0.85rem; display: flex; align-items: center; gap: 8px; }
.sql-schema .tbl:hover { background: var(--panel2); }
.sql-schema .tbl .tname { font-family: ui-monospace, monospace; font-weight: 600; }
.sql-schema .tbl .trows { margin-left: auto; font-size: 0.72rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.sql-schema .cols { font-size: 0.72rem; color: var(--fg-muted); padding: 0 10px 6px 28px; font-family: ui-monospace, monospace; word-break: break-word; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th { position: sticky; top: 0; text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-muted); font-weight: 700; padding: 8px 12px; background: var(--panel2); border-bottom: 1.5px solid var(--linestrong); white-space: nowrap; }
.data-table td { padding: 7px 12px; border-bottom: var(--border-whisper); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; vertical-align: top; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.data-table td.null { color: var(--fg-muted); font-style: italic; }
.data-scroll { overflow: auto; max-height: 60vh; border: var(--border-whisper); border-radius: var(--radius-comfortable); }

/* ── Error logs ── */
.log-row { display: grid; grid-template-columns: 74px 150px 1fr; gap: 12px; padding: 9px 14px; border-bottom: var(--border-whisper); font-size: 0.85rem; align-items: baseline; }
.log-row:hover { background: var(--panel2); }
.log-lvl { font-family: ui-monospace, monospace; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 7px; border-radius: 5px; text-align: center; }
.log-lvl.warn { background: var(--orange-tint); color: var(--orange); }
.log-lvl.error, .log-lvl.fatal { background: var(--danger-tint); color: var(--danger); }
.log-lvl.info { background: var(--navy-tint); color: var(--navy); }
.log-when { font-size: 0.78rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.log-msg { min-width: 0; }
.log-msg .src { font-family: ui-monospace, monospace; font-size: 0.72rem; color: var(--fg-muted); margin-right: 8px; }
.log-detail { font-family: ui-monospace, monospace; font-size: 0.76rem; color: var(--fg-secondary); background: var(--panel2); border-radius: 6px; padding: 6px 10px; margin-top: 5px; white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow: auto; }

/* filter chips (shared by MRs + logs) */
.chipbar { display: inline-flex; gap: 4px; background: var(--panel2); border-radius: var(--radius-pill); padding: 4px; }
.chipbar button { font: inherit; font-size: 0.82rem; font-weight: 600; padding: 5px 14px; border: none; background: none; border-radius: var(--radius-pill); cursor: pointer; color: var(--fg-secondary); }
.chipbar button.active { background: var(--bg-page); color: var(--fg-primary); box-shadow: var(--shadow-card); }

.adm-empty { color: var(--fg-muted); font-size: 0.9rem; padding: 28px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-comfortable); }
.adm-spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--navy); border-radius: 50%; animation: adm-spin 0.7s linear infinite; vertical-align: -2px; }
@keyframes adm-spin { to { transform: rotate(360deg); } }
.adm-callout { border-left: 3px solid var(--color-orange); background: var(--orange-tint); border-radius: 0 8px 8px 0; padding: 14px 18px; font-size: 0.9rem; }
.adm-callout code { background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 4px; font-size: 0.85em; }
