/* ---- The computer ---------------------------------------------------------------------------
   An original desktop: a plain top bar, a dock of app tiles, one window.
   Solid panels and thin lines; no frosted glass, no large gradients.
   Neutral greys carry the layout; the accent only marks what is active.  */
#os { position: fixed; inset: 0; z-index: 20; overflow: hidden; background: var(--bg); color: var(--text); font-size: 14px;
  opacity: 0; transition: opacity var(--t-os) ease-out; }
#os.on { opacity: 1; }
#os.placed { inset: auto; }
#os .layer { position: absolute; }
html[data-layout="mobile"] #os { height: 100vh; height: 100dvh; }
.os-frame { position: relative; display: flex; flex-direction: column; height: 100%; }
.os-lock, .os-desk { flex: 1; min-height: 0; }
#os[data-screen="lock"] .os-desk, #os[data-screen="desktop"] .os-lock { display: none; }
.os-banner { display: none; }
html[data-layout="mobile"] .os-banner { display: block; flex: none; padding: 7px 16px; padding-top: max(7px, env(safe-area-inset-top));
  background: var(--text); color: #fff; font-size: 13px; text-align: center; }

/* ---- Lock screen ---- */
.os-lock { position: relative; display: grid; place-items: center; padding: 24px; overflow: auto;
  background: var(--wallpaper, none) center / cover, var(--night); }
.os-lock::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .22); }
.lock-card { position: relative; display: grid; justify-items: center; gap: 4px; width: min(380px, 100%); color: #fff; text-align: center; }
.lock-logo { width: auto; height: 36px; margin-bottom: 10px; }
.lock-logo.wordmark { width: 40px; height: 40px; font-size: 15px; }
.lock-card > p { text-shadow: 0 1px 12px rgba(0, 0, 0, .35); }
.lock-time { font: 400 clamp(46px, 7vw, 80px)/1 var(--font-ui); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.lock-date { font-size: 17px; }
.lock-greet { margin-top: 18px; font-size: 20px; font-weight: 500; }
.lock-form { display: grid; gap: 8px; width: 100%; margin-top: 10px; padding: 18px; border-radius: var(--radius-lg); background: var(--bg);
  box-shadow: var(--shadow-2); color: var(--text); text-align: left; }
.lock-label { font-weight: 500; }
.lock-row { display: flex; gap: 8px; }
.lock-input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--field); border-radius: var(--radius); background: #fff; font-size: 16px; }
.lock-input[aria-invalid="true"] { border-color: var(--danger); }
.lock-go { min-height: 40px; }
.lock-err { color: var(--danger); font-size: 13px; }
.lock-err:empty { display: none; }
.lock-note { color: var(--muted); font-size: 12.5px; }

/* ---- Desktop ---- */
.os-desk { display: flex; flex-direction: column; background: var(--wallpaper, none) center / cover, var(--panel-2); }
.os-top { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; height: 38px; padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--line); background: var(--bg); }
.os-brand { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.os-logo { width: auto; height: 20px; }
.wordmark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--accent); color: var(--accent-ink);
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em; }
.os-company { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.os-status { display: flex; flex: none; align-items: center; gap: 12px; font-size: 13px; }
.os-week { padding: 0 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font-size: 12px; font-weight: 600; }
.os-when { display: flex; gap: 8px; font-variant-numeric: tabular-nums; }
.os-menu-btn { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; }
.os-menu-btn:hover, .os-menu-btn[aria-expanded="true"] { background: var(--panel); }
.os-who { max-width: 14ch; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.os-who:empty { display: none; }
.os-main { position: relative; display: flex; flex: 1; justify-content: center; min-height: 0; padding: 16px 16px 10px; }
.os-main:has(.window.max) { padding: 0; }
.os-dock { display: flex; flex: none; gap: 2px; margin: 0 auto 10px; padding: 5px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg); box-shadow: var(--shadow-1); }
.dock-btn { position: relative; display: grid; justify-items: center; gap: 2px; width: 66px; padding: 5px 2px 3px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text); font-size: 11.5px; line-height: 1.2; }
.dock-btn:hover { background: var(--panel); }
/* the open app: a soft tint behind its icon and a short accent bar under it */
.dock-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--panel); color: var(--text-2);
  transition: background var(--t-ui), color var(--t-ui); }
.dock-btn[aria-current] .dock-icon { background: var(--accent-soft); color: var(--accent); }
.dock-btn[aria-current] .dock-label { color: var(--accent); }
.dock-btn[aria-current]::after { content: ""; position: absolute; bottom: -4px; left: 50%; width: 16px; height: 3px; margin-left: -8px;
  border-radius: 2px; background: var(--accent); }
.dock-label { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.badge { position: absolute; top: 0; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; border: 2px solid var(--bg); border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 600; line-height: 14px; text-align: center; }
.phone-only { display: none; }

/* ---- Window ---- */
.window { display: flex; flex-direction: column; width: min(94%, 1180px); height: 100%; overflow: hidden; border: 1px solid var(--line);
  border-radius: var(--radius-lg); background: var(--bg); box-shadow: var(--shadow-2); animation: win-in var(--t-os) ease-out; }
.window.max { width: 100%; border: 0; border-radius: 0; }
@keyframes win-in { from { opacity: 0; transform: scale(.985); } }
.win-bar { display: flex; flex: none; align-items: center; justify-content: space-between; height: 40px; padding: 0 6px 0 14px;
  border-bottom: 1px solid var(--line); }
.win-title { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.win-title { font-weight: 500; }
.win-title svg { color: var(--text-2); }
.win-ctl { display: flex; gap: 2px; }
.win-body { flex: 1; min-height: 0; overflow: auto; container: app / inline-size; }

/* ---- Notifications ---- */
/* bottom right, above the dock, so a toast never covers the top bar or a window's buttons */
.os-toasts { position: absolute; bottom: 92px; right: 12px; z-index: 5; display: grid; gap: 8px; width: min(340px, calc(100% - 24px)); pointer-events: none; }
.toast-item { position: relative; pointer-events: auto; opacity: 0; transform: translateX(calc(100% + 16px));
  transition: transform 240ms var(--ease-cam), opacity 240ms ease-out; }
.toast-item.in { opacity: 1; transform: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 12px 36px 12px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-2); text-align: left; }
.toast:hover { border-color: var(--line-strong); }
.toast-icon { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.toast-text { display: grid; gap: 1px; min-width: 0; font-size: 13px; }
.toast-text strong { font-size: 13.5px; font-weight: 600; }
.toast-text span { color: var(--muted); }
.toast-x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; }

/* ---- System menu and dialogs ---- */
.menu-layer { z-index: 6; }
/* .menu-layer .os-menu outranks the close-up rule ".layer > *" that would otherwise centre the menu */
.menu-layer .os-menu { position: absolute; top: 40px; right: 8px; width: 240px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: #fff; box-shadow: var(--shadow-2); }
.menu-who { margin-bottom: 4px; padding: 6px 10px 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; text-align: left; }
.menu-item:hover { background: var(--panel); }
.dialog-layer { z-index: 7; padding: 16px; }
.dialog { display: grid; gap: 10px; width: min(420px, 100%); padding: 20px; border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-2); }
.dialog-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--panel); color: var(--text-2); }
.dialog-title { font-size: 17px; }
.dialog-text { color: var(--text); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ---- Phone layout ---- */
html[data-layout="mobile"] .os-top { height: 46px; }
html[data-layout="mobile"] .os-when .os-date, html[data-layout="mobile"] .os-who { display: none; }
html[data-layout="mobile"] .os-main { padding: 0; }
html[data-layout="mobile"] .window { width: 100%; border: 0; border-radius: 0; box-shadow: none; animation: none; }
html[data-layout="mobile"] .win-ctl { display: none; }
html[data-layout="mobile"] .os-dock { justify-content: space-around; width: 100%; margin: 0; padding: 4px 4px max(4px, env(safe-area-inset-bottom));
  border-width: 1px 0 0; border-radius: 0; box-shadow: none; }
html[data-layout="mobile"] .dock-btn { flex: 1; width: auto; min-width: 0; }
html[data-layout="mobile"] .phone-only { display: grid; }
html[data-layout="mobile"] .os-toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }

@media (prefers-reduced-motion: reduce) {
  .toast-item { transform: none; transition: none; }
  .window { animation: none; }
}
