Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

36.7 KB
Raw Blame
@import "tailwindcss";
@import "tw-animate-css";

/* Dark is driven by [data-theme=dark] (os-rr convention), so shadcn `dark:`
   utilities key off the same attribute. */
@custom-variant dark (&:is([data-theme=dark] *));

/* ── os-rr design tokens (light / aqua default) ─────────────────────── */
:root {
  color-scheme: light;
  /* Chrome typeface tokens. NOTE the mono token is --font-mono-ui, NOT
     --font-mono: the @theme inline block maps Tailwind's --font-mono to it —
     naming both the same created a self-referential var() cycle that nuked
     monospace everywhere. Theme presets override BOTH (presets/apply.ts). */
  --font-ui: var(--font-geist-sans), -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono-ui: var(--font-geist-mono), ui-monospace, "SF Mono", Menlo, monospace;
  /* a11y text scale — driven live by the appearance store (Settings → Theme);
     the rem cascade follows because this is the root font-size. */
  --font-scale: 1;

  /* Notch / home-bar safe areas — read by the AppShell ResponsiveProvider and
     by primitives (AppFrame body padding). Resolve to 0 off-device. */
  --sai-top: env(safe-area-inset-top, 0px);
  --sai-right: env(safe-area-inset-right, 0px);
  --sai-bottom: env(safe-area-inset-bottom, 0px);
  --sai-left: env(safe-area-inset-left, 0px);

  /* ── Shell z-index scale ────────────────────────────────────────────
     Documented source of truth for the full-screen modal tier (consumed
     as z-[var(--z-*)]). Window-tile (10–80) + shell-chrome (880–2000)
     layers stay inline — their relative order is self-evident in context. */
  --z-skip-link: 2000;
  --z-quick-look: 8000;
  --z-launcher: 8400;
  --z-clipboard: 8500;
  --z-share: 8600;
  --z-shortcut-help: 8700;
  --z-spotlight: 9000;
  --z-lock-screen: 9500;

  /* Primary accent — darkened from #2f7bf6 (3.97:1 vs white) to #1f6df0
     (4.66:1) so primary buttons hit WCAG AA. Visual delta is minimal. */
  --accent: #1f6df0;
  --accent-text: #ffffff;

  --text: #1c1c1f;
  --text-dim: rgba(28, 28, 31, 0.62);
  --text-faint: rgba(28, 28, 31, 0.38);
  --sep: rgba(0, 0, 0, 0.1);
  --sep-strong: rgba(0, 0, 0, 0.16);

  /* iOS grouped-list + systemFill + liquid-glass edge. Referenced only by
     [data-shell="ios"] rules → inert for the android/windows/dashboard shells. */
  --grouped: #f2f2f7;
  --fill: rgba(118, 118, 128, 0.12);
  --fill2: rgba(118, 118, 128, 0.24);
  --glass-hi: rgba(255, 255, 255, 0.95);
  --glass-stroke: rgba(255, 255, 255, 0.7);
  /* Notification Center — a dark glass panel over the wallpaper in BOTH themes
     (iOS lock-screen aesthetic), so it is not redefined under dark. */
  --glass-nc: rgba(20, 22, 38, 0.62);

  --glass-bar: rgba(250, 250, 252, 0.62);
  --glass-panel: rgba(252, 252, 254, 0.78);
  --glass-menu: rgba(252, 252, 254, 0.86);
  --window-bg: rgba(248, 248, 251, 0.86);
  --surface: #f4f4f7;
  --window-head: rgba(255, 255, 255, 0.55);
  --sidebar: rgba(244, 244, 248, 0.7);
  --field: rgba(255, 255, 255, 0.7);
  --hover: rgba(0, 0, 0, 0.05);
  --hover-strong: rgba(0, 0, 0, 0.09);
  --inset: rgba(0, 0, 0, 0.04);

  --blur: 30px;
  /* Single radius source: a color preset sets --radius and window/control
     corners derive from it (DRY). --radius-icon is a squircle proportion (%),
     not a corner radius, so it stays constant. */
  --radius: 0.625rem;
  --radius-win: calc(var(--radius) + 0.125rem);
  --radius-icon: 22%;
  --shadow-win: 0 0 0 0.5px rgba(0, 0, 0, 0.16), 0 24px 60px -12px rgba(0, 0, 0, 0.42), 0 8px 22px -10px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 14px 38px -8px rgba(0, 0, 0, 0.32);
  --dock-bg: rgba(255, 255, 255, 0.34);

  /* shadcn token bridge → os-rr palette */
  --background: var(--surface);
  --foreground: var(--text);
  --card: var(--window-bg);
  --card-foreground: var(--text);
  --popover: var(--glass-menu);
  --popover-foreground: var(--text);
  --primary: var(--accent);
  --primary-foreground: var(--accent-text);
  --secondary: var(--field);
  --secondary-foreground: var(--text);
  --muted: var(--inset);
  --muted-foreground: var(--text-dim);
  --accent-bg: var(--hover);
  --accent-foreground: var(--text);
  --destructive: #ff5f57;
  /* AA-safe red for destructive TEXT on a light card (the fill --destructive
     stays bright for buttons/dots where white sits on top). */
  --destructive-text: #d70015;
  --success: #34c759;
  --warning: #ff9500;
  /* Darker than iOS #0a84ff so tinted TEXT (links, action rows) clears AA 4.5:1
     on the light card; bg-info + the dark-theme value stay bright. */
  --info: #0060df;
  --border: var(--sep);
  --input: var(--sep-strong);
  --ring: var(--accent);
}

/* Accessibility: high-contrast (Settings / a11y commands) — stronger
   separators + darker secondary text, both themes. NOTE: order matters —
   the base [data-theme="dark"] block MUST come before the high-contrast
   variant so scripts/check-contrast.mjs's first-match regex picks up the
   correct dark token map (the high-contrast variant has unique --text-dim
   that scans as a false-positive against light backgrounds). */
.high-contrast {
  --sep: rgba(0, 0, 0, 0.45);
  --sep-strong: rgba(0, 0, 0, 0.6);
  --text-dim: rgba(28, 28, 31, 0.88);
}

[data-theme="dark"] {
  color-scheme: dark;
  --text: #f2f2f5;
  --text-dim: rgba(242, 242, 245, 0.64);
  --text-faint: rgba(242, 242, 245, 0.4);
  --sep: rgba(255, 255, 255, 0.1);
  --sep-strong: rgba(255, 255, 255, 0.18);

  --grouped: #000000;
  --fill: rgba(120, 120, 128, 0.24);
  --fill2: rgba(120, 120, 128, 0.36);
  --glass-hi: rgba(255, 255, 255, 0.2);
  --glass-stroke: rgba(255, 255, 255, 0.14);

  --glass-bar: rgba(28, 28, 32, 0.6);
  --glass-panel: rgba(34, 34, 40, 0.74);
  --glass-menu: rgba(40, 40, 46, 0.86);
  --window-bg: rgba(34, 34, 40, 0.82);
  --surface: #1b1b20;
  --window-head: rgba(60, 60, 68, 0.5);
  --sidebar: rgba(28, 28, 33, 0.6);
  --field: rgba(255, 255, 255, 0.08);
  --hover: rgba(255, 255, 255, 0.08);
  --hover-strong: rgba(255, 255, 255, 0.14);
  --inset: rgba(0, 0, 0, 0.25);

  --shadow-win: 0 0 0 0.5px rgba(0, 0, 0, 0.6), 0 28px 70px -12px rgba(0, 0, 0, 0.7), 0 8px 22px -10px rgba(0, 0, 0, 0.55);
  --shadow-pop: 0 0 0 0.5px rgba(255, 255, 255, 0.08), 0 16px 40px -8px rgba(0, 0, 0, 0.6);
  --dock-bg: rgba(40, 40, 48, 0.42);

  --warning: #ff9f0a;
  --info: #409cff;
  --destructive-text: #ff5f57; /* bright red for destructive text on the dark card (AA 5.4:1) */
}

.high-contrast[data-theme="dark"] {
  --sep: rgba(255, 255, 255, 0.4);
  --sep-strong: rgba(255, 255, 255, 0.55);
  --text-dim: rgba(236, 237, 241, 0.92);
}

.reduce-glass { --blur: 0px; }

@theme inline {
  --font-sans: var(--font-ui);
  --font-mono: var(--font-mono-ui);
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent-bg);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-text: var(--destructive-text);
  --color-success: var(--success);
  --color-warning: var(--warning);
  --color-info: var(--info);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-sidebar: var(--sidebar);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
}

/* MUST stay inside @layer base. Unlayered CSS beats EVERY layered rule in the
   cascade, and Tailwind 4 emits all utilities into layers — so while this lived
   outside a layer it silently overrode every `border-<color>` utility in the app.
   Measured before the fix: `border-red-500`, `border-primary` and
   `border-foreground/70` all computed to rgba(0,0,0,0.1), identical to no class
   at all — 64 usages across 48 files, including 15 `border-primary` selection
   states, 10 `border-destructive/*` danger states and 6 `border-ring`. Same trap
   applies to `box-border`/`box-content`, hence box-sizing moves in here too. */
@layer base {
  * { box-sizing: border-box; border-color: var(--color-border); scrollbar-width: thin; scrollbar-color: var(--text-dim) transparent; }
  @media (forced-colors: active) { * { scrollbar-color: auto; } }
}
/* Global :focus-visible fallback — component primitives (Button etc.) own
   their own rings; this catches native <a>/<input>, custom tabIndex divs and
   anything else without a bespoke focus style. WCAG 2.4.7 (Focus Visible). */
*:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius); }
html, body { height: 100%; margin: 0; }
/* Root font-size = browser default × the a11y scale, so every rem reacts live. */
html { font-size: calc(100% * var(--font-scale, 1)); }
body {
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--surface);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  overscroll-behavior: none;
  /* Kill double-tap-to-zoom + the 300ms tap delay so the standalone PWA feels
     native, while KEEPING pinch-zoom (WCAG 1.4.4). Gesture children set their
     own stricter touch-action (none / pan-y) per-element and still win locally. */
  touch-action: manipulation;
}

/* glass helper — applied alongside theme tokens, never raw hex in components */
.glass {
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  backdrop-filter: blur(var(--blur)) saturate(180%);
}

/* Wallpapers — per-shell native backdrops. Each key paints its delivered MSO
   webp (public/wallpapers/<key>.webp) over a gradient fallback (shown while the
   image loads or if it 404s). "auto" resolves to the active shell's pick via
   ShellDescriptor.wallpaper; a per-shell override or custom image wins. graphite
   (Dashboard) stays a pure gradient — a photo backdrop fights data widgets. */
.wp-aurora { background:
  url("/wallpapers/aurora.webp?v=ad083c6c2ccb") center/cover no-repeat,
  radial-gradient(110% 120% at 16% 16%, #f4d6a0 0%, rgba(244,214,160,0) 46%),
  radial-gradient(110% 110% at 82% 18%, #f2eee9 0%, rgba(242,238,233,0) 44%),
  linear-gradient(145deg, #d3c5bd 0%, #d9dce7 56%, #b7c8dc 100%); }
[data-theme="dark"] .wp-aurora { background:
  url("/wallpapers/aurora-dark.webp?v=b24824de9799") center/cover no-repeat,
  radial-gradient(110% 120% at 18% 14%, #30386f 0%, rgba(48,56,111,0) 46%),
  radial-gradient(110% 110% at 84% 20%, #263d67 0%, rgba(38,61,103,0) 44%),
  linear-gradient(145deg, #161629 0%, #10152c 58%, #0b1223 100%); }
.wp-graphite { background:
  radial-gradient(120% 120% at 30% 20%, #3a3f4b 0%, rgba(58,63,75,0) 55%),
  linear-gradient(160deg, #23262e 0%, #16181d 70%, #0e0f13 100%); }
.wp-win11    { background: url("/wallpapers/win11.webp") center/cover no-repeat, radial-gradient(90% 75% at 50% 35%, #3b82f6 0%, #1e40af 42%, #0b1f4a 100%); }
.wp-material { background: url("/wallpapers/material.webp") center/cover no-repeat, linear-gradient(150deg, #cfe0ff 0%, #e8def8 55%, #ffd8e4 100%); }
.wp-ios      { background: url("/wallpapers/ios.webp") center/cover no-repeat, linear-gradient(165deg, #0f2a6b 0%, #5b3bb4 48%, #c84fa0 100%); }
/* "auto" swatch in pickers — a hue ring that reads as "follows the OS". */
.wp-auto     { background: conic-gradient(from 220deg at 50% 50%, #3b82f6, #8b5cf6, #ec4899, #f59e0b, #10b981, #3b82f6); }

/* ── Per-shell design tokens ──────────────────────────────────────────────
   `data-shell` on the Surface root lets each OS skin diverge (font, corner
   radius, icon mask, motion curve + durations) WITHOUT forking the shared
   chrome — components read the --shell-* vars. Base = framework defaults; each
   shell overrides only what differs. Font is scoped to chrome (menu bar /
   taskbar / window title) so app content keeps the theme preset's typeface. */
[data-shell] {
  --shell-font: var(--font-ui);
  --shell-radius-win: var(--radius-win);
  --shell-radius-ui: var(--radius);
  --shell-icon-radius: 22.37%;
  /* App-icon look, per shell. Defaults are FLAT (iOS 7+ killed the glassy dome);
     macOS re-adds a whisper of depth below. Plain rounded-rect corner — a true
     CSS squircle (corner-shape: superellipse) was tried and reverted: at a fixed
     radius a >2 exponent makes corners hug the square = POINTIER, not rounder. */
  --shell-icon-sheen: 0.06; /* top-light overlay alpha */
  --shell-icon-shade: 0; /* bottom inner-shade alpha */
  --shell-icon-ring: 0.1; /* top hairline edge alpha */
  --shell-icon-glyph: 52%; /* glyph size */
  --shell-icon-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
  --shell-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --shell-dur-fast: 150ms;
  --shell-dur: 250ms;
  --shell-dur-slow: 340ms;
}
[data-shell="macos"], [data-shell="ios"] {
  --shell-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", var(--font-ui);
  --shell-radius-win: 10px;
  --shell-ease: cubic-bezier(0.32, 0.72, 0, 1);
}
/* macOS icons keep gentle Big-Sur dimensionality (not flat, not glossy) + a
   soft layered dock shadow + a slightly more inset glyph. iOS inherits the flat
   base above. Illustrated Finder/Safari-style art is out of scope (proprietary);
   this is a cohesive modern glyph-tile set. */
[data-shell="macos"] {
  --shell-icon-radius: 22.5%;
  --shell-icon-sheen: 0.12;
  --shell-icon-shade: 0.06;
  --shell-icon-ring: 0.14;
  --shell-icon-glyph: 46%;
  --shell-icon-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 6px 14px rgba(0, 0, 0, 0.3);
}
/* Shared app-icon tile corner: a plain rounded-rect at the per-shell radius. */
.shell-icon-tile {
  border-radius: var(--shell-icon-radius);
}

/* Platform-family app artwork. Apple surfaces share the macOS artwork family
   (macOS + iOS), while Microsoft/Material surfaces share the Windows artwork
   family (Windows + Android). Dashboard keeps the generic fallback. */
.shell-artwork {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.shell-platform-mark {
  border-radius: inherit;
}
/* Markup keeps all three variants (the shell family is hydration-only knowledge, so
   SSR choosing would mismatch); the losers stay out of layout and paint. */
.shell-artwork-macos, .shell-artwork-windows { display: none; content-visibility: hidden; }
[data-shell="macos"] .shell-artwork-default,
[data-shell="ios"] .shell-artwork-default,
[data-shell="windows"] .shell-artwork-default,
[data-shell="android"] .shell-artwork-default { display: none; }
[data-shell="macos"] .shell-artwork-macos,
[data-shell="ios"] .shell-artwork-macos { display: block; content-visibility: visible; }
[data-shell="windows"] .shell-artwork-windows,
[data-shell="android"] .shell-artwork-windows { display: block; content-visibility: visible; }

/* ── iOS component parity (scoped to the iOS surface ONLY) ─────────────────
   Shared primitives (Switch, Segmented) carry accent-tinted states that suit
   Material/Fluent; iOS wants system-green switches + a raised WHITE segmented
   pill (Golden Rule 5: tint is not a fill). Scoping to [data-shell="ios"] on
   #main-content (desktop.tsx) means android/windows/dashboard/macos never match
   → their computed styles stay byte-identical. #30d158 is a fixed semantic
   category color (accepted raw-hex exception, like the traffic lights). */
[data-shell="ios"] [role="switch"] {
  width: 47px;
  height: 29px;
}
[data-shell="ios"] [role="switch"][aria-checked="true"] { background: #30d158; }
[data-shell="ios"] [role="switch"][aria-checked="false"] { background: var(--fill2); }
[data-shell="ios"] [role="switch"] > span {
  width: 25px;
  height: 25px;
  transform: translateX(2px);
}
[data-shell="ios"] [role="switch"][aria-checked="true"] > span {
  transform: translateX(20px);
}
[data-shell="ios"] [data-slot="segmented"] {
  background: var(--fill);
  border-color: transparent;
  border-radius: 9px;
  gap: 0;
}
[data-shell="ios"] [data-slot="segmented-option"] {
  font-size: 14px;
  font-weight: 500;
  border-radius: 7px;
}
[data-shell="ios"] [data-slot="segmented-option"][data-selected="true"] {
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* iOS 27 home-screen widget placeholders. The kit paints these purple so the
   size (small, medium, large, extra large) reads before a real widget does.
   Scoped to the iOS shell so the macOS widget stack stays on its own cards. */
[data-shell="ios"] [data-slot="ios-widget-placeholder"] {
  background: #6e56cf;
}

/* Two-tone focus stays visible across light and dark wallpaper regions. */
.ios-lock-focus:focus-visible {
  outline: 2px solid Canvas;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px CanvasText;
}

/* iOS Settings grouped-list body. The shell-settings primitives render the SAME
   markup in every shell; the iOS type scale + borderless-card-on-grouped-page
   look lives here (scoped) so the portable slice stays brand/shell-free.
   Row/section-title/value/footnote sizes are px in scoped CSS — the tokens-not-hex
   rule governs colors (which stay --sep/--grouped/--card), not sizes. */
[data-shell="ios"] [data-slot="settings-row-label"] { font-size: 16px; font-weight: 500; }
[data-shell="ios"] [data-slot="settings-value"] { font-size: 15px; }
[data-shell="ios"] [data-slot="settings-section-title"] { font-size: 13px; }
[data-shell="ios"] [data-slot="settings-footnote"] {
  font-size: 12.5px;
  padding-left: 16px;
  padding-right: 16px;
  line-height: 1.42;
}
/* Borderless grouped card on a distinct --grouped page (the tonal step reads as
   "grouped"); the consumer paints the pane via data-slot="settings-pane". */
[data-shell="ios"] [data-slot="settings-card"] {
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
[data-shell="ios"] [data-slot="settings-pane"] { background: var(--grouped); }
/* 0.5px hairline at the full --sep alpha, inset to 16px (row padding, not past
   the icon tile) — overrides both the primitive rows (already 16px) and the
   index rows (56px on other shells) to one iOS inset. */
[data-shell="ios"] [data-slot="settings-row"]::after {
  left: 16px;
  background: var(--sep);
  height: 1px;
  transform: scaleY(0.5);
  transform-origin: bottom;
}


/* ── iOS System Settings content ───────────────────────────────────────────
   The shell owns the single mobile navigation header. Settings contributes only
   Search/grouped content at root and detail content below the published parent/title.
   These selectors are fully iOS + Settings-slot scoped; Android/desktop shells
   keep their own layouts. */
[data-shell="ios"] [data-slot="ios-settings-root"],
[data-shell="ios"] [data-slot="ios-settings-detail"] {
  font-family: var(--shell-font);
  background: var(--grouped);
}
[data-shell="ios"] [data-slot="ios-settings-root"] [data-slot="settings-card"],
[data-shell="ios"] [data-slot="ios-settings-detail"] [data-slot="settings-card"] {
  border: 0;
  border-radius: 16px;
  box-shadow: none;
}
[data-shell="ios"] [data-slot="ios-settings-detail"] [data-slot="settings-section-heading"] {
  gap: 0;
  padding-left: 4px;
  padding-right: 4px;
}
[data-shell="ios"] [data-slot="ios-settings-detail"] [data-slot="settings-section-icon"] {
  display: none;
}
[data-shell="ios"] [data-slot="ios-settings-detail"] [data-slot="settings-section-title"] {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-dim);
}
[data-shell="ios"] [data-slot="ios-settings-detail"] [data-slot="settings-row"] {
  min-height: 50px;
}
[data-shell="ios"] [data-slot="ios-settings-detail"] [data-slot="settings-row"]:has([role="switch"]) {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
[data-shell="ios"] [data-slot="ios-settings-detail"] [data-slot="settings-row"]:has([role="switch"]) > div:last-child {
  width: auto;
  flex-shrink: 0;
}

/* ── Touch-target a11y (HIG 44px / Material 48dp) ──────────────────────────
   The app root is 14px, so rem-based control heights fall short of 44px
   (h-8 = 28px, h-9 = 31.5px). Lift form controls + menu rows on ANY coarse
   pointer — iOS AND Android both need it. This is universal a11y sizing, NOT
   iOS visual identity, so it correctly applies to both touch shells and does
   not leak the iOS *look* onto Android (colors/glass/type stay iOS-scoped
   above). Matches the existing [@media(pointer:coarse)] convention
   (code-editor, tabs). Buttons stay per-call-site: the 30px composer send FAB
   (chat-composer.tsx, size-[30px]) and segmented options are deliberately
   compact iOS controls and must not grow. ponytail: one rule covers ~25
   input/select/menuitem targets across every slice; buttons remain explicit. */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
  textarea,
  select,
  [data-slot="select-trigger"],
  [role="menuitem"] {
    min-height: 44px;
  }
  /* iOS focus-zoom guard: Safari zooms the viewport when a focused text field
     computes <16px (our text-sm inputs = 14px). Floor entry fields at 16px on
     touch only; max(…,1rem) still grows with the a11y font-scale. Desktop (fine
     pointer) keeps the denser text-sm. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
  textarea,
  select {
    font-size: max(16px, 1rem);
  }
}

[data-shell="windows"] {
  --shell-font: "Segoe UI Variable Text", "Segoe UI", system-ui, var(--font-ui);
  --shell-radius-win: 8px;
  --shell-radius-ui: 4px;
  --shell-ease: cubic-bezier(0, 0, 0, 1);
  --shell-dur: 230ms;
  /* Win11 Mica: a near-opaque neutral window surface with a faint accent wash.
     Reuses the theme-aware --window-bg + --accent so it flips light/dark by
     itself; scoped to the windows shell, so no other persona is touched.
     Accent held to 5% so muted-foreground labels on the tinted chrome keep
     WCAG AA (10% dropped the window title / clock to ~4.46:1; 5% ≈ 4.58:1). */
  --mica-win: color-mix(in srgb, var(--window-bg) 95%, var(--accent) 5%);
}
[data-shell="android"] {
  --shell-font: Roboto, "Google Sans Text", system-ui, var(--font-ui);
  /* M3 Expressive spring-ish enter: a mild overshoot (y>1) gives app-open a
     lively settle. Android-only + enter-only (no exit/geometry glide on mobile),
     so it can't cause dismiss bounce; reduce-motion still collapses --shell-dur.
     Kept because features/notifications/components/dynamic-island.tsx still reads
     --shell-ease; the M3 tokens below supersede it inside the Android shell. */
  --shell-ease: cubic-bezier(0.2, 0.9, 0.3, 1.06);
  --shell-dur: 300ms;
  --shell-dur-slow: 400ms;

  /* Material 3 Expressive replaced duration+easing with PHYSICS: spatial springs
     for anything that moves (may overshoot) and effects springs for colour and
     opacity (must not). CSS has no spring primitive, so each token below is a real
     spring sampled into linear().
     Six M3 tokens collapse into three curves because a spring's normalised SHAPE
     depends only on its damping ratio — stiffness only scales time, which is what
     the durations carry.
     The durations are multiples of --shell-dur ON PURPOSE: the reduce-motion block
     further down collapses --shell-dur to 1ms, and hard-coded milliseconds here
     would silently opt every Android animation out of that.
     CEILING: a linear() cannot be interrupted and re-targeted mid-flight the way a
     real spring can — it always restarts from zero velocity. Swap for a JS spring
     only if an interruptible gesture ever needs it. */
  --m3-spatial-fast: linear(0, 0.0857, 0.2789, 0.504, 0.7122, 0.8779, 0.9931, 1.0608, 1.0905, 1.0935, 1.0805, 1.0604, 1.0392, 1.0208, 1.0069, 0.9978, 0.9928, 0.9911, 0.9915, 0.993, 1); /* k=800  ζ=0.6 */
  --m3-spatial: linear(0, 0.0538, 0.1769, 0.3268, 0.477, 0.6125, 0.7266, 0.8174, 0.8862, 0.936, 0.9702, 0.9923, 1.0055, 1.0123, 1.0149, 1.0149, 1.0135, 1.0113, 1.009, 1.0068, 1); /* k=380  ζ=0.8 */
  --m3-effects: linear(0, 0.1712, 0.4382, 0.6532, 0.7972, 0.8856, 0.9371, 0.966, 0.9819, 0.9905, 1); /* ζ=1.0, never overshoots */
  --m3-dur-spatial-fast: calc(var(--shell-dur) * 1.073); /* 322ms @300 — small elements */
  --m3-dur-spatial: calc(var(--shell-dur) * 1.237); /* 371ms */
  --m3-dur-spatial-slow: calc(var(--shell-dur) * 1.703); /* 511ms — large surfaces */
  --m3-dur-effects-fast: calc(var(--shell-dur) * 0.403); /* 121ms */
  --m3-dur-effects: calc(var(--shell-dur) * 0.620); /* 186ms */
  --m3-dur-effects-slow: calc(var(--shell-dur) * 0.877); /* 263ms */
  --shell-icon-radius: 50%;
}
/* Top safe-area floor per touch shell — the back/nav buttons + top bars must
   clear the status bar / notch. --sai-top is read by both mobile shells (home,
   headers, spotlight, switcher, dynamic-island) and defaults to env()=0 (the
   :root rule above) for desktop shells. iOS floors everywhere (same 2.75rem it
   used inline before, so iOS is visually unchanged); Android floors ONLY in the
   installed PWA (display-mode: standalone), so the browser tab / desktop
   PhoneFrame preview stays visually unchanged while the real app clears the bar. */
[data-shell="ios"] { --sai-top: max(env(safe-area-inset-top, 0px), 2.75rem); }
/* Android floors BOTH insets, in every display mode.
   It used to floor only --sai-top, only at 1.5rem (24px), and only inside
   `display-mode: standalone`. Three problems on a real phone, all reported from
   one: 24px is a 2019 status bar — a punch-hole or curved-corner device needs
   ~36px, so the home grid and the top of every app sat UNDER the cutout; the
   standalone gate meant an installed-to-home-screen PWA that Chrome does not
   report as standalone got no floor at all; and --sai-bottom had no floor, so on
   gesture navigation the 48px nav row sat beneath the system gesture bar and its
   Back/Home/Recents could not be tapped.
   max() throughout, so a device that reports a LARGER inset still wins and nothing
   is capped. The desktop PhoneFrame preview gains 36px of top chrome, which is the
   honest thing for a preview of a device that has a status bar. */
[data-shell="android"] {
  --sai-top: max(env(safe-area-inset-top, 0px), 2.25rem);
  --sai-bottom: max(env(safe-area-inset-bottom, 0px), 1rem);
}
/* OS reduced-motion: collapse durations to ~instant. 1ms (not 0) so animationend
   still fires — the window close/minimize finalize on that event. Scoped narrowly
   so the global rule never accidentally freezes a drag/snap transition that the
   shell store relies on (those are inline `transition:none` during gesture). */
@media (prefers-reduced-motion: reduce) {
  [data-shell] { --shell-dur-fast: 1ms; --shell-dur: 1ms; --shell-dur-slow: 1ms; }
  /* Non-essential motion: toasts, dialog/sheet/drawer/popover enter-exit, the
     spotlight palette, app-launcher, and tailwindcss-animate `animate-in`
     utilities (data-state driven). The window geometry glide (`.win-geo`) and
     the wallpaper blob keyframes are intentionally excluded — wallpaper drift
     is decorative-only (transform-only, compositor-cheap) and there is no
     auto-animating canvas in the tree to gate. */
  [data-state="open"], [data-state="closed"],
  .animate-in, .animate-out,
  [class*="fade-in"], [class*="slide-in"], [class*="zoom-in"] {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
  }
}

/* Window lifecycle motion (macOS + Windows). Open on mount; close/minimize via a
   component-local phase that finalizes the store action on animationend. */
@keyframes winOpen { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes winClose { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(0.95); } }
@keyframes winMin { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(0.5) translateY(46%); } }
/* Geometry glide for maximize/snap/restore. The drag + resize hooks set
   `transition:none` inline during a gesture, so per-frame drags never lag — only
   the jump moves (maximize/un-maximize/snap) animate. */
.win-geo { transition: left var(--shell-dur) var(--shell-ease), top var(--shell-dur) var(--shell-ease), width var(--shell-dur) var(--shell-ease), height var(--shell-dur) var(--shell-ease); }

/* Mobile app transitions intentionally do NOT scale/zoom the whole UI. On phones
   a full-surface scale makes text and controls visibly breathe; a short spatial
   translate keeps orientation/navigation feedback without changing perceived UI size. */
@keyframes mobileAppOpen { from { transform: translateY(10px); } to { transform: none; } }
@keyframes mobileAppClose { from { transform: none; opacity: 1; } to { transform: translateY(8px); opacity: 0; } }
/* Live-wallpaper blob drift (transform-only — compositor-friendly). */
@keyframes wpFloatA { 0%, 100% { transform: translate(-10%, -6%) scale(1); } 50% { transform: translate(12%, 8%) scale(1.18); } }
@keyframes wpFloatB { 0%, 100% { transform: translate(8%, 10%) scale(1.1); } 50% { transform: translate(-10%, -8%) scale(0.92); } }
@keyframes bootPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.06); opacity: 0.85; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* ── Shell design-profile surfaces ─────────────────────────────────────────
   Behavior stays shared; these selectors are the presentation seam. Per-shell
   design.md files live in frontend/slices/appshell/design/<shell>/design.md. */
[data-slot="shell-dialog-surface"][data-shell-id="ios"] {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", var(--font-ui);
  background: var(--card);
}
[data-slot="shell-dialog-surface"][data-shell-id="android"] {
  font-family: Roboto, "Google Sans Text", system-ui, var(--font-ui);
  background: var(--card);
}
[data-slot="shell-dialog-surface"][data-shell-id="macos"] {
  border-radius: 12px;
  background: var(--window-bg);
}
[data-slot="shell-dialog-surface"][data-shell-id="windows"] {
  border-radius: 8px;
  background: var(--mica-win, var(--window-bg));
}
[data-slot="shell-dialog-surface"][data-shell-id="dashboard"] {
  border-radius: 10px;
  background: var(--card);
}

/* macOS Settings: compact sidebar + solid inset content groups. */
[data-shell="macos"] [data-slot="settings-card"] { border-radius: 10px; }
[data-shell="macos"] [data-slot="settings-row"] { min-height: 42px; }
[data-shell="macos"] [data-slot="settings-section-title"] {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 600;
}

/* Material 3 Settings: larger touch rows and tonal rounded containers. */
[data-shell="android"] [data-slot="settings-pane"] { background: var(--background); }
[data-shell="android"] [data-slot="settings-card"] {
  border-color: transparent;
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
[data-shell="android"] [data-slot="settings-row"] { min-height: 56px; }
[data-shell="android"] [data-slot="settings-section-title"] {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
[data-shell="android"] [data-slot="settings-footnote"] {
  font-size: 12px;
  line-height: 1.45;
}

/* Windows 11 Settings: compact Fluent geometry, no mobile-style pill cards. */
[data-shell="windows"] [data-slot="settings-card"] { border-radius: 8px; }
[data-shell="windows"] [data-slot="settings-row"] { min-height: 44px; }
[data-shell="windows"] [data-slot="settings-section-title"] {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
[data-shell="windows"] [data-slot="settings-desktop-tabs"] {
  gap: 2px;
  padding: 6px;
  background: var(--mica-win, var(--sidebar));
}

/* Dashboard: intentionally denser than consumer OS shells. */
[data-shell="dashboard"] [data-slot="settings-card"] { border-radius: 8px; }
[data-shell="dashboard"] [data-slot="settings-row"] { min-height: 40px; padding-top: 8px; padding-bottom: 8px; }
[data-shell="dashboard"] [data-slot="settings-desktop-tabs"] { padding: 4px; gap: 2px; }
[data-shell="dashboard"] [data-slot="settings-section-title"] { font-size: 10px; }
/* Native mobile sheet geometry wins over the base Drawer radius. Scoped to the
   shell + design family so desktop dialogs and the other persona are untouched. */
[data-slot="shell-dialog-surface"][data-shell-id="ios"][data-shell-mobile="true"] {
  border-top-left-radius: 24px !important;
  border-top-right-radius: 24px !important;
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
[data-slot="shell-dialog-surface"][data-shell-id="android"][data-shell-mobile="true"] {
  border-top-left-radius: 28px !important;
  border-top-right-radius: 28px !important;
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

/* Portaled shell surfaces cannot inherit the active surface's --shell-font because
   Radix/Vaul mount them under <body>. data-shell-id makes typography self-contained. */
[data-shell-id="ios"], [data-shell-id="macos"] {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", var(--font-ui);
}
[data-shell-id="android"] {
  font-family: Roboto, "Google Sans Text", system-ui, var(--font-ui);
}
[data-shell-id="windows"] {
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, var(--font-ui);
}
[data-shell-id="dashboard"] {
  font-family: var(--font-ui);
}
[data-slot="shell-dialog-surface"][data-shell-id="windows"] {
  background: color-mix(in srgb, var(--window-bg) 95%, var(--accent) 5%);
}

/* Mobile widget persona + containment. The widget behavior/data stays shared;
   only the surface follows the active phone shell. X is always clipped at the
   Today/Widgets boundary so one long Quicklink can never create a second axis. */
[data-shell="ios"] { --widget-bg: var(--glass-menu); }
[data-shell="android"] { --widget-bg: color-mix(in srgb, var(--card) 92%, var(--accent) 8%); }
[data-shell="android"] [data-slot="widget-card"] {
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 24px;
  backdrop-filter: none;
}
[data-shell="ios"] [data-slot="widget-card"] { border-radius: 22px; }
[data-slot="mobile-widgets"], [data-slot="quicklinks-widget-grid"] { max-width: 100%; }

/* Shared node-canvas chrome (Organization + Workflows). */
.mso-graph-flow {
  --xy-background-color: transparent;
  --xy-node-border: 1px solid var(--border);
  --xy-handle-background-color: var(--background);
  --xy-handle-border-color: var(--sep-strong);
  --xy-edge-stroke: var(--sep-strong);
  --xy-edge-stroke-selected: var(--accent);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}
.mso-graph-flow .react-flow__controls {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 0.125rem);
  background: var(--glass-panel);
  box-shadow: var(--shadow-pop);
  backdrop-filter: blur(var(--blur));
}
.mso-graph-flow .react-flow__controls-button {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}
.mso-graph-flow .react-flow__controls-button:last-child { border-bottom: 0; }
.mso-graph-flow .react-flow__controls-button:hover,
.mso-graph-flow .react-flow__controls-button.is-active { background: var(--hover-strong); }
.mso-graph-flow .react-flow__controls-button svg { max-width: 0.9rem; max-height: 0.9rem; fill: none; }
.mso-graph-flow .react-flow__minimap {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 0.125rem);
  background: var(--glass-panel);
  box-shadow: var(--shadow-pop);
  backdrop-filter: blur(var(--blur));
}
.mso-graph-flow .react-flow__minimap-mask { fill: color-mix(in srgb, var(--surface) 60%, transparent); }
.mso-graph-flow .react-flow__minimap-node { vector-effect: non-scaling-stroke; }
.mso-graph-flow .react-flow__minimap svg { width: 100%; height: 100%; }
.mso-graph-flow .mso-graph-secondary-control { border-top: 1px solid var(--border); }
.mso-graph-flow .react-flow__selection,
.mso-graph-flow .react-flow__nodesselection-rect { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.mso-graph-flow .react-flow__edge.selected .react-flow__edge-path { stroke: var(--accent); stroke-width: 2.25; }
.mso-graph-flow .react-flow__edge-path { transition: stroke 140ms ease, stroke-width 140ms ease, opacity 140ms ease; }
.mso-graph-flow .react-flow__edge.animated path { stroke-dasharray: 6 6; animation-duration: 0.7s; }