/* The OBSCURA OS desktop (/os): the shell os-shell.js draws.
 *
 * A desktop with a taskbar along the bottom, windows that hold the site's
 * own pages, a launcher, a tray and a Files window. Everything here is the
 * site's own system from theme.css: the colourway's paper, rules and ink,
 * the nine type sizes, the four corners, the one icon stroke, the motion
 * tokens. Nothing is coloured that the colourways do not colour, so every
 * colourway, light and dark, is a desktop of its own without a rule here.
 *
 * The shape is serious desktop software: square-shouldered windows with a
 * hairline edge, a title bar with the application's mark and name, flat
 * controls, and the one shadow theme.css allows for something lifted
 * (--elev-2) on the window in front. Loaded on /os only.
 */

:root {
  --os-bar-h: 48px;
  --os-top: 0px;
  --os-cell-w: 92px;
  --os-cell-h: 96px;
  --os-title-h: 36px;
  /* The ink of anything written straight on the wallpaper: the shortcut
     labels and the recent documents. A dark wallpaper turns it light. */
  --os-wall: var(--paper-inset);
  --os-wall-ink: var(--ink);
  --os-wall-soft: var(--ink-soft);
}

/* ------------------------------------------------------------- the page */

html:has(body.os-shell) { height: 100%; overflow: hidden; }
body.os-shell {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--paper-raised);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  line-height: var(--leading-ui);
  -webkit-tap-highlight-color: transparent;
}
.os-shell button { font: inherit; color: inherit; }
.os-sr {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
.os-shell :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* The privacy badge floats over a page's corner; on the desktop that
   corner is the taskbar, so the tray carries a button that opens the same
   panel (os-shell.js) and the floating badge is put away. */
body.os-shell #ppBadge { display: none !important; }
/* A notice from the desktop itself sits above the taskbar, not over it. */
body.os-shell #obscuraNotice, body.os-shell #obscura-save-notice, body.os-shell #pfBar { bottom: calc(var(--os-bar-h) + var(--space-3)) !important; }

/* ------------------------------------------------------------- the desk */

.os-desk {
  position: fixed;
  left: 0; right: 0;
  top: var(--os-top);
  bottom: var(--os-bar-h);
  overflow: hidden;
  background: var(--os-wall);
  color: var(--os-wall-ink);
}
/* The wallpapers: the site's own tones, from the colourway, so a change of
   colourway or mode is a change of wallpaper too. */
[data-wall="paper"] { --os-wall: var(--paper); }
[data-wall="stone"] { --os-wall: var(--paper-inset); }
[data-wall="tint"] { --os-wall: var(--accent-soft); }
[data-wall="deep"] {
  --os-wall: color-mix(in oklab, var(--accent-strong) 62%, var(--ink));
  --os-wall-ink: var(--paper);
  --os-wall-soft: color-mix(in oklab, var(--paper) 78%, transparent);
}
:root[data-theme="dark"] [data-wall="deep"] {
  --os-wall: color-mix(in oklab, var(--accent) 16%, var(--paper-inset));
  --os-wall-ink: var(--ink);
  --os-wall-soft: var(--ink-soft);
}
.os-noscript { margin: var(--space-6); max-width: var(--measure); font-size: var(--text-md); line-height: var(--leading-prose); }

/* The mark of an application: its line and plane in the hue it wears
   everywhere, on a square of the same hue mixed into the paper. The same
   drawing as its tile on the front door, without the light from above. */
.os-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--accent-strong);
  background: var(--accent-soft);
}
@supports (color: oklch(0.5 0.1 200)) and (color: color-mix(in oklab, red 10%, blue)) {
  .os-ico {
    --ico-ink: oklch(var(--ico-l) var(--ico-c) var(--ico-h, 258));
    color: var(--ico-ink);
    background: color-mix(in oklab, var(--ico-ink) var(--ico-tint), var(--paper-raised));
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ico-ink) 18%, transparent);
  }
  .os-ico.is-neutral { --ico-c: 0; }
}
.os-ico svg { width: 22px; height: 22px; stroke-width: var(--icon-stroke); }
.os-ico .ico-plane { fill-opacity: var(--ico-plane); }
.os-ico.is-sm { width: 26px; height: 26px; border-radius: var(--radius-sm); }
.os-ico.is-sm svg { width: 16px; height: 16px; }
.os-ico.is-xs { width: 20px; height: 20px; border-radius: var(--radius-sm); }
.os-ico.is-xs svg { width: 13px; height: 13px; }
.os-ico.is-lg { width: 48px; height: 48px; border-radius: var(--radius-lg); }
.os-ico.is-lg svg { width: 26px; height: 26px; }

/* Shortcuts, on a grid the person arranges. */
.os-icons { position: absolute; left: var(--space-3); top: var(--space-3); right: 0; bottom: 0; pointer-events: none; }
.os-icon {
  position: absolute;
  left: calc(var(--c, 0) * var(--os-cell-w));
  top: calc(var(--r, 0) * var(--os-cell-h));
  width: calc(var(--os-cell-w) - var(--space-2));
  height: calc(var(--os-cell-h) - var(--space-2));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  color: var(--os-wall-ink);
  cursor: default;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}
.os-icon-name {
  font-size: var(--text-xs);
  line-height: 1.25;
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.os-icon:hover { background: color-mix(in srgb, var(--os-wall-ink) 7%, transparent); }
.os-icon.is-sel { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.os-icon.is-over { border-color: var(--accent); border-style: dashed; }
.os-icon.is-lifted { z-index: 2; opacity: .85; }
.os-icon:focus-visible { outline-offset: 0; }

/* Recent documents, down the right of the desktop. */
.os-recent { position: absolute; top: var(--space-4); right: var(--space-4); width: 288px; max-height: calc(100% - var(--space-6)); overflow: auto; color: var(--os-wall-ink); }
.os-recent-head, .os-files-side h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--os-wall-soft);
}
.os-recent-list, .os-l-list { list-style: none; margin: 0; padding: 0; }
.os-doc {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  padding: var(--space-1) var(--space-2);
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: inherit;
  text-align: left;
  cursor: default;
}
.os-doc:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.os-doc-text { min-width: 0; display: flex; flex-direction: column; }
.os-doc-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-doc-sub { font-size: var(--text-xs); color: var(--os-wall-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.os-pop .os-doc-sub, .os-home .os-doc-sub { color: var(--ink-faint); }

/* ------------------------------------------------------------- windows */

.os-wins { position: absolute; inset: 0; pointer-events: none; }
.os-win {
  position: absolute;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-width: 320px;
  min-height: 200px;
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
  overflow: hidden;
  pointer-events: auto;
  animation: os-win-in var(--dur-3) var(--ease-standard);
}
@keyframes os-win-in { from { opacity: 0; transform: translateY(var(--os-rise-sm)); } }
:root[data-motion="none"] .os-win { animation: none; }
.os-win.is-front { box-shadow: var(--elev-2); border-color: color-mix(in srgb, var(--ink) 28%, var(--rule-strong)); }
.os-win.is-max, .os-win.is-snap { border-radius: 0; min-width: 0; min-height: 0; }
.os-win.is-max { border-width: 0; box-shadow: none; }
.os-win[hidden] { display: none; }
.os-win-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  height: var(--os-title-h);
  padding-left: var(--space-3);
  background: var(--paper-inset);
  border-bottom: 1px solid var(--rule);
  color: var(--ink-faint);
  user-select: none;
  touch-action: none;
  cursor: default;
}
.os-win.is-front .os-win-bar { background: var(--paper-raised); color: var(--ink); }
.os-win-bar:focus-visible { outline-offset: -2px; }
.os-win-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: var(--space-2); white-space: nowrap; overflow: hidden; }
.os-win-name { font-size: var(--text-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 60%; }
.os-win-doc { font-size: var(--text-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.os-win-sep { display: none; flex: none; color: var(--ink-faint); }
.os-win.has-doc .os-win-sep { display: inline; }
.os-win.has-doc .os-win-name { font-weight: 400; color: var(--ink-soft); }
.os-win-btns { display: flex; flex: none; height: 100%; }
.os-win-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: default;
}
.os-win-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.os-win-btn.is-close:hover { background: var(--danger); color: var(--on-danger); }
.os-win-btn:focus-visible { outline-offset: -2px; }
.os-win-btn svg { width: 16px; height: 16px; stroke-width: var(--icon-stroke); }
.os-win-body { position: relative; flex: 1; min-height: 0; background: var(--paper); container-type: inline-size; container-name: win; }
.os-win-body iframe { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0; background: var(--paper); }
.os-desk.is-moving iframe, .os-desk.is-carrying iframe { pointer-events: none; }
.os-desk.is-moving, .os-desk.is-moving * { user-select: none; }
.os-win.is-target { border-color: var(--accent); }
.os-win.is-target .os-win-body::after { content: ""; position: absolute; inset: 0; border: 2px dashed var(--accent); pointer-events: none; }
/* While a window's page loads: its name, said once, where the page will be. */
.os-win-wait { position: absolute; left: var(--space-5); top: var(--space-5); margin: 0; color: var(--ink-faint); font-size: var(--text-sm); }
.os-win-wait[hidden] { display: none; }
/* A page that will not be shown inside another (or a window the desktop
   cannot read), said as what happened and what to do. */
.os-win-note { padding: var(--space-6) var(--space-5); max-width: 56ch; }
.os-win-note h2 { margin: 0 0 var(--space-2); font-size: var(--text-lg); font-weight: 600; }
.os-win-note p { margin: 0 0 var(--space-4); color: var(--ink-soft); line-height: var(--leading-prose); }

/* The edges a window is resized from: four sides and four corners. */
.os-grip { position: absolute; z-index: 3; touch-action: none; }
.os-grip[data-g="n"] { top: 0; left: 10px; right: 10px; height: 5px; cursor: ns-resize; }
.os-grip[data-g="s"] { bottom: 0; left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
.os-grip[data-g="e"] { right: 0; top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
.os-grip[data-g="w"] { left: 0; top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
.os-grip[data-g="ne"] { top: 0; right: 0; width: 12px; height: 12px; cursor: nesw-resize; }
.os-grip[data-g="nw"] { top: 0; left: 0; width: 12px; height: 12px; cursor: nwse-resize; }
.os-grip[data-g="se"] { bottom: 0; right: 0; width: 14px; height: 14px; cursor: nwse-resize; }
.os-grip[data-g="sw"] { bottom: 0; left: 0; width: 14px; height: 14px; cursor: nesw-resize; }
.os-win.is-max .os-grip { display: none; }

/* Where a window will land when it is let go at an edge. */
.os-snap {
  position: absolute;
  z-index: 40000;
  box-sizing: border-box;
  border: 2px solid var(--accent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  pointer-events: none;
  transition: left var(--dur-2) var(--ease-standard), top var(--dur-2) var(--ease-standard), width var(--dur-2) var(--ease-standard), height var(--dur-2) var(--ease-standard);
}

/* ------------------------------------------------------------- the taskbar */

.os-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50000;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  height: var(--os-bar-h);
  box-sizing: border-box;
  padding: 0 0 0 var(--space-1);
  background: var(--paper-raised);
  border-top: 1px solid var(--rule-strong);
}
.os-start, .os-pin, .os-task, .os-tray-btn, .os-clock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  min-width: 44px;
  box-sizing: border-box;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--ink-soft);
  text-decoration: none;
  cursor: default;
  position: relative;
}
:is(.os-start, .os-pin, .os-task, .os-tray-btn, .os-clock):hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.os-start { width: 48px; color: var(--accent-strong); }
.os-start svg { width: 24px; height: 24px; }
.os-start[aria-expanded="true"], .os-tray-btn[aria-expanded="true"], .os-clock[aria-expanded="true"] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--ink); }
.os-pins { display: flex; align-items: center; gap: 2px; padding: 0 var(--space-1); border-right: 1px solid var(--rule); }
.os-pins:empty { display: none; }
.os-tasks { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; padding-left: var(--space-1); overflow: hidden; }
.os-task {
  flex: 0 1 196px;
  min-width: 44px;
  justify-content: flex-start;
  gap: var(--space-2);
  padding: 0 var(--space-3) 0 var(--space-2);
  font-size: var(--text-sm);
}
.os-task-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Open, in front, minimised: a line under the button, as long and as
   strong as how present the window is. */
.os-task::after, .os-pin.is-open::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 16px;
  height: 2px;
  margin-left: -8px;
  border-radius: var(--radius-pill);
  background: var(--ink-faint);
}
.os-task.is-front { background: color-mix(in srgb, var(--accent) 11%, transparent); color: var(--ink); }
.os-task.is-front::after { left: var(--space-3); right: var(--space-3); width: auto; margin-left: 0; background: var(--accent); }
.os-task.is-min { color: var(--ink-faint); }
.os-task.is-min::after { background: var(--rule-strong); }
.os-task.is-target, .os-pin.is-target { outline: 2px dashed var(--accent); outline-offset: -2px; }
.os-tray { display: flex; align-items: center; gap: 2px; height: 100%; padding-left: var(--space-2); border-left: 1px solid var(--rule); }
.os-tray-btn { gap: var(--space-2); padding: 0 var(--space-2); font-size: var(--text-sm); font-weight: 600; }
.os-tray-btn svg { width: 18px; height: 18px; stroke-width: var(--icon-stroke); flex: none; }
.os-tray-sign { color: var(--ink); }
.os-tray-pro { color: var(--good); }
html[data-pro="on"] .os-tray-sign, html:not([data-pro="on"]) .os-tray-pro { display: none; }
.os-bell-n { font-size: var(--text-2xs); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent-strong); }
.os-clock { flex-direction: column; align-items: flex-end; padding: 0 var(--space-2); font-variant-numeric: tabular-nums; line-height: 1.2; }
.os-clock-time { font-size: var(--text-sm); font-weight: 600; color: var(--ink); }
.os-clock-date { font-size: var(--text-2xs); }
.os-showdesk { align-self: stretch; width: 24px; margin-left: var(--space-1); padding: 0; border: 0; border-left: 1px solid var(--rule); background: none; cursor: default; }
.os-showdesk:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }

/* Installed with the window controls overlay: the strip at the top where
   the system draws its own buttons. */
.os-wco { display: none; }
@media (display-mode: window-controls-overlay) {
  :root { --os-top: env(titlebar-area-height, 33px); }
  .os-wco {
    position: fixed;
    left: env(titlebar-area-x, 0);
    top: env(titlebar-area-y, 0);
    width: env(titlebar-area-width, 100%);
    height: env(titlebar-area-height, 33px);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-3);
    font-size: var(--text-xs);
    color: var(--ink-soft);
    -webkit-app-region: drag;
    app-region: drag;
  }
  .os-wco-mark { display: inline-flex; color: var(--accent-strong); }
  .os-wco-mark svg { width: 16px; height: 16px; }
  .os-wco-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ------------------------------------------------------------- panels over the taskbar */

.os-pop {
  position: fixed;
  z-index: 50001;
  bottom: calc(var(--os-bar-h) + var(--space-2));
  box-sizing: border-box;
  max-height: calc(100vh - var(--os-bar-h) - var(--os-top) - var(--space-4));
  max-height: calc(100dvh - var(--os-bar-h) - var(--os-top) - var(--space-4));
  overflow: auto;
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-2);
  color: var(--ink);
  animation: os-pop-in var(--dur-3) var(--ease-standard);
}
@keyframes os-pop-in { from { opacity: 0; transform: translateY(var(--os-rise-sm)); } }
:root[data-motion="none"] .os-pop { animation: none; }
.os-pop[hidden] { display: none; }
.os-pop h2 { margin: 0; font-size: var(--text-md); font-weight: 600; }

/* The start menu: a search box, then Pinned and Recent (or All apps, or
   the results), then the plan and the power along the foot. */
.os-launch {
  left: var(--space-2);
  width: min(680px, calc(100vw - var(--space-4)));
  height: min(680px, calc(100dvh - var(--os-bar-h) - var(--os-top) - var(--space-4)));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}
.os-l-wrap { display: contents; }
.os-l-top { padding: var(--space-4) var(--space-4) var(--space-3); }
.os-l-find { position: relative; display: block; }
.os-l-find svg { position: absolute; left: var(--space-3); top: 50%; width: 16px; height: 16px; margin-top: -8px; color: var(--ink-faint); stroke-width: var(--icon-stroke); pointer-events: none; }
.os-l-input {
  width: 100%;
  height: 44px;
  box-sizing: border-box;
  padding: 0 var(--space-3) 0 calc(var(--space-5) + var(--space-4));
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-md);
}
.os-l-input::placeholder { color: var(--ink-faint); }
.os-l-input:focus, .os-l-input:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-color: var(--focus); }
.os-s-body { position: relative; min-height: 0; display: grid; }
.os-s-main, .os-l-list.os-s-res { grid-area: 1 / 1; min-height: 0; overflow: auto; padding: 0 var(--space-4) var(--space-4); }
.os-s-main[hidden], .os-s-res[hidden] { display: none; }
.os-s-res { margin: 0; list-style: none; }
.os-s-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: var(--space-2) 0 var(--space-2); }
.os-s-head .os-link svg { width: 16px; height: 16px; stroke-width: var(--icon-stroke); }
.os-s-title { margin: 0; font-size: var(--text-sm); font-weight: 600; color: var(--ink); }
.os-l-head { margin: var(--space-3) 0 var(--space-2); font-size: var(--text-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); }
.os-l-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 2px; margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.os-l-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 88px;
  box-sizing: border-box;
  padding: var(--space-2) var(--space-1);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  color: var(--ink);
  text-align: center;
  cursor: default;
}
.os-l-app:hover, .os-l-app.is-on { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.os-l-app.is-over { border-color: var(--accent); border-style: dashed; }
.os-l-name { font-size: var(--text-xs); line-height: 1.25; overflow-wrap: anywhere; }
.os-l-pro { display: block; font-size: var(--text-2xs); font-weight: 600; letter-spacing: .04em; color: var(--accent-strong); }
.os-l-none { margin: var(--space-2) 0 var(--space-3); color: var(--ink-soft); line-height: var(--leading-prose); }
.os-l-pro-note { font-weight: 400; letter-spacing: 0; text-transform: none; }
/* All apps: rows, A to Z, and the tools under a suite that opens. */
.os-s-rows { list-style: none; margin: 0 0 var(--space-2); padding: 0; }
.os-l-app.is-row { flex-direction: row; justify-content: flex-start; gap: var(--space-3); min-height: 40px; padding: var(--space-1) var(--space-2); text-align: left; }
.os-l-app.is-row .os-l-name { font-size: var(--text-sm); display: flex; align-items: baseline; gap: var(--space-2); }
.os-l-app.is-row .os-l-pro { display: inline; }
.os-s-suite { border-top: 1px solid var(--rule); }
.os-s-suite:last-child { border-bottom: 1px solid var(--rule); }
.os-s-suite-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-2);
  border: 0;
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: default;
}
.os-s-suite-btn:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.os-s-suite-btn > svg { width: 16px; height: 16px; stroke-width: var(--icon-stroke); color: var(--ink-faint); }
.os-s-suite-btn[aria-expanded="true"] > svg { transform: rotate(90deg); }
.os-s-suite-name { flex: 1; font-weight: 600; }
.os-s-count { font-size: var(--text-xs); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.os-s-rows.is-tools { padding-left: var(--space-4); }
/* Results, grouped. */
.os-l-list { list-style: none; margin: 0; padding: 0; }
.os-l-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 48px;
  box-sizing: border-box;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  color: var(--ink);
  cursor: default;
}
.os-l-row.is-on { background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 2px 0 0 var(--accent); }
.os-l-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.os-l-row-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-l-row-desc { font-size: var(--text-xs); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-l-row-kind { flex: none; font-size: var(--text-xs); color: var(--ink-faint); }
.os-s-recent { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-2); }
/* The foot: the plan on the left, Settings and the power on the right. */
.os-s-foot { display: flex; align-items: center; gap: var(--space-2); min-height: 56px; padding: 0 var(--space-3); border-top: 1px solid var(--rule); background: var(--paper); }
.os-s-plan {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: default;
}
.os-s-plan:hover, .os-s-foot-btn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.os-s-plan-text { min-width: 0; display: flex; flex-direction: column; }
.os-s-plan-name { font-weight: 600; }
.os-s-plan-sub { font-size: var(--text-xs); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.os-s-plan.is-on .os-s-plan-sub { color: var(--good); }
.os-s-foot-btns { display: flex; gap: 2px; }
.os-s-foot-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius-md); background: none; color: var(--ink-soft); cursor: default; }
.os-s-foot-btn svg { width: 20px; height: 20px; stroke-width: var(--icon-stroke); }
.os-keys kbd, .os-welcome kbd { font-family: var(--font-mono); font-size: var(--text-2xs); padding: 0 var(--space-1); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--paper-raised); }

/* The notification centre. */
.os-centre { right: var(--space-2); width: min(380px, calc(100vw - var(--space-4))); padding: 0 0 var(--space-2); }
.os-c-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4); background: var(--paper-raised); border-bottom: 1px solid var(--rule); }
.os-c-day { margin: 0; padding: var(--space-3) var(--space-4) 0; font-size: var(--text-xs); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.os-c-list { list-style: none; margin: 0; padding: var(--space-2); }
.os-c-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-1) var(--space-3); align-items: start; padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--rule); }
.os-c-item:last-child { border-bottom: 0; }
.os-c-from { font-size: var(--text-xs); font-weight: 600; }
.os-c-time { font-size: var(--text-xs); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.os-c-text { grid-column: 2 / 4; margin: 0; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.os-c-item.is-warn .os-c-from { color: var(--danger); }
.os-c-go { grid-column: 2 / 4; justify-self: start; }
.os-c-empty { margin: 0; padding: var(--space-5) var(--space-4); color: var(--ink-soft); line-height: var(--leading-prose); }
.os-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--accent-strong);
  font-weight: 600;
  cursor: pointer;
}
.os-link:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* Choices: a row of radio buttons as one control, a switch, a list. */
.os-seg { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); min-width: 240px; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); overflow: hidden; }
.os-seg button { min-height: 36px; padding: 0 var(--space-3); border: 0; border-left: 1px solid var(--rule); background: var(--paper); cursor: default; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.os-seg button:first-child { border-left: 0; }
.os-seg button:hover { color: var(--ink); }
.os-seg button[aria-checked="true"] { background: var(--accent-soft); color: var(--ink); }
.os-seg button:focus-visible { outline-offset: -2px; }
.os-walls { display: grid; grid-template-columns: repeat(4, minmax(0, 96px)); gap: var(--space-3); }
.os-wall {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-1);
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--text-xs);
  text-align: left;
  cursor: default;
}
.os-wall-tone { display: block; height: 56px; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--os-wall); }
.os-wall[aria-checked="true"] .os-wall-tone { border: 2px solid var(--accent); }
.os-wall:focus-visible { outline: none; }
.os-wall:focus-visible .os-wall-tone { outline: 2px solid var(--focus); outline-offset: 2px; }
.os-wall[aria-checked="true"] { font-weight: 600; }
.os-switch-btn { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 36px; padding: 0 var(--space-1); border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-soft); cursor: default; }
.os-switch-track { position: relative; width: 36px; height: 20px; box-sizing: border-box; border: 1px solid var(--rule-strong); border-radius: var(--radius-pill); background: var(--paper-inset); }
.os-switch-knob { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink-soft); transition: left var(--dur-2) var(--ease-standard); }
.os-switch-btn[aria-checked="true"] .os-switch-track { background: var(--accent-strong); border-color: var(--accent-strong); }
.os-switch-btn[aria-checked="true"] .os-switch-knob { left: 19px; background: var(--paper-raised); }
.os-switch-btn[aria-checked="true"] { color: var(--ink); }
.os-switch-word { min-width: 2.2em; font-size: var(--text-xs); font-weight: 600; text-align: left; }
:root[data-motion="none"] .os-switch-knob { transition: none; }
.os-select, .os-input {
  min-height: 36px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0 var(--space-3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
.os-select:focus-visible, .os-input:focus-visible { outline: 2px solid var(--focus); outline-offset: -1px; }
.os-meter { display: block; height: 8px; margin-top: var(--space-2); border-radius: var(--radius-pill); background: var(--paper-inset); border: 1px solid var(--rule); overflow: hidden; }
.os-meter > span { display: block; height: 100%; background: var(--accent-strong); }
.os-meter.is-thin { height: 4px; margin-top: var(--space-1); border: 0; }

/* Settings: the pages down the left, the page on the right. */
.os-set { position: absolute; inset: 0; display: grid; grid-template-columns: 236px minmax(0, 1fr); background: var(--paper-raised); color: var(--ink); }
.os-set-nav { overflow: auto; padding: var(--space-3) var(--space-2); border-right: 1px solid var(--rule); background: var(--paper); }
.os-set-find { position: relative; display: block; margin: 0 var(--space-1) var(--space-3); }
.os-set-find svg, .os-files-find svg { position: absolute; left: var(--space-2); top: 50%; width: 16px; height: 16px; margin-top: -8px; color: var(--ink-faint); stroke-width: var(--icon-stroke); pointer-events: none; }
.os-set-find input, .os-files-find input { width: 100%; min-height: 32px; box-sizing: border-box; padding: 0 var(--space-2) 0 calc(var(--space-5) + var(--space-1)); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--paper-raised); color: var(--ink); font: inherit; }
.os-set-find input:focus-visible, .os-files-find input:focus-visible { outline: 2px solid var(--focus); outline-offset: -1px; }
.os-set-pages { list-style: none; margin: 0; padding: 0; }
.os-set-pages li[hidden] { display: none; }
.os-set-page {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 36px;
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: default;
}
.os-set-page:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.os-set-page[aria-current="page"] { background: var(--accent-soft); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent-strong); }
.os-set-page svg { width: 18px; height: 18px; flex: none; stroke-width: var(--icon-stroke); color: var(--ink-soft); }
.os-set-body { overflow: auto; padding: var(--space-5) var(--space-6) var(--space-6); }
.os-set-body:focus { outline: none; }
.os-set-title { margin: 0 0 var(--space-4); font-size: var(--text-xl); font-weight: 600; }
.os-set-sec { max-width: 760px; margin: 0 0 var(--space-5); }
.os-set-h { margin: 0 0 var(--space-2); font-size: var(--text-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); }
.os-set-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid var(--rule); border-bottom-width: 0; background: var(--paper); }
.os-set-sec .os-set-row:first-of-type { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.os-set-sec .os-set-row:last-of-type { border-bottom-width: 1px; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.os-set-sec .os-set-row:only-of-type { border-radius: var(--radius-md); }
.os-set-row.is-block { display: block; }
.os-set-row.is-block > .os-set-text { margin-bottom: var(--space-3); }
.os-set-row.is-found { background: color-mix(in srgb, var(--accent) 10%, var(--paper)); }
.os-set-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.os-set-label { font-weight: 600; }
.os-set-sub { font-size: var(--text-xs); color: var(--ink-soft); line-height: 1.45; font-variant-numeric: tabular-nums; }
.os-set-ctl { flex: none; display: flex; align-items: center; gap: var(--space-2); }
.os-set-note { margin: var(--space-2) 0 0; font-size: var(--text-xs); color: var(--ink-soft); line-height: var(--leading-prose); max-width: 68ch; }
.os-set-sec > .os-set-note:first-child { margin: 0 0 var(--space-3); }
.os-set-lead { margin: 0 0 var(--space-3); line-height: var(--leading-prose); max-width: 64ch; }
.os-set-status { margin: var(--space-2) 0 0; min-height: 1.4em; color: var(--ink-soft); }
.os-set-state { font-weight: 600; color: var(--good); }
.os-set-btns { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.os-set-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-1) var(--space-4); margin: var(--space-3) 0 0; font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.os-set-dl.is-wide { font-size: var(--text-sm); margin: 0 0 var(--space-2); padding: var(--space-3) var(--space-4); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--paper); }
.os-set-dl dt { color: var(--ink-soft); }
.os-set-dl dd { margin: 0; }
.os-ways-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--space-2); }
.os-way-pick { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-1); padding: var(--space-1); border: 1px solid transparent; border-radius: var(--radius-md); background: none; color: var(--ink); font-size: var(--text-xs); text-align: left; cursor: default; }
.os-way-pick:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.os-way-pick[aria-checked="true"] { border-color: var(--accent); font-weight: 600; }
.os-way-swatch { display: flex; align-items: flex-end; height: 40px; padding: var(--space-1); box-sizing: border-box; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); }
.os-way-swatch > span { display: block; width: 100%; height: 10px; border-radius: var(--radius-sm); }
.os-set-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; border: 1px solid var(--rule); border-radius: var(--radius-md); }
.os-set-item { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-2) 0 var(--space-3); border-top: 1px solid var(--rule); }
.os-set-item:first-child { border-top: 0; }
.os-set-item-name { flex: 1; min-width: 0; }
.os-set-add { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-3); }
.os-set-table { border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--paper); overflow: hidden; }
.os-set-tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-3); align-items: center; min-height: 44px; padding: var(--space-1) var(--space-3); border-top: 1px solid var(--rule); }
.os-set-tr.is-apps { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
.os-set-tr.is-head { min-height: 32px; border-top: 0; background: var(--paper-inset); font-size: var(--text-xs); font-weight: 600; color: var(--ink-soft); }
.os-set-tr .os-select { width: 100%; }
.os-set-tr .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.os-set-ext { font-family: var(--font-mono); font-size: var(--text-xs); }
.os-set-mark { font-family: var(--font-ui); color: var(--accent-strong); }
.os-set-app { display: flex; align-items: center; gap: var(--space-2); }
.os-set-about { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-4); }
.os-set-about .os-set-lead { margin: 0 0 var(--space-1); font-weight: 600; font-size: var(--text-md); }
.os-keys { width: 100%; max-width: 760px; border-collapse: collapse; font-size: var(--text-sm); }
.os-keys th, .os-keys td { padding: var(--space-2) var(--space-3); border-top: 1px solid var(--rule); text-align: left; vertical-align: top; }
.os-keys th { width: 40%; font-weight: 400; white-space: nowrap; }
@container win (max-width: 620px) {
  .os-set { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .os-set-nav { border-right: 0; border-bottom: 1px solid var(--rule); padding: var(--space-2); }
  .os-set-find { display: none; }
  .os-set-pages { display: flex; gap: var(--space-1); overflow-x: auto; }
  .os-set-page { width: auto; white-space: nowrap; min-height: 44px; }
  .os-set-body { padding: var(--space-4); }
  .os-set-row { flex-direction: column; align-items: stretch; }
  .os-set-ctl { flex-wrap: wrap; }
  .os-seg { min-width: 0; }
  .os-set-tr.is-apps { grid-template-columns: minmax(0, 1fr) auto; }
  .os-set-tr.is-apps > :nth-child(2), .os-set-tr.is-apps > :nth-child(3) { display: none; }
  .os-walls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Quick settings, from the tray. */
.os-quick { right: var(--space-2); width: min(360px, calc(100vw - var(--space-4))); padding: 0 0 var(--space-2); }
.os-q-head { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--rule); }
.os-q-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); padding: var(--space-3); }
.os-q-tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 0 var(--space-2);
  align-items: center;
  min-height: 56px;
  box-sizing: border-box;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  cursor: default;
}
.os-q-tile > svg { grid-row: 1 / 3; width: 20px; height: 20px; stroke-width: var(--icon-stroke); color: var(--ink-soft); }
.os-q-tile:hover:not(.is-info) { border-color: var(--ink-faint); }
.os-q-tile[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.os-q-tile[aria-pressed="true"] > svg { color: var(--accent-strong); }
.os-q-tile.is-off > svg { color: var(--warn); }
.os-q-tile.is-wide { grid-column: 1 / -1; }
.os-q-label { font-weight: 600; font-size: var(--text-sm); }
.os-q-state { font-size: var(--text-xs); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.os-q-row { display: flex; align-items: center; gap: var(--space-3); width: calc(100% - 2 * var(--space-3)); margin: 0 var(--space-3); min-height: 56px; box-sizing: border-box; padding: var(--space-2) var(--space-3); border: 1px solid var(--rule); border-radius: var(--radius-md); background: none; color: var(--ink); text-align: left; cursor: default; }
.os-q-row:hover { border-color: var(--ink-faint); }
.os-q-row > svg { width: 20px; height: 20px; flex: none; stroke-width: var(--icon-stroke); color: var(--ink-soft); }
.os-q-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.os-q-foot { display: flex; justify-content: space-between; padding: var(--space-2) var(--space-2) 0; }
.os-q-foot .os-link svg, .os-c-head .os-link svg { width: 16px; height: 16px; margin-right: var(--space-1); stroke-width: var(--icon-stroke); }
.os-tray-quick .os-quick-glyphs { display: inline-flex; gap: 2px; }
.os-tray-quick.is-offline { color: var(--danger); }

/* The lock screen: the wallpaper, the time and the date over everything. */
.os-lock {
  position: fixed;
  inset: 0;
  z-index: 60000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  padding: max(12vh, var(--space-6)) var(--space-5) var(--space-6);
  background: var(--os-wall);
  color: var(--os-wall-ink);
}
.os-lock[hidden] { display: none; }
.os-lock-face { text-align: center; }
.os-lock-time { margin: 0; font-size: calc(var(--text-4xl) * 2); font-weight: 300; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.os-lock-date { margin: var(--space-3) 0 0; font-size: var(--text-lg); color: var(--os-wall-soft); }
.os-lock-notes { margin: var(--space-4) 0 0; font-size: var(--text-sm); color: var(--os-wall-soft); font-variant-numeric: tabular-nums; }
.os-lock-foot { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.os-lock-btn { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-5); border: 1px solid color-mix(in srgb, var(--os-wall-ink) 40%, transparent); border-radius: var(--radius-md); background: color-mix(in srgb, var(--os-wall-ink) 8%, transparent); color: var(--os-wall-ink); font-weight: 600; cursor: default; }
.os-lock-btn:hover { background: color-mix(in srgb, var(--os-wall-ink) 14%, transparent); }
.os-lock-btn svg { width: 18px; height: 18px; stroke-width: var(--icon-stroke); }
.os-lock-say { margin: 0; max-width: 46ch; text-align: center; font-size: var(--text-xs); color: var(--os-wall-soft); line-height: var(--leading-prose); }
body.is-locked .os-desk, body.is-locked .os-bar, body.is-locked .os-toasts, body.is-locked .os-pop:not(.os-lock), body.is-locked .os-menu, body.is-locked .os-switch { visibility: hidden; }

/* The first run. */
.os-welcome { position: absolute; inset: 0; overflow: auto; padding: var(--space-5) var(--space-6); background: var(--paper-raised); color: var(--ink); }
.os-welcome-title { margin: 0 0 var(--space-3); font-size: var(--text-xl); font-weight: 600; }
.os-welcome-title:focus { outline: none; }
.os-welcome-lead { margin: 0 0 var(--space-4); line-height: var(--leading-prose); max-width: 60ch; }
.os-welcome .os-seg { max-width: 360px; margin-bottom: var(--space-4); }
.os-welcome-note { margin: 0 0 var(--space-4); font-size: var(--text-xs); color: var(--ink-soft); line-height: var(--leading-prose); max-width: 60ch; }
.os-welcome-btns { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
/* The first run's question: six answers in two columns, each a name and
   a line saying what it is for; then three things to try, as a list. */
.os-use { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin: 0 0 var(--space-4); max-width: 620px; }
.os-use-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 60px; padding: var(--space-2) var(--space-3); border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--paper); color: var(--ink); text-align: left; cursor: default; }
.os-use-pick:hover { border-color: var(--ink-faint); }
.os-use-pick[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.os-use-name { font-weight: 600; }
.os-use-sub { font-size: var(--text-xs); line-height: var(--leading-ui); color: var(--ink-soft); }
.os-welcome-row { display: flex; flex-wrap: wrap; gap: 0 var(--space-5); }
.os-welcome-row .os-seg { min-width: 0; }
.os-try { list-style: none; margin: 0 0 var(--space-4); padding: 0; max-width: 620px; border-top: 1px solid var(--rule); }
.os-try li { border-bottom: 1px solid var(--rule); }
.os-try-btn { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 56px; padding: var(--space-2) var(--space-2); border: 0; background: none; color: var(--ink); text-align: left; cursor: default; }
.os-try-btn:hover { background: var(--paper-inset); }
.os-try-text { display: flex; flex-direction: column; min-width: 0; }
.os-try-name { font-weight: 600; }
.os-try-how { font-size: var(--text-xs); color: var(--ink-soft); }
@media (max-width: 560px) { .os-use { grid-template-columns: minmax(0, 1fr); } .os-welcome { padding: var(--space-4); } }

/* A question that needs an answer before anything happens (closing a
   window with work in it that is not saved). */
.os-ask { left: 50%; top: 30%; bottom: auto; width: min(440px, calc(100vw - var(--space-5))); transform: translateX(-50%); padding: var(--space-5); z-index: 50005; }
.os-ask p { margin: 0 0 var(--space-4); font-size: var(--text-md); line-height: var(--leading-prose); }
.os-ask-btns { display: flex; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; }
.os-tool.is-main { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); font-weight: 600; }
.os-tool.is-main[disabled] { background: var(--paper); border-color: var(--rule); color: var(--ink-faint); font-weight: 600; }

/* Switching windows from the keyboard. */
.os-switch {
  position: fixed;
  z-index: 50003;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  max-width: calc(100vw - var(--space-6));
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-2);
}
.os-switch[hidden] { display: none; }
.os-sw-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  width: 128px;
  padding: var(--space-3) var(--space-2);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  cursor: default;
}
.os-sw-item.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.os-sw-name { font-size: var(--text-xs); font-weight: 600; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.os-sw-none { margin: 0; padding: var(--space-2) var(--space-3); color: var(--ink-soft); }

/* A menu on a right click, or on Shift F10 from the keyboard. */
.os-menu {
  position: fixed;
  z-index: 50004;
  min-width: 208px;
  max-width: 300px;
  padding: var(--space-1);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-2);
}
.os-menu[hidden] { display: none; }
.os-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 32px;
  box-sizing: border-box;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  text-align: left;
  cursor: default;
}
.os-menu-item:hover, .os-menu-item:focus { background: color-mix(in srgb, var(--accent) 12%, transparent); outline: none; }
.os-menu-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.os-menu-item[aria-checked="true"]::after { content: ""; margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-strong); }
.os-menu-item[aria-disabled="true"] { color: var(--ink-faint); }
.os-menu hr { margin: var(--space-1) 0; border: 0; border-top: 1px solid var(--rule); }

/* Notices from a window behind the others, or from the desktop. */
.os-toasts {
  position: fixed;
  z-index: 50002;
  right: var(--space-3);
  bottom: calc(var(--os-bar-h) + var(--space-3));
  width: min(360px, calc(100vw - var(--space-5)));
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
.os-toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-1) var(--space-3);
  align-items: start;
  padding: var(--space-3) var(--space-1) var(--space-3) var(--space-3);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-2);
  pointer-events: auto;
  animation: os-pop-in var(--dur-3) var(--ease-standard);
}
.os-toast.is-warn { border-left: 3px solid var(--danger); }
.os-toast-text { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }
.os-toast-from { display: block; font-size: var(--text-xs); font-weight: 600; color: var(--ink-soft); }
.os-toast-x { width: 32px; height: 32px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-soft); cursor: pointer; display: grid; place-items: center; }
.os-toast-x:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.os-toast-x svg { width: 16px; height: 16px; stroke-width: var(--icon-stroke); }
:root[data-motion="none"] .os-toast { animation: none; }

/* ------------------------------------------------------------- Files */

/* A command bar, then where you are, then the places, the list and the
   details, then a status line: the shape of a file manager. */
.os-files { position: absolute; inset: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; background: var(--paper-raised); color: var(--ink); container-type: inline-size; container-name: files; }
.os-files-cmds { display: flex; align-items: center; gap: var(--space-1); min-height: 44px; padding: 0 var(--space-2); border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.os-files-sep { flex: none; width: 1px; height: 20px; margin: 0 var(--space-1); background: var(--rule); }
.os-files-gap { flex: 1; }
.os-files-nav { display: flex; align-items: center; gap: var(--space-1); min-height: 40px; padding: 0 var(--space-2); border-bottom: 1px solid var(--rule); background: var(--paper); }
.os-files-crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; overflow: hidden; white-space: nowrap; padding: 0 var(--space-1); }
.os-crumb { flex: none; max-width: 22ch; min-height: 28px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; cursor: default; }
.os-crumb:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.os-crumb[aria-current] { color: var(--ink); font-weight: 600; }
.os-crumb-sep { color: var(--ink-faint); }
.os-files-find { position: relative; flex: 0 1 200px; min-width: 120px; }
.os-tool {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  min-height: 32px;
  padding: 0 var(--space-3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  white-space: nowrap;
  cursor: default;
}
.os-tool:hover:not([disabled]) { border-color: var(--ink-faint); }
.os-tool[disabled] { color: var(--ink-faint); border-color: var(--rule); }
.os-tool[hidden] { display: none; }
.os-tool svg { width: 16px; height: 16px; stroke-width: var(--icon-stroke); flex: none; }
.os-tool.is-icon { justify-content: center; width: 32px; padding: 0; }
.os-tool.is-flat, .os-files-cmds .os-tool { border-color: transparent; background: none; }
.os-files-cmds .os-tool:hover:not([disabled]), .os-tool.is-flat:hover:not([disabled]) { border-color: transparent; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.os-tool[aria-pressed="true"] { background: var(--accent-soft) !important; color: var(--ink); }
.os-files-main { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 0; }
.os-files.has-info .os-files-main { grid-template-columns: 208px minmax(0, 1fr) 232px; }
.os-files-main > * { min-width: 0; }
.os-files-side { overflow: auto; padding: var(--space-3) var(--space-2); border-right: 1px solid var(--rule); background: var(--paper); }
.os-files-side h3 { margin: var(--space-3) var(--space-2) var(--space-1); color: var(--ink-faint); }
.os-files-side h3:first-child { margin-top: 0; }
.os-place {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 32px;
  box-sizing: border-box;
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  text-align: left;
  cursor: default;
}
.os-place span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-place.is-sub { padding-left: var(--space-5); }
.os-place:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.os-place[aria-current="true"] { background: var(--accent-soft); font-weight: 600; }
.os-place svg { width: 16px; height: 16px; flex: none; stroke-width: var(--icon-stroke); color: var(--ink-soft); }
.os-place.is-drop, .os-file.is-drop { border-color: var(--accent); border-style: dashed; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.os-files-pane { display: flex; flex-direction: column; min-height: 0; container-type: inline-size; container-name: pane; }
.os-files-cols, .os-file { display: grid; grid-template-columns: minmax(0, 1fr) 132px 152px 80px; gap: var(--space-3); align-items: center; padding: 0 var(--space-3); }
.os-files-cols { min-height: 32px; border-bottom: 1px solid var(--rule); font-size: var(--text-xs); color: var(--ink-faint); }
.os-files-cols button { min-height: 28px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: default; }
.os-files-cols button:hover { color: var(--ink); }
.os-files-cols button.os-file-size { text-align: right; }
.os-files-cols button.is-sorted { color: var(--ink); font-weight: 600; }
.os-files-cols button.is-sorted::after { content: ""; display: inline-block; margin-left: var(--space-1); border: 4px solid transparent; border-bottom-color: currentColor; border-top-width: 0; vertical-align: middle; }
.os-files-cols button.is-sorted.is-desc::after { border-bottom-width: 0; border-top: 4px solid currentColor; }
.os-files-list { flex: 1; min-height: 0; overflow: auto; padding: var(--space-1) 0; }
.os-files-list:focus-visible { outline-offset: -2px; }
.os-file { min-height: 34px; border: 1px solid transparent; cursor: default; user-select: none; }
.os-file:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.os-file[aria-selected="true"] { background: var(--accent-soft); }
.os-files-list:focus-visible .os-file.is-active, .os-dlg .os-file.is-active { box-shadow: inset 2px 0 0 var(--focus); }
.os-file.is-cut { opacity: .55; }
.os-file-name { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.os-file-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-file-kind, .os-file-when, .os-file-size { font-size: var(--text-xs); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-file-when, .os-file-size { font-variant-numeric: tabular-nums; }
.os-file-size { text-align: right; }
.os-ftype { display: grid; place-items: center; flex: none; width: 20px; height: 20px; color: var(--ink-soft); }
.os-ftype svg { width: 18px; height: 18px; stroke-width: var(--icon-stroke); }
.os-file.is-folder .os-ftype { color: var(--accent-strong); }
.os-rename { min-width: 0; width: 100%; min-height: 26px; box-sizing: border-box; padding: 0 var(--space-1); border: 1px solid var(--focus); border-radius: var(--radius-sm); background: var(--paper-raised); color: var(--ink); font: inherit; }
.os-rename:focus { outline: none; box-shadow: 0 0 0 1px var(--focus); }
.os-rename.is-icon { text-align: center; font-size: var(--text-xs); }
/* The icon view: tiles in rows, the mark above the name. */
.os-files-list.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); align-content: start; gap: var(--space-1); padding: var(--space-2); }
.os-files-list.is-grid .os-file { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); min-height: 96px; padding: var(--space-2) var(--space-1); border-radius: var(--radius-md); text-align: center; }
.os-files-list.is-grid .os-file-name { flex-direction: column; gap: var(--space-1); width: 100%; }
.os-files-list.is-grid .os-ftype { width: 40px; height: 40px; }
.os-files-list.is-grid .os-ftype svg { width: 34px; height: 34px; }
.os-files-list.is-grid .os-file-label { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: var(--text-xs); }
.os-files-list.is-grid .os-file-kind, .os-files-list.is-grid .os-file-when, .os-files-list.is-grid .os-file-size { display: none; }
.os-files-pane:has(.os-files-list.is-grid) .os-files-cols { display: none; }
.os-files-list.is-grid .os-files-empty { grid-column: 1 / -1; }
.os-files-list.is-grid .os-file.is-active { box-shadow: none; }
.os-files-list.is-grid:focus-visible .os-file.is-active { outline: 2px solid var(--focus); outline-offset: -2px; }
.os-files-empty { margin: 0; padding: var(--space-6) var(--space-4); max-width: 52ch; color: var(--ink-soft); line-height: var(--leading-prose); }
/* The details pane. */
.os-files-info { display: none; overflow: auto; padding: var(--space-4) var(--space-3); border-left: 1px solid var(--rule); background: var(--paper); }
.os-files.has-info .os-files-info { display: block; }
.os-info-mark { display: grid; place-items: center; height: 88px; margin-bottom: var(--space-3); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--paper-raised); color: var(--ink-soft); }
.os-info-mark svg { width: 44px; height: 44px; stroke-width: var(--icon-stroke); }
.os-info-name { margin: 0 0 var(--space-3); font-weight: 600; overflow-wrap: anywhere; }
.os-info-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-1) var(--space-3); margin: 0 0 var(--space-3); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.os-info-dl dt { color: var(--ink-soft); }
.os-info-dl dd { margin: 0; overflow-wrap: anywhere; }
.os-files-status { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 28px; padding: 0 var(--space-3); border-top: 1px solid var(--rule); background: var(--paper); font-size: var(--text-xs); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.os-files-hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Files in a narrow window: the details go first, then the places become
   a row along the top, and the columns that matter least go. Measured on
   the window, not the screen, because a window can be any width. */
@container files (max-width: 820px) {
  .os-files.has-info .os-files-main { grid-template-columns: 208px minmax(0, 1fr); }
  .os-files.has-info .os-files-info { display: none; }
}
@container files (max-width: 560px) {
  .os-files-main, .os-files.has-info .os-files-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .os-files-side { display: flex; gap: var(--space-1); overflow-x: auto; padding: var(--space-2); border-right: 0; border-bottom: 1px solid var(--rule); }
  .os-files-side h3, .os-files-hint, .os-tool span, .os-files-find { display: none; }
  .os-place { width: auto; flex: none; }
  .os-place.is-sub { padding-left: var(--space-2); }
}
@container pane (max-width: 600px) {
  .os-files-cols, .os-file { grid-template-columns: minmax(0, 1fr) 140px 72px; }
  .os-files-cols button:nth-child(2), .os-file-kind { display: none; }
}
@container pane (max-width: 400px) {
  .os-files-cols, .os-file { grid-template-columns: minmax(0, 1fr) auto; }
  .os-files-cols button:nth-child(3), .os-file-when { display: none; }
}

/* The Open dialog a window asks for. */
.os-dlg { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); width: min(760px, calc(100vw - var(--space-4))); height: min(520px, calc(100dvh - var(--os-bar-h) - var(--space-5))); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; z-index: 50005; }
.os-dlg-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); border-bottom: 1px solid var(--rule); }
.os-dlg-from { font-weight: 400; color: var(--ink-soft); }
.os-dlg-main { display: grid; grid-template-columns: 180px minmax(0, 1fr); min-height: 0; }
.os-dlg-pane { display: flex; flex-direction: column; min-height: 0; }
.os-dlg-path { margin: 0; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--rule); font-weight: 600; font-size: var(--text-xs); color: var(--ink-soft); }
.os-dlg .os-file { grid-template-columns: minmax(0, 1fr) 152px 80px; }
.os-dlg-foot { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3); border-top: 1px solid var(--rule); background: var(--paper); }

/* A file on the desktop: its kind's mark, in the paper of a page. */
.os-ico.is-doc { background: var(--paper-raised); color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.os-icon.is-file .os-ico svg { stroke-width: var(--icon-stroke); }
.os-desk[data-icons="sm"] .os-ico:not(.is-sm):not(.is-xs):not(.is-lg) { width: 32px; height: 32px; }
.os-desk[data-icons="sm"] .os-ico:not(.is-sm):not(.is-xs):not(.is-lg) svg { width: 18px; height: 18px; }
.os-desk[data-icons="lg"] .os-icons .os-ico { width: 52px; height: 52px; border-radius: var(--radius-lg); }
.os-desk[data-icons="lg"] .os-icons .os-ico svg { width: 30px; height: 30px; }

/* ------------------------------------------------------------- a phone */

/* No windows on a small screen: the desktop is the launcher, an
   application fills the screen, and the bar has Home, Search and the
   open applications. os-shell.js sets is-phone below 760 pixels. */
.os-phone { display: none; }
body.is-phone .os-icons, body.is-phone .os-recent, body.is-phone .os-pins, body.is-phone .os-tasks,
body.is-phone .os-showdesk, body.is-phone .os-clock-date, body.is-phone #osProof, body.is-phone .os-start { display: none; }
body.is-phone { --os-bar-h: 56px; }
body.is-phone .os-bar { padding-bottom: env(safe-area-inset-bottom); height: calc(var(--os-bar-h) + env(safe-area-inset-bottom)); }
body.is-phone .os-phone { display: flex; flex: 1; align-items: stretch; height: 100%; }
.os-phone-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--ink-soft);
  font-size: var(--text-2xs);
  font-weight: 600;
}
.os-phone-btn svg { width: 22px; height: 22px; stroke-width: var(--icon-stroke); }
.os-phone-btn[aria-pressed="true"] { color: var(--accent-strong); }
.os-phone-n { font-variant-numeric: tabular-nums; }
body.is-phone .os-tray { border-left: 0; padding-left: 0; }
body.is-phone .os-tray-btn span:not(.os-sr):not(.os-bell-n) { display: none; }
body.is-phone .os-home { display: block; position: absolute; inset: 0; overflow: auto; padding: var(--space-4) var(--space-4) var(--space-6); }
body.is-phone .os-home[hidden] { display: none; }
body.is-phone .os-home .os-l-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.is-phone .os-home .os-l-app { min-height: 92px; }
body.is-phone .os-win { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; min-width: 0; min-height: 0; border: 0; border-radius: 0; box-shadow: none; animation: none; }
body.is-phone .os-win:not(.is-front), body.is-phone.is-home .os-win { display: none; }
body.is-phone .os-grip { display: none; }
body.is-phone .os-win-bar { height: 44px; }
body.is-phone .os-win-btn[data-act="min"], body.is-phone .os-win-btn[data-act="max"] { display: none; }
body.is-phone .os-pop { left: var(--space-2); right: var(--space-2); width: auto; }
body.is-phone .os-launch { height: auto; }
body.is-phone .os-ask { transform: none; }
body.is-phone .os-dlg { transform: none; top: var(--space-2); bottom: calc(var(--os-bar-h) + var(--space-2)); height: auto; }
body.is-phone .os-dlg-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
body.is-phone .os-dlg .os-files-side { display: flex; gap: var(--space-1); overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--rule); }
body.is-phone .os-dlg .os-file { grid-template-columns: minmax(0, 1fr) auto; }
body.is-phone .os-dlg .os-file-when { display: none; }
body.is-phone .os-s-recent { grid-template-columns: minmax(0, 1fr); }
body.is-phone .os-home .os-s-res { padding: 0; }
body.is-phone .os-home .os-l-top { padding: 0 0 var(--space-3); }
body.is-phone .os-place, body.is-phone .os-tool, body.is-phone .os-set-page, body.is-phone .os-crumb { min-height: 44px; }
body.is-phone .os-tool.is-icon { width: 44px; }
body.is-phone .os-switch { inset: 0 0 var(--os-bar-h); transform: none; max-width: none; display: block; padding: var(--space-4); border: 0; border-radius: 0; box-shadow: none; overflow: auto; }
body.is-phone .os-switch[hidden] { display: none; }
body.is-phone .os-sw-item { flex-direction: row; width: 100%; min-height: 56px; justify-content: flex-start; padding: var(--space-2) var(--space-3); border: 1px solid var(--rule); margin-bottom: var(--space-2); }
body.is-phone .os-sw-name { text-align: left; flex: 1; }
.os-sw-row { display: flex; align-items: center; gap: var(--space-2); }
body.is-phone .os-sw-row .os-sw-item { margin-bottom: 0; }
body.is-phone .os-sw-row { margin-bottom: var(--space-2); }
body.is-phone .os-sw-row .os-toast-x { width: 44px; height: 44px; flex: none; }
body.is-phone .os-place, body.is-phone .os-tool { min-height: 44px; }
body.is-phone .os-file { min-height: 52px; }

/* A finger is not a pointer: 44 pixels, wherever there is a pointer that
   coarse, at any width. */
@media (pointer: coarse) {
  :root { --os-title-h: 44px; }
  .os-menu-item, .os-place, .os-tool, .os-link, .os-toast-x, .os-way-pick, .os-seg button, .os-set-page, .os-crumb, .os-switch-btn, .os-select, .os-input, .os-files-cols button { min-height: 44px; }
  .os-tool.is-icon { width: 44px; }
  .os-toast-x { width: 44px; height: 44px; }
  .os-file { min-height: 48px; }
}

