/* MultiplyOS product design kit — stylesheet. Source: design/RULES-CARD.md v1, 23 Sep 2026.
   Every rule uses var(--mo-…); the only literal hexes in this file are the token definitions below.
   Font: Inter, root 15px. Dark theme is first class (rule 13). */

:root {
  --mo-ink: #0B1320;
  --mo-muted: #5B6472;
  --mo-page: #FFFFFF;
  /* Whisper well on a white card (rank chips, tile icons, avatars). Not the page field. */
  --mo-inset: #F1F3F4;
  --mo-card: #FFFFFF;
  --mo-field: #FFFFFF;
  --mo-line: #D8DCE3;
  --mo-accent: #1D4ED8;
  /* No longer a blue field. Leftover references resolve to the whisper inset. */
  --mo-accent-tint: #F8F9FA;
  --mo-btn-fill: #0B1320;
  --mo-btn-ink: #FFFFFF;
  --mo-btn-hover: #243044;
  --mo-danger: #C4001A;
  --mo-danger-ink: #FFFFFF;

  /* State colour accent (his ruling, 24 Sep 2026): a quiet hue on top of shape + order + words
     (rule §7), never instead of them. Pigments are the locked board — red #E0301E,
     orange #F07E13, yellow #F5D700, green #189A4E — the same fills as the spectrum mark.
     Ink companions are that hue deepened so a word on cloud still reads. */
  --mo-st-ok: #189A4E;
  --mo-st-ok-ink: #137B3E;
  --mo-st-watch: #F5D700;
  --mo-st-watch-ink: #7A6A00;
  --mo-st-attn: #F07E13;
  --mo-st-attn-ink: #9E520A;
  --mo-st-high: #E0301E;
  --mo-st-high-ink: #D52E1D;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mo-ink: #F2F5F9;
    --mo-muted: #9BA6B8;
    --mo-page: #0B1320;
    --mo-inset: #0B1320;
    --mo-card: #141C2B;
    --mo-field: #0F1626;
    --mo-line: #2A3547;
    --mo-accent: #7BA4FF;
    --mo-accent-tint: #1B2A4A;
    --mo-btn-fill: #F2F5F9;
    --mo-btn-ink: #0B1320;
    --mo-btn-hover: #D0D7E0;
    --mo-danger: #FF6B7F;
    --mo-danger-ink: #0B1320;
    /* Same locked pigments as light. Companions are a quiet step of the same hue —
       not the neon lifts (#1FC765, #FFC51A, #38E07E) that glowed on midnight. */
    --mo-st-ok: #189A4E;
    --mo-st-ok-ink: #2E9E5C;
    --mo-st-watch: #F5D700;
    --mo-st-watch-ink: #E8C200;
    --mo-st-attn: #F07E13;
    --mo-st-attn-ink: #E8893A;
    --mo-st-high: #E0301E;
    --mo-st-high-ink: #E24A3C;
  }
}

:root[data-theme="dark"] {
  --mo-ink: #F2F5F9;
  --mo-muted: #9BA6B8;
  --mo-page: #0B1320;
  --mo-inset: #0B1320;
  --mo-card: #141C2B;
  --mo-field: #0F1626;
  --mo-line: #2A3547;
  --mo-accent: #7BA4FF;
  --mo-accent-tint: #1B2A4A;
  --mo-btn-fill: #F2F5F9;
  --mo-btn-ink: #0B1320;
  --mo-btn-hover: #D0D7E0;
  --mo-danger: #FF6B7F;
  --mo-danger-ink: #0B1320;
  /* Same locked pigments as light. Companions are a quiet step of the same hue —
     not the neon lifts (#1FC765, #FFC51A, #38E07E) that glowed on midnight. */
  --mo-st-ok: #189A4E;
  --mo-st-ok-ink: #2E9E5C;
  --mo-st-watch: #F5D700;
  --mo-st-watch-ink: #E8C200;
  --mo-st-attn: #F07E13;
  --mo-st-attn-ink: #E8893A;
  --mo-st-high: #E0301E;
  --mo-st-high-ink: #E24A3C;
}

/* ---- Base ---- */
html { font-size: 15px; }
body {
  margin: 0;
  background: var(--mo-page);
  color: var(--mo-ink);
  font-family: var(--mo-font, Inter), system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 1rem;
  line-height: 1.55;
  font-weight: 400;
}
* { box-sizing: border-box; }

:focus-visible {
  outline: 2px solid var(--mo-accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--mo-card);
}

/* ---- Type ---- */
.mo-h1 { font-size: 28px; font-weight: 700; line-height: 1.15; margin: 0; color: var(--mo-ink); }
.mo-h2 { font-size: 21px; font-weight: 600; line-height: 1.25; margin: 0; color: var(--mo-ink); }
.mo-h3 { font-size: 17px; font-weight: 600; line-height: 1.35; margin: 0; color: var(--mo-ink); }
.mo-label { font-size: 13px; font-weight: 500; line-height: 1.4; color: var(--mo-muted); }
.mo-caption { font-size: 12px; font-weight: 400; line-height: 1.4; color: var(--mo-muted); }
.mo-num { font-variant-numeric: tabular-nums; }

/* ---- Brand lockup ---- Source: design/mark/SPEC.md §4. .mo-brand sets its own
   gap and font-size (the em basis for .mo-wordmark and .mo-brand__sub) inline,
   per size (side/phone/signin) — see MultiplyBrand in MultiplyMark.tsx. */
.mo-brand { display: inline-flex; align-items: center; }
.mo-wordmark { font-weight: 400; letter-spacing: -0.005em; color: var(--mo-ink); white-space: nowrap; }
.mo-wordmark__lede { font-weight: 800; letter-spacing: -0.015em; }
.mo-brand--signin .mo-wordmark { letter-spacing: -0.015em; }
.mo-brand--signin .mo-wordmark__lede { font-weight: 900; letter-spacing: -0.03em; }
.mo-brand--accent { color: var(--mo-accent); }
.mo-brand__sub {
  display: block;
  font-size: max(12px, 0.30534em); /* 0.42 × cap height (cap = 0.727em) */
  font-weight: 500;
  color: var(--mo-muted);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-top: 4px;
}
.mo-brand__context {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--mo-muted);
  margin-top: 2px;
}

/* ---- Sidebar / nav ---- */
.mo-side {
  width: 240px;
  flex: none;
  background: var(--mo-card);
  border-right: 1px solid var(--mo-line);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 16px;
}
.mo-nav { display: flex; flex-direction: column; gap: 2px; }
.mo-nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 12px 0 13px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--mo-ink);
  text-decoration: none;
  border-left: 3px solid transparent;
  background: transparent;
}
.mo-nav__icon { width: 20px; height: 20px; flex: none; color: var(--mo-ink); }
.mo-nav__item.is-active {
  background: var(--mo-inset);
  color: var(--mo-ink);
  font-weight: 600;
  border-left: 3px solid var(--mo-ink);
  padding-left: 10px;
}
.mo-nav__item.is-active .mo-nav__icon { color: var(--mo-ink); }

/* ---- Top bar ---- */
.mo-topbar {
  height: 64px;
  background: var(--mo-card);
  border-bottom: 1px solid var(--mo-line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}
.mo-search {
  height: 44px;
  flex: 1;
  max-width: 420px;
  border: 1px solid var(--mo-line);
  border-radius: 10px;
  background: var(--mo-field);
  color: var(--mo-ink);
  padding: 0 14px;
  font-size: 15px;
}
.mo-search::placeholder { color: var(--mo-muted); }
.mo-userchip { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mo-userchip__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--mo-inset);
  color: var(--mo-ink);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 500;
  flex: none;
}

/* ---- Page ---- */
.mo-page { background: var(--mo-page); padding: 24px; min-height: 100vh; }
.mo-page__inner { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }

/* ---- Tile ---- */
.mo-tile {
  background: var(--mo-card);
  border: 1px solid var(--mo-line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mo-tile__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--mo-inset);
  color: var(--mo-ink);
  display: grid;
  place-items: center;
}
.mo-tile__icon svg { width: 18px; height: 18px; }
.mo-tile__value { font-size: 28px; font-weight: 700; color: var(--mo-ink); }
.mo-tile__delta { font-size: 13px; color: var(--mo-muted); display: inline-flex; align-items: center; gap: 4px; }

/* ---- Card ---- */
.mo-card {
  background: var(--mo-card);
  border: 1px solid var(--mo-line);
  border-radius: 12px;
  padding: 16px;
}

/* ---- List ---- */
.mo-list { display: flex; flex-direction: column; flex: none; border: 1px solid var(--mo-line); border-radius: 12px; overflow: hidden; background: var(--mo-card); }
/* A list inside a fixed-height scroll box scrolls; it never shrinks its rows into each other. */
.mo-list__row {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--mo-line);
  color: var(--mo-ink);
  text-decoration: none;
  background: transparent;
  width: 100%;
  cursor: pointer;
}
.mo-list__row:last-child { border-bottom: none; }

/* ---- Phone header / tabbar ---- */
.mo-header {
  display: none;
  height: 56px;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--mo-card);
  border-bottom: 1px solid var(--mo-line);
}
.mo-tabbar {
  display: none;
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  height: 56px;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--mo-card);
  border-top: 1px solid var(--mo-line);
}
.mo-tabbar__tab {
  flex: 1;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  min-height: 56px;
  font-size: 12px;
  color: var(--mo-muted);
  text-decoration: none;
}
.mo-tabbar__tab.is-active { color: var(--mo-ink); font-weight: 600; }
.mo-tabbar__tab svg { width: 20px; height: 20px; }

/* ---- Buttons ---- */
.mo-button,
.mo-button--main,
.mo-button--quiet,
.mo-button--danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--mo-line);
  background: var(--mo-card);
  color: var(--mo-ink);
  cursor: pointer;
}
.mo-button--main {
  background: var(--mo-btn-fill);
  color: var(--mo-btn-ink);
  border: none;
}
.mo-button--main:hover { background: var(--mo-btn-hover); }
.mo-button--quiet {
  background: transparent;
  border: none;
  color: var(--mo-accent);
  padding: 0 4px;
}
.mo-button--danger {
  background: var(--mo-danger);
  color: var(--mo-danger-ink);
  border: none;
}

/* ---- Fields ---- */
.mo-field {
  height: 44px;
  width: 100%;
  font-size: 15px;
  color: var(--mo-ink);
  background: var(--mo-field);
  border: 1px solid var(--mo-line);
  border-radius: 10px;
  padding: 0 14px;
}
.mo-field::placeholder { color: var(--mo-muted); }
.mo-fieldlabel { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--mo-muted); }
.mo-why { display: block; margin-top: 6px; font-size: 13px; color: var(--mo-muted); }

/* ---- Status ---- */
.mo-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.mo-status--error { color: var(--mo-danger); }
.mo-status--busy { color: var(--mo-muted); }
.mo-status--done { color: var(--mo-ink); }

/* ---- Next-step signal. Exactly one .mo-next on a screen at a time. ---- */
.mo-next { position: relative; animation: mo-next-pulse 1.8s ease-out infinite; }
@keyframes mo-next-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mo-accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 16px color-mix(in srgb, var(--mo-accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mo-accent) 0%, transparent); }
}
.mo-next-pill {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  max-width: calc(100vw - 32px);
  padding: 0 20px;
  border: 2px solid var(--mo-accent);
  border-radius: 999px;
  background: var(--mo-btn-fill);
  color: var(--mo-btn-ink);
  font: inherit;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.25);
  animation: mo-next-pulse 1.8s ease-out infinite;
}
.mo-next-pill[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .mo-next, .mo-next-pill { animation: none; outline: 3px solid var(--mo-accent); outline-offset: 4px; }
}

/* ---- Empty state ---- */
.mo-empty {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 48px 24px;
  text-align: center;
  border: 2px dashed var(--mo-line);
  border-radius: 12px;
  color: var(--mo-ink);
}

/* ---- States: shape + words, supported by the Heartbeat colour accent ---- */
.mo-state { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--mo-ink); }
.mo-state--compact { font-size: 12px; line-height: 1.4; }
.mo-state::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--mo-ink);
  background: conic-gradient(var(--mo-ink) 0%, var(--mo-ink) 0%, transparent 0%, transparent 100%);
}
.mo-state[data-state="engaged"]::before { background: conic-gradient(var(--mo-ink) 0% 100%, transparent 100%); }
.mo-state[data-state="watch"]::before { background: conic-gradient(var(--mo-ink) 0% 75%, transparent 75% 100%); }
.mo-state[data-state="attention"]::before { background: conic-gradient(var(--mo-ink) 0% 50%, transparent 50% 100%); }
.mo-state[data-state="higher"]::before { background: conic-gradient(transparent 0% 100%); }

/* The pipeline uses the existing momentum status, not a stage or a new score.
   Words and ring fill still distinguish states with colour disabled. */
[data-state="engaged"] { --mo-state-hue: var(--mo-st-ok); --mo-state-ring: var(--mo-st-ok-ink); }
[data-state="watch"] { --mo-state-hue: var(--mo-st-watch); --mo-state-ring: var(--mo-st-watch-ink); }
[data-state="attention"] { --mo-state-hue: var(--mo-st-attn); --mo-state-ring: var(--mo-st-attn-ink); }
[data-state="higher"] { --mo-state-hue: var(--mo-st-high); --mo-state-ring: var(--mo-st-high-ink); }

/* One shape per status. Pigment carries the hue; the companion edge keeps yellow
   and orange readable on white. The legacy class name remains for existing consumers. */
.mo-state.mo-hue-dot { gap: 6px; }
.mo-state.mo-hue-dot::before { order: -2; border-color: var(--mo-state-ring); }
.mo-state.mo-hue-dot[data-state="engaged"]::before { background: var(--mo-state-hue); }
.mo-state.mo-hue-dot[data-state="watch"]::before { background: conic-gradient(var(--mo-state-hue) 0% 75%, transparent 75% 100%); }
.mo-state.mo-hue-dot[data-state="attention"]::before { background: conic-gradient(var(--mo-state-hue) 0% 50%, transparent 50% 100%); }

/* Quiet edges keep the page and every card white. */
.mo-person-row { border-left: 3px solid transparent; }
.mo-person-row[data-state] { border-left-color: var(--mo-state-hue); }
.mo-hue-edge.mo-tile[data-state] { border-bottom: 3px solid var(--mo-state-hue); }
.mo-hue-edge.mo-card[data-state] { border-left: 3px solid var(--mo-state-hue); }

/* ---- Phone breakpoint (≤768px) ---- */
@media (max-width: 768px) {
  .mo-side { display: none; }
  .mo-header { display: flex; }
  .mo-tabbar { display: flex; }
  .mo-button--main { height: 56px; width: 100%; }
  .mo-field { height: 56px; }
  .mo-page { padding: 16px; }
  .mo-tabbar { padding-bottom: env(safe-area-inset-bottom); }
}
