:root {
  --bg: #0b1020;
  --bg-2: #121a30;
  --surface: rgba(18, 24, 40, 0.86);
  --raised: rgba(32, 42, 68, 0.9);
  --text: #eef2f8;
  --muted: #93a0b8;
  --accent: #5b8cff;
  --ok: #3dd68c;
  --warn: #f5a524;
  --danger: #f31260;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --dock: 72px;
  --panel: 44px;
  --radius: 14px;
}
html[data-theme="light"] {
  --bg: #eef1f6;
  --bg-2: #f7f8fb;
  --surface: rgba(255, 255, 255, 0.86);
  --raised: #ffffff;
  --text: #12141a;
  --muted: #5c6575;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 12px 32px rgba(20, 30, 50, 0.12);
}
html[data-theme="light"] { --wallpaper-overlay: rgba(255, 255, 255, 0.48); }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.45 ui-sans-serif, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  display: grid;
  grid-template-rows: var(--panel) 1fr auto;
}
html[data-wallpaper="aurora"] body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(91, 140, 255, 0.18), transparent 50%),
    radial-gradient(900px 500px at 100% 100%, rgba(61, 214, 140, 0.08), transparent 45%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}
html[data-wallpaper="tide"] body {
  background:
    radial-gradient(ellipse at 82% 12%, rgba(41, 209, 207, 0.32), transparent 38%),
    radial-gradient(ellipse at 18% 88%, rgba(36, 103, 209, 0.4), transparent 48%),
    linear-gradient(145deg, #071426, #102b4a 56%, #071a2c);
}
html[data-theme="light"][data-wallpaper="tide"] body {
  background:
    radial-gradient(ellipse at 82% 12%, rgba(41, 173, 176, 0.22), transparent 38%),
    radial-gradient(ellipse at 18% 88%, rgba(64, 126, 202, 0.22), transparent 48%),
    linear-gradient(145deg, #d9edf0, #c7d9ee 56%, #e4edf5);
}
html[data-wallpaper="ember"] body {
  background:
    radial-gradient(ellipse at 80% 15%, rgba(255, 156, 74, 0.25), transparent 40%),
    radial-gradient(ellipse at 16% 85%, rgba(165, 92, 255, 0.32), transparent 48%),
    linear-gradient(145deg, #171127, #35223e 58%, #171a32);
}
html[data-theme="light"][data-wallpaper="ember"] body {
  background:
    radial-gradient(ellipse at 80% 15%, rgba(222, 127, 75, 0.2), transparent 40%),
    radial-gradient(ellipse at 16% 85%, rgba(146, 93, 202, 0.2), transparent 48%),
    linear-gradient(145deg, #f4e8e4, #e9dfea 58%, #eee7f2);
}
html[data-wallpaper="custom"] body {
  background: #101827;
}
.panel, .dock, .taskbar, .start-menu, .widget, dialog, .menu, .win, .card, .list, table, main {
  position: relative;
  isolation: isolate;
}
.panel::before, .dock::before, .taskbar::before, .start-menu::before,
.widget::before, dialog::before, .menu::before, .win::before, .card::before,
.list::before, table::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur, 16px)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--glass-blur, 16px)) saturate(1.2);
  pointer-events: none;
}
html[data-glass="off"] .panel::before,
html[data-glass="off"] .dock::before,
html[data-glass="off"] .taskbar::before,
html[data-glass="off"] .start-menu::before,
html[data-glass="off"] .widget::before,
html[data-glass="off"] .win::before,
html[data-glass="off"] .card::before,
html[data-glass="off"] dialog::before,
html[data-glass="off"] .menu::before,
html[data-glass="off"] .list::before,
html[data-glass="off"] table::before {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--raised);
}
input, textarea, button, label, .text, .card > *, .list > *, form, table, th, td,
.stack, .row, main, dialog, .widget, .win .body, .panel, .dock, .taskbar {
  position: relative;
  z-index: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}
.panel {
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px; border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -0.02em; }
.brand img { width: 25px; height: 25px; }
.route { color: var(--muted); flex: 1; }
.chip { display: flex; gap: 6px; font-size: 12px; }
.chip span { padding: 3px 10px; border-radius: 999px; background: var(--raised); border: 1px solid var(--border); }
.desktop { display: grid; grid-template-columns: var(--dock) 1fr; min-height: 0; }
.dock {
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  padding: 12px 6px; border-right: 1px solid var(--border);
}
.dock button {
  width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--raised); color: var(--text); cursor: pointer;
}
.dock button[aria-current=page] { box-shadow: inset 0 0 0 2px var(--accent); }
.workspace { position: relative; min-height: 0; overflow: hidden; }
.icons {
  position: absolute; top: 18px; left: 18px; z-index: 2;
  display: flex; flex-direction: column; gap: 14px;
}
.icons button {
  width: 76px; background: transparent; border: 0; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px;
}
.icons .glyph {
  font-size: 20px; width: 52px; height: 52px; display: grid; place-items: center;
  background: var(--raised); border-radius: 16px; border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.widgets {
  position: absolute; top: 18px; right: 18px; z-index: 2; width: 200px;
  display: flex; flex-direction: column; gap: 10px;
}
.widget { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.widget strong { display: block; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.widget-value { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.windows { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.win {
  position: absolute; pointer-events: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
  min-width: min(280px, 100%); min-height: min(180px, 100%);
  max-width: 100%; max-height: 100%;
  left: 6%; top: 8%; width: 62%; height: 70%;
}
.win header {
  display: flex; gap: 6px; align-items: center; padding: 8px 10px;
  border-bottom: 1px solid var(--border); cursor: move; background: var(--raised);
}
.win header strong { flex: 1; font-weight: 600; }
.win header button { width: 22px; height: 22px; padding: 0; border-radius: 6px; }
.win header .forward { margin-right: 4px; }
.win header button:disabled { opacity: 0.38; cursor: default; }
.win header button:disabled:hover { background: transparent; }
.win-nav {
  display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--raised);
}
.win-nav button {
  width: auto; min-width: 64px; height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12px; font-weight: 650;
}
.win-nav button:disabled { opacity: 0.4; cursor: default; }
.win-nav .win-nav-title {
  min-width: 0; margin-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-size: 12px;
}
.win .body { padding: 12px; overflow: auto; flex: 1; min-height: 0; min-width: 0; }
.resize {
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); border-radius: 0 0 4px 0;
}
.menu {
  position: fixed; z-index: 70; left: 8px; top: 8px; right: auto; bottom: auto; transform: none;
  display: flex; flex-direction: column; align-items: stretch; width: max-content;
  min-width: min(196px, calc(100vw - 16px)); max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px); box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 10px; padding: 6px; box-shadow: var(--shadow);
  background: var(--bg-2);
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
}
.menu::before { content: none; }
.menu[hidden] { display: none !important; }
.menu[data-measure="1"] {
  width: max-content;
  min-width: 0;
  max-width: min(320px, calc(100vw - 16px));
}
.menu[data-measure="1"] button { width: auto; }
.menu[data-fit="compact"] { padding: 4px; border-radius: 8px; }
.menu[data-fit="compact"] button { padding: 3px 8px; font-size: 12px; }
.menu[data-fit="compact"] .menu-sep { margin: 2px; }
.menu button {
  display: block; width: 100%; min-width: 0; flex: 0 0 auto; text-align: left; border: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu button:disabled { opacity: 0.38; cursor: default; }
.menu button:disabled:hover { background: transparent; }
.menu-sep { height: 1px; margin: 4px 2px; flex: 0 0 auto; background: var(--border); }
@supports (left: attr(data-x type(<percentage>))) {
  .menu[data-x] {
    left: attr(data-x type(<percentage>), 8px);
    top: attr(data-y type(<percentage>), 8px);
    right: auto;
    bottom: auto;
    transform: none;
    width: attr(data-w type(<percentage>), 90%);
    min-width: 0;
    max-width: attr(data-w type(<percentage>), 90%);
    max-height: attr(data-h type(<percentage>), 90%);
  }
}
main { position: relative; z-index: 1; height: 100%; overflow: auto; padding: 20px 24px 20px 110px; }
.taskbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-top: 1px solid var(--border);
}
.start { font-weight: 650; background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 7px 16px; cursor: pointer; }
.tasks { display: flex; gap: 6px; flex: 1; overflow: auto; }
.tasks button { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 8px; }
.tasks button[aria-current=true] { box-shadow: inset 0 0 0 2px var(--accent); }
.tray { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
#clock { font-variant-numeric: tabular-nums; color: var(--text); }
#top-clock, #clock { cursor: pointer; }
#top-clock:hover, #clock:hover, .clock-button:hover { text-decoration: underline; }
html[data-clock="top"] #clock { display: none; }
html[data-clock="bottom"] #top-clock { display: none; }
.start-menu {
  position: fixed; bottom: 60px; left: 12px; z-index: 20;
  width: 280px; max-height: 70vh; overflow: auto;
  border: 1px solid var(--border); border-radius: 16px;
  padding: 8px; box-shadow: var(--shadow);
}
.start-menu button { width: 100%; text-align: left; margin: 2px 0; border-radius: 8px; }
button, .ghost { font: inherit; }
.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.primary { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 7px 14px; cursor: pointer; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.text.title { font-size: 22px; font-weight: 650; letter-spacing: -0.03em; }
.text.muted { color: var(--muted); }
.card, .list, table { background: var(--raised); border: 1px solid var(--border); border-radius: 12px; }
.card { padding: 12px; }
.list { list-style: none; margin: 0; padding: 6px; }
.list button { width: 100%; text-align: left; }
.list-item { display: grid; gap: 5px; padding: 9px 10px; border-radius: 8px; color: var(--text); }
.list-item-title { font-weight: 600; }
.list-item-subtitle { color: var(--muted); font-size: 12px; }
.list-item-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge { display: inline-flex; align-items: center; width: fit-content; padding: 2px 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 11px; line-height: 1.4; }
.badge.accent, .stat.accent { color: var(--accent); }
.badge.success, .stat.success { color: var(--ok); }
.badge.warning, .stat.warning { color: var(--warn); }
.badge.danger, .stat.danger { color: var(--danger); }
.tabs { display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.tab { flex: 0 0 auto; border: 0; border-bottom: 2px solid transparent; border-radius: 7px 7px 0 0; padding: 8px 12px; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.tab:hover { background: var(--surface); color: var(--text); }
.tab.active { border-bottom-color: var(--accent); color: var(--text); }
.stat { display: grid; flex: 1 1 120px; gap: 4px; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--raised); }
.stat-label { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.stat-value { overflow-wrap: anywhere; font-size: 18px; font-weight: 650; }
.sparkline { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.sparkline-label { color: var(--muted); font-size: 12px; }
.sparkline-values { color: var(--accent); font: 16px/1.2 ui-monospace, "SF Mono", monospace; letter-spacing: 1px; }
.divider { height: 1px; border: 0; background: var(--border); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
form label { display: block; margin: 8px 0; }
input, textarea { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
#terminal {
  position: fixed; left: 6%; right: 6%; bottom: 58px; margin: 0;
  width: auto; max-height: 48vh;
  background: #0b0f16; color: #e6edf5;
  border: 1px solid #2a3344; border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0,0,0,.45); padding: 0; overflow: hidden;
}
.term-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: #121826; border-bottom: 1px solid #2a3344;
}
.term-title { font-weight: 600; letter-spacing: 0.04em; }
.term-session { color: #8aa0b8; font-size: 12px; }
.term-out {
  margin: 0; min-height: 140px; max-height: 28vh; overflow: auto;
  padding: 12px; font: 13px/1.45 ui-monospace, "SF Mono", monospace;
  white-space: pre-wrap; color: #d7e2ee;
}
.term-form {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 12px; border-top: 1px solid #2a3344; background: #10151e;
}
.term-prompt { color: #7aa2ff; font-family: ui-monospace, monospace; }
#term-line { flex: 1; background: transparent; border: 0; color: #e6edf5; font-family: ui-monospace, monospace; }
.term-menu { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid #2a3344; }
#toast { position: fixed; bottom: 70px; right: 16px; z-index: 40; }
dialog#personalize {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  width: min(900px, calc(100vw - 32px));
  max-height: min(88vh, 760px);
  overflow: auto;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0;
  box-shadow: var(--shadow);
}
dialog#personalize::backdrop { background: rgba(2, 6, 15, 0.48); backdrop-filter: blur(5px); }
#personalize-form { margin: 0; }
.personalize-heading, .personalize-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.personalize-heading {
  min-height: 82px;
  margin: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--raised);
}
.personalize-title { display: flex; align-items: center; gap: 12px; }
.personalize-title h2 { margin: 0; font-size: 21px; letter-spacing: -0.04em; }
.settings-glyph {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #3d8cff, #2163d8);
  font-size: 22px;
}
.settings-description { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.eyebrow { margin: 0 0 3px; color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: 0.14em; }
#personalize fieldset { margin: 0 0 20px; padding: 0; border: 0; }
#personalize legend { margin-bottom: 10px; font-weight: 650; }
.personalize-layout { display: grid; grid-template-columns: 184px minmax(0, 1fr); min-height: 350px; }
.personalize-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 18px 10px;
  border-right: 1px solid var(--border);
}
.personalize-nav button {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.personalize-nav button span { display: inline-block; width: 24px; color: var(--muted); }
.personalize-nav button[aria-current="page"] { background: rgba(59, 137, 255, 0.2); color: #8fc1ff; }
.personalize-content { min-width: 0; max-height: calc(88vh - 82px); overflow: auto; padding: 20px; }
.choice-grid { display: grid; gap: 10px; }
.logo-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wallpaper-choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choice-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--raised);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.choice-card:hover { transform: translateY(-2px); border-color: rgba(75, 224, 211, 0.55); }
.choice-card[aria-pressed="true"] { border-color: #54dfd1; box-shadow: 0 0 0 2px rgba(84, 223, 209, 0.22); }
.logo-choice { display: grid; justify-items: center; gap: 5px; padding: 14px 8px; }
.logo-choice img { width: 62px; height: 62px; margin-bottom: 4px; }
.choice-card span { display: block; font-weight: 620; }
.choice-card small { display: block; color: var(--muted); font-size: 11px; }
.wallpaper-choice { min-height: 105px; padding: 10px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; overflow: hidden; }
.wallpaper-choice.aurora { background: radial-gradient(at 80% 15%, #254973, transparent 56%), linear-gradient(145deg, #0b1020, #14253c); }
.wallpaper-choice.tide { background: radial-gradient(at 80% 15%, #13a4a0, transparent 54%), linear-gradient(145deg, #071426, #24538a); }
.wallpaper-choice.ember { background: radial-gradient(at 80% 15%, #d87849, transparent 54%), linear-gradient(145deg, #21152e, #74426c); }
.wallpaper-choice.custom { background: linear-gradient(135deg, #252e43, #101827 55%, #374c67); }
.wallpaper-choice span { text-shadow: 0 1px 8px rgba(0,0,0,.8); }
.wallpaper-choice small { color: rgba(255,255,255,.78); text-shadow: 0 1px 8px rgba(0,0,0,.8); }
.file-picker { display: inline-flex; margin-top: 12px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-picker:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.help { color: var(--muted); font-size: 12px; }
.personalize-error { padding: 9px 11px; border-radius: 8px; color: #ffd9df; background: rgba(243, 18, 96, 0.14); }
.personalize-actions { justify-content: flex-end; margin-top: 16px; }
@media (max-width: 560px) {
  dialog#personalize { width: calc(100vw - 20px); max-height: calc(100vh - 24px); }
  .personalize-layout { grid-template-columns: 1fr; }
  .personalize-nav { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px 10px; }
  .personalize-nav button { width: auto; }
  .personalize-nav button span { width: auto; margin-right: 5px; }
  .personalize-content { max-height: calc(88vh - 140px); padding: 14px; }
  .wallpaper-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .personalize-title h2 { font-size: 18px; }
  .settings-glyph { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

:root {
  --dock: 76px;
  --panel: 58px;
  --taskbar-height: 58px;
  --wallpaper-overlay: rgba(4, 10, 24, 0.08);
}
html, body { min-height: 100%; }
body {
  min-height: 100vh;
  grid-template-rows: var(--panel) minmax(0, 1fr) var(--taskbar-height);
  overflow: hidden;
  isolation: isolate;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--wallpaper-overlay);
  pointer-events: none;
}
.wallpaper-image { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.panel.topbar, .desktop, .taskbar { position: relative; z-index: 1; }
html[data-glass-blur="0"] { --glass-blur: 0px; }
html[data-glass-blur="4"] { --glass-blur: 4px; }
html[data-glass-blur="8"] { --glass-blur: 8px; }
html[data-glass-blur="12"] { --glass-blur: 12px; }
html[data-glass-blur="16"] { --glass-blur: 16px; }
html[data-glass-blur="20"] { --glass-blur: 20px; }
html[data-glass-blur="24"] { --glass-blur: 24px; }
.panel.topbar {
  z-index: 8;
  display: flex;
  gap: 18px;
  min-width: 0;
  padding: 0 18px;
  border: 0;
  border-bottom: 1px solid rgba(185, 211, 255, 0.16);
  background: rgba(7, 14, 30, 0.72);
  box-shadow: 0 5px 24px rgba(0, 0, 0, 0.12);
}
.panel.topbar::before { background: rgba(7, 14, 30, 0.66); }
.brand-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #eff6ff;
  cursor: pointer;
  text-align: left;
}
.brand-button img { width: 31px; height: 31px; }
.history-nav { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.history-button {
  height: 28px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(194, 215, 255, 0.28);
  background: rgba(16, 32, 62, 0.92); color: #f2f6ff; cursor: pointer; font: inherit; font-size: 12px; font-weight: 650;
}
.history-button:hover { background: rgba(60, 96, 158, 0.95); }
.history-button:disabled, .history-nav button:disabled { opacity: 0.4; cursor: default; }
.history-button:disabled:hover, .history-nav button:disabled:hover { background: rgba(16, 32, 62, 0.92); }
.brand-name { font-size: 15px; font-weight: 720; letter-spacing: 0.01em; }
.global-search {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(450px, 44vw);
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(194, 215, 255, 0.2);
  border-radius: 9px;
  background: rgba(9, 18, 38, 0.72);
  color: #a9b7d0;
  cursor: pointer;
  text-align: left;
}
.global-search > span:first-child { font-size: 20px; line-height: 1; color: #c8d7f2; }
.global-search > span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.global-search kbd { padding: 2px 5px; border: 1px solid rgba(194, 215, 255, 0.18); border-radius: 5px; color: #8796b1; font-size: 10px; }
.top-status { display: flex; align-items: center; gap: 12px; margin-left: auto; color: #c0cbe0; white-space: nowrap; }
.top-status-label { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: #b3c1d8; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #50d79a; box-shadow: 0 0 10px rgba(80, 215, 154, 0.75); }
.top-status .chip { gap: 5px; }
.top-status .chip span { padding: 2px 7px; border-color: rgba(194, 215, 255, 0.12); background: rgba(12, 24, 45, 0.64); font-size: 10px; }
.status-button {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #ccd7e9;
  cursor: pointer;
  font-size: 16px;
}
.status-button:hover { background: rgba(190, 212, 250, 0.12); }
#top-clock, #clock { font-variant-numeric: tabular-nums; }
#top-clock { min-width: 58px; color: #f2f5fc; font-size: 12px; text-align: right; }
.desktop { grid-template-columns: var(--dock) minmax(0, 1fr); min-height: 0; }
.dock {
  z-index: 5;
  align-items: stretch;
  gap: 7px;
  overflow-y: auto;
  padding: 16px 10px;
  border: 0;
  border-right: 1px solid rgba(190, 212, 250, 0.14);
  background: rgba(8, 15, 31, 0.64);
}
.dock::before { background: rgba(8, 15, 31, 0.5); }
.dock-app {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 54px !important;
  min-height: 55px;
  height: auto !important;
  padding: 5px 2px;
  border: 1px solid transparent !important;
  border-radius: 11px !important;
  background: transparent !important;
  color: #c6d0e3 !important;
  cursor: pointer;
}
.dock-app:hover { background: rgba(173, 201, 255, 0.12) !important; color: #fff !important; }
.dock-app[aria-current="page"] { background: rgba(85, 139, 255, 0.18) !important; border-color: rgba(104, 157, 255, 0.32) !important; }
.dock-glyph { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; background: linear-gradient(145deg, #5078c8, #314a7f); color: #f6f8ff; font-size: 17px; font-weight: 680; }
.dock-home .dock-glyph { padding: 5px; background: linear-gradient(145deg, #e7f4ff, #a8d5ff); }
.dock-home .dock-glyph::first-letter { color: #1768d4; }
.dock-boxes .dock-glyph { background: linear-gradient(145deg, #dfaa4f, #a36227); }
.dock-ide .dock-glyph { background: linear-gradient(145deg, #3d9fe7, #2d62c7); font-size: 12px; }
.dock-sasha .dock-glyph { background: linear-gradient(145deg, #ba83ef, #6843be); }
.dock-files .dock-glyph { background: linear-gradient(145deg, #f4c65a, #db8b2d); }
.dock-settings .dock-glyph { background: linear-gradient(145deg, #8499b9, #465875); }
.dock-store .dock-glyph { background: linear-gradient(145deg, #60c6b1, #21816d); }
.dock-label { max-width: 52px; overflow: hidden; color: #aebbd1; font-size: 9px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.workspace { overflow: hidden; isolation: isolate; }
.workspace::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse at 58% 40%, rgba(75, 133, 226, 0.2), transparent 52%);
  pointer-events: none;
}
.icons {
  top: 24px;
  left: 16px;
  z-index: 2;
  gap: 15px;
}
.icons button.desktop-app {
  width: 78px;
  min-height: 78px;
  padding: 5px 3px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #f5f7fb;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
}
.icons button.desktop-app:hover, .icons button.desktop-app:focus-visible { border-color: rgba(190, 218, 255, 0.25); background: rgba(171, 202, 255, 0.12); }
.icons .glyph {
  width: 45px;
  height: 45px;
  border: 1px solid rgba(238, 246, 255, 0.28);
  border-radius: 13px;
  background: linear-gradient(145deg, #5a8ee0, #294e91);
  box-shadow: 0 9px 22px rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  text-shadow: none;
}
.icons .glyph.boxes { background: linear-gradient(145deg, #f2bd59, #ac6629); }
.icons .glyph.ide { background: linear-gradient(145deg, #4ea6ec, #315fbb); font-size: 14px; }
.icons .glyph.sasha { background: linear-gradient(145deg, #c18df2, #7047bb); }
.icons .glyph.files { background: linear-gradient(145deg, #f6d16a, #d89035); }
.desktop-app-label { max-width: 76px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.widgets { top: 18px; right: 20px; width: 176px; gap: 8px; }
.widget { padding: 10px 12px; border: 1px solid rgba(195, 216, 255, 0.15); border-radius: 11px; background: rgba(11, 22, 43, 0.56); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14); font-size: 13px; }
.widget::before { background: rgba(11, 22, 43, 0.36); }
.widget strong { color: #a8bad8; font-size: 9px; letter-spacing: 0.09em; }
.windows { z-index: 4; }
.win {
  min-width: min(280px, 100%);
  border: 1px solid rgba(194, 215, 250, 0.3);
  border-radius: 11px;
  background: rgba(17, 26, 44, 0.96);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(7, 13, 26, 0.36);
  transition: box-shadow 130ms ease, border-color 130ms ease;
}
.win.animated {
  transition: left 160ms ease, top 160ms ease, width 160ms ease, height 160ms ease, box-shadow 130ms ease, border-color 130ms ease;
}
html.gesturing .win,
html.gesturing .win.animated,
html.reduced-motion .win,
html.reduced-motion .win.animated {
  transition: box-shadow 130ms ease, border-color 130ms ease;
}
html.reduced-motion .win,
html.reduced-motion .win.animated { transition: none; }
html.gesturing .win::before {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.win[data-state="max"] {
  left: 0.45% !important;
  top: 0.55% !important;
  width: 99.1% !important;
  height: 98.9% !important;
}
#snap-preview {
  position: absolute;
  z-index: 28;
  pointer-events: none;
  border: 2px solid rgba(140, 184, 255, 0.9);
  border-radius: 12px;
  background: rgba(91, 140, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease;
}
html.reduced-motion #snap-preview { transition: none; }
#snap-preview[data-preset="left"] { left: 0; top: 0; width: 50%; height: 100%; }
#snap-preview[data-preset="right"] { left: 50%; top: 0; width: 50%; height: 100%; }
#snap-preview[data-preset="max"] { left: 0; top: 0; width: 100%; height: 100%; }
#snap-preview[data-preset="top-left"] { left: 0; top: 0; width: 50%; height: 50%; }
#snap-preview[data-preset="top-right"] { left: 50%; top: 0; width: 50%; height: 50%; }
#snap-preview[data-preset="bottom-left"] { left: 0; top: 50%; width: 50%; height: 50%; }
#snap-preview[data-preset="bottom-right"] { left: 50%; top: 50%; width: 50%; height: 50%; }
.grip {
  position: absolute;
  z-index: 6;
  touch-action: none;
}
.grip.n, .grip.s { left: 14px; right: 14px; height: 8px; cursor: ns-resize; }
.grip.n { top: 0; }
.grip.s { bottom: 0; }
.grip.e, .grip.w { top: 14px; bottom: 14px; width: 8px; cursor: ew-resize; }
.grip.e { right: 0; }
.grip.w { left: 0; }
.grip.nw, .grip.ne, .grip.sw, .grip.se { width: 16px; height: 16px; }
.grip.nw { top: 0; left: 0; cursor: nwse-resize; }
.grip.se { right: 0; bottom: 0; cursor: nwse-resize; }
.grip.ne { top: 0; right: 0; cursor: nesw-resize; }
.grip.sw { bottom: 0; left: 0; cursor: nesw-resize; }
.win[data-state="max"] .grip { display: none; }
html.gesturing, html.gesturing * { user-select: none !important; }
html.gesturing[data-cursor="move"], html.gesturing[data-cursor="move"] * { cursor: grabbing !important; }
html.gesturing[data-cursor="ns"], html.gesturing[data-cursor="ns"] * { cursor: ns-resize !important; }
html.gesturing[data-cursor="ew"], html.gesturing[data-cursor="ew"] * { cursor: ew-resize !important; }
html.gesturing[data-cursor="nwse"], html.gesturing[data-cursor="nwse"] * { cursor: nwse-resize !important; }
html.gesturing[data-cursor="nesw"], html.gesturing[data-cursor="nesw"] * { cursor: nesw-resize !important; }
@keyframes sash-window-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.win.opening { animation: sash-window-in 180ms ease-out; }
html.reduced-motion .win.opening,
html.gesturing .win.opening { animation: none; }
@supports (left: attr(data-x type(<percentage>))) {
  .win[data-x] { left: attr(data-x type(<percentage>), 6%); }
  .win[data-y] { top: attr(data-y type(<percentage>), 8%); }
  .win[data-w] { width: attr(data-w type(<percentage>), 62%); }
  .win[data-h] { height: attr(data-h type(<percentage>), 70%); }
}
@supports not (left: attr(data-x type(<percentage>))) {
  /* percent-geometry-fallback:start */
  .win.px-0 { left: 0%; }
  .win.py-0 { top: 0%; }
  .win.pw-0 { width: 0%; }
  .win.ph-0 { height: 0%; }
  .win.px-1 { left: 1%; }
  .win.py-1 { top: 1%; }
  .win.pw-1 { width: 1%; }
  .win.ph-1 { height: 1%; }
  .win.px-2 { left: 2%; }
  .win.py-2 { top: 2%; }
  .win.pw-2 { width: 2%; }
  .win.ph-2 { height: 2%; }
  .win.px-3 { left: 3%; }
  .win.py-3 { top: 3%; }
  .win.pw-3 { width: 3%; }
  .win.ph-3 { height: 3%; }
  .win.px-4 { left: 4%; }
  .win.py-4 { top: 4%; }
  .win.pw-4 { width: 4%; }
  .win.ph-4 { height: 4%; }
  .win.px-5 { left: 5%; }
  .win.py-5 { top: 5%; }
  .win.pw-5 { width: 5%; }
  .win.ph-5 { height: 5%; }
  .win.px-6 { left: 6%; }
  .win.py-6 { top: 6%; }
  .win.pw-6 { width: 6%; }
  .win.ph-6 { height: 6%; }
  .win.px-7 { left: 7%; }
  .win.py-7 { top: 7%; }
  .win.pw-7 { width: 7%; }
  .win.ph-7 { height: 7%; }
  .win.px-8 { left: 8%; }
  .win.py-8 { top: 8%; }
  .win.pw-8 { width: 8%; }
  .win.ph-8 { height: 8%; }
  .win.px-9 { left: 9%; }
  .win.py-9 { top: 9%; }
  .win.pw-9 { width: 9%; }
  .win.ph-9 { height: 9%; }
  .win.px-10 { left: 10%; }
  .win.py-10 { top: 10%; }
  .win.pw-10 { width: 10%; }
  .win.ph-10 { height: 10%; }
  .win.px-11 { left: 11%; }
  .win.py-11 { top: 11%; }
  .win.pw-11 { width: 11%; }
  .win.ph-11 { height: 11%; }
  .win.px-12 { left: 12%; }
  .win.py-12 { top: 12%; }
  .win.pw-12 { width: 12%; }
  .win.ph-12 { height: 12%; }
  .win.px-13 { left: 13%; }
  .win.py-13 { top: 13%; }
  .win.pw-13 { width: 13%; }
  .win.ph-13 { height: 13%; }
  .win.px-14 { left: 14%; }
  .win.py-14 { top: 14%; }
  .win.pw-14 { width: 14%; }
  .win.ph-14 { height: 14%; }
  .win.px-15 { left: 15%; }
  .win.py-15 { top: 15%; }
  .win.pw-15 { width: 15%; }
  .win.ph-15 { height: 15%; }
  .win.px-16 { left: 16%; }
  .win.py-16 { top: 16%; }
  .win.pw-16 { width: 16%; }
  .win.ph-16 { height: 16%; }
  .win.px-17 { left: 17%; }
  .win.py-17 { top: 17%; }
  .win.pw-17 { width: 17%; }
  .win.ph-17 { height: 17%; }
  .win.px-18 { left: 18%; }
  .win.py-18 { top: 18%; }
  .win.pw-18 { width: 18%; }
  .win.ph-18 { height: 18%; }
  .win.px-19 { left: 19%; }
  .win.py-19 { top: 19%; }
  .win.pw-19 { width: 19%; }
  .win.ph-19 { height: 19%; }
  .win.px-20 { left: 20%; }
  .win.py-20 { top: 20%; }
  .win.pw-20 { width: 20%; }
  .win.ph-20 { height: 20%; }
  .win.px-21 { left: 21%; }
  .win.py-21 { top: 21%; }
  .win.pw-21 { width: 21%; }
  .win.ph-21 { height: 21%; }
  .win.px-22 { left: 22%; }
  .win.py-22 { top: 22%; }
  .win.pw-22 { width: 22%; }
  .win.ph-22 { height: 22%; }
  .win.px-23 { left: 23%; }
  .win.py-23 { top: 23%; }
  .win.pw-23 { width: 23%; }
  .win.ph-23 { height: 23%; }
  .win.px-24 { left: 24%; }
  .win.py-24 { top: 24%; }
  .win.pw-24 { width: 24%; }
  .win.ph-24 { height: 24%; }
  .win.px-25 { left: 25%; }
  .win.py-25 { top: 25%; }
  .win.pw-25 { width: 25%; }
  .win.ph-25 { height: 25%; }
  .win.px-26 { left: 26%; }
  .win.py-26 { top: 26%; }
  .win.pw-26 { width: 26%; }
  .win.ph-26 { height: 26%; }
  .win.px-27 { left: 27%; }
  .win.py-27 { top: 27%; }
  .win.pw-27 { width: 27%; }
  .win.ph-27 { height: 27%; }
  .win.px-28 { left: 28%; }
  .win.py-28 { top: 28%; }
  .win.pw-28 { width: 28%; }
  .win.ph-28 { height: 28%; }
  .win.px-29 { left: 29%; }
  .win.py-29 { top: 29%; }
  .win.pw-29 { width: 29%; }
  .win.ph-29 { height: 29%; }
  .win.px-30 { left: 30%; }
  .win.py-30 { top: 30%; }
  .win.pw-30 { width: 30%; }
  .win.ph-30 { height: 30%; }
  .win.px-31 { left: 31%; }
  .win.py-31 { top: 31%; }
  .win.pw-31 { width: 31%; }
  .win.ph-31 { height: 31%; }
  .win.px-32 { left: 32%; }
  .win.py-32 { top: 32%; }
  .win.pw-32 { width: 32%; }
  .win.ph-32 { height: 32%; }
  .win.px-33 { left: 33%; }
  .win.py-33 { top: 33%; }
  .win.pw-33 { width: 33%; }
  .win.ph-33 { height: 33%; }
  .win.px-34 { left: 34%; }
  .win.py-34 { top: 34%; }
  .win.pw-34 { width: 34%; }
  .win.ph-34 { height: 34%; }
  .win.px-35 { left: 35%; }
  .win.py-35 { top: 35%; }
  .win.pw-35 { width: 35%; }
  .win.ph-35 { height: 35%; }
  .win.px-36 { left: 36%; }
  .win.py-36 { top: 36%; }
  .win.pw-36 { width: 36%; }
  .win.ph-36 { height: 36%; }
  .win.px-37 { left: 37%; }
  .win.py-37 { top: 37%; }
  .win.pw-37 { width: 37%; }
  .win.ph-37 { height: 37%; }
  .win.px-38 { left: 38%; }
  .win.py-38 { top: 38%; }
  .win.pw-38 { width: 38%; }
  .win.ph-38 { height: 38%; }
  .win.px-39 { left: 39%; }
  .win.py-39 { top: 39%; }
  .win.pw-39 { width: 39%; }
  .win.ph-39 { height: 39%; }
  .win.px-40 { left: 40%; }
  .win.py-40 { top: 40%; }
  .win.pw-40 { width: 40%; }
  .win.ph-40 { height: 40%; }
  .win.px-41 { left: 41%; }
  .win.py-41 { top: 41%; }
  .win.pw-41 { width: 41%; }
  .win.ph-41 { height: 41%; }
  .win.px-42 { left: 42%; }
  .win.py-42 { top: 42%; }
  .win.pw-42 { width: 42%; }
  .win.ph-42 { height: 42%; }
  .win.px-43 { left: 43%; }
  .win.py-43 { top: 43%; }
  .win.pw-43 { width: 43%; }
  .win.ph-43 { height: 43%; }
  .win.px-44 { left: 44%; }
  .win.py-44 { top: 44%; }
  .win.pw-44 { width: 44%; }
  .win.ph-44 { height: 44%; }
  .win.px-45 { left: 45%; }
  .win.py-45 { top: 45%; }
  .win.pw-45 { width: 45%; }
  .win.ph-45 { height: 45%; }
  .win.px-46 { left: 46%; }
  .win.py-46 { top: 46%; }
  .win.pw-46 { width: 46%; }
  .win.ph-46 { height: 46%; }
  .win.px-47 { left: 47%; }
  .win.py-47 { top: 47%; }
  .win.pw-47 { width: 47%; }
  .win.ph-47 { height: 47%; }
  .win.px-48 { left: 48%; }
  .win.py-48 { top: 48%; }
  .win.pw-48 { width: 48%; }
  .win.ph-48 { height: 48%; }
  .win.px-49 { left: 49%; }
  .win.py-49 { top: 49%; }
  .win.pw-49 { width: 49%; }
  .win.ph-49 { height: 49%; }
  .win.px-50 { left: 50%; }
  .win.py-50 { top: 50%; }
  .win.pw-50 { width: 50%; }
  .win.ph-50 { height: 50%; }
  .win.px-51 { left: 51%; }
  .win.py-51 { top: 51%; }
  .win.pw-51 { width: 51%; }
  .win.ph-51 { height: 51%; }
  .win.px-52 { left: 52%; }
  .win.py-52 { top: 52%; }
  .win.pw-52 { width: 52%; }
  .win.ph-52 { height: 52%; }
  .win.px-53 { left: 53%; }
  .win.py-53 { top: 53%; }
  .win.pw-53 { width: 53%; }
  .win.ph-53 { height: 53%; }
  .win.px-54 { left: 54%; }
  .win.py-54 { top: 54%; }
  .win.pw-54 { width: 54%; }
  .win.ph-54 { height: 54%; }
  .win.px-55 { left: 55%; }
  .win.py-55 { top: 55%; }
  .win.pw-55 { width: 55%; }
  .win.ph-55 { height: 55%; }
  .win.px-56 { left: 56%; }
  .win.py-56 { top: 56%; }
  .win.pw-56 { width: 56%; }
  .win.ph-56 { height: 56%; }
  .win.px-57 { left: 57%; }
  .win.py-57 { top: 57%; }
  .win.pw-57 { width: 57%; }
  .win.ph-57 { height: 57%; }
  .win.px-58 { left: 58%; }
  .win.py-58 { top: 58%; }
  .win.pw-58 { width: 58%; }
  .win.ph-58 { height: 58%; }
  .win.px-59 { left: 59%; }
  .win.py-59 { top: 59%; }
  .win.pw-59 { width: 59%; }
  .win.ph-59 { height: 59%; }
  .win.px-60 { left: 60%; }
  .win.py-60 { top: 60%; }
  .win.pw-60 { width: 60%; }
  .win.ph-60 { height: 60%; }
  .win.px-61 { left: 61%; }
  .win.py-61 { top: 61%; }
  .win.pw-61 { width: 61%; }
  .win.ph-61 { height: 61%; }
  .win.px-62 { left: 62%; }
  .win.py-62 { top: 62%; }
  .win.pw-62 { width: 62%; }
  .win.ph-62 { height: 62%; }
  .win.px-63 { left: 63%; }
  .win.py-63 { top: 63%; }
  .win.pw-63 { width: 63%; }
  .win.ph-63 { height: 63%; }
  .win.px-64 { left: 64%; }
  .win.py-64 { top: 64%; }
  .win.pw-64 { width: 64%; }
  .win.ph-64 { height: 64%; }
  .win.px-65 { left: 65%; }
  .win.py-65 { top: 65%; }
  .win.pw-65 { width: 65%; }
  .win.ph-65 { height: 65%; }
  .win.px-66 { left: 66%; }
  .win.py-66 { top: 66%; }
  .win.pw-66 { width: 66%; }
  .win.ph-66 { height: 66%; }
  .win.px-67 { left: 67%; }
  .win.py-67 { top: 67%; }
  .win.pw-67 { width: 67%; }
  .win.ph-67 { height: 67%; }
  .win.px-68 { left: 68%; }
  .win.py-68 { top: 68%; }
  .win.pw-68 { width: 68%; }
  .win.ph-68 { height: 68%; }
  .win.px-69 { left: 69%; }
  .win.py-69 { top: 69%; }
  .win.pw-69 { width: 69%; }
  .win.ph-69 { height: 69%; }
  .win.px-70 { left: 70%; }
  .win.py-70 { top: 70%; }
  .win.pw-70 { width: 70%; }
  .win.ph-70 { height: 70%; }
  .win.px-71 { left: 71%; }
  .win.py-71 { top: 71%; }
  .win.pw-71 { width: 71%; }
  .win.ph-71 { height: 71%; }
  .win.px-72 { left: 72%; }
  .win.py-72 { top: 72%; }
  .win.pw-72 { width: 72%; }
  .win.ph-72 { height: 72%; }
  .win.px-73 { left: 73%; }
  .win.py-73 { top: 73%; }
  .win.pw-73 { width: 73%; }
  .win.ph-73 { height: 73%; }
  .win.px-74 { left: 74%; }
  .win.py-74 { top: 74%; }
  .win.pw-74 { width: 74%; }
  .win.ph-74 { height: 74%; }
  .win.px-75 { left: 75%; }
  .win.py-75 { top: 75%; }
  .win.pw-75 { width: 75%; }
  .win.ph-75 { height: 75%; }
  .win.px-76 { left: 76%; }
  .win.py-76 { top: 76%; }
  .win.pw-76 { width: 76%; }
  .win.ph-76 { height: 76%; }
  .win.px-77 { left: 77%; }
  .win.py-77 { top: 77%; }
  .win.pw-77 { width: 77%; }
  .win.ph-77 { height: 77%; }
  .win.px-78 { left: 78%; }
  .win.py-78 { top: 78%; }
  .win.pw-78 { width: 78%; }
  .win.ph-78 { height: 78%; }
  .win.px-79 { left: 79%; }
  .win.py-79 { top: 79%; }
  .win.pw-79 { width: 79%; }
  .win.ph-79 { height: 79%; }
  .win.px-80 { left: 80%; }
  .win.py-80 { top: 80%; }
  .win.pw-80 { width: 80%; }
  .win.ph-80 { height: 80%; }
  .win.px-81 { left: 81%; }
  .win.py-81 { top: 81%; }
  .win.pw-81 { width: 81%; }
  .win.ph-81 { height: 81%; }
  .win.px-82 { left: 82%; }
  .win.py-82 { top: 82%; }
  .win.pw-82 { width: 82%; }
  .win.ph-82 { height: 82%; }
  .win.px-83 { left: 83%; }
  .win.py-83 { top: 83%; }
  .win.pw-83 { width: 83%; }
  .win.ph-83 { height: 83%; }
  .win.px-84 { left: 84%; }
  .win.py-84 { top: 84%; }
  .win.pw-84 { width: 84%; }
  .win.ph-84 { height: 84%; }
  .win.px-85 { left: 85%; }
  .win.py-85 { top: 85%; }
  .win.pw-85 { width: 85%; }
  .win.ph-85 { height: 85%; }
  .win.px-86 { left: 86%; }
  .win.py-86 { top: 86%; }
  .win.pw-86 { width: 86%; }
  .win.ph-86 { height: 86%; }
  .win.px-87 { left: 87%; }
  .win.py-87 { top: 87%; }
  .win.pw-87 { width: 87%; }
  .win.ph-87 { height: 87%; }
  .win.px-88 { left: 88%; }
  .win.py-88 { top: 88%; }
  .win.pw-88 { width: 88%; }
  .win.ph-88 { height: 88%; }
  .win.px-89 { left: 89%; }
  .win.py-89 { top: 89%; }
  .win.pw-89 { width: 89%; }
  .win.ph-89 { height: 89%; }
  .win.px-90 { left: 90%; }
  .win.py-90 { top: 90%; }
  .win.pw-90 { width: 90%; }
  .win.ph-90 { height: 90%; }
  .win.px-91 { left: 91%; }
  .win.py-91 { top: 91%; }
  .win.pw-91 { width: 91%; }
  .win.ph-91 { height: 91%; }
  .win.px-92 { left: 92%; }
  .win.py-92 { top: 92%; }
  .win.pw-92 { width: 92%; }
  .win.ph-92 { height: 92%; }
  .win.px-93 { left: 93%; }
  .win.py-93 { top: 93%; }
  .win.pw-93 { width: 93%; }
  .win.ph-93 { height: 93%; }
  .win.px-94 { left: 94%; }
  .win.py-94 { top: 94%; }
  .win.pw-94 { width: 94%; }
  .win.ph-94 { height: 94%; }
  .win.px-95 { left: 95%; }
  .win.py-95 { top: 95%; }
  .win.pw-95 { width: 95%; }
  .win.ph-95 { height: 95%; }
  .win.px-96 { left: 96%; }
  .win.py-96 { top: 96%; }
  .win.pw-96 { width: 96%; }
  .win.ph-96 { height: 96%; }
  .win.px-97 { left: 97%; }
  .win.py-97 { top: 97%; }
  .win.pw-97 { width: 97%; }
  .win.ph-97 { height: 97%; }
  .win.px-98 { left: 98%; }
  .win.py-98 { top: 98%; }
  .win.pw-98 { width: 98%; }
  .win.ph-98 { height: 98%; }
  .win.px-99 { left: 99%; }
  .win.py-99 { top: 99%; }
  .win.pw-99 { width: 99%; }
  .win.ph-99 { height: 99%; }
  .win.px-100 { left: 100%; }
  .win.py-100 { top: 100%; }
  .win.pw-100 { width: 100%; }
  .win.ph-100 { height: 100%; }
  /* percent-geometry-fallback:end */
}
.win[data-order="0"] { z-index: 3; }
.win[data-order="1"] { z-index: 4; }
.win[data-order="2"] { z-index: 5; }
.win[data-order="3"] { z-index: 6; }
.win[data-order="4"] { z-index: 7; }
.win[data-order="5"] { z-index: 8; }
.win[data-order="6"] { z-index: 9; }
.win[data-order="7"] { z-index: 10; }
.win[data-order="8"] { z-index: 11; }
.win[data-order="9"] { z-index: 12; }
.win[data-order="10"] { z-index: 13; }
.win[data-order="11"] { z-index: 14; }
.win[data-order="12"] { z-index: 15; }
.win[data-order="13"] { z-index: 16; }
.win[data-order="14"] { z-index: 17; }
.win[data-order="15"] { z-index: 18; }
.win.focused { z-index: 40 !important; }
.win.focused { border-color: rgba(153, 195, 255, 0.64); box-shadow: 0 24px 68px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(111, 162, 245, 0.24); }
.win::before {
  background: rgba(17, 26, 44, 0.94);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.win > header.drag {
  min-height: 42px;
  gap: 6px;
  padding: 5px 8px;
  border-bottom: 1px solid rgba(193, 215, 255, 0.15);
  background: #151f32;
  color: #e6edf9;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.win > header strong { padding-left: 3px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.window-app-icon { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 7px; background: #345b9b; color: white; font-size: 13px; }
.window-app-icon.files { background: #bd812d; }
.window-app-icon.ide { background: #347dc4; font-size: 10px; }
.window-app-icon.sasha { background: #8054bd; }
.window-control {
  display: grid;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #bcc9dc;
  cursor: pointer;
}
.window-control:hover { background: rgba(192, 214, 250, 0.14); color: #fff; }
.window-control.close:hover { background: #c74352; }
.win .body { padding: 18px; color: #dce5f4; min-height: 0; min-width: 0; }
.win .body img, .win .body svg, .win .body canvas, .win .body video { max-width: 100%; height: auto; }
.win .body table, .win .body pre, .win .body .code { max-width: 100%; }
.win .body pre, .win .body .code { overflow: auto; }
.win.lifting { box-shadow: 0 28px 80px rgba(0, 0, 0, 0.52), 0 0 0 1px rgba(111, 162, 245, 0.28); }
/* SashOS Device (A4): a desktop window outside #windows, so Sash window state does not manage it. */
.win.device-win { position: fixed; left: 40px; top: 56px; width: 414px; height: 908px; min-width: 0; min-height: 0; z-index: 45; display: flex; flex-direction: column; overflow: hidden; }
.win.device-win > header.drag { flex: 0 0 auto; min-height: 44px; }
.win.device-win .device-text { width: auto; min-width: 44px; padding: 0 8px; font-size: 12px; }
.win.device-win .device-text[aria-pressed="true"] { background: rgba(111, 162, 245, 0.28); }
.win.device-win .device-stage { position: relative; flex: 0 0 auto; margin: 12px auto; overflow: hidden; border-radius: 22px; background: #05080f; box-shadow: 0 0 0 1px rgba(183, 206, 245, 0.18); }
.win.device-win .device-frame { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.win.device-win .device-screen { display: block; width: 100%; height: 100%; border: 0; background: #05080f; }
.win.device-win .device-grip { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 50%, rgba(183, 206, 245, 0.45) 50%); }
.win.device-win > header.drag:focus-visible, .win.device-win .device-grip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.win .body > .stack { max-width: 100%; }
.win .body .text.title { margin: 0 0 5px; color: #eff4fd; font-size: 22px; }
.win .body .text.muted, .win .body .muted { color: #9cabc3; }
.win .body .card { padding: 14px; border: 1px solid rgba(195, 215, 250, 0.12); border-radius: 10px; background: rgba(29, 42, 65, 0.65); }
.win .body .card::before, .win .body .list::before { background: transparent; }
.win .body label { display: grid; gap: 5px; color: #b8c5da; }
.win .body input, .win .body textarea, .win .body select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(183, 206, 245, 0.2);
  border-radius: 7px;
  background: #0e1729;
  color: #edf3fc;
}
.win .body .primary, .win .body button.primary { min-height: 34px; padding: 7px 12px; border-radius: 7px; }
.win .body .ghost { padding: 7px 10px; border: 1px solid rgba(183, 206, 245, 0.14); border-radius: 7px; background: rgba(26, 39, 61, 0.8); color: #dce7f8; cursor: pointer; }
.win .body .list { padding: 0; list-style: none; }
.win .body .list li { margin: 5px 0; }
.win .body table { width: 100%; border-collapse: collapse; }
.win .body th, .win .body td { padding: 7px; border-bottom: 1px solid rgba(183, 206, 245, 0.12); text-align: left; }
.win .body th { color: #a9bad4; font-size: 11px; }
.settings-personalize { margin-bottom: 12px; }
.resize { border-color: rgba(190, 209, 237, 0.5); }
main { display: block; padding: 18px 20px 18px 110px; }
.workspace[data-route="home"] > main { display: none; }
.taskbar {
  z-index: 7;
  gap: 12px;
  min-width: 0;
  padding: 7px 14px;
  border: 0;
  border-top: 1px solid rgba(190, 212, 250, 0.16);
  background: rgba(7, 14, 30, 0.8);
}
.taskbar::before { background: rgba(7, 14, 30, 0.66); }
.start {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 5px;
  border: 1px solid rgba(174, 208, 255, 0.3);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(42, 101, 184, 0.9), rgba(23, 54, 105, 0.9));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.start img { width: 30px; height: 30px; }
.tasks { gap: 7px; align-items: center; }
.task-app {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 190px;
  min-width: 44px;
  height: 40px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(37, 53, 78, 0.5);
  color: #c7d3e7;
  cursor: pointer;
}
.task-app:hover, .task-app.active { border-color: rgba(139, 180, 246, 0.27); background: rgba(77, 111, 165, 0.25); color: #fff; }
.task-glyph { color: #91b8f2; font-size: 15px; }
.task-label { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.tray { gap: 9px; color: #bac7dc; }
.tray-separator { height: 26px; border-left: 1px solid rgba(192, 214, 250, 0.18); }
#notes { color: #93a3bd; font-size: 10px; background: none; border: 0; padding: 2px 4px; font-family: inherit; border-radius: 6px; cursor: pointer; }
#notes[aria-expanded="true"], #notes:focus-visible { color: #eef2f8; }
#notes:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#clock { min-width: 55px; color: #eff4fc; font-size: 11px; text-align: right; }
.start-menu {
  z-index: 20;
  bottom: calc(var(--taskbar-height) + 8px);
  left: 12px;
  width: min(310px, calc(100vw - 24px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 9px;
  border: 1px solid rgba(190, 212, 250, 0.24);
  border-radius: 13px;
  background: rgba(14, 23, 40, 0.96);
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.46);
}
.start-menu::before { background: rgba(14, 23, 40, 0.92); }
.palette-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: #eaf1fc; }
dialog#name-prompt {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 16px;
}
dialog#name-prompt::backdrop { background: rgba(2, 6, 15, 0.56); }
dialog#name-prompt input, dialog#name-prompt textarea {
  width: 100%;
  margin: 8px 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
dialog#name-prompt textarea { min-height: 88px; }
dialog#palette {
  position: fixed;
  top: 10vh;
  width: min(560px, calc(100vw - 24px));
  max-height: 75vh;
  margin: 0 auto;
  padding: 16px;
  border: 1px solid rgba(190, 212, 250, 0.25);
  border-radius: 13px;
  background: #101a2d;
  color: var(--text);
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.48);
}
dialog#palette::backdrop { background: rgba(2, 6, 15, 0.56); backdrop-filter: blur(5px); }
dialog#palette::before { background: #101a2d; }
#palette-input { width: 100%; padding: 10px 12px; border: 1px solid rgba(183, 206, 245, 0.22); border-radius: 8px; background: #0b1425; color: #eff5ff; }
#palette-list { max-height: 56vh; overflow: auto; padding: 0; list-style: none; }
#palette-list li { margin: 5px 0; }
#palette-list button { width: 100%; text-align: left; }
.start-app {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e0e8f6;
  cursor: pointer;
  text-align: left;
}
.start-app:hover { background: rgba(122, 163, 231, 0.16); }
.start-glyph { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 8px; background: #385b8f; color: #fff; font-size: 14px; }
.start-glyph.files { background: #ba812f; }
.start-glyph.ide { background: #357bc0; }
.start-glyph.sasha { background: #8052be; }
.start-glyph.settings { background: #596b86; }
.start-glyph.store { background: #308e7b; }
.start-glyph.boxes { background: #a9652d; }
.start-glyph.launcher { background: #426caa; }
@media (max-width: 760px) {
  :root { --dock: 58px; --panel: 54px; --taskbar-height: 54px; }
  .panel.topbar { gap: 9px; padding: 0 10px; }
  .brand-button { min-width: 38px; }
  .brand-name, .top-status-label, .top-status .chip { display: none; }
  .global-search { width: min(350px, 47vw); gap: 7px; padding: 0 8px; }
  .global-search kbd { display: none; }
  .top-status { gap: 5px; }
  .dock { padding: 12px 4px; }
  .dock-app { width: 48px !important; min-height: 49px; }
  .dock-label { display: none; }
  .widgets { display: none; }
  .icons { top: 12px; left: 4px; gap: 6px; }
  .icons button.desktop-app { width: 60px; min-height: 62px; }
  .icons .glyph { width: 36px; height: 36px; border-radius: 10px; }
  .desktop-app-label { max-width: 58px; font-size: 9px; }
  .win { min-width: min(270px, 100%); max-width: 100%; }
  .win > header.drag { gap: 3px; padding: 4px; }
  .window-control { width: 23px; height: 25px; }
  .win .body { padding: 12px; }
  .tray { gap: 6px; }
  #notes, .tray-separator, .tray > span[aria-label="System status"] { display: none; }
  .task-app { max-width: 48px; padding: 0 9px; }
  .task-label { display: none; }
}
.explorer { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.explorer-nav {
  display: flex; align-items: center; gap: 6px; flex: 1 1 100%; min-width: 0;
  padding: 4px; border: 1px solid rgba(195, 215, 250, 0.16); border-radius: 10px;
  background: rgba(8, 16, 32, 0.45);
}
.explorer-nav > button { flex: 0 0 auto; min-width: 64px; height: 28px; padding: 0 10px; font-size: 12px; font-weight: 650; }
.explorer-nav > button:disabled { opacity: 0.4; cursor: default; }
.explorer-address {
  display: flex; flex: 1 1 auto; align-items: center; gap: 4px; min-width: 0; overflow: auto;
  padding: 2px 6px; border-radius: 8px; background: rgba(6, 12, 24, 0.55);
}
.explorer-crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 0; }
.clipboard-buffer { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.explorer-sep { color: #8ea0bb; }
.explorer-crumb, .explorer-up {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d5e2f6;
  cursor: pointer;
}
.explorer-crumb { padding: 2px 4px; }
.explorer-crumb.current { color: #f4f7fd; font-weight: 600; }
.explorer-crumb:hover { background: rgba(122, 163, 231, 0.16); }
.explorer-location { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explorer-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.explorer-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.win .body .explorer-form input { width: 9.5rem; min-width: 0; }
.explorer-list { display: flex; flex-direction: column; min-width: 0; border: 1px solid rgba(195, 215, 250, 0.12); border-radius: 10px; overflow: hidden; }
.explorer-head, .explorer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 64px 128px 72px;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
}
.explorer-head { color: #8ea0bb; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; background: rgba(14, 23, 40, 0.45); }
.explorer-row + .explorer-row { border-top: 1px solid rgba(195, 215, 250, 0.08); }
.explorer-row:hover { background: rgba(122, 163, 231, 0.08); }
.explorer-name {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #e7eefb;
  cursor: pointer;
  text-align: left;
}
.explorer-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explorer-name:hover span:last-child { text-decoration: underline; }
.explorer-glyph { width: 1rem; color: #8eb4ef; text-align: center; }
.explorer-glyph.dir { color: #e2b15a; }
.explorer-kind, .explorer-size, .explorer-modified { color: #9cabc3; font-size: 12px; }
.explorer-modified { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explorer-trash { padding: 4px 8px; }
.explorer-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.explorer-actions strong { margin-right: auto; }
.explorer-preview { max-height: 360px; margin: 0; white-space: pre-wrap; }
.explorer-empty, .explorer-note { margin: 0; }
.agent { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.9fr); gap: 16px; min-width: 0; }
.agent-chat, .agent-canvas { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.agent-note, .agent-empty { margin: 0; }
.agent-log { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.agent-turn { border: 1px solid rgba(195, 215, 250, 0.12); border-radius: 10px; padding: 8px 10px; }
.agent-turn.you { background: rgba(122, 163, 231, 0.08); }
.agent-role { display: block; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: #8ea0bb; }
.agent-turn p { margin: 4px 0 0; white-space: pre-wrap; }
.agent-form { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 0; }
.win .body .agent-form input, .win .body .agent-form textarea { width: 100%; min-width: 0; }
.agent-form textarea { min-height: 72px; }
.agent-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.agent-card { border: 1px solid rgba(195, 215, 250, 0.12); border-radius: 10px; padding: 8px 10px; }
.agent-card h3 { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: #a8bad8; }
.agent-card p { margin: 0 0 6px; }
.agent-steps, .agent-hits, .agent-skills, .agent-models { margin: 0; padding-left: 18px; }
.calendar { display: flex; flex-direction: column; gap: 12px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar-dow, .calendar-day { text-align: center; padding: 8px 0; border-radius: 8px; }
.calendar-dow { color: #8ea0bb; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.calendar-day.today { background: rgba(122, 163, 231, 0.28); font-weight: 600; }
.calendar-day.empty { visibility: hidden; }
button.calendar-day { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; width: 100%; }
.calendar-day.selected { outline: 1px solid rgba(142, 180, 239, 0.9); }
.calendar-day.has-event { box-shadow: inset 0 -2px 0 #8eb4ef; }
.calendar-events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.calendar-events li { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.calendar-nav, .clock-placement { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.clock-placement .active { outline: 1px solid rgba(142, 180, 239, 0.9); }
.live-clock { font-variant-numeric: tabular-nums; font-size: 18px; }
.win .body:has(.console) { display: flex; flex-direction: column; }
.console { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
.term-tabs, .term-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.term-tab, .term-tools button { border-radius: 8px; }
.term-tab.active { outline: 1px solid rgba(142, 180, 239, 0.9); }
.term-tab.pinned { font-weight: 650; }
.term-stack { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
.term-scroll, .term-activity {
  min-height: 180px;
  max-height: min(52vh, 560px);
  overflow: auto;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(195, 215, 250, 0.12);
  border-radius: 10px;
  background: rgba(7, 12, 22, 0.45);
}
.term-cmd { white-space: pre-wrap; }
.term-prompt { color: #8eb4ef; }
.term-stdout { margin: 2px 0 8px; white-space: pre-wrap; }
.term-stdout.fail, .term-ev.error { color: #ffb4b4; }
.term-ev.debug { color: #d6c27a; }
.term-ev.info { color: #d5e2f6; }
.term-empty, .term-note { margin: 0; color: #9cabc3; }
.term-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.win .body .term-form input { flex: 1; width: auto; min-width: 0; }
@media (max-width: 760px) {
  .agent { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .global-search { width: 36vw; }
  .global-search > span:nth-child(2) { font-size: 10px; }
  .top-status { gap: 2px; }
  #clock { min-width: 46px; font-size: 10px; }
  .icons { display: none; }
}


/* ---- Adaptive shell. lib/adaptive.sash picks the form and app.js sets html[data-*]
   (size-class, nav, chrome, windowing, input, form, focus) and --touch, --kb and
   --host-inset-*. These rules only paint that form; they decide nothing. ---- */
:root { --touch: 32px; --kb: 0px; --host-inset-top: 0px; --host-inset-right: 0px; --host-inset-bottom: 0px; --host-inset-left: 0px; }
#safe-area-probe {
  position: fixed; inset: 0 auto auto 0; width: 0; height: 0; visibility: hidden; pointer-events: none;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.appbar, .bottom-nav { display: none; }
.pull-indicator {
  --pull: 0px;
  position: fixed; z-index: 40; left: 50%; top: calc(var(--host-inset-top) + 8px);
  width: 36px; height: 36px; margin-left: -18px; border-radius: 50%;
  display: grid; place-items: center; color: var(--accent); background: var(--raised); box-shadow: var(--shadow);
  opacity: calc(var(--pull) / 90px); transform: translateY(calc(var(--pull) * 0.6)) rotate(calc(var(--pull) * 3deg));
  pointer-events: none;
}
html:not([data-windowing="single"]) .pull-indicator { display: none; }

html[data-windowing="single"] body {
  height: 100vh; height: 100dvh; overflow: hidden;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "bar" "main" "nav";
  touch-action: manipulation;
}
html[data-windowing="single"] .topbar,
html[data-windowing="single"] .taskbar,
html[data-windowing="single"] .dock,
html[data-windowing="single"] #icons,
html[data-windowing="single"] #widgets,
html[data-windowing="single"] #windows { display: none !important; }
html[data-windowing="single"] .desktop { grid-area: main; display: block; min-height: 0; }
html[data-windowing="single"] .workspace { height: 100%; }
html[data-windowing="single"] .workspace::before { content: none; }
html[data-windowing="single"] .workspace > main,
html[data-windowing="single"] .workspace[data-route="home"] > main {
  display: block; height: 100%; overflow: auto; overscroll-behavior-y: contain;
  padding: 16px calc(16px + var(--host-inset-right)) 24px calc(16px + var(--host-inset-left));
}
html[data-windowing="single"] .appbar {
  grid-area: bar; z-index: 30;
  display: flex; align-items: center; gap: 4px;
  min-height: calc(56px + var(--host-inset-top));
  padding: var(--host-inset-top) calc(4px + var(--host-inset-right)) 0 calc(4px + var(--host-inset-left));
  background: var(--surface); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.appbar-title { flex: 1; min-width: 0; margin: 0 8px; font-size: 20px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#appbar-back[hidden] + .appbar-title { margin-left: 12px; }
.appbar-button {
  width: max(var(--touch), 48px); height: max(var(--touch), 48px); flex: none;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--text); font-size: 22px;
}
.appbar-button[hidden] { display: none; }
.appbar-button:active { background: var(--raised); }

/* Navigation bar (compact) */
html[data-windowing="single"][data-nav="bar"] .bottom-nav {
  grid-area: nav; z-index: 30;
  display: flex; justify-content: space-around; align-items: stretch;
  padding: 4px calc(4px + var(--host-inset-right)) calc(4px + var(--host-inset-bottom)) calc(4px + var(--host-inset-left));
  background: var(--surface); border-top: 1px solid var(--border);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.nav-dest {
  flex: 1 1 0; min-width: 0; min-height: max(var(--touch), 56px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 4px 2px; border: 0; border-radius: 16px; background: transparent; color: var(--muted);
}
.nav-glyph { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 15px; font-size: 18px; line-height: 1; }
.nav-label { max-width: 100%; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-dest[aria-current="page"] { color: var(--text); }
.nav-dest[aria-current="page"] .nav-glyph { background: rgba(91, 140, 255, 0.28); }
.nav-dest:active .nav-glyph { background: var(--raised); }
html.keyboard-open .bottom-nav { display: none !important; }

/* Navigation rail (medium, landscape phones, TV) */
html[data-windowing="single"][data-nav="rail"] body {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "rail bar" "rail main";
}
html[data-windowing="single"][data-nav="rail"] .bottom-nav {
  grid-area: rail; z-index: 30;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  width: calc(88px + var(--host-inset-left));
  padding: var(--host-inset-top) 4px var(--host-inset-bottom) calc(4px + var(--host-inset-left));
  background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto;
}
html[data-windowing="single"][data-nav="rail"] .nav-dest { flex: none; }
html[data-windowing="single"][data-nav="rail"] .appbar { padding-left: 8px; }
html[data-windowing="single"][data-nav="rail"] .workspace > main { padding-left: 24px; }

/* App drawer: the start menu as a bottom sheet */
html[data-windowing="single"] .start-menu {
  position: fixed; z-index: 50; inset: auto 0 0 0; width: auto; max-height: 75dvh;
  margin: 0 var(--host-inset-right) 0 var(--host-inset-left);
  padding: 20px 12px calc(16px + var(--host-inset-bottom));
  display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 4px;
  border-radius: 28px 28px 0 0; border: 0; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-2); box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.4);
  animation: sheet-up 180ms ease-out;
}
html[data-windowing="single"] .start-menu[hidden] { display: none; }
html[data-windowing="single"] .start-menu::after {
  content: ""; position: absolute; top: 8px; left: 50%; width: 32px; height: 4px; margin-left: -16px; border-radius: 2px; background: var(--muted); opacity: .5;
}
html[data-windowing="single"] .start-menu button {
  min-height: 88px; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
}
@keyframes sheet-up { from { transform: translateY(40%); opacity: 0; } to { transform: none; opacity: 1; } }

/* Menus and dialogs fit small screens */
html[data-size-class="compact"] dialog { max-width: calc(100vw - 16px); max-height: calc(100dvh - var(--host-inset-top) - var(--host-inset-bottom) - 16px); }
html[data-size-class="compact"] dialog#terminal { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; border-radius: 0; padding-top: var(--host-inset-top); padding-bottom: var(--host-inset-bottom); }
html[data-input="touch"] .menu button, html[data-input="pen"] .menu button { min-height: var(--touch); padding-inline: 16px; }

/* Touch targets and touch input */
html[data-input="touch"] main button, html[data-input="touch"] main select,
html[data-input="touch"] main input:not([type="checkbox"]):not([type="radio"]),
html[data-input="touch"] main a, html[data-input="touch"] dialog button,
html[data-input="pen"] main button, html[data-input="pen"] dialog button { min-height: var(--touch); }
html[data-input="hybrid"] main button, html[data-input="hybrid"] main select,
html[data-input="hybrid"] main input:not([type="checkbox"]):not([type="radio"]),
html[data-input="hybrid"] main a, html[data-input="hybrid"] dialog button { min-height: var(--touch); }
html[data-input="hybrid"] .menu button { min-height: var(--touch); padding-inline: 16px; }
html[data-input="touch"] main input, html[data-input="touch"] main textarea, html[data-input="touch"] main select { font-size: 16px; }
html[data-input="touch"] * { -webkit-tap-highlight-color: transparent; }
html[data-input="touch"] main table { display: block; overflow-x: auto; }
html[data-windowing="single"] main img, html[data-windowing="single"] main pre { max-width: 100%; }
html[data-windowing="single"] main pre { overflow-x: auto; }

/* Directional focus (TV remote, keyboard only): a clear, large focus ring */
html[data-focus="directional"] :focus-visible, html[data-focus="linear"] :focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px;
}
@media (hover: hover) and (pointer: fine) { .nav-dest:hover .nav-glyph { background: var(--raised); } }
@media (prefers-reduced-motion: reduce) { html[data-windowing="single"] .start-menu { animation: none; } }

/* Scrim behind the drawer; toasts sit above the navigation bar */
html[data-windowing="single"] .start-menu:not([hidden]) { box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45); }
html[data-windowing="single"] #toast { left: 16px; right: 16px; bottom: calc(88px + var(--host-inset-bottom)); text-align: center; }
html[data-windowing="single"] #toast:not(.show) { display: none; }

/* Apps fit their own width (container queries), not the screen: the same rules hold in a
   phone, a split pane or a narrow desktop window. */
html[data-windowing="single"] main, .win .body { container-type: inline-size; container-name: app; }
@container app (max-width: 560px) {
  .explorer-head, .explorer-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .explorer-head > :nth-child(3), .explorer-head > :nth-child(4),
  .explorer-row > :nth-child(3), .explorer-row > :nth-child(4) { display: none; }
  .explorer-nav { flex-wrap: wrap; }
  .explorer-address { flex: 1 1 100%; }
}

/* View switch (data-view on html, set from Sash's adaptive map). The cross-fade is added by
   setView() for 180 ms; reduced motion never adds it. */
@keyframes view-fade { from { opacity: 0.35; } to { opacity: 1; } }
html.view-fade .desktop, html.view-fade .appbar, html.view-fade .bottom-nav { animation: view-fade 180ms ease-out; }
@media (prefers-reduced-motion: reduce) { html.view-fade .desktop, html.view-fade .appbar, html.view-fade .bottom-nav { animation: none; } }

/* Tray button: Desktop View only (Mobile View has the app bar menu instead) */
.view-tray { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 8px; border-radius: 8px; color: inherit; background: transparent; border: 1px solid transparent; cursor: pointer; }
.view-tray:hover { background: rgba(171, 202, 255, 0.12); }
.view-tip { display: none; font-size: 12px; white-space: nowrap; }
.view-tray:focus-visible .view-tip, .view-tray:hover .view-tip { display: inline; }
html[data-view="mobile"] .view-tray { display: none; }

/* View choices in the appearance dialog */
.view-choices .view-choice { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; cursor: pointer; }
.view-choices .view-choice small { color: var(--muted); }
.view-choices input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

/* Banner suggesting Mobile View on a narrow screen (role="status") */
.view-hint { position: fixed; z-index: 60; left: 8px; right: 8px; top: calc(var(--host-inset-top) + 8px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px;
  background: var(--raised, #1b2437); color: inherit; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); }
.view-hint[hidden] { display: none; }
.view-hint > span { flex: 1 1 200px; }
.view-hint button { min-height: 40px; padding: 6px 12px; border-radius: 8px; }

/* Keyboard focus for the new controls */
.view-tray:focus-visible, .view-hint button:focus-visible, .view-choices input[type="radio"]:focus-visible,
.view-choices .view-choice:focus-within, #start-menu button[data-view-switch]:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

/* ---- Mobile View (html[data-view="mobile"]). Phone-style shell. #icons, #widgets and #dock are hidden
   here; the phone home is #home (renderMobileHome). Desktop View is not touched by these rules.
   [data-mobile-home] is set from the route (renderAppBar): the phone home screen shows on the home
   route only; app routes stay full screen with the app bar. ---- */

/* Desktop chrome and the navigation bar/rail never show in Mobile View. */
html[data-view="mobile"] #icons,
html[data-view="mobile"] #widgets,
html[data-view="mobile"] #dock { display: none !important; }
html[data-view="mobile"] .taskbar,
html[data-view="mobile"] .topbar,
html[data-view="mobile"] #start-btn,
html[data-view="mobile"] #windows,
html[data-view="mobile"] .bottom-nav { display: none !important; }

/* Home route: the phone home screen replaces the page (#main is hidden, the app bar is hidden). */
html[data-view="mobile"][data-mobile-home="true"] .appbar,
html[data-view="mobile"][data-mobile-home="true"] .workspace > main { display: none !important; }
html[data-view="mobile"] .desktop { position: relative; }
html[data-view="mobile"][data-mobile-home="true"] .desktop { height: 100%; }
html[data-view="mobile"][data-mobile-home="true"] .workspace {
  height: 100%; overflow-y: auto; overscroll-behavior: contain; background: transparent;
  display: flex; flex-direction: column; gap: 0;
  padding: 0;
}

/* Status strip: clock on the left, status icons on the right (same data as the desktop tray). */
.phone-status { display: none; }
html[data-view="mobile"][data-mobile-home="true"] .phone-status {
  position: fixed; z-index: 7; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  height: calc(var(--host-inset-top) + 36px);
  padding: var(--host-inset-top) calc(20px + var(--host-inset-right)) 0 calc(22px + var(--host-inset-left));
  color: var(--text); font-size: 15px; font-weight: 650; pointer-events: none;
}
.phone-status-icons { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.phone-status-notes { font-size: 12px; }


/* ---- Mobile View home (A3a). Built from sh.home (home.sash for_shell): a pager of 4 x 6 grids, the
   frosted dock, the app drawer and the folder sheet. Desktop View never shows these. ---- */
#home { display: none; }
html[data-view="mobile"][data-mobile-home="true"] #home {
  display: flex; flex-direction: column; position: relative; z-index: 2;
  box-sizing: border-box; width: 100%; height: 100%; min-height: 0; --cell: 72px;
  padding: calc(var(--host-inset-top) + 52px) 0 0;
}
.home-pages {
  flex: 1 1 auto; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain;
}
.home-pages::-webkit-scrollbar { display: none; }
.home-pages:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: 16px; }
.home-page {
  flex: 0 0 100%; min-width: 100%; box-sizing: border-box; scroll-snap-align: start; scroll-snap-stop: always;
  container-type: size; overflow: hidden; padding: 6px 16px 12px;
  display: flex; justify-content: center; align-items: flex-start;
}
.home-grid {
  --gap: 12px;
  /* A cell is the width-based square, shrunk when six rows would not fit the page height. */
  --cell: min(calc((min(100cqw, 560px) - 3 * var(--gap)) / 4), calc((100cqh - 18px - 5 * var(--gap)) / 6));
  width: 100%; max-width: 560px; box-sizing: border-box;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(6, var(--cell));
  gap: var(--gap); align-content: start;
}
.home-dots { display: flex; justify-content: center; align-items: center; padding: 4px 0; }
.home-dot {
  appearance: none; width: 24px; height: 24px; margin: 0; padding: 0; border: 0; background: transparent;
  cursor: pointer; display: grid; place-items: center; -webkit-tap-highlight-color: transparent;
}
.home-dot::before {
  content: ""; width: 7px; height: 7px; border-radius: 4px; background: var(--muted); opacity: 0.5;
  transition: width 160ms ease-out, opacity 160ms ease-out;
}
.home-dot[aria-current="true"]::before { width: 18px; opacity: 1; background: var(--text); }
.home-dot:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 12px; }

/* Tiles are buttons: an icon above a label. The icon scales with the cell. */
.home-tile {
  appearance: none; margin: 0; padding: 0; border: 0; background: transparent; color: var(--text);
  font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 4px; min-width: 0; min-height: 0; cursor: pointer; border-radius: 18px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: transform 120ms ease-out;
}
.home-tile:active { transform: scale(0.94); }
.home-tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.home-icon {
  display: grid; place-items: center; box-sizing: border-box; aspect-ratio: 1; color: #fff; font-weight: 650;
  width: min(100%, calc(var(--cell) * 0.66), 64px); border-radius: 22%;
  font-size: clamp(16px, calc(var(--cell) * 0.3), 28px); line-height: 1;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.home-label {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; line-height: 14px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.tone-blue { background: linear-gradient(145deg, #62a8ff, #2d62d0); }
.tone-orange { background: linear-gradient(145deg, #ffb265, #e8702a); }
.tone-violet { background: linear-gradient(145deg, #b99cff, #6b4fd6); }
.tone-purple { background: linear-gradient(145deg, #d58cf2, #8a3fb8); }
.tone-amber { background: linear-gradient(145deg, #ffd45c, #e0962a); }
.tone-green { background: linear-gradient(145deg, #7ddc8a, #2e9a4f); }
.tone-teal { background: linear-gradient(145deg, #5fd8cc, #1f8f87); }
.tone-red { background: linear-gradient(145deg, #ff8a80, #d43f3f); }
.tone-slate { background: linear-gradient(145deg, #9aa9c4, #4f5f7d); }
.tone-pink { background: linear-gradient(145deg, #ff9ac7, #d2468c); }

/* Folder tile: a 3 x 3 mini grid of up to nine app glyphs. */
.home-folder-preview {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; box-sizing: border-box; aspect-ratio: 1;
  width: min(100%, calc(var(--cell) * 0.66), 64px); padding: 6px; border-radius: 22%;
  background: rgba(255, 255, 255, 0.14); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.home-folder-preview .mini {
  display: grid; place-items: center; border-radius: 4px; color: #fff; font-size: 8px; line-height: 1; overflow: hidden;
}

/* Widget cards: glass, spanning their cells. */
.home-widget {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 0; overflow: hidden; box-sizing: border-box;
  padding: 12px 14px; border-radius: 22px; border: 1px solid rgba(195, 216, 255, 0.18);
  background: rgba(11, 22, 43, 0.5); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); color: var(--text); font-size: 13px;
  backdrop-filter: blur(var(--glass-blur, 16px)); -webkit-backdrop-filter: blur(var(--glass-blur, 16px));
}
.home-widget-title { margin: 0; font-size: 10px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.home-widget-body { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.home-widget-body p { margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-widget-body ul { list-style: none; margin: 0; padding: 0; }
.home-widget-body li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-w-time { display: block; font-size: 30px; font-weight: 600; line-height: 1.1; }
.home-w-date, .home-w-muted { color: var(--muted); font-size: 12px; }
.home-w-big { display: block; font-size: 18px; font-weight: 600; }
.home-w-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.home-w-quick .home-icon { width: 100%; max-width: 48px; }
.home-w-quick .home-label { display: none; }

/* Frosted dock: up to five apps or folders, then the drawer button at the right end. */
.home-dock {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-evenly; gap: 4px; box-sizing: border-box;
  margin: 0 calc(14px + var(--host-inset-right, 0px)) calc(var(--host-inset-bottom, 0px) + 30px) calc(14px + var(--host-inset-left, 0px));
  padding: 10px 12px; border: 1px solid rgba(195, 216, 255, 0.18); border-radius: 28px;
  background: rgba(8, 15, 31, 0.42); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(var(--glass-blur, 16px)); -webkit-backdrop-filter: blur(var(--glass-blur, 16px));
}
.home-dock .home-tile { width: 60px; height: 60px; justify-content: center; gap: 0; }
.home-dock .home-icon { width: 54px; height: 54px; }
.home-dock .home-label { display: none; }
.home-drawer-icon { background: rgba(255, 255, 255, 0.16); color: var(--text); box-shadow: none; }

/* App drawer: full-screen sheet. Search first, then suggested, categories and A to Z. */
.app-drawer {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; box-sizing: border-box;
  padding: calc(var(--host-inset-top, 0px) + 10px) calc(16px + var(--host-inset-right, 0px)) calc(var(--host-inset-bottom, 0px) + 40px) calc(16px + var(--host-inset-left, 0px));
  background: rgba(8, 14, 28, 0.94); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  color: var(--text); animation: drawer-up 220ms ease-out;
}
.app-drawer[hidden], .folder-overlay[hidden] { display: none !important; }
.drawer-grab { display: flex; justify-content: center; }
.drawer-grab-btn {
  appearance: none; width: 100%; min-height: 28px; margin: 0; padding: 0; border: 0; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.drawer-grab-btn span { width: 40px; height: 5px; border-radius: 3px; background: var(--muted); opacity: 0.6; }
.drawer-grab-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.drawer-search { padding: 4px 0 6px; }
.drawer-search input {
  width: 100%; box-sizing: border-box; min-height: 44px; padding: 0 14px; border-radius: 14px; font: inherit; font-size: 16px;
  border: 1px solid rgba(195, 216, 255, 0.2); background: rgba(255, 255, 255, 0.08); color: var(--text);
}
.drawer-search input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.drawer-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0 0; }
.drawer-section h3 {
  margin: 16px 4px 8px; font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.drawer-card {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 6px; padding: 14px 8px;
  border-radius: 22px; background: rgba(255, 255, 255, 0.06);
}
.drawer-row { display: flex; gap: 12px; overflow-x: auto; padding: 0 0 4px; scrollbar-width: none; }
.drawer-row .home-tile { flex: 0 0 64px; width: 64px; --cell: 72px; }
.drawer-card .home-tile { --cell: 72px; }
.drawer-card .home-icon, .drawer-row .home-icon { width: 52px; height: 52px; }
.drawer-list { list-style: none; margin: 0; padding: 0; }
.drawer-list button {
  appearance: none; width: 100%; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 8px;
  border: 0; border-radius: 12px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.drawer-list button:hover { background: rgba(255, 255, 255, 0.06); }
.drawer-list button:focus-visible, .drawer-row .home-tile:focus-visible, .drawer-card .home-tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.drawer-list .home-icon { width: 36px; height: 36px; font-size: 16px; }
.drawer-row-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Folder sheet: blurred backdrop, app grid. Tap outside or Escape closes. */
.folder-overlay {
  position: fixed; inset: 0; z-index: 48; display: flex; align-items: center; justify-content: center; box-sizing: border-box;
  padding: calc(var(--host-inset-top, 0px) + 56px) 16px calc(var(--host-inset-bottom, 0px) + 60px);
  background: rgba(5, 10, 22, 0.45); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.folder-sheet {
  width: min(100%, 420px); max-height: 100%; overflow-y: auto; box-sizing: border-box; padding: 18px; border-radius: 28px;
  background: rgba(14, 23, 40, 0.9); border: 1px solid rgba(195, 216, 255, 0.2); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  color: var(--text); animation: folder-in 180ms ease-out;
}
.folder-sheet:focus { outline: none; }
.folder-title { margin: 0 0 12px; font-size: 17px; font-weight: 650; text-align: center; }
.folder-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 6px; }
.folder-grid .home-tile { --cell: 72px; }
.folder-grid .home-icon { width: 56px; height: 56px; }

/* Edit mode (A3b): top bar, wiggle (dashed outline under reduced motion), badges, drag ghost and
   drop cell. Drag targets use touch-action none so a drag is not taken for a page swipe. */
.home-edit-bar {
  flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; box-sizing: border-box;
  padding: 2px 16px 6px; color: var(--text);
}
.home-edit-bar[hidden] { display: none; }
.home-edit-title { margin-right: auto; font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.home-edit-bar button { min-height: 40px; padding: 0 12px; border-radius: 999px; font: inherit; font-size: 14px; cursor: pointer; }
.home-editing .home-page { position: relative; }
.home-editing [data-drag-id] { touch-action: none; user-select: none; -webkit-user-select: none; position: relative; cursor: grab; }
.home-editing [data-drag-zone="page"] { animation: home-wiggle 240ms ease-in-out infinite alternate; }
.home-editing [data-drag-zone]:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
@keyframes home-wiggle { from { transform: rotate(-1.4deg); } to { transform: rotate(1.4deg); } }
@media (prefers-reduced-motion: reduce) {
  .home-editing [data-drag-zone="page"] { animation: none; }
  .home-editing [data-drag-zone] { outline: 2px dashed rgba(195, 216, 255, 0.5); outline-offset: 4px; border-radius: 18px; }
}
html.reduced-motion .home-editing [data-drag-zone="page"] { animation: none; }
html.reduced-motion .home-editing [data-drag-zone] { outline: 2px dashed rgba(195, 216, 255, 0.5); outline-offset: 4px; border-radius: 18px; }
.home-editing .home-widget[data-drag-zone] { outline-offset: 0; }
.home-tile.is-dragging, .home-widget.is-dragging { opacity: 0.25; }
.home-tile.is-picked, .home-widget.is-picked { box-shadow: 0 0 0 3px var(--accent); }
.home-badge {
  position: absolute; top: -6px; left: -6px; z-index: 3; box-sizing: border-box; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: #2b3650; color: #fff; border: 2px solid rgba(8, 14, 28, 0.9);
  font-size: 18px; font-weight: 700; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.home-widget > .home-badge { top: 6px; right: 6px; left: auto; }
.home-ghost { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; opacity: 0.92; will-change: transform; }
.home-ghost > * { animation: none !important; }
.home-drop {
  box-sizing: border-box; border-radius: 22px; border: 2px solid var(--accent); background: rgba(120, 170, 255, 0.16);
  pointer-events: none; z-index: 1;
}
.home-drop.hold { border-style: dashed; }
.home-drop.fold { background: rgba(125, 220, 138, 0.2); border-color: #7ddc8a; }
.home-drop.bad { border-color: #ff8a80; background: rgba(255, 80, 80, 0.14); }
.home-dock.is-drop { outline: 2px dashed var(--accent); outline-offset: 2px; }
.home-page-remove {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid rgba(255, 138, 128, 0.6); background: rgba(40, 20, 24, 0.7); color: #ffb4ac;
  font: inherit; font-size: 14px; cursor: pointer;
}
.folder-title { cursor: text; }
.folder-rename {
  width: 100%; box-sizing: border-box; min-height: 40px; padding: 0 10px; border-radius: 12px; text-align: center;
  font: inherit; font-size: 17px; color: var(--text); border: 1px solid rgba(195, 216, 255, 0.3); background: rgba(255, 255, 255, 0.08);
}
.folder-rename:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.folder-overlay.dragging { pointer-events: none; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.folder-overlay.dragging .folder-sheet { opacity: 0.35; }
.folder-overlay.editing .folder-app .home-icon { box-shadow: 0 0 0 2px rgba(195, 216, 255, 0.4), 0 6px 16px rgba(0, 0, 0, 0.25); }

/* Bottom sheets: widget gallery, widget menu, resize and configure. */
.home-sheet-overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; box-sizing: border-box;
  background: rgba(5, 10, 22, 0.45); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.home-sheet-overlay[hidden] { display: none !important; }
.home-sheet {
  width: 100%; max-width: 560px; max-height: 86%; overflow-y: auto; overscroll-behavior: contain; box-sizing: border-box;
  padding: 16px 16px calc(20px + var(--host-inset-bottom, 0px)); border-radius: 28px 28px 0 0;
  background: rgba(14, 23, 40, 0.97); border-top: 1px solid rgba(195, 216, 255, 0.2); color: var(--text);
  animation: drawer-up 200ms ease-out;
}
.home-sheet:focus { outline: none; }
.home-sheet-row {
  display: flex; align-items: center; width: 100%; min-height: 48px; box-sizing: border-box; margin: 4px 0; padding: 0 14px;
  border: 0; border-radius: 14px; background: rgba(255, 255, 255, 0.06); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.home-sheet-row[aria-pressed="true"] { background: rgba(120, 170, 255, 0.25); }
.home-sheet-row:focus-visible, .gallery-chips button:focus-visible, .home-sheet-check input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.home-sheet-check { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.home-sheet-check input { width: 20px; height: 20px; margin: 0; }
.home-sheet-check input:disabled + * { opacity: 0.5; }
.gallery-card { display: grid; gap: 8px; margin: 0 0 18px; }
.gallery-preview { width: 100%; max-width: 280px; margin: 4px auto 0; box-sizing: border-box; }
.gallery-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.gallery-chips button {
  min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(195, 216, 255, 0.25);
  background: transparent; color: var(--text); font: inherit; cursor: pointer;
}
.gallery-chips button[aria-pressed="true"] { background: rgba(120, 170, 255, 0.3); }
.home-sheet .primary { min-height: 44px; width: 100%; margin-top: 8px; border-radius: 14px; font: inherit; cursor: pointer; }
.home-sheet .primary:disabled { opacity: 0.5; cursor: default; }

@keyframes drawer-up { from { transform: translateY(8%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes folder-in { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .home-tile, .home-dot::before, .app-drawer, .folder-sheet { transition: none !important; animation: none !important; }
  .home-tile:active { transform: none; }
}
html.reduced-motion .home-tile, html.reduced-motion .home-dot::before { transition: none !important; }
html.reduced-motion .home-tile:active { transform: none; }
html.reduced-motion .app-drawer, html.reduced-motion .folder-sheet { animation: none !important; }

/* Home indicator: a transparent strip (24 px plus the bottom inset) with a thin pill. Tap, swipe up
   or Enter/Space goes home; long press or Alt+Shift+E opens the drawer sheet. */
.home-indicator { display: none; }
html[data-view="mobile"][data-home-bar="true"] .home-indicator {
  display: flex; position: fixed; z-index: 51; left: 0; right: 0; box-sizing: border-box;
  bottom: var(--host-inset-bottom, 0px); height: var(--home-bar-h, 24px);
  width: 100%; padding: 0; transition: bottom 0.18s ease, opacity 0.18s ease;
  align-items: center; justify-content: center; margin: 0; border: 0; border-radius: 0;
  background: transparent; cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent;
}
/* Android's bar shown (transiently or by setting): the SashOS bar is already lifted above it; fade it. */
html.system-bar-shown[data-view="mobile"][data-home-bar="true"] .home-indicator { opacity: 0.55; }
html[data-view="mobile"][data-home-bar="true"] .home-indicator:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: 12px; }
html.keyboard-open .home-indicator { display: none !important; }
.home-pill { width: 134px; height: 5px; border-radius: 3px; background: rgba(245, 247, 251, 0.9); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
html[data-theme="light"] .home-pill { background: rgba(20, 26, 40, 0.8); box-shadow: none; }

/* Android-style press feedback is the 0.94 scale above; no ripple. Reduced motion removes the transition. */

/* ---- S1 control and notification sheet (H1). One component for both views. Desktop View: a floating
   glass panel under the top bar, top right. Mobile View: a full-width top sheet over a scrim, with a
   grab handle. Tiles are rounded fills (filled with the accent when on). Touch and hybrid input get
   var(--touch) targets. */
.shade-scrim { position: fixed; inset: 0; z-index: 54; background: rgba(4, 8, 18, 0.36); }
.shade-scrim[hidden] { display: none; }
.shade {
  position: fixed; z-index: 55; display: flex; flex-direction: column; gap: 12px; box-sizing: border-box;
  top: calc(var(--panel) + 8px + var(--host-inset-top, 0px)); right: 12px;
  width: min(380px, calc(100vw - 24px)); max-height: 80vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 14px 14px; color: var(--text);
  border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow);
  background: var(--surface); backdrop-filter: blur(var(--glass-blur, 16px)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--glass-blur, 16px)) saturate(1.2);
  animation: shade-in 180ms ease-out;
}
.shade[hidden] { display: none !important; }
html[data-glass="off"] .shade { background: var(--raised); backdrop-filter: none; -webkit-backdrop-filter: none; }
.shade-grab { display: none; }
.shade-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shade-tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px;
  min-height: max(76px, var(--touch, 32px)); padding: 12px; border: 0; border-radius: 22px;
  background: var(--raised); color: var(--text); font: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: transform 120ms ease-out, background-color 120ms;
}
.shade-tile.on { background: var(--accent); color: #fff; }
.shade-tile:active { transform: scale(0.97); }
.shade-glyph { font-size: 18px; line-height: 1; }
.shade-tile-label { font-size: 13px; font-weight: 650; }
.shade-tile-sub { font-size: 11px; opacity: 0.78; overflow-wrap: anywhere; }
.shade-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.shade-heading { margin: 0; font-size: 14px; font-weight: 650; }
.shade-heading:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.shade-count { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; }
.shade-count:empty { display: none; }
.shade-notes { display: grid; gap: 10px; }
.shade-group { display: grid; gap: 6px; }
.shade-source { display: flex; justify-content: space-between; margin: 0; color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; }
.shade-card {
  position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 10px 8px 10px 12px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--raised); touch-action: pan-y;
  transition: transform 160ms ease-out, opacity 160ms ease-out;
}
.shade-card.dragging { transition: none; }
.shade-card-body { flex: 1 1 auto; min-width: 0; }
.shade-card-title { margin: 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.shade-card-text { margin: 2px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.shade-card-time { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.shade-dismiss { flex: 0 0 auto; width: 30px; height: 30px; padding: 0; border-radius: 999px; line-height: 1; font-size: 16px; }
.shade-empty { margin: 0; padding: 14px 0; color: var(--muted); font-size: 13px; text-align: center; }
.shade-foot { display: flex; justify-content: flex-end; }
.shade-foot button:disabled { opacity: 0.45; cursor: default; }
.shade button:focus-visible, .shade-card:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.shade-tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
html[data-input="touch"] .shade button, html[data-input="hybrid"] .shade button, html[data-input="pen"] .shade button {
  min-height: var(--touch); }
html[data-input="touch"] .shade-dismiss, html[data-input="hybrid"] .shade-dismiss, html[data-input="pen"] .shade-dismiss { width: var(--touch); }
@keyframes shade-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes shade-drop { from { transform: translateY(-100%); } to { transform: none; } }

/* Mobile View: full-width top sheet under the status strip. Grab handle on top; drag up or tap closes. */
html[data-view="mobile"] .shade {
  top: 0; left: 0; right: 0; width: auto; max-height: 85vh; max-height: 85dvh;
  padding: calc(var(--host-inset-top, 0px) + 6px) calc(14px + var(--host-inset-right, 0px)) 16px calc(14px + var(--host-inset-left, 0px));
  border: 0; border-radius: 0 0 28px 28px; animation: shade-drop 220ms ease-out;
}
html[data-view="mobile"] .shade-grab {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 28px; margin: 0; padding: 0;
  border: 0; background: transparent; cursor: grab; touch-action: none;
}
.shade-grab span { width: 40px; height: 5px; border-radius: 3px; background: var(--muted); opacity: 0.6; }
html[data-view="mobile"] .shade-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html[data-view="mobile"] .shade-scrim { z-index: 54; }
/* The status strip is the pull-down target on the phone home; it is not a click target otherwise. */
html[data-view="mobile"][data-mobile-home="true"] .phone-status { pointer-events: auto; }

@media (prefers-reduced-motion: reduce) {
  .shade, html[data-view="mobile"] .shade { animation: none; }
  .shade-card, .shade-tile { transition: none; }
}
html.reduced-motion .shade, html.reduced-motion[data-view="mobile"] .shade { animation: none; }
html.reduced-motion .shade-card, html.reduced-motion .shade-tile { transition: none; }

/* ---- Desktop widgets (A4). Glass cards at x_pct/y_pct of the desktop area; hidden in Mobile View. ---- */
.desktop-widgets { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
html[data-view="mobile"] .desktop-widgets { display: none; }
.dw {
  position: absolute; box-sizing: border-box; display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; overflow: hidden; pointer-events: auto; touch-action: none; cursor: grab;
  border: 1px solid rgba(195, 216, 255, 0.18); border-radius: 18px;
  background: rgba(11, 22, 43, 0.56); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); color: var(--text);
}
.dw:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.dw.dragging { cursor: grabbing; opacity: 0.9; }
.dw-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.dw-head .home-widget-title { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
.dw-menu {
  flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: transparent;
  color: inherit; font: inherit; line-height: 1; cursor: pointer;
}
.dw-menu:hover, .dw-menu:focus-visible { background: rgba(255, 255, 255, 0.1); }
html[data-input="touch"] .dw-menu, html[data-input="pen"] .dw-menu, html[data-input="hybrid"] .dw-menu {
  min-width: var(--touch); min-height: var(--touch);
}

/* ---- H3: Recents (both views), split divider and touch-aware window chrome. Sash decides; CSS paints. ---- */
.recents[hidden], .split-divider[hidden] { display: none !important; }
.recents-btn { min-width: 40px; font-size: 16px; }
.recents {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; gap: 16px; padding: 24px;
  background: rgba(6, 10, 20, 0.62); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: var(--text, #e8eefc);
}
.recents-head { display: flex; align-items: center; gap: 12px; }
.recents-head strong { flex: 1; font-size: 18px; }
.recents-grid {
  flex: 1; display: flex; flex-wrap: wrap; gap: 16px; align-content: center; justify-content: center; overflow: auto;
}
.recent-card {
  position: relative; width: 200px; min-height: 150px; padding: 16px; border-radius: 16px; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 8px; cursor: pointer; user-select: none; touch-action: none;
  background: rgba(32, 42, 68, 0.72); border: 1px solid rgba(195, 215, 250, 0.18);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35); transition: transform 0.12s;
}
.recent-card.focused, .recent-card:focus-visible { outline: 2px solid #5b8cff; outline-offset: 2px; }
.recent-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 20px;
}
.recent-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 36px; }
.recent-meta { color: #9fb0cc; font-size: 12px; }
.recent-close {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; padding: 0;
  border-radius: 50%; font-size: 18px; line-height: 1;
}
.recents-empty { color: #9fb0cc; }
/* Mobile View: the same cards as a horizontal carousel. Horizontal pans scroll it; a vertical swipe still closes. */
html[data-view="mobile"] .recents { padding: 24px 0; }
html[data-view="mobile"] .recents-head { padding: 0 16px; }
html[data-view="mobile"] .recents-grid {
  flex: 0 0 auto; flex-wrap: nowrap; justify-content: flex-start; align-content: center; align-items: center;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; padding: 12px 16px; gap: 14px;
  scrollbar-width: none;
}
html[data-view="mobile"] .recents-grid::-webkit-scrollbar { display: none; }
html[data-view="mobile"] .recent-card { flex: 0 0 min(220px, 70vw); scroll-snap-align: center; touch-action: pan-x; min-height: 260px; }

/* Split divider between two side-by-side windows. Sits on the shared edge; the ratio is stored by Sash. */
.split-divider {
  position: absolute; top: 0; bottom: 0; width: 12px; margin-left: -6px; z-index: 11;
  cursor: col-resize; touch-action: none; pointer-events: auto;
}
.split-divider::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 5px; width: 2px;
  background: rgba(153, 195, 255, 0.6);
}
.split-divider:focus-visible { outline: 2px solid #5b8cff; outline-offset: 0; }

/* Touch-aware chrome: html[data-input] is set from Sash by applyAdaptive ("touch" or "hybrid"). */
html[data-input="touch"] .win header,
html[data-input="hybrid"] .win header { min-height: 44px; }
html[data-input="touch"] .win header button,
html[data-input="hybrid"] .win header button { width: 44px; height: 44px; }
html[data-input="touch"] .grip.n, html[data-input="touch"] .grip.s,
html[data-input="hybrid"] .grip.n, html[data-input="hybrid"] .grip.s { height: 12px; }
html[data-input="touch"] .grip.e, html[data-input="touch"] .grip.w,
html[data-input="hybrid"] .grip.e, html[data-input="hybrid"] .grip.w { width: 12px; }
html[data-input="touch"] .grip.nw, html[data-input="touch"] .grip.ne,
html[data-input="touch"] .grip.sw, html[data-input="touch"] .grip.se,
html[data-input="hybrid"] .grip.nw, html[data-input="hybrid"] .grip.ne,
html[data-input="hybrid"] .grip.sw, html[data-input="hybrid"] .grip.se { width: 12px; height: 12px; }
html[data-input="touch"] .recents-btn, html[data-input="hybrid"] .recents-btn,
html[data-input="touch"] .recent-close, html[data-input="hybrid"] .recent-close { min-width: 44px; min-height: 44px; }
html[data-input="touch"] .recent-close, html[data-input="hybrid"] .recent-close { width: 44px; height: 44px; }

/* ---- H4: Desktop View edge gestures, widget panel and hybrid dock. ---- */
.edge-glow { position: fixed; z-index: 60; pointer-events: none; opacity: 0; transition: opacity 180ms ease; }
.edge-glow.on { opacity: 1; }
.edge-glow[data-edge="left"] { top: 0; bottom: 0; left: 0; width: 26px; background: linear-gradient(to right, rgba(139, 180, 246, 0.42), transparent); }
.edge-glow[data-edge="right"] { top: 0; bottom: 0; right: 0; width: 26px; background: linear-gradient(to left, rgba(139, 180, 246, 0.42), transparent); }
.edge-glow[data-edge="top"] { top: 0; left: 0; right: 0; height: 26px; background: linear-gradient(to bottom, rgba(139, 180, 246, 0.42), transparent); }
.edge-glow[data-edge="bottom"] { bottom: 0; left: 0; right: 0; height: 26px; background: linear-gradient(to top, rgba(139, 180, 246, 0.42), transparent); }
html.reduced-motion .edge-glow { transition: none; }

.widget-panel[hidden], .nav-buttons[hidden], .recents-btn[hidden], .widgets-btn[hidden] { display: none; }
.widget-panel {
  position: fixed; top: calc(var(--panel, 58px) + 10px); right: 10px;
  bottom: calc(var(--taskbar-height, 58px) + 10px); z-index: 58;
  display: flex; flex-direction: column; gap: 10px; width: min(340px, calc(100vw - 20px));
  padding: 14px; overflow-y: auto; box-sizing: border-box;
  border: 1px solid rgba(195, 216, 255, 0.22); border-radius: 20px;
  background: rgba(11, 22, 43, 0.74); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); color: var(--text);
  animation: widget-panel-in 220ms ease-out;
}
@keyframes widget-panel-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
html.reduced-motion .widget-panel { animation: none; }
@media (prefers-reduced-motion: reduce) { .widget-panel { animation: none; } }
html[data-view="mobile"] .widget-panel { display: none !important; }
.widget-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.widget-panel-title { margin: 0; font-size: 15px; font-weight: 650; }
.widget-panel-list { display: flex; flex-direction: column; gap: 10px; }
.dw-panel-card { position: relative; left: auto; top: auto; width: 100%; min-height: 140px; cursor: default; touch-action: auto; }
.widget-panel-add { min-height: 44px; }

.nav-buttons { display: flex; align-items: center; gap: 4px; }
.nav-button {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 1px solid rgba(190, 212, 250, 0.2); border-radius: 12px;
  background: rgba(37, 53, 78, 0.5); color: #dbe6f7; font: inherit; font-size: 16px; cursor: pointer;
}
.nav-button:hover { background: rgba(77, 111, 165, 0.3); }
.widgets-btn {
  min-width: 28px; height: 28px; padding: 0 4px; border: 0; border-radius: 6px;
  background: none; color: #93a3bd; font: inherit; font-size: 14px; cursor: pointer;
}
.widgets-btn[aria-expanded="true"], .widgets-btn:hover { color: #eef2f8; }
.nav-button:focus-visible, .widgets-btn:focus-visible, .recents-btn:focus-visible, .task-app:focus-visible, .dw-menu:focus-visible {
  outline: 2px solid var(--accent, #8bb4f6); outline-offset: 2px;
}
html[data-input="touch"] .taskbar button, html[data-input="hybrid"] .taskbar button {
  min-width: var(--touch, 44px); min-height: var(--touch, 44px);
}
html[data-input="touch"] .widgets-btn, html[data-input="hybrid"] .widgets-btn { min-width: var(--touch, 44px); }

/* Hybrid dock: a centered rounded glass bar with icons, running dots and the Recents slot at the right end. */
html[data-dock="on"] .taskbar {
  justify-self: center; width: fit-content; max-width: min(560px, calc(100% - 16px)); box-sizing: border-box;
  margin: 6px auto 8px; padding: 6px 12px; gap: 8px;
  border: 1px solid rgba(190, 212, 250, 0.22); border-radius: 24px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
}
html[data-dock="on"] .taskbar .start { order: 1; }
/* The task list scrolls sideways once the bar hits its cap; the bottom padding keeps running dots inside the clip. */
html[data-dock="on"] .tasks { order: 2; flex: 0 1 auto; justify-content: center; min-width: 0; overflow-x: auto; overflow-y: hidden; padding-bottom: 8px; margin-bottom: -8px; scrollbar-width: none; }
html[data-dock="on"] #nav-buttons { order: 3; }
html[data-dock="on"] .tray { order: 4; }
html[data-dock="on"] #recents-btn { order: 5; }
html[data-dock="on"] .task-app {
  position: relative; justify-content: center; width: 48px; min-width: 48px; max-width: 48px; height: 48px;
  padding: 0; border-radius: 14px;
}
html[data-dock="on"] .task-app .task-label { display: none; }
html[data-dock="on"] .task-glyph { font-size: 20px; }
html[data-dock="on"] .dock-pin:not(.running) { opacity: 0.8; }
html[data-dock="on"] .task-app.running::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; width: 5px; height: 5px; margin-left: -2.5px;
  border-radius: 50%; background: var(--accent, #8bb4f6);
}
html[data-dock="on"] .tray { gap: 6px; }

/* H5 lock screen: one full-screen layer in both views. Classes only (CSP forbids style attributes). */
.lock {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background: var(--lock-bg, #0b0d12);
  color: var(--lock-fg, #f4f5f7);
  overflow: hidden;
  touch-action: none;
}
.lock[hidden] { display: none; }
.lock-top { text-align: center; }
.lock-date { margin: 0; font-size: 1rem; opacity: 0.8; }
.lock-time { margin: 4px 0 0; font-size: clamp(3.5rem, 18vw, 7rem); font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
.lock-notes { width: min(420px, 100%); display: grid; gap: 8px; max-height: 30vh; overflow: auto; }
.lock-note-group { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.1); }
.lock-note-app { font-weight: 600; }
.lock-note-count { opacity: 0.7; }
.lock-note-text { grid-column: 1 / -1; margin: 2px 0 0; font-size: 0.9rem; opacity: 0.9; overflow-wrap: anywhere; }
.lock-muted { margin: 0; opacity: 0.7; text-align: center; }
.lock-widgets { width: min(560px, 100%); display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.lock-widget { padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, 0.12); min-width: 0; }
.lock-w-title { margin: 0 0 6px; font-size: 0.85rem; font-weight: 600; opacity: 0.8; }
.lock-widget ul { margin: 0; padding-left: 1.1em; }
.lock-form { display: grid; gap: 6px; width: min(320px, 100%); }
.lock-form[hidden] { display: none; }
.lock-secret-label { font-size: 0.9rem; opacity: 0.85; }
.lock-form input { min-height: 44px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.08); color: inherit; padding: 0 12px; font: inherit; }
.lock-error { margin: 0; color: #ffb4a8; text-align: center; }
.lock-error[hidden] { display: none; }
.lock-unlock { min-width: 180px; min-height: 48px; border: 0; border-radius: 24px; background: rgba(255, 255, 255, 0.9); color: #0b0d12; font: inherit; font-weight: 600; cursor: pointer; }
.lock-unlock:focus-visible, .lock-form input:focus-visible { outline: 3px solid #8ab4ff; outline-offset: 3px; }
.lock-hint { margin: 0; font-size: 0.85rem; opacity: 0.85; text-align: center; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .lock { --lock-bg: #e9edf3; --lock-fg: #14171f; }
}
:root[data-theme="light"] .lock { --lock-bg: #e9edf3; --lock-fg: #14171f; }

/* H6 accessibility. A visible ring on every keyboard-focused control (mouse focus stays quiet).
   Edge bounce: a back swipe with nowhere to go nudges the edge glow once. Reduced motion drops the nudge. */
:focus-visible { outline: 3px solid var(--accent, #8ab4ff); outline-offset: 2px; }
.edge-glow.bounce { animation: edge-nudge 320ms ease-out 1; }
.edge-glow.bounce[data-edge="left"] { --nx: 10px; --ny: 0px; }
.edge-glow.bounce[data-edge="right"] { --nx: -10px; --ny: 0px; }
.edge-glow.bounce[data-edge="top"] { --nx: 0px; --ny: 10px; }
.edge-glow.bounce[data-edge="bottom"] { --nx: 0px; --ny: -10px; }
@keyframes edge-nudge { 0%, 100% { translate: 0 0; } 40% { translate: var(--nx, 0px) var(--ny, 0px); } }
html.reduced-motion .edge-glow.bounce { animation: none; }
@media (prefers-reduced-motion: reduce) { .edge-glow.bounce { animation: none; } }

/* Home bar style "buttons": Back, Home and Recents on the bar (ui.home_bar_style). The pill is replaced. */
.home-buttons { display: none; }
html[data-view="mobile"][data-home-bar="true"][data-home-bar-kind="sashos"][data-home-bar-style="buttons"] .home-indicator { display: none !important; }
html[data-view="mobile"][data-home-bar="true"][data-home-bar-kind="sashos"][data-home-bar-style="buttons"] .home-buttons {
  display: flex; position: fixed; z-index: 51; left: 0; right: 0; bottom: var(--host-inset-bottom, 0px); height: max(48px, var(--home-bar-h, 24px));
  box-sizing: border-box; align-items: center; justify-content: space-around;
  padding: 0 calc(16px + var(--host-inset-right, 0px)) 0 calc(16px + var(--host-inset-left, 0px));
  background: rgba(10, 14, 26, 0.6); backdrop-filter: blur(12px);
}
.home-buttons button { min-width: 56px; min-height: 36px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font: inherit; font-size: 18px; cursor: pointer; }
.home-buttons button:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
html.keyboard-open .home-buttons { display: none !important; }

/* Content reserves the SashOS bar height plus the host inset, so the dock and pages never sit under the bar. */
html[data-view="mobile"][data-home-bar="true"] { --bar-reserve: calc(var(--home-bar-h, 24px) + var(--host-inset-bottom, 0px)); }
html[data-view="mobile"][data-home-bar="true"][data-home-bar-kind="sashos"][data-home-bar-style="buttons"] { --bar-reserve: calc(max(48px, var(--home-bar-h, 24px)) + var(--host-inset-bottom, 0px)); }
html[data-view="mobile"][data-home-bar="true"] .home-dock { margin-bottom: calc(var(--bar-reserve) + 12px); }
html[data-view="mobile"][data-home-bar="true"] main { padding-bottom: calc(var(--bar-reserve) + 12px); }

/* Merged or strip (owner direction): Android's handle is the only bar. SashOS draws no pill, only the
   transparent strip that takes the gestures; a faint line shows for 3 s after launch. */
html[data-home-bar-kind="merged"] .home-pill, html[data-home-bar-kind="strip"] .home-pill { display: none; }
html[data-view="mobile"][data-home-bar="true"][data-home-bar-kind="merged"] .home-indicator,
html[data-view="mobile"][data-home-bar="true"][data-home-bar-kind="strip"] .home-indicator { background: transparent; }
html.strip-hint[data-home-bar-kind="merged"] .home-indicator::before,
html.strip-hint[data-home-bar-kind="strip"] .home-indicator::before {
  content: ""; position: absolute; left: 30%; right: 30%; top: 6px; height: 3px; border-radius: 3px;
  background: rgba(245, 247, 251, 0.35); transition: opacity 0.6s ease;
}
/* Gestures group: each control on its own row, checkbox aligned with its label. */
#gesture-settings label { display: block; margin: 6px 0; }
#gesture-settings label > input[type="checkbox"] { width: auto; margin: 0 8px 0 0; vertical-align: middle; }
