/* Internal portal adapter — approved Messages visual direction, 2026-11-10.
   Loaded centrally by ui.css for every portal .page; withViewerNav also opts into components.
   Primitives remain owned by tokens.css. This bridges the existing portal's
   resolved html[data-theme] and legacy semantic variables; it changes no data,
   destinations, status meanings, navigation markup, or messaging behavior.
   Standalone Messages retains its own adapter and is explicitly excluded. */

/* theme-boot.js resolves System/Light/Dark before paint. Keep these semantics
   identical to tokens.css's dark block; an explicit local light/dark theme wins. */
html[data-theme="dark"] body.page:not([data-messages-app]):is(:not([data-mendo-theme]), [data-mendo-theme="system"]) {
  --mendo-canvas: #14251E;
  --mendo-surface: #192E25;
  --mendo-alternate: #243D30;
  --mendo-ink: var(--mendo-ivory);
  --mendo-muted: var(--mendo-sage);
  --mendo-border: #8B9F8B;
  --mendo-divider: #516653;
  --mendo-nav: #11291F;
  --mendo-nav-selected: #35563E;
  --mendo-primary: var(--mendo-sage);
  --mendo-on-primary: var(--mendo-navy);
  --mendo-selected: var(--mendo-sage);
  --mendo-on-selected: var(--mendo-forest);
  --mendo-focus: var(--mendo-ivory);
  --mendo-focus-offset: #14251E;
  --mendo-hover: #304B39;
  --mendo-disabled: #334338;
  --mendo-disabled-ink: #B2BFAF;
  --mendo-shadow: 0 2px 5px rgb(0 0 0 / .16);
  color-scheme: dark;
}

html body.page:not([data-messages-app]) {
  --font-sans: var(--mendo-font-sans);
  --font-serif: var(--mendo-font-display);
  --bg: var(--mendo-canvas);
  --paper: var(--mendo-surface);
  --alt: var(--mendo-alternate);
  --row: var(--mendo-alternate);
  --track: var(--mendo-alternate);
  --hover: var(--mendo-hover);
  --sel: var(--mendo-hover);
  --ink: var(--mendo-ink);
  --heading: var(--mendo-ink);
  --muted: var(--mendo-muted);
  --line: var(--mendo-divider);
  --field-line: var(--mendo-border);
  --control-line: var(--mendo-border);
  --accent: var(--mendo-primary);
  --on-accent: var(--mendo-on-primary);
  --accent-hover: color-mix(in srgb, var(--mendo-primary) 88%, var(--mendo-forest));
  --link: var(--mendo-primary);
  --blue: var(--mendo-primary);
  --blue-hover: var(--mendo-ink);
  --focus: var(--mendo-focus);
  --glow: var(--mendo-shadow);
  background-color: var(--mendo-canvas);
  background-image: none;
  color: var(--mendo-ink);
  font-family: var(--mendo-font-sans);
}

/* Existing error, warning, success, busy and code colors are intentionally
   inherited from ui.css/theme.css/status-look.css. Only working surfaces and
   ordinary actions are translated to the shared internal UI semantics. */
html body.page:not([data-messages-app]) :is(.queue, .workspace, .panel, .up-card, .modal, .home-attention) {
  border-radius: var(--mendo-radius-group);
}

html body.page:not([data-messages-app]) :where(main, #view, .modal, .assistant-panel) :is(.button, .btn, input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), select, textarea) {
  border-radius: var(--mendo-radius-control);
}

html body.page:not([data-messages-app]) :is(.workspace-header h2, .modal h2) {
  font-family: var(--mendo-font-display);
}

/* The existing list renderers retain ordering, unread and selected state.
   Their alternating-row hooks now use sage; selection has its own orange edge. */
html body.page:not([data-messages-app]) .queue-item.selected {
  box-shadow: inset 3px 0 var(--mendo-orange);
}

html body.page:not([data-messages-app]) .tabs {
  border-radius: var(--mendo-radius-control);
}

html body.page:not([data-messages-app]) .tabs button {
  border-radius: calc(var(--mendo-radius-control) - 3px);
}

html body.page:not([data-messages-app]) .tabs button[aria-pressed="true"] {
  background: var(--mendo-primary);
  color: var(--mendo-on-primary);
  box-shadow: inset 0 -3px var(--mendo-orange);
}

html body.page:not([data-messages-app]) .tabs button[aria-pressed="true"] .count {
  color: var(--mendo-on-primary);
}

/* These empty Home elements are decorative logo billboards. The genuine
   header/sign-in marks, all actions, and composer dimensions remain intact. */
html body.page:not([data-messages-app]) :is(.home-mvp-hero, .home-hero) {
  display: none;
}

html body.page:not([data-messages-app]) .composer-container.home-hero-open::before {
  content: none;
}

@media (forced-colors: active) {
  html body.page:not([data-messages-app]) .tabs button[aria-pressed="true"] {
    border: 2px solid Highlight;
    box-shadow: none;
  }
}

/* Forest ornament sits behind working panels; the genuine header mark is the
   phoenix breaking out of the computer screen. No text or controls over art. */
html body.page:not([data-messages-app]) {
 background-image:url("/internal-ui/forest.svg");background-repeat:repeat-x;
 background-position:center bottom;background-attachment:fixed;background-size:auto 220px;
}
html[data-theme="dark"] body.page:not([data-messages-app]):is(:not([data-mendo-theme]), [data-mendo-theme="system"]) {
 background-image:url("/internal-ui/forest-dark.svg");
}

/* The Work hub keeps its own --wh-* names; point them at the shared palette
   so its pages, filters and segmented controls match the rest of the portal. */
html body.page.work-hub-page:not([data-messages-app]) {
 --wh-canvas:var(--mendo-canvas);--wh-surface:var(--mendo-surface);--wh-stripe:var(--mendo-alternate);
 --wh-ink:var(--mendo-ink);--wh-muted:var(--mendo-muted);--wh-line:var(--mendo-divider);
 --wh-accent:var(--mendo-primary);--wh-section:var(--mendo-alternate);
}
html body.page.work-hub-page:not([data-messages-app]) :is(.wh-appearance, .wh-grouping) button[aria-pressed=true] {
 background:var(--mendo-selected);border-color:var(--mendo-selected);color:var(--mendo-on-selected);
}
html body.page:not([data-messages-app]) .queue-item:not(.selected):nth-child(even of :not([hidden])){background-color:var(--mendo-alternate)}
html body.page:not([data-messages-app]) .queue-item:not(.selected):nth-child(odd of :not([hidden])){background-color:var(--mendo-surface)}
@media(max-width:760px){html body.page:not([data-messages-app]){background-size:auto 140px}}
@media print,(forced-colors:active){html body.page:not([data-messages-app]){background-image:none}}
