/* The only unflagged rule: added artwork must stay hidden in the legacy UI. */
.mos-brand-new { display: none; }

/* Apple-standard text sizes (owner ruling 5 Oct 2026): macOS 13px body on desktop, iOS 17px body on phones.
   Headings are fixed px steps, never em of a large base. */
html[data-ui="multiplyos"] {
  --mos-font-size: 13px;
  --mos-line: 1.4;
  --mos-title-size: 26px;
  --mos-section-size: 17px;
  --mos-caption-size: 12px;
  --mos-control-h: 32px;
  --mos-main-h: 36px;
  --mos-nav-h: 34px;
  --mos-control-pad: 6px 14px;
  --mos-field-pad: 6px 10px;
}
@media (max-width: 767px) {
  html[data-ui="multiplyos"] {
    --mos-font-size: 17px;
    --mos-line: 1.35;
    --mos-title-size: 28px;
    --mos-section-size: 20px;
    --mos-caption-size: 15px;
    --mos-control-h: 44px;
    --mos-main-h: 50px;
    --mos-nav-h: 44px;
    --mos-control-pad: 10px 18px;
    --mos-field-pad: 10px 14px;
  }
}

/* Keep rem spacing intact. Standalone auth pages retain their existing root/type. */
html[data-ui="multiplyos"]:has(.mos-shell) {
  font-size: 16px;
  color-scheme: light;
}

/* AU NATION SCOPE: globals.css defines --mo-ink and the rest on :root, :root:not([data-theme="light"])
   (inside prefers-color-scheme: dark) and :root[data-theme="dark"]. Redefining them on body, which is
   nearer to the content than any of those html-level scopes, wins in light, system-dark and forced-dark.
   AU has one shell (no GlobalChrome), so body:has(.mos-shell) is the only scope. */
html[data-ui="multiplyos"].mos-ui body:has(.mos-shell) {
  --mo-ink: var(--mos-text);
  --mo-muted: var(--mos-muted);
  --mo-page: var(--mos-background);
  --mo-card: var(--mos-surface);
  --mo-field: var(--mos-surface);
  --mo-inset: var(--mos-surface-soft);
  --mo-line: var(--mos-border);
  --mo-accent: var(--mos-focus);
  --mo-accent-tint: var(--mos-info-tint);
  --mo-btn-fill: var(--mos-primary);
  --mo-btn-ink: var(--mos-on-primary);
  --mo-btn-hover: var(--mos-primary-hover);
  --mo-danger: var(--mos-danger);
  --mo-danger-ink: var(--mos-background);
  --mo-module-ink: var(--mos-text);
  --mo-font: var(--mos-font-family);
  --text: var(--mos-text);
  --text-2: var(--mos-muted);
  --text-3: var(--mos-muted);
  --bg: var(--mos-background);
  --bg-2: var(--mos-surface-soft);
  --panel: var(--mos-surface);
  --panel-2: var(--mos-surface-soft);
  --panel-3: var(--mos-border);
  --border: var(--mos-border);
  --border-2: var(--mos-border);
  --critical: var(--mos-danger);
}

/* ThemeToggle writes data-theme; copy the approved dark palette without changing tokens.css. */
@media (prefers-color-scheme: dark) {
  html[data-ui="multiplyos"]:not([data-theme="light"]) {
    --mos-background:#0B1220;
    --mos-surface:#131E2F;
    --mos-surface-raised:#19263A;
    --mos-surface-soft:#223249;
    --mos-text:#F2F6FC;
    --mos-muted:#B4C2D6;
    --mos-border:#34465E;
    --mos-control-border:#8396AF;
    --mos-primary:#8CBFFF;
    --mos-primary-hover:#B8D7FF;
    --mos-on-primary:#061629;
    --mos-focus:#8CBFFF;
    --mos-nav-background:#060B12;
    --mos-nav-text:#F2F6FC;
    --mos-nav-muted:#B4C2D6;
    --mos-nav-active:#193355;
    --mos-success:#8CE2B3;
    --mos-success-tint:#133C2B;
    --mos-warning:#FFE095;
    --mos-warning-tint:#493805;
    --mos-danger:#FFB4BE;
    --mos-danger-tint:#49202B;
    --mos-info:#8CBFFF;
    --mos-info-tint:#18385E;
    color-scheme:dark;
  }
}
html[data-ui="multiplyos"][data-theme="dark"] {
  --mos-background:#0B1220;
  --mos-surface:#131E2F;
  --mos-surface-raised:#19263A;
  --mos-surface-soft:#223249;
  --mos-text:#F2F6FC;
  --mos-muted:#B4C2D6;
  --mos-border:#34465E;
  --mos-control-border:#8396AF;
  --mos-primary:#8CBFFF;
  --mos-primary-hover:#B8D7FF;
  --mos-on-primary:#061629;
  --mos-focus:#8CBFFF;
  --mos-nav-background:#060B12;
  --mos-nav-text:#F2F6FC;
  --mos-nav-muted:#B4C2D6;
  --mos-nav-active:#193355;
  --mos-success:#8CE2B3;
  --mos-success-tint:#133C2B;
  --mos-warning:#FFE095;
  --mos-warning-tint:#493805;
  --mos-danger:#FFB4BE;
  --mos-danger-tint:#49202B;
  --mos-info:#8CBFFF;
  --mos-info-tint:#18385E;
  color-scheme:dark;
}

html[data-ui="multiplyos"] body:has(.mos-shell),
html[data-ui="multiplyos"] .mos-shell,
html[data-ui="multiplyos"] .mos-shell :is(.auth-ui) {
  font-family: var(--mos-font-family);
  font-size: var(--mos-font-size);
  line-height: var(--mos-line);
  color: var(--mos-text);
}
html[data-ui="multiplyos"] body:has(.mos-shell) { background: var(--mos-background); }
html[data-ui="multiplyos"] .mos-shell {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  background: var(--mos-background);
  overflow-wrap: anywhere;
}

/* Limit component overrides to the shell's named regions, leaving the drawer alone.
   Charts keep their module typography; no SVG/text or chart-module selectors are restyled. */
html[data-ui="multiplyos"] .mos-shell :is(.mos-shell__main, .mos-shell__sidebar, .mos-shell__header, .mos-shell__tabbar) {
  font-family: var(--mos-font-family);
  font-size: var(--mos-font-size);
  line-height: var(--mos-line);
}

/* 22px prose also follows the reading size; larger metric utilities follow the hero. */
html[data-ui="multiplyos"] .mos-shell :where(.mos-shell__main, .mos-shell__sidebar, .mos-shell__header, .mos-shell__tabbar) :is(
  [class~="focus:text-[16px]"]:where(:focus),
  [class~="md:text-[13px]"],
  [class~="md:text-[20px]"],
  [class~="phone:text-[16px]"],
  [class~="sm:text-[15px]"],
  [class~="text-[12px]"],
  [class~="text-[13px]"],
  [class~="text-[14px]"],
  [class~="text-[15px]"],
  [class~="text-[16px]"],
  [class~="text-[17px]"],
  [class~="text-[18px]"],
  [class~="text-[19px]"],
  [class~="text-[20px]"],
  [class~="text-[22px]"],
  [class~="text-base"],
  [class~="text-lg"],
  [class~="text-sm"],
  [class~="text-xs"]
):not(:where([class*="charts"], [class*="charts"] *)) { font-size: 1em; line-height: var(--mos-line); }
html[data-ui="multiplyos"] .mos-shell :where(.mos-shell__main, .mos-shell__sidebar, .mos-shell__header, .mos-shell__tabbar) :is(
  [class~="md:text-[24px]"],
  [class~="md:text-[28px]"],
  [class~="md:text-[40px]"],
  [class~="sm:text-[32px]"],
  [class~="sm:text-[36px]"],
  [class~="text-2xl"],
  [class~="text-3xl"],
  [class~="text-4xl"],
  [class~="text-[24px]"],
  [class~="text-[25px]"],
  [class~="text-[26px]"],
  [class~="text-[27px]"],
  [class~="text-[28px]"],
  [class~="text-[29px]"],
  [class~="text-[30px]"],
  [class~="text-[31px]"],
  [class~="text-[32px]"],
  [class~="text-[33px]"],
  [class~="text-[34px]"],
  [class~="text-[35px]"],
  [class~="text-[36px]"],
  [class~="text-[37px]"],
  [class~="text-[38px]"],
  [class~="text-[39px]"],
  [class~="text-[40px]"],
  [class~="text-xl"]
):not(:where([class*="charts"], [class*="charts"] *)) { font-size: var(--mos-section-size); line-height: 1.25; }
html[data-ui="multiplyos"] .mos-shell :where(.mos-shell__main, .mos-shell__sidebar, .mos-shell__header, .mos-shell__tabbar) :is(
  [class~="md:text-[52px]"],
  [class~="text-[44px]"]
):not(:where([class*="charts"], [class*="charts"] *)) { font-size: var(--mos-title-size); line-height: 1.18; }

html[data-ui="multiplyos"] .mos-shell__main :is(.font-serif, .mo-h1, .mo-h2, .mo-h3) {
  font-family: var(--mos-font-family);
}
html[data-ui="multiplyos"] .mos-shell__main :is(.mo-label, .mo-caption, .mo-fieldlabel, .mo-why,
  .mo-status, .mo-state, .mo-light, .mo-help, .mo-tile__delta, .mo-compose__banner,
  .mo-compose__hint, .mo-compose__nudge, .mo-reach__hint, .mo-needs__line,
  .mo-needs__question, .mo-needs__link, .mo-needs__empty, .global-label, .global-note,
  .world-destination, .world-road-labels, .world-grouping, .world-tribe-name,
  .world-report-total, .needs-you__text, .needs-you__next, .needs-you__status,
  .global-detail > summary, .global-view-controls > details > summary, .mo-h3) {
  font-size: 1em;
  line-height: var(--mos-line);
}
html[data-ui="multiplyos"] .mos-shell__main .mo-h1 {
  font-size: var(--mos-title-size);
  font-weight: 700;
  line-height: 1.18;
}
html[data-ui="multiplyos"] .mos-shell__main :is(.mos-page-header h1, .global-header h1, .global-account h1) {
  font-family: var(--mos-font-family);
  font-size: var(--mos-title-size);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.02em;
}
/* Section headings outrank reading text; metric labels remain semibold body text. */
html[data-ui="multiplyos"] .mos-shell .mos-shell__main :is(h2, .mo-h2) {
  font-size: var(--mos-section-size);
  font-weight: 600;
  line-height: 1.25;
}
html[data-ui="multiplyos"] .mos-shell .mos-shell__main :is(h3, h4, h5, h6, .mo-h3) {
  font-size: 1em;
  font-weight: 600;
  line-height: 1.4;
}
html[data-ui="multiplyos"] .mos-page-header > .uppercase { text-transform: none; letter-spacing: 0; }

/* Approved artwork replaces only the shell lockups. */
html[data-ui="multiplyos"] .mos-brand-legacy { display: none; }
html[data-ui="multiplyos"] .mos-brand-new {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 270px;
  min-width: 0;
  flex-wrap: wrap;
}
html[data-ui="multiplyos"] .mos-brand-new img:first-child { width: 48px; height: auto; flex: none; }
html[data-ui="multiplyos"] .mos-brand-new img + img { width: 210px; max-width: calc(100% - 60px); height: auto; min-width: 0; }

html[data-ui="multiplyos"] .mos-shell__sidebar {
  display: none;
  height: 100dvh;
  padding: 32px 20px 24px;
  gap: 30px;
  border-right: 0;
  background: var(--mos-nav-background);
  color: var(--mos-nav-text);
  --text: var(--mos-nav-text);
  --text-2: var(--mos-nav-muted);
  --text-3: var(--mos-nav-muted);
  --bg: var(--mos-nav-active);
  --panel: var(--mos-nav-background);
  --panel-2: var(--mos-nav-active);
  --border: var(--mos-nav-muted);
}
html[data-ui="multiplyos"] .mos-shell__nav { display: grid; gap: 8px; }
html[data-ui="multiplyos"] .mos-shell__nav-item {
  min-height: var(--mos-nav-h);
  padding: 6px 12px;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--mos-nav-text);
  line-height: 1.35;
}
html[data-ui="multiplyos"] .mos-shell__nav-item svg { width: 18px; height: 18px; flex: none; }
html[data-ui="multiplyos"] .mos-shell__nav-item:hover { background: var(--mos-nav-active); }
html[data-ui="multiplyos"] .mos-shell__nav-item[aria-current="page"] {
  background: var(--mos-nav-active);
  border-color: #365B89;
  color: var(--mos-nav-text);
  font-weight: 600;
}
html[data-ui="multiplyos"] .mos-shell__nav-item > .absolute { display: none; }
html[data-ui="multiplyos"] .mos-shell__account {
  margin-top: auto;
  border-color: var(--mos-nav-muted);
  background: var(--mos-nav-background);
  color: var(--mos-nav-text);
}
html[data-ui="multiplyos"] .mos-shell__account .truncate { white-space: normal; overflow-wrap: anywhere; }
html[data-ui="multiplyos"] .mos-shell__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  height: auto;
  min-height: 56px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--mos-border);
  background: var(--mos-surface);
  color: var(--mos-text);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-ui="multiplyos"] .mos-shell__header .mos-brand-new {
  padding: 12px;
  max-width: 294px;
  border-radius: 12px;
  background: var(--mos-nav-background);
}
html[data-ui="multiplyos"] .mos-shell__header > .md\:hidden { display: flex; }
html[data-ui="multiplyos"] .mos-shell__header > .md\:block { display: none; }
html[data-ui="multiplyos"] .mos-shell__header > :is(div, nav) {
  height: auto;
  min-width: 0;
  flex-wrap: wrap;
}
html[data-ui="multiplyos"] .mos-shell__header > nav { flex-shrink: 1; }
html[data-ui="multiplyos"] .mos-shell__main {
  width: 100%;
  max-width: 1672px;
  min-width: 0;
  padding: 28px 24px calc(180px + env(safe-area-inset-bottom));
}
html[data-ui="multiplyos"] .mos-shell__main .global-screen { max-width: none; }
html[data-ui="multiplyos"] .mos-shell .mos-shell__main .global-metrics {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
html[data-ui="multiplyos"] .mos-shell__tabbar {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  height: auto;
  align-items: stretch;
  padding: 4px 8px calc(8px + env(safe-area-inset-bottom));
  background: var(--mos-surface);
  border-top: 1px solid var(--mos-border);
}
html[data-ui="multiplyos"] .mos-shell .mos-shell__tabbar > :is(a, button) {
  min-width: 0;
  min-height: 56px;
  padding: 6px 2px;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--mos-text);
  background: transparent;
}
html[data-ui="multiplyos"] .mos-shell__tabbar > :is(a, button) svg { width: 24px; height: 24px; flex: none; }
html[data-ui="multiplyos"] .mos-shell .mos-shell__tabbar > [aria-current="page"] { color: var(--mos-primary); border-color: var(--mos-primary); }

/* Main-button ownership stays with the existing components and next-step behavior. */
html[data-ui="multiplyos"] .mos-shell :where(.mos-shell__main, .mos-shell__header, .mos-shell__account) :is(button, .mo-button, .mo-button--quiet, .mo-button--main, .fx-button, .fx-button--main):not(:where([class*="charts"], [class*="charts"] *)) {
  height: auto;
  min-height: var(--mos-control-h);
  max-width: 100%;
  padding: var(--mos-control-pad);
  border: 1px solid var(--mos-control-border);
  border-radius: 12px;
  font-family: var(--mos-font-family);
  font-size: 1em;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--mos-text);
  background: var(--mos-surface);
  background-image: none;
  box-shadow: none;
}
html[data-ui="multiplyos"] .mos-shell :where(.mos-shell__main, .mos-shell__header, .mos-shell__account) :is(button, .mo-button, .fx-button):hover:not(:where([class*="charts"], [class*="charts"] *)) { background: var(--mos-surface-soft); }
html[data-ui="multiplyos"] .mos-shell .mos-shell__main :is(.mo-button--main, .fx-button--main) {
  min-height: var(--mos-main-h);
  background: var(--mos-primary);
  color: var(--mos-on-primary);
  border-color: var(--mos-primary);
}
html[data-ui="multiplyos"] .mos-shell .mos-shell__main :is(.mo-button--main, .fx-button--main):hover { background: var(--mos-primary-hover); }
html[data-ui="multiplyos"] .mos-shell__main :is(.mo-card, .mos-card, .mos-stat, .mo-tile) {
  min-width: 0;
  border: 1px solid var(--mos-border);
  border-radius: 22px;
  background: var(--mos-surface);
  box-shadow: none;
}
html[data-ui="multiplyos"] .mos-shell__main .mo-card.mo-hue-edge[data-state] { border-left-width: 3px; }
html[data-ui="multiplyos"] .mos-shell__main :is(.mo-field, .mo-compose__text, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea):not(:where([class*="charts"], [class*="charts"] *)) {
  height: auto;
  min-height: var(--mos-control-h);
  min-width: 0;
  max-width: 100%;
  padding: var(--mos-field-pad);
  font-family: var(--mos-font-family);
  font-size: 1em;
  line-height: var(--mos-line);
  border: 1px solid var(--mos-control-border);
  border-radius: 12px;
  background: var(--mos-surface);
  color: var(--mos-text);
  box-shadow: none;
}
html[data-ui="multiplyos"] .mos-shell__main :is(input, textarea):not(:where([class*="charts"], [class*="charts"] *))::placeholder { color: var(--mos-muted); opacity: 1; }
html[data-ui="multiplyos"] .mos-shell__main [aria-invalid="true"] { border-color: var(--mos-danger); }
html[data-ui="multiplyos"] .mos-shell__main .mo-table { font-size: 1em; border-collapse: collapse; }
html[data-ui="multiplyos"] .mos-shell__main .mo-table :is(th, td) { font-size: 1em; border-bottom: 1px solid var(--mos-border); padding: 8px 12px; }
html[data-ui="multiplyos"] .mos-shell__main .mo-table th { font-weight: 600; color: var(--mos-muted); background: var(--mos-surface-soft); }
html[data-ui="multiplyos"] .mos-shell__main .mo-table td::before { font-size: 1em; }
html[data-ui="multiplyos"] .mos-shell__main :is(.mos-pill, .mo-state) { max-width: 100%; white-space: normal; line-height: 1.4; }
html[data-ui="multiplyos"] .mos-shell__main .mos-pill { padding: 6px 12px; border-radius: 999px; color: var(--mos-info); background: var(--mos-info-tint); }
html[data-ui="multiplyos"] .mos-shell__main .mo-status--error { color: var(--mos-danger); }
html[data-ui="multiplyos"] .mos-shell__main .mo-status--done { color: var(--mos-success); }
html[data-ui="multiplyos"] .mos-shell__main .mo-status--busy { color: var(--mos-muted); }
html[data-ui="multiplyos"] .mos-shell [role="dialog"] {
  border: 1px solid var(--mos-border);
  border-radius: 24px;
  background: var(--mos-surface-raised);
  color: var(--mos-text);
  box-shadow: 0 12px 32px rgb(0 0 0 / .14);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
html[data-ui="multiplyos"] .mos-shell :where(.mos-shell__main, .mos-shell__sidebar, .mos-shell__header, .mos-shell__tabbar) :focus-visible:not(:where([class*="charts"], [class*="charts"] *)) {
  outline: 3px solid var(--mos-focus);
  outline-offset: 4px;
  box-shadow: none;
}

@media (min-width: 1100px) {
  html[data-ui="multiplyos"] .mos-shell { grid-template-columns: 260px minmax(0, 1fr); }
  html[data-ui="multiplyos"] .mos-shell__sidebar { display: flex; }
  html[data-ui="multiplyos"] .mos-shell__header { padding: 20px 36px; }
  html[data-ui="multiplyos"] .mos-shell__header > .md\:hidden { display: none; }
  html[data-ui="multiplyos"] .mos-shell__header > .md\:block { display: block; }
  html[data-ui="multiplyos"] .mos-shell__tabbar { display: none; }
  html[data-ui="multiplyos"] .mos-shell__main { padding: 36px; }
}
@media (max-width: 599px) {
  html[data-ui="multiplyos"] .mos-shell__header { padding: 16px; }
  html[data-ui="multiplyos"] .mos-shell__main { padding: 24px 16px calc(180px + env(safe-area-inset-bottom)); }
  html[data-ui="multiplyos"] .mos-shell :where(.mos-shell__main, .mos-shell__sidebar, .mos-shell__header, .mos-shell__tabbar) :is(
    [class~="md:text-[24px]"],
    [class~="md:text-[28px]"],
    [class~="md:text-[40px]"],
    [class~="sm:text-[32px]"],
    [class~="sm:text-[36px]"],
    [class~="text-2xl"],
    [class~="text-3xl"],
    [class~="text-4xl"],
    [class~="text-[24px]"],
    [class~="text-[25px]"],
    [class~="text-[26px]"],
    [class~="text-[27px]"],
    [class~="text-[28px]"],
    [class~="text-[29px]"],
    [class~="text-[30px]"],
    [class~="text-[31px]"],
    [class~="text-[32px]"],
    [class~="text-[33px]"],
    [class~="text-[34px]"],
    [class~="text-[35px]"],
    [class~="text-[36px]"],
    [class~="text-[37px]"],
    [class~="text-[38px]"],
    [class~="text-[39px]"],
    [class~="text-[40px]"],
    [class~="text-xl"]
  ):not(:where([class*="charts"], [class*="charts"] *)) { font-size: var(--mos-section-size); }
  html[data-ui="multiplyos"] .mos-shell__main .mo-h1 { font-size: var(--mos-title-size); }
  html[data-ui="multiplyos"] .mos-shell .mos-shell__main :is(.mos-page-header h1, .global-header h1, .global-account h1) { font-size: var(--mos-title-size); }
  html[data-ui="multiplyos"] .mos-shell__main :is(.mo-button--main, .fx-button--main) { width: 100%; min-height: var(--mos-main-h); }
  html[data-ui="multiplyos"] .mos-page-header { display: grid; gap: 12px; }
  html[data-ui="multiplyos"] .mos-shell .mos-shell__main .global-metrics { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 768px) {
  html[data-ui="multiplyos"] .mos-shell .mos-shell__main :is(h2, .mo-h2) { font-size: var(--mos-section-size); }
}
@media (prefers-reduced-motion: reduce) {
  html[data-ui="multiplyos"] .mos-shell *,
  html[data-ui="multiplyos"] .mos-shell *::before,
  html[data-ui="multiplyos"] .mos-shell *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Keep saying which app this is: the app name sits under the new lockup, as it did under the old one. */
html[data-ui="multiplyos"] .mos-brand-context {
  flex-basis: 100%;
  font-size: var(--mos-caption-size);
  font-weight: 600;
  line-height: 1.3;
  color: var(--mos-nav-muted);
}

/* Tab labels never break inside a word; they scale with the phone width (12px, as on iOS). */
html[data-ui="multiplyos"] .mos-shell__tabbar :is(a, span, button) {
  overflow-wrap: normal !important;
  word-break: normal !important;
  hyphens: none !important;
  white-space: nowrap !important;
}
html[data-ui="multiplyos"] .mos-shell__tabbar :is(a, button) {
  font-size: 12px !important;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
