/* MultiplyOS app switcher (approved design, 12 Oct 2026). Load after multiplyos.css: its tokens own both explicit
   and system themes, and the brief's colours are the fallbacks when a host has no kit tokens.
   Same overlay layer as mo-guide; core makes the two sheets mutually exclusive.
   Type: 15px is the floor for every word on a phone (768px and under) and for tile labels and subtitles
   everywhere; each size follows the person's text size (--mos-ts) above its floor.
   mos-text-ignore-file: switcher type has a 15px floor on phone. */
.mo-apps-root, .mo-apps-launcher {
  --mo-apps-bg: var(--mo-inset, #F7F8FA);
  --mo-apps-surface: var(--mo-card, #FFFFFF);
  --mo-apps-line: var(--mo-line, #E6E8EC);
  --mo-apps-ink: var(--mo-ink, #111827);
  --mo-apps-muted: var(--mo-muted, #6B7280);
  --mo-apps-primary: var(--mo-accent, #2563EB);
  --mo-apps-primary-tint: var(--mo-accent-tint, #EFF4FF);
  --mo-apps-on-primary: var(--mo-page, #FFFFFF);
  --mo-apps-15: max(15px, calc(15px * var(--mos-ts, 1)));
  --mo-apps-18: max(18px, calc(18px * var(--mos-ts, 1)));
  --mo-apps-small: max(13px, calc(13px * var(--mos-ts, 1)));
}

/* ---- The trigger: a 3x3 grid button for the top bar, next to notifications and the avatar ----
   The kit owns this control's look, so its box is !important: a host's shell rule for every header button
   (multiplyos-ui.css styles them all at a higher specificity) must not give it a border, padding or fill.
   display is left alone so a host can still hide it at a breakpoint. */
.mo-apps-launcher {
  appearance: none !important;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px !important;
  height: 40px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  margin: 0;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  color: var(--mo-apps-ink) !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 80ms ease-out, color 80ms ease-out, transform 100ms ease-out;
}
/* Nine rounded squares from one, so the glyph needs no image (any CSP) and takes currentColor. */
.mo-apps-launcher::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 1.25px;
  background: currentColor;
  box-shadow: 7px 0, 14px 0, 0 7px, 7px 7px, 14px 7px, 0 14px, 7px 14px, 14px 14px;
  transform: translate(-7px, -7px);
}
.mo-apps-launcher:hover { background: var(--mo-apps-bg) !important; }
.mo-apps-launcher:active { transform: scale(.96); background: color-mix(in srgb, var(--mo-apps-ink) 10%, transparent) !important; }
.mo-apps-launcher[aria-expanded="true"] { background: var(--mo-apps-primary) !important; color: var(--mo-apps-on-primary) !important; }
.mo-apps-launcher:focus-visible { outline: 2px solid var(--mo-apps-primary) !important; outline-offset: 2px !important; }

/* ---- The layer ---- */
.mo-apps-root {
  position: fixed;
  inset: 0;
  z-index: 2147482900;
  isolation: isolate;
  color: var(--mo-apps-ink);
  font: 400 var(--mo-apps-15)/1.35 system-ui, sans-serif;
}
.mo-apps-root[hidden], .mo-apps-root [hidden] { display: none !important; }
.mo-apps-root.mo-apps-closing { pointer-events: none; }
.mo-apps-root *, .mo-apps-root *::before, .mo-apps-root *::after { box-sizing: border-box; }
.mo-apps-root :is(a, button, p, span, h2, h3, li) { font-family: inherit; letter-spacing: normal; text-transform: none; }
.mo-apps-root :is(a, button) { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.mo-apps-root :focus-visible { outline: 2px solid var(--mo-apps-primary); outline-offset: 2px; }
.mo-apps-dim { position: absolute; inset: 0; background: transparent; }

/* ---- Desktop popover: 380 x auto (max 520), padding 16, radius 16, under the trigger ---- */
.mo-apps-panel {
  position: absolute;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100% - 32px));
  max-height: 520px;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--mo-apps-line);
  border-radius: 16px;
  background: var(--mo-apps-surface);
  color: var(--mo-apps-ink);
  box-shadow: 0 12px 32px color-mix(in srgb, #0B1320 14%, transparent), 0 2px 6px color-mix(in srgb, #0B1320 6%, transparent);
  animation: mo-apps-pop-in 160ms ease-out both;
}
.mo-apps-closing .mo-apps-panel { animation: mo-apps-pop-out 120ms ease-in both; }
@keyframes mo-apps-pop-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
@keyframes mo-apps-pop-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(.98); } }
.mo-apps-handle { display: none; }

.mo-apps-header {
  display: flex;
  flex: none;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 16px 12px;
  transition: box-shadow 80ms ease-out;
}
/* A hairline under the header once the list has scrolled under it. */
.mo-apps-panel[data-scrolled] .mo-apps-header { box-shadow: 0 1px 0 var(--mo-apps-line); }
.mo-apps-heading { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mo-apps-root .mo-apps-title { margin: 0; font-size: var(--mo-apps-18); font-weight: 600; line-height: 1.25; }
.mo-apps-root .mo-apps-subtitle { margin: 0; font-size: var(--mo-apps-15); color: var(--mo-apps-muted); }
.mo-apps-tools { display: flex; flex: none; align-items: center; gap: 4px; }
.mo-apps-root .mo-apps-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 4px 8px;
  border-radius: 10px;
  color: var(--mo-apps-primary);
  font-size: var(--mo-apps-15);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 80ms ease-out;
}
.mo-apps-home:hover { background: var(--mo-apps-primary-tint); }
.mo-apps-home-glyph { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mo-apps-home-words { display: flex; flex-direction: column; }
.mo-apps-home-sub { display: none; }
.mo-apps-root .mo-apps-close {
  appearance: none;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--mo-apps-muted);
  cursor: pointer;
  transition: background-color 80ms ease-out;
}
.mo-apps-close:hover { background: var(--mo-apps-bg); }
/* An x from two bars: no image, takes currentColor. */
.mo-apps-close-x { position: relative; width: 16px; height: 16px; }
.mo-apps-close-x::before, .mo-apps-close-x::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 0;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transform: rotate(45deg);
}
.mo-apps-close-x::after { transform: rotate(-45deg); }

.mo-apps-status { flex: none; margin: 0; padding: 12px 16px 0; color: var(--mo-apps-muted); }
.mo-apps-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 4px 16px 16px;
  scroll-padding-block: 8px;
}

/* ---- The grid: 4 columns; tiles 88 tall, radius 12; icon tiles 40, radius 10. The brief's 88-wide tiles with
   16 gaps do not fit its 380 panel, so the columns share the width and the gap is 10, as on the board. ---- */
.mo-apps-root .mo-apps-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.mo-apps-cell { display: flex; min-width: 0; }
.mo-apps-root .mo-apps-tile {
  --mo-apps-tile-accent: #64748B;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  min-height: 88px;
  padding: 10px 2px 8px;
  border: 1px solid var(--mo-apps-line);
  border-radius: 12px;
  background: var(--mo-apps-surface);
  color: var(--mo-apps-ink);
  text-align: center;
  text-decoration: none;
  transition: background-color 80ms ease-out, border-color 80ms ease-out, transform 100ms ease-out;
}
a.mo-apps-tile:hover { background: var(--mo-apps-bg); }
a.mo-apps-tile:active { transform: scale(.97); }
.mo-apps-root .mo-apps-tile--here {
  border-color: var(--mo-apps-primary);
  box-shadow: inset 0 0 0 1px var(--mo-apps-primary);
}
.mo-apps-root .mo-apps-tile--home { --mo-apps-tile-accent: #64748B; }
.mo-apps-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--mo-apps-tile-accent);
  color: #FFFFFF;
}
.mo-apps-glyph { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.mo-apps-label { display: block; max-width: 100%; font-size: var(--mo-apps-15); font-weight: 500; line-height: 1.2; overflow-wrap: break-word; hyphens: auto; }
.mo-apps-name { display: inline; }
.mo-apps-sub { display: block; color: var(--mo-apps-muted); }
.mo-apps-chip {
  display: inline-block;
  max-width: 100%;
  margin-top: auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--mo-apps-primary-tint);
  color: var(--mo-apps-primary);
  font-size: var(--mo-apps-small);
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.mo-apps-tile--off { cursor: default; }
.mo-apps-tile--off .mo-apps-mark { background: var(--mo-apps-line); color: var(--mo-apps-muted); }
.mo-apps-tile--off .mo-apps-label { color: var(--mo-apps-muted); }
.mo-apps-tile--off .mo-apps-chip { background: var(--mo-apps-bg); color: var(--mo-apps-muted); }

.mo-apps-root .mo-apps-notes { margin: 12px 0 0; padding: 0; list-style: none; color: var(--mo-apps-muted); font-size: var(--mo-apps-15); }
.mo-apps-note + .mo-apps-note { margin-top: 4px; }
.mo-apps-note-name { color: var(--mo-apps-ink); font-weight: 500; }
.mo-apps-root .mo-apps-section { margin: 16px 0 8px; font-size: var(--mo-apps-15); font-weight: 600; line-height: 1.3; color: var(--mo-apps-muted); }

/* ---- Other nations: a pill each ---- */
.mo-apps-nations { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.mo-apps-nations-name { flex-basis: 100%; font-weight: 500; }
.mo-apps-root .mo-apps-nation {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  max-width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--mo-apps-line);
  border-radius: 999px;
  color: var(--mo-apps-ink);
  font-size: var(--mo-apps-15);
  text-decoration: none;
  transition: background-color 80ms ease-out;
}
.mo-apps-nation:hover { background: var(--mo-apps-bg); }
.mo-apps-root .mo-apps-nation-main { border-color: var(--mo-apps-primary); font-weight: 600; }
.mo-apps-root .mo-apps-nation[aria-current] { background: var(--mo-apps-primary-tint); }

/* ---- Footer: the next app, then the sign-in line ---- */
.mo-apps-action {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--mo-apps-line);
  background: var(--mo-apps-surface);
}
.mo-apps-next-row { display: flex; flex-direction: column; gap: 6px; }
.mo-apps-root .mo-apps-hint { margin: 0; font-size: var(--mo-apps-15); font-weight: 600; color: var(--mo-apps-muted); }
.mo-apps-root .mo-apps-next {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 8px;
  width: 100%;
  height: auto;
  min-height: 44px;
  margin: 0;
  padding: 8px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--mo-apps-primary);
  color: var(--mo-apps-on-primary);
  font-size: var(--mo-apps-15);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  transition: filter 80ms ease-out, transform 100ms ease-out;
  /* Retain the kit ring if a host's next-step scan chooses a background step. */
  animation: mo-next-pulse 1.8s ease-out infinite;
}
.mo-apps-next:hover { filter: brightness(1.08); }
.mo-apps-next:active { transform: scale(.98); }
.mo-apps-destination { font-weight: 400; opacity: .9; }
.mo-apps-root .mo-apps-sso {
  display: block;
  margin: 0;
  color: var(--mo-apps-muted);
  font-size: var(--mo-apps-small);
  text-align: center;
}
.mo-apps-sso-glyph { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }

/* ---- Phone: a bottom sheet, full width, max 78% of the viewport, top corners 24, 3 columns, gap 12 ---- */
@media (max-width: 768px) {
  .mo-apps-launcher { width: 44px !important; height: 44px !important; }
  .mo-apps-root, .mo-apps-launcher { --mo-apps-small: var(--mo-apps-15); }
  .mo-apps-dim { background: color-mix(in srgb, #0B1320 32%, transparent); animation: mo-apps-fade-in 220ms ease-out both; }
  .mo-apps-closing .mo-apps-dim { animation: mo-apps-fade-out 180ms ease-in both; }
  .mo-apps-panel {
    inset: auto 0 0;
    width: 100%;
    max-height: 78%;
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    animation: mo-apps-sheet-in 220ms ease-out both;
  }
  .mo-apps-closing .mo-apps-panel { animation: mo-apps-sheet-out 180ms ease-in both; }
  .mo-apps-handle { display: block; flex: none; width: 36px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: var(--mo-apps-line); }
  /* Title and tools on one line, the subtitle under both at full width. */
  .mo-apps-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title tools" "sub sub";
    align-items: start;
    row-gap: 0;
    padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  }
  .mo-apps-heading { display: contents; }
  .mo-apps-root .mo-apps-title { grid-area: title; padding-top: 8px; }
  .mo-apps-root .mo-apps-subtitle { grid-area: sub; margin-top: 4px; }
  .mo-apps-tools { grid-area: tools; }
  .mo-apps-root .mo-apps-home { min-height: 44px; align-items: flex-start; }
  .mo-apps-home-sub { display: block; color: var(--mo-apps-muted); font-weight: 400; }
  .mo-apps-root .mo-apps-close { width: 44px; height: 44px; }
  .mo-apps-body { padding: 4px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); }
  .mo-apps-root .mo-apps-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .mo-apps-root .mo-apps-tile { min-height: 96px; padding: 12px 4px 10px; }
  .mo-apps-mark { width: 44px; height: 44px; border-radius: 12px; }
  .mo-apps-glyph { width: 24px; height: 24px; }
  .mo-apps-root .mo-apps-nation { min-height: 44px; }
  .mo-apps-action { padding: 12px max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .mo-apps-sso-glyph { width: 16px; height: 16px; }
}
@keyframes mo-apps-sheet-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes mo-apps-sheet-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(24px); } }
@keyframes mo-apps-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes mo-apps-fade-out { from { opacity: 1; } to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .mo-apps-launcher, .mo-apps-root * { transition: none !important; }
  .mo-apps-root .mo-apps-panel, .mo-apps-root .mo-apps-dim { animation: none !important; }
  .mo-apps-root .mo-apps-next { animation: none; outline: 3px solid var(--mo-apps-primary); outline-offset: 4px; }
}
@media print { .mo-apps-root { display: none !important; } }
