/* P0099 · Settings (and the Home shell) in the Dark theme. Load after app.css and home.css.
   No structural change: this re-points the existing design-system tokens (tokens.css) for Dark and replaces the few
   literal colours in home.css (Home and Settings v2) with tokens. Light needs nothing: it is the current design.

   Scope: only screens that carry `.uws-app.is-launch` (Home and Settings, per the Home and Settings v2 package).
   Module screens are untouched; drop the `:has(...)` part if the whole shell should follow the theme later.
   Workspace host (3 Dec 2026): every rule below is scoped to `.uws-app.is-launch`, and the last block covers the
   literal whites of the shared top bar, Search and account menu on Settings (app.css), which the token remap misses. */

:root[data-theme="dark"]:has(.uws-app.is-launch) {
  --paper: #0B0B0F;
  --white: #16161C;
  --ink: #F4F4F7;
  --grey-600: #A1A1AC;
  --grey-300: rgba(255, 255, 255, .22);
  --grey-200: rgba(255, 255, 255, .10);
  --grey-100: rgba(255, 255, 255, .06);
  --violet-100: rgba(157, 133, 255, .16);
  --violet-200: rgba(157, 133, 255, .34);
  --violet-600: #B9A8FF;
  --violet-700: #CFC3FF;
  --ws-control-border: rgba(255, 255, 255, .22);
  --ws-row-hover: rgba(255, 255, 255, .06);
  --ws-rule: rgba(255, 255, 255, .10);
  --ws-subrow: rgba(255, 255, 255, .03);
  --ws-text-tertiary: #B4B4BE;
  --ws-shadow-pop: 0 12px 32px rgba(0, 0, 0, .5);
  --ws-tone-warn-fg: #F5C27A; --ws-tone-warn-bg: rgba(168, 91, 8, .22);
  --ws-tone-acc-fg: #CFC3FF;  --ws-tone-acc-bg: rgba(157, 133, 255, .16);
  --ws-tone-neu-fg: #C9C9D1;  --ws-tone-neu-bg: rgba(255, 255, 255, .08);
  --surface-scrim: rgba(0, 0, 0, .6);
  background: var(--paper);
  color: var(--ink);
}

/* Literal colours in home.css (v2) → tokens. Selectors match home.css exactly. */
:root[data-theme="dark"] .uws-app.is-launch .uws-settings-btn { background: var(--white); }
:root[data-theme="dark"] .uws-app.is-launch .uws-settings-btn.is-on,
:root[data-theme="dark"] .uws-app.is-launch .uws-settings-btn.is-on:hover { background: var(--ink); border-color: var(--ink); color: #0B0B0F; }
:root[data-theme="dark"] .uws-app.is-launch .uws-set-note { color: var(--grey-600); }
:root[data-theme="dark"] .uws-app.is-launch .uws-set-entry { background: var(--white); }
:root[data-theme="dark"] .uws-app.is-launch .uws-set-entry:hover { border-color: var(--violet-200); }
:root[data-theme="dark"] .uws-app.is-launch .uws-set-entry__step { background: var(--ws-tone-warn-bg); color: var(--ws-tone-warn-fg); }
:root[data-theme="dark"] .uws-app.is-launch .uws-set-entry__chev { color: var(--grey-600); }
/* Module tint squares keep their registry hue; on Dark they sit on a slightly lifted disc so pale tints don't glare. */
:root[data-theme="dark"] .uws-app.is-launch .uws-set-entry__icon { filter: saturate(.9) brightness(.92); }
:root[data-theme="dark"] .uws-app.is-launch .uws-launch__empty-mark { background: var(--violet-100); }

@container uws (max-width: 759px) {
  :root[data-theme="dark"] .uws-app.is-launch .uws-set-list { background: var(--white); border-color: var(--grey-200); }
  :root[data-theme="dark"] .uws-app.is-launch .uws-set-list > li + li .uws-set-entry { border-top-color: var(--grey-100); }
  :root[data-theme="dark"] .uws-app.is-launch .uws-set-entry:active { background: var(--paper); }
  :root[data-theme="dark"] .uws-app.is-launch .uws-settings-btn.is-on,
  :root[data-theme="dark"] .uws-app.is-launch .uws-settings-btn.is-on:hover { background: var(--violet-100); color: var(--violet-600); }
}

/* Workspace host: shared shell pieces on Settings with literal whites in app.css / home.css. */
:root[data-theme="dark"] .uws-app.is-launch .uws-topbar { background: var(--paper); border-bottom-color: var(--ws-rule); }
:root[data-theme="dark"] .uws-app.is-launch .uws-jump,
:root[data-theme="dark"] .uws-app.is-launch .uws-menu__trigger { background: var(--white); color: var(--ink); }
:root[data-theme="dark"] .uws-app.is-launch .uws-jump { color: var(--grey-600); }
:root[data-theme="dark"] .uws-app.is-launch .uws-menu__pop { background: var(--white); border-color: var(--ws-rule); }
:root[data-theme="dark"] .uws-app.is-launch .uws-brand img { filter: brightness(1.35); }
/* The contextual sign-in popover on the public Home (literal whites in home.css). */
:root[data-theme="dark"] .uws-app.is-launch :is(.uws-signin-context, .uws-signin-google, .uws-signin-notice) { background: var(--white); border-color: var(--grey-300); color: var(--ink); }
/* Super Admin "Preview as" control (portal on <body>, app.css): keep its dark pill and readable menu on Home/Settings. */
:root[data-theme="dark"]:has(.uws-app.is-launch) .uws-proto .uws-menu__trigger.is-dark { background: #16161C; border-color: rgba(255, 255, 255, .22); color: #FFFFFF; }
:root[data-theme="dark"]:has(.uws-app.is-launch) .uws-proto .uws-menu__pop { background: var(--white); border-color: var(--ws-rule); }
