/*
 * members-v2.css — M40 scoped design uplift.
 *
 * Strict additive layer. Nothing here matches `*`, `body`, `html`, or any
 * existing class on the page. Every selector is prefixed with `.v2-` or
 * `.m40-` so it can only style elements created by M40+ modules.
 *
 * Design tokens are inspired by `Melbourne AI Hub/styles.css` but render
 * with the system fonts already on members.html — no font load.
 *
 * Loaded via <link rel="stylesheet" href="/js/members-v2.css?v=m40"> in
 * members.html. Removing the link reverts every M40 surface to native
 * members.html styling without touching any existing class.
 */

/* ---------------------------------------------------------------- */
/* Scoped tokens (only apply where consumed by .v2-* / .m40-* classes) */
/* ---------------------------------------------------------------- */

.v2-scope {
  --v2-bg-1: #0f141b;
  --v2-bg-2: #131a22;
  --v2-bg-3: #1a232e;
  --v2-line: rgba(255, 255, 255, 0.08);
  --v2-line-strong: rgba(255, 255, 255, 0.16);
  --v2-ink-0: #e9edf3;
  --v2-ink-1: #b6bdc7;
  --v2-ink-2: #9aa5b4;
  --v2-ink-3: #6a7583;
  --v2-mint: #6ad3b8;
  --v2-amber: #f4b740;
  --v2-purple: #a855f7;
  --v2-green: #22c55e;
  --v2-orange: #f97316;
  --v2-danger: #ff8f8f;
  --v2-radius: 8px;
  --v2-radius-sm: 6px;
  --v2-pad: 1rem;
}

/* ---------------------------------------------------------------- */
/* Primitives                                                       */
/* ---------------------------------------------------------------- */

.v2-card {
  background: var(--v2-bg-1);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  padding: 1rem 1.1rem;
  color: var(--v2-ink-1);
}

.v2-card-soft {
  background: var(--v2-bg-2);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius-sm);
  padding: 0.75rem 0.85rem;
}

.v2-kicker {
  font-family: var(--font-mono, ui-monospace, "JetBrains Mono", monospace);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--v2-ink-3);
  line-height: 1;
}

.v2-faint {
  color: var(--v2-ink-3);
}

.v2-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--v2-line);
  color: var(--v2-ink-1);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.v2-pill-mint {
  color: var(--v2-mint);
  border-color: rgba(106, 211, 184, 0.35);
  background: rgba(106, 211, 184, 0.08);
}
.v2-pill-amber {
  color: var(--v2-amber);
  border-color: rgba(244, 183, 64, 0.35);
  background: rgba(244, 183, 64, 0.08);
}
.v2-pill-purple {
  color: var(--v2-purple);
  border-color: rgba(168, 85, 247, 0.35);
  background: rgba(168, 85, 247, 0.08);
}
.v2-pill-green {
  color: var(--v2-green);
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}
.v2-pill-orange {
  color: var(--v2-orange);
  border-color: rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.08);
}

/* Progress ring + bar -------------------------------------------- */
.v2-progress {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.v2-progress-bar {
  height: 100%;
  background: var(--v2-mint);
  transition: width 0.25s ease;
}

/* Scoped tab row (used inside Learning track sections) ----------- */
.v2-tab-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.v2-tab {
  background: transparent;
  border: 1px solid var(--v2-line);
  border-radius: 999px;
  color: var(--v2-ink-2);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  transition:
    color 0.12s ease,
    border-color 0.12s ease,
    background 0.12s ease;
}
.v2-tab:hover {
  color: var(--v2-ink-0);
  border-color: var(--v2-line-strong);
}
.v2-tab.is-on {
  color: var(--v2-mint);
  border-color: rgba(106, 211, 184, 0.4);
  background: rgba(106, 211, 184, 0.06);
}

/* ---------------------------------------------------------------- */
/* M40 Learning Tracks                                              */
/* ---------------------------------------------------------------- */

.m40-tracks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.7rem;
}
.m40-track-card {
  background: var(--v2-bg-1);
  border: 1px solid var(--v2-line);
  border-left: 3px solid var(--v2-mint);
  border-radius: var(--v2-radius);
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.m40-track-card[data-color="amber"] {
  border-left-color: var(--v2-amber);
}
.m40-track-card[data-color="purple"] {
  border-left-color: var(--v2-purple);
}
.m40-track-card[data-color="green"] {
  border-left-color: var(--v2-green);
}
.m40-track-card[data-color="orange"] {
  border-left-color: var(--v2-orange);
}
.m40-track-title {
  font-weight: 600;
  color: var(--v2-ink-0);
  font-size: 0.95rem;
  line-height: 1.2;
}
.m40-track-outcome {
  color: var(--v2-ink-1);
  font-size: 0.82rem;
  line-height: 1.5;
}
.m40-track-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.m40-track-cta {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--v2-line);
  border-radius: 6px;
  color: var(--v2-ink-1);
  font-size: 0.78rem;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  transition:
    color 0.12s,
    border-color 0.12s,
    background 0.12s;
}
.m40-track-cta:hover {
  color: var(--v2-ink-0);
  border-color: var(--v2-line-strong);
  background: rgba(255, 255, 255, 0.03);
}
.m40-track-cta.is-on {
  color: var(--v2-mint);
  border-color: rgba(106, 211, 184, 0.4);
  background: rgba(106, 211, 184, 0.06);
}

/* Track detail expand panel -------------------------------------- */
.m40-track-detail {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--v2-line);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

/* Quiz question card --------------------------------------------- */
.m40-quiz {
  background: var(--v2-bg-2);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius-sm);
  padding: 0.8rem 0.9rem;
}
.m40-quiz-q {
  color: var(--v2-ink-0);
  font-size: 0.86rem;
  line-height: 1.5;
  margin-bottom: 0.6rem;
}
.m40-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.m40-quiz-option {
  background: transparent;
  border: 1px solid var(--v2-line);
  border-radius: 6px;
  color: var(--v2-ink-1);
  text-align: left;
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
  line-height: 1.45;
  cursor: pointer;
  transition:
    color 0.12s,
    border-color 0.12s,
    background 0.12s;
}
.m40-quiz-option:hover:not(:disabled) {
  color: var(--v2-ink-0);
  border-color: var(--v2-line-strong);
}
.m40-quiz-option.is-correct {
  border-color: rgba(106, 211, 184, 0.5);
  background: rgba(106, 211, 184, 0.06);
  color: var(--v2-mint);
}
.m40-quiz-option.is-incorrect {
  border-color: rgba(255, 143, 143, 0.45);
  background: rgba(255, 143, 143, 0.05);
  color: var(--v2-danger);
}
.m40-quiz-option.is-skipped {
  border-color: rgba(154, 165, 180, 0.35);
  background: rgba(154, 165, 180, 0.04);
  color: var(--v2-ink-2);
  font-style: italic;
}
.m40-quiz-option:disabled {
  cursor: default;
  opacity: 0.95;
}
.m40-quiz-explanation {
  margin-top: 0.6rem;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.02);
  border-left: 2px solid var(--v2-mint);
  border-radius: 4px;
  color: var(--v2-ink-1);
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* Lesson card ---------------------------------------------------- */
.m40-lesson {
  background: var(--v2-bg-2);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius-sm);
  padding: 0.8rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.m40-lesson-title {
  color: var(--v2-ink-0);
  font-weight: 600;
  font-size: 0.86rem;
  line-height: 1.35;
}
.m40-lesson-body {
  color: var(--v2-ink-1);
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.m40-lesson-take {
  color: var(--v2-mint);
  font-size: 0.74rem;
  line-height: 1.45;
  border-left: 2px solid rgba(106, 211, 184, 0.45);
  padding-left: 0.55rem;
}
.m40-lesson-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.m40-lesson.is-read {
  border-color: rgba(106, 211, 184, 0.3);
}

/* Flip card ------------------------------------------------------ */
.m40-flip {
  background: var(--v2-bg-3);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius-sm);
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  cursor: pointer;
  transition:
    border-color 0.12s,
    background 0.12s;
}
.m40-flip:hover {
  border-color: var(--v2-line-strong);
  background: rgba(255, 255, 255, 0.02);
}
.m40-flip-term {
  font-weight: 600;
  color: var(--v2-ink-0);
  font-size: 0.84rem;
}
.m40-flip-def {
  color: var(--v2-ink-1);
  font-size: 0.78rem;
  line-height: 1.5;
}
.m40-flip.is-collapsed .m40-flip-def {
  display: none;
}
.m40-flip.is-seen {
  border-color: rgba(106, 211, 184, 0.35);
}
.m40-flip.is-seen .m40-flip-term {
  color: var(--v2-mint);
}

/* Status / sign-in banner ---------------------------------------- */
.m40-banner {
  padding: 0.65rem 0.8rem;
  border-radius: var(--v2-radius-sm);
  font-size: 0.78rem;
  line-height: 1.5;
}
.m40-banner-info {
  background: rgba(106, 211, 184, 0.05);
  border: 1px solid rgba(106, 211, 184, 0.25);
  color: var(--v2-ink-1);
}
.m40-banner-warn {
  background: rgba(244, 183, 64, 0.05);
  border: 1px solid rgba(244, 183, 64, 0.3);
  color: var(--v2-amber);
}
.m40-banner-error {
  background: rgba(255, 143, 143, 0.05);
  border: 1px solid rgba(255, 143, 143, 0.3);
  color: var(--v2-danger);
}
.m40-banner code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.74rem;
  color: var(--v2-ink-0);
}

/* Section heading inside the tracks panel ------------------------ */
.m40-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.m40-section-head h3 {
  margin: 0;
  color: var(--v2-ink-0);
  font-size: 0.95rem;
  font-weight: 600;
}
.m40-section-head h4 {
  margin: 0;
  color: var(--v2-ink-0);
  font-size: 0.86rem;
  font-weight: 600;
}

/* ---------------------------------------------------------------- */
/* M40C Founder Ops · Release Lab                                   */
/* All selectors are .m40-rl-* — strictly additive, founder-only by */
/* placement (rendered inside #panel-founder-ops). No overrides of  */
/* existing classes; no global selectors.                           */
/* ---------------------------------------------------------------- */

.m40-rl-concepts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.8rem;
}
.m40-rl-concept {
  background: var(--v2-bg-1);
  border: 1px solid var(--v2-line);
  border-left: 3px solid var(--v2-purple);
  border-radius: var(--v2-radius);
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.m40-rl-concept-title {
  margin: 0;
  color: var(--v2-ink-0);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
}
.m40-rl-concept-summary {
  margin: 0;
  color: var(--v2-ink-1);
  font-size: 0.8rem;
  line-height: 1.55;
}
.m40-rl-concept-stage {
  background: var(--v2-bg-2);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius-sm);
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.m40-rl-concept-headline {
  color: var(--v2-ink-0);
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.35;
}
.m40-rl-concept-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}
.m40-rl-concept-stat {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}
.m40-rl-concept-stat-value {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 1rem;
  font-weight: 700;
  color: var(--v2-ink-0);
  line-height: 1;
}
.m40-rl-concept-stat.is-flag .m40-rl-concept-stat-value {
  color: var(--v2-amber);
}
.m40-rl-concept-countdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}
.m40-rl-concept-countdown-cell {
  background: var(--v2-bg-3);
  border: 1px solid var(--v2-line);
  border-radius: 4px;
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  align-items: center;
}
.m40-rl-concept-countdown-num {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--v2-ink-0);
}
.m40-rl-concept-roster,
.m40-rl-concept-ledger {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.m40-rl-concept-row,
.m40-rl-concept-ledger-row {
  display: grid;
  grid-template-columns: 56px 100px 1fr;
  gap: 0.4rem;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--v2-ink-1);
}
.m40-rl-concept-row-t,
.m40-rl-concept-ledger-t {
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--v2-ink-3);
}
.m40-rl-concept-row-who,
.m40-rl-concept-ledger-who {
  color: var(--v2-ink-0);
}
.m40-rl-concept-ledger-row.is-clinical .m40-rl-concept-ledger-who,
.m40-rl-concept-ledger-row.is-clinical .m40-rl-concept-ledger-what {
  color: var(--v2-amber);
}
.m40-rl-concept-editors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
.m40-rl-concept-editor {
  background: var(--v2-bg-3);
  border: 1px solid var(--v2-line);
  border-radius: 4px;
  padding: 0.55rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.m40-rl-concept-editor-name {
  color: var(--v2-ink-0);
  font-weight: 600;
  font-size: 0.78rem;
}
.m40-rl-concept-editor-bio {
  color: var(--v2-ink-1);
  font-size: 0.72rem;
  line-height: 1.45;
}
.m40-rl-concept-editor-coi {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.7rem;
}
.m40-rl-concept-nos {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.m40-rl-concept-no-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 0.5rem;
  align-items: baseline;
}
.m40-rl-concept-no-mark {
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--v2-danger);
  font-size: 1rem;
  line-height: 1;
}
.m40-rl-concept-no-h {
  color: var(--v2-ink-0);
  font-size: 0.8rem;
  font-weight: 600;
}
.m40-rl-concept-code {
  margin: 0;
  background: var(--v2-bg-3);
  border: 1px solid var(--v2-line);
  border-radius: 4px;
  padding: 0.6rem 0.75rem;
  font-family: var(--font-mono, ui-monospace, "JetBrains Mono", monospace);
  font-size: 0.7rem;
  line-height: 1.55;
  color: var(--v2-ink-1);
  overflow-x: auto;
  white-space: pre;
}

/* Idea form ------------------------------------------------------ */
.m40-rl-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.55rem;
  background: var(--v2-bg-2);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius-sm);
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.7rem;
}
.m40-rl-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.m40-rl-field:last-of-type {
  grid-column: 1 / -1;
}
.m40-rl-input,
.m40-rl-textarea,
.m40-rl-select {
  background: var(--v2-bg-3);
  border: 1px solid var(--v2-line);
  border-radius: 4px;
  color: var(--v2-ink-0);
  padding: 0.42rem 0.55rem;
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1.45;
}
.m40-rl-textarea {
  min-height: 3.5rem;
  resize: vertical;
}
.m40-rl-input:focus,
.m40-rl-textarea:focus,
.m40-rl-select:focus {
  outline: none;
  border-color: rgba(106, 211, 184, 0.5);
  background: var(--v2-bg-2);
}
.m40-rl-form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Idea list ------------------------------------------------------ */
.m40-rl-idea-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.m40-rl-idea {
  background: var(--v2-bg-1);
  border: 1px solid var(--v2-line);
  border-left: 3px solid var(--v2-amber);
  border-radius: var(--v2-radius-sm);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.m40-rl-idea-head {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: space-between;
}
.m40-rl-idea-title {
  margin: 0;
  color: var(--v2-ink-0);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
}
.m40-rl-idea-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.m40-rl-idea-body {
  margin: 0;
  color: var(--v2-ink-1);
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.m40-rl-idea-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* Discussion ----------------------------------------------------- */
.m40-rl-thread {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.m40-rl-comment {
  background: var(--v2-bg-2);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius-sm);
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.m40-rl-comment[data-depth="1"] {
  background: var(--v2-bg-3);
}
.m40-rl-comment-head {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  flex-wrap: wrap;
}
.m40-rl-comment-author {
  color: var(--v2-ink-0);
  font-weight: 600;
  font-size: 0.78rem;
}
.m40-rl-comment-body {
  margin: 0;
  color: var(--v2-ink-1);
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.m40-rl-comment-reply {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--v2-line);
  border-radius: 4px;
  color: var(--v2-ink-2);
  font-size: 0.7rem;
  padding: 0.22rem 0.55rem;
  cursor: pointer;
  transition:
    color 0.12s,
    border-color 0.12s;
}
.m40-rl-comment-reply:hover {
  color: var(--v2-ink-0);
  border-color: var(--v2-line-strong);
}
.m40-rl-comment-replies {
  margin-top: 0.45rem;
  padding-left: 0.8rem;
  border-left: 1px dashed var(--v2-line);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.m40-rl-composer {
  margin-top: 0.7rem;
  background: var(--v2-bg-2);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius-sm);
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.m40-rl-composer-head {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.m40-rl-seed-title {
  color: var(--v2-ink-0);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

/* ---------------------------------------------------------------- */
/* M40F · Editorial shell uplift                                    */
/* All selectors gated on `.m40f-shell` so removing the class fully */
/* reverts the page to its pre-M40F look. Selectors prefixed with   */
/* `.m40f-` are scoped component classes; nested-class selectors    */
/* like `.m40f-shell .side-nav` only apply once the shell is on.    */
/* No global *, body, or html selectors.                            */
/* ---------------------------------------------------------------- */

.m40f-shell {
  --m40f-bg-0: oklch(0.145 0.012 200);
  --m40f-bg-1: oklch(0.18 0.013 200);
  --m40f-bg-2: oklch(0.215 0.014 200);
  --m40f-bg-3: oklch(0.26 0.014 200);
  --m40f-line: oklch(0.3 0.012 200 / 0.55);
  --m40f-line-strong: oklch(0.4 0.014 200 / 0.7);
  --m40f-ink-0: oklch(0.96 0.005 200);
  --m40f-ink-1: oklch(0.78 0.008 200);
  --m40f-ink-2: oklch(0.6 0.01 200);
  --m40f-ink-3: oklch(0.45 0.012 200);
  --m40f-mint: oklch(0.85 0.14 170);
  --m40f-warm: oklch(0.78 0.14 70);
  --m40f-danger: oklch(0.7 0.2 25);
  --m40f-rail-w: 320px;
}

/* Side-nav editorial restyle ------------------------------------ */
.m40f-shell .side-nav {
  background: var(--m40f-bg-0);
  border-right: 1px solid var(--m40f-line);
}
.m40f-shell .side-nav-section {
  font-family: var(--font-mono, ui-monospace, "JetBrains Mono", monospace);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--m40f-ink-3);
  padding-top: 0.9rem;
  padding-bottom: 0.35rem;
}
.m40f-shell .side-nav-item {
  font-family: var(--font-mono, ui-monospace, "JetBrains Mono", monospace);
  color: var(--m40f-ink-1);
}
.m40f-shell .side-nav-item:hover {
  color: var(--m40f-ink-0);
  background: var(--m40f-bg-2);
}
.m40f-shell .side-nav-item.active {
  color: var(--m40f-mint);
  background: color-mix(in oklab, var(--m40f-mint) 10%, transparent);
}
.m40f-shell .side-nav-profile {
  border-bottom: 1px solid var(--m40f-line);
}
.m40f-shell .side-nav-footer {
  border-top: 1px solid var(--m40f-line);
}

/* Top-bar editorial restyle ------------------------------------- */
.m40f-shell .top-bar {
  background: var(--m40f-bg-0);
  border-bottom: 1px solid var(--m40f-line);
}
.m40f-shell .top-bar-name {
  color: var(--m40f-ink-0);
}
.m40f-shell .top-bar-role {
  color: var(--m40f-ink-3);
  font-family: var(--font-mono, ui-monospace, monospace);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10.5px;
}

/* Topbar status atoms (injected by members-shell-v2.js) --------- */
.m40f-topbar-stats {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-right: 0.6rem;
  flex-wrap: wrap;
}
.m40f-topbar-kicker {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--m40f-ink-3);
}
.m40f-topbar-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--m40f-ink-2);
}
.m40f-topbar-stat-label {
  color: var(--m40f-mint);
}
.m40f-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--m40f-mint);
  box-shadow: 0 0 6px color-mix(in oklab, var(--m40f-mint) 70%, transparent);
}
.m40f-topbar-search {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--m40f-bg-2);
  border: 1px solid var(--m40f-line);
  border-radius: 4px;
  color: var(--m40f-ink-2);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11.5px;
  padding: 0.32rem 0.6rem;
  cursor: default;
  transition:
    border-color 0.12s,
    color 0.12s;
}
.m40f-topbar-search:hover {
  color: var(--m40f-ink-0);
  border-color: var(--m40f-line-strong);
}
.m40f-topbar-search-label {
  color: var(--m40f-ink-3);
}

/* M40L · Ledger toggle chip in the topbar (primary affordance).
   Synced with the side pill (.m40g-ledger-toggle) — same toggleLedger()
   handler. Hidden below 1180px because the rail itself is hidden there. */
.m40f-topbar-ledger-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(106, 211, 184, 0.08);
  border: 1px solid rgba(106, 211, 184, 0.4);
  border-radius: 4px;
  color: rgba(106, 211, 184, 0.95);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.32rem 0.7rem;
  cursor: pointer;
  transition:
    background 0.14s,
    border-color 0.14s,
    color 0.14s,
    transform 0.12s;
}
.m40f-topbar-ledger-toggle:hover {
  background: rgba(106, 211, 184, 0.18);
  border-color: rgba(106, 211, 184, 0.7);
  color: #ffffff;
  transform: translateY(-1px);
}
.m40f-topbar-ledger-toggle:focus-visible {
  outline: 2px solid rgba(106, 211, 184, 0.7);
  outline-offset: 1px;
}
.m40f-topbar-ledger-toggle-glyph {
  font-size: 14px;
  line-height: 1;
  font-family: ui-monospace, monospace;
}
.m40f-topbar-ledger-toggle-label {
  font-weight: 600;
}
@media (max-width: 1179px) {
  .m40f-topbar-ledger-toggle {
    display: none;
  }
}

.m40f-kbd {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  background: var(--m40f-bg-3);
  border: 1px solid var(--m40f-line);
  border-radius: 3px;
  padding: 0.05rem 0.32rem;
  color: var(--m40f-ink-1);
}
.m40f-kicker {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--m40f-ink-3);
}

/* Open Ledger rail (fixed position, desktop only) ---------------- */
.m40f-ledger-rail {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--m40f-rail-w);
  background: var(--m40f-bg-0);
  border-left: 1px solid var(--m40f-line);
  flex-direction: column;
  z-index: 4;
  overflow-y: auto;
}
.m40f-ledger-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 0.95rem 0.5rem;
  border-bottom: 1px solid var(--m40f-line);
}
.m40f-ledger-live {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--m40f-mint);
}
.m40f-ledger-note {
  margin: 0;
  padding: 0.55rem 0.95rem;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--m40f-ink-3);
  border-bottom: 1px dashed var(--m40f-line);
  font-style: italic;
}
.m40f-ledger-tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-bottom: 1px solid var(--m40f-line);
  flex-wrap: wrap;
}
.m40f-ledger-tab {
  background: transparent;
  border: 1px solid var(--m40f-line);
  border-radius: 999px;
  color: var(--m40f-ink-2);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.18rem 0.65rem;
  cursor: pointer;
  transition:
    color 0.12s,
    border-color 0.12s,
    background 0.12s;
}
.m40f-ledger-tab:hover {
  color: var(--m40f-ink-0);
  border-color: var(--m40f-line-strong);
}
.m40f-ledger-tab.is-on {
  color: var(--m40f-mint);
  border-color: color-mix(in oklab, var(--m40f-mint) 50%, var(--m40f-line));
  background: color-mix(in oklab, var(--m40f-mint) 8%, transparent);
}
.m40f-ledger-body {
  flex: 1 1 auto;
  padding: 0.55rem 0.95rem 1rem;
}
.m40f-ledger-day {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--m40f-ink-3);
  margin: 0.65rem 0 0.35rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px dashed var(--m40f-line);
}
.m40f-ledger-day-count {
  color: var(--m40f-ink-3);
}
.m40f-ledger-day-foot {
  border-bottom: 0;
  border-top: 1px dashed var(--m40f-line);
  margin-top: 1.1rem;
  padding-top: 0.4rem;
}
.m40f-ledger-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid
    color-mix(in oklab, var(--m40f-line) 50%, transparent);
}
.m40f-ledger-row:last-of-type {
  border-bottom: 0;
}
.m40f-ledger-t {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  color: var(--m40f-ink-3);
  letter-spacing: 0.06em;
}
.m40f-ledger-entry-body {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--m40f-ink-1);
}
.m40f-ledger-who {
  color: var(--m40f-ink-0);
  font-weight: 600;
}
.m40f-ledger-row.is-warm .m40f-ledger-who,
.m40f-ledger-row.is-warm .m40f-ledger-what {
  color: var(--m40f-warm);
}

/* Desktop: show rail + reserve right space on the main column.
   Hidden on tablets/mobile where the existing top-bar layout owns
   the screen width. */
@media (min-width: 1180px) {
  .m40f-shell .m40f-ledger-rail {
    display: flex;
  }
  .m40f-shell .main-col {
    padding-right: var(--m40f-rail-w);
  }
}
@media (max-width: 1179px) {
  .m40f-shell .m40f-ledger-rail {
    display: none;
  }
}

/* M40F · Members & Skills directory ----------------------------- */
/* When the editorial shell is on, the dense directory takes the */
/* primary visual position. Legacy #skillsGrid stays in markup so */
/* turning the shell off restores the original card layout. */
.m40f-shell #skillsGrid {
  display: none;
}

.m40f-directory {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-top: 1.2rem;
}
.m40f-directory-hero {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.1));
}
.m40f-directory-h2 {
  margin: 0;
  font-family: var(--font-serif, "Source Serif 4", Georgia, serif);
  font-size: 2rem;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--m40f-ink-0, #e9edf3);
}
.m40f-directory-deck {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--m40f-ink-1, #b6bdc7);
  max-width: 60ch;
}
.m40f-directory-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
}
.m40f-directory-stat {
  background: var(--m40f-bg-2, #131a22);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.m40f-directory-stat-value {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--m40f-ink-0, #e9edf3);
  line-height: 1;
}
.m40f-directory-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.m40f-directory-actions {
  display: flex;
  gap: 0.4rem;
}
.m40f-directory-cta {
  background: transparent;
  border: 1px solid var(--m40f-line-strong, rgba(255, 255, 255, 0.16));
  border-radius: 4px;
  color: var(--m40f-ink-1, #b6bdc7);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 0.42rem 0.9rem;
  cursor: pointer;
  transition:
    color 0.12s,
    background 0.12s,
    border-color 0.12s;
}
.m40f-directory-cta:hover:not(:disabled) {
  color: var(--m40f-ink-0, #e9edf3);
  background: var(--m40f-bg-3, #1a232e);
}
.m40f-directory-cta:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.m40f-directory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.m40f-directory-table thead th {
  text-align: left;
  padding: 0.55rem 0.7rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--m40f-ink-3, #6a7583);
  border-bottom: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.1));
}
.m40f-directory-table tbody td {
  padding: 0.7rem;
  border-bottom: 1px solid
    color-mix(
      in oklab,
      var(--m40f-line, rgba(255, 255, 255, 0.1)) 60%,
      transparent
    );
  vertical-align: top;
  color: var(--m40f-ink-1, #b6bdc7);
}
.m40f-directory-row:hover {
  background: var(--m40f-bg-2, #131a22);
}
.m40f-directory-name-cell {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  min-width: 220px;
}
.m40f-directory-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--m40f-bg-3, #1a232e);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.1));
  color: var(--m40f-mint, #6ad3b8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 700;
  font-size: 0.74rem;
  flex-shrink: 0;
  overflow: hidden;
}
.m40f-directory-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.m40f-directory-name {
  font-weight: 600;
  color: var(--m40f-ink-0, #e9edf3);
  font-size: 0.86rem;
  line-height: 1.3;
}
.m40f-directory-sub {
  font-size: 0.72rem;
  color: var(--m40f-ink-3, #6a7583);
  margin-top: 0.1rem;
}
.m40f-directory-role-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.1));
  background: var(--m40f-bg-2, #131a22);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--m40f-ink-1, #b6bdc7);
}
.m40f-directory-role-pill.is-founder {
  color: var(--m40f-warm, #f4b740);
  border-color: color-mix(
    in oklab,
    var(--m40f-warm, #f4b740) 40%,
    var(--m40f-line, rgba(255, 255, 255, 0.1))
  );
  background: color-mix(in oklab, var(--m40f-warm, #f4b740) 10%, transparent);
}
.m40f-directory-focus {
  font-size: 0.78rem;
  line-height: 1.5;
  max-width: 28ch;
}
.m40f-directory-skills-cell {
  max-width: 32ch;
}
.m40f-directory-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.m40f-directory-chip,
.m40f-directory-chip-more {
  display: inline-flex;
  padding: 0.12rem 0.45rem;
  border-radius: 2px;
  background: color-mix(in oklab, var(--m40f-mint, #6ad3b8) 12%, transparent);
  border: 1px solid
    color-mix(in oklab, var(--m40f-mint, #6ad3b8) 32%, transparent);
  color: var(--m40f-mint, #6ad3b8);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.m40f-directory-chip-more {
  color: var(--m40f-ink-3, #6a7583);
  background: transparent;
  border-color: var(--m40f-line, rgba(255, 255, 255, 0.1));
}
.m40f-directory-no-skills {
  color: var(--m40f-ink-3, #6a7583);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}
.m40f-directory-state {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--m40f-ink-2, #9aa5b4);
}
.m40f-directory-empty {
  text-align: center;
  padding: 1.2rem;
  color: var(--m40f-ink-3, #6a7583);
}

/* M40J · Release Lab — stacked layout: catalogue + comments at top,    */
/* artifact gets full horizontal width below. Reverts to the original   */
/* 3-pane grid only when no concept is selected (so the layout can      */
/* shrink to fit everything when there's nothing to render).            */
.m40-rl-shell {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "left"
    "right"
    "center";
  gap: 0.85rem;
  align-items: stretch;
  margin-top: 0.8rem;
}
.m40-rl-pane {
  background: var(--v2-bg-1);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 0;
}
.m40-rl-pane-left {
  grid-area: left;
  background: var(--v2-bg-2);
  /* Backlog as a horizontal timeline rail */
  flex-direction: column;
  gap: 0.5rem;
  max-height: 280px;
}
.m40-rl-pane-right {
  grid-area: right;
  background: var(--v2-bg-2);
  max-height: 240px;
  overflow-y: auto;
}
.m40-rl-pane-center {
  grid-area: center;
  min-height: 540px;
}
/* Backlog list flows horizontally as a scrolling timeline. */
.m40-rl-pane-left .m40-rl-backlog-list {
  flex-direction: row !important;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  gap: 0.5rem;
  padding-bottom: 0.3rem;
}
.m40-rl-pane-left .m40-rl-backlog-list .m40-rl-backlog-item {
  flex: 0 0 auto;
  width: 220px;
  min-height: 78px;
}
.m40-rl-pane-left .m40-rl-backlog-head {
  border-bottom: 0;
  padding-bottom: 0.2rem;
}
.m40-rl-pane-left .m40-rl-backlog-new {
  align-self: flex-start;
  flex: 0 0 auto;
  margin-top: 0.2rem;
}
@media (max-width: 800px) {
  .m40-rl-pane-left {
    max-height: 240px;
  }
  .m40-rl-pane-left .m40-rl-backlog-list .m40-rl-backlog-item {
    width: 180px;
  }
}
.m40-rl-backlog-head {
  border-bottom: 1px dashed var(--v2-line);
  padding-bottom: 0.4rem;
}
.m40-rl-backlog-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.m40-rl-backlog-item {
  text-align: left;
  background: transparent;
  border: 1px solid var(--v2-line);
  border-radius: 6px;
  color: var(--v2-ink-1);
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  transition:
    color 0.12s,
    background 0.12s,
    border-color 0.12s;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}
.m40-rl-backlog-item:hover {
  background: var(--v2-bg-3);
  color: var(--v2-ink-0);
  border-color: var(--v2-line-strong);
}
.m40-rl-backlog-item.is-on {
  border-color: rgba(106, 211, 184, 0.45);
  background: rgba(106, 211, 184, 0.08);
  color: var(--v2-ink-0);
}
.m40-rl-backlog-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
}
.m40-rl-backlog-item-sub {
  font-size: 0.7rem;
  color: var(--v2-ink-3);
  line-height: 1.4;
}
.m40-rl-backlog-empty {
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 0.5rem 0;
}
.m40-rl-backlog-new {
  margin-top: auto;
  background: transparent;
  border: 1px dashed var(--v2-line-strong);
  border-radius: 6px;
  color: var(--v2-ink-1);
  padding: 0.55rem 0.7rem;
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition:
    color 0.12s,
    background 0.12s,
    border-color 0.12s;
}
.m40-rl-backlog-new:hover {
  color: var(--v2-ink-0);
  background: var(--v2-bg-3);
  border-color: var(--v2-line-strong);
}

/* Detail (centre pane) ------------------------------------------ */
.m40-rl-detail {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.m40-rl-detail-head {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-bottom: 1px dashed var(--v2-line);
  padding-bottom: 0.6rem;
}
.m40-rl-detail-title {
  margin: 0;
  font-family: var(--font-serif, "Source Serif 4", Georgia, serif);
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--v2-ink-0);
}
.m40-rl-detail-summary {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--v2-ink-1);
}
.m40-rl-detail-notes {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--v2-ink-1);
}
.m40-rl-tab-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--v2-line);
  padding-bottom: 0.5rem;
}
.m40-rl-tab {
  background: transparent;
  border: 1px solid var(--v2-line);
  border-radius: 999px;
  color: var(--v2-ink-2);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
  transition:
    color 0.12s,
    border-color 0.12s,
    background 0.12s;
}
.m40-rl-tab:hover {
  color: var(--v2-ink-0);
  border-color: var(--v2-line-strong);
}
.m40-rl-tab.is-on {
  color: var(--v2-mint);
  border-color: rgba(106, 211, 184, 0.45);
  background: rgba(106, 211, 184, 0.08);
}
.m40-rl-tab-body {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

/* Decision checklist + likes + CTA row -------------------------- */
.m40-rl-decision {
  background: var(--v2-bg-2);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius-sm);
  padding: 0.8rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.m40-rl-decision-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--v2-ink-1);
  padding: 0.32rem 0.4rem;
  border-radius: 4px;
}
.m40-rl-decision-row:hover {
  background: var(--v2-bg-3);
}
.m40-rl-decision-row.is-on {
  color: var(--v2-mint);
}
.m40-rl-decision-label {
  line-height: 1.4;
}

.m40-rl-cta-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--v2-line);
}
.m40-rl-like {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--v2-line);
  color: var(--v2-ink-2);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition:
    color 0.12s,
    border-color 0.12s,
    background 0.12s;
}
.m40-rl-like:hover {
  color: var(--v2-ink-0);
  border-color: var(--v2-line-strong);
}
.m40-rl-like.is-on {
  color: var(--v2-amber);
  border-color: rgba(244, 183, 64, 0.45);
  background: rgba(244, 183, 64, 0.08);
}
.m40-rl-like-icon {
  font-size: 0.86rem;
  line-height: 1;
}
.m40-rl-like-count {
  font-variant-numeric: tabular-nums;
  color: var(--v2-ink-3);
}
.m40-rl-like.is-on .m40-rl-like-count {
  color: var(--v2-amber);
}
.m40-rl-form-context {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.7rem;
  background: var(--v2-bg-2);
  border: 1px dashed var(--v2-line);
  border-radius: 4px;
  grid-column: 1 / -1;
}
.m40-rl-form-context-id {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.72rem;
  color: var(--v2-mint);
}
.m40-rl-cancel {
  background: transparent;
  border: 1px solid var(--v2-line);
  border-radius: 4px;
  color: var(--v2-ink-2);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.42rem 0.85rem;
  cursor: pointer;
}
.m40-rl-cancel:hover {
  color: var(--v2-ink-0);
  border-color: var(--v2-line-strong);
}

/* Public Page Uplift preview pieces ----------------------------- */
.m40-rl-concept-masthead {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--v2-line);
}
.m40-rl-concept-masthead-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--v2-ink-3);
}
.m40-rl-concept-masthead-line .dim {
  color: var(--v2-ink-3);
}
.m40-rl-concept-masthead-line .live {
  color: var(--v2-mint);
  margin-left: auto;
}
.m40-rl-concept-masthead-title {
  font-family: var(--font-serif, "Source Serif 4", Georgia, serif);
  font-size: 2rem;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--v2-ink-0);
}
.m40-rl-concept-masthead-title b {
  font-weight: 700;
}
.m40-rl-concept-masthead-strap {
  font-size: 0.78rem;
  color: var(--v2-ink-2);
  font-style: italic;
}
.m40-rl-concept-headline-serif {
  font-family: var(--font-serif, "Source Serif 4", Georgia, serif);
  font-size: 1.7rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--v2-ink-0);
}
.m40-rl-concept-deck {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--v2-ink-1);
  max-width: 60ch;
}
.m40-rl-concept-ticker {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0.7rem;
  background: var(--v2-bg-2);
  border: 1px solid var(--v2-line);
  border-radius: 4px;
}
.m40-rl-concept-ticker-rail {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.74rem;
  color: var(--v2-ink-1);
  font-family: var(--font-mono, ui-monospace, monospace);
}
.m40-rl-concept-pubnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.3rem;
  border-top: 1px dashed var(--v2-line);
}
.m40-rl-concept-pubnav-item {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--v2-ink-2);
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--v2-line);
  border-radius: 3px;
}
.m40-rl-concept-pubnav-item.is-on {
  color: var(--v2-mint);
  border-color: rgba(106, 211, 184, 0.4);
  background: rgba(106, 211, 184, 0.06);
}

/* Discussion pane head ------------------------------------------ */
.m40-rl-discussion-head {
  border-bottom: 1px dashed var(--v2-line);
  padding-bottom: 0.4rem;
}

/* ---------------------------------------------------------------- */
/* M40G · Open Ledger real-source rendering                         */
/* The rail itself uses .m40f-* classes; per-source pills, error    */
/* rows, and empty/loading states are scoped under .m40g-*.         */
/* ---------------------------------------------------------------- */
.m40g-ledger-source-pill {
  display: inline-block;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  border: 1px solid var(--m40f-line);
  color: var(--m40f-ink-2);
  margin-right: 0.3rem;
  vertical-align: middle;
}
.m40g-ledger-source-pill[data-source="drafts"] {
  color: var(--m40f-warm);
  border-color: color-mix(in oklab, var(--m40f-warm) 40%, var(--m40f-line));
}
.m40g-ledger-source-pill[data-source="projects"] {
  color: var(--m40f-mint);
  border-color: color-mix(in oklab, var(--m40f-mint) 40%, var(--m40f-line));
}
.m40g-ledger-source-pill[data-source="comments"] {
  color: oklch(0.78 0.12 240);
  border-color: color-mix(in oklab, oklch(0.78 0.12 240) 40%, var(--m40f-line));
}
.m40g-ledger-source-pill[data-source="members"] {
  color: oklch(0.78 0.14 320);
  border-color: color-mix(in oklab, oklch(0.78 0.14 320) 40%, var(--m40f-line));
}
/* M40P: signup events get a celebratory mint pill with a soft glow so they
   visually pop in the ledger rail. Same hue family as projects, slightly
   warmer + brighter, with a subtle box-shadow to read as "fresh". */
.m40g-ledger-source-pill[data-source="signups"] {
  color: var(--m40f-mint);
  border-color: color-mix(in oklab, var(--m40f-mint) 60%, var(--m40f-line));
  background: color-mix(in oklab, var(--m40f-mint) 14%, transparent);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--m40f-mint) 22%, transparent);
}
.m40f-ledger-row[data-source="signups"] .m40f-ledger-who {
  font-weight: 600;
}
.m40f-ledger-row.m40g-ledger-row-error {
  opacity: 0.78;
}
.m40f-ledger-row.m40g-ledger-row-error .m40f-ledger-what {
  color: var(--m40f-ink-3);
  font-style: italic;
}
.m40g-ledger-sub {
  display: block;
  font-size: 10.5px;
  color: var(--m40f-ink-3);
  margin-top: 0.18rem;
}
.m40f-ledger-empty {
  padding: 0.7rem 0.2rem;
  font-size: 11.5px;
  color: var(--m40f-ink-3);
  font-style: italic;
}
/* Live pill states (driven by data-state) */
#m40g-ledger-live-pill[data-state="loading"],
#m40g-ledger-live-pill[data-state="empty"],
#m40g-ledger-live-pill[data-state="unavailable"] {
  color: var(--m40f-ink-3);
}
#m40g-ledger-live-pill[data-state="loading"] .m40f-dot,
#m40g-ledger-live-pill[data-state="empty"] .m40f-dot,
#m40g-ledger-live-pill[data-state="unavailable"] .m40f-dot {
  background: var(--m40f-ink-3);
  box-shadow: none;
}
#m40g-ledger-live-pill[data-state="unavailable"] .m40f-dot {
  background: var(--m40f-danger);
  box-shadow: 0 0 6px color-mix(in oklab, var(--m40f-danger) 60%, transparent);
}
/* Topbar status atom: same data-state contract */
#m40g-topbar-ledger-status[data-state="loading"] .m40f-topbar-stat-label,
#m40g-topbar-ledger-status[data-state="empty"] .m40f-topbar-stat-label,
#m40g-topbar-ledger-status[data-state="unavailable"] .m40f-topbar-stat-label {
  color: var(--m40f-ink-3);
}
#m40g-topbar-ledger-status[data-state="loading"] .m40f-dot,
#m40g-topbar-ledger-status[data-state="empty"] .m40f-dot {
  background: var(--m40f-ink-3);
  box-shadow: none;
}
#m40g-topbar-ledger-status[data-state="unavailable"] .m40f-dot {
  background: var(--m40f-danger);
  box-shadow: 0 0 6px color-mix(in oklab, var(--m40f-danger) 60%, transparent);
}

/* ---------------------------------------------------------------- */
/* M40G · Nested side nav                                           */
/* Lives inside .side-nav-body. When .m40g-nav-active is set, the   */
/* original .side-nav-section / .side-nav-item children are hidden  */
/* and the new tree (.m40g-nav) takes over. Removing the class      */
/* fully restores the static fallback nav.                          */
/* ---------------------------------------------------------------- */
.m40f-shell .side-nav-body.m40g-nav-active > .side-nav-section,
.m40f-shell .side-nav-body.m40g-nav-active > .side-nav-item {
  display: none;
}
.m40g-nav {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  font-family: var(--font-mono, ui-monospace, "JetBrains Mono", monospace);
}
.m40g-nav-group {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid
    color-mix(in oklab, var(--m40f-line) 50%, transparent);
  padding: 0.1rem 0;
}
.m40g-nav-group:last-child {
  border-bottom: 0;
}
.m40g-nav-group-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 0.55rem 0.7rem 0.35rem;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--m40f-ink-3);
  cursor: pointer;
  text-align: left;
  transition: color 0.12s;
}
.m40g-nav-group-head:hover {
  color: var(--m40f-ink-1);
}
.m40g-nav-group-label {
  flex: 1 1 auto;
}
.m40g-nav-group-chevron {
  font-size: 10px;
  color: var(--m40f-ink-3);
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
  display: inline-block;
}
.m40g-nav-group.is-open .m40g-nav-group-chevron {
  transform: rotate(0deg);
}
.m40g-nav-group-list {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding-bottom: 0.25rem;
}
.m40g-nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.42rem 0.7rem 0.42rem 1rem;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--m40f-ink-1);
  cursor: pointer;
  text-align: left;
  transition:
    background 0.12s,
    color 0.12s,
    border-color 0.12s;
}
.m40g-nav-item:hover {
  color: var(--m40f-ink-0);
  background: var(--m40f-bg-2);
}
.m40g-nav-item.is-active {
  color: var(--m40f-mint);
  background: color-mix(in oklab, var(--m40f-mint) 10%, transparent);
  border-color: color-mix(in oklab, var(--m40f-mint) 30%, transparent);
}
.m40g-nav-item-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  flex-shrink: 0;
}
.m40g-nav-item.is-active .m40g-nav-item-dot {
  opacity: 1;
}
.m40g-nav-item-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m40g-nav-item.is-tone-blue {
  color: oklch(0.78 0.12 240);
}
.m40g-nav-item.is-tone-amber {
  color: var(--m40f-warm);
}
.m40g-nav-item.is-tone-mint {
  color: var(--m40f-mint);
}
.m40g-nav-item.is-signout {
  color: oklch(0.7 0.16 25);
}
.m40g-nav-item.is-signout:hover {
  background: color-mix(in oklab, oklch(0.7 0.16 25) 10%, transparent);
  border-color: color-mix(in oklab, oklch(0.7 0.16 25) 35%, transparent);
}

/* Below 900px the side-nav is hidden anyway; ensure no horizontal
   overflow if it ever shows. */
@media (max-width: 900px) {
  .m40g-nav-item {
    font-size: 13px;
  }
}

/* ---------------------------------------------------------------- */
/* M40G · Avatar upload affordance                                  */
/* Wraps profile preview in a clickable label so the preview itself */
/* is the upload trigger. Hover shows a "Change avatar" overlay.    */
/* ---------------------------------------------------------------- */
.m40g-avatar-affordance {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  cursor: pointer;
  overflow: hidden;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: rgba(106, 211, 184, 0.12);
  transition: border-color 0.15s;
}
.m40g-avatar-affordance:hover,
.m40g-avatar-affordance:focus-within {
  border-color: rgba(106, 211, 184, 0.55);
}
.m40g-avatar-affordance #profileAvatarPreview {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  border-radius: 0;
}
.m40g-avatar-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 13, 0.6);
  color: #6ad3b8;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  padding: 0 0.4rem;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.m40g-avatar-affordance:hover .m40g-avatar-overlay,
.m40g-avatar-affordance:focus-within .m40g-avatar-overlay {
  opacity: 1;
}
.m40g-avatar-helper {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}
.m40g-avatar-helper.is-error {
  color: #ff8f8f;
}
.m40g-avatar-helper.is-ok {
  color: #6ad3b8;
}

/* ---------------------------------------------------------------- */
/* M40G · Public Page Uplift preview workspace                      */
/* Iframe-based render of buildPublicPageHtml() with desktop/mobile */
/* /fit toolbar. Uses sandbox + srcdoc; no scripts run inside.      */
/* ---------------------------------------------------------------- */
.m40-rl-preview-workspace {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.m40-rl-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--v2-line, rgba(255, 255, 255, 0.06));
}
.m40-rl-preview-toolbar-spacer {
  flex: 1 1 auto;
}
.m40-rl-preview-action {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.6rem;
  background: transparent;
  border: 1px solid var(--v2-line, rgba(255, 255, 255, 0.08));
  border-radius: 4px;
  color: var(--text-secondary, #9aa5b4);
  cursor: pointer;
  transition:
    border-color 0.12s,
    color 0.12s,
    background 0.12s;
}
.m40-rl-preview-action:hover {
  color: var(--text-primary, #e9edf3);
  border-color: rgba(106, 211, 184, 0.45);
}
.m40-rl-preview-action.is-on {
  color: #6ad3b8;
  border-color: rgba(106, 211, 184, 0.55);
  background: rgba(106, 211, 184, 0.08);
}
.m40-rl-preview-frame {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  background: #0a0d12;
  border: 1px solid var(--v2-line, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  padding: 0.6rem;
  overflow: hidden;
}
.m40-rl-preview-iframe {
  display: block;
  width: 100%;
  min-height: 720px;
  height: 720px;
  border: 0;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  transition:
    width 0.18s ease,
    max-width 0.18s ease;
}
.m40-rl-preview-frame[data-mode="mobile"] .m40-rl-preview-iframe {
  width: 390px;
  max-width: 100%;
  min-height: 720px;
}
.m40-rl-preview-frame[data-mode="fit"] .m40-rl-preview-iframe {
  min-height: 480px;
  height: 480px;
}
.m40-rl-preview-caption {
  font-size: 11.5px;
  color: var(--text-muted, #6a7583);
  font-style: italic;
}
.m40-rl-preview-status {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--text-muted, #6a7583);
  min-height: 1em;
}
.m40-rl-preview-status.is-ok {
  color: #6ad3b8;
}
.m40-rl-preview-status.is-error {
  color: #ff8f8f;
}
@media (max-width: 700px) {
  .m40-rl-preview-iframe {
    min-height: 520px;
    height: 520px;
  }
  .m40-rl-preview-frame[data-mode="mobile"] .m40-rl-preview-iframe {
    width: 100%;
  }
}

/* ---------------------------------------------------------------- */
/* M40H · Member directory clickable rows + profile modal           */
/* Modal mounts on document.body; backdrop closes on outside click. */
/* ---------------------------------------------------------------- */
.m40g-directory-row-clickable {
  cursor: pointer;
  transition: background 0.12s;
}
.m40g-directory-row-clickable:hover,
.m40g-directory-row-clickable:focus-visible {
  background: rgba(106, 211, 184, 0.05);
  outline: 0;
}
.m40g-directory-row-clickable:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(106, 211, 184, 0.6);
}

.m40g-profile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 13, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  animation: m40g-fade-in 0.18s ease;
}
@keyframes m40g-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.m40g-profile-card {
  position: relative;
  background: var(--m40f-bg-1, #0f141b);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 1.6rem 1.6rem 1.2rem;
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  color: var(--text-primary, #e9edf3);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  font-family: inherit;
}
.m40g-profile-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-secondary, #9aa5b4);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition:
    color 0.12s,
    background 0.12s,
    border-color 0.12s;
}
.m40g-profile-close:hover {
  color: var(--text-primary, #e9edf3);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
.m40g-profile-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.m40g-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(106, 211, 184, 0.12);
  color: #6ad3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 700;
  font-size: 1.3rem;
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
}
.m40g-profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.m40g-profile-headline {
  flex: 1 1 auto;
  min-width: 0;
}
.m40g-profile-name {
  margin: 0 0 0.18rem;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}
.m40g-profile-role {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted, #6a7583);
  margin-bottom: 0.18rem;
}
.m40g-profile-company {
  font-size: 0.82rem;
  color: var(--text-secondary, #9aa5b4);
}
.m40g-profile-hidden-pill {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  background: rgba(244, 183, 64, 0.1);
  border: 1px solid rgba(244, 183, 64, 0.35);
  color: #f4b740;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.m40g-profile-bio {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-secondary, #c2cad4);
  margin: 0 0 1rem;
  white-space: pre-wrap;
}
.m40g-profile-empty {
  color: var(--text-muted, #6a7583);
  font-style: italic;
}
.m40g-profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  margin-bottom: 1rem;
}
.m40g-profile-meta-bit {
  font-size: 0.78rem;
  color: var(--text-muted, #9aa5b4);
}
.m40g-profile-meta-bit + .m40g-profile-meta-bit::before {
  content: "·";
  margin-right: 0.5rem;
  color: var(--text-muted, #6a7583);
}
.m40g-profile-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.m40g-profile-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.m40g-profile-skill-chip {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  background: rgba(106, 211, 184, 0.08);
  border: 1px solid rgba(106, 211, 184, 0.25);
  border-radius: 999px;
  color: #6ad3b8;
  font-size: 0.74rem;
}
.m40g-profile-links {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.m40g-profile-link {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.5rem 0.7rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-primary, #e9edf3);
  transition:
    border-color 0.12s,
    background 0.12s;
}
.m40g-profile-link:hover {
  border-color: rgba(0, 180, 255, 0.4);
  background: rgba(0, 180, 255, 0.04);
}
.m40g-profile-link-kind {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted, #6a7583);
}
.m40g-profile-link-value {
  font-size: 0.84rem;
  word-break: break-all;
}
.m40g-profile-actions {
  margin-top: 0.4rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.m40g-profile-message-btn {
  padding: 0.55rem 1rem;
  background: rgba(0, 180, 255, 0.1);
  border: 1px solid rgba(0, 180, 255, 0.4);
  border-radius: 6px;
  color: #00b4ff;
  font-family: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  transition:
    background 0.12s,
    border-color 0.12s;
}
.m40g-profile-message-btn:hover:not([disabled]) {
  background: rgba(0, 180, 255, 0.16);
  border-color: rgba(0, 180, 255, 0.6);
}
.m40g-profile-message-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
@media (max-width: 600px) {
  .m40g-profile-card {
    padding: 1.2rem 1rem 1rem;
  }
  .m40g-profile-header {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ---------------------------------------------------------------- */
/* M40H · Messages tab mode picker (broadcast feed vs DMs)          */
/* ---------------------------------------------------------------- */
.m40g-msg-modetabs {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
  border-radius: 8px;
  margin-bottom: 1.2rem;
}
.m40g-msg-modetab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted, #9aa5b4);
  cursor: pointer;
  transition:
    color 0.12s,
    background 0.12s;
}
.m40g-msg-modetab:hover {
  color: var(--text-primary, #e9edf3);
}
.m40g-msg-modetab.is-on {
  background: rgba(106, 211, 184, 0.1);
  color: #6ad3b8;
  border-color: rgba(106, 211, 184, 0.3);
}

/* ---------------------------------------------------------------- */
/* M40H · DM module                                                 */
/* Two-pane: list + thread. Stacks on mobile.                       */
/* ---------------------------------------------------------------- */
.m40g-dms {
  display: block;
}
.m40g-dms-pane {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  overflow: hidden;
  min-height: 480px;
  height: clamp(480px, 64vh, 720px);
  background: var(--m40f-bg-1, #0f141b);
}

.m40g-dms-list {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
  background: rgba(255, 255, 255, 0.015);
  overflow: hidden;
}
.m40g-dms-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
}
.m40g-dms-list-count {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--text-muted, #6a7583);
}
.m40g-dms-list-empty {
  padding: 1rem;
  font-size: 0.84rem;
  color: var(--text-muted, #6a7583);
  line-height: 1.5;
}
.m40g-dms-list-empty p {
  margin: 0;
}
.m40g-dms-list-body {
  flex: 1 1 auto;
  overflow-y: auto;
}
.m40g-dms-list-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid
    color-mix(
      in oklab,
      var(--m40f-line, rgba(255, 255, 255, 0.06)) 50%,
      transparent
    );
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: background 0.12s;
}
.m40g-dms-list-row:hover {
  background: rgba(255, 255, 255, 0.03);
}
.m40g-dms-list-row.is-active {
  background: rgba(106, 211, 184, 0.06);
  border-left: 2px solid rgba(106, 211, 184, 0.45);
}
.m40g-dms-list-row.has-unread .m40g-dms-list-row-name {
  color: #6ad3b8;
  font-weight: 700;
}
.m40g-dms-list-row-body {
  flex: 1 1 auto;
  min-width: 0;
}
.m40g-dms-list-row-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.m40g-dms-list-row-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary, #e9edf3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m40g-dms-list-row-time {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  color: var(--text-muted, #6a7583);
  flex-shrink: 0;
}
.m40g-dms-list-row-snippet {
  font-size: 0.78rem;
  color: var(--text-secondary, #9aa5b4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.18rem;
}
.m40g-dms-list-row-unread {
  display: inline-block;
  margin-top: 0.3rem;
  padding: 0.05rem 0.35rem;
  background: rgba(244, 183, 64, 0.16);
  border: 1px solid rgba(244, 183, 64, 0.4);
  color: #f4b740;
  border-radius: 999px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.m40g-dms-thread {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--m40f-bg-1, #0f141b);
}
.m40g-dms-thread-empty {
  padding: 2rem 1.4rem;
  text-align: center;
  color: var(--text-muted, #6a7583);
}
.m40g-dms-thread-empty h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary, #9aa5b4);
}
.m40g-dms-thread-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
  background: rgba(255, 255, 255, 0.02);
}
.m40g-dms-thread-back {
  display: none; /* shown on mobile only */
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  color: var(--text-secondary, #9aa5b4);
  cursor: pointer;
}
.m40g-dms-thread-back:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary, #e9edf3);
}
.m40g-dms-thread-headline {
  flex: 1 1 auto;
  min-width: 0;
}
.m40g-dms-thread-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary, #e9edf3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m40g-dms-thread-role {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted, #6a7583);
  margin-top: 0.1rem;
}
.m40g-dms-thread-profile-btn {
  background: transparent;
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary, #9aa5b4);
  cursor: pointer;
  transition:
    border-color 0.12s,
    color 0.12s;
}
.m40g-dms-thread-profile-btn:hover {
  border-color: rgba(0, 180, 255, 0.4);
  color: #00b4ff;
}

.m40g-dms-thread-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.m40g-dm-msg {
  max-width: 78%;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}
.m40g-dm-msg.is-mine {
  align-self: flex-end;
  background: rgba(0, 180, 255, 0.12);
  border: 1px solid rgba(0, 180, 255, 0.3);
}
.m40g-dm-msg.is-theirs {
  align-self: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.m40g-dm-msg-meta {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--text-muted, #6a7583);
  margin-top: 0.3rem;
}

.m40g-dms-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem 0.9rem;
  border-top: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
  background: rgba(255, 255, 255, 0.02);
}
.m40g-dms-composer-input {
  background: var(--m40f-bg-2, #14191f);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  color: var(--text-primary, #e9edf3);
  font-family: inherit;
  font-size: 0.88rem;
  resize: vertical;
  min-height: 40px;
}
.m40g-dms-composer-input:focus {
  outline: 0;
  border-color: rgba(106, 211, 184, 0.55);
}
.m40g-dms-composer-send {
  align-self: flex-end;
  background: rgba(106, 211, 184, 0.12);
  border: 1px solid rgba(106, 211, 184, 0.4);
  border-radius: 6px;
  padding: 0.55rem 1rem;
  color: #6ad3b8;
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition:
    background 0.12s,
    border-color 0.12s;
}
.m40g-dms-composer-send:hover:not([disabled]) {
  background: rgba(106, 211, 184, 0.2);
  border-color: rgba(106, 211, 184, 0.6);
}
.m40g-dms-composer-send[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.m40g-dm-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(106, 211, 184, 0.12);
  color: #6ad3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 700;
  font-size: 0.78rem;
  overflow: hidden;
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
}
.m40g-dm-avatar[data-size="sm"] {
  width: 28px;
  height: 28px;
  font-size: 0.7rem;
}
.m40g-dm-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 800px) {
  .m40g-dms-pane {
    grid-template-columns: 1fr;
    height: clamp(520px, 70vh, 760px);
  }
  .m40g-dms-pane.is-thread-open .m40g-dms-list {
    display: none;
  }
  .m40g-dms-pane:not(.is-thread-open) .m40g-dms-thread {
    display: none;
  }
  .m40g-dms-thread-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ---------------------------------------------------------------- */
/* M40H · Notebook explainer                                         */
/* ---------------------------------------------------------------- */
.m40g-notebook-explainer {
  margin: 0 0 1.4rem;
  padding: 1rem 1.1rem;
  background: rgba(106, 211, 184, 0.04);
  border: 1px solid rgba(106, 211, 184, 0.2);
  border-radius: 8px;
}
.m40g-notebook-explainer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}
.m40g-notebook-explainer-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.m40g-notebook-explainer-card p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary, #c2cad4);
}
.m40g-notebook-explainer-card code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  color: #6ad3b8;
}

/* ---------------------------------------------------------------- */
/* M40H · Guide walkthrough                                          */
/* In-page steps; each step has an inline CTA (data-jump-tab) so    */
/* the user moves from "read about it" to "do it" without           */
/* leaving the page. No outbound-link cards.                        */
/* ---------------------------------------------------------------- */
.m40g-guide {
  /* hosted inside .dash-section-inner; no top-level shifts */
}
.m40g-guide-deck {
  color: var(--text-secondary, #c2cad4);
  line-height: 1.7;
  font-size: 0.95rem;
  margin-bottom: 2rem;
}
.m40g-guide-step {
  position: relative;
  padding: 1.4rem 1.5rem 1.2rem;
  margin-bottom: 1.2rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
  border-radius: 8px;
  border-left: 3px solid rgba(106, 211, 184, 0.4);
}
.m40g-guide-step:hover {
  border-left-color: rgba(106, 211, 184, 0.8);
}
.m40g-guide-step-head {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}
.m40g-guide-step-num {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--m40f-warm, #f4b740);
  flex-shrink: 0;
}
.m40g-guide-step-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary, #e9edf3);
  line-height: 1.3;
}
.m40g-guide-step p {
  margin: 0.5rem 0;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-secondary, #c2cad4);
}
.m40g-guide-step a {
  color: var(--accent-blue, #00b4ff);
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
}
.m40g-guide-step a:hover {
  border-bottom-style: solid;
}
.m40g-guide-step strong {
  color: var(--text-primary, #e9edf3);
}
.m40g-guide-step em {
  color: var(--text-primary, #e9edf3);
  font-style: italic;
}
.m40g-guide-code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  color: var(--accent-blue, #00b4ff);
}
.m40g-guide-step-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.m40g-guide-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  background: rgba(106, 211, 184, 0.1);
  border: 1px solid rgba(106, 211, 184, 0.4);
  border-radius: 6px;
  color: #6ad3b8;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px solid rgba(106, 211, 184, 0.4);
  transition:
    background 0.12s,
    border-color 0.12s;
}
.m40g-guide-cta:hover {
  background: rgba(106, 211, 184, 0.18);
  border-color: rgba(106, 211, 184, 0.6);
}
.m40g-guide-cta.is-secondary {
  background: rgba(0, 180, 255, 0.08);
  border-color: rgba(0, 180, 255, 0.35);
  color: var(--accent-blue, #00b4ff);
}
.m40g-guide-cta.is-secondary:hover {
  background: rgba(0, 180, 255, 0.16);
  border-color: rgba(0, 180, 255, 0.55);
}

/* Founder-only step inherits the existing role-allowed cascade */
#appShell[data-user-role]
  .m40g-guide-founder-only[data-role-required]:not(.role-allowed) {
  display: none;
}

/* ---------------------------------------------------------------- */
/* M40I · Chat heads (LinkedIn-style docked DM panels)              */
/* ---------------------------------------------------------------- */
.m40g-chathead-dock {
  position: fixed;
  right: 24px;
  bottom: 0;
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-end;
  gap: 0.5rem;
  z-index: 5000;
  pointer-events: none;
  font-family: inherit;
}
.m40g-chathead-dock > * {
  pointer-events: auto;
}
.m40g-chathead-overflow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(106, 211, 184, 0.16);
  color: #6ad3b8;
  border: 1px solid rgba(106, 211, 184, 0.45);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 0.4rem;
  transition:
    background 0.12s,
    border-color 0.12s;
}
.m40g-chathead-overflow:hover {
  background: rgba(106, 211, 184, 0.28);
  border-color: rgba(106, 211, 184, 0.7);
}
.m40g-chathead-panel {
  width: 320px;
  background: var(--m40f-bg-1, #0f141b);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.1));
  border-bottom: 0;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  color: var(--text-primary, #e9edf3);
}
.m40g-chathead-panel.is-open {
  height: 440px;
}
.m40g-chathead-panel.is-min {
  height: 36px;
  width: 220px;
}
.m40g-chathead-head {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0.35rem 0.4rem 0.35rem 0.5rem;
  border-bottom: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
  background: rgba(255, 255, 255, 0.02);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}
.m40g-chathead-panel.is-min .m40g-chathead-head {
  border-bottom: 0;
}
.m40g-chathead-head-btn {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  padding: 0.2rem 0.3rem;
  min-width: 0;
}
.m40g-chathead-head-btn:hover {
  color: var(--text-primary, #e9edf3);
}
.m40g-chathead-head-info {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.m40g-chathead-head-name {
  flex: 1 1 auto;
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary, #e9edf3);
}
.m40g-chathead-head-unread {
  flex-shrink: 0;
  background: rgba(244, 183, 64, 0.18);
  border: 1px solid rgba(244, 183, 64, 0.45);
  color: #f4b740;
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}
.m40g-chathead-close {
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-muted, #6a7583);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.m40g-chathead-close:hover {
  color: var(--text-primary, #e9edf3);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
.m40g-chathead-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--m40f-bg-1, #0f141b);
}
.m40g-chathead-empty {
  color: var(--text-muted, #6a7583);
  font-size: 0.78rem;
  font-style: italic;
  padding: 0.5rem 0;
  text-align: center;
}
.m40g-chathead-error {
  background: rgba(255, 107, 107, 0.06);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: #ff8f8f;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.4;
}
.m40g-chathead-msg {
  max-width: 80%;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  font-size: 0.84rem;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
}
.m40g-chathead-msg.is-mine {
  align-self: flex-end;
  background: rgba(0, 180, 255, 0.14);
  border: 1px solid rgba(0, 180, 255, 0.32);
}
.m40g-chathead-msg.is-theirs {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.m40g-chathead-msg-meta {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--text-muted, #6a7583);
  margin-top: 0.2rem;
}
.m40g-chathead-composer {
  display: grid;
  grid-template-columns: 1fr 32px;
  gap: 0.3rem;
  align-items: end;
  padding: 0.45rem 0.55rem 0.55rem;
  border-top: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
  background: rgba(255, 255, 255, 0.02);
}
.m40g-chathead-input {
  background: var(--m40f-bg-2, #14191f);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 16px;
  padding: 0.4rem 0.7rem;
  color: var(--text-primary, #e9edf3);
  font-family: inherit;
  font-size: 0.84rem;
  line-height: 1.4;
  resize: none;
  min-height: 28px;
  max-height: 96px;
}
.m40g-chathead-input:focus {
  outline: 0;
  border-color: rgba(106, 211, 184, 0.55);
}
.m40g-chathead-send {
  width: 32px;
  height: 32px;
  background: rgba(106, 211, 184, 0.16);
  border: 1px solid rgba(106, 211, 184, 0.45);
  border-radius: 50%;
  color: #6ad3b8;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.12s;
}
.m40g-chathead-send:hover {
  background: rgba(106, 211, 184, 0.3);
}
.m40g-chathead-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(106, 211, 184, 0.12);
  color: #6ad3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 700;
  font-size: 0.7rem;
  overflow: hidden;
}
.m40g-chathead-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mobile sheet pattern: at <800px collapse to a single bottom drawer. */
@media (max-width: 800px) {
  .m40g-chathead-dock {
    right: 0;
    left: 0;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 0;
  }
  .m40g-chathead-panel,
  .m40g-chathead-panel.is-open {
    width: 100%;
    height: 70vh;
    border-radius: 12px 12px 0 0;
  }
  .m40g-chathead-panel.is-min {
    width: 100%;
    height: 36px;
  }
  /* Only the front panel shows in expanded form on mobile; siblings minimise. */
  .m40g-chathead-dock
    > .m40g-chathead-panel.is-open
    ~ .m40g-chathead-panel.is-open {
    display: none;
  }
}

/* ---------------------------------------------------------------- */
/* M40I · Ledger rail collapse/expand                                */
/* ---------------------------------------------------------------- */
.m40g-ledger-toggle {
  position: absolute;
  top: 50%;
  left: -18px;
  transform: translateY(-50%);
  width: 28px;
  height: 72px;
  background: linear-gradient(
    180deg,
    rgba(106, 211, 184, 0.22),
    rgba(106, 211, 184, 0.1)
  );
  color: #6ad3b8;
  border: 1px solid rgba(106, 211, 184, 0.5);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 1.3rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  box-shadow: -3px 0 14px rgba(0, 0, 0, 0.45);
  transition:
    background 0.14s,
    color 0.14s,
    border-color 0.14s,
    transform 0.18s;
}
.m40g-ledger-toggle:hover,
.m40g-ledger-toggle:focus-visible {
  background: linear-gradient(
    180deg,
    rgba(106, 211, 184, 0.36),
    rgba(106, 211, 184, 0.2)
  );
  color: #ffffff;
  border-color: rgba(106, 211, 184, 0.75);
  transform: translateY(-50%) translateX(-2px);
  outline: 0;
}
.m40g-ledger-toggle-glyph {
  line-height: 1;
}

/* When collapsed, slim the rail down to the toggle column and hide
   the body. The handle stays visible so the user can re-expand. */
.m40f-shell.is-rail-collapsed .m40f-ledger-rail {
  width: 32px;
}
.m40f-shell.is-rail-collapsed .m40f-ledger-rail > *:not(.m40g-ledger-toggle) {
  visibility: hidden;
}
@media (min-width: 1180px) {
  .m40f-shell.is-rail-collapsed .main-col {
    padding-right: 32px;
  }
}
.m40f-shell.is-rail-collapsed .m40g-ledger-toggle {
  left: 4px;
  border-radius: 6px;
  border-right: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
}
@media (max-width: 1179px) {
  .m40g-ledger-toggle {
    display: none;
  }
}

/* ---------------------------------------------------------------- */
/* M40I · Ledger messages roster                                     */
/* ---------------------------------------------------------------- */
.m40g-ledger-msg-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed
    color-mix(
      in oklab,
      var(--m40f-line, rgba(255, 255, 255, 0.06)) 60%,
      transparent
    );
  padding: 0.5rem 0.2rem;
  text-align: left;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  transition: background 0.12s;
}
.m40g-ledger-msg-row:last-child {
  border-bottom: 0;
}
.m40g-ledger-msg-row:hover {
  background: rgba(255, 255, 255, 0.03);
}
.m40g-ledger-msg-row.has-unread .m40g-ledger-msg-name {
  color: #6ad3b8;
  font-weight: 700;
}
.m40g-ledger-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(106, 211, 184, 0.12);
  color: #6ad3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 700;
  font-size: 0.7rem;
}
.m40g-ledger-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.m40g-ledger-msg-body {
  flex: 1 1 auto;
  min-width: 0;
}
.m40g-ledger-msg-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
}
.m40g-ledger-msg-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--m40f-ink-0, #e9edf3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m40g-ledger-msg-time {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  color: var(--m40f-ink-3);
  flex-shrink: 0;
}
.m40g-ledger-msg-snippet {
  font-size: 11.5px;
  color: var(--m40f-ink-2);
  margin-top: 0.18rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m40g-ledger-msg-unread {
  display: inline-block;
  margin-top: 0.22rem;
  padding: 0.05rem 0.35rem;
  background: rgba(244, 183, 64, 0.16);
  border: 1px solid rgba(244, 183, 64, 0.45);
  color: #f4b740;
  border-radius: 999px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}
.m40g-ledger-source-pill[data-source="messages"] {
  color: oklch(0.78 0.14 200);
  border-color: color-mix(in oklab, oklch(0.78 0.14 200) 40%, var(--m40f-line));
}

/* The rail uses position:fixed; ensure the handle's relative anchor lives
   on the rail itself so the toggle sits on the rail edge regardless of
   scroll. Also need 'position:relative' on the rail for the absolute
   handle to anchor correctly. */
.m40f-ledger-rail {
  position: fixed; /* already set in M40F base — re-asserted for clarity */
}

/* ---------------------------------------------------------------- */
/* M40I · Public Page artifact (editor + live iframe split)         */
/* Replaces the static iframe layout from M40G for this concept.    */
/* ---------------------------------------------------------------- */
.m40-rl-artifact {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.m40-rl-artifact-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--v2-line, rgba(255, 255, 255, 0.06));
}
.m40-rl-artifact-body {
  display: grid;
  /* fr columns set inline by JS so the divider drag preserves intent */
  grid-template-columns: minmax(0, 1fr) 8px minmax(0, 1fr);
  width: 100%;
  border: 1px solid var(--v2-line, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  background: #0a0d12;
  overflow: hidden;
  /* M40L: was a fixed clamp(560px, 70vh, 820px). Replaced with min/max so
     the artifact grows when the user collapses catalogue + discussion. */
  min-height: 480px;
  max-height: calc(100vh - 220px);
  height: auto;
}
/* When catalogue + discussion are both collapsed, give the artifact more room
   to breathe — the only competing space is two 40px header strips. */
.m40-rl-shell.is-both-side-collapsed .m40-rl-artifact-body {
  max-height: calc(100vh - 160px);
}
.m40-rl-artifact-editor {
  background: #0a0d12;
  color: #e9edf3;
  border: 0;
  border-right: 1px solid var(--v2-line, rgba(255, 255, 255, 0.06));
  padding: 0.85rem 0.95rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  resize: none;
  outline: none;
  overflow: auto;
  white-space: pre;
  tab-size: 2;
}
.m40-rl-artifact-editor:focus {
  outline: 2px solid rgba(106, 211, 184, 0.4);
  outline-offset: -2px;
}
.m40-rl-artifact-divider {
  background: var(--v2-line, rgba(255, 255, 255, 0.08));
  cursor: col-resize;
  position: relative;
  transition: background 0.12s;
}
.m40-rl-artifact-divider:hover,
.m40-rl-artifact-divider:focus-visible {
  background: rgba(106, 211, 184, 0.45);
  outline: 0;
}
.m40-rl-artifact-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 28px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  transform: translate(-50%, -50%);
}
.m40-rl-artifact .m40-rl-preview-frame {
  height: 100%;
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 0.5rem;
  overflow: auto;
}
.m40-rl-artifact .m40-rl-preview-iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}
.m40-rl-artifact
  .m40-rl-preview-frame[data-mode="mobile"]
  .m40-rl-preview-iframe {
  width: 390px;
  max-width: 100%;
  margin: 0 auto;
  display: block;
}
.m40-rl-artifact .m40-rl-preview-frame[data-mode="fit"] .m40-rl-preview-iframe {
  height: 100%;
  min-height: 0;
}

/* Fullscreen overlay — frees the artifact from the 3-pane lab shell. */
.m40-rl-artifact-fullscreen-host {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #05080d;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  animation: m40g-fade-in 0.18s ease;
}
.m40-rl-artifact.is-fullscreen {
  height: 100%;
  flex: 1 1 auto;
  gap: 0.5rem;
}
.m40-rl-artifact.is-fullscreen .m40-rl-artifact-body {
  flex: 1 1 auto;
  height: auto;
  /* M40L: in fullscreen, drop the calc(100vh - 220px) clamp so the artifact
     fills the entire overlay (it already has its own padding via the host). */
  max-height: none;
  min-height: 0;
}

@media (max-width: 800px) {
  .m40-rl-artifact-body {
    grid-template-columns: 1fr !important;
    grid-template-rows: 220px 8px 1fr;
    /* M40L: drop fixed clamp on mobile too — let viewport drive. */
    min-height: 420px;
    max-height: calc(100vh - 140px);
  }
  .m40-rl-artifact-divider {
    cursor: row-resize;
  }
  .m40-rl-artifact-editor {
    border-right: 0;
    border-bottom: 1px solid var(--v2-line, rgba(255, 255, 255, 0.06));
  }
}

/* ---------------------------------------------------------------- */
/* M40L · Founder Ops Pipeline subview (read-only health)            */
/* ---------------------------------------------------------------- */
.m40l-pipeline-intro {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-bottom: 0.7rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px dashed var(--m40f-line, rgba(255, 255, 255, 0.06));
}
.m40l-pipeline-intro p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
}
.m40l-pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.7rem;
}
.m40l-pipeline-leg {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.m40l-pipeline-leg-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.m40l-pipeline-leg-title {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--m40f-ink-1, rgba(255, 255, 255, 0.85));
}
.m40l-pipeline-leg-hint {
  font-size: 0.82rem;
  color: var(--m40f-ink-2, rgba(255, 255, 255, 0.7));
  line-height: 1.45;
}
.m40l-pipeline-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  flex: 0 0 auto;
}
.m40l-pipeline-dot.is-ok {
  background: #6ad3b8;
  box-shadow: 0 0 6px rgba(106, 211, 184, 0.55);
}
.m40l-pipeline-dot.is-warn {
  background: #f4b740;
}
.m40l-pipeline-dot.is-error {
  background: #e57373;
}
.m40l-pipeline-dot.is-unknown,
.m40l-pipeline-dot.is-loading {
  background: rgba(255, 255, 255, 0.3);
}
.m40l-pipeline-leg.is-error {
  border-color: rgba(229, 115, 115, 0.45);
}
.m40l-pipeline-leg.is-warn {
  border-color: rgba(244, 183, 64, 0.4);
}
.m40l-pipeline-leg.is-ok {
  border-color: rgba(106, 211, 184, 0.4);
}

/* ---------------------------------------------------------------- */
/* M40L · Workbench project create + document upload                 */
/* ---------------------------------------------------------------- */
.m40l-projects-cta {
  background: rgba(106, 211, 184, 0.1);
  border: 1px solid rgba(106, 211, 184, 0.4);
  color: #6ad3b8;
  border-radius: 6px;
  padding: 0.55rem 0.95rem;
  font-family: var(--font-display, inherit);
  font-size: 0.84rem;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.14s,
    border-color 0.14s,
    color 0.14s;
}
.m40l-projects-cta:hover:not([disabled]) {
  background: rgba(106, 211, 184, 0.2);
  border-color: rgba(106, 211, 184, 0.7);
  color: #fff;
}
.m40l-projects-cta[disabled] {
  opacity: 0.55;
  cursor: progress;
}
.m40l-projects-cta.is-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-secondary, rgba(255, 255, 255, 0.65));
}
.m40l-projects-cta.is-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.m40l-projects-cta.is-small {
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
}
.m40l-projects-form {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
  margin: 0.5rem 0 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.m40l-projects-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.m40l-projects-input {
  background: var(--m40f-bg-2, #14191f);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  color: var(--text-primary, #e9edf3);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  width: 100%;
  resize: vertical;
}
.m40l-projects-input:focus {
  outline: 0;
  border-color: rgba(106, 211, 184, 0.55);
}
.m40l-projects-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}
.m40l-projects-docs {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
  border-radius: 8px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.m40l-projects-docs-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.m40l-projects-docs-head .v2-kicker {
  flex: 1 1 auto;
}
.m40l-projects-docs-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.m40l-projects-doc-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
  border-radius: 6px;
}
.m40l-projects-doc-row:hover {
  border-color: rgba(106, 211, 184, 0.35);
}
.m40l-projects-doc-meta {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  flex: 1 1 auto;
  min-width: 0;
}
.m40l-projects-doc-name {
  font-size: 0.92rem;
  color: #6ad3b8;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m40l-projects-doc-name:hover {
  text-decoration: underline;
}
.m40l-projects-doc-sub {
  font-size: 0.75rem;
  color: var(--m40f-ink-3, rgba(255, 255, 255, 0.45));
  font-family: var(--font-mono, ui-monospace, monospace);
}

/* ---------------------------------------------------------------- */
/* M40L · Release Lab pane collapse (catalogue + discussion)         */
/* ---------------------------------------------------------------- */
.m40-rl-pane-collapse {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--v2-line, rgba(255, 255, 255, 0.08));
  color: var(--m40f-ink-2, rgba(255, 255, 255, 0.7));
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  margin-left: auto;
  transition:
    background 0.14s,
    border-color 0.14s,
    color 0.14s;
}
.m40-rl-pane-collapse:hover {
  background: rgba(106, 211, 184, 0.1);
  border-color: rgba(106, 211, 184, 0.5);
  color: #fff;
}
.m40-rl-pane-collapse-glyph {
  font-size: 10px;
  line-height: 1;
}

/* When the .is-collapsed flag is on a side pane, shrink its body but keep
   the head strip + collapse button visible so the user can re-expand. */
.m40-rl-pane.is-collapsed {
  max-height: 38px !important;
  overflow: hidden;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}
.m40-rl-pane.is-collapsed > * {
  display: none;
}
.m40-rl-pane.is-collapsed > .m40-rl-backlog-head,
.m40-rl-pane.is-collapsed > .m40-rl-discussion-head {
  display: flex;
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
/* The head bar already uses flex; ensure the header itself becomes a row
   so the collapse button stays anchored right. */
.m40-rl-backlog-head,
.m40-rl-discussion-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---------------------------------------------------------------- */
/* M40I · Newsletter authoring (Content tab)                         */
/* ---------------------------------------------------------------- */
.m40g-news-author {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
  border-radius: 8px;
  padding: 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.m40g-news-author-head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.m40g-news-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.m40g-news-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.m40g-news-input,
.m40g-news-textarea {
  background: var(--m40f-bg-2, #14191f);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  color: var(--text-primary, #e9edf3);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.55;
}
.m40g-news-input:focus,
.m40g-news-textarea:focus {
  outline: 0;
  border-color: rgba(106, 211, 184, 0.55);
}
.m40g-news-textarea {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  resize: vertical;
  min-height: 240px;
}
.m40g-news-body-field {
  height: 100%;
}
.m40g-news-body-field .m40g-news-textarea {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}
.m40g-news-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8px minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.015);
  overflow: hidden;
  height: clamp(420px, 60vh, 640px);
}
.m40g-news-divider {
  background: var(--v2-line, rgba(255, 255, 255, 0.08));
  cursor: col-resize;
  position: relative;
  transition: background 0.12s;
}
.m40g-news-divider:hover,
.m40g-news-divider:focus-visible {
  background: rgba(106, 211, 184, 0.45);
  outline: 0;
}
.m40g-news-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 28px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  transform: translate(-50%, -50%);
}
.m40g-news-preview {
  display: flex;
  flex-direction: column;
  background: #0a0d12;
  padding: 0.6rem 0.7rem 0.7rem;
  gap: 0.4rem;
  min-width: 0;
}
.m40g-news-preview-iframe {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}
.m40g-news-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
@media (max-width: 800px) {
  .m40g-news-split {
    grid-template-columns: 1fr !important;
    grid-template-rows: 220px 8px 1fr;
    height: clamp(420px, 70vh, 640px);
  }
  .m40g-news-divider {
    cursor: row-resize;
  }
}

/* ---------------------------------------------------------------- */
/* M40K · Newsletter block editor (self-hosted, replaces markdown)   */
/* ---------------------------------------------------------------- */
.m40g-news-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
}
.m40g-news-toolbar-spacer {
  flex: 1 1 auto;
}
.m40g-news-subject-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 0.7rem;
}
@media (max-width: 720px) {
  .m40g-news-subject-row {
    grid-template-columns: 1fr;
  }
}
.m40g-news-editor {
  background: #0a0d12;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
  min-width: 0;
}
.m40g-news-empty {
  padding: 1.4rem 1rem;
  text-align: center;
  color: var(--m40f-ink-3, rgba(255, 255, 255, 0.45));
  font-style: italic;
  border: 1px dashed var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.015);
}
.m40g-news-block {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  padding: 0.55rem 0.65rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.m40g-news-block:hover {
  border-color: rgba(106, 211, 184, 0.25);
}
.m40g-news-block.is-selected {
  border-color: rgba(106, 211, 184, 0.6);
  background: rgba(106, 211, 184, 0.04);
}
.m40g-news-block-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.m40g-news-block-type {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--m40f-ink-2, rgba(255, 255, 255, 0.62));
}
.m40g-news-block-action {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary, #e9edf3);
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.m40g-news-block-action:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(106, 211, 184, 0.45);
}
.m40g-news-block-action.is-danger:hover {
  background: rgba(220, 80, 80, 0.18);
  border-color: rgba(220, 80, 80, 0.55);
  color: #ffb4b4;
}
.m40g-news-block-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.m40g-news-block-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1 1 0;
}
.m40g-news-block-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.m40g-news-block-row > .m40g-news-block-field {
  min-width: 120px;
}
.m40g-news-block-input {
  background: var(--m40f-bg-2, #14191f);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 5px;
  padding: 0.45rem 0.6rem;
  color: var(--text-primary, #e9edf3);
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  width: 100%;
  min-width: 0;
  resize: vertical;
}
.m40g-news-block-input:focus {
  outline: 0;
  border-color: rgba(106, 211, 184, 0.55);
}
textarea.m40g-news-block-input {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  min-height: 64px;
}
.m40g-news-block-field-color {
  flex: 0 0 auto;
}
.m40g-news-block-color {
  width: 56px;
  height: 32px;
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 5px;
  background: var(--m40f-bg-2, #14191f);
  padding: 2px;
  cursor: pointer;
}
.m40g-news-image-preview {
  background: #14191f;
  border: 1px dashed var(--m40f-line, rgba(255, 255, 255, 0.1));
  border-radius: 5px;
  padding: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  max-height: 260px;
  overflow: hidden;
}
.m40g-news-image-preview img {
  max-width: 100%;
  max-height: 240px;
  height: auto;
  border-radius: 4px;
}
.m40g-news-image-empty {
  color: var(--m40f-ink-3, rgba(255, 255, 255, 0.45));
  font-style: italic;
  font-size: 0.9rem;
  text-align: center;
}
.m40g-news-image-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(106, 211, 184, 0.4);
  background: rgba(106, 211, 184, 0.08);
  color: rgba(106, 211, 184, 0.95);
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.86rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 0 0 auto;
  transition: background 0.15s;
}
.m40g-news-image-upload:hover {
  background: rgba(106, 211, 184, 0.16);
}
.m40g-news-image-upload .v2-kicker {
  color: inherit;
  letter-spacing: inherit;
}
.m40g-news-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--m40f-line, rgba(255, 255, 255, 0.08));
  margin-top: 0.2rem;
}
.m40g-news-add-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.1));
  color: var(--text-primary, #e9edf3);
  border-radius: 14px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.m40g-news-add-btn:hover {
  background: rgba(106, 211, 184, 0.12);
  border-color: rgba(106, 211, 184, 0.5);
}

/* Editor pane in the M40K split takes over the same slot the M40I textarea
   used; reuse the existing .m40g-news-split / divider / preview rules. */
.m40g-news-split > .m40g-news-editor {
  border-right: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
}
@media (max-width: 800px) {
  .m40g-news-split {
    grid-template-rows: minmax(280px, 50vh) 8px 1fr;
  }
  .m40g-news-split > .m40g-news-editor {
    border-right: 0;
    border-bottom: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.06));
  }
}

/* ---------------------------------------------------------------- */
/* M40J · Avatar render hardening                                    */
/* When an <img> is present (data-state="img" on the wrapper), kill */
/* the green initials background + text colour so they can't bleed  */
/* through a transparent image or the wrapper border.               */
/* ---------------------------------------------------------------- */
#userAvatar[data-state="img"] {
  background: transparent !important;
  color: transparent !important;
}
.side-nav-profile .avatar[data-state="img"] {
  background: transparent !important;
  color: transparent !important;
}
.m40g-avatar-affordance #profileAvatarPreview img {
  position: relative;
  z-index: 2;
}
/* When the topbar / side-nav avatar wrapper has an img child, give the img
   absolute positioning so it fully covers the wrapper. */
#userAvatar[data-state="img"] {
  position: relative;
}
#userAvatar[data-state="img"] > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}
.side-nav-profile .avatar[data-state="img"] {
  position: relative;
}
.side-nav-profile .avatar[data-state="img"] > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

/* M40J · Messages roster section headers + cold-row variant */
.m40g-ledger-msg-section {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--m40f-ink-3);
  margin: 0.65rem 0 0.35rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px dashed var(--m40f-line);
}
.m40g-ledger-msg-row.is-cold {
  opacity: 0.78;
}
.m40g-ledger-msg-row.is-cold:hover {
  opacity: 1;
}

/* ---------------------------------------------------------------- */
/* M40O · Workspace throughline footer (replaces the M40M arc)       */
/* Build · Connect · Launch — matches index.html positioning.        */
/* ---------------------------------------------------------------- */
.m40o-throughline {
  background: linear-gradient(
    135deg,
    rgba(106, 211, 184, 0.04),
    rgba(0, 180, 255, 0.03)
  );
  border-top: 1px solid rgba(106, 211, 184, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.2rem 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: center;
  text-align: center;
}
.m40o-throughline-pillars {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.7rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.m40o-throughline-pillar {
  color: #6ad3b8;
  font-weight: 600;
}
.m40o-throughline-dot {
  color: rgba(255, 255, 255, 0.3);
}
.m40o-throughline-blurb {
  margin: 0;
  max-width: 680px;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

/* ---------------------------------------------------------------- */
/* M40M · Shared CTA + form controls (outcomes, events, edit forms) */
/* ---------------------------------------------------------------- */
.m40m-cta {
  background: rgba(106, 211, 184, 0.1);
  border: 1px solid rgba(106, 211, 184, 0.4);
  color: #6ad3b8;
  border-radius: 6px;
  padding: 0.55rem 0.95rem;
  font-family: var(--font-display, inherit);
  font-size: 0.84rem;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.14s,
    border-color 0.14s,
    color 0.14s;
}
.m40m-cta:hover:not([disabled]) {
  background: rgba(106, 211, 184, 0.2);
  border-color: rgba(106, 211, 184, 0.7);
  color: #fff;
}
.m40m-cta[disabled] {
  opacity: 0.55;
  cursor: progress;
}
.m40m-cta.is-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-secondary, rgba(255, 255, 255, 0.65));
}
.m40m-cta.is-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.m40m-cta.is-small {
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
}
.m40m-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  flex: 1 1 0;
}
.m40m-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.m40m-field-row > .m40m-field {
  min-width: 140px;
}
.m40m-input {
  background: var(--m40f-bg-2, #14191f);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  color: var(--text-primary, #e9edf3);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  width: 100%;
  resize: vertical;
}
.m40m-input:focus {
  outline: 0;
  border-color: rgba(106, 211, 184, 0.55);
}
.m40m-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}
.m40m-checkbox {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
}
.m40m-checkbox input {
  width: auto;
}

/* ---------------------------------------------------------------- */
/* M40M · Outcomes Ledger (Founder Ops → Outcomes)                   */
/* ---------------------------------------------------------------- */
.m40m-outcomes-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.7rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px dashed var(--m40f-line, rgba(255, 255, 255, 0.06));
}
.m40m-outcomes-toolbar p {
  margin: 0;
  flex: 1 1 320px;
  font-size: 0.82rem;
  line-height: 1.55;
}
.m40m-outcomes-form {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.m40m-outcomes-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.m40m-outcomes-row {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 0.95rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.m40m-outcomes-row[data-type="exit"] {
  border-color: rgba(244, 183, 64, 0.35);
}
.m40m-outcomes-row[data-type="valuation"],
.m40m-outcomes-row[data-type="funding"] {
  border-color: rgba(106, 211, 184, 0.35);
}
.m40m-outcomes-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}
.m40m-outcomes-type {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6ad3b8;
}
.m40m-outcomes-amount {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffd166;
}
.m40m-outcomes-pill {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.14em;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: rgba(106, 211, 184, 0.18);
  border: 1px solid rgba(106, 211, 184, 0.45);
  color: #6ad3b8;
}
.m40m-outcomes-date {
  margin-left: auto;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--m40f-ink-3, rgba(255, 255, 255, 0.45));
}
.m40m-outcomes-headline {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.45;
}
.m40m-outcomes-narrative {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}
.m40m-outcomes-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--m40f-ink-3, rgba(255, 255, 255, 0.45));
}
.m40m-outcomes-meta a {
  color: #6ad3b8;
  text-decoration: none;
}
.m40m-outcomes-meta a:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------------- */
/* M40M · Events authoring (Events tab, founder host below list)     */
/* ---------------------------------------------------------------- */
.m40m-events-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.7rem;
  margin-bottom: 0.9rem;
  border-top: 1px dashed var(--m40f-line, rgba(255, 255, 255, 0.06));
  border-bottom: 1px dashed var(--m40f-line, rgba(255, 255, 255, 0.06));
  padding-top: 0.9rem;
}
.m40m-events-toolbar p {
  margin: 0;
  flex: 1 1 280px;
  font-size: 0.82rem;
  line-height: 1.55;
}
.m40m-events-form {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.m40m-events-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.m40m-events-row {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 0.95rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.m40m-events-row[data-status="cancelled"] {
  opacity: 0.55;
  border-style: dashed;
}
.m40m-events-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}
.m40m-events-type {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #6ad3b8;
}
.m40m-events-status {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.14em;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--m40f-line, rgba(255, 255, 255, 0.08));
}
.m40m-events-status.is-upcoming {
  color: #6ad3b8;
  border-color: rgba(106, 211, 184, 0.45);
}
.m40m-events-status.is-live {
  color: #ffd166;
  border-color: rgba(255, 209, 102, 0.45);
}
.m40m-events-status.is-completed {
  color: var(--m40f-ink-3, rgba(255, 255, 255, 0.45));
}
.m40m-events-status.is-cancelled {
  color: #e57373;
  border-color: rgba(229, 115, 115, 0.4);
}
.m40m-events-date {
  margin-left: auto;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--m40f-ink-3, rgba(255, 255, 255, 0.45));
}
.m40m-events-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.4;
}
.m40m-events-desc {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}
.m40m-events-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  font-size: 0.78rem;
  color: var(--m40f-ink-3, rgba(255, 255, 255, 0.55));
}
.m40m-events-meta a {
  color: #6ad3b8;
  text-decoration: none;
}
.m40m-events-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.3rem;
}

/* M40M project edit form re-uses .m40l-projects-form shell + .m40l-projects-cta. */
.m40m-projects-edit-form {
  margin-top: 0.5rem;
}

/* ---------------------------------------------------------------- */
/* M40N · Workbench breadcrumb + page-feel header                    */
/* ---------------------------------------------------------------- */
.m40n-page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-muted, rgba(255, 255, 255, 0.45));
}
.m40n-page-back {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  transition:
    background 0.14s,
    color 0.14s,
    border-color 0.14s;
}
.m40n-page-back:hover {
  background: rgba(106, 211, 184, 0.1);
  border-color: rgba(106, 211, 184, 0.4);
  color: #6ad3b8;
}
.m40n-page-crumb-sep {
  color: var(--text-muted, rgba(255, 255, 255, 0.3));
}
.m40n-page-crumb-tab {
  color: var(--text-secondary, rgba(255, 255, 255, 0.65));
  text-transform: uppercase;
}
.m40n-page-crumb-current {
  color: var(--text-primary, #e9edf3);
  font-weight: 600;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- */
/* M40N · Tasks module (the magnum-opus contribution surface)        */
/* ---------------------------------------------------------------- */
.m40n-tasks-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.m40n-tasks-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border, rgba(255, 255, 255, 0.06));
}
.m40n-tasks-head .v2-kicker {
  flex: 1 1 auto;
}
.m40n-tasks-error {
  color: #e57373;
  font-size: 0.78rem;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.m40n-task-composer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.m40n-task-add {
  align-self: flex-start;
  padding: 0.45rem 0.85rem;
  background: rgba(106, 211, 184, 0.1);
  border: 1px dashed rgba(106, 211, 184, 0.4);
  color: #6ad3b8;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}
.m40n-task-add:hover {
  background: rgba(106, 211, 184, 0.18);
  border-style: solid;
}
.m40n-task-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.m40n-task-input {
  background: var(--m40f-bg-2, #14191f);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  color: var(--text-primary, #e9edf3);
  border-radius: 5px;
  padding: 0.45rem 0.65rem;
  font-family: inherit;
  font-size: 0.86rem;
  flex: 1 1 auto;
  min-width: 0;
}
.m40n-task-input:focus {
  outline: 0;
  border-color: rgba(106, 211, 184, 0.6);
}
.m40n-task-pick {
  flex: 0 1 auto;
  min-width: 130px;
}
.m40n-task-save {
  background: rgba(106, 211, 184, 0.2);
  border: 1px solid rgba(106, 211, 184, 0.5);
  color: #6ad3b8;
  border-radius: 5px;
  padding: 0.45rem 0.95rem;
  font-size: 0.84rem;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
}
.m40n-task-save:hover:not([disabled]) {
  background: rgba(106, 211, 184, 0.3);
  color: #fff;
}
.m40n-task-save[disabled] {
  opacity: 0.55;
  cursor: progress;
}
.m40n-task-cancel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  border-radius: 5px;
  padding: 0.45rem 0.85rem;
  font-size: 0.84rem;
  cursor: pointer;
  font-family: inherit;
}
.m40n-tasks-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.m40n-tasks-group.is-archived {
  opacity: 0.5;
}
.m40n-tasks-group-head {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted, rgba(255, 255, 255, 0.45));
  padding-top: 0.4rem;
}
.m40n-task-row-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.06));
  border-radius: 6px;
  transition: border-color 0.14s;
}
.m40n-task-row-card:hover {
  border-color: rgba(106, 211, 184, 0.3);
}
.m40n-task-row-card[data-status="done"] {
  opacity: 0.7;
}
.m40n-task-row-card[data-status="done"] .m40n-task-title {
  text-decoration: line-through;
  text-decoration-color: rgba(255, 255, 255, 0.35);
}
.m40n-task-status {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  cursor: pointer;
  flex: 0 0 auto;
  font-weight: 600;
  white-space: nowrap;
  transition:
    background 0.14s,
    border-color 0.14s,
    color 0.14s;
}
.m40n-task-status:not([disabled]):hover {
  background: rgba(106, 211, 184, 0.18);
  border-color: rgba(106, 211, 184, 0.5);
  color: #fff;
}
.m40n-task-status[disabled] {
  cursor: not-allowed;
  opacity: 0.7;
}
.m40n-task-status.is-open {
  background: rgba(244, 183, 64, 0.12);
  border-color: rgba(244, 183, 64, 0.4);
  color: #f4b740;
}
.m40n-task-status.is-in_progress {
  background: rgba(0, 180, 255, 0.12);
  border-color: rgba(0, 180, 255, 0.4);
  color: #00b4ff;
}
.m40n-task-status.is-done {
  background: rgba(106, 211, 184, 0.18);
  border-color: rgba(106, 211, 184, 0.5);
  color: #6ad3b8;
}
.m40n-task-status.is-blocked {
  background: rgba(229, 115, 115, 0.15);
  border-color: rgba(229, 115, 115, 0.45);
  color: #e57373;
}
.m40n-task-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}
.m40n-task-title {
  font-size: 0.9rem;
  color: var(--text-primary, #e9edf3);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m40n-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--text-muted, rgba(255, 255, 255, 0.42));
}
.m40n-task-prio {
  text-transform: uppercase;
}
.m40n-task-due {
  color: var(--accent-amber, #f4b740);
}
.m40n-task-attribution {
  background: rgba(106, 211, 184, 0.12);
  border: 1px solid rgba(106, 211, 184, 0.4);
  color: #6ad3b8;
  padding: 0.06rem 0.4rem;
  border-radius: 999px;
  text-transform: uppercase;
  cursor: help;
}
.m40n-task-assignee {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.m40n-task-assignee-name {
  font-size: 0.78rem;
  color: var(--text-secondary, rgba(255, 255, 255, 0.65));
  white-space: nowrap;
}
.m40n-task-claim {
  background: rgba(106, 211, 184, 0.1);
  border: 1px solid rgba(106, 211, 184, 0.4);
  color: #6ad3b8;
  border-radius: 4px;
  padding: 0.25rem 0.55rem;
  font-size: 0.74rem;
  cursor: pointer;
  font-family: inherit;
}
.m40n-task-claim:hover {
  background: rgba(106, 211, 184, 0.2);
  color: #fff;
}

/* M40N · Document review chip on M40L doc rows */
.m40l-projects-doc-row.is-needs-review {
  border-color: rgba(244, 183, 64, 0.4);
  background: rgba(244, 183, 64, 0.05);
}
.m40l-projects-doc-title-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.m40n-doc-review-chip {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(244, 183, 64, 0.18);
  border: 1px solid rgba(244, 183, 64, 0.5);
  color: #f4b740;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.14em;
}

@media (max-width: 760px) {
  .m40n-task-row-card {
    flex-wrap: wrap;
  }
  .m40n-task-assignee {
    width: 100%;
  }
}

/* ================================================================ */
/* M40O · Project side-rail (replaces the M40M project drawer)       */
/* ================================================================ */

/* Backdrop dims the shell when the rail is open. */
.m40o-rail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 13, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 9990;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.m40o-rail-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* The rail itself — slides in from the right. Mint channel via the
   data-mah-mode="project" override below. */
.m40o-rail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: clamp(420px, 62vw, 920px);
  background: #0a0d12;
  border-left: 1px solid rgba(106, 211, 184, 0.25);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.45);
  z-index: 9991;
  transform: translateX(100%);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.m40o-rail.is-open {
  transform: translateX(0);
}

/* When the rail is open, dim the shell behind it via attribute selector
   (set on document.body by the rail module). */
body[data-mah-mode="project"] #appShell {
  filter: saturate(0.7) brightness(0.85);
  transition: filter 0.2s ease;
}
body[data-mah-mode="project"] {
  overflow: hidden;
}

/* Rail header — sticky, holds breadcrumb + close + "Open in Workbench"
   + the join button when relevant. */
.m40o-rail-head {
  position: sticky;
  top: 0;
  background: linear-gradient(
    180deg,
    rgba(106, 211, 184, 0.08),
    rgba(106, 211, 184, 0.02)
  );
  border-bottom: 1px solid rgba(106, 211, 184, 0.2);
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 2;
}
.m40o-rail-crumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted, rgba(255, 255, 255, 0.45));
}
.m40o-rail-close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  transition:
    background 0.14s,
    color 0.14s;
}
.m40o-rail-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.m40o-rail-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}
.m40o-rail-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted, rgba(255, 255, 255, 0.5));
}
.m40o-rail-status-pill {
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(106, 211, 184, 0.4);
  background: rgba(106, 211, 184, 0.1);
  color: #6ad3b8;
}
.m40o-rail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Rail body — scrolls. Contains About-view + (member content OR locked previews). */
.m40o-rail-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.m40o-rail-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  position: relative;
}
.m40o-rail-section h4 {
  margin: 0 0 0.6rem;
  font-size: 0.92rem;
  font-weight: 600;
}
.m40o-rail-desc {
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  line-height: 1.65;
  font-size: 0.88rem;
  white-space: pre-wrap;
}

/* Locked preview — shows for non-members. One CTA: "Join the project". */
.m40o-locked {
  border-style: dashed;
  border-color: rgba(106, 211, 184, 0.35);
  background: rgba(106, 211, 184, 0.02);
}
.m40o-locked-preview {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
  margin-bottom: 0.7rem;
}
.m40o-locked-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  background: rgba(106, 211, 184, 0.1);
  border: 1px solid rgba(106, 211, 184, 0.4);
  color: #6ad3b8;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.14s;
}
.m40o-locked-cta:hover {
  background: rgba(106, 211, 184, 0.2);
  color: #fff;
}

.m40o-rail-cta {
  background: rgba(106, 211, 184, 0.18);
  border: 1px solid rgba(106, 211, 184, 0.5);
  color: #6ad3b8;
  border-radius: 6px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.14s;
}
.m40o-rail-cta:hover {
  background: rgba(106, 211, 184, 0.3);
  color: #fff;
}
.m40o-rail-cta.is-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}
.m40o-rail-cta.is-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Application-pending banner (after submitting, before PI accepts). */
.m40o-rail-pending {
  background: rgba(244, 183, 64, 0.1);
  border: 1px solid rgba(244, 183, 64, 0.4);
  color: #f4b740;
  border-radius: 6px;
  padding: 0.7rem 0.95rem;
  font-size: 0.85rem;
}

/* Welcome banner (after PI accepts). */
.m40o-rail-welcome {
  background: rgba(106, 211, 184, 0.12);
  border: 1px solid rgba(106, 211, 184, 0.45);
  color: #6ad3b8;
  border-radius: 6px;
  padding: 0.7rem 0.95rem;
  font-size: 0.88rem;
}

/* Mobile: rail becomes a fullscreen sheet. */
@media (max-width: 800px) {
  .m40o-rail {
    width: 100vw;
    border-left: 0;
  }
  body[data-mah-mode="project"] #appShell {
    filter: none;
  }
}

/* ================================================================ */
/* M40O · Join modal                                                 */
/* ================================================================ */
.m40o-join-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 13, 0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9995;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: m40o-fade-in 0.18s ease;
}
@keyframes m40o-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.m40o-join-modal {
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: #0f141b;
  border: 1px solid rgba(106, 211, 184, 0.3);
  border-radius: 12px;
  padding: 1.6rem 1.7rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
.m40o-join-modal h3 {
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
}
.m40o-join-modal-sub {
  margin: 0 0 1.1rem;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  font-size: 0.88rem;
  line-height: 1.55;
}
.m40o-join-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
}
.m40o-join-field label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
}
.m40o-join-field textarea,
.m40o-join-field input {
  background: var(--m40f-bg-2, #14191f);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #e9edf3);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  width: 100%;
  resize: vertical;
}
.m40o-join-field textarea:focus,
.m40o-join-field input:focus {
  outline: 0;
  border-color: rgba(106, 211, 184, 0.55);
}
.m40o-join-field-hint {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.62rem;
  color: var(--text-muted, rgba(255, 255, 255, 0.45));
  align-self: flex-end;
}
.m40o-join-understand {
  background: rgba(106, 211, 184, 0.05);
  border: 1px solid rgba(106, 211, 184, 0.25);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 0.6rem 0 1rem;
}
.m40o-join-understand-head {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.m40o-join-understand-head input[type="checkbox"] {
  margin-top: 0.2rem;
  flex: 0 0 auto;
}
.m40o-join-understand-head label {
  font-size: 0.86rem;
  color: var(--text-primary, #e9edf3);
  font-weight: 600;
  cursor: pointer;
}
.m40o-join-understand ol {
  margin: 0.4rem 0 0 1.4rem;
  padding: 0;
  font-size: 0.82rem;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  line-height: 1.55;
}
.m40o-join-understand ol li {
  margin: 0.18rem 0;
}
.m40o-join-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.m40o-join-success {
  text-align: center;
  padding: 2rem 1rem;
}
.m40o-join-success-mark {
  font-size: 3rem;
  color: #6ad3b8;
  line-height: 1;
}
.m40o-join-success-headline {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0.6rem 0 0.4rem;
}
.m40o-join-success-sub {
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  font-size: 0.9rem;
}
.m40o-join-error {
  background: rgba(229, 115, 115, 0.1);
  border: 1px solid rgba(229, 115, 115, 0.4);
  color: #ffb4b4;
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
}

/* ================================================================ */
/* M40O · Impact tab (Artefacts + Certifications)                    */
/* ================================================================ */
.m40o-impact-tabs {
  display: flex;
  gap: 0.4rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  padding-bottom: 0.5rem;
  margin-bottom: 0.9rem;
}
.m40o-impact-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
}
.m40o-impact-tab.is-active {
  background: rgba(106, 211, 184, 0.12);
  color: #6ad3b8;
  border-color: rgba(106, 211, 184, 0.35);
}
.m40o-impact-section {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.m40o-impact-section-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.m40o-impact-section-head .v2-kicker {
  flex: 1 1 auto;
}
.m40o-impact-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.m40o-impact-row {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.7rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.m40o-impact-row.is-public {
  border-color: rgba(106, 211, 184, 0.45);
}
.m40o-impact-row.is-pending {
  border-color: rgba(244, 183, 64, 0.4);
  background: rgba(244, 183, 64, 0.03);
}
.m40o-impact-row-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.m40o-impact-kind,
.m40o-impact-cert-type {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6ad3b8;
}
.m40o-impact-status {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.14em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted, rgba(255, 255, 255, 0.5));
}
.m40o-impact-status.is-published,
.m40o-impact-status.is-verified {
  color: #6ad3b8;
  border-color: rgba(106, 211, 184, 0.45);
  background: rgba(106, 211, 184, 0.1);
}
.m40o-impact-status.is-under_review,
.m40o-impact-status.is-submitted {
  color: #f4b740;
  border-color: rgba(244, 183, 64, 0.45);
  background: rgba(244, 183, 64, 0.08);
}
.m40o-impact-public-pill {
  margin-left: auto;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.14em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(106, 211, 184, 0.18);
  border: 1px solid rgba(106, 211, 184, 0.45);
  color: #6ad3b8;
}
.m40o-impact-title {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  font-weight: 600;
}
.m40o-impact-title a {
  color: var(--text-primary, #e9edf3);
  text-decoration: none;
}
.m40o-impact-title a:hover {
  color: #6ad3b8;
  text-decoration: underline;
}
.m40o-impact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-muted, rgba(255, 255, 255, 0.42));
}
.m40o-impact-narrative {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}
.m40o-impact-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* M40O modal-form base used by Add Artefact + Submit Certification. */
.m40o-modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(106, 211, 184, 0.25);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin-bottom: 0.9rem;
}
.m40o-modal-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.m40o-modal-form label > span {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted, rgba(255, 255, 255, 0.5));
}
.m40o-modal-form input,
.m40o-modal-form select,
.m40o-modal-form textarea {
  background: var(--m40f-bg-2, #14191f);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #e9edf3);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
  width: 100%;
}
.m40o-modal-form input:focus,
.m40o-modal-form select:focus,
.m40o-modal-form textarea:focus {
  outline: 0;
  border-color: rgba(106, 211, 184, 0.55);
}
.m40o-modal-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.m40o-modal-form-row > label {
  flex: 1 1 0;
  min-width: 130px;
}

/* M40O dot-pulse tour (no overlay — ambient pulses on existing surfaces) */
@keyframes m40o-dot-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(106, 211, 184, 0.7);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(106, 211, 184, 0);
  }
}
.m40o-pulsing {
  animation: m40o-dot-pulse 1.5s ease-out 3;
  border-radius: 8px;
}
