/* ═════════════════════════════════════════════════════════════
   RINGI · DESIGN SYSTEM
   ─────────────────────────────────────────────────────────────
   Light, near-monochrome, calm. Inter throughout. Soft shadows.
   Built for non-technical reviewers — Notion/Stripe sensibility.
   ═════════════════════════════════════════════════════════════ */

:root {
  /* ── surfaces ──────────────────────────────────────────── */
  --bg:           #ffffff;
  --bg-subtle:    #f7f7f8;
  --bg-sunken:    #f1f1f2;
  --surface:      #ffffff;

  /* ── lines ─────────────────────────────────────────────── */
  --border:        #e8e8ea;
  --border-strong: #d8d8dc;

  /* ── ink ───────────────────────────────────────────────── */
  --text:        #1c1c1e;
  --text-body:   #2e2e33;
  --text-muted:  #6b6b73;
  --text-faint:  #9a9aa2;

  /* ── accent · used sparingly (focus, active, links) ────── */
  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft:  #eef3ff;

  /* ── annotation highlighter ────────────────────────────── */
  --highlight:       rgba(250, 204, 21, 0.40);
  --highlight-on:    rgba(250, 204, 21, 0.70);

  /* ── status (semantic, soft) ───────────────────────────── */
  --st-draft-fg:   #6b6b73;  --st-draft-bg:   #f1f1f2;
  --st-review-fg:  #1d4ed8;  --st-review-bg:  #eef3ff;
  --st-changes-fg: #b45309;  --st-changes-bg: #fff7ed;
  --st-ready-fg:   #15803d;  --st-ready-bg:   #ecfdf3;
  --danger:        #b91c1c;
  --danger-bg:     #fef2f2;

  /* ── radius ────────────────────────────────────────────── */
  --r-sm:   6px;
  --r:      8px;
  --r-lg:   12px;
  --r-pill: 999px;

  /* ── shadow ────────────────────────────────────────────── */
  --shadow-sm: 0 1px 2px rgba(17,17,26,0.05);
  --shadow:    0 1px 3px rgba(17,17,26,0.08), 0 1px 2px rgba(17,17,26,0.04);
  --shadow-md: 0 4px 14px rgba(17,17,26,0.08);
  --shadow-lg: 0 14px 40px rgba(17,17,26,0.14);

  /* ── type ──────────────────────────────────────────────── */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

  /* ── back-compat aliases (legacy inline styles) ────────── */
  --bg-alias: var(--bg);
  --meta:     var(--text-muted);
  --muted:    var(--text-faint);
  --accent-c: var(--accent);
  --text-c:   var(--text);
}

/* ── reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-body);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
::selection { background: var(--accent-soft); }

input, textarea, select, button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ═════════════════════════════════════════════════════════════
   TOPBAR
   ═════════════════════════════════════════════════════════════ */
.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 12px 28px;
  gap: 20px;
}
.masthead-left  { display: flex; gap: 14px; align-items: center; min-width: 0; }
.masthead-right { display: flex; gap: 16px; align-items: center; justify-content: flex-end; min-width: 0; flex-wrap: wrap; }

.masthead-eyebrow {
  font-size: 12.5px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crest {
  font-weight: 650;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}
.crest-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.crest:hover { color: var(--text); }

.file-no {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
  font-feature-settings: "tnum";
}
.file-no strong { color: var(--text-muted); font-weight: 600; }

.masthead-email {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: var(--r-sm);
  padding: 4px 8px;
}
.masthead-email:hover { color: var(--text); background: var(--bg-subtle); }
.masthead-logout { display: inline-flex; margin: 0; }
.masthead-logout button {
  font-size: 15px;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  border-radius: var(--r-sm);
}
.masthead-logout button:hover { color: var(--text); background: var(--bg-subtle); }

/* ═════════════════════════════════════════════════════════════
   STATUS PILLS (class names locked by Go: pill-{status})
   ═════════════════════════════════════════════════════════════ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 550;
  line-height: 1;
  padding: 5px 10px 5px 9px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.pill-draft         { color: var(--st-draft-fg);   background: var(--st-draft-bg); }
.pill-in-review     { color: var(--st-review-fg);  background: var(--st-review-bg); }
.pill-needs-changes { color: var(--st-changes-fg); background: var(--st-changes-bg); }
.pill-ready         { color: var(--st-ready-fg);   background: var(--st-ready-bg); }

/* ═════════════════════════════════════════════════════════════
   BUTTONS  (class names kept: btn-stamp / btn-stamp-light)
   ═════════════════════════════════════════════════════════════ */
.btn-stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.2;
  padding: 9px 16px;
  background: var(--text);
  color: #fff;
  border: 1px solid var(--text);
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, transform 0.06s ease;
}
.btn-stamp:hover { background: #000; border-color: #000; box-shadow: var(--shadow-sm); }
.btn-stamp:active { transform: translateY(0.5px); }
.btn-stamp span { transition: transform 0.16s ease; }
.btn-stamp:hover span { transform: translateX(2px); }

.btn-stamp.solid { background: var(--text); color: #fff; border-color: var(--text); }
.btn-stamp.solid:hover { background: #000; }

.btn-stamp-light {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-stamp-light:hover { background: var(--bg-subtle); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-sm); }

/* ═════════════════════════════════════════════════════════════
   PAGE LAYOUTS
   ═════════════════════════════════════════════════════════════ */
.page-center {
  max-width: 880px;
  margin: 0 auto;
  padding: 56px 32px 96px;
}

/* ═════════════════════════════════════════════════════════════
   LANDING
   ═════════════════════════════════════════════════════════════ */
.landing-min {
  max-width: 600px;
  margin: 0 auto;
  padding: 88px 28px 80px;
}

.landing-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 550;
  color: var(--accent);
  margin-bottom: 22px;
}
.landing-eyebrow .rule { width: 22px; height: 1.5px; border-radius: 2px; background: var(--accent); }

.wordmark {
  font-weight: 700;
  font-size: clamp(2.6rem, 6vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--text);
  margin-bottom: 20px;
}
.wordmark .accent { color: var(--accent); }

.lead {
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--text);
  max-width: 34ch;
  margin-bottom: 18px;
}

.lede-prose {
  font-size: 1.0rem;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 54ch;
  margin-bottom: 56px;
}
.lede-prose em { font-style: normal; color: var(--text); font-weight: 550; }

/* numbered step labels */
.block-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--text);
  margin-bottom: 16px;
}
.block-label > span:first-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-sunken);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}
.block-label .dot { display: none; }

/* sign-in */
.signin-block { margin-bottom: 48px; }
.signin-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.signin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.signin-row input[type="email"] {
  font-size: 15px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
  min-width: 0;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.signin-row input[type="email"]::placeholder { color: var(--text-faint); }
.signin-row input[type="email"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.signin-hint { font-size: 12.5px; color: var(--text-faint); margin-top: 10px; }

.signin-toast {
  font-size: 14px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.signin-toast-ok  { background: var(--st-ready-bg); color: var(--st-ready-fg); }
.signin-toast-err { background: var(--danger-bg); color: var(--danger); }

/* agent prompt */
.agent-block { }
.agent-intro {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin-bottom: 14px;
  max-width: 54ch;
}
.prompt-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 14px;
}
.prompt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.prompt-head-label { color: var(--text-muted); font-weight: 550; }
.prompt-copy {
  font-size: 12px;
  font-weight: 550;
  padding: 5px 11px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.prompt-copy:hover { background: var(--text); color: #fff; border-color: var(--text); }
.prompt-copy.copied { background: var(--st-ready-fg); color: #fff; border-color: var(--st-ready-fg); }
.prompt-body {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-body);
  padding: 14px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-faint);
}
.agent-meta a, .agent-meta-link {
  color: var(--text);
  font-weight: 550;
  border-bottom: 1px solid var(--border-strong);
}
.agent-meta a:hover, .agent-meta-link:hover { color: var(--accent); border-color: var(--accent); }
.agent-meta-sep { color: var(--border-strong); }

/* ═════════════════════════════════════════════════════════════
   COLLECTION INDEX  (template class names kept as .packet*)
   ═════════════════════════════════════════════════════════════ */
.packet {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 32px 96px;
}
.packet-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.packet-eyebrow {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.packet-eyebrow .slug-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: var(--r-sm);
}
.packet-header h1 {
  font-weight: 700;
  font-size: clamp(1.7rem, 3.5vw, 2.3rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  max-width: 24ch;
  color: var(--text);
}
.packet-header h1 em { font-style: normal; color: var(--accent); }
.packet-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* document list (template class names kept as .circulation*) */
.circulation { margin-top: 8px; }
.circulation-row {
  display: grid;
  grid-template-columns: 56px 1fr 200px 150px 36px;
  gap: 24px;
  align-items: center;
  padding: 16px 12px;
  margin: 0 -12px;
  border-radius: var(--r);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease;
}
.circulation-row:hover { background: var(--bg-subtle); text-decoration: none; }
.circulation-row.head {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-faint);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.circulation-row.head:hover { background: transparent; }

.doc-no {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}
.doc-no strong { color: var(--text-muted); font-weight: 600; }
.doc-title {
  font-weight: 600;
  font-size: 1.0rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text);
}
.doc-title .slug-only { font-family: var(--font-mono); font-weight: 500; font-size: 0.9em; color: var(--text-muted); }
.doc-title .doc-author {
  display: block;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-faint);
  margin-top: 3px;
}
.rev-stack {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.rev-pip { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }
.rev-pip.current { background: var(--accent); }
.go {
  font-size: 1.1rem;
  color: var(--text-faint);
  transition: color 0.12s ease, transform 0.12s ease;
  text-align: right;
}
.circulation-row:hover .go { color: var(--text); transform: translateX(3px); }
.packet-empty {
  margin-top: 24px;
  padding: 64px 0;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  color: var(--text-faint);
  font-size: 1.0rem;
}

/* ═════════════════════════════════════════════════════════════
   DOCUMENT / REVIEW PAGE
   ═════════════════════════════════════════════════════════════ */
.page-pin {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 56px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 40px 120px;
  align-items: start;
}
.prose-shell { max-width: 740px; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 22px;
}
.back:hover { color: var(--text); text-decoration: none; }

.doc-banner {
  padding-bottom: 22px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--border);
}
.crumb {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.crumb a { color: var(--text-muted); }
.crumb a:hover { color: var(--accent); text-decoration: none; }
.crumb .sep { color: var(--border-strong); }

.doc-banner h1 {
  font-weight: 700;
  font-size: clamp(1.6rem, 3.2vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
  max-width: 26ch;
  color: var(--text);
}

.doc-meta-row {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.doc-meta-row .vert { width: 1px; height: 12px; background: var(--border); }
.doc-meta-row .pin-updated { color: var(--text-faint); }

/* reviewer avatars (in banner meta row) */
.reviewers { display: inline-flex; align-items: center; }
.reviewers .avatar { margin-left: -6px; }
.reviewers .avatar:first-child { margin-left: 0; }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-sunken);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1.5px solid var(--surface);
  flex-shrink: 0;
}

.rev-selector,
.version-btn {
  font-family: var(--font-sans);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  padding: 5px 26px 5px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 4l3 3 3-3' stroke='%236b6b73' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  color: var(--text);
}
.version-btn:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* status + share controls */
.doc-status-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.status-controls,
.status-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px;
}
.status-btn {
  font-size: 12.5px;
  font-weight: 550;
  padding: 5px 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.status-btn:hover { color: var(--text); background: var(--bg-sunken); }
.status-btn-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.status-btn-active:hover { background: var(--surface); color: var(--text); }

.share-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-share {
  font-size: 12.5px;
  font-weight: 550;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  text-decoration: none;
  display: inline-block;
}
.btn-share:hover { background: var(--bg-subtle); }
.btn-share-empty { color: var(--text-muted); }
.btn-share-empty:hover { color: var(--text); }

/* version banner (past revision) */
.version-banner {
  background: var(--accent-soft);
  border: 1px solid #d6e2ff;
  border-radius: var(--r);
  padding: 10px 14px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--accent-hover);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.version-banner a { color: var(--accent); font-weight: 550; border-bottom: 1px solid currentColor; padding-bottom: 1px; }

/* ═════════════════════════════════════════════════════════════
   PROSE (rendered markdown) — all Inter
   ═════════════════════════════════════════════════════════════ */
.prose {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-body);
}
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  font-weight: 650;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.02em;
}
.prose h1 { font-size: 1.7rem; margin: 0 0 0.6em; }
.prose h2 { font-size: 1.32rem; margin: 1.9em 0 0.5em; }
.prose h3 { font-size: 1.1rem; margin: 1.5em 0 0.4em; }
.prose h4 { font-size: 1.0rem; margin: 1.4em 0 0.4em; color: var(--text-body); }
.prose p   { margin: 0 0 1.0em; }
.prose ul, .prose ol { margin: 0 0 1.1em 1.4em; padding: 0; }
.prose li { margin-bottom: 0.4em; padding-left: 4px; }
.prose ul li::marker { color: var(--text-faint); }
.prose ol li::marker { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: var(--r-sm);
}
.prose pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 1.3em;
  font-size: 13.5px;
  line-height: 1.6;
}
.prose pre code { background: none; border: none; padding: 0; font-size: inherit; }
.prose blockquote {
  border-left: 3px solid var(--border-strong);
  padding: 2px 0 2px 16px;
  margin: 1.3em 0;
  color: var(--text-muted);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.3em;
  font-size: 0.92em;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.prose th, .prose td { border-bottom: 1px solid var(--border); padding: 9px 13px; text-align: left; vertical-align: top; }
.prose tr:last-child td { border-bottom: none; }
.prose th { background: var(--bg-subtle); font-weight: 600; font-size: 0.92em; color: var(--text); }
.prose a { color: var(--accent); border-bottom: 1px solid #c8d8ff; padding-bottom: 0.5px; }
.prose a:hover { border-color: var(--accent); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.2em 0; }
.prose img { display: block; max-width: 100%; margin: 1.5em auto; border-radius: var(--r); border: 1px solid var(--border); }
.prose strong { font-weight: 650; color: var(--text); }

/* block-level anchoring (class names locked by JS) */
.block {
  position: relative;
  transition: background 0.16s ease, box-shadow 0.16s ease;
  padding: 2px 10px;
  margin-left: -10px;
  margin-right: -10px;
  border-radius: var(--r-sm);
}
.block:hover { background: var(--bg-subtle); cursor: text; }
.block.selected { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }

/* inline marks (class names locked by JS) */
mark.comment-selection {
  background: var(--accent-soft);
  color: inherit;
  border-bottom: 2px solid var(--accent);
  padding: 0 1px;
  border-radius: 2px;
}
mark.comment-highlight {
  background: var(--highlight);
  color: inherit;
  cursor: pointer;
  border-radius: 2px;
  padding: 0 1px;
  transition: background 0.15s ease;
}
mark.comment-highlight.is-active { background: var(--highlight-on); }
mark.comment-highlight.is-flash { animation: comment-highlight-flash 1.2s ease-out 1; }
@keyframes comment-highlight-flash {
  0%   { background: var(--highlight); box-shadow: 0 0 0 0 rgba(250,204,21,0); }
  15%  { background: var(--highlight-on); box-shadow: 0 0 0 4px rgba(250,204,21,0.25); }
  60%  { background: var(--highlight-on); box-shadow: 0 0 0 4px rgba(250,204,21,0.10); }
  100% { background: var(--highlight); box-shadow: 0 0 0 0 rgba(250,204,21,0); }
}

.comment-card { cursor: pointer; }
.comment-card button, .comment-card a, .comment-card input, .comment-card textarea { cursor: auto; }
.comment-card button.btn-resolve, .comment-card button.btn-delete { cursor: pointer; }

/* ═════════════════════════════════════════════════════════════
   COMMENT RAIL
   ═════════════════════════════════════════════════════════════ */
.comment-rail {
  position: sticky;
  top: 84px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rail-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
}
.rail-card-head,
.rail-section-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.commenting-as { font-size: 14px; color: var(--text-muted); margin: 0; }
.commenting-as strong { font-weight: 600; color: var(--text); }

.link-btn,
.change-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  margin-left: 8px;
  padding: 0;
}
.link-btn:hover { color: var(--accent-hover); text-decoration: underline; }

.select-hint,
.rail-hint {
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 6px;
  line-height: 1.5;
  transition: opacity 0.3s;
}
.select-hint.hidden { opacity: 0; pointer-events: none; }

.name-card { }
#name-form .comment-form-row { display: flex; gap: 8px; align-items: center; }
#name-form input[type="text"] {
  flex: 1;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-sm);
  min-width: 0;
}
#name-form input[type="text"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#name-form button {
  font-size: 13px;
  font-weight: 550;
  padding: 8px 14px;
  background: var(--text);
  color: #fff;
  border: 1px solid var(--text);
  border-radius: var(--r-sm);
  cursor: pointer;
}
#name-form button:hover { background: #000; }

#comments-list { display: flex; flex-direction: column; gap: 10px; }

/* comment cards (class names locked by JS) */
.comment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 14px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.comment-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.comment-card.is-resolved { opacity: 0.6; }
.comment-card.is-resolved::after {
  content: "Resolved";
  position: absolute;
  top: 11px;
  right: 13px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--st-ready-fg);
  background: var(--st-ready-bg);
  padding: 2px 7px;
  border-radius: var(--r-pill);
}
.comment-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.comment-header { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; flex-wrap: wrap; }
.note-stamp,
.comment-header .avatar { width: 26px; height: 26px; border: none; }
.note-stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--text-muted);
  background: var(--bg-sunken);
  flex-shrink: 0;
  text-transform: uppercase;
}
.comment-card.is-resolved .note-stamp { color: var(--st-ready-fg); background: var(--st-ready-bg); }
.comment-author { font-weight: 600; font-size: 14px; color: var(--text); flex: 1; }
.comment-time { font-size: 12px; color: var(--text-faint); white-space: nowrap; flex-shrink: 0; }
.comment-anchor {
  font-size: 12.5px;
  color: var(--text-muted);
  border-left: 2px solid var(--border-strong);
  padding: 1px 0 1px 9px;
  margin: 4px 0 8px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.comment-body { font-size: 14px; line-height: 1.55; color: var(--text-body); white-space: pre-wrap; }
.comment-foot { display: flex; justify-content: flex-end; margin-top: 10px; }

.btn-resolve {
  font-size: 12px;
  font-weight: 550;
  background: none;
  border: 1px solid var(--border-strong);
  padding: 4px 10px;
  color: var(--text-muted);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.12s ease;
}
.btn-resolve:hover { border-color: var(--st-ready-fg); color: var(--st-ready-fg); background: var(--st-ready-bg); }

.btn-delete {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  color: var(--text-faint);
  padding: 2px 4px;
  border-radius: var(--r-sm);
  opacity: 0;
  transition: opacity 0.1s, color 0.1s, background 0.1s;
}
.comment-card:hover .btn-delete { opacity: 1; }
.btn-delete:hover { color: var(--danger); background: var(--danger-bg); }

/* popover (class names / ids locked by JS) */
.comment-popover {
  position: fixed;
  width: 340px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 16px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  box-sizing: border-box;
  animation: popover-in 0.16s ease-out;
}
.comment-popover[hidden] { display: none; }
@keyframes popover-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.popover-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 19px;
  line-height: 1;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--r-sm);
}
.popover-close:hover { color: var(--text); background: var(--bg-subtle); }

@media (max-width: 1099px) {
  .comment-popover {
    position: fixed;
    left: 0; right: 0; bottom: 0; top: auto !important;
    width: 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: none;
    box-shadow: 0 -10px 32px rgba(17,17,26,0.16);
    animation: popover-up 0.18s ease-out;
  }
  @keyframes popover-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
}

.quote-chip {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-left: 2px solid var(--border-strong);
  padding: 7px 10px;
  margin-bottom: 10px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  line-height: 1.5;
  word-wrap: break-word;
}
.quote-chip[hidden] { display: none; }

#comment-form textarea {
  width: 100%;
  font-size: 14px;
  line-height: 1.55;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-sm);
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
  margin-bottom: 10px;
  box-sizing: border-box;
}
#comment-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.comment-form-row { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.comment-form-row input[type="text"] {
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  min-width: 0;
}
.comment-form-row input[type="text"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.comment-form-row button[type="submit"] {
  font-size: 13px;
  font-weight: 550;
  padding: 9px 16px;
  background: var(--text);
  color: #fff;
  border: 1px solid var(--text);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.14s ease;
  white-space: nowrap;
}
.comment-form-row button[type="submit"]:hover { background: #000; }

/* ═════════════════════════════════════════════════════════════
   FOOTER
   ═════════════════════════════════════════════════════════════ */
.colophon {
  border-top: 1px solid var(--border);
  padding: 28px 32px;
  background: var(--bg);
}
.colophon-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  font-size: 12.5px;
  color: var(--text-faint);
}
.colophon-inner a { color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: 1px; }
.colophon-inner a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.colophon-right { text-align: right; }

/* ═════════════════════════════════════════════════════════════
   ERROR
   ═════════════════════════════════════════════════════════════ */
.error-page { text-align: center; padding: 96px 0; }
.error-code {
  font-weight: 700;
  font-size: 5rem;
  letter-spacing: -0.04em;
  color: var(--text);
  display: block;
  margin-bottom: 12px;
  line-height: 1;
}
.error-msg { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 26px; }
.error-page a { font-size: 14px; font-weight: 550; color: var(--accent); border-bottom: 1px solid currentColor; padding-bottom: 1px; }

/* ═════════════════════════════════════════════════════════════
   INVITES (legacy inline-styled template; color vars aliased)
   ═════════════════════════════════════════════════════════════ */
.space-header { margin-bottom: 28px; }
.space-header h1 { font-weight: 700; font-size: 1.6rem; letter-spacing: -0.025em; color: var(--text); }
.space-header .slug { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-faint); margin-top: 4px; }
.invites-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.invites-table th {
  text-align: left;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
}
.invites-table td { padding: 12px 0; border-bottom: 1px solid var(--border); }
.invites-table tr:last-child td { border-bottom: none; }

.empty {
  color: var(--text-faint);
  font-size: 1.0rem;
  padding: 32px 0;
}

/* ═════════════════════════════════════════════════════════════
   DASHBOARD
   ═════════════════════════════════════════════════════════════ */
.dash { max-width: 920px; margin: 0 auto; padding: 56px 32px 96px; }
.dash-narrow { max-width: 680px; }

.dash-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: end;
  margin-bottom: 32px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.dash-eyebrow {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.dash-eyebrow .rule { width: 22px; height: 1.5px; border-radius: 2px; background: var(--border-strong); }
.dash-title {
  font-weight: 700;
  font-size: clamp(1.6rem, 3.4vw, 2.1rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}
.dash-title em { font-style: normal; color: var(--accent); }
.dash-sub { color: var(--text-muted); font-size: 0.95rem; margin-top: 8px; }
.dash-sub a { color: var(--text); border-bottom: 1px solid var(--border-strong); }
.dash-sub a:hover { color: var(--accent); border-color: var(--accent); }

/* flash */
.dash-flash {
  font-size: 14px;
  padding: 12px 14px;
  margin-bottom: 24px;
  border-radius: var(--r);
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.dash-flash-ok  { background: var(--st-ready-bg); color: var(--st-ready-fg); }
.dash-flash-err { background: var(--danger-bg); color: var(--danger); }
.dash-flash code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: var(--r-sm);
}

/* table */
.dash-table { }
.dash-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 56px;
  gap: 18px;
  align-items: center;
  padding: 15px 12px;
  margin: 0 -12px;
  border-radius: var(--r);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background 0.12s ease;
}
.dash-row:hover:not(.dash-row-head) { background: var(--bg-subtle); }
.dash-row-head {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  cursor: default;
}
.dash-row-head:hover { background: transparent; }
.dash-packet { display: flex; flex-direction: column; gap: 2px; }
.dash-packet strong { font-weight: 600; font-size: 1.0rem; letter-spacing: -0.01em; color: var(--text); }
.dash-slug { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.dash-pincount { color: var(--text-muted); font-size: 0.92rem; }
.dash-time { font-size: 12.5px; color: var(--text-faint); }
.dash-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; color: var(--text-faint); }
.dash-actions .go { font-size: 1.1rem; color: var(--text-faint); }
.dash-row:hover .dash-actions .go { color: var(--text); }
.dash-settings { color: var(--text-faint); font-size: 15px; padding: 2px 4px; border-radius: var(--r-sm); }
.dash-settings:hover { color: var(--text); background: var(--bg-sunken); }

.dash-empty { text-align: center; padding: 64px 0; color: var(--text-faint); font-size: 1.0rem; }
.dash-empty p + p { margin-top: 22px; }
.dash-empty-inline { color: var(--text-faint); padding: 18px 0; }

/* claim */
.dash-claim { margin-top: 48px; border-top: 1px solid var(--border); padding-top: 22px; }
.dash-claim summary {
  font-size: 13px;
  font-weight: 550;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 0;
  list-style: none;
}
.dash-claim summary::-webkit-details-marker { display: none; }
.dash-claim summary::before { content: "▸ "; color: var(--text-faint); }
.dash-claim[open] summary::before { content: "▾ "; }
.dash-claim summary:hover { color: var(--text); }
.dash-claim-hint { font-size: 0.92rem; color: var(--text-muted); margin: 12px 0; max-width: 60ch; }
.dash-claim-hint code,
.dash-create-form code,
.dash-sub code,
.token-reveal code,
.code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: var(--r-sm);
}
.dash-claim-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.dash-claim-form label,
.dash-field,
.token-mint label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-muted);
}
.dash-claim-form input,
.dash-create-form input,
.dash-create-form textarea,
.token-mint input {
  font-size: 14px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
}
.dash-claim-form input:focus,
.dash-create-form input:focus,
.dash-create-form textarea:focus,
.token-mint input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* create form */
.dash-create-form { display: flex; flex-direction: column; gap: 18px; }
.dash-field > span:first-child { font-weight: 600; color: var(--text); }
.dash-create-form textarea {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  min-height: 240px;
}
.dash-create-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.dash-create-hint { font-size: 0.9rem; color: var(--text-faint); }

/* token reveal */
.token-reveal {
  background: var(--accent-soft);
  border: 1px solid #d6e2ff;
  border-radius: var(--r);
  padding: 16px 18px;
  margin-bottom: 28px;
}
.token-reveal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-hover);
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.token-reveal-label { font-weight: 400; color: var(--text-muted); }
.token-reveal-label em { color: var(--text); font-style: normal; font-weight: 550; }
.token-reveal-body {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  word-break: break-all;
  white-space: pre-wrap;
  margin: 0;
  color: var(--text);
}
.token-reveal-actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.token-reveal-warn { font-size: 0.88rem; color: var(--accent-hover); }

.dash-h2 { font-weight: 650; font-size: 1.25rem; letter-spacing: -0.02em; margin: 36px 0 8px; color: var(--text); }

.token-mint { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; margin: 16px 0 28px; }

.token-table { }
.token-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr 1fr 90px;
  gap: 16px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.token-row-head {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}
.token-row-revoked { color: var(--text-faint); }
.token-row-revoked .token-preview code { text-decoration: line-through; }
.token-preview code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: var(--r-sm);
}
.token-row time { font-size: 12px; color: var(--text-faint); }
.token-row-actions { text-align: right; }
.token-row-actions form { margin: 0; display: inline; }
.muted { color: var(--text-faint); font-size: 12px; }

.link-danger {
  background: none;
  border: 1px solid transparent;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  padding: 4px 9px;
  border-radius: var(--r-sm);
}
.link-danger:hover { border-color: var(--danger); background: var(--danger-bg); }

/* ═════════════════════════════════════════════════════════════
   RESPONSIVE
   ═════════════════════════════════════════════════════════════ */
@media (max-width: 1099px) {
  .landing-min { padding: 56px 22px 64px; }
  .dash { padding: 48px 22px 72px; }
  .dash-claim-form { grid-template-columns: 1fr; }
  .dash-row { grid-template-columns: 1fr; gap: 6px; }
  .dash-row-head { display: none; }
  .dash-actions { justify-content: flex-start; }
  .token-row { grid-template-columns: 1fr; gap: 6px; }
  .token-row-head { display: none; }
  .token-mint { grid-template-columns: 1fr; }
  .dash-head { grid-template-columns: 1fr; gap: 14px; }
  .page-pin { grid-template-columns: 1fr; gap: 32px; padding: 32px 22px 80px; max-width: 740px; }
  .comment-rail { position: static; order: 3; border-top: 1px solid var(--border); padding-top: 22px; }
  .packet-header { grid-template-columns: 1fr; }
  .circulation-row { grid-template-columns: 1fr; gap: 8px; padding: 16px 12px; }
  .circulation-row.head { display: none; }
  .circulation-row .go { display: none; }
}
@media (max-width: 720px) {
  .masthead { grid-template-columns: auto 1fr auto; padding: 11px 16px; gap: 12px; }
  .masthead-left .masthead-eyebrow { display: none; }
  .page-center { padding: 40px 18px 72px; }
  .packet { padding: 40px 18px 72px; }
  .page-pin { padding: 24px 16px 80px; }
  .landing-min { padding: 44px 18px 56px; }
  .signin-row { grid-template-columns: 1fr; }
  .colophon { padding: 24px 18px; }
  .colophon-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .colophon-right { text-align: left; }
}
