/* 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;
  --mo-inset: #F1F3F4;
  --mo-card: #FFFFFF;
  --mo-field: #FFFFFF;
  --mo-line: #D8DCE3;
  --mo-accent: #1D4ED8;
  --mo-accent-tint: #E9EFFF;
  --mo-btn-fill: #0B1320;
  --mo-btn-ink: #FFFFFF;
  --mo-btn-hover: #243044;
  --mo-danger: #C4001A;
  --mo-danger-ink: #FFFFFF;
  /* Lockup line 2 module name (26 Sep 2026 ruling): ink on light, steel on Midnight
     (#B7C4D9, 10.56:1) — distinct from --mo-ink, which flips to near-white in dark. */
  --mo-module-ink: #0B1320;
  /* Deep tier of the four brand colours: main-button fills ONLY where RULES-CARD §6a allows (25 Sep 2026) */
  --mo-deep-green: #0D652D;   /* Finance --mo-btn-fill override; hover #0A5224 */
  --mo-deep-red: #A3261A;     /* --mo-danger hover only */
  --mo-deep-orange: #8A4507;  /* reserved, pending his ruling */
  --mo-deep-gold: #E0A800;    /* Notes --mo-btn-fill override = Notes' existing gold, unchanged; MIDNIGHT label; hover #C79500 (his ruling 25 Sep 2026) */
  --mo-deep-gold-ink: #0B1320;

  /* State colour accent (his ruling, 24 Sep 2026): a quiet hue on top of shape + order + words
     (rule §7), never instead of them. Proven in design/explorations/2026-09-24-state-colour/. */
  --mo-st-ok: #189A4E;
  --mo-st-ok-ink: #137B3E;
  --mo-st-watch: #AB8000;
  --mo-st-watch-ink: #876500;
  --mo-st-attn: #CF6B0D;
  --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;
    --mo-module-ink: #D1D5DB;
    --mo-st-ok: #1FC765;
    --mo-st-ok-ink: #38E07E;
    --mo-st-watch: #E6AB00;
    --mo-st-watch-ink: #FFC51A;
    --mo-st-attn: #D8700E;
    --mo-st-attn-ink: #F3963F;
    --mo-st-high: #CA2B1B;
    --mo-st-high-ink: #EA6E62;
  }
}

: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;
  --mo-module-ink: #D1D5DB;
  --mo-st-ok: #1FC765;
  --mo-st-ok-ink: #38E07E;
  --mo-st-watch: #E6AB00;
  --mo-st-watch-ink: #FFC51A;
  --mo-st-attn: #D8700E;
  --mo-st-attn-ink: #F3963F;
  --mo-st-high: #CA2B1B;
  --mo-st-high-ink: #EA6E62;
}

/* ---- 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;
} /* superseded by .mo-brand__line2 (26 Sep 2026 ruling) for module+tenant callers;
     class kept — a bare, undivided `context` string still renders through it. */
/* Line 2 of the lockup (26 Sep 2026 ruling): the module name, bold, then the tenant,
   muted, both 15px — never smaller. Supersedes the single 12px context line above
   for every caller that has (or is given) a module and a tenant. */
.mo-brand__line2 {
  display: block;
  font-size: 15px;
  margin-top: 2px;
  white-space: nowrap;
}
.mo-brand__module {
  font-weight: 800;
  color: var(--mo-module-ink);
}
.mo-brand__tenant {
  font-weight: 400;
  color: var(--mo-muted);
}

/* ---- 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;
  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-accent-tint);
  color: var(--mo-accent);
  border-left: 3px solid var(--mo-accent);
  padding-left: 10px;
}
.mo-nav__item.is-active .mo-nav__icon { color: var(--mo-accent); }

/* ---- 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;
  /* 56px of tabs PLUS the home-indicator strip: with border-box, a bare 56px would let the
     safe-area padding eat the tabs' own height (found on Comms, 24 Sep 2026). */
  height: calc(56px + env(safe-area-inset-bottom));
  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-accent); }
.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 + order + words, never hue (rule §7) ---- */
.mo-state { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--mo-ink); }
.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%); }

/* ---- State colour accent (his ruling, 24 Sep 2026): quiet, additive, never the only signal.
   Shape + order + words (above) always stay; this adds a hue on top of them, nowhere else.
   Strength "dot" — people rows and cards: .mo-state gets mo-hue-dot by default (MoState.tsx).
   Strength "edge" — KPI tiles and cards carrying data-state directly. No ring or wash strength
   is shipped in the kit (see RULES-CARD.md §7). ---- */

/* mo-hue-dot: an 8px dot ahead of the words, and the ring glyph itself takes the hue. The ring
   stays ::before (order -2); the dot is ::after, ordered ahead of the text (order -1) so the
   result reads ring → dot → words, never disturbing the DOM MoState.tsx already renders. */
.mo-state.mo-hue-dot::before { order: -2; }
.mo-state.mo-hue-dot::after {
  content: "";
  order: -1;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.mo-state.mo-hue-dot[data-state="engaged"]::after { background: var(--mo-st-ok); }
.mo-state.mo-hue-dot[data-state="engaged"]::before {
  border-color: var(--mo-st-ok);
  background: conic-gradient(var(--mo-st-ok) 0% 100%, transparent 100%);
}
.mo-state.mo-hue-dot[data-state="watch"]::after { background: var(--mo-st-watch); }
.mo-state.mo-hue-dot[data-state="watch"]::before {
  border-color: var(--mo-st-watch);
  background: conic-gradient(var(--mo-st-watch) 0% 75%, transparent 75% 100%);
}
.mo-state.mo-hue-dot[data-state="attention"]::after { background: var(--mo-st-attn); }
.mo-state.mo-hue-dot[data-state="attention"]::before {
  border-color: var(--mo-st-attn);
  background: conic-gradient(var(--mo-st-attn) 0% 50%, transparent 50% 100%);
}
.mo-state.mo-hue-dot[data-state="higher"]::after { background: var(--mo-st-high); }
.mo-state.mo-hue-dot[data-state="higher"]::before {
  border-color: var(--mo-st-high);
  background: conic-gradient(transparent 0% 100%);
}

/* mo-hue-edge: a 3px edge in the state hue — bottom edge on a tile, left edge on a card. Only
   that one edge changes colour; the other three sides stay --mo-line. Words, numbers and icons
   stay --mo-ink; only the thin rule carries the hue. */
.mo-hue-edge.mo-tile[data-state] {
  border-bottom-width: 3px;
  padding-bottom: 13px; /* 16px tile padding minus the 3px edge */
}
.mo-hue-edge.mo-card[data-state] {
  border-left-width: 3px;
  padding-left: 13px; /* 16px card padding minus the 3px edge */
}
.mo-hue-edge.mo-tile[data-state="engaged"] { border-bottom-color: var(--mo-st-ok); }
.mo-hue-edge.mo-card[data-state="engaged"] { border-left-color: var(--mo-st-ok); }
.mo-hue-edge.mo-tile[data-state="watch"] { border-bottom-color: var(--mo-st-watch); }
.mo-hue-edge.mo-card[data-state="watch"] { border-left-color: var(--mo-st-watch); }
.mo-hue-edge.mo-tile[data-state="attention"] { border-bottom-color: var(--mo-st-attn); }
.mo-hue-edge.mo-card[data-state="attention"] { border-left-color: var(--mo-st-attn); }
.mo-hue-edge.mo-tile[data-state="higher"] { border-bottom-color: var(--mo-st-high); }
.mo-hue-edge.mo-card[data-state="higher"] { border-left-color: var(--mo-st-high); }

/* ---- Phone breakpoint (≤768px) ---- */
@media (max-width: 768px) {
  .mo-topbar { display: none; } /* the phone header replaces it */
  .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); }
}
