/* cms-remoir mock styles — visual scaffolding for the source-doc CMS.
   Reuses tokens from website/src/style.css so the CMS feels like a sibling
   of the Lens. Mocks are static HTML; no JS.
   ─────────────────────────────────────────────────────────────────────── */

:root {
  --bg:           #faf9f6;
  --bg-card:      #f4f0e7;
  --bg-card-hov:  #ede8db;
  --bg-elev:      #ffffff;
  --text:         #1a1a1a;
  --text-2:       #5a5a5a;
  --text-3:       #8a8a8a;
  --text-4:       #a8a3a0;
  --border:       #e6e3dd;
  --border-2:     #d4cfc3;
  --accent:       #15803d;
  --accent-2:     #166534;
  --accent-soft:  #d4e7d8;
  --accent-faint: #ecf3ee;

  --warn:         #ca8a04;
  --warn-soft:    #fef3c7;
  --warn-2:       #92400e;

  --danger:       #c2410c;
  --danger-soft:  #fde2cf;

  --serif: 'Charter', 'Iowan Old Style', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  --mono:  ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  --pane-tree: 296px;
  --topbar-h:  auto;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

code, .mono { font-family: var(--mono); font-size: 0.88em; }

/* ───── app shell ───────────────────────────────────────────── */

.cms-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: var(--pane-tree) 1fr;
  grid-template-areas:
    "topbar topbar"
    "tree   main";
  min-height: 100vh;
}

/* ───── topbar (matches Lens .site-header spacing) ────────── */

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 22px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  z-index: 10;
}

.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── app-switcher (lifted from website/src/style.css) ─── */

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-switcher {
  position: relative;
  display: inline-block;
}
.app-switcher-trigger {
  list-style: none;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-2);
  transition: background 120ms, color 120ms;
  outline: none;
}
.app-switcher-trigger::-webkit-details-marker,
.app-switcher-trigger::marker { display: none; }
.app-switcher-trigger:hover { background: var(--bg-card); color: var(--text); }
.app-switcher[open] .app-switcher-trigger { background: var(--bg-card); color: var(--text); }
.app-switcher-trigger svg { display: block; }

.app-switcher-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 360px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  padding: 6px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.app-switcher-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 10px;
  width: 10px;
  height: 10px;
  background: var(--bg);
  border-left: 1px solid var(--border-2);
  border-top: 1px solid var(--border-2);
  transform: rotate(45deg);
}

.env-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 12px;
  padding: 10px 12px;
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  align-items: baseline;
  position: relative;
}
.env-item:hover { background: var(--bg-card); text-decoration: none; }
.env-item.current { background: var(--accent-faint); }
.env-item.current::after {
  content: '●';
  position: absolute;
  right: 14px;
  top: 12px;
  color: var(--accent);
  font-size: 10px;
}
.env-item-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  grid-column: 1;
  grid-row: 1;
}
.env-item-empty-tag {
  font-family: var(--sans);
  font-size: 10px;
  font-style: italic;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.02em;
  padding: 2px 6px;
  background: var(--bg-card);
  border-radius: 99px;
  white-space: nowrap;
}
.env-item-desc {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-3);
  grid-column: 1;
  grid-row: 2;
}
.env-item-url {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}
.env-item.current .env-item-url { padding-right: 14px; }

.crumb {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.crumb .sep { color: var(--text-4); }
.crumb .leaf { color: var(--text); font-weight: 500; }

.session-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-3);
  border-right: 1px solid var(--border);
  padding-right: 18px;
  margin-right: 4px;
  white-space: nowrap;
}
.session-stat .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-4);
}
.session-stat.active .pulse { background: var(--accent); }
.session-stat .count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}
.session-stat.active .count { color: var(--accent-2); font-weight: 600; }

.btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 4px;
  border: 1px solid var(--border-2);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}
.btn:hover { background: var(--bg-card); border-color: var(--text-3); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-primary:disabled,
.btn-primary.disabled {
  background: var(--bg-card);
  color: var(--text-4);
  border-color: var(--border);
  cursor: not-allowed;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text); }
.btn-danger-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
}
.btn-danger-ghost:hover { background: var(--danger-soft); color: var(--danger); }

.btn .badge {
  background: white;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 99px;
  font-weight: 600;
}
.btn-primary.disabled .badge {
  background: var(--border);
  color: var(--text-4);
}

/* ───── file tree pane ─────────────────────────────────────── */

.tree-pane {
  grid-area: tree;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg) 0%, #f7f4ec 100%);
  overflow-y: auto;
  padding: 28px 0 60px;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
}

.tree-head {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 20px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tree-head .tree-meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  color: var(--text-4);
}

.tree-group {
  margin-bottom: 4px;
}
.tree-group > summary {
  list-style: none;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 20px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}
.tree-group > summary::-webkit-details-marker,
.tree-group > summary::marker { display: none; }
.tree-group > summary:hover { background: var(--accent-faint); }
.tree-group > summary .caret {
  color: var(--text-3);
  width: 12px;
  font-size: 10px;
  transition: transform 150ms ease;
}
.tree-group[open] > summary .caret { transform: rotate(90deg); color: var(--accent-2); }
.tree-group > summary .group-meta {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-4);
}

.tree-children { padding: 2px 0 6px; }

.tree-subgroup { margin: 2px 0; }
.tree-subgroup > summary {
  list-style: none;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 20px 4px 36px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
}
.tree-subgroup > summary::-webkit-details-marker,
.tree-subgroup > summary::marker { display: none; }
.tree-subgroup > summary:hover { background: var(--accent-faint); }
.tree-subgroup > summary .caret {
  color: var(--text-4);
  width: 10px;
  font-size: 9px;
  transition: transform 150ms ease;
}
.tree-subgroup[open] > summary .caret { transform: rotate(90deg); color: var(--accent-2); }

.tree-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 20px 4px 36px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
  text-decoration: none;
  position: relative;
}
.tree-subgroup .tree-file { padding-left: 54px; }
.tree-file:hover { background: var(--accent-faint); color: var(--text); text-decoration: none; }
.tree-file.active {
  background: var(--accent-faint);
  color: var(--text);
}
.tree-file.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}
.tree-file .name { flex: 1; }
.tree-file .pending-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  flex-shrink: 0;
}
.tree-file .pending-dot.saved {
  background: var(--accent);
}

/* ───── main viewer/editor pane ────────────────────────────── */

.main-pane {
  grid-area: main;
  padding: 56px 0 120px;
}

.doc-frame {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 56px;
}

.doc-header {
  margin-bottom: 48px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.doc-eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}
.doc-path {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}
.doc-path .leaf { color: var(--text); font-weight: 500; }
.doc-meta {
  display: flex;
  gap: 18px;
  align-items: baseline;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-3);
  margin-top: 16px;
}
.doc-meta .pill {
  font-family: var(--sans);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--bg-card);
  color: var(--text-2);
  letter-spacing: 0.02em;
}
.doc-meta .pill.modified { background: var(--warn-soft); color: var(--warn-2); font-weight: 600; }

/* ── sections (paper cards — Lens .bet pattern) ─────────── */

.section-card {
  background: var(--bg-card);
  border-radius: 4px;
  margin-bottom: 28px;
  position: relative;
  transition: background 150ms ease;
  border-left: 3px solid transparent;
}
.section-card:hover { background: var(--bg-card-hov); }
.section-card.modified {
  border-left-color: var(--warn);
  background: #faf2dc;
}
.section-card.modified:hover { background: #f5ebcc; }
.section-card.editing {
  border-left-color: var(--accent);
  background: var(--accent-faint);
}
.section-card.preamble { background: #f7f3e8; }
.section-card.preamble:hover { background: #ede8db; }

/* Section bar — borrows the Lens section-head pattern:
   sans-uppercase eyebrow on the left, meta on the right, bottom divider */
.section-bar {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 18px 26px 12px;
  border-bottom: 1px solid var(--border);
}

.section-depth {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  flex-shrink: 0;
  width: 64px;
}
.section-card.modified .section-depth { color: var(--warn-2); }
.section-card.editing  .section-depth { color: var(--accent-2); }

.section-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-pill {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 99px;
}
.section-pill.modified { background: var(--warn-soft); color: var(--warn-2); }
.section-pill.editing  { background: var(--accent-soft); color: var(--accent-2); }
.section-pill.saved    { background: var(--accent-soft); color: var(--accent-2); }

.section-actions {
  display: flex;
  gap: 4px;
}
.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}
.icon-btn:hover { background: var(--bg); color: var(--text); border-color: var(--border); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-soft); }
.icon-btn svg { display: block; width: 14px; height: 14px; }

.section-body {
  padding: 22px 26px 18px;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
}
.section-body > :first-child { margin-top: 0; }
.section-body > :last-child  { margin-bottom: 12px; }
.section-body h1,
.section-body h2,
.section-body h3 {
  font-family: var(--serif);
  margin: 0 0 12px;
  letter-spacing: -0.005em;
  font-weight: 600;
}
.section-body h1 { font-size: 26px; }
.section-body h2 { font-size: 20px; }
.section-body h3 { font-size: 16px; }
.section-body p { margin: 0 0 12px; }
.section-body ul,
.section-body ol { margin: 0 0 14px; padding-left: 22px; }
.section-body li { margin-bottom: 4px; }
.section-body code { background: var(--bg-card); padding: 1px 5px; border-radius: 3px; }
.section-body em { font-style: italic; }
.section-body strong { font-weight: 600; }
.section-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 14px;
  font-size: 13px;
}
.section-body th,
.section-body td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.section-body th {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-2);
}
.section-body td.mono { font-family: var(--mono); font-size: 12px; }
.section-body blockquote {
  margin: 0 0 14px;
  padding: 8px 14px;
  background: var(--bg-card);
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--text);
}

/* ── editor (textarea inside a section) ─────────────────── */

.section-editor {
  padding: 18px 26px 20px;
}
.section-editor label {
  display: block;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}
.section-editor .heading-input {
  width: 100%;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 9px 14px;
  color: var(--text);
  margin-bottom: 16px;
}
.section-editor .heading-input:focus { outline: none; border-color: var(--accent); }
.section-editor textarea {
  width: 100%;
  min-height: 240px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 14px 16px;
  resize: vertical;
}
.section-editor textarea:focus { outline: none; border-color: var(--accent); }
.section-editor .editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 12px;
}
.section-editor .editor-hint {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.5;
  flex: 1;
}
.section-editor .editor-hint code { background: var(--bg-card); padding: 1px 4px; border-radius: 2px; font-size: 0.9em; }
.section-editor .editor-buttons {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── modified diff strip (compact under bar) ─────────────── */

.section-mod-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 26px;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--warn-2);
  background: rgba(202, 138, 4, 0.08);
  border-bottom: 1px solid rgba(202, 138, 4, 0.18);
}
.section-mod-strip .label {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.section-mod-strip .summary {
  font-family: var(--serif);
  font-style: italic;
  color: var(--text-2);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.section-mod-strip .since {
  font-family: var(--mono);
  color: var(--text-3);
}
.section-mod-strip a.revert {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--warn-2);
  cursor: pointer;
}
.section-mod-strip a.revert:hover { text-decoration: underline; }

/* ───── placeholder / loading / error states ───────────────── */

.doc-placeholder {
  margin-top: 80px;
  text-align: center;
  color: var(--text-3);
}
.placeholder-eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 8px;
}
.placeholder-body {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--text-2);
  margin: 0;
}

.doc-loading, .doc-error, .tree-error {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  padding: 24px;
}
.doc-error, .tree-error { color: var(--danger); }

.modal.modal-narrow { max-width: 460px; }

/* ───── push modal ─────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 18, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--bg);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  width: 100%;
  max-width: 680px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head {
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-eyebrow {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 6px;
}
.modal-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}
.modal-sub {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-2);
  margin-top: 8px;
  line-height: 1.55;
}

.modal-body {
  padding: 18px 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-section {
  margin-bottom: 22px;
}
.modal-section-label {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

.filename-box {
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 12px;
  background: var(--accent-faint);
  border: 1px dashed var(--accent-soft);
  border-radius: 4px;
  color: var(--accent-2);
  word-break: break-all;
}

.push-summary {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elev);
  overflow: hidden;
}
.push-file {
  border-bottom: 1px solid var(--border);
}
.push-file:last-child { border-bottom: none; }
.push-file-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  background: #fbfaf5;
}
.push-file-head .count {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-3);
  margin-left: auto;
}
.push-file-changes {
  padding: 6px 14px 10px 32px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.push-file-changes .change {
  display: flex;
  align-items: center;
  gap: 8px;
}
.push-file-changes .change-kind {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 2px;
  font-weight: 600;
}
.push-file-changes .change-kind.edited { background: var(--warn-soft); color: var(--warn-2); }
.push-file-changes .change-kind.renamed { background: #dbeafe; color: #1e40af; }
.push-file-changes .change-leaf {
  font-family: var(--serif);
  font-style: italic;
  color: var(--text);
}

.note-textarea {
  width: 100%;
  min-height: 70px;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.55;
  background: white;
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 10px 12px;
  color: var(--text);
  resize: vertical;
}
.note-textarea:focus { outline: none; border-color: var(--accent); }

.brief-preview {
  background: #1a1a1a;
  color: #e3dfd2;
  border-radius: 4px;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 280px;
  overflow-y: auto;
}
.brief-preview .h1 { color: #f3efe6; font-weight: 600; }
.brief-preview .h2 { color: #9ad4a8; font-weight: 600; }
.brief-preview .h3 { color: #f3c98b; font-weight: 600; }
.brief-preview .diff-add { color: #9ad4a8; }
.brief-preview .diff-del { color: #f9a8a8; }
.brief-preview .muted { color: #a3a09a; }

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  background: #fbfaf5;
}
.modal-foot-info {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-3);
}
.modal-foot-actions { display: flex; gap: 8px; }

/* ───── mocks index (Lens page-title + section-head pattern) ──── */

/* topbar variant used outside the .cms-shell grid context */
.topbar-standalone { justify-content: space-between; }
.topbar-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.index-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 56px 100px;
}

.index-header { margin-bottom: 64px; }
.index-header .eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}
.index-header .page-title {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.015em;
  margin: 0 0 20px;
}
.index-header .page-lede {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  margin: 0;
  max-width: 740px;
}
.index-header .page-lede code {
  background: var(--bg-card);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.85em;
}

.index-section { margin-bottom: 56px; }

.index-section .section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 24px;
}
.index-section .section-head h2 {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0;
}
.index-section .section-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
}

.scenarios {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.scenario {
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 24px 26px 22px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background 140ms ease, border-color 140ms ease;
  position: relative;
}
.scenario:hover {
  background: var(--bg-card-hov);
  border-color: var(--border-2);
  text-decoration: none;
}
.scenario .num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-2);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.scenario h3 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}
.scenario p {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
  margin: 0;
}
.scenario p code { background: var(--bg); padding: 1px 5px; border-radius: 3px; font-size: 0.88em; }
.scenario p em { color: var(--text); }
.scenario-arrow {
  position: absolute;
  top: 22px;
  right: 24px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-3);
}
.scenario:hover .scenario-arrow { color: var(--accent-2); }

.conventions {
  margin: 0;
  padding-left: 22px;
  font-family: var(--serif);
}
.conventions li {
  font-size: 15px;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 8px;
}
.conventions li code {
  background: var(--bg-card);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.85em;
  font-family: var(--mono);
}
.conventions li em { color: var(--text-2); }

/* ───── responsive guard ───────────────────────────────────── */

@media (max-width: 900px) {
  .cms-shell {
    grid-template-columns: 220px 1fr;
  }
  .doc-frame { padding: 0 24px; }
  .scenarios { grid-template-columns: 1fr; }
}
