/*
 * 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;
}

/* Day mode now mirrors the new "rounds" / paper landing palette
   (warm parchment + navy ink + deep mint accent). Night block above
   is unchanged. Category colours (--v2-purple / --v2-green / --v2-orange)
   stay as-is because they encode meaning (project / outcome / research)
   that doesn't change between modes. */
html[data-mah-theme="day"] .v2-scope {
  --v2-bg-1: #fdfaf3;
  --v2-bg-2: #f0e9dd;
  --v2-bg-3: #e6dccb;
  --v2-line: rgba(22, 32, 60, 0.1);
  --v2-line-strong: rgba(22, 32, 60, 0.22);
  --v2-ink-0: #16203c;
  --v2-ink-1: #3a4663;
  --v2-ink-2: #5e6a85;
  --v2-ink-3: #7e8aa3;
  --v2-mint: #18b585;
  --v2-amber: #b3851f;
  --v2-purple: #6f4bc2;
  --v2-green: #168347;
  --v2-orange: #b45514;
  --v2-danger: #b4233c;
}

/* ---------------------------------------------------------------- */
/* 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);
}
/* Sprint W1.4/W2.1 — extras for Spinup + Drift panes */
.v2-pill-cyan {
  color: #67e8f9;
  border-color: rgba(103, 232, 249, 0.35);
  background: rgba(103, 232, 249, 0.08);
}
.v2-pill-red {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}
.v2-pill-grey {
  color: rgba(255, 255, 255, 0.5);
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
}
.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;
}

/* Day mode now mirrors the new "rounds" / paper landing palette
   (warm parchment + navy ink + deep mint accent). Night block above
   is unchanged. */
html[data-mah-theme="day"] .m40f-shell {
  --m40f-bg-0: #faf6ee;
  --m40f-bg-1: #fdfaf3;
  --m40f-bg-2: #f0e9dd;
  --m40f-bg-3: #e6dccb;
  --m40f-line: rgba(22, 32, 60, 0.12);
  --m40f-line-strong: rgba(22, 32, 60, 0.24);
  --m40f-ink-0: #16203c;
  --m40f-ink-1: #3a4663;
  --m40f-ink-2: #5e6a85;
  --m40f-ink-3: #7e8aa3;
  --m40f-mint: #18b585;
  --m40f-warm: #b3851f;
  --m40f-danger: #b4233c;
}

html[data-mah-theme="day"] .m40f-shell .side-nav,
html[data-mah-theme="day"] .m40f-shell .top-bar,
html[data-mah-theme="day"] .m40f-shell .m40f-ledger-rail {
  box-shadow: 0 14px 40px rgba(23, 33, 43, 0.08);
}

html[data-mah-theme="day"] .m40f-shell .side-nav-profile {
  background: rgba(255, 255, 255, 0.66);
}

html[data-mah-theme="day"] .m40f-shell .side-nav-profile .name {
  color: var(--m40f-ink-0);
}

/* Side-nav editorial restyle ------------------------------------ */
.m40f-shell .side-nav-header {
  position: relative;
}
body.mah-has-dev-preview-banner .m40f-shell .side-nav-header {
  padding-top: calc(0.5rem + 34px);
}
.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);
}
.m52-rail-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.55rem 0.95rem 0;
}
.m52-rail-mode-btn {
  background: var(--m40f-bg-1);
  border: 1px solid var(--m40f-line);
  border-radius: 5px;
  color: var(--m40f-ink-2);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.38rem 0.5rem;
  cursor: pointer;
}
.m52-rail-mode-btn:hover {
  color: var(--m40f-ink-0);
  border-color: var(--m40f-line-strong);
}
.m52-rail-mode-btn.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-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);
}
.m52-mobile-rail-close {
  display: none;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  margin-left: 0.25rem;
  border: 1px solid var(--m40f-line);
  border-radius: 6px;
  background: var(--m40f-bg-1);
  color: var(--m40f-ink-1);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.m52-mobile-rail-close:hover,
.m52-mobile-rail-close:focus-visible {
  color: var(--m40f-ink-0);
  border-color: var(--m40f-line-strong);
  outline: 0;
}
.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;
  }
  .m52-mobile-rail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    border: 0;
    background: rgba(5, 8, 13, 0.48);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    cursor: pointer;
  }
  .m52-mobile-rail-backdrop[hidden] {
    display: none !important;
  }
  .m40f-shell.is-mobile-rail-open .m40f-ledger-rail {
    display: flex;
    top: calc(
      var(--mah-header-height, 44px) + var(--mah-member-dev-offset, 0px)
    );
    right: 0;
    bottom: 0;
    width: min(92vw, 420px);
    max-width: 420px;
    z-index: 999;
    border-left: 1px solid var(--m40f-line);
    border-top: 1px solid var(--m40f-line);
    border-radius: 10px 0 0 0;
    box-shadow: -20px 0 48px rgba(0, 0, 0, 0.28);
  }
  .m40f-shell.is-mobile-rail-open .m40f-ledger-rail > * {
    visibility: visible;
  }
  .m40f-shell.is-mobile-rail-open .m52-mobile-rail-close {
    display: inline-flex;
  }
  .m40f-shell.is-mobile-rail-open .m40g-ledger-toggle {
    display: none;
  }
  .m40f-shell.is-rail-collapsed.is-mobile-rail-open .m40f-ledger-rail {
    width: min(92vw, 420px);
  }
  body.mah-has-dev-preview-banner
    .m40f-shell.is-mobile-rail-open
    .m40f-ledger-rail {
    top: calc(
      var(--mah-header-height, 44px) + var(--mah-member-dev-offset, 0px) + 48px
    ) !important;
  }
  body.mah-has-dev-preview-banner .m52-mobile-rail-backdrop {
    top: calc(
      var(--mah-header-height, 44px) + var(--mah-member-dev-offset, 0px) + 48px
    ) !important;
  }
}

/* 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:
    "center"
    "left"
    "right";
  gap: 0.85rem;
  align-items: stretch;
  margin-top: 0.8rem;
}

/* Push 8 — Gmail labels band, full-width row beneath the artifact shell */
.m40-rl-gmail-band {
  margin-top: 1.4rem;
  padding: 0.9rem 1rem 1rem;
  background: var(--v2-bg-1);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
}
.m40-rl-gmail-band .m40-section-head {
  margin-bottom: 0.6rem;
}
.m40-rl-gmail-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.m40-rl-gmail-row {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr) 5rem 4.5rem;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.45rem 0.55rem;
  border-radius: 4px;
  color: inherit;
  text-decoration: none;
  font-size: 0.86rem;
  transition: background-color 0.12s ease;
}
.m40-rl-gmail-row:hover {
  background: var(--v2-bg-2, rgba(255, 255, 255, 0.04));
}
.m40-rl-gmail-code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--v2-accent, currentColor);
}
.m40-rl-gmail-subject {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m40-rl-gmail-count {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  opacity: 0.75;
  text-align: right;
}
.m40-rl-gmail-age {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  text-align: right;
}
@media (max-width: 640px) {
  .m40-rl-gmail-row {
    grid-template-columns: 5.5rem minmax(0, 1fr) 3.4rem;
  }
  .m40-rl-gmail-age {
    display: none;
  }
}
.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-artifact-body {
    display: flex;
    flex-direction: column;
    max-height: none;
  }
  .m40-rl-artifact-editor {
    min-height: 240px;
    border-right: 0;
    border-bottom: 1px solid var(--v2-line, rgba(255, 255, 255, 0.06));
  }
  .m40-rl-artifact-divider {
    display: none;
  }
  .m40-rl-artifact .m40-rl-preview-frame {
    min-height: 440px;
  }
}
.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.is-open .m40g-nav-group-head,
.m40g-nav-group-head:hover {
  color: var(--m40f-ink-1);
}
.m40g-nav-group-label {
  flex: 1 1 auto;
}
/* Section-level icon (M53b). Only visible when the rail is collapsed —
   in expanded mode it stays hidden so the group head keeps its compact
   uppercase label look. */
.m40g-nav-group-icon {
  display: none;
}
.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-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  opacity: 0.72;
}
.m40g-nav-item-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.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.is-active .m40g-nav-item-icon {
  opacity: 1;
}
.m40g-nav-item-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  flex-shrink: 0;
}

/* M53 · Desktop mini rail ---------------------------------------- */
.m53-sidebar-toggle {
  margin-left: auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Mint-tinted to stay visible against either sidebar background
     (day = #f6f8fb almost-white, night = oklch(0.145) near-black). */
  border: 1px solid
    color-mix(in oklab, var(--m40f-mint, #6ad3b8) 35%, transparent);
  border-radius: 7px;
  background: color-mix(in oklab, var(--m40f-mint, #6ad3b8) 8%, transparent);
  color: var(--m40f-mint, #6ad3b8);
  cursor: pointer;
  transition:
    color 0.14s,
    border-color 0.14s,
    background 0.14s,
    transform 0.14s;
}
.m53-sidebar-toggle:hover,
.m53-sidebar-toggle:focus-visible {
  border-color: color-mix(in oklab, var(--m40f-mint, #6ad3b8) 60%, transparent);
  background: color-mix(in oklab, var(--m40f-mint, #6ad3b8) 16%, transparent);
}
.m53-sidebar-toggle:active {
  transform: scale(0.96);
}
.m53-sidebar-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (min-width: 901px) {
  #appShell.app-shell-with-sidenav.m40f-shell.is-sidebar-collapsed {
    grid-template-columns: var(--mah-member-sidebar-width, 72px) minmax(0, 1fr) !important;
  }

  .m40f-shell.is-sidebar-collapsed .side-nav {
    width: var(--mah-member-sidebar-width, 72px);
    overflow: visible;
    z-index: 20;
  }

  .m40f-shell.is-sidebar-collapsed .side-nav-body {
    overflow-x: visible;
  }

  .m40f-shell.is-sidebar-collapsed .side-nav-header {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }

  .m40f-shell.is-sidebar-collapsed .side-nav-brand {
    justify-content: center;
    margin-bottom: 0.7rem;
  }

  .m40f-shell.is-sidebar-collapsed .side-nav-brand .brand__text,
  .m40f-shell.is-sidebar-collapsed .side-nav-profile .info,
  .m40f-shell.is-sidebar-collapsed .m40g-nav-group-label,
  .m40f-shell.is-sidebar-collapsed .m40g-nav-group-chevron,
  .m40f-shell.is-sidebar-collapsed .m40g-nav-item-label,
  .m40f-shell.is-sidebar-collapsed .side-nav-footer-item span:not(.ico) {
    display: none !important;
  }

  /* M53b — Group head becomes the only thing visible per group when
     the rail is collapsed: a single 42x40 icon button that opens a
     flyout with that group's items. No more flattened-icon stacks. */
  .m40f-shell.is-sidebar-collapsed .m40g-nav-group-head {
    position: relative;
    width: 42px;
    height: 40px;
    margin: 0 auto;
    padding: 0;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--m40f-ink-1);
  }
  .m40f-shell.is-sidebar-collapsed .m40g-nav-group-head:hover,
  .m40f-shell.is-sidebar-collapsed
    .m40g-nav-group.is-flyout-open
    .m40g-nav-group-head {
    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);
  }
  .m40f-shell.is-sidebar-collapsed .m40g-nav-group-icon {
    width: 19px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    opacity: 0.85;
  }
  .m40f-shell.is-sidebar-collapsed .m40g-nav-group-icon svg {
    width: 19px;
    height: 19px;
  }
  .m40f-shell.is-sidebar-collapsed .m40g-nav-group-head::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    pointer-events: none;
    opacity: 0;
    z-index: 10000;
    white-space: nowrap;
    padding: 0.42rem 0.58rem;
    border-radius: 6px;
    background: #17212b;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 34px rgba(23, 33, 43, 0.2);
    font-size: 11px;
    letter-spacing: 0.04em;
    transition:
      opacity 0.12s,
      transform 0.12s;
  }
  .m40f-shell.is-sidebar-collapsed .m40g-nav-group-head:hover::after,
  .m40f-shell.is-sidebar-collapsed .m40g-nav-group-head:focus-visible::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
  /* Hide the inline tooltip when the flyout itself is showing the items. */
  .m40f-shell.is-sidebar-collapsed
    .m40g-nav-group.is-flyout-open
    .m40g-nav-group-head::after {
    display: none;
  }

  .m40f-shell.is-sidebar-collapsed .m53-sidebar-toggle {
    position: absolute;
    top: 0.9rem;
    right: 0.45rem;
    width: 26px;
    height: 26px;
    background: color-mix(in oklab, var(--m40f-bg-1) 85%, transparent);
  }

  body.mah-has-dev-preview-banner
    .m40f-shell.is-sidebar-collapsed
    .m53-sidebar-toggle {
    top: calc(0.9rem + 34px);
  }

  .m40f-shell.is-sidebar-collapsed .side-nav-profile {
    justify-content: center;
    padding: 0.55rem 0;
  }

  .m40f-shell.is-sidebar-collapsed .m40g-nav {
    gap: 0.18rem;
    align-items: center;
    padding: 0.25rem 0;
  }

  .m40f-shell.is-sidebar-collapsed .m40g-nav-group {
    width: 100%;
    border-bottom: 0;
    padding: 0;
  }

  /* Hide individual items inline when collapsed — they live in the flyout. */
  .m40f-shell.is-sidebar-collapsed .m40g-nav-group-list {
    display: none !important;
  }

  /* Flyout panel: shown next to the collapsed rail when a group is opened.
     position:fixed so it floats above sibling groups + the main column.
     Top is set inline by JS to match the head's runtime y-position. */
  .m40f-shell.is-sidebar-collapsed
    .m40g-nav-group.is-flyout-open
    .m40g-nav-group-list {
    display: flex !important;
    flex-direction: column;
    gap: 0.18rem;
    position: fixed;
    left: calc(var(--mah-member-sidebar-width, 72px) + 8px);
    top: 0;
    min-width: 220px;
    max-width: 280px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 0.45rem;
    background: var(--m40f-bg-1, #0f141b);
    border: 1px solid var(--m40f-line, #1c2430);
    border-radius: 10px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
    z-index: 10001;
  }

  /* Inside the flyout, items render as full-width labelled rows — not icons. */
  .m40f-shell.is-sidebar-collapsed
    .m40g-nav-group.is-flyout-open
    .m40g-nav-item {
    width: 100%;
    height: auto;
    margin: 0;
    justify-content: flex-start;
    padding: 0.42rem 0.7rem;
    border-radius: 6px;
  }
  .m40f-shell.is-sidebar-collapsed
    .m40g-nav-group.is-flyout-open
    .m40g-nav-item-label {
    display: inline-block !important;
  }
  .m40f-shell.is-sidebar-collapsed
    .m40g-nav-group.is-flyout-open
    .m40g-nav-item::after {
    display: none;
  }

  .m40f-shell.is-sidebar-collapsed .side-nav-footer {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .m40f-shell.is-sidebar-collapsed .side-nav-footer-item {
    justify-content: center;
    min-height: 38px;
    padding-left: 0;
    padding-right: 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;
  }
}

/* M53 · Dashboard executive compact pass ------------------------- */
.m40f-shell #panel-dashboard .dash-section {
  padding-top: 1.6rem;
  padding-bottom: 2.4rem;
}
.m40f-shell #panel-dashboard .dash-section-inner {
  max-width: 1040px;
}
.m40f-shell #panel-dashboard .welcome-card {
  margin-bottom: 1.15rem;
  padding: 1.35rem 1.55rem;
  border-radius: 8px;
  background: linear-gradient(
    135deg,
    color-mix(in oklab, var(--m40f-mint) 8%, transparent),
    color-mix(in oklab, var(--m40f-warm) 5%, transparent)
  );
  border-color: color-mix(in oklab, var(--m40f-mint) 22%, var(--m40f-line));
}
.m40f-shell #panel-dashboard .welcome-card h2 {
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  margin-bottom: 0.25rem;
}
.m40f-shell #panel-dashboard .welcome-card p {
  max-width: 680px;
  line-height: 1.55;
}
.m40f-shell #panel-dashboard .quick-actions {
  margin-top: 1rem;
  gap: 0.55rem;
}
.m40f-shell #panel-dashboard .quick-btn {
  min-height: 34px;
  padding: 0.42rem 0.78rem;
  border-radius: 6px;
  background: var(--m40f-bg-1);
  border-color: var(--m40f-line);
  color: var(--m40f-ink-1);
}
.m40f-shell #panel-dashboard .quick-btn:hover {
  background: var(--m40f-bg-2);
  border-color: var(--m40f-line-strong);
  color: var(--m40f-ink-0);
  box-shadow: none;
}
.m40f-shell #panel-dashboard .pulse-row {
  gap: 0.75rem !important;
  margin: 1rem 0 1.25rem;
}
.m40f-shell #panel-dashboard .pulse-card {
  min-width: 128px;
  padding: 0.78rem 0.85rem;
  border-radius: 8px;
  text-align: left;
  background: var(--m40f-bg-1);
  border-color: var(--m40f-line);
}
.m40f-shell #panel-dashboard .pulse-card-val {
  font-size: 1.35rem;
  line-height: 1.05;
  text-shadow: none;
}
.m40f-shell #panel-dashboard .pulse-card-label {
  margin-top: 0.28rem;
  font-size: 0.57rem;
  letter-spacing: 0.1em;
}
.m40f-shell #panel-dashboard .dash-bindings-card {
  margin-top: 1rem !important;
  margin-bottom: 1.4rem;
  padding: 0.8rem 0.9rem !important;
  border-radius: 8px !important;
  background: var(--m40f-bg-1) !important;
  border-color: var(--m40f-line) !important;
}
.m40f-shell #panel-dashboard .dash-bindings-label {
  margin-bottom: 0.65rem !important;
  letter-spacing: 0.12em !important;
}
.m40f-shell #panel-dashboard .dash-bindings-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
  gap: 0.55rem !important;
}
.m40f-shell #panel-dashboard .dash-binding-link {
  min-height: 54px;
  padding: 0.62rem 0.72rem !important;
  border-radius: 7px !important;
  background: var(--m40f-bg-2) !important;
  border-color: var(--m40f-line) !important;
  color: var(--m40f-ink-0) !important;
}
.m40f-shell #panel-dashboard .dash-binding-link:hover {
  background: color-mix(
    in oklab,
    var(--m40f-mint) 6%,
    var(--m40f-bg-1)
  ) !important;
  border-color: color-mix(
    in oklab,
    var(--m40f-mint) 32%,
    var(--m40f-line)
  ) !important;
}

/* ---------------------------------------------------------------- */
/* 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;
  }
  .m40f-shell.is-mobile-rail-open.is-rail-collapsed .m40f-ledger-rail {
    width: min(92vw, 420px);
  }
  .m40f-shell.is-mobile-rail-open.is-rail-collapsed .m40f-ledger-rail > * {
    visibility: visible;
  }
}

/* ---------------------------------------------------------------- */
/* 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-code-review {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.m40-rl-code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.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;
}

/* ─── Day-mode raw-colour overrides (rounds palette swap, 2026-05-03) ───
   The members-v2.css below has many sites where #6ad3b8 (eucalyptus mint)
   and #f4b740 (eucalyptus amber) are hard-coded — they don't go through
   --m40f-* CSS vars. In night mode that's the correct accent. In day mode
   we now want the deeper rounds-palette mint (#18b585) and ochre (#b3851f).
   Rather than touch every line, a high-specificity override block here
   resolves them in day mode only. Night mode is untouched. */
html[data-mah-theme="day"] .m40f-shell .m40g-avatar-helper.is-ok,
html[data-mah-theme="day"] .m40f-shell .m40-rl-preview-action.is-on,
html[data-mah-theme="day"] .m40f-shell .m40-rl-preview-status.is-ok,
html[data-mah-theme="day"] .m40f-shell .m40g-avatar-fallback,
html[data-mah-theme="day"] .m40f-shell [class*="m40g-"][class*="-mint"] {
  color: var(--m40f-mint);
}
html[data-mah-theme="day"] .m40f-shell .m40-rl-preview-action.is-on {
  border-color: color-mix(in oklab, var(--m40f-mint) 55%, transparent);
  background: color-mix(in oklab, var(--m40f-mint) 8%, transparent);
}

/* ─── Inline-style attribute overrides for members.html ───
   The members.html monolith has ~18 inline `style="background:rgba(10,15,22,X)"`
   and `color:#00b4ff` / `#6ad3b8` / `#ffb800` snippets that the existing
   day-mode `[style*="background:rgba(10,15,22"]` catch-all already neutralises
   for backgrounds. This adds the same translation for the inline mint/cyan
   accent colours so day mode shows the rounds-palette accent instead of the
   night-mode eucalyptus / cyan. */
html[data-mah-theme="day"] .tab-panel [style*="color:#6ad3b8"],
html[data-mah-theme="day"] .tab-panel [style*="color: #6ad3b8"],
html[data-mah-theme="day"] .tab-panel [style*="color:#00b4ff"],
html[data-mah-theme="day"] .tab-panel [style*="color: #00b4ff"] {
  color: var(--axum-accent) !important;
}
html[data-mah-theme="day"] .tab-panel [style*="color:#ffb800"],
html[data-mah-theme="day"] .tab-panel [style*="color: #ffb800"],
html[data-mah-theme="day"] .tab-panel [style*="color:#f4b740"],
html[data-mah-theme="day"] .tab-panel [style*="color: #f4b740"] {
  color: var(--axum-warning) !important;
}
html[data-mah-theme="day"] .tab-panel [style*="background:rgba(106,211,184"],
html[data-mah-theme="day"] .tab-panel [style*="background: rgba(106,211,184"],
html[data-mah-theme="day"] .tab-panel [style*="background:rgba(0,180,255"],
html[data-mah-theme="day"] .tab-panel [style*="background: rgba(0,180,255"] {
  background: color-mix(
    in oklab,
    var(--axum-accent) 12%,
    transparent
  ) !important;
}
html[data-mah-theme="day"] .tab-panel [style*="background:rgba(255,184,0"],
html[data-mah-theme="day"] .tab-panel [style*="background: rgba(255,184,0"],
html[data-mah-theme="day"] .tab-panel [style*="background:rgba(244,183,64"],
html[data-mah-theme="day"] .tab-panel [style*="background: rgba(244,183,64"] {
  background: color-mix(
    in oklab,
    var(--axum-warning) 12%,
    transparent
  ) !important;
}
html[data-mah-theme="day"]
  .tab-panel
  [style*="border:1px solid rgba(106,211,184"],
html[data-mah-theme="day"]
  .tab-panel
  [style*="border: 1px solid rgba(106,211,184"],
html[data-mah-theme="day"]
  .tab-panel
  [style*="border:1px solid rgba(0,180,255"],
html[data-mah-theme="day"]
  .tab-panel
  [style*="border: 1px solid rgba(0,180,255"] {
  border-color: color-mix(
    in oklab,
    var(--axum-accent) 50%,
    transparent
  ) !important;
}
html[data-mah-theme="day"]
  .tab-panel
  [style*="border:1px solid rgba(255,184,0"],
html[data-mah-theme="day"]
  .tab-panel
  [style*="border: 1px solid rgba(255,184,0"] {
  border-color: color-mix(
    in oklab,
    var(--axum-warning) 50%,
    transparent
  ) !important;
}

/* ─── JS-injected styles (members-learning, dashboard-inbox, etc.) ───
   Same pattern: catch the hard-coded rgba()/hex tints injected from JS at
   runtime and route them through day-mode tokens. Class-prefix selectors
   keep the override scoped so we don't accidentally hit things like the
   AI console, which already uses var()-based colours. */
html[data-mah-theme="day"] .learning-module-tile,
html[data-mah-theme="day"] [class*="m40-dashboard-inbox"] [style*="#6ad3b8"],
html[data-mah-theme="day"]
  [class*="m40-dashboard-inbox"]
  [style*="rgba(106,211,184"] {
  /* Defer to the catch-all above; this scope just makes the tile and inbox
     surfaces play nicely with the parchment background. */
  background: var(--axum-bg-elev-1);
  border-color: color-mix(in oklab, var(--axum-accent) 22%, var(--axum-border));
}

/* ---------------------------------------------------------------- */
/* M60 Space Intelligence 3D planner                                 */
/* ---------------------------------------------------------------- */

.m60-space {
  --m60-bg: #050812;
  --m60-panel: #0f141b;
  --m60-line: rgba(255, 255, 255, 0.09);
  --m60-line-strong: rgba(255, 255, 255, 0.18);
  --m60-ink: #e9edf3;
  --m60-muted: #9aa5b4;
  --m60-faint: #6a7583;
  --m60-sky: #38bdf8;
  --m60-mint: #6ad3b8;
  --m60-danger: #ff8f8f;
  padding: 0.85rem;
  border: 1px solid var(--m60-line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(56, 189, 248, 0.06), transparent 18rem),
    var(--m60-bg);
  color: var(--m60-ink);
  container-type: inline-size;
}

.m60-space:fullscreen {
  width: 100vw;
  height: 100vh;
  padding: 0.85rem;
  overflow: hidden;
}

.m60-space:fullscreen .m60-layout {
  height: calc(100vh - 96px);
}

.m60-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.m60-head h3 {
  margin: 0.35rem 0 0;
  color: var(--m60-ink);
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  line-height: 1.1;
  letter-spacing: 0;
}

.m60-head p {
  max-width: 680px;
  margin: 0.45rem 0 0;
  color: var(--m60-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.m60-head-meta {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.m60-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 340px);
  gap: 0.85rem;
  height: clamp(540px, calc(100vh - 300px), 760px);
  min-height: 0;
}

.m60-layout > * {
  min-width: 0;
}

.m60-stage {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--m60-line);
  border-radius: 8px;
  background: var(--m60-bg);
  overscroll-behavior: contain;
}
.m60-stage:focus {
  outline: none;
}
.m60-stage:focus-visible {
  outline: 2px solid rgba(106, 211, 184, 0.55);
  outline-offset: 2px;
}

.m60-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.m60-scene-hud,
.m60-scene-summary,
.m60-issue-line,
.m60-status-line {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.68);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
}

.m60-scene-hud {
  top: 0.75rem;
  left: 0.75rem;
  max-width: min(360px, calc(100% - 1.5rem));
  padding: 0.72rem 0.8rem;
  border-radius: 8px;
}

.m60-scene-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 0.55rem;
  border: 1px solid rgba(56, 189, 248, 0.42);
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: #bae6fd;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.m60-scene-hud h4 {
  margin: 0.55rem 0 0;
  color: #f8fafc;
  font-size: 1rem;
  letter-spacing: 0;
}

.m60-scene-hud p {
  margin: 0.35rem 0 0;
  color: #cbd5e1;
  font-size: 0.78rem;
  line-height: 1.55;
}

.m60-scene-tools {
  position: absolute;
  z-index: 3;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 0.4rem;
  padding: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(14px);
}

.m60-scene-tools .m60-button {
  min-height: 32px;
  padding: 0.35rem 0.55rem;
  font-size: 0.7rem;
}

.m60-scene-summary {
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 0.75rem;
  border-radius: 8px;
  color: #e5e7eb;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.72rem;
}

.m60-scene-summary span {
  color: #9aa5b4;
}

.m60-status-line {
  right: 0.75rem;
  top: 4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  color: #bae6fd;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.m60-issue-line {
  left: 0.75rem;
  bottom: 5.2rem;
  max-width: min(560px, calc(100% - 1.5rem));
  padding: 0.45rem 0.65rem;
  border-color: rgba(255, 143, 143, 0.32);
  border-radius: 6px;
  background: rgba(127, 29, 29, 0.48);
  color: #fecaca;
  font-size: 0.74rem;
}

.m60-walk-pad {
  position: absolute;
  z-index: 3;
  left: 0.85rem;
  bottom: 5.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  width: 168px;
  padding: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(5, 8, 18, 0.74);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(16px);
  touch-action: none;
}

.m60-walk-pad[hidden] {
  display: none;
}

.m60-walk-pad-label {
  color: #bae6fd;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.m60-walk-pad-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.32rem;
}

.m60-walk-pad-spacer {
  min-height: 42px;
}

.m60-walk-btn,
.m60-walk-reset {
  min-height: 42px;
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.78);
  color: #e0f2fe;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.m60-walk-btn.is-active,
.m60-walk-btn:active,
.m60-walk-reset:active {
  border-color: rgba(106, 211, 184, 0.74);
  background: rgba(6, 78, 59, 0.7);
  color: #d1fae5;
  transform: translateY(1px);
}

.m60-walk-reset {
  width: 100%;
  min-height: 34px;
  color: #cbd5e1;
  font-size: 0.62rem;
}

html[data-mah-theme="day"] .m60-walk-pad {
  border-color: rgba(15, 23, 42, 0.14);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 52px rgba(15, 23, 42, 0.16);
}

html[data-mah-theme="day"] .m60-walk-pad-label {
  color: #0369a1;
}

html[data-mah-theme="day"] .m60-walk-btn,
html[data-mah-theme="day"] .m60-walk-reset {
  border-color: rgba(2, 132, 199, 0.28);
  background: rgba(240, 249, 255, 0.92);
  color: #0f172a;
}

html[data-mah-theme="day"] .m60-walk-btn.is-active,
html[data-mah-theme="day"] .m60-walk-btn:active,
html[data-mah-theme="day"] .m60-walk-reset:active {
  border-color: rgba(13, 148, 136, 0.6);
  background: rgba(204, 251, 241, 0.88);
  color: #134e4a;
}

.m60-action-tray {
  position: absolute;
  z-index: 4;
  top: 4.75rem;
  right: 0.75rem;
  bottom: 5.35rem;
  width: min(390px, calc(100% - 1.5rem));
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(5, 8, 18, 0.78);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
}
.m60-action-tray[hidden] {
  display: none;
}
.m60-tray-toggle {
  position: absolute;
  z-index: 5;
  right: 0.85rem;
  bottom: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.62rem 0.9rem;
  border: 1px solid rgba(56, 189, 248, 0.42);
  border-radius: 999px;
  background: rgba(5, 8, 18, 0.82);
  color: #dff6ff;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(16px);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}
.m60-tray-toggle:hover,
.m60-tray-toggle:focus-visible {
  border-color: rgba(106, 211, 184, 0.68);
  background: rgba(6, 78, 59, 0.58);
  outline: none;
}
.m60-tray-toggle[hidden] {
  display: none;
}

.m60-action-dock {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.28rem;
  padding: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.m60-action-dock .m60-button {
  min-height: 32px;
  padding: 0.34rem 0.28rem;
  font-size: 0.67rem;
}

.m60-action-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.7rem;
}

.m60-action-content {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.m60-action-title {
  color: #f8fafc;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.m60-action-tray .m60-minimap {
  height: 190px;
}

.m60-action-tray .m60-analysis-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.m60-selected-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.62rem 0.7rem;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.08);
}

.m60-selected-chip strong {
  min-width: 0;
  overflow: hidden;
  color: #e0f2fe;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m60-selected-chip span,
.m60-touch-help {
  color: var(--m60-faint);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.62rem;
  line-height: 1.45;
}

.m60-touch-help {
  padding: 0.58rem 0.65rem;
  border: 1px solid rgba(106, 211, 184, 0.22);
  border-radius: 6px;
  background: rgba(106, 211, 184, 0.06);
}

.m60-side {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.m60-panel {
  min-width: 0;
  border: 1px solid var(--m60-line);
  border-radius: 8px;
  background: rgba(15, 20, 27, 0.96);
  padding: 0.95rem;
  color: var(--m60-muted);
}

.m60-panel h4 {
  margin: 0 0 0.75rem;
  color: var(--m60-ink);
  font-size: 0.92rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.m60-segmented,
.m60-preset-grid,
.m60-nudge-grid {
  display: grid;
  gap: 0.45rem;
}

.m60-segmented {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.m60-segmented.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.m60-preset-grid,
.m60-nudge-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.m60-inline-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.m60-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  min-height: 38px;
  padding: 0.52rem 0.68rem;
  border: 1px solid var(--m60-line);
  border-radius: 6px;
  background: #111827;
  color: #d8dde4;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.25;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.m60-button:hover,
.m60-button.is-active {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.14);
  color: #e0f2fe;
}

.m60-button.is-danger {
  border-color: rgba(255, 143, 143, 0.28);
  background: rgba(127, 29, 29, 0.26);
  color: #fecaca;
}

.m60-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.m60-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.m60-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.m60-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--m60-line);
  border-radius: 6px;
  background: #090d15;
  color: var(--m60-muted);
  font-size: 0.76rem;
}

.m60-toggle input {
  accent-color: var(--m60-sky);
}

.m60-analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.m60-metric {
  min-height: 58px;
  padding: 0.62rem;
  border: 1px solid var(--m60-line);
  border-radius: 6px;
  background: #090d15;
}

.m60-metric span {
  display: block;
  color: var(--m60-faint);
  font-size: 0.68rem;
}

.m60-metric strong {
  display: block;
  margin-top: 0.18rem;
  color: var(--m60-ink);
  font-size: 0.9rem;
  line-height: 1.2;
}

.m60-metric.is-warning {
  border-color: rgba(255, 143, 143, 0.32);
  background: rgba(127, 29, 29, 0.18);
}

.m60-metric.is-warning strong {
  color: #fecaca;
}

.m60-dextron-note {
  grid-column: 1 / -1;
  padding: 0.7rem;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.06);
  color: var(--m60-muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.m60-dextron-note strong {
  color: #bae6fd;
}

.m60-minimap {
  display: block;
  width: 100%;
  height: 210px;
  border: 1px solid var(--m60-line);
  border-radius: 8px;
  background: #090d15;
  touch-action: none;
}

.m60-minimap rect[role="button"],
.m60-wall-handle {
  cursor: pointer;
}

.m60-plan-gridline {
  stroke: rgba(148, 163, 184, 0.16);
  stroke-width: 0.7;
  pointer-events: none;
}

.m60-plan-item {
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

.m60-plan-label {
  fill: #cbd5e1;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0;
  pointer-events: none;
}

.m60-plan-label.is-selected {
  fill: #bae6fd;
  font-weight: 700;
}

.m60-wall-handle circle {
  fill: #1f2937;
  stroke: rgba(203, 213, 225, 0.78);
  stroke-width: 2;
}

.m60-wall-handle.is-unlocked circle {
  fill: rgba(56, 189, 248, 0.22);
  stroke: #38bdf8;
}

.m60-wall-handle text {
  fill: #e0f2fe;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 8px;
  font-weight: 800;
  pointer-events: none;
}

.m60-suggestion-status {
  color: var(--m60-faint);
  font-size: 0.74rem;
  line-height: 1.45;
}

.m60-suggestion-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(210px, 76%);
  gap: 0.65rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding: 0 0 0.25rem;
}

.m60-suggestion-card {
  min-height: 260px;
  padding: 0.7rem;
  border: 1px solid var(--m60-line);
  border-radius: 8px;
  background: #090d15;
  color: var(--m60-muted);
  scroll-snap-align: start;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.m60-suggestion-card:hover,
.m60-suggestion-card:focus {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.08);
  outline: none;
  transform: translateY(-1px);
}

.m60-suggestion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  color: var(--m60-ink);
  font-size: 0.82rem;
  line-height: 1.25;
}

.m60-suggestion-head span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 24px;
  border: 1px solid rgba(106, 211, 184, 0.3);
  border-radius: 999px;
  color: #bff7e9;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.62rem;
}

.m60-suggestion-card p {
  margin: 0.55rem 0 0;
  font-size: 0.74rem;
  line-height: 1.45;
}

.m60-suggestion-mini {
  display: block;
  width: 100%;
  height: 116px;
  margin-top: 0.6rem;
  border: 1px solid var(--m60-line);
  border-radius: 6px;
  background: #07101b;
}

.m60-suggestion-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.6rem;
}

.m60-suggestion-tags span {
  padding: 0.18rem 0.38rem;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 999px;
  color: #bae6fd;
  font-size: 0.58rem;
}

.m60-suggestion-changes {
  margin: 0.55rem 0 0;
  padding-left: 1rem;
  color: var(--m60-faint);
  font-size: 0.68rem;
  line-height: 1.45;
}

.m60-form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.m60-form-grid {
  display: grid;
  gap: 0.55rem;
}

.m60-form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.m60-form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.m60-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.m60-field > span {
  color: var(--m60-faint);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.m60-field small {
  color: var(--m60-faint);
  font-size: 0.68rem;
  line-height: 1.45;
}

.m60-input,
.m60-textarea {
  width: 100%;
  border: 1px solid var(--m60-line);
  border-radius: 6px;
  background: #070b12;
  color: var(--m60-ink);
  font: inherit;
  font-size: 0.8rem;
  outline: none;
}

.m60-input {
  min-height: 38px;
  padding: 0.48rem 0.62rem;
}

.m60-input:focus,
.m60-textarea:focus {
  border-color: rgba(56, 189, 248, 0.5);
}

.m60-color {
  height: 38px;
  padding: 0.18rem;
}

.m60-textarea {
  min-height: 220px;
  padding: 0.7rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.7rem;
  line-height: 1.5;
  resize: vertical;
}

.m60-furniture-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.m60-row-button {
  display: block;
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--m60-line);
  border-radius: 6px;
  background: #090d15;
  color: var(--m60-muted);
  font: inherit;
  text-align: left;
}

.m60-row-button.is-selected {
  border-color: rgba(56, 189, 248, 0.48);
  background: rgba(56, 189, 248, 0.08);
}

.m60-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  color: var(--m60-ink);
  font-size: 0.82rem;
}

.m60-row-meta {
  display: block;
  margin-top: 0.25rem;
  color: var(--m60-faint);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.64rem;
}

.m60-ok {
  color: var(--m60-mint);
}

.m60-bad,
.m60-warning {
  color: #fecaca;
}

.m60-warning {
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(255, 143, 143, 0.32);
  border-radius: 6px;
  background: rgba(127, 29, 29, 0.2);
  font-size: 0.76rem;
}

.m60-muted {
  margin: 0;
  color: var(--m60-muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.m60-webgl-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem;
  background: #050812;
}

.m60-webgl-fallback h4 {
  margin: 0;
  color: var(--m60-ink);
}

.m60-webgl-fallback p {
  max-width: 520px;
  color: var(--m60-muted);
  line-height: 1.6;
}

@container (max-width: 900px) {
  .m60-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .m60-stage {
    height: clamp(560px, calc(100vh - 300px), 720px);
  }

  .m60-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@container (max-width: 620px) {
  .m60-side {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .m60-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .m60-stage {
    height: clamp(520px, 70vh, 680px);
  }

  .m60-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 760px) {
  .m60-space {
    padding: 0.65rem;
  }

  .m60-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .m60-head-meta {
    justify-content: flex-start;
  }

  .m60-stage {
    height: clamp(500px, 72vh, 620px);
  }

  .m60-scene-hud {
    top: 4.55rem;
    right: 0.75rem;
    max-width: none;
  }

  .m60-scene-tools {
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    bottom: auto;
    justify-content: flex-end;
    overflow-x: auto;
  }

  .m60-scene-tools .m60-button {
    width: 42px;
    min-width: 42px;
    padding: 0.5rem;
    font-size: 0;
  }

  .m60-scene-tools .m60-button svg {
    width: 17px;
    height: 17px;
  }

  .m60-status-line {
    top: 11.25rem;
    bottom: auto;
  }

  .m60-scene-summary {
    display: none;
  }

  .m60-issue-line {
    top: 13.75rem;
    bottom: auto;
  }

  .m60-walk-pad {
    left: 0.65rem;
    bottom: 4.7rem;
    width: 154px;
    padding: 0.48rem;
  }

  .m60-walk-pad-grid {
    gap: 0.28rem;
  }

  .m60-walk-pad-spacer,
  .m60-walk-btn {
    min-height: 40px;
  }

  .m60-action-tray {
    top: auto;
    left: 0.65rem;
    right: 0.65rem;
    bottom: 0.65rem;
    width: auto;
    max-height: min(54vh, 390px);
  }

  .m60-action-dock {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .m60-action-dock .m60-button {
    min-width: 74px;
    scroll-snap-align: start;
  }

  .m60-action-tray .m60-minimap {
    height: 220px;
  }

  .m60-action-tray .m60-nudge-grid,
  .m60-action-tray .m60-inline-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .m60-side {
    grid-template-columns: 1fr;
  }

  .m60-form-grid.two,
  .m60-form-grid.three,
  .m60-preset-grid,
  .m60-nudge-grid,
  .m60-inline-actions {
    grid-template-columns: 1fr;
  }
}

/* ════════════════════════════════════════════════════════════════
   Sprint W1.4 — Founder Console Spinup pane
   ════════════════════════════════════════════════════════════════ */
.fc-spinup-header {
  margin-bottom: 1.2rem;
}
.fc-spinup-header h3 {
  margin: 0 0 0.3rem;
}
.fc-spinup-tick-row {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  margin-top: 0.5rem;
}
.fc-spinup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
}
.fc-spinup-card {
  background: var(--v2-bg-1);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  padding: 0.85rem 1rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.fc-spinup-card-head {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.6rem;
}
.fc-spinup-code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--v2-accent, currentColor);
}
.fc-spinup-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.92rem;
}
.fc-spinup-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.fc-spinup-tile {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  padding: 0.16rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--v2-line);
}
.fc-spinup-tile.is-on {
  color: var(--v2-green);
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.1);
}
.fc-spinup-tile.is-off {
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.03);
}
.fc-spinup-last-error {
  font-size: 0.8rem;
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.06);
  padding: 0.4rem 0.55rem;
  border-radius: 4px;
  border: 1px solid rgba(248, 113, 113, 0.25);
}
.fc-spinup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.3rem;
}
.fc-spinup-btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  border-radius: 4px;
  border: 1px solid var(--v2-line);
  background: var(--v2-bg-2, rgba(255, 255, 255, 0.04));
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease;
}
.fc-spinup-btn:hover {
  border-color: var(--v2-accent, currentColor);
}
.fc-spinup-btn:disabled {
  opacity: 0.5;
  cursor: progress;
}
.fc-spinup-btn-approved {
  border-color: rgba(34, 197, 94, 0.45);
  color: var(--v2-green);
}
.fc-spinup-btn-in_progress {
  border-color: rgba(103, 232, 249, 0.45);
  color: #67e8f9;
}
.fc-spinup-btn-cancelled {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.6);
}
.fc-spinup-empty,
.fc-spinup-loading,
.fc-drift-empty,
.fc-drift-loading {
  padding: 1.4rem 1rem;
  text-align: center;
}

/* W1.5 — inline edit form for external-system IDs */
.fc-spinup-edit {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.5rem 0.2rem 0.2rem;
}
.fc-spinup-edit-row {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
}
.fc-spinup-edit-row label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--v2-ink-2, rgba(255, 255, 255, 0.65));
}
.fc-spinup-edit-row input {
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--v2-line);
  background: var(--v2-bg-2, rgba(255, 255, 255, 0.04));
  color: inherit;
  font-family: inherit;
  font-size: 0.8rem;
}
.fc-spinup-edit-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.4rem;
}
.fc-spinup-btn-edit {
  border-color: var(--v2-line);
  color: rgba(255, 255, 255, 0.7);
}

/* ════════════════════════════════════════════════════════════════
   Sprint W2.1 — Founder Console Drift pane
   ════════════════════════════════════════════════════════════════ */
.fc-drift-header {
  margin-bottom: 1.2rem;
}
.fc-drift-header h3 {
  margin: 0 0 0.3rem;
}
.fc-drift-grid {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.fc-drift-card {
  background: var(--v2-bg-1);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.fc-drift-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, auto) 1fr;
  align-items: baseline;
  gap: 0.6rem;
}
.fc-drift-code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--v2-accent, currentColor);
}
.fc-drift-when {
  text-align: right;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.fc-drift-diff {
  display: grid;
  grid-template-columns: 6rem 1fr;
  row-gap: 0.2rem;
  column-gap: 0.6rem;
  margin: 0;
  font-size: 0.85rem;
}
.fc-drift-diff dt {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}
.fc-drift-diff dd {
  margin: 0;
  word-break: break-all;
}
.fc-drift-card-foot {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.4rem;
}
.fc-drift-notes {
  flex: 1;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--v2-line);
  background: var(--v2-bg-2, rgba(255, 255, 255, 0.04));
  border-radius: 4px;
  color: inherit;
  font-family: inherit;
  font-size: 0.82rem;
}
.fc-drift-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 4px;
  border: 1px solid var(--v2-line);
  background: var(--v2-bg-2, rgba(255, 255, 255, 0.04));
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
}
.fc-drift-btn:hover {
  border-color: var(--v2-accent, currentColor);
}
.fc-drift-btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

/* ════════════════════════════════════════════════════════════════
   Sprint W2.2★ — Operations Cockpit
   ════════════════════════════════════════════════════════════════ */
.fcck-header {
  margin-bottom: 1.2rem;
}
.fcck-header h3 {
  margin: 0 0 0.3rem;
}
.fcck-loading {
  padding: 1.4rem 1rem;
  text-align: center;
}
.fcck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 0.9rem;
}
.fcck-panel {
  background: var(--v2-bg-1);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  padding: 0.85rem 1rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 160px;
}
.fcck-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  border-bottom: 1px solid var(--v2-line);
  padding-bottom: 0.4rem;
}
.fcck-panel-head h4 {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 600;
}
html[data-mah-theme="day"] .fcck-panel-head h4 {
  color: rgba(0, 0, 0, 0.78);
}
html[data-mah-theme="day"] .fcck-empty {
  color: rgba(0, 0, 0, 0.55);
}
html[data-mah-theme="day"] .fcck-header h3 {
  color: rgba(0, 0, 0, 0.92);
}
.fcck-jump {
  font-size: 0.7rem;
  background: transparent;
  border: none;
  color: var(--v2-accent, #67e8f9);
  cursor: pointer;
  font-family: inherit;
}
.fcck-jump:hover {
  text-decoration: underline;
}
.fcck-empty {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.45);
  padding: 0.5rem 0;
}

/* Pipeline ticks */
.fcck-tick-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.fcck-tick-row {
  display: grid;
  grid-template-columns: 12px auto 1fr;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}
.fcck-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.fcck-dot.is-ok {
  background: #4ade80;
}
.fcck-dot.is-err {
  background: #f87171;
}
.fcck-tick-when {
  font-variant-numeric: tabular-nums;
}

/* Signups */
.fcck-signup-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.fcck-signup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.fcck-signup-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}
.fcck-signup-name {
  font-size: 0.86rem;
}
.fcck-signup-when {
  font-size: 0.72rem;
}
.fcck-signup-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}
.fcck-mini-btn {
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  font-size: 0.72rem;
  border: 1px solid var(--v2-line);
  background: var(--v2-bg-2, rgba(255, 255, 255, 0.04));
  color: inherit;
  cursor: pointer;
  font-family: inherit;
}
.fcck-mini-btn-promote {
  border-color: rgba(34, 197, 94, 0.45);
  color: var(--v2-green, #4ade80);
}
.fcck-mini-btn-decline {
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}
.fcck-mini-btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

/* Telegram two-col */
.fcck-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.fcck-two-col > div h5 {
  margin: 0 0 0.3rem;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}
.fcck-tg-msg,
.fcck-tg-file {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0.3rem;
  font-size: 0.76rem;
  padding: 0.18rem 0;
}
.fcck-tg-sender {
  font-weight: 600;
}
.fcck-tg-body {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fcck-tg-when {
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}
.fcck-tg-link {
  color: var(--v2-accent, #67e8f9);
  text-decoration: none;
}
.fcck-tg-link:hover {
  text-decoration: underline;
}
@media (max-width: 700px) {
  .fcck-two-col {
    grid-template-columns: 1fr;
  }
}

/* Money */
.fcck-money-headline {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.3rem 0;
}
.fcck-money-num {
  font-family: var(--font-display, ui-serif, serif);
  font-size: 1.5rem;
  color: var(--v2-green, #4ade80);
}
.fcck-money-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.fcck-money-row {
  display: grid;
  grid-template-columns: 4rem 1fr auto auto;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.78rem;
}
.fcck-money-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.fcck-money-who {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fcck-money-when {
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

/* Spinup state grid (6 cells) */
.fcck-spin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}
.fcck-spin-cell {
  background: var(--v2-bg-2, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--v2-line);
  border-radius: 4px;
  padding: 0.4rem 0.55rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.fcck-spin-n {
  font-family: var(--font-display, ui-serif, serif);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

/* Drift summary */
.fcck-drift-headline {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.3rem 0;
}
.fcck-drift-num {
  font-family: var(--font-display, ui-serif, serif);
  font-size: 1.5rem;
  color: #fca5a5;
}
.fcck-drift-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.fcck-drift-tr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}
.fcck-drift-n {
  font-variant-numeric: tabular-nums;
}

/* ─────────────────────────────────────────────────────────
   Books — Founder Ops > Books pane (expense + hours logger)
   ───────────────────────────────────────────────────────── */
#ops-view-books .books-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  padding: 0.4rem 0;
}
#ops-view-books .books-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
#ops-view-books .books-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.6rem;
  margin: 0;
  color: var(--text-primary);
}
#ops-view-books .books-sub {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.72);
  margin: 0;
  max-width: 56ch;
}
html[data-mah-theme="day"] #ops-view-books .books-sub {
  color: rgba(0, 0, 0, 0.7);
}
#ops-view-books .books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
#ops-view-books .books-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
html[data-mah-theme="day"] #ops-view-books .books-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}
#ops-view-books .books-card-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.1rem;
  margin: 0;
  color: var(--text-primary);
}
#ops-view-books .books-card-sub {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
  margin: -0.4rem 0 0 0;
}
html[data-mah-theme="day"] #ops-view-books .books-card-sub {
  color: rgba(0, 0, 0, 0.55);
}
#ops-view-books .books-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
#ops-view-books .books-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
#ops-view-books .books-field-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.6);
}
html[data-mah-theme="day"] #ops-view-books .books-field-label {
  color: rgba(0, 0, 0, 0.6);
}
#ops-view-books .books-form input,
#ops-view-books .books-form select,
#ops-view-books .books-form textarea {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  font-family: inherit;
  font-size: 0.92rem;
  width: 100%;
  box-sizing: border-box;
}
html[data-mah-theme="day"] #ops-view-books .books-form input,
html[data-mah-theme="day"] #ops-view-books .books-form select,
html[data-mah-theme="day"] #ops-view-books .books-form textarea {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.12);
}
#ops-view-books .books-form input:focus,
#ops-view-books .books-form select:focus,
#ops-view-books .books-form textarea:focus {
  outline: none;
  border-color: #f4b740;
  box-shadow: 0 0 0 1px rgba(244, 183, 64, 0.3);
}
#ops-view-books .books-form textarea {
  resize: vertical;
  min-height: 2.6rem;
}
#ops-view-books .books-submit {
  align-self: flex-start;
  background: rgba(244, 183, 64, 0.12);
  border: 1px solid rgba(244, 183, 64, 0.5);
  color: #f4b740;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
}
#ops-view-books .books-submit:hover:not(:disabled) {
  background: rgba(244, 183, 64, 0.2);
}
#ops-view-books .books-submit:disabled {
  opacity: 0.55;
  cursor: progress;
}
#ops-view-books .books-status {
  min-height: 1.15rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
}
#ops-view-books .books-status.is-ok {
  color: #4ade80;
}
#ops-view-books .books-status.is-err {
  color: #fca5a5;
}
#ops-view-books .books-status.is-pending {
  color: #fde68a;
}
#ops-view-books .books-recent-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
#ops-view-books .books-recent-card {
  gap: 0.55rem;
}
#ops-view-books .books-recent-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#ops-view-books .books-recent-refresh {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.75);
  padding: 0.25rem 0.7rem;
  border-radius: 5px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
}
html[data-mah-theme="day"] #ops-view-books .books-recent-refresh {
  border-color: rgba(0, 0, 0, 0.15);
  color: rgba(0, 0, 0, 0.75);
}
#ops-view-books .books-recent-refresh:hover {
  border-color: rgba(244, 183, 64, 0.5);
  color: #f4b740;
}
#ops-view-books .books-recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
#ops-view-books .books-recent-row {
  display: grid;
  grid-template-columns: 88px 76px 1fr 88px 84px;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.82rem;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}
html[data-mah-theme="day"] #ops-view-books .books-recent-row {
  border-bottom-color: rgba(0, 0, 0, 0.07);
}
#ops-view-books .books-recent-row:last-child {
  border-bottom: none;
}
#ops-view-books .books-recent-date {
  color: rgba(255, 255, 255, 0.6);
  font-variant-numeric: tabular-nums;
}
html[data-mah-theme="day"] #ops-view-books .books-recent-date {
  color: rgba(0, 0, 0, 0.6);
}
#ops-view-books .books-recent-amt {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary);
}
#ops-view-books .books-recent-mid {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#ops-view-books .books-recent-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(244, 183, 64, 0.85);
}
#ops-view-books .books-recent-status {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-mah-theme="day"] #ops-view-books .books-recent-status {
  color: rgba(0, 0, 0, 0.55);
}
#ops-view-books .books-recent-status.is-paid {
  color: #4ade80;
}
#ops-view-books .books-recent-status.is-recurring {
  color: #fde68a;
}
#ops-view-books .books-recent-status.is-planned {
  color: rgba(255, 255, 255, 0.5);
}
#ops-view-books .books-recent-status.is-refunded {
  color: rgba(255, 255, 255, 0.45);
  text-decoration: line-through;
}
#ops-view-books .books-recent-empty,
#ops-view-books .books-recent-loading {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  padding: 0.5rem 0.25rem;
}
html[data-mah-theme="day"] #ops-view-books .books-recent-empty,
html[data-mah-theme="day"] #ops-view-books .books-recent-loading {
  color: rgba(0, 0, 0, 0.5);
}
#ops-view-books .books-recent-err {
  color: #fca5a5;
  font-size: 0.85rem;
  padding: 0.5rem 0.25rem;
}
@media (max-width: 640px) {
  #ops-view-books .books-recent-row {
    grid-template-columns: 70px 60px 1fr;
    grid-template-rows: auto auto;
  }
  #ops-view-books .books-recent-tag {
    grid-column: 1 / 3;
  }
  #ops-view-books .books-recent-status {
    grid-column: 3 / 4;
    text-align: left;
  }
}

/* ─────────────────────────────────────────────────────────
   TribeWizard tabs (Events / Invoices / SMS / CRM / Overheads)
   ───────────────────────────────────────────────────────── */
.tw-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
html[data-mah-theme="day"] .tw-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}
.tw-pane-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.tw-pane-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.45rem;
  margin: 0;
  color: var(--text-primary);
}
.tw-pane-badge {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border: 1px solid rgba(244, 183, 64, 0.5);
  color: #f4b740;
  border-radius: 3px;
}
.tw-pane-sub {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
  max-width: 64ch;
}
html[data-mah-theme="day"] .tw-pane-sub {
  color: rgba(0, 0, 0, 0.65);
}
.tw-pane-foot {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
}
html[data-mah-theme="day"] .tw-pane-foot {
  color: rgba(0, 0, 0, 0.45);
}
.tw-pane-empty,
.tw-pane-warn,
.tw-pane-err {
  font-size: 0.86rem;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
}
.tw-pane-empty {
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.02);
}
.tw-pane-warn {
  color: #fde68a;
  background: rgba(253, 230, 138, 0.06);
  border: 1px solid rgba(253, 230, 138, 0.25);
}
.tw-pane-err {
  color: #fca5a5;
  background: rgba(252, 165, 165, 0.06);
  border: 1px solid rgba(252, 165, 165, 0.25);
}
html[data-mah-theme="day"] .tw-pane-empty {
  color: rgba(0, 0, 0, 0.55);
  background: rgba(0, 0, 0, 0.02);
}
.tw-refresh-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.75);
  padding: 0.3rem 0.75rem;
  border-radius: 5px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
}
html[data-mah-theme="day"] .tw-refresh-btn {
  border-color: rgba(0, 0, 0, 0.15);
  color: rgba(0, 0, 0, 0.75);
}
.tw-refresh-btn:hover {
  border-color: rgba(244, 183, 64, 0.5);
  color: #f4b740;
}
.tw-signin-card {
  max-width: 480px;
}
.tw-signin-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.4rem;
}
.tw-signin-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.tw-signin-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.6);
}
html[data-mah-theme="day"] .tw-signin-label {
  color: rgba(0, 0, 0, 0.6);
}
.tw-signin-form input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  font-family: inherit;
  font-size: 0.92rem;
  width: 100%;
  box-sizing: border-box;
}
html[data-mah-theme="day"] .tw-signin-form input {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.12);
}
.tw-signin-form input:focus {
  outline: none;
  border-color: #f4b740;
  box-shadow: 0 0 0 1px rgba(244, 183, 64, 0.3);
}
.tw-signin-btn {
  align-self: flex-start;
  background: rgba(244, 183, 64, 0.12);
  border: 1px solid rgba(244, 183, 64, 0.5);
  color: #f4b740;
  padding: 0.55rem 1.2rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
}
.tw-signin-btn:hover:not(:disabled) {
  background: rgba(244, 183, 64, 0.2);
}
.tw-signin-btn:disabled {
  opacity: 0.55;
  cursor: progress;
}
.tw-signin-status {
  min-height: 1.15rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
}
.tw-signin-status.is-ok {
  color: #4ade80;
}
.tw-signin-status.is-err {
  color: #fca5a5;
}
.tw-signin-status.is-pending {
  color: #fde68a;
}
.tw-quota {
  display: grid;
  grid-template-columns: auto auto auto auto auto auto;
  gap: 0.5rem 1rem;
  align-items: baseline;
  padding: 0.65rem 0.85rem;
  background: rgba(244, 183, 64, 0.04);
  border: 1px solid rgba(244, 183, 64, 0.18);
  border-radius: 6px;
  font-size: 0.82rem;
}
.tw-quota-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.55);
}
html[data-mah-theme="day"] .tw-quota-label {
  color: rgba(0, 0, 0, 0.55);
}
.tw-quota-val {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary);
}
.tw-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.tw-row {
  display: grid;
  gap: 0.6rem;
  align-items: baseline;
  font-size: 0.82rem;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}
html[data-mah-theme="day"] .tw-row {
  border-bottom-color: rgba(0, 0, 0, 0.07);
}
.tw-row:last-child {
  border-bottom: none;
}
.tw-row-head {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
html[data-mah-theme="day"] .tw-row-head {
  color: rgba(0, 0, 0, 0.55);
  border-bottom-color: rgba(0, 0, 0, 0.1);
}
.tw-row-events {
  grid-template-columns: 90px 1fr 130px 100px 80px;
}
.tw-row-invoices {
  grid-template-columns: 90px 110px 90px 90px 100px;
}
.tw-row-sms {
  grid-template-columns: 80px 120px 80px 1fr;
}
.tw-row-crm {
  grid-template-columns: 160px 1fr 110px 90px 90px;
}
.tw-row-expenses {
  grid-template-columns: 90px 1fr 140px 100px;
}
.tw-col-date {
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.6);
}
html[data-mah-theme="day"] .tw-col-date {
  color: rgba(0, 0, 0, 0.6);
}
.tw-col-amt,
.tw-col-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}
.tw-col-mid,
.tw-col-msg,
.tw-col-name {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tw-col-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(244, 183, 64, 0.85);
}
.tw-col-status {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
}
html[data-mah-theme="day"] .tw-col-status {
  color: rgba(0, 0, 0, 0.55);
}
.tw-col-status.is-paid,
.tw-col-status.is-completed,
.tw-col-status.is-active,
.tw-col-status.is-sent {
  color: #4ade80;
}
.tw-col-status.is-unpaid,
.tw-col-status.is-overdue,
.tw-col-status.is-queued,
.tw-col-status.is-pending {
  color: #fde68a;
}
.tw-col-status.is-cancelled,
.tw-col-status.is-failed {
  color: #fca5a5;
  text-decoration: line-through;
}
.tw-col-status.is-upcoming {
  color: #93c5fd;
}
.tw-vip-pill {
  display: inline-block;
  margin-left: 0.45rem;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.05rem 0.35rem;
  border: 1px solid rgba(244, 183, 64, 0.6);
  color: #f4b740;
  border-radius: 3px;
  vertical-align: middle;
}
@media (max-width: 760px) {
  .tw-row-events,
  .tw-row-invoices,
  .tw-row-sms,
  .tw-row-crm,
  .tw-row-expenses {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 0.2rem 0.5rem;
  }
  .tw-row .tw-col-mid,
  .tw-row .tw-col-msg,
  .tw-row .tw-col-name {
    grid-column: 1 / -1;
    white-space: normal;
  }
  .tw-quota {
    grid-template-columns: auto auto;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   Day-mode contrast pass — 2026-05-29
   ────────────────────────────────────────────────────────────────────────
   Overrides for classes whose night-mode literals (white rgba, dark hex)
   become invisible or wash out under day mode (warm parchment + navy ink).

   Selectors are grouped by shared body to keep this section compact.
   Day-mode palette extends `--axum-*` / `--v2-*` tokens:
     mint  #18b585 (text-on-light: #0e7a59 → hover #074a3a)
     warm  #b3851f (text-on-light: #8a6116)
     navy ink rgba(22,32,60,*) for borders / muted text / form bg
     cyan  #0e6c8a (text-on-light: #0e6c8a → hover #074a60)
     red   #b4233c (text-on-light: #8e1b30)
   ──────────────────────────────────────────────────────────────────────── */

/* === Mint-tinted surfaces (chips, ctas, status pills, claim buttons) === */
html[data-mah-theme="day"] .v2-pill-mint,
html[data-mah-theme="day"] .m40g-profile-skill-chip,
html[data-mah-theme="day"] .m40g-guide-cta,
html[data-mah-theme="day"] .m40m-cta,
html[data-mah-theme="day"] .m40n-task-add,
html[data-mah-theme="day"] .m40n-task-claim,
html[data-mah-theme="day"] .m40o-rail-status-pill,
html[data-mah-theme="day"] .m40o-impact-public-pill,
html[data-mah-theme="day"] .m40l-projects-cta {
  background: rgba(24, 181, 133, 0.1);
  border-color: rgba(24, 181, 133, 0.4);
  color: #0e7a59;
}

/* === Slightly heavier mint (composer-send, attribution, outcomes-pill, save) === */
html[data-mah-theme="day"] .m40g-dms-composer-send,
html[data-mah-theme="day"] .m40g-chathead-send,
html[data-mah-theme="day"] .m40n-task-attribution,
html[data-mah-theme="day"] .m40m-outcomes-pill,
html[data-mah-theme="day"] .m40o-locked-cta,
html[data-mah-theme="day"] .m40o-rail-cta {
  background: rgba(24, 181, 133, 0.14);
  border-color: rgba(24, 181, 133, 0.45);
  color: #0e7a59;
}

/* === Mint hover deepen === */
html[data-mah-theme="day"] .m40m-cta:hover:not([disabled]),
html[data-mah-theme="day"] .m40n-task-save:hover:not([disabled]),
html[data-mah-theme="day"] .m40n-task-claim:hover,
html[data-mah-theme="day"] .m40g-chathead-send:hover,
html[data-mah-theme="day"] .m40o-locked-cta:hover,
html[data-mah-theme="day"] .m40o-rail-cta:hover {
  background: rgba(24, 181, 133, 0.22);
  color: #074a3a;
}
html[data-mah-theme="day"] .m40m-cta:hover:not([disabled]) {
  border-color: rgba(24, 181, 133, 0.7);
}
html[data-mah-theme="day"] .m40n-task-add:hover {
  background: rgba(24, 181, 133, 0.18);
}
html[data-mah-theme="day"] .m40g-dms-composer-send:hover:not([disabled]) {
  background: rgba(24, 181, 133, 0.22);
  border-color: rgba(24, 181, 133, 0.65);
  color: #074a3a;
}

/* === m40n-task-save (heavy mint default + hover) === */
html[data-mah-theme="day"] .m40n-task-save {
  background: rgba(24, 181, 133, 0.2);
  border-color: rgba(24, 181, 133, 0.5);
  color: #0e7a59;
}

/* === Navy-ink form surfaces (cancel buttons, ghost ctas, codeblock, chathead-overflow) === */
html[data-mah-theme="day"] .m40g-chathead-overflow,
html[data-mah-theme="day"] .m40n-task-cancel,
html[data-mah-theme="day"] .m40m-cta.is-ghost,
html[data-mah-theme="day"] .m40o-rail-cta.is-ghost,
html[data-mah-theme="day"] .m40o-join-understand,
html[data-mah-theme="day"] .m40f-topbar-ledger-toggle,
html[data-mah-theme="day"] .m40g-news-image-upload {
  background: rgba(22, 32, 60, 0.04);
  border-color: rgba(22, 32, 60, 0.14);
  color: var(--v2-ink-1, #3a4663);
}

html[data-mah-theme="day"] .m40m-cta.is-ghost:hover,
html[data-mah-theme="day"] .m40o-rail-cta.is-ghost:hover {
  background: rgba(22, 32, 60, 0.08);
  color: var(--v2-ink-0, #16203c);
}

/* === Single-tone leftovers === */
html[data-mah-theme="day"] .v2-pill-cyan {
  color: #0e6c8a;
  border-color: rgba(14, 108, 138, 0.4);
  background: rgba(14, 108, 138, 0.08);
}
html[data-mah-theme="day"] .v2-pill-grey {
  color: rgba(22, 32, 60, 0.6);
  border-color: rgba(22, 32, 60, 0.18);
  background: rgba(22, 32, 60, 0.04);
}
html[data-mah-theme="day"] .v2-pill-red {
  color: #b4233c;
  border-color: rgba(180, 35, 60, 0.4);
  background: rgba(180, 35, 60, 0.07);
}
html[data-mah-theme="day"] .m40-banner-info {
  background: rgba(24, 181, 133, 0.06);
  border-color: rgba(24, 181, 133, 0.3);
  color: var(--v2-ink-1);
}

/* === Avatars (m40g profile / dm / chathead / ledger / affordance) === */
html[data-mah-theme="day"] .m40g-avatar-affordance,
html[data-mah-theme="day"] .m40g-profile-avatar,
html[data-mah-theme="day"] .m40g-dm-avatar,
html[data-mah-theme="day"] .m40g-chathead-avatar,
html[data-mah-theme="day"] .m40g-ledger-msg-avatar {
  background: rgba(24, 181, 133, 0.14);
  color: #0e7a59;
}
html[data-mah-theme="day"] .m40g-profile-avatar,
html[data-mah-theme="day"] .m40g-dm-avatar,
html[data-mah-theme="day"] .m40g-avatar-affordance {
  border-color: rgba(22, 32, 60, 0.12);
}

/* === m40g · profile message button (cyan accent) === */
html[data-mah-theme="day"] .m40g-profile-message-btn {
  background: rgba(14, 108, 138, 0.1);
  border-color: rgba(14, 108, 138, 0.4);
  color: #0e6c8a;
}
html[data-mah-theme="day"] .m40g-profile-message-btn:hover:not([disabled]) {
  background: rgba(14, 108, 138, 0.18);
  border-color: rgba(14, 108, 138, 0.6);
  color: #074a60;
}

/* === m40g · notebook explainer + release-lab artifact bodies === */
html[data-mah-theme="day"] .m40g-notebook-explainer {
  background: rgba(24, 181, 133, 0.05);
  border-color: rgba(24, 181, 133, 0.22);
}
html[data-mah-theme="day"] .m40g-notebook-explainer-card p {
  color: var(--v2-ink-1, #3a4663);
}
html[data-mah-theme="day"] .m40g-notebook-explainer-card code {
  background: rgba(22, 32, 60, 0.06);
  color: #0e7a59;
}
html[data-mah-theme="day"] .m40g-ledger-toggle {
  border-color: rgba(24, 181, 133, 0.45);
}
html[data-mah-theme="day"] .m40g-news-preview,
html[data-mah-theme="day"] .m40g-news-editor,
html[data-mah-theme="day"] .m40-rl-preview-frame,
html[data-mah-theme="day"] .m40-rl-artifact-body,
html[data-mah-theme="day"] .m40-rl-artifact-editor,
html[data-mah-theme="day"] .m40-rl-artifact-fullscreen-host {
  background: rgba(22, 32, 60, 0.03);
}

/* === m40o · outcomes throughline / amount + meta link === */
html[data-mah-theme="day"] .m40o-throughline-dot {
  color: var(--v2-ink-2, #5e6a85);
}
html[data-mah-theme="day"] .m40m-outcomes-type,
html[data-mah-theme="day"] .m40m-outcomes-meta a {
  color: #0e7a59;
}
html[data-mah-theme="day"] .m40m-outcomes-amount {
  color: #b3851f;
}

/* === m40n · task-status state colours === */
html[data-mah-theme="day"] .m40n-task-status {
  border-color: rgba(22, 32, 60, 0.14);
  background: rgba(22, 32, 60, 0.04);
  color: var(--v2-ink-1, #3a4663);
}
html[data-mah-theme="day"] .m40n-task-status.is-open {
  background: rgba(179, 133, 31, 0.12);
  border-color: rgba(179, 133, 31, 0.4);
  color: #8a6116;
}
html[data-mah-theme="day"] .m40n-task-status.is-in_progress {
  background: rgba(14, 108, 138, 0.12);
  border-color: rgba(14, 108, 138, 0.4);
  color: #0e6c8a;
}
html[data-mah-theme="day"] .m40n-task-status.is-done {
  background: rgba(24, 181, 133, 0.18);
  border-color: rgba(24, 181, 133, 0.5);
  color: #0e7a59;
}
html[data-mah-theme="day"] .m40n-task-status.is-blocked {
  background: rgba(180, 35, 60, 0.12);
  border-color: rgba(180, 35, 60, 0.45);
  color: #8e1b30;
}

/* === m40o · Project rail (right-side slide-in) === */
html[data-mah-theme="day"] .m40o-rail {
  background: #faf6ee;
  border-left-color: rgba(24, 181, 133, 0.32);
}
html[data-mah-theme="day"] .m40o-rail-head {
  background: linear-gradient(
    180deg,
    rgba(24, 181, 133, 0.1),
    rgba(24, 181, 133, 0.02)
  );
  border-bottom-color: rgba(24, 181, 133, 0.25);
}
html[data-mah-theme="day"] .m40o-rail-close {
  background: rgba(22, 32, 60, 0.05);
  border-color: rgba(22, 32, 60, 0.12);
  color: var(--v2-ink-1, #3a4663);
}
html[data-mah-theme="day"] .m40o-rail-close:hover {
  background: rgba(22, 32, 60, 0.1);
  color: var(--v2-ink-0, #16203c);
}
html[data-mah-theme="day"] .m40o-rail-section {
  background: rgba(22, 32, 60, 0.025);
  border-color: rgba(22, 32, 60, 0.08);
}
html[data-mah-theme="day"] .m40o-locked {
  border-color: rgba(24, 181, 133, 0.4);
  background: rgba(24, 181, 133, 0.03);
}
html[data-mah-theme="day"] .m40o-rail-welcome {
  background: rgba(24, 181, 133, 0.12);
  border-color: rgba(24, 181, 133, 0.45);
  color: #0e7a59;
}
html[data-mah-theme="day"] .m40o-join-modal {
  background: #fdfaf3;
  border-color: rgba(22, 32, 60, 0.14);
  color: var(--v2-ink-0, #16203c);
}
html[data-mah-theme="day"] .m40o-modal-form {
  border-color: rgba(22, 32, 60, 0.12);
}
/* Soften project-mode shell dim so rail content stays readable */
html[data-mah-theme="day"] body[data-mah-mode="project"] #appShell {
  filter: saturate(0.9) brightness(0.96);
}

/* === fc-spinup variants + tw-signin-status === */
html[data-mah-theme="day"] .fc-spinup-btn-in_progress {
  border-color: rgba(14, 108, 138, 0.5);
  color: #0e6c8a;
}
html[data-mah-theme="day"] .fc-spinup-btn-cancelled {
  border-color: rgba(22, 32, 60, 0.22);
  color: rgba(22, 32, 60, 0.55);
}
html[data-mah-theme="day"] .fc-spinup-btn-edit {
  border-color: rgba(22, 32, 60, 0.16);
  color: rgba(22, 32, 60, 0.7);
}
html[data-mah-theme="day"] .tw-signin-status {
  color: rgba(22, 32, 60, 0.55);
}

/* ──────────────────────────────────────────────────────────────────────
   members.html inline-style chrome (mah-rail / mah-panel / ops-*)
   These rules live in <style> blocks inside members.html which means
   members.html owns them — but members-v2.css loads AFTER those <style>
   blocks, so equal-specificity overrides here will win the cascade.
   ────────────────────────────────────────────────────────────────────── */

/* === mah-rail (52px icon column) + mah-panel (slide-out subnav) === */
html[data-mah-theme="day"] .app-shell-with-sidenav.mah-rail-active {
  background:
    radial-gradient(
      circle at top left,
      rgba(24, 181, 133, 0.06),
      transparent 28rem
    ),
    #faf6ee !important;
}
html[data-mah-theme="day"] .mah-rail,
html[data-mah-theme="day"] .mah-panel {
  background: #fdfaf3;
  border-right-color: rgba(22, 32, 60, 0.1);
}
html[data-mah-theme="day"] .mah-rail-brand,
html[data-mah-theme="day"] .mah-panel-header {
  border-bottom-color: rgba(22, 32, 60, 0.07);
}
html[data-mah-theme="day"] .mah-rail-footer {
  border-top-color: rgba(22, 32, 60, 0.06);
}
html[data-mah-theme="day"] .mah-rail-btn,
html[data-mah-theme="day"] .mah-rail-btn.is-admin,
html[data-mah-theme="day"] .mah-panel-close {
  color: #7e8aa3;
}
html[data-mah-theme="day"] .mah-panel-title {
  color: #16203c;
}
html[data-mah-theme="day"] .mah-rail-btn:hover,
html[data-mah-theme="day"] .mah-panel-close:hover {
  background: rgba(22, 32, 60, 0.05);
  color: #16203c;
}
html[data-mah-theme="day"] .mah-rail-btn.is-active {
  background: rgba(24, 181, 133, 0.12);
  color: #0e7a59;
}
html[data-mah-theme="day"] .mah-rail-btn.is-active::before,
html[data-mah-theme="day"] .mah-panel-link.is-active::before {
  background: #18b585;
}
html[data-mah-theme="day"] .mah-rail-btn[data-tone="amber"].is-active,
html[data-mah-theme="day"] .mah-rail-btn.is-admin:hover {
  background: rgba(179, 133, 31, 0.12);
  color: #8a6116;
}
html[data-mah-theme="day"] .mah-rail-btn[data-tone="amber"].is-active::before {
  background: #b3851f;
}
html[data-mah-theme="day"] .mah-rail-btn[data-tooltip]::after {
  background: #16203c;
  color: #fdfaf3;
  box-shadow: 0 2px 8px rgba(22, 32, 60, 0.18);
}
html[data-mah-theme="day"] .mah-panel-body {
  scrollbar-color: rgba(22, 32, 60, 0.18) transparent;
}
html[data-mah-theme="day"] .mah-panel-body::-webkit-scrollbar-thumb {
  background: rgba(22, 32, 60, 0.18);
}
html[data-mah-theme="day"] .mah-panel-link {
  color: #5e6a85;
}
html[data-mah-theme="day"] .mah-panel-link:hover {
  background: rgba(22, 32, 60, 0.04);
  color: #16203c;
}
html[data-mah-theme="day"] .mah-panel-link.is-active {
  background: rgba(24, 181, 133, 0.1);
  color: #16203c;
  box-shadow: 0 1px 2px rgba(22, 32, 60, 0.08);
}
html[data-mah-theme="day"] .mah-panel-link.is-active svg {
  color: #0e7a59;
}

/* === Main column gradient + portal toolbar when rail is active === */
html[data-mah-theme="day"] .app-shell-with-sidenav.mah-rail-active .main-col {
  background:
    linear-gradient(
      180deg,
      rgba(253, 250, 243, 0.6),
      rgba(250, 246, 238, 0.96)
    ),
    var(--bg, #faf6ee);
}
html[data-mah-theme="day"]
  .app-shell-with-sidenav.mah-rail-active
  .section-head {
  border-bottom-color: rgba(22, 32, 60, 0.08);
}
html[data-mah-theme="day"]
  .app-shell-with-sidenav.mah-rail-active
  .mah-portal-toolbar {
  border-color: rgba(22, 32, 60, 0.1);
  background: rgba(255, 255, 255, 0.85);
}
html[data-mah-theme="day"]
  .app-shell-with-sidenav.mah-rail-active
  .mah-portal-action {
  border-color: rgba(22, 32, 60, 0.12);
  background: rgba(22, 32, 60, 0.03);
  color: var(--text-secondary, #5e6a85);
}
html[data-mah-theme="day"]
  .app-shell-with-sidenav.mah-rail-active
  .mah-portal-action:hover {
  border-color: rgba(24, 181, 133, 0.5);
  color: #0e7a59;
  background: rgba(24, 181, 133, 0.08);
}

/* === Mobile: panel as horizontal scroller === */
@media (max-width: 900px) {
  html[data-mah-theme="day"]
    .app-shell-with-sidenav.mah-rail-active.mah-panel-open
    .mah-panel {
    border-bottom-color: rgba(22, 32, 60, 0.1);
  }
  html[data-mah-theme="day"]
    .app-shell-with-sidenav.mah-rail-active
    .mah-panel-link {
    border-color: rgba(22, 32, 60, 0.1);
    background: rgba(22, 32, 60, 0.025);
  }
}

/* === Founder Ops chrome — sub-tabs, inputs, buttons, pills, codeblock === */
html[data-mah-theme="day"] .ops-subtabs {
  border-bottom-color: rgba(22, 32, 60, 0.06);
}
html[data-mah-theme="day"] .ops-input,
html[data-mah-theme="day"] .ops-textarea,
html[data-mah-theme="day"] .ops-select {
  background: #fff;
  border-color: rgba(22, 32, 60, 0.14);
  color: var(--v2-ink-0, #16203c);
}
html[data-mah-theme="day"] .ops-input:focus,
html[data-mah-theme="day"] .ops-textarea:focus,
html[data-mah-theme="day"] .ops-select:focus {
  border-color: rgba(179, 133, 31, 0.5);
}

/* Buttons: default=amber, primary=mint, danger=red, ghost=navy */
html[data-mah-theme="day"] .ops-btn,
html[data-mah-theme="day"] .ops-pill.applicant {
  background: rgba(179, 133, 31, 0.1);
  border-color: rgba(179, 133, 31, 0.4);
  color: #8a6116;
}
html[data-mah-theme="day"] .ops-btn:hover {
  background: rgba(179, 133, 31, 0.18);
}
html[data-mah-theme="day"] .ops-btn.primary {
  background: rgba(24, 181, 133, 0.12);
  border-color: rgba(24, 181, 133, 0.4);
  color: #0e7a59;
}
html[data-mah-theme="day"] .ops-btn.primary:hover,
html[data-mah-theme="day"] .ops-codeblock .copy-btn:hover {
  background: rgba(24, 181, 133, 0.22);
}
html[data-mah-theme="day"] .ops-btn.danger,
html[data-mah-theme="day"] .ops-pill.declined {
  background: rgba(180, 35, 60, 0.08);
  border-color: rgba(180, 35, 60, 0.35);
  color: #8e1b30;
}
html[data-mah-theme="day"] .ops-btn.danger:hover {
  background: rgba(180, 35, 60, 0.18);
}
html[data-mah-theme="day"] .ops-btn.ghost {
  background: transparent;
  border-color: rgba(22, 32, 60, 0.12);
  color: var(--v2-ink-2, #5e6a85);
}
html[data-mah-theme="day"] .ops-btn.ghost:hover {
  color: var(--v2-ink-0, #16203c);
  border-color: rgba(22, 32, 60, 0.22);
}

/* Pills: draft (neutral), approved/active/paid (mint), archived (faint),
   applicant (amber, see above), declined (red, see above), planned (cyan) */
html[data-mah-theme="day"] .ops-pill.draft {
  background: rgba(22, 32, 60, 0.06);
  color: #5e6a85;
  border-color: rgba(22, 32, 60, 0.16);
}
html[data-mah-theme="day"] .ops-pill.approved,
html[data-mah-theme="day"] .ops-pill.active,
html[data-mah-theme="day"] .ops-pill.paid {
  background: rgba(24, 181, 133, 0.1);
  color: #0e7a59;
  border-color: rgba(24, 181, 133, 0.35);
}
html[data-mah-theme="day"] .ops-pill.archived {
  background: rgba(22, 32, 60, 0.03);
  color: #7e8aa3;
  border-color: rgba(22, 32, 60, 0.08);
}
html[data-mah-theme="day"] .ops-pill.planned {
  background: rgba(14, 108, 138, 0.08);
  color: #0e6c8a;
  border-color: rgba(14, 108, 138, 0.35);
}

/* Codeblock + copy button */
html[data-mah-theme="day"] .ops-codeblock {
  background: rgba(22, 32, 60, 0.04);
  border-color: rgba(22, 32, 60, 0.12);
  color: var(--v2-ink-1, #3a4663);
}
html[data-mah-theme="day"] .ops-codeblock .copy-btn {
  background: rgba(24, 181, 133, 0.12);
  border-color: rgba(24, 181, 133, 0.4);
  color: #0e7a59;
}

/* Card-row + status-dot fallbacks */
html[data-mah-theme="day"] .ops-card-row {
  border-color: rgba(22, 32, 60, 0.08);
}
html[data-mah-theme="day"] .ops-status-dot.ok {
  background: #18b585;
}

/* ════════════════════════════════════════════════════════════════════════
   Microanimations — sub-150ms, respects prefers-reduced-motion
   ──────────────────────────────────────────────────────────────────────── */

.ops-subtab,
.mah-rail-btn,
.mah-panel-close,
.mah-panel-link,
.tw-refresh-btn,
.tw-signin-btn,
#ops-view-books .books-submit,
#ops-view-books .books-recent-refresh,
.fcck-panel {
  transition:
    background 0.12s ease,
    color 0.12s ease,
    border-color 0.12s ease,
    transform 0.1s ease;
}

.mah-rail-btn:hover {
  transform: translateY(-1px);
}
.tw-refresh-btn:active,
.tw-signin-btn:active:not(:disabled),
#ops-view-books .books-submit:active:not(:disabled),
#ops-view-books .books-recent-refresh:active {
  transform: translateY(1px);
}

/* Tooltip on rail buttons — gentle slide-in from offscreen */
.mah-rail-btn[data-tooltip]::after {
  transform: translateY(-50%) translateX(-4px);
  transition:
    opacity 0.12s ease,
    transform 0.16s cubic-bezier(0.3, 0, 0.2, 1);
}
.mah-rail-btn:hover[data-tooltip]::after {
  transform: translateY(-50%) translateX(0);
}

/* Cockpit cards — border lift on hover */
.fcck-panel:hover {
  border-color: rgba(106, 211, 184, 0.32);
}
html[data-mah-theme="day"] .fcck-panel:hover {
  border-color: rgba(24, 181, 133, 0.38);
}

/* Cockpit OK dot — gentle pulse halo */
@keyframes mah-pulse-dot {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0);
  }
}
@keyframes mah-pulse-dot-day {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(24, 181, 133, 0.45);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(24, 181, 133, 0);
  }
}
.fcck-dot.is-ok {
  animation: mah-pulse-dot 2.4s ease-in-out infinite;
}
html[data-mah-theme="day"] .fcck-dot.is-ok {
  background: #18b585;
  animation-name: mah-pulse-dot-day;
}

/* Reduced motion — kill all the above */
@media (prefers-reduced-motion: reduce) {
  .ops-subtab,
  .mah-rail-btn,
  .mah-panel-close,
  .mah-panel-link,
  .tw-refresh-btn,
  .tw-signin-btn,
  #ops-view-books .books-submit,
  #ops-view-books .books-recent-refresh,
  .mah-rail-btn[data-tooltip]::after,
  .fcck-panel {
    transition: none !important;
    transform: none !important;
  }
  .fcck-dot.is-ok {
    animation: none !important;
  }
}

/* ─────────────────────────────────────────────────────────
   v0.3 Theme A — TW polish (skeleton loading + sign-out btn)
   ───────────────────────────────────────────────────────── */

/* A1 — Loading skeleton */
.tw-card-loading {
  pointer-events: none;
}
.tw-pane-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(244, 183, 64, 0.25);
  border-top-color: #f4b740;
  border-radius: 50%;
  display: inline-block;
  margin-left: 0.4rem;
  animation: tw-spinner-rotate 0.8s linear infinite;
}
html[data-mah-theme="day"] .tw-pane-spinner {
  border-color: rgba(0, 0, 0, 0.18);
  border-top-color: #f4b740;
}
@keyframes tw-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}
.tw-skel-sub {
  opacity: 0.7;
}
.tw-skel-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.tw-skel-row {
  display: grid;
  grid-template-columns: 90px 1fr 130px 100px;
  gap: 0.6rem;
  align-items: center;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}
html[data-mah-theme="day"] .tw-skel-row {
  border-bottom-color: rgba(0, 0, 0, 0.05);
}
.tw-skel-row:last-child {
  border-bottom: none;
}
.tw-skel-cell {
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: tw-skel-shimmer 1.4s ease-in-out infinite;
}
html[data-mah-theme="day"] .tw-skel-cell {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.04) 0%,
    rgba(0, 0, 0, 0.1) 50%,
    rgba(0, 0, 0, 0.04) 100%
  );
  background-size: 200% 100%;
}
.tw-skel-cell-sm {
  width: 70%;
}
.tw-skel-cell-md {
  width: 85%;
}
.tw-skel-cell-lg {
  width: 100%;
}
@keyframes tw-skel-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tw-pane-spinner,
  .tw-skel-cell {
    animation: none !important;
  }
}

/* A2 — Sign-out button (paired with .tw-refresh-btn in pane headers) */
.tw-signout-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.55);
  padding: 0.3rem 0.7rem;
  border-radius: 5px;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
  margin-left: 0.4rem;
  transition:
    color 0.12s,
    border-color 0.12s,
    background 0.12s;
}
html[data-mah-theme="day"] .tw-signout-btn {
  border-color: rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.55);
}
.tw-signout-btn:hover {
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.4);
}
.tw-signout-btn:active {
  transform: translateY(1px);
}

/* ─────────────────────────────────────────────────────────
   A4 — Re-auth banner. Compact "Session expired · Sign in again"
   row shown when a TW loader hits a JWT-expired / permission-denied
   error. Replaces the verbose .tw-pane-err + .tw-reauth-btn pair
   for auth-class failures.
   ───────────────────────────────────────────────────────── */
.tw-reauth-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.6rem;
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  background: rgba(244, 183, 64, 0.08);
  border: 1px solid rgba(244, 183, 64, 0.32);
  font-size: 0.86rem;
}
.tw-reauth-banner-text {
  color: #f4b740;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tw-reauth-banner .tw-reauth-btn {
  align-self: auto;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  margin: 0;
}
html[data-mah-theme="day"] .tw-reauth-banner {
  background: rgba(244, 183, 64, 0.12);
  border-color: rgba(180, 130, 30, 0.4);
}
html[data-mah-theme="day"] .tw-reauth-banner-text {
  color: #8a6010;
}

/* ─────────────────────────────────────────────────────────
   A6 — Cockpit TW signals strip. 3 compact tiles above the
   6-panel grid surfacing TW invoices/events/sms health so the
   founder doesn't have to open the 5 TW tabs to know if there
   is something to look at. Each tile is a button → switchOpsView.
   ───────────────────────────────────────────────────────── */
.fcck-tw-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}
@media (max-width: 720px) {
  .fcck-tw-strip {
    grid-template-columns: 1fr;
  }
}
.fcck-tw-tile {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.18rem;
  background: var(--v2-bg-1);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  padding: 0.7rem 0.95rem;
  min-height: 78px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    border-color 0.12s ease,
    background 0.12s ease;
}
.fcck-tw-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(244, 183, 64, 0.45);
  background: rgba(244, 183, 64, 0.04);
}
@media (prefers-reduced-motion: reduce) {
  .fcck-tw-tile,
  .fcck-tw-tile:hover {
    transition: none;
    transform: none;
  }
}
.fcck-tw-tile:focus-visible {
  outline: 2px solid rgba(244, 183, 64, 0.6);
  outline-offset: 2px;
}
.fcck-tw-tile-num {
  font-family: var(--font-display, ui-serif, serif);
  font-size: 1.6rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #fff);
}
.fcck-tw-tile-label {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
}
.fcck-tw-tile-sub {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.fcck-tw-tile.is-warn {
  border-color: rgba(244, 183, 64, 0.55);
  background: rgba(244, 183, 64, 0.08);
}
.fcck-tw-tile.is-warn .fcck-tw-tile-num,
.fcck-tw-tile.is-warn .fcck-tw-tile-sub {
  color: #f4b740;
}
.fcck-tw-tile.is-empty {
  border-style: dashed;
  background: transparent;
}
.fcck-tw-tile.is-empty .fcck-tw-tile-label {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.82rem;
  text-transform: none;
  letter-spacing: 0;
}
.fcck-tw-tile.is-empty .fcck-tw-tile-sub {
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
}
html[data-mah-theme="day"] .fcck-tw-tile-label {
  color: rgba(0, 0, 0, 0.78);
}
html[data-mah-theme="day"] .fcck-tw-tile-sub {
  color: rgba(0, 0, 0, 0.55);
}
html[data-mah-theme="day"] .fcck-tw-tile.is-empty .fcck-tw-tile-label {
  color: rgba(0, 0, 0, 0.55);
}
html[data-mah-theme="day"] .fcck-tw-tile.is-empty .fcck-tw-tile-sub {
  color: rgba(0, 0, 0, 0.4);
}
html[data-mah-theme="day"] .fcck-tw-tile.is-warn .fcck-tw-tile-num,
html[data-mah-theme="day"] .fcck-tw-tile.is-warn .fcck-tw-tile-sub {
  color: #8a6010;
}

/* ════════════════════════════════════════════════════════════════════════
   v0.3 Theme A — A5 shared filter/sort/date toolbar
   ────────────────────────────────────────────────────────────────────────
   Single horizontal bar above each TW data list. Holds any combination of
   search input, sort dropdown, status/category dropdowns, and a date-range
   pair. All controls fire onChange to re-render the list below; the toolbar
   itself is built once per loader render so focus + caret survive between
   fetches.

   Layout: flex with gap + wrap on narrow screens. Each control gets the
   same height + padding for visual consistency.
   ──────────────────────────────────────────────────────────────────────── */
.tw-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  margin-top: 0.25rem;
}
html[data-mah-theme="day"] .tw-toolbar {
  border-top-color: rgba(0, 0, 0, 0.07);
  border-bottom-color: rgba(0, 0, 0, 0.07);
}
.tw-toolbar-control {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-radius: 5px;
  padding: 0.35rem 0.55rem;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.2;
  min-height: 30px;
  box-sizing: border-box;
}
.tw-toolbar-control:focus {
  outline: none;
  border-color: #f4b740;
  box-shadow: 0 0 0 1px rgba(244, 183, 64, 0.3);
}
html[data-mah-theme="day"] .tw-toolbar-control {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.14);
  color: var(--v2-ink-0, #16203c);
}
.tw-toolbar-search {
  min-width: 220px;
  flex: 1 1 220px;
  max-width: 360px;
}
.tw-toolbar-sort,
.tw-toolbar-status,
.tw-toolbar-category {
  cursor: pointer;
  padding-right: 1.6rem;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.55) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.55) 50%, transparent 50%);
  background-position:
    calc(100% - 0.85rem) 0.85em,
    calc(100% - 0.55rem) 0.85em;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
html[data-mah-theme="day"] .tw-toolbar-sort,
html[data-mah-theme="day"] .tw-toolbar-status,
html[data-mah-theme="day"] .tw-toolbar-category {
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(22, 32, 60, 0.55) 50%),
    linear-gradient(135deg, rgba(22, 32, 60, 0.55) 50%, transparent 50%);
}
.tw-toolbar-date-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.tw-toolbar-date-sep {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.5);
}
html[data-mah-theme="day"] .tw-toolbar-date-sep {
  color: rgba(0, 0, 0, 0.55);
}
.tw-toolbar-date {
  min-width: 140px;
  font-variant-numeric: tabular-nums;
}
.tw-toolbar-clear {
  background: transparent;
  border: 1px solid rgba(252, 165, 165, 0.35);
  color: rgba(252, 165, 165, 0.9);
  padding: 0.3rem 0.55rem;
  border-radius: 5px;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
}
.tw-toolbar-clear:hover {
  background: rgba(252, 165, 165, 0.1);
  color: #fca5a5;
}
html[data-mah-theme="day"] .tw-toolbar-clear {
  border-color: rgba(180, 35, 60, 0.3);
  color: #8e1b30;
}
html[data-mah-theme="day"] .tw-toolbar-clear:hover {
  background: rgba(180, 35, 60, 0.08);
}
@media (max-width: 760px) {
  .tw-toolbar-search {
    min-width: 100%;
    max-width: 100%;
  }
  .tw-toolbar-date {
    min-width: 130px;
    flex: 1 1 130px;
  }
  .tw-toolbar-date-group {
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tw-toolbar-control {
    transition: none !important;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   v0.3 Theme B — Canonical primitives (B2 CSS extraction)
   ────────────────────────────────────────────────────────────────────────
   Three additive primitives. They DO NOT replace existing button/input
   classes (.ops-btn / .quick-btn / .nav-tab / .m40g-guide-cta / inline
   styles) — those still work via their own definitions in this file and
   in members.html. Use the new classes for NEW code; existing call sites
   migrate opportunistically when touched.
   ──────────────────────────────────────────────────────────────────────── */

/* Spacing scale — 6 sizes for new layout work.
   --sp-xs:  0.25rem  (4px)
   --sp-sm:  0.5rem   (8px)
   --sp-md:  0.75rem  (12px)
   --sp-lg:  1rem     (16px)
   --sp-xl:  1.5rem   (24px)
   --sp-2xl: 2.5rem   (40px)
   Existing call sites continue to use literal rem values; this is for
   new components and opportunistic migration. */
:root {
  --sp-xs: 0.25rem;
  --sp-sm: 0.5rem;
  --sp-md: 0.75rem;
  --sp-lg: 1rem;
  --sp-xl: 1.5rem;
  --sp-2xl: 2.5rem;
}

/* Canonical button primitives.
   Use .btn-primary for the principal CTA on a surface (one per region),
   .btn-secondary for supporting actions, .btn-ghost for tertiary chrome.
   All three include day-mode overrides further down. */
.btn-primary,
.btn-secondary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.12s ease,
    color 0.12s ease,
    border-color 0.12s ease,
    transform 0.1s ease;
}
.btn-primary {
  background: rgba(244, 183, 64, 0.12);
  border: 1px solid rgba(244, 183, 64, 0.45);
  color: #f4b740;
}
.btn-primary:hover {
  background: rgba(244, 183, 64, 0.2);
  border-color: rgba(244, 183, 64, 0.6);
  color: #ffc658;
}
.btn-primary:active {
  transform: translateY(1px);
}
.btn-primary:focus-visible {
  outline: 2px solid rgba(244, 183, 64, 0.7);
  outline-offset: 2px;
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-primary, #e9edf3);
}
.btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.03);
}
.btn-secondary:active {
  transform: translateY(1px);
}
.btn-secondary:focus-visible {
  outline: 2px solid rgba(106, 211, 184, 0.7);
  outline-offset: 2px;
}
.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted, #9aa5b4);
}
.btn-ghost:hover {
  color: var(--text-primary, #e9edf3);
  background: rgba(255, 255, 255, 0.04);
}
.btn-ghost:active {
  transform: translateY(1px);
}
.btn-ghost:focus-visible {
  outline: 2px solid rgba(106, 211, 184, 0.55);
  outline-offset: 2px;
}
.btn-ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Day-mode overrides for the three canonical buttons. */
html[data-mah-theme="day"] .btn-primary {
  background: rgba(179, 133, 31, 0.12);
  border-color: rgba(179, 133, 31, 0.5);
  color: #8a6116;
}
html[data-mah-theme="day"] .btn-primary:hover {
  background: rgba(179, 133, 31, 0.22);
  border-color: rgba(179, 133, 31, 0.65);
  color: #6f4d10;
}
html[data-mah-theme="day"] .btn-secondary {
  border-color: rgba(22, 32, 60, 0.18);
  color: #16203c;
}
html[data-mah-theme="day"] .btn-secondary:hover {
  border-color: rgba(22, 32, 60, 0.34);
  background: rgba(22, 32, 60, 0.04);
}
html[data-mah-theme="day"] .btn-ghost {
  color: #5e6a85;
}
html[data-mah-theme="day"] .btn-ghost:hover {
  color: #16203c;
  background: rgba(22, 32, 60, 0.05);
}

/* Canonical form input primitive.
   Migration target: replace inline style="background:rgba(0,0,0,0.25);
   border:1px solid rgba(255,255,255,0.12); color:var(--text-primary)"
   on inputs/selects/textareas in Founder Ops Command Centre + other
   places. Not mass-replaced in this pass to keep the change footprint
   tight; new code should use .form-input. */
.form-input,
.form-input input,
.form-input select,
.form-input textarea {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary, #e9edf3);
  font-family: inherit;
  font-size: 0.82rem;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: 5px;
  transition:
    border-color 0.12s ease,
    background 0.12s ease;
}
.form-input:focus,
.form-input input:focus,
.form-input select:focus,
.form-input textarea:focus {
  outline: 1px solid rgba(244, 183, 64, 0.7);
  outline-offset: 0;
  border-color: rgba(244, 183, 64, 0.5);
}
.form-input:disabled,
.form-input input:disabled,
.form-input select:disabled,
.form-input textarea:disabled {
  background: rgba(0, 0, 0, 0.12);
  color: var(--text-muted, #9aa5b4);
  cursor: not-allowed;
  opacity: 0.6;
}
.form-input::placeholder,
.form-input input::placeholder,
.form-input textarea::placeholder {
  color: var(--text-muted, #9aa5b4);
  opacity: 0.7;
}

html[data-mah-theme="day"] .form-input,
html[data-mah-theme="day"] .form-input input,
html[data-mah-theme="day"] .form-input select,
html[data-mah-theme="day"] .form-input textarea {
  background: #fff;
  border-color: rgba(22, 32, 60, 0.18);
  color: #16203c;
}
html[data-mah-theme="day"] .form-input:focus,
html[data-mah-theme="day"] .form-input input:focus,
html[data-mah-theme="day"] .form-input select:focus,
html[data-mah-theme="day"] .form-input textarea:focus {
  outline-color: rgba(179, 133, 31, 0.7);
  border-color: rgba(179, 133, 31, 0.5);
}
html[data-mah-theme="day"] .form-input:disabled,
html[data-mah-theme="day"] .form-input input:disabled,
html[data-mah-theme="day"] .form-input select:disabled,
html[data-mah-theme="day"] .form-input textarea:disabled {
  background: rgba(22, 32, 60, 0.04);
  color: rgba(22, 32, 60, 0.45);
}

/* ════════════════════════════════════════════════════════════════════════
   v0.3 Theme B — Founder Hub IA regroup (B1 collapsible groups)
   ────────────────────────────────────────────────────────────────────────
   The Founder Hub side rail (mah-panel-body) now interleaves group
   headers between sub-tab buttons. Click a header to collapse / expand
   its group; state persists to localStorage.mah_founder_groups_collapsed.
   At ≤640px, a <select> combobox with <optgroup>s replaces the buttons.
   ──────────────────────────────────────────────────────────────────────── */

.mah-panel-group-header {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--sp-sm) var(--sp-md);
  margin-top: var(--sp-sm);
  background: transparent;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: #6a7583;
  font-family: var(--font-mono, ui-monospace, "JetBrains Mono", monospace);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
  gap: var(--sp-sm);
  transition:
    color 0.12s ease,
    background 0.12s ease;
}
.mah-panel-group-header:first-child {
  margin-top: 0;
  border-top: 0;
}
.mah-panel-group-header:hover {
  color: #9aa5b4;
  background: rgba(255, 255, 255, 0.02);
}
.mah-panel-group-header:focus-visible {
  outline: 2px solid #6ad3b8;
  outline-offset: -2px;
}
.mah-panel-group-label {
  flex: 1 1 auto;
}
.mah-panel-group-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transition: transform 0.18s ease;
  transform: rotate(0deg); /* points down (expanded) */
}
.mah-panel-group-header[aria-expanded="false"] .mah-panel-group-chevron {
  transform: rotate(-90deg); /* points right (collapsed) */
}
.mah-panel-group-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  transition:
    max-height 0.22s ease,
    opacity 0.18s ease;
  max-height: 1200px; /* generous default for "expanded" */
  opacity: 1;
}
.mah-panel-group-body[hidden] {
  display: none;
}
/* Active group gets a subtle highlight on the header */
.mah-panel-group-header.has-active {
  color: #c8d0db;
}
.mah-panel-group-header.has-active .mah-panel-group-chevron {
  color: #f4b740;
}

/* Day-mode overrides for group headers */
html[data-mah-theme="day"] .mah-panel-group-header {
  color: #7e8aa3;
  border-top-color: rgba(22, 32, 60, 0.08);
}
html[data-mah-theme="day"] .mah-panel-group-header:hover {
  color: #16203c;
  background: rgba(22, 32, 60, 0.04);
}
html[data-mah-theme="day"] .mah-panel-group-header.has-active {
  color: #16203c;
}
html[data-mah-theme="day"]
  .mah-panel-group-header.has-active
  .mah-panel-group-chevron {
  color: #b3851f;
}

/* Mobile combobox fallback for Founder area at ≤640px.
   Both the regular .mah-panel-link button list AND the combobox are
   rendered into the panel body; CSS media query toggles visibility. */
.mah-panel-founder-combobox {
  display: none; /* hidden by default; shown at ≤640px via media query */
  width: 100%;
  padding: var(--sp-sm) var(--sp-md);
  font-family: inherit;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-primary, #e9edf3);
  border-radius: 5px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 11px) 50%;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}
.mah-panel-founder-combobox:focus {
  outline: 1px solid rgba(244, 183, 64, 0.7);
  outline-offset: 0;
  border-color: rgba(244, 183, 64, 0.5);
}
html[data-mah-theme="day"] .mah-panel-founder-combobox {
  background-color: #fff;
  border-color: rgba(22, 32, 60, 0.18);
  color: #16203c;
}

@media (max-width: 640px) {
  /* Show combobox, hide group headers + buttons on Founder area only */
  .mah-panel-founder-combobox {
    display: block;
  }
  .mah-panel-body .mah-panel-group-header,
  .mah-panel-body .mah-panel-group-body {
    display: none !important;
  }
}

/* Respect reduced motion — kill the collapse animation + chevron rotate */
@media (prefers-reduced-motion: reduce) {
  .mah-panel-group-header,
  .mah-panel-group-chevron,
  .mah-panel-group-body,
  .btn-primary,
  .btn-secondary,
  .btn-ghost,
  .form-input,
  .form-input input,
  .form-input select,
  .form-input textarea {
    transition: none !important;
    transform: none !important;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   v0.3 Theme B — Empty state component (B3)
   ────────────────────────────────────────────────────────────────────────
   Used by window.MAHEmptyState.render(host, opts). Centered flex column:
   inline-SVG illustration (~96px, single-stroke line art, --v2-ink-3),
   Fraunces headline (~22px), Inter sub-copy (~14px, max 50ch, muted),
   optional .btn-primary CTA from B2.

   Caller chooses one of 5 illustrations (folder / gear / inbox / chart /
   compass); all are inline SVGs using `currentColor`, so they pick up
   the day-mode override automatically via .mah-empty-state-illus colour.
   ──────────────────────────────────────────────────────────────────────── */

.mah-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-2xl) var(--sp-lg);
  gap: var(--sp-md);
  min-height: 220px;
}

.mah-empty-state-illus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  color: var(--v2-ink-3, #6a7583);
  opacity: 0.85;
  margin-bottom: var(--sp-xs);
}
.mah-empty-state-illus svg {
  display: block;
  width: 96px;
  height: 96px;
}

.mah-empty-state-title {
  font-family: "Fraunces", "Cormorant Garamond", Georgia, serif;
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.005em;
  color: var(--v2-ink-2, #9aa5b4);
  margin: 0;
}

.mah-empty-state-sub {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    system-ui,
    sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--v2-ink-3, #6a7583);
  max-width: 50ch;
  margin: 0;
}

.mah-empty-state-cta {
  margin-top: var(--sp-md);
}

/* Day-mode overrides — re-tint the illustration + text to the
   day palette without changing layout. */
html[data-mah-theme="day"] .mah-empty-state-illus {
  color: var(--v2-ink-3, #7e8aa3);
  opacity: 0.9;
}
html[data-mah-theme="day"] .mah-empty-state-title {
  color: #2a3654;
}
html[data-mah-theme="day"] .mah-empty-state-sub {
  color: var(--v2-ink-2, #5e6a85);
}

/* ════════════════════════════════════════════════════════════════════════
   v0.3 Theme B — Pulse-ring animation (B4)
   ────────────────────────────────────────────────────────────────────────
   Drop a single 2.4s emanating ring on any node that just received a
   Supabase realtime update. The ring is painted via ::after positioned
   absolute over the host node — the JS only toggles `.is-active`.

   Host node should have `position: relative` (or be a block-level
   element where position:relative is safe). The CSS sets position:
   relative on the host as a safety net so consumers don't have to.
   ──────────────────────────────────────────────────────────────────────── */

.mah-pulse-ring {
  position: relative;
}
.mah-pulse-ring::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 0 0 0 rgba(244, 183, 64, 0);
}
.mah-pulse-ring.is-active::after {
  animation: mah-pulse-ring-keyframes 2.4s ease-out 1;
}

@keyframes mah-pulse-ring-keyframes {
  0% {
    opacity: 0.9;
    box-shadow: 0 0 0 0 rgba(244, 183, 64, 0.55);
  }
  60% {
    opacity: 0.45;
    box-shadow: 0 0 0 14px rgba(244, 183, 64, 0.05);
  }
  100% {
    opacity: 0;
    box-shadow: 0 0 0 22px rgba(244, 183, 64, 0);
  }
}

/* Day-mode — darker amber accent so the pulse reads on light surfaces. */
html[data-mah-theme="day"] .mah-pulse-ring.is-active::after {
  animation-name: mah-pulse-ring-keyframes-day;
}
@keyframes mah-pulse-ring-keyframes-day {
  0% {
    opacity: 0.85;
    box-shadow: 0 0 0 0 rgba(138, 97, 22, 0.5);
  }
  60% {
    opacity: 0.4;
    box-shadow: 0 0 0 14px rgba(138, 97, 22, 0.04);
  }
  100% {
    opacity: 0;
    box-shadow: 0 0 0 22px rgba(138, 97, 22, 0);
  }
}

/* ════════════════════════════════════════════════════════════════════════
   v0.3 Theme B — Microanimation polish (B7)
   ────────────────────────────────────────────────────────────────────────
   1. .ops-subview fade-in on sub-tab switch (Founder Ops)
   2. .form-input.is-success — 600ms green border flash
   3. .mah-spinner — small 8px-radius rotating ring + keyframes

   Existing .ops-subview { display: none; / display: block on .active }
   lives in members.html. We extend with opacity + translateY so the
   switch reads as a gentle fade-in instead of an instant flash.
   ──────────────────────────────────────────────────────────────────────── */

/* 1. Tab fade-in — Founder Ops sub-views. The display:none/block
   handoff is owned by members.html; we layer the transition on top. */
.ops-subview {
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}
.ops-subview.active {
  opacity: 1;
  transform: translateY(0);
}

/* 2. Form-submit success flash — applied by MAHMicroanim.flashSuccess
   for ~600ms then removed. Use on .form-input fields after a confirmed
   write. Green border + soft glow that fades back to the resting
   border colour. */
.form-input.is-success,
.form-input.is-success input,
.form-input.is-success select,
.form-input.is-success textarea {
  animation: mah-form-success-flash 0.6s ease-out 1;
}
@keyframes mah-form-success-flash {
  0% {
    border-color: rgba(106, 211, 184, 0.95);
    box-shadow: 0 0 0 3px rgba(106, 211, 184, 0.18);
  }
  100% {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 0 rgba(106, 211, 184, 0);
  }
}
html[data-mah-theme="day"] .form-input.is-success,
html[data-mah-theme="day"] .form-input.is-success input,
html[data-mah-theme="day"] .form-input.is-success select,
html[data-mah-theme="day"] .form-input.is-success textarea {
  animation-name: mah-form-success-flash-day;
}
@keyframes mah-form-success-flash-day {
  0% {
    border-color: rgba(31, 122, 92, 0.95);
    box-shadow: 0 0 0 3px rgba(31, 122, 92, 0.15);
  }
  100% {
    border-color: rgba(22, 32, 60, 0.18);
    box-shadow: 0 0 0 0 rgba(31, 122, 92, 0);
  }
}

/* 3. Generic spinner — small 8px-radius rotating ring. Reused alongside
   .fcck-loading / .tw-loading copy spinners. Inline-block so it sits
   next to "Loading…" text cleanly. */
.mah-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid rgba(244, 183, 64, 0.18);
  border-top-color: rgba(244, 183, 64, 0.85);
  animation: mah-spinner-rotate 0.9s linear infinite;
  vertical-align: -3px;
  box-sizing: border-box;
}
@keyframes mah-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}
html[data-mah-theme="day"] .mah-spinner {
  border-color: rgba(138, 97, 22, 0.18);
  border-top-color: rgba(138, 97, 22, 0.85);
}

/* Reduced motion — kill all B3/B4/B7 motion. The is-active / is-success
   class swaps still happen so JS callers stay deterministic; users
   just see static state changes. */
@media (prefers-reduced-motion: reduce) {
  .mah-pulse-ring.is-active::after,
  .form-input.is-success,
  .form-input.is-success input,
  .form-input.is-success select,
  .form-input.is-success textarea,
  .mah-spinner,
  .ops-subview {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
  .ops-subview {
    opacity: 1;
  }
}

/* ─────────────────────────────────────────────────────────
   v0.3 Theme C C5 — Cockpit welcome card (first-run personalisation)
   ───────────────────────────────────────────────────────── */
.fcck-welcome-card {
  position: relative;
  background: linear-gradient(
    180deg,
    rgba(244, 183, 64, 0.08) 0%,
    rgba(244, 183, 64, 0.02) 100%
  );
  border: 1px solid rgba(244, 183, 64, 0.35);
  border-radius: 12px;
  padding: 1.1rem 1.3rem 1.2rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  animation: fcck-welcome-in 0.4s ease both;
}
@keyframes fcck-welcome-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.fcck-welcome-card.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}
html[data-mah-theme="day"] .fcck-welcome-card {
  background: linear-gradient(
    180deg,
    rgba(244, 183, 64, 0.1) 0%,
    rgba(244, 183, 64, 0.03) 100%
  );
  border-color: rgba(180, 130, 30, 0.4);
}
.fcck-welcome-head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.fcck-welcome-kicker {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f4b740;
}
.fcck-welcome-h {
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: 1.55rem;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--text-primary);
}
.fcck-welcome-deck {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.72);
  margin: 0;
  max-width: 60ch;
}
html[data-mah-theme="day"] .fcck-welcome-deck {
  color: rgba(0, 0, 0, 0.72);
}
.fcck-welcome-bits {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.fcck-welcome-bit {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.78);
}
html[data-mah-theme="day"] .fcck-welcome-bit {
  color: rgba(0, 0, 0, 0.8);
}
.fcck-welcome-bit strong {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 600;
  margin-right: 0.35rem;
}
html[data-mah-theme="day"] .fcck-welcome-bit strong {
  color: rgba(0, 0, 0, 0.55);
}
.fcck-welcome-q {
  border-top: 1px dashed rgba(244, 183, 64, 0.25);
  padding-top: 0.5rem;
  margin-top: 0.2rem;
  font-style: italic;
}
.fcck-welcome-dismiss {
  position: absolute;
  top: 0.7rem;
  right: 0.9rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.65);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  font-family: inherit;
}
html[data-mah-theme="day"] .fcck-welcome-dismiss {
  border-color: rgba(0, 0, 0, 0.18);
  color: rgba(0, 0, 0, 0.65);
}
.fcck-welcome-dismiss:hover {
  border-color: rgba(244, 183, 64, 0.5);
  color: #f4b740;
}
@media (prefers-reduced-motion: reduce) {
  .fcck-welcome-card {
    animation: none;
  }
  .fcck-welcome-card.is-leaving {
    transition: none;
  }
}

/* ─────────────────────────────────────────────────────────
   v0.3 Theme B B5 — Cockpit alert cards
   Mounts between the C5 welcome card and the A6 TW signals
   strip. Renders only cards whose underlying condition fires
   (no "all clear" placeholder — silent when clean). Three
   types today: applicants pending decision, YTD spend over
   pro-rata budget, unpaid TW invoices.
   ───────────────────────────────────────────────────────── */
.fcck-alerts {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}
.fcck-alert-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.95rem;
  background: var(--v2-bg-1);
  border: 1px solid var(--v2-line);
  border-left-width: 3px;
  border-radius: var(--v2-radius);
  animation: fcck-alert-in 0.32s ease both;
}
@keyframes fcck-alert-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.fcck-alert-card.is-warn {
  border-color: rgba(244, 183, 64, 0.55);
  border-left-color: #f4b740;
  background: rgba(244, 183, 64, 0.06);
}
.fcck-alert-card.is-info {
  border-color: rgba(120, 170, 240, 0.4);
  border-left-color: #78aaf0;
  background: rgba(120, 170, 240, 0.04);
}
.fcck-alert-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.32);
  flex: 0 0 auto;
}
.fcck-alert-card.is-warn .fcck-alert-dot {
  background: #f4b740;
  box-shadow: 0 0 0 3px rgba(244, 183, 64, 0.18);
}
.fcck-alert-card.is-info .fcck-alert-dot {
  background: #78aaf0;
  box-shadow: 0 0 0 3px rgba(120, 170, 240, 0.18);
}
.fcck-alert-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.fcck-alert-title {
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: 1rem;
  letter-spacing: -0.005em;
  margin: 0;
  color: var(--text-primary, #fff);
  font-weight: 600;
}
.fcck-alert-sub {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fcck-alert-action {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.75);
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  flex: 0 0 auto;
  transition:
    border-color 0.12s ease,
    color 0.12s ease,
    background 0.12s ease;
}
.fcck-alert-action:hover {
  border-color: rgba(244, 183, 64, 0.55);
  color: #f4b740;
  background: rgba(244, 183, 64, 0.04);
}
.fcck-alert-card.is-info .fcck-alert-action:hover {
  border-color: rgba(120, 170, 240, 0.55);
  color: #78aaf0;
  background: rgba(120, 170, 240, 0.06);
}
.fcck-alert-action:focus-visible {
  outline: 2px solid rgba(244, 183, 64, 0.6);
  outline-offset: 2px;
}
html[data-mah-theme="day"] .fcck-alert-sub {
  color: rgba(0, 0, 0, 0.6);
}
html[data-mah-theme="day"] .fcck-alert-action {
  border-color: rgba(0, 0, 0, 0.2);
  color: rgba(0, 0, 0, 0.72);
}
html[data-mah-theme="day"] .fcck-alert-card.is-warn {
  background: rgba(244, 183, 64, 0.1);
}
html[data-mah-theme="day"] .fcck-alert-card.is-info {
  background: rgba(120, 170, 240, 0.08);
}
@media (max-width: 720px) {
  .fcck-alert-card {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }
  .fcck-alert-action {
    grid-column: 1 / -1;
    justify-self: start;
  }
  .fcck-alert-sub {
    white-space: normal;
  }
}
@media (prefers-reduced-motion: reduce) {
  .fcck-alert-card {
    animation: none;
  }
  .fcck-alert-action {
    transition: none;
  }
}

/* ─────────────────────────────────────────────────────────
   v0.3 Theme B B6 — Founder Hub density badges + heartbeat
   Stamped at runtime by js/members-density-badges.js onto:
     - .mah-rail-btn[data-mah-area="founder"] (badge + dot)
     - .mah-panel-link[data-tier2-opsview="drift"] (badge only)
     - .mah-panel-link[data-tier2-opsview="tw-invoices"] (badge only)
   The rail button + panel link already declare `position:relative`
   in the inline styles in members.html so the absolutely-positioned
   chrome lands against them.
   ───────────────────────────────────────────────────────── */
.mah-density-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: rgba(244, 183, 64, 0.92);
  color: #1a1006;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.02em;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  z-index: 2;
}
.mah-density-badge.is-warn {
  background: #f4b740;
  color: #1a1006;
}
.mah-density-badge.is-info {
  background: #78aaf0;
  color: #061018;
}
/* On panel link rows the badge sits inline to the right of the label */
.mah-panel-link .mah-density-badge {
  position: static;
  margin-left: auto;
  font-size: 10px;
  height: 17px;
  line-height: 17px;
  min-width: 18px;
  flex: 0 0 auto;
}

/* Supervisor heartbeat dot — small status indicator on the rail icon,
   bottom-right corner so it can coexist with the top-right badge. */
.mah-density-dot {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(154, 165, 180, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 2;
}
.mah-density-dot.is-ok {
  background: #4ade80;
  border-color: rgba(0, 0, 0, 0.35);
  animation: mah-density-heartbeat 2.4s ease-in-out infinite;
}
.mah-density-dot.is-warn {
  background: #f4b740;
  border-color: rgba(0, 0, 0, 0.35);
}
.mah-density-dot.is-err {
  background: #ef5b6a;
  border-color: rgba(0, 0, 0, 0.35);
}
.mah-density-dot.is-cold {
  background: rgba(154, 165, 180, 0.55);
}
@keyframes mah-density-heartbeat {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.45);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0);
  }
}
html[data-mah-theme="day"] .mah-density-badge {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
html[data-mah-theme="day"] .mah-density-dot {
  border-color: rgba(255, 255, 255, 0.6);
}
html[data-mah-theme="day"] .mah-density-dot.is-ok {
  background: #18b585;
  animation-name: mah-density-heartbeat-day;
}
@keyframes mah-density-heartbeat-day {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(24, 181, 133, 0.5);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(24, 181, 133, 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .mah-density-dot.is-ok {
    animation: none;
  }
}

/* ─────────────────────────────────────────────────────────
   Projects Phase 1 — Project Dossier + CV Track
   Mounted by js/members-project-dossier.js (full dossier +
   capability ribbon) and js/members-project-track-cv.js
   (CV exemplar callout above the projects grid). Vanilla
   CSS, no preprocessor. No emoji icons — SVG only.
   ───────────────────────────────────────────────────────── */
.proj-cap-ribbon {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.proj-cap-ribbon.is-all-absent {
  opacity: 0.55;
}
.proj-cap-pill {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  transition:
    background 0.12s ease,
    color 0.12s ease,
    border-color 0.12s ease;
}
.proj-cap-pill.is-present {
  background: rgba(106, 211, 184, 0.1);
  border-color: rgba(106, 211, 184, 0.35);
  color: #6ad3b8;
}
.proj-cap-pill.is-absent {
  background: transparent;
  color: rgba(255, 255, 255, 0.22);
  border-style: dashed;
}
html[data-mah-theme="day"] .proj-cap-pill {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.45);
}
html[data-mah-theme="day"] .proj-cap-pill.is-present {
  background: rgba(24, 181, 133, 0.12);
  border-color: rgba(24, 181, 133, 0.4);
  color: #18b585;
}
html[data-mah-theme="day"] .proj-cap-pill.is-absent {
  color: rgba(0, 0, 0, 0.22);
}

.proj-dossier {
  background: linear-gradient(
    180deg,
    rgba(0, 180, 255, 0.04) 0%,
    rgba(0, 180, 255, 0.01) 100%
  );
  border: 1px solid rgba(0, 180, 255, 0.18);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  animation: proj-dossier-in 0.34s ease both;
}
@keyframes proj-dossier-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.proj-dossier-head {
  position: relative;
  padding: 1.15rem 1.4rem 0.95rem 1.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.proj-dossier-stripe {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: rgba(0, 180, 255, 0.55);
}
.proj-dossier-stripe.cat-research {
  background: #b27dff;
}
.proj-dossier-stripe.cat-internal {
  background: #f4b740;
}
.proj-dossier-stripe.cat-partnership {
  background: #6ad3b8;
}
.proj-dossier-stripe.cat-member {
  background: #00b4ff;
}
.proj-dossier-stripe.cat-community {
  background: #ef5b6a;
}
.proj-dossier-head-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.proj-dossier-code-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.proj-dossier-code {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0, 180, 255, 0.85);
  padding: 0.18rem 0.5rem;
  border: 1px solid rgba(0, 180, 255, 0.3);
  border-radius: 4px;
}
.proj-dossier-code.cat-research {
  color: #c8a5ff;
  border-color: rgba(178, 125, 255, 0.4);
}
.proj-dossier-code.cat-internal {
  color: #f4b740;
  border-color: rgba(244, 183, 64, 0.4);
}
.proj-dossier-code.cat-partnership {
  color: #6ad3b8;
  border-color: rgba(106, 211, 184, 0.4);
}
.proj-dossier-code.cat-community {
  color: #ef5b6a;
  border-color: rgba(239, 91, 106, 0.4);
}
.proj-dossier-status-badge {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.16rem 0.45rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
}
.proj-dossier-status-badge.active {
  background: rgba(106, 211, 184, 0.15);
  color: #6ad3b8;
}
.proj-dossier-status-badge.proposed {
  background: rgba(244, 183, 64, 0.15);
  color: #f4b740;
}
.proj-dossier-status-badge.archived {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
}
.proj-dossier-llab-chip {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  padding: 0.16rem 0.45rem;
  border-radius: 4px;
  background: rgba(0, 180, 255, 0.12);
}
.proj-dossier-title {
  margin: 0.15rem 0 0;
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-primary, #fff);
}
.proj-dossier-tagline {
  margin: 0;
  font-style: italic;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.75);
  max-width: 70ch;
}
.proj-dossier-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
@media (max-width: 880px) {
  .proj-dossier-sections {
    grid-template-columns: 1fr;
  }
}
.proj-dossier-section {
  padding: 1rem 1.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}
.proj-dossier-section:nth-child(2n) {
  border-right: 0;
}
@media (max-width: 880px) {
  .proj-dossier-section {
    border-right: 0;
  }
}
.proj-dossier-section-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}
.proj-dossier-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: rgba(0, 180, 255, 0.1);
  color: #00b4ff;
}
.proj-dossier-section-label {
  margin: 0;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}
.proj-dossier-empty-hint {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.55;
  border-left: 2px dashed rgba(255, 255, 255, 0.12);
  padding: 0.15rem 0 0.15rem 0.7rem;
}
.proj-dossier-thesis {
  margin: 0 0 0.5rem;
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: 1.02rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.45;
}
.proj-dossier-desc {
  margin: 0 0 0.6rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.72);
}
.proj-dossier-ethics {
  margin: 0.4rem 0 0;
  padding: 0.55rem 0.8rem;
  background: rgba(244, 183, 64, 0.07);
  border-left: 3px solid #f4b740;
  border-radius: 0 4px 4px 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
}
.proj-dossier-ethics strong {
  color: #f4b740;
  font-weight: 600;
}
.proj-dossier-people {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.proj-dossier-person {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
}
.proj-dossier-person-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 180, 255, 0.12);
  color: #00b4ff;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.proj-dossier-person-body {
  min-width: 0;
}
.proj-dossier-person-name {
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
}
.proj-dossier-person-note {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.proj-dossier-role-chip {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.06);
}
.proj-dossier-role-chip.role-builder {
  color: #00b4ff;
  background: rgba(0, 180, 255, 0.1);
}
.proj-dossier-role-chip.role-expert {
  color: #f4b740;
  background: rgba(244, 183, 64, 0.1);
}
.proj-dossier-role-chip.role-validator {
  color: #6ad3b8;
  background: rgba(106, 211, 184, 0.1);
}
.proj-dossier-role-chip.role-sponsor {
  color: #b27dff;
  background: rgba(178, 125, 255, 0.1);
}
.proj-dossier-role-chip.role-owner {
  color: #ef5b6a;
  background: rgba(239, 91, 106, 0.1);
}
.proj-dossier-data,
.proj-dossier-models,
.proj-dossier-edge {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.proj-dossier-data-row,
.proj-dossier-model-row,
.proj-dossier-edge-row {
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.02);
}
.proj-dossier-data-name,
.proj-dossier-model-name,
.proj-dossier-edge-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}
.proj-dossier-data-meta,
.proj-dossier-model-meta,
.proj-dossier-edge-meta {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 0.2rem;
}
.proj-dossier-model-metric {
  color: #6ad3b8;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
}
.proj-dossier-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
}
.proj-dossier-media-tile {
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.15);
}
.proj-dossier-media-kicker {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.45);
}
.proj-dossier-media-label {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 0.2rem;
}
.proj-dossier-media-link {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.74rem;
  color: #00b4ff;
  text-decoration: none;
}
.proj-dossier-media-link:hover {
  text-decoration: underline;
}
.proj-dossier-tools {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.proj-dossier-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.78rem;
  text-decoration: none;
  transition:
    border-color 0.12s ease,
    background 0.12s ease,
    color 0.12s ease;
}
.proj-dossier-tool:hover {
  border-color: rgba(0, 180, 255, 0.45);
  background: rgba(0, 180, 255, 0.06);
  color: #00b4ff;
}
.proj-dossier-human-line {
  margin: 0 0 0.5rem;
  padding: 0.5rem 0.7rem;
  background: rgba(106, 211, 184, 0.08);
  border-left: 3px solid #6ad3b8;
  border-radius: 0 4px 4px 0;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
}
.proj-dossier-human-line strong {
  color: #6ad3b8;
}
.proj-dossier-risk-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.proj-dossier-risk-row {
  padding: 0.4rem 0.6rem;
  border: 1px solid rgba(239, 91, 106, 0.18);
  border-left-width: 3px;
  border-radius: 0 4px 4px 0;
  background: rgba(239, 91, 106, 0.04);
}
.proj-dossier-risk-name {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}
.proj-dossier-risk-mitigation {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 0.2rem;
}
html[data-mah-theme="day"] .proj-dossier {
  background: linear-gradient(
    180deg,
    rgba(0, 180, 255, 0.07) 0%,
    rgba(0, 180, 255, 0.02) 100%
  );
}
html[data-mah-theme="day"] .proj-dossier-title {
  color: rgba(0, 0, 0, 0.9);
}
html[data-mah-theme="day"] .proj-dossier-tagline {
  color: rgba(0, 0, 0, 0.7);
}
html[data-mah-theme="day"] .proj-dossier-thesis {
  color: rgba(0, 0, 0, 0.9);
}
html[data-mah-theme="day"] .proj-dossier-desc {
  color: rgba(0, 0, 0, 0.68);
}
html[data-mah-theme="day"] .proj-dossier-empty-hint {
  color: rgba(0, 0, 0, 0.5);
  border-left-color: rgba(0, 0, 0, 0.12);
}
html[data-mah-theme="day"] .proj-dossier-section-label {
  color: rgba(0, 0, 0, 0.72);
}
html[data-mah-theme="day"] .proj-dossier-person {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
}
html[data-mah-theme="day"] .proj-dossier-person-name {
  color: rgba(0, 0, 0, 0.88);
}
html[data-mah-theme="day"] .proj-dossier-person-note {
  color: rgba(0, 0, 0, 0.55);
}
html[data-mah-theme="day"] .proj-dossier-data-row,
html[data-mah-theme="day"] .proj-dossier-model-row,
html[data-mah-theme="day"] .proj-dossier-edge-row {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
}
html[data-mah-theme="day"] .proj-dossier-data-name,
html[data-mah-theme="day"] .proj-dossier-model-name,
html[data-mah-theme="day"] .proj-dossier-edge-name {
  color: rgba(0, 0, 0, 0.88);
}
html[data-mah-theme="day"] .proj-dossier-section {
  border-color: rgba(0, 0, 0, 0.06);
}

@media (prefers-reduced-motion: reduce) {
  .proj-dossier {
    animation: none;
  }
}

/* CV TRACK CALLOUT */
.proj-track-cv {
  margin: 0 0 1.5rem;
  padding: 1.3rem 1.4rem 1.4rem;
  background: linear-gradient(
    135deg,
    rgba(0, 180, 255, 0.07) 0%,
    rgba(178, 125, 255, 0.04) 100%
  );
  border: 1px solid rgba(0, 180, 255, 0.2);
  border-radius: 14px;
  animation: proj-dossier-in 0.42s ease both;
}
.proj-track-cv-head {
  margin-bottom: 1rem;
}
.proj-track-cv-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #00b4ff;
}
.proj-track-cv-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #00b4ff;
  display: inline-block;
}
.proj-track-cv-title {
  margin: 0.35rem 0 0.3rem;
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-primary, #fff);
}
.proj-track-cv-through {
  margin: 0 0 0.5rem;
  font-style: italic;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.85);
}
.proj-track-cv-deck {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.72);
  max-width: 76ch;
}
.proj-track-cv-deck strong {
  color: #6ad3b8;
}
.proj-track-cv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 940px) {
  .proj-track-cv-grid {
    grid-template-columns: 1fr;
  }
}
.proj-track-cv-domain {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.proj-track-cv-domain[data-domain="opshop"] {
  border-color: rgba(244, 183, 64, 0.3);
}
.proj-track-cv-domain[data-domain="bee"] {
  border-color: rgba(106, 211, 184, 0.3);
}
.proj-track-cv-domain-head {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 0.7rem;
  align-items: flex-start;
}
.proj-track-cv-domain-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(0, 180, 255, 0.12);
  color: #00b4ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.proj-track-cv-domain[data-domain="opshop"] .proj-track-cv-domain-icon {
  background: rgba(244, 183, 64, 0.14);
  color: #f4b740;
}
.proj-track-cv-domain[data-domain="bee"] .proj-track-cv-domain-icon {
  background: rgba(106, 211, 184, 0.14);
  color: #6ad3b8;
}
.proj-track-cv-domain-code {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.55);
}
.proj-track-cv-domain-title {
  margin: 0.15rem 0 0.2rem;
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: 1.2rem;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--text-primary, #fff);
}
.proj-track-cv-domain-tagline {
  margin: 0;
  font-style: italic;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.74);
  line-height: 1.45;
}
.proj-track-cv-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.proj-track-cv-h5 {
  margin: 0;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.proj-track-cv-p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.78);
}
.proj-track-cv-numbers-list {
  list-style: disc inside;
  padding: 0 0 0 0.3rem;
  margin: 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.55;
}
.proj-track-cv-roles {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.proj-track-cv-role {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.45rem 0.5rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.proj-track-cv-role-icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
}
.proj-track-cv-role.role-builder .proj-track-cv-role-icon {
  background: rgba(0, 180, 255, 0.14);
  color: #00b4ff;
}
.proj-track-cv-role.role-expert .proj-track-cv-role-icon {
  background: rgba(244, 183, 64, 0.14);
  color: #f4b740;
}
.proj-track-cv-role.role-validator .proj-track-cv-role-icon {
  background: rgba(106, 211, 184, 0.14);
  color: #6ad3b8;
}
.proj-track-cv-role.role-sponsor .proj-track-cv-role-icon {
  background: rgba(178, 125, 255, 0.14);
  color: #b27dff;
}
.proj-track-cv-role-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.proj-track-cv-role-label {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.proj-track-cv-role.role-builder .proj-track-cv-role-label {
  color: #00b4ff;
}
.proj-track-cv-role.role-expert .proj-track-cv-role-label {
  color: #f4b740;
}
.proj-track-cv-role.role-validator .proj-track-cv-role-label {
  color: #6ad3b8;
}
.proj-track-cv-role.role-sponsor .proj-track-cv-role-label {
  color: #b27dff;
}
.proj-track-cv-role-text {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.45;
}
.proj-track-cv-diff {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.proj-track-cv-diff-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
}
.proj-track-cv-diff-level {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #00b4ff;
  background: rgba(0, 180, 255, 0.12);
  border-radius: 3px;
  padding: 0.1rem 0.3rem;
  text-align: center;
}
.proj-track-cv-section-edge,
.proj-track-cv-section-overlap {
  background: rgba(106, 211, 184, 0.05);
  border-left: 3px solid #6ad3b8;
  border-radius: 0 6px 6px 0;
  padding: 0.55rem 0.7rem;
}
.proj-track-cv-section-overlap {
  background: rgba(244, 183, 64, 0.05);
  border-left-color: #f4b740;
}
.proj-track-cv-foot {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.proj-track-cv-foot-line {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.78);
}
.proj-track-cv-foot-line strong {
  color: #6ad3b8;
}
html[data-mah-theme="day"] .proj-track-cv-title {
  color: rgba(0, 0, 0, 0.92);
}
html[data-mah-theme="day"] .proj-track-cv-through {
  color: rgba(0, 0, 0, 0.78);
}
html[data-mah-theme="day"] .proj-track-cv-deck {
  color: rgba(0, 0, 0, 0.7);
}
html[data-mah-theme="day"] .proj-track-cv-domain {
  background: rgba(255, 255, 255, 0.55);
}
html[data-mah-theme="day"] .proj-track-cv-domain-title {
  color: rgba(0, 0, 0, 0.9);
}
html[data-mah-theme="day"] .proj-track-cv-domain-tagline {
  color: rgba(0, 0, 0, 0.7);
}
html[data-mah-theme="day"] .proj-track-cv-p,
html[data-mah-theme="day"] .proj-track-cv-numbers-list,
html[data-mah-theme="day"] .proj-track-cv-role-text,
html[data-mah-theme="day"] .proj-track-cv-diff-row,
html[data-mah-theme="day"] .proj-track-cv-foot-line {
  color: rgba(0, 0, 0, 0.72);
}
html[data-mah-theme="day"] .proj-track-cv-h5 {
  color: rgba(0, 0, 0, 0.6);
}
html[data-mah-theme="day"] .proj-track-cv-role {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
}

/* Phase 2C — deep-link button at the foot of each CV Track domain card.
   Stays hidden when its slot is empty (no seed row in DB). */
.proj-track-cv-deeplink-slot:empty {
  display: none;
}
.proj-track-cv-deeplink-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
  padding: 0.55rem 0.85rem;
  background: rgba(0, 180, 255, 0.1);
  border: 1px solid rgba(0, 180, 255, 0.32);
  border-radius: 6px;
  color: #00b4ff;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    transform 0.1s ease;
}
.proj-track-cv-domain[data-domain="opshop"] .proj-track-cv-deeplink-btn {
  background: rgba(244, 183, 64, 0.12);
  border-color: rgba(244, 183, 64, 0.42);
  color: #f4b740;
}
.proj-track-cv-domain[data-domain="bee"] .proj-track-cv-deeplink-btn {
  background: rgba(106, 211, 184, 0.12);
  border-color: rgba(106, 211, 184, 0.42);
  color: #6ad3b8;
}
.proj-track-cv-deeplink-btn:hover {
  transform: translateY(-1px);
  border-color: currentColor;
}
.proj-track-cv-deeplink-btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
html[data-mah-theme="day"] .proj-track-cv-deeplink-btn {
  background: rgba(0, 180, 255, 0.14);
}
html[data-mah-theme="day"]
  .proj-track-cv-domain[data-domain="opshop"]
  .proj-track-cv-deeplink-btn {
  background: rgba(244, 183, 64, 0.18);
}
html[data-mah-theme="day"]
  .proj-track-cv-domain[data-domain="bee"]
  .proj-track-cv-deeplink-btn {
  background: rgba(106, 211, 184, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  .proj-track-cv {
    animation: none;
  }
  .proj-track-cv-deeplink-btn {
    transition: none;
  }
}

/* PROJECT HIERARCHY: Maslow portfolio map */
.proj-hierarchy {
  margin: 0 0 1.35rem;
  padding: 1.1rem;
  border: 1px solid rgba(120, 170, 240, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(
      120deg,
      rgba(120, 170, 240, 0.08),
      rgba(106, 211, 184, 0.045)
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.025) 0 1px,
      transparent 1px 68px
    );
  overflow: hidden;
}
.proj-hierarchy.is-empty {
  padding: 1rem 1.1rem;
}
.proj-hierarchy-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}
.proj-hierarchy-kicker {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: #78aaf0;
}
.proj-hierarchy-title {
  margin: 0.25rem 0 0.35rem;
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: 1.48rem;
  line-height: 1.15;
  letter-spacing: 0;
  color: var(--text-primary, #fff);
}
.proj-hierarchy-deck {
  margin: 0;
  max-width: 82ch;
  font-size: 0.88rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.72);
}
.proj-hierarchy-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(82px, 1fr));
  gap: 0.45rem;
  margin: 0;
}
.proj-hierarchy-stat {
  min-height: 58px;
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.12);
}
.proj-hierarchy-stat dt {
  margin: 0 0 0.2rem;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  letter-spacing: 0;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}
.proj-hierarchy-stat dd {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-primary, #fff);
}
.proj-hierarchy-stage {
  display: grid;
  grid-template-columns: minmax(360px, 1.25fr) minmax(280px, 0.75fr);
  gap: 1rem;
  align-items: stretch;
}
.proj-maslow-pyramid {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  min-width: 0;
  perspective: 1000px;
}
.proj-maslow-layer {
  width: var(--layer-width, 100%);
  min-height: 92px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(138px, 0.34fr) minmax(0, 1fr);
  border: 1px solid color-mix(in srgb, var(--level-color) 42%, transparent);
  border-left: 4px solid var(--level-color);
  border-radius: 8px;
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--level-color) 14%, transparent),
      rgba(255, 255, 255, 0.025)
    ),
    rgba(4, 8, 13, 0.34);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.16);
  transform: translateZ(0);
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}
.proj-maslow-layer[data-maslow-layer="self_actualization"] {
  --layer-width: 64%;
}
.proj-maslow-layer[data-maslow-layer="esteem"] {
  --layer-width: 76%;
}
.proj-maslow-layer[data-maslow-layer="belonging"] {
  --layer-width: 86%;
}
.proj-maslow-layer[data-maslow-layer="safety"] {
  --layer-width: 94%;
}
.proj-maslow-layer[data-maslow-layer="physiological"] {
  --layer-width: 100%;
}
.proj-maslow-layer.is-drop-target {
  transform: translateY(-2px);
  border-color: var(--level-color);
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--level-color) 22%, transparent),
      rgba(255, 255, 255, 0.045)
    ),
    rgba(4, 8, 13, 0.42);
}
.proj-maslow-layer-label {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.25rem 0.45rem;
  align-content: center;
  padding: 0.72rem 0.78rem;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.proj-maslow-layer-icon {
  grid-row: 1 / span 2;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--level-color);
  background: color-mix(in srgb, var(--level-color) 16%, transparent);
}
.proj-maslow-layer-name {
  min-width: 0;
  color: var(--text-primary, #fff);
  font-weight: 800;
  font-size: 0.9rem;
  line-height: 1.2;
}
.proj-maslow-layer-signal {
  grid-column: 2 / span 2;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  letter-spacing: 0;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--level-color) 82%, white);
}
.proj-maslow-layer-count {
  min-width: 26px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: var(--text-primary, #fff);
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.74rem;
  font-weight: 700;
}
.proj-maslow-layer-body {
  min-width: 0;
  padding: 0.68rem 0.78rem;
}
.proj-maslow-layer-thesis {
  margin: 0 0 0.5rem;
  font-size: 0.76rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.58);
}
.proj-maslow-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  align-items: stretch;
}
.proj-maslow-chip {
  min-width: 168px;
  max-width: 240px;
  min-height: 46px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.12rem;
  padding: 0.42rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    border-color 0.12s ease,
    background 0.12s ease;
}
.proj-maslow-chip:hover,
.proj-maslow-chip.is-selected {
  transform: translateY(-1px);
  border-color: color-mix(
    in srgb,
    var(--level-color) 54%,
    rgba(255, 255, 255, 0.16)
  );
  background: rgba(255, 255, 255, 0.065);
}
.proj-maslow-chip-code {
  min-width: 0;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--level-color) 80%, white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.proj-maslow-chip-title {
  min-width: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.proj-maslow-chip-meta,
.proj-maslow-empty,
.proj-maslow-more {
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.68rem;
}
.proj-maslow-chip.is-inferred .proj-maslow-chip-code::after {
  content: " inferred";
  color: rgba(255, 255, 255, 0.36);
  font-weight: 500;
}
.proj-maslow-more {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 0.5rem;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 7px;
}
.proj-hierarchy-focus {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
  padding: 1rem;
  border: 1px solid
    color-mix(in srgb, var(--level-color, #78aaf0) 36%, transparent);
  border-radius: 8px;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--level-color, #78aaf0) 12%, transparent),
      rgba(0, 0, 0, 0.18)
    ),
    rgba(4, 8, 13, 0.42);
}
.proj-hierarchy-focus-kicker,
.proj-hierarchy-move-label,
.proj-hierarchy-ledger-label {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--level-color, #78aaf0) 78%, white);
}
.proj-hierarchy-focus-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
  color: var(--text-primary, #fff);
}
.proj-hierarchy-focus-layer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  align-items: center;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
}
.proj-hierarchy-focus-icon {
  width: 23px;
  height: 23px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: var(--level-color, #78aaf0);
  background: color-mix(in srgb, var(--level-color, #78aaf0) 16%, transparent);
}
.proj-hierarchy-inferred {
  padding: 0.12rem 0.38rem;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.52);
  background: rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
}
.proj-hierarchy-focus-desc {
  margin: 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.82rem;
  line-height: 1.55;
  max-height: 8.2rem;
  overflow: auto;
}
.proj-hierarchy-focus-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.42rem;
}
.proj-hierarchy-metric {
  min-height: 54px;
  padding: 0.42rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.14);
}
.proj-hierarchy-metric span {
  display: block;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.64rem;
}
.proj-hierarchy-metric strong {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-primary, #fff);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.proj-hierarchy-actions,
.proj-hierarchy-move {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.proj-hierarchy-action,
.proj-hierarchy-move-btn {
  min-height: 36px;
  padding: 0.42rem 0.68rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.proj-hierarchy-move-btn {
  color: #04130f;
  background: #6ad3b8;
  border-color: #6ad3b8;
}
.proj-hierarchy-move-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.proj-hierarchy-select,
.proj-hierarchy-reason {
  height: 36px;
  min-height: 36px;
  padding: 0.42rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-primary, #fff);
  font: inherit;
  font-size: 0.78rem;
}
.proj-hierarchy-reason {
  flex: 1 1 160px;
  min-width: 0;
  resize: none;
}
.proj-hierarchy-status {
  padding: 0.48rem 0.6rem;
  border-radius: 6px;
  font-size: 0.76rem;
  line-height: 1.4;
  background: rgba(120, 170, 240, 0.12);
  color: #b6d1ff;
}
.proj-hierarchy-status.ok {
  background: rgba(106, 211, 184, 0.12);
  color: #6ad3b8;
}
.proj-hierarchy-status.error {
  background: rgba(239, 91, 106, 0.12);
  color: #ff9aa5;
}
.proj-hierarchy-ledger {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.proj-hierarchy-ledger-empty {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.45;
}
.proj-hierarchy-ledger-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}
.proj-hierarchy-ledger-row {
  display: grid;
  grid-template-columns: minmax(88px, auto) 1fr;
  gap: 0.18rem 0.55rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
}
.proj-hierarchy-ledger-move {
  color: var(--text-primary, #fff);
  font-size: 0.74rem;
  font-weight: 800;
}
.proj-hierarchy-ledger-meta,
.proj-hierarchy-ledger-reason {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.7rem;
}
.proj-hierarchy-ledger-reason {
  grid-column: 1 / -1;
  color: rgba(255, 255, 255, 0.68);
}
.project-maslow-badge,
.proj-dossier-maslow-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0.14rem 0.42rem;
  border-radius: 5px;
  border: 1px solid rgba(120, 170, 240, 0.24);
  background: rgba(120, 170, 240, 0.08);
  color: #b6d1ff;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}
.project-maslow-badge[data-maslow-layer="physiological"],
.proj-dossier-maslow-chip[data-maslow-layer="physiological"] {
  color: #ff9aa5;
  border-color: rgba(239, 91, 106, 0.32);
  background: rgba(239, 91, 106, 0.1);
}
.project-maslow-badge[data-maslow-layer="safety"],
.proj-dossier-maslow-chip[data-maslow-layer="safety"] {
  color: #f4b740;
  border-color: rgba(244, 183, 64, 0.32);
  background: rgba(244, 183, 64, 0.1);
}
.project-maslow-badge[data-maslow-layer="belonging"],
.proj-dossier-maslow-chip[data-maslow-layer="belonging"] {
  color: #6ad3b8;
  border-color: rgba(106, 211, 184, 0.32);
  background: rgba(106, 211, 184, 0.1);
}
.project-maslow-badge[data-maslow-layer="esteem"],
.proj-dossier-maslow-chip[data-maslow-layer="esteem"] {
  color: #78aaf0;
  border-color: rgba(120, 170, 240, 0.32);
  background: rgba(120, 170, 240, 0.1);
}
.project-maslow-badge[data-maslow-layer="self_actualization"],
.proj-dossier-maslow-chip[data-maslow-layer="self_actualization"] {
  color: #c8a5ff;
  border-color: rgba(178, 125, 255, 0.32);
  background: rgba(178, 125, 255, 0.1);
}

html[data-mah-theme="day"] .proj-hierarchy {
  background:
    linear-gradient(
      120deg,
      rgba(120, 170, 240, 0.12),
      rgba(106, 211, 184, 0.08)
    ),
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.035) 0 1px,
      transparent 1px 68px
    );
}
html[data-mah-theme="day"] .proj-hierarchy-title,
html[data-mah-theme="day"] .proj-maslow-layer-name,
html[data-mah-theme="day"] .proj-hierarchy-focus-title,
html[data-mah-theme="day"] .proj-hierarchy-stat dd,
html[data-mah-theme="day"] .proj-hierarchy-metric strong,
html[data-mah-theme="day"] .proj-hierarchy-ledger-move {
  color: rgba(0, 0, 0, 0.9);
}
html[data-mah-theme="day"] .proj-hierarchy-deck,
html[data-mah-theme="day"] .proj-maslow-layer-thesis,
html[data-mah-theme="day"] .proj-hierarchy-focus-desc,
html[data-mah-theme="day"] .proj-hierarchy-focus-layer,
html[data-mah-theme="day"] .proj-hierarchy-ledger-empty,
html[data-mah-theme="day"] .proj-hierarchy-ledger-meta,
html[data-mah-theme="day"] .proj-hierarchy-ledger-reason {
  color: rgba(0, 0, 0, 0.62);
}
html[data-mah-theme="day"] .proj-hierarchy-stat,
html[data-mah-theme="day"] .proj-hierarchy-metric,
html[data-mah-theme="day"] .proj-maslow-chip,
html[data-mah-theme="day"] .proj-hierarchy-ledger-row {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(0, 0, 0, 0.08);
}
html[data-mah-theme="day"] .proj-maslow-layer,
html[data-mah-theme="day"] .proj-hierarchy-focus {
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--level-color, #78aaf0) 12%, transparent),
      rgba(255, 255, 255, 0.72)
    ),
    rgba(255, 255, 255, 0.72);
}
html[data-mah-theme="day"] .proj-maslow-chip-title {
  color: rgba(0, 0, 0, 0.82);
}
html[data-mah-theme="day"] .proj-maslow-chip-meta,
html[data-mah-theme="day"] .proj-maslow-empty,
html[data-mah-theme="day"] .proj-maslow-more,
html[data-mah-theme="day"] .proj-hierarchy-stat dt,
html[data-mah-theme="day"] .proj-hierarchy-metric span {
  color: rgba(0, 0, 0, 0.5);
}
html[data-mah-theme="day"] .proj-hierarchy-select,
html[data-mah-theme="day"] .proj-hierarchy-reason {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.88);
}

@media (max-width: 1120px) {
  .proj-hierarchy-head,
  .proj-hierarchy-stage {
    grid-template-columns: 1fr;
  }
  .proj-hierarchy-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .proj-hierarchy {
    padding: 0.85rem;
  }
  .proj-hierarchy-stats,
  .proj-hierarchy-focus-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .proj-maslow-layer {
    width: 100%;
    grid-template-columns: 1fr;
  }
  .proj-maslow-layer-label {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .proj-maslow-chip {
    min-width: min(100%, 220px);
    max-width: 100%;
  }
}
@media (max-width: 460px) {
  .proj-hierarchy-stats,
  .proj-hierarchy-focus-metrics {
    grid-template-columns: 1fr;
  }
  .proj-hierarchy-actions,
  .proj-hierarchy-move {
    align-items: stretch;
    flex-direction: column;
  }
  .proj-hierarchy-action,
  .proj-hierarchy-move-btn,
  .proj-hierarchy-select,
  .proj-hierarchy-reason {
    width: 100%;
  }
  .proj-hierarchy-reason {
    flex: 0 0 auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  .proj-maslow-layer,
  .proj-maslow-chip {
    transition: none;
  }
}

/* ─────────────────────────────────────────────────────────
   Projects Phase 2B — staged-move banner + cancel button.
   Renders on the hierarchy focus pane when a drag-and-drop
   stages a cross-layer move pending the user's rationale.
   ───────────────────────────────────────────────────────── */
.proj-hierarchy-staged-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.55rem 0.7rem;
  margin: 0 0 0.55rem;
  background: rgba(244, 183, 64, 0.1);
  border-left: 3px solid #f4b740;
  border-radius: 0 5px 5px 0;
  font-size: 0.85rem;
  color: var(--text-primary, #fff);
  line-height: 1.45;
  animation: proj-hierarchy-staged-in 0.25s ease both;
}
@keyframes proj-hierarchy-staged-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.proj-hierarchy-staged-banner strong {
  color: #f4b740;
  font-weight: 600;
}
.proj-hierarchy-staged-hint {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.78rem;
}
html[data-mah-theme="day"] .proj-hierarchy-staged-banner {
  background: rgba(244, 183, 64, 0.14);
  color: rgba(0, 0, 0, 0.88);
}
html[data-mah-theme="day"] .proj-hierarchy-staged-hint {
  color: rgba(0, 0, 0, 0.58);
}
.proj-hierarchy-move-btn.is-staged {
  background: #f4b740;
  color: #1a1006;
  border-color: #d99c20;
  font-weight: 600;
  animation: proj-hierarchy-pulse 1.4s ease-in-out infinite;
}
@keyframes proj-hierarchy-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(244, 183, 64, 0.45);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(244, 183, 64, 0);
  }
}
.proj-hierarchy-move-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.proj-hierarchy-move-cancel {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-size: 0.78rem;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition:
    border-color 0.12s ease,
    color 0.12s ease;
}
.proj-hierarchy-move-cancel:hover {
  border-color: rgba(239, 91, 106, 0.55);
  color: #ef5b6a;
}
html[data-mah-theme="day"] .proj-hierarchy-move-cancel {
  border-color: rgba(0, 0, 0, 0.18);
  color: rgba(0, 0, 0, 0.72);
}
@media (max-width: 720px) {
  .proj-hierarchy-move-actions {
    flex-direction: column;
  }
  .proj-hierarchy-move-actions .proj-hierarchy-move-btn,
  .proj-hierarchy-move-actions .proj-hierarchy-move-cancel {
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .proj-hierarchy-staged-banner {
    animation: none;
  }
  .proj-hierarchy-move-btn.is-staged {
    animation: none;
  }
}

/* ─────────────────────────────────────────────────────────
   Projects Phase 2D — founder metadata editor.
   Inline-styled overlay anchored inside the dossier wrap;
   edits the small-text metadata fields (tagline, thesis,
   ethics, human_judgement, living_lab) via supabase-js +
   re-renders the dossier in place on save. Array fields
   stay SQL-edit until a future wave.
   ───────────────────────────────────────────────────────── */
.proj-dossier-edit-btn {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(0, 180, 255, 0.12);
  border: 1px solid rgba(0, 180, 255, 0.35);
  color: #00b4ff;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.22rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  margin-left: auto;
  transition:
    background 0.12s ease,
    border-color 0.12s ease;
}
.proj-dossier-edit-btn:hover {
  background: rgba(0, 180, 255, 0.2);
  border-color: rgba(0, 180, 255, 0.6);
}
.proj-dossier-edit-btn:focus-visible {
  outline: 2px solid rgba(0, 180, 255, 0.6);
  outline-offset: 2px;
}
html[data-mah-theme="day"] .proj-dossier-edit-btn {
  background: rgba(0, 180, 255, 0.16);
  color: #0078b4;
}

.proj-dossier-edit-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 13, 18, 0.74);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4rem 1rem 1rem;
  z-index: 50;
  animation: proj-dossier-edit-in 0.18s ease both;
}
@keyframes proj-dossier-edit-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.proj-dossier {
  position: relative;
}
.proj-dossier-edit-panel {
  width: min(560px, 96%);
  max-height: calc(100% - 6rem);
  overflow-y: auto;
  background: var(--v2-bg-1, #10141b);
  border: 1px solid rgba(0, 180, 255, 0.4);
  border-radius: 10px;
  padding: 1.1rem 1.3rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.55);
}
.proj-dossier-edit-h {
  margin: 0;
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: 1.25rem;
  letter-spacing: -0.015em;
  color: var(--text-primary, #fff);
}
.proj-dossier-edit-deck {
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
}
.proj-dossier-edit-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.proj-dossier-edit-row-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.proj-dossier-edit-label {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
}
.proj-dossier-edit-input,
.proj-dossier-edit-textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  padding: 0.5rem 0.65rem;
  color: var(--text-primary, #fff);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
}
.proj-dossier-edit-input:focus,
.proj-dossier-edit-textarea:focus {
  outline: none;
  border-color: rgba(0, 180, 255, 0.55);
  background: rgba(0, 180, 255, 0.05);
}
.proj-dossier-edit-checkbox {
  width: 16px;
  height: 16px;
  accent-color: #00b4ff;
}
.proj-dossier-edit-status {
  font-size: 0.78rem;
  min-height: 1.1rem;
  color: rgba(255, 255, 255, 0.7);
}
.proj-dossier-edit-status.is-error {
  color: #ef5b6a;
}
.proj-dossier-edit-status.is-pending {
  color: #f4b740;
}
.proj-dossier-edit-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.4rem;
}
.proj-dossier-edit-save {
  appearance: none;
  -webkit-appearance: none;
  background: #00b4ff;
  color: #00121d;
  border: 0;
  border-radius: 5px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}
.proj-dossier-edit-save:hover {
  background: #2cc1ff;
}
.proj-dossier-edit-save:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.proj-dossier-edit-cancel {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}
.proj-dossier-edit-cancel:hover {
  border-color: rgba(255, 255, 255, 0.36);
  color: rgba(255, 255, 255, 0.9);
}
html[data-mah-theme="day"] .proj-dossier-edit-panel {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(0, 180, 255, 0.4);
}
html[data-mah-theme="day"] .proj-dossier-edit-h {
  color: rgba(0, 0, 0, 0.92);
}
html[data-mah-theme="day"] .proj-dossier-edit-deck {
  color: rgba(0, 0, 0, 0.62);
}
html[data-mah-theme="day"] .proj-dossier-edit-label {
  color: rgba(0, 0, 0, 0.65);
}
html[data-mah-theme="day"] .proj-dossier-edit-input,
html[data-mah-theme="day"] .proj-dossier-edit-textarea {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.14);
  color: rgba(0, 0, 0, 0.9);
}
html[data-mah-theme="day"] .proj-dossier-edit-status {
  color: rgba(0, 0, 0, 0.7);
}
html[data-mah-theme="day"] .proj-dossier-edit-cancel {
  color: rgba(0, 0, 0, 0.72);
  border-color: rgba(0, 0, 0, 0.18);
}
@media (prefers-reduced-motion: reduce) {
  .proj-dossier-edit-overlay {
    animation: none;
  }
}

/* ── v0.4.0 — dataset / experiment row affordances ─────────────
   Inline Edit / Delete pills attached to table-backed dossier rows,
   plus the "+ New dataset / + New experiment" footer button, plus the
   inline confirm bar used by Delete. Re-uses the v0.3.5 .proj-dossier-edit-*
   overlay tokens for the create/edit overlays themselves. */

.proj-dossier-data-wrap,
.proj-dossier-models-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.proj-dossier-row-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.3rem;
  flex-wrap: wrap;
  align-items: center;
}

.proj-dossier-row-action {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.proj-dossier-row-action:hover {
  background: rgba(0, 180, 255, 0.1);
  color: #00b4ff;
  border-color: rgba(0, 180, 255, 0.5);
}

.proj-dossier-row-action.is-danger:hover {
  background: rgba(255, 90, 90, 0.1);
  color: #ff7878;
  border-color: rgba(255, 90, 90, 0.5);
}

.proj-dossier-row-action:focus-visible {
  outline: 2px solid #00b4ff;
  outline-offset: 2px;
}

.proj-dossier-row-tag-meta {
  opacity: 0.55;
}

.proj-dossier-inline-confirm {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  background: rgba(255, 184, 0, 0.09);
  border: 1px solid rgba(255, 184, 0, 0.4);
  flex-wrap: wrap;
  width: 100%;
}

.proj-dossier-inline-confirm-label {
  font-size: 0.76rem;
  color: #ffb800;
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}

.proj-dossier-inline-confirm-yes,
.proj-dossier-inline-confirm-no {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.22rem 0.7rem;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    filter 0.15s;
}

.proj-dossier-inline-confirm-yes {
  background: #d44b4b;
  color: #fff;
  border-color: #d44b4b;
}

.proj-dossier-inline-confirm-yes:hover {
  filter: brightness(1.08);
}

.proj-dossier-inline-confirm-yes:disabled {
  opacity: 0.55;
  cursor: progress;
}

.proj-dossier-add-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.45rem;
}

.proj-dossier-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px dashed #00b4ff;
  background: transparent;
  color: #00b4ff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s,
    border-style 0.15s;
}

.proj-dossier-add-btn:hover {
  background: rgba(0, 180, 255, 0.08);
  border-style: solid;
}

.proj-dossier-add-btn:focus-visible {
  outline: 2px solid #00b4ff;
  outline-offset: 2px;
}

/* Day theme overrides */
html[data-mah-theme="day"] .proj-dossier-row-action {
  color: rgba(20, 30, 50, 0.72);
  border-color: rgba(20, 30, 50, 0.18);
}

html[data-mah-theme="day"] .proj-dossier-row-action:hover {
  background: rgba(0, 130, 200, 0.08);
  color: #006fc1;
  border-color: rgba(0, 130, 200, 0.45);
}

html[data-mah-theme="day"] .proj-dossier-row-action.is-danger:hover {
  background: rgba(200, 60, 60, 0.08);
  color: #b53939;
  border-color: rgba(200, 60, 60, 0.4);
}

html[data-mah-theme="day"] .proj-dossier-add-btn {
  color: #006fc1;
  border-color: #006fc1;
}

html[data-mah-theme="day"] .proj-dossier-add-btn:hover {
  background: rgba(0, 111, 193, 0.08);
}

html[data-mah-theme="day"] .proj-dossier-inline-confirm {
  background: rgba(255, 184, 0, 0.16);
  border-color: rgba(180, 130, 0, 0.55);
}

html[data-mah-theme="day"] .proj-dossier-inline-confirm-label {
  color: #8a5a00;
}

html[data-mah-theme="day"] .proj-dossier-inline-confirm-no {
  color: rgba(20, 30, 50, 0.82);
  border-color: rgba(20, 30, 50, 0.18);
}

/* Mobile — let actions wrap underneath instead of overflowing the row */
@media (max-width: 480px) {
  .proj-dossier-row-actions {
    margin-top: 0.4rem;
  }
  .proj-dossier-inline-confirm-label {
    flex-basis: 100%;
  }
  .proj-dossier-add-row {
    justify-content: stretch;
  }
  .proj-dossier-add-btn {
    width: 100%;
    justify-content: center;
  }
}
