/* ============ Base ============ */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}
.viewport-probe {
  position: fixed; top: 0; left: 0; width: 0; height: 100vh; box-sizing: border-box;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  visibility: hidden; pointer-events: none; contain: strict; z-index: -1;
}
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none;
  background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .5; }
input { font: inherit; color: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { display: block; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }

/* ============ Materials ============
   Glass approximates iOS Liquid Glass with backdrop blur + saturation, a light rim and soft shadow.
   Per Apple's guidance it is used only for the navigation layer floating above content
   (top controls, tab bar, toolbar buttons, sheets, menus, toasts) — never for cards or reading text. */
.glass, .glass-surface,
.app[data-layout="compact"] .status-tabs,
dialog.sheet, .menu, .toast {
  background: var(--glass-tint);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
}
dialog.sheet, .menu { background: var(--glass-tint-strong); }
.chrome-bg { background: var(--glass-tint-chrome); }
.glass, .app[data-layout="compact"] .status-tabs, dialog.sheet, .menu, .toast {
  position: relative;
  box-shadow: var(--glass-shadow), inset 0 0 0 .5px var(--glass-edge);
}
/* Specular rim: a 1px gradient ring, brightest top-left, like light catching a glass edge. */
.glass::after, .app[data-layout="compact"] .status-tabs::after, dialog.sheet::after, .menu::after, .toast::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 2;
  background: linear-gradient(150deg, var(--glass-rim-a), var(--glass-rim-b) 28%, transparent 52%, var(--glass-rim-b) 82%, var(--glass-rim-a));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* Solid material (setting), reduced transparency, or no backdrop-filter support */
:root[data-material="solid"] { --glass-tint: var(--pane); --glass-tint-strong: var(--surface); --glass-tint-chrome: var(--pane); --glass-filter: none; }
@media (prefers-reduced-transparency: reduce) { :root:root { --glass-tint: var(--pane); --glass-tint-strong: var(--surface); --glass-tint-chrome: var(--pane); --glass-filter: none; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { :root:root { --glass-tint: var(--glass-tint-strong); } }
@supports not (transition-timing-function: linear(0, 1)) { :root { --spring: var(--ease); --spring-bounce: cubic-bezier(.34, 1.36, .64, 1); } }

/* ============ App grid (shared) ============ */
.app {
  position: fixed; left: 0; right: 0; top: var(--vv-top, 0px);
  height: var(--app-h, 100vh);
  display: grid; overflow: hidden;
  background:
    radial-gradient(120% 55% at 0% 0%, var(--amb-1), transparent 62%),
    radial-gradient(90% 45% at 100% 35%, var(--amb-2), transparent 60%),
    radial-gradient(110% 55% at 25% 100%, var(--amb-3), transparent 62%),
    var(--bg);
}
@supports (height: 100dvh) { .app { height: var(--app-h, 100dvh); } }
.app > * { min-width: 0; min-height: 0; }
.app-header { grid-area: header; }
.sync-banner { grid-area: banner; }
.toolbar { grid-area: tools; }
.status-tabs { grid-area: tabs; }
.detail-pane { grid-area: detail; }
.hinge { grid-area: hinge; }
.app-header, .sync-banner, .toolbar, .status-tabs { position: relative; z-index: 3; }
.chrome-bg { z-index: 2; pointer-events: none; margin-bottom: -18px; -webkit-mask-image: linear-gradient(#000 calc(100% - 18px), transparent); mask-image: linear-gradient(#000 calc(100% - 18px), transparent); }
.list-scroll { position: relative; z-index: 1; }
.app.no-anim *, .app.no-anim, .app.no-anim *::before { transition: none !important; }

/* ---- Compact: single column; list scrolls under the glass top bar and the floating tab bar ---- */
.app[data-layout="compact"] {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  grid-template-areas: "header" "banner" "tools" "." "tabs";
}
.app[data-layout="compact"] .list-scroll { grid-row: 1 / -1; grid-column: 1; }
.app[data-layout="compact"] .chrome-bg { grid-row: 1 / 4; grid-column: 1; }
.app[data-layout="compact"] .hinge { display: none; }
.app[data-layout="compact"] .detail-pane {
  position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--app-h, 100vh); z-index: 30;
  transform: translate3d(100%, 0, 0); visibility: hidden;
  box-shadow: -16px 0 40px rgba(0, 0, 0, .22);
  transition: transform var(--dur-spring) var(--spring), visibility 0s linear var(--dur-spring);
}
@supports (height: 100dvh) { .app[data-layout="compact"] .detail-pane { height: var(--app-h, 100dvh); } }
.app[data-layout="compact"][data-detail-open] .detail-pane {
  transform: none; visibility: visible;
  transition: transform var(--dur-spring) var(--spring), visibility 0s;
}
/* The list slides back a little under the incoming page, like a UINavigationController push. */
.app[data-layout="compact"] > :not(.detail-pane) { transition: transform var(--dur-spring) var(--spring); }
.app[data-layout="compact"][data-detail-open] > :not(.detail-pane) {
  transform: translate3d(calc(-22% + 22% * var(--swipe-p, 0)), 0, 0);
}
.app[data-swiping] > *, .app[data-swiping] .detail-pane { transition: none !important; }
.app[data-layout="compact"] .detail-scroll { touch-action: pan-y pinch-zoom; }

/* ---- Wide: list + detail side by side ---- */
.app[data-layout="wide"] {
  grid-template-columns: var(--list-w) var(--hinge-w, 0px) minmax(0, 1fr);
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  grid-template-areas:
    "header hinge detail"
    "banner hinge detail"
    "tools  hinge detail"
    "tabs   hinge detail"
    ".      hinge detail";
}
.app[data-layout="wide"] .list-scroll { grid-row: 1 / -1; grid-column: 1; }
.app[data-layout="wide"] .chrome-bg { grid-row: 1 / 5; grid-column: 1; }
.app[data-layout="wide"] .detail-pane { border-left: 1px solid var(--line); }
.app[data-layout="wide"] .back-btn { display: none; }

/* Focus reading (wide only): the detail covers the window. The list column stays laid out underneath
   (hidden + inert), so its scroll position, filters, search text and selection are untouched. */
.app[data-layout="wide"][data-focus] .detail-pane { grid-column: 1 / -1; grid-row: 1 / -1; z-index: 3; border-left: 0; }
.app[data-layout="wide"][data-focus] > :is(.app-header, .sync-banner, .toolbar, .status-tabs, .list-scroll, .chrome-bg, .hinge) { visibility: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .app[data-layout="wide"][data-focus] .detail { animation: focus-in var(--dur-spring) var(--spring); }
}
@keyframes focus-in { from { opacity: .4; transform: translate3d(-24px, 0, 0); } }
/* Mid widths (e.g. iPhone Duo inner display in portrait, 669px): a slimmer list, and status tabs
   without icons so all four still fit. Task cards keep their status shape and colour. */
@media (max-width: 899px) {
  .app[data-layout="wide"] .tab-top svg { display: none; }
  .app[data-layout="wide"] .tab { padding: 0 6px; gap: 4px; }
  .app[data-layout="wide"] .detail { padding-left: 18px; padding-right: calc(18px + var(--safe-right)); }
}
.app[data-layout="wide"] .app-header { padding-left: calc(12px + var(--safe-left)); }
@media (max-width: 1023px) {
  .app[data-layout="wide"] .brand-text { display: none; }
  .app[data-layout="wide"] .brand { flex: 0 0 auto; }
  .app[data-layout="wide"] .conn-pill { flex: 1 1 auto; justify-content: flex-start; }
}

/* ---- Desk: top = selected task, bottom = glass controls over the list ---- */
.app[data-layout="desk"] {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: var(--desk-top, 57%) var(--hinge-h, 0px) auto auto auto minmax(0, 1fr);
  grid-template-areas:
    "detail detail"
    "hinge  hinge"
    "banner banner"
    "tabs   header"
    "tools  tools"
    ".      .";
}
.app[data-layout="desk"] .list-scroll { grid-row: 3 / -1; grid-column: 1 / -1; }
.app[data-layout="desk"] .chrome-bg { grid-row: 3 / 6; grid-column: 1 / -1; }
@media (min-width: 760px) {
  .app[data-layout="desk"] {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: var(--desk-top, 57%) var(--hinge-h, 0px) auto auto minmax(0, 1fr);
    grid-template-areas:
      "detail detail detail"
      "hinge  hinge  hinge"
      "banner banner banner"
      "tabs   tools  header"
      ".      .      .";
  }
  .app[data-layout="desk"] .chrome-bg { grid-row: 3 / 5; }
}
.app[data-layout="desk"] .detail-pane { border-bottom: 1px solid var(--line); }
.app[data-layout="desk"] .back-btn { display: none; }
.app[data-layout="desk"] .brand,
.app[data-layout="desk"] .conn-pill { display: none; }
.app[data-layout="desk"] .app-header { min-height: 0; padding: 8px calc(8px + var(--safe-right)) 0 0; }
.app[data-layout="desk"] .status-tabs { margin: 8px 0 0 calc(12px + var(--safe-left)); align-self: center; }
.app[data-layout="desk"] .toolbar { flex-direction: row; align-items: center; padding: 8px calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left)); gap: 8px; }
.app[data-layout="desk"] .search { flex: 0 0 200px; }
.app[data-layout="desk"] .search input { height: 38px; }
.app[data-layout="desk"] .chips { flex: 1 1 auto; margin: 0; padding: 0; }
@media (max-width: 480px) {
  .app[data-layout="desk"] .search { flex-basis: 150px; }
  .app[data-layout="desk"] .tab { padding: 0 7px; gap: 4px; }
  .app[data-layout="desk"] .status-tabs { margin-left: calc(8px + var(--safe-left)); }
}
@media (min-width: 760px) {
  .app[data-layout="desk"] .toolbar { padding: 8px 4px 8px 8px; }
}
.app[data-layout="desk"] .task-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  gap: 8px; padding: 6px calc(12px + var(--safe-right)) calc(14px + var(--safe-bottom)) calc(12px + var(--safe-left));
}
.app[data-layout="desk"] .group-head { grid-column: 1 / -1; padding-top: 8px; }
.app[data-layout="desk"] .card { padding: 10px 12px; gap: 4px; }
.app[data-layout="desk"] .card-title { font-size: 14.5px; }
.app[data-layout="desk"] .card-summary { -webkit-line-clamp: 1; font-size: 13px; }

/* ============ Header ============ */
.app-header {
  display: flex; align-items: center; gap: 8px;
  min-height: 56px;
  padding: calc(var(--safe-top) + 6px) calc(8px + var(--safe-right)) 6px calc(14px + var(--safe-left));
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1 1 auto; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-mark svg { width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-name { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 350px) { .brand-sub { display: none; } }
.header-actions { display: flex; gap: 2px; flex: none; }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center; border-radius: 20px; color: var(--text-2);
  transition: background-color .15s, transform var(--dur-bounce) var(--spring-bounce);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active { background: var(--fill); transform: scale(.9); transition-duration: .1s; }
@media (hover: hover) { .icon-btn:hover { background: var(--fill); color: var(--text); } }

.conn-pill {
  display: inline-flex; align-items: center; gap: 7px; flex: 0 1 auto; min-width: 0;
  height: 32px; padding: 0 12px 0 10px; border-radius: 999px;
  background: var(--fill);
  font-size: 12.5px; color: var(--text-2); white-space: nowrap;
  transition: transform var(--dur-bounce) var(--spring-bounce);
}
.conn-pill:active { transform: scale(.95); transition-duration: .1s; }
.conn-text { overflow: hidden; text-overflow: ellipsis; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }
[data-f="live"] > .conn-dot { background: var(--done); box-shadow: 0 0 0 3px var(--done-soft); }
[data-f="cached"] > .conn-dot,
[data-f="connecting"] > .conn-dot { background: transparent; box-shadow: inset 0 0 0 2px var(--text-3); }
[data-f="stale"] > .conn-dot { background: var(--wait); box-shadow: 0 0 0 3px var(--wait-soft); }
[data-f="disconnected"] > .conn-dot,
[data-f="offline"] > .conn-dot,
[data-f="failed"] > .conn-dot { background: transparent; box-shadow: inset 0 0 0 2px var(--bad); }
@media (prefers-reduced-motion: no-preference) {
  [data-f="connecting"] > .conn-dot, [data-f="cached"] > .conn-dot { animation: pulse 1.4s ease-in-out infinite; }
}

/* ============ Sync banner ============ */
.sync-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 0 calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left));
  padding: 9px 8px 9px 12px; border-radius: 14px;
  font-size: 13px; line-height: 1.45;
  background: var(--wait-soft); border: 1px solid var(--wait-line);
}
.app[data-layout="desk"] .sync-banner { margin: 8px calc(12px + var(--safe-right)) 0 calc(12px + var(--safe-left)); }
.sync-banner[data-tone="bad"] { background: var(--bad-soft); border-color: var(--bad-line); }
.sync-banner[data-tone="info"] { background: var(--fill); border-color: transparent; }
.sync-banner > svg { width: 18px; height: 18px; color: var(--wait); }
.sync-banner[data-tone="bad"] > svg { color: var(--bad); }
.sync-banner[data-tone="info"] > svg { color: var(--text-3); }
.sb-text { flex: 1; min-width: 0; }
.sb-title { font-weight: 650; }
.sb-sub { color: var(--text-2); font-size: 12.5px; }
.sb-btn {
  flex: none; height: 34px; padding: 0 12px; border-radius: 17px;
  background: var(--chip-bg); box-shadow: inset 0 0 0 .5px var(--line-2);
  font-size: 13px; font-weight: 650; display: inline-flex; align-items: center; gap: 6px;
  transition: transform var(--dur-bounce) var(--spring-bounce);
}
.sb-btn:active { transform: scale(.94); transition-duration: .1s; }
.sb-btn svg { width: 15px; height: 15px; }

/* ============ Toolbar: search + device chips ============ */
.toolbar {
  display: flex; flex-direction: column; gap: 8px;
  padding: 0 calc(12px + var(--safe-right)) 10px calc(12px + var(--safe-left));
}
.search { position: relative; display: flex; align-items: center; min-width: 0; }
.search-ic { position: absolute; left: 11px; width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.search-ic svg { width: 18px; height: 18px; }
.search input {
  width: 100%; height: 42px; padding: 0 40px 0 37px;
  border-radius: 21px; border: 1px solid transparent; background: var(--fill);
  font-size: 16px; /* >=16px prevents iOS zoom on focus */
  -webkit-appearance: none; appearance: none; transition: border-color .15s, background-color .15s;
}
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button, .search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.search input:focus { border-color: var(--accent); background: var(--chip-bg); }
.search-clear { position: absolute; right: 3px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 18px; color: var(--text-3); }
.search-clear svg { width: 16px; height: 16px; }

.chips {
  display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain;
  margin: 0 calc(-12px - var(--safe-right)) 0 calc(-12px - var(--safe-left));
  padding: 0 calc(12px + var(--safe-right)) 0 calc(12px + var(--safe-left));
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 34px; padding: 0 12px; border-radius: 17px;
  background: var(--chip-bg); box-shadow: inset 0 0 0 .5px var(--line);
  font-size: 13px; color: var(--text-2); white-space: nowrap;
  transition: background-color .2s, color .2s, transform var(--dur-bounce) var(--spring-bounce);
}
.chip:active { transform: scale(.94); transition-duration: .1s; }
.chip svg { width: 15px; height: 15px; color: var(--text-3); }
.chip .cnt { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chip .odot { width: 6px; height: 6px; border-radius: 50%; background: var(--done); }
.chip .odot.is-off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-3); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); box-shadow: none; }
.chip[aria-pressed="true"] svg, .chip[aria-pressed="true"] .cnt { color: inherit; opacity: .75; }

/* ============ Status tabs (floating glass tab bar on compact; segmented control elsewhere) ============ */
.status-tabs { display: flex; gap: 2px; isolation: isolate; }
.tab {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  flex: 1 1 0; min-width: 0;
  min-height: 50px; border-radius: 25px; color: var(--text-3);
  font-size: 11.5px; font-weight: 600; transition: color .2s, transform var(--dur-bounce) var(--spring-bounce);
}
.tab:active { transform: scale(.94); transition-duration: .1s; }
.tab-top { display: flex; align-items: center; gap: 5px; }
.tab-top svg { width: 15px; height: 15px; }
.tab-n { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-2); }
.tab[data-s="running"] svg { color: var(--run); }
.tab[data-s="waiting"] svg { color: var(--wait); }
.tab[data-s="done"] svg { color: var(--done); }
.tab[data-s="all"] svg { color: var(--text-3); }
.tab[aria-pressed="true"] { color: var(--text); }
.tab[aria-pressed="true"] .tab-n { color: var(--text); }
.tab[data-s="waiting"][data-has] .tab-n { color: var(--wait); }

/* The "lens" that slides between tabs and briefly stretches while pressed. */
.tab-ind {
  position: absolute; z-index: 0; left: 0; top: 4px; bottom: 4px; width: 0;
  border-radius: 999px; background: var(--glass-lens);
  box-shadow: inset 0 .5px 0 var(--glass-rim-a), 0 2px 8px rgba(0, 0, 0, .08);
  transform: translateX(var(--ind-x, 0px)) scale(var(--ind-s, 1));
  transition: transform var(--dur-bounce) var(--spring-bounce), width var(--dur-bounce) var(--spring-bounce), opacity .2s;
  pointer-events: none;
}
.status-tabs:not([data-ind-ready]) .tab-ind { opacity: 0; transition: none; }

.app[data-layout="compact"] .status-tabs {
  background: var(--glass-tint-chrome); /* busy content passes beneath: favour legibility */
  margin: 0 calc(14px + var(--safe-right)) max(calc(var(--safe-bottom) - 4px), 12px) calc(14px + var(--safe-left));
  padding: 4px; border-radius: 30px;
}
.l-short { display: none; }
.app:not([data-layout="compact"]) .l-long { display: none; }
.app:not([data-layout="compact"]) .l-short { display: inline; }
.app:not([data-layout="compact"]) .tab[data-s="all"] .tab-top svg { display: none; }
@media (min-width: 1100px) {
  .app[data-layout="wide"] .l-long { display: inline; }
  .app[data-layout="wide"] .l-short { display: none; }
}
.app:not([data-layout="compact"]) .status-tabs {
  padding: 3px; margin: 0 12px 10px; border-radius: 19px; background: var(--fill);
}
.app:not([data-layout="compact"]) .tab { flex-direction: row; gap: 6px; min-height: 32px; font-size: 13px; padding: 0 8px; white-space: nowrap; border-radius: 16px; }
.app:not([data-layout="compact"]) .tab-top { display: contents; }
.app:not([data-layout="compact"]) .tab-label { order: 1; }
.app:not([data-layout="compact"]) .tab-n { font-size: 12.5px; order: 2; font-weight: 600; color: var(--text-3); }
.app:not([data-layout="compact"]) .tab-ind { top: 3px; bottom: 3px; }
.app[data-layout="desk"] .status-tabs { margin-bottom: 0; }
.app[data-layout="desk"] .tab { flex: 0 0 auto; padding: 0 10px; }

/* Short landscape, e.g. iPhone Duo's outer display turned sideways (594×406 in Safari 27.1):
   search and device chips share one row, the brand collapses to its icon and the tab bar slims down,
   so the list keeps most of the height. */
@media (orientation: landscape) and (max-height: 480px) {
  .app[data-layout="compact"] .app-header { min-height: 48px; }
  .app[data-layout="compact"] .brand-text { display: none; }
  .app[data-layout="compact"] .toolbar { flex-direction: row; align-items: center; }
  .app[data-layout="compact"] .search { flex: 0 0 min(240px, 42%); }
  .app[data-layout="compact"] .search input { height: 38px; }
  .app[data-layout="compact"] .chips { flex: 1 1 auto; margin: 0 calc(-12px - var(--safe-right)) 0 0; padding-left: 0; }
  .app[data-layout="compact"] .tab { flex-direction: row; gap: 6px; min-height: 38px; font-size: 13px; }
  .app[data-layout="compact"] .tab-top { display: contents; }
  .app[data-layout="compact"] .tab-label { order: 1; }
  .app[data-layout="compact"] .tab-n { order: 2; }
  .app[data-layout="compact"] .status-tabs { padding: 3px; }
}

/* ============ List ============ */
.list-scroll {
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding-top: var(--list-pt, 0px); padding-bottom: var(--list-pb, 0px);
  scroll-padding-top: calc(var(--list-pt, 0px) + 8px); scroll-padding-bottom: calc(var(--list-pb, 0px) + 8px);
}
.task-list {
  display: flex; flex-direction: column; gap: 8px;
  padding: 6px calc(12px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(12px + var(--safe-left));
}
.group-head {
  display: flex; align-items: center; gap: 7px; margin: 0;
  padding: 12px 4px 2px; font-size: 12.5px; font-weight: 650; color: var(--text-3); letter-spacing: .02em;
}
.group-head svg { width: 14px; height: 14px; }
.group-head[data-s="running"] svg { color: var(--run); }
.group-head[data-s="waiting"] svg { color: var(--wait); }
.group-head[data-s="done"] svg { color: var(--done); }
.group-head[data-s="unknown"] svg { color: var(--unk); }
.group-head .gh-n { font-variant-numeric: tabular-nums; font-weight: 600; }
.task-list > .group-head:first-child { padding-top: 4px; }

.card {
  position: relative; display: grid; gap: 5px; width: 100%; min-width: 0;
  padding: 12px 14px 13px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
  transition: border-color .15s, background-color .15s, transform var(--dur-bounce) var(--spring-bounce);
  -webkit-user-select: none; user-select: none;
}
.card:active { transform: scale(.98); transition-duration: .12s; }
@media (hover: hover) { .card:hover { border-color: var(--line-2); } }
.card[data-status="waiting"] { border-color: var(--wait-line); background: linear-gradient(var(--wait-soft), var(--wait-soft)) var(--surface); }
.card[data-status="waiting"]::before {
  content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--wait);
}
.card[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-1); }
.card-meta { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; color: var(--text-3); }
.card-time { margin-left: auto; white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }
.card-title {
  font-size: 15.5px; font-weight: 650; line-height: 1.42; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.card-title.is-missing, .d-title.is-missing { color: var(--text-3); font-weight: 600; }
.card-summary {
  font-size: 13.5px; line-height: 1.5; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.card-summary.is-missing { color: var(--text-3); }
.card-summary .lead { color: var(--wait); font-weight: 600; }
.card-flag { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.card-flag svg { width: 14px; height: 14px; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Status tag: icon + text, never colour alone */
.st {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  height: 22px; padding: 0 8px 0 6px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap;
}
.st svg { width: 14px; height: 14px; }
.st[data-s="running"] { color: var(--run); background: var(--run-soft); }
.st[data-s="waiting"] { color: var(--wait); background: var(--wait-soft); }
.st[data-s="done"] { color: var(--done); background: var(--done-soft); }
.st[data-s="unknown"] { color: var(--unk); background: var(--unk-soft); }
.st .st-ink { stroke: var(--status-ink); }
.st-lg { height: 28px; padding: 0 11px 0 8px; font-size: 13px; }
.st-lg svg { width: 16px; height: 16px; }
.st-spin { transform-origin: 10px 10px; transform-box: view-box; }
@media (prefers-reduced-motion: no-preference) {
  .st[data-live] .st-spin { animation: spin 1.8s linear infinite; }
}
.st-qual { font-weight: 500; opacity: .8; }

.dev { display: inline-flex; align-items: center; gap: 5px; min-width: 0; color: var(--text-2); }
.dev svg { width: 14px; height: 14px; color: var(--text-3); }
.dev-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-off {
  flex: none; font-size: 11px; font-weight: 600; padding: 0 5px; border-radius: 5px;
  color: var(--text-3); box-shadow: inset 0 0 0 1px var(--line-2);
}

/* Skeleton */
.sk { display: grid; gap: 10px; padding: 14px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); }
.sk i { display: block; height: 10px; border-radius: 5px; background: var(--surface-3); }
.sk i:nth-child(1) { width: 38%; }
.sk i:nth-child(2) { width: 82%; height: 13px; }
.sk i:nth-child(3) { width: 64%; }
@media (prefers-reduced-motion: no-preference) {
  .sk i { background: linear-gradient(90deg, var(--surface-3) 20%, var(--surface-2) 50%, var(--surface-3) 80%); background-size: 220% 100%; animation: shimmer 1.5s ease-in-out infinite; }
}
.sk-note { text-align: center; font-size: 13px; color: var(--text-3); padding: 6px 0 2px; }

/* Empty / error states */
.list-state {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 44px 28px 56px; color: var(--text-2);
}
.ls-ic { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; background: var(--fill); color: var(--text-3); margin-bottom: 4px; }
.ls-ic svg { width: 24px; height: 24px; }
.ls-ic[data-tone="bad"] { background: var(--bad-soft); color: var(--bad); }
.ls-title { font-size: 16.5px; font-weight: 700; color: var(--text); }
.ls-desc { font-size: 13.5px; line-height: 1.6; max-width: 30em; }
.ls-desc .mono { font-size: 12px; }
.ls-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 42px; padding: 0 18px; border-radius: 21px;
  background: var(--chip-bg); box-shadow: inset 0 0 0 .5px var(--line-2);
  font-size: 14px; font-weight: 650; white-space: nowrap;
  transition: background-color .15s, transform var(--dur-bounce) var(--spring-bounce);
}
.btn:active { transform: scale(.96); transition-duration: .1s; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--text); color: var(--bg); box-shadow: none; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 17px; }
@media (hover: hover) { .btn:not(.btn-primary):hover { background: var(--fill-2); } }

/* ============ Detail ============ */
.detail-pane {
  display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  background: var(--bg); min-height: 0; overflow: hidden;
}
.detail-topbar {
  grid-area: 1 / 1; align-self: start; z-index: 2; position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-top) + 8px) calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left));
  pointer-events: none;
}
.detail-topbar > * { pointer-events: auto; }
/* Scroll edge effect: a soft blurred fade that appears once content scrolls under the buttons. */
.detail-topbar::before {
  content: ""; position: absolute; inset: 0 0 -24px; z-index: -1; pointer-events: none;
  background: linear-gradient(var(--bg) 62%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent);
  opacity: 0; transition: opacity .25s;
}
.detail-topbar[data-edge]::before { opacity: 1; }
.app[data-layout="wide"] .detail-topbar { padding-left: 14px; }
/* This strip can be painted but iOS intercepts touches there. Use it only for the
   existing passive app title; all buttons retain their full top safe-area padding. */
:root[data-tall-top] .app[data-layout="wide"] .brand-text {
  display: flex; position: absolute; left: calc(14px + var(--safe-left)); top: 16px;
  max-width: calc(100% - 28px); pointer-events: none;
}
/* Only the wide layout has a list to hide (more specific than .glass-btn, which is defined later). */
.detail-topbar .focus-btn { display: none; }
.app[data-layout="wide"] .detail-topbar .focus-btn { display: inline-flex; padding: 0 14px; }
.focus-btn[aria-pressed="true"] { color: var(--accent); }

.glass-btn {
  flex: none; height: 44px; padding: 0 16px; border-radius: 22px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 14px; font-weight: 600; color: var(--text);
  transition: transform var(--dur-bounce) var(--spring-bounce), color .2s;
}
.glass-btn.is-round { width: 44px; padding: 0; }
.glass-btn svg { width: 18px; height: 18px; }
.glass-btn.is-round svg { width: 22px; height: 22px; }
.glass-btn:active { transform: scale(.9); transition-duration: .1s; }
.glass-btn[data-done] { color: var(--done); }
#copyTaskBtn { margin-left: auto; }

.topbar-title {
  flex: 1 1 auto; min-width: 0; text-align: center; font-size: 15px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translateY(6px); transition: opacity .25s, transform var(--dur-spring) var(--spring);
}
.detail-topbar[data-scrolled] .topbar-title { opacity: 1; transform: none; }
.desk-glance { display: none; }
.app[data-layout="desk"] .desk-glance,
.app[data-layout="wide"][data-focus] .desk-glance {
  display: flex; align-items: center; gap: 12px; flex: none; min-width: 0;
  height: 40px; padding: 0 14px; border-radius: 20px; font-size: 12.5px; color: var(--text-2);
}
.app[data-layout="desk"] .detail-topbar[data-scrolled] .desk-glance .dg-counts,
.app[data-layout="wide"][data-focus] .detail-topbar[data-scrolled] .desk-glance .dg-counts { display: none; }
@media (max-width: 760px) { .app[data-layout="wide"][data-focus] .dg-counts { display: none; } }
.dg-conn { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.dg-counts { display: inline-flex; gap: 10px; white-space: nowrap; color: var(--text-3); }
.dg-counts b { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.dg-counts .w b { color: var(--wait); }
@media (max-width: 460px) { .app[data-layout="desk"] .dg-counts { display: none; } }

.text-btn {
  flex: none; height: 36px; padding: 0 12px; border-radius: 18px; margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
  transition: background-color .15s, color .15s, transform var(--dur-bounce) var(--spring-bounce);
}
.text-btn svg { width: 16px; height: 16px; }
.text-btn:active { background: var(--fill); transform: scale(.95); transition-duration: .1s; }
@media (hover: hover) { .text-btn:hover { background: var(--fill); color: var(--text); } }
.text-btn[data-done] { color: var(--done); }

.detail-scroll {
  grid-area: 1 / 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  container-type: inline-size; container-name: detail;
  scroll-padding-top: var(--topbar-h, 60px);
}
.detail {
  max-width: 800px; margin: 0 auto;
  padding: calc(var(--topbar-h, 60px) + 4px) calc(18px + var(--safe-right)) calc(40px + var(--safe-bottom)) calc(18px + var(--safe-left));
}
.app[data-layout="wide"] .detail { padding-left: 28px; padding-right: calc(28px + var(--safe-right)); }
.app[data-layout="desk"] .detail { max-width: 1100px; padding-bottom: 28px; }

.d-statusline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.d-statusline .dev { font-size: 13px; }
.d-title {
  margin: 12px 0 6px; font-size: 22px; line-height: 1.38; font-weight: 700; letter-spacing: -.005em;
  overflow-wrap: anywhere;
}
@container detail (min-width: 640px) { .d-title { font-size: 25px; } }
.app[data-layout="desk"] .d-title { font-size: 20px; margin-top: 8px; }
.d-sub { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; color: var(--text-3); }
.d-sub span { white-space: nowrap; }

.note {
  display: flex; gap: 10px; margin-top: 12px; padding: 11px 13px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.6; background: var(--surface-2); color: var(--text-2);
}
.note > svg { width: 18px; height: 18px; margin-top: 2px; color: var(--text-3); }
.note b { color: var(--text); font-weight: 650; }
.note--wait { background: var(--wait-soft); border: 1px solid var(--wait-line); color: var(--text); }
.note--wait > svg { color: var(--wait); }
.note--wait .nw-reason { display: block; font-size: 15px; font-weight: 650; margin: 2px 0 4px; overflow-wrap: anywhere; }
.note--wait .nw-hint { display: block; color: var(--text-2); font-size: 12.5px; }
.note--stale > svg { color: var(--wait); }
.note--off > svg { color: var(--text-3); }

.d-sec { margin-top: 26px; }
.d-sec-h { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; min-height: 28px; font-size: 13px; font-weight: 650; color: var(--text-3); letter-spacing: .02em; }
.d-sec-h .meta-t { font-weight: 500; font-size: 12.5px; }
.d-sec-h .text-btn { height: 32px; padding: 0 10px; font-size: 13px; }

.act { list-style: none; margin: 0; padding: 0; }
.act li { position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 10px; padding: 5px 0; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.act li::before { content: ""; grid-column: 1; width: 7px; height: 7px; margin: 7px auto 0; border-radius: 50%; background: var(--line-2); }
.act li:not(:last-child)::after { content: ""; position: absolute; left: 7.5px; top: 20px; bottom: -6px; width: 1px; background: var(--line); }
.act li:first-child { color: var(--text); }
.act li:first-child::before { background: var(--text-2); }
.act .a-text { overflow-wrap: anywhere; }
.act time { font-size: 12px; color: var(--text-3); white-space: nowrap; padding-top: 2px; font-variant-numeric: tabular-nums; }
.act-more { margin: 4px 0 0 18px; height: 32px; padding: 0 10px; font-size: 13px; }
/* Collapsible activity header (done tasks). */
.act-toggle {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px; margin-left: -6px; padding: 0 10px 0 6px;
  border-radius: 16px; font: inherit; color: inherit; letter-spacing: inherit;
  transition: background-color .15s, transform var(--dur-bounce) var(--spring-bounce);
}
.act-toggle:active { transform: scale(.96); transition-duration: .1s; }
.act-toggle > svg { width: 14px; height: 14px; transition: transform .25s var(--spring); }
.act-toggle[aria-expanded="true"] > svg { transform: rotate(90deg); }
.act-toggle-hint { font-weight: 600; font-size: 12.5px; color: var(--accent); }
@media (hover: hover) { .act-toggle:hover { background: var(--fill); } }
.muted-line { font-size: 13.5px; color: var(--text-3); }

.reply {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 18px 18px 22px;
}
@container detail (max-width: 420px) { .reply { padding: 16px 14px 20px; border-radius: 16px; } }
.reply-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; border-radius: 18px; border: 1px dashed var(--line-2); color: var(--text-2); font-size: 14px; line-height: 1.6; }
.reply-empty b { color: var(--text); font-size: 15px; }
.reply-empty .mono { font-size: 12.5px; color: var(--text-3); }

.meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 16px; margin: 0; font-size: 13px; }
.meta dt { color: var(--text-3); }
.meta dd { margin: 0; color: var(--text-2); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.meta .mono { font-size: 12.5px; }

.d-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; min-height: 60vh; padding: 32px; color: var(--text-2); }
.app[data-layout="desk"] .d-empty { min-height: 0; padding: 40px 24px; }

@container detail (min-width: 980px) {
  .detail {
    max-width: 1240px;
    display: grid; grid-template-columns: minmax(0, 1fr) 300px; column-gap: 40px; align-items: start;
    /* Activity sits beside the header so it is in view on open, whatever the task status. */
    grid-template-areas: "head act" "reply act" "reply meta" "reply rest";
    grid-template-rows: auto auto auto 1fr;
  }
  .d-act.d-sec { margin-top: 4px; }
  .d-head { grid-area: head; }
  .d-act { grid-area: act; }
  .d-reply { grid-area: reply; }
  .d-meta { grid-area: meta; }
  .d-head .d-title { max-width: 34em; }
}
@container detail (min-width: 720px) {
  .app[data-layout="desk"] .detail {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 30%); column-gap: 28px; align-items: start;
    grid-template-areas: "head act" "reply act" "reply meta" "reply rest";
    grid-template-rows: auto auto auto 1fr;
  }
  .app[data-layout="desk"] .d-head { grid-area: head; }
  .app[data-layout="desk"] .d-act { grid-area: act; }
  .app[data-layout="desk"] .d-reply { grid-area: reply; }
  .app[data-layout="desk"] .d-meta { grid-area: meta; }
  .app[data-layout="desk"] .d-reply.d-sec { margin-top: 18px; }
  .app[data-layout="desk"] .d-act.d-sec { margin-top: 0; }
}

/* ============ Sheets (dialogs) ============ */
dialog.sheet {
  border: 0; padding: 0; color: var(--text);
  width: min(560px, calc(100vw - 32px)); max-width: none; max-height: min(86vh, 780px);
  border-radius: 30px; overflow: hidden;
}
dialog.sheet::backdrop { background: var(--scrim); }
@supports (height: 100dvh) { dialog.sheet { max-height: min(86dvh, 780px); } }
@media (max-width: 639px) {
  /* iOS 26-style floating sheet: inset from the screen edges with large concentric corners. */
  dialog.sheet {
    width: calc(100% - 16px - var(--safe-left) - var(--safe-right));
    margin: auto auto max(8px, var(--safe-bottom)); border-radius: 34px; max-height: 88vh;
  }
  @supports (height: 100dvh) { dialog.sheet { max-height: 88dvh; } }
}
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] { animation: sheet-pop var(--dur-spring) var(--spring); }
  dialog.sheet[open]::backdrop { animation: fade-in .25s ease; }
  @media (max-width: 639px) { dialog.sheet[open] { animation: sheet-up var(--dur-spring) var(--spring); } }
  dialog.sheet[data-closing] { animation: sheet-out .22s cubic-bezier(.4, 0, 1, 1) forwards; }
  dialog.sheet[data-closing]::backdrop { animation: fade-out .22s ease forwards; }
  @media (max-width: 639px) { dialog.sheet[data-closing] { animation: sheet-down .24s cubic-bezier(.4, 0, 1, 1) forwards; } }
}
dialog.sheet[data-dragging] { animation: none !important; transition: none !important; }
.sheet-wrap { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 12px 8px 22px; flex: none; touch-action: none; }
.sheet-head h2 { margin: 0; font-size: 18px; font-weight: 700; flex: 1; min-width: 0; }
.sheet-head .icon-btn { background: var(--fill); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 2px 20px calc(24px + var(--safe-bottom)); }
@media (max-width: 639px) { .sheet-body { padding-bottom: 22px; } }
.grab { display: none; }
@media (max-width: 639px) {
  .grab { display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); margin: 8px auto 0; flex: none; touch-action: none; }
  .sheet-head { padding-top: 6px; }
}

.set-group { margin-top: 18px; }
.set-group:first-child { margin-top: 4px; }
.set-group > h3 { margin: 0 0 8px; font-size: 12.5px; font-weight: 650; color: var(--text-3); letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.set-card { background: var(--fill); border-radius: 18px; overflow: hidden; }
.set-row { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 11px 14px; font-size: 14.5px; }
.set-row + .set-row { border-top: .5px solid var(--line-2); }
.set-row > svg { width: 18px; height: 18px; color: var(--text-3); }
.set-row .sr-main { flex: 1; min-width: 0; }
.set-row .sr-title { display: block; }
.set-row .sr-desc { display: block; font-size: 12.5px; color: var(--text-3); line-height: 1.5; margin-top: 2px; }
.set-row .sr-val { font-size: 13px; color: var(--text-2); text-align: right; }
.set-row.is-stack { flex-direction: column; align-items: stretch; gap: 10px; }
button.set-row { width: 100%; text-align: left; }
.set-note { font-size: 12.5px; line-height: 1.6; color: var(--text-3); margin: 8px 4px 0; }

.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 10px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--fill-2); color: var(--text-2);
}
.tag--ok { background: var(--done-soft); color: var(--done); }
.tag--warn { background: var(--wait-soft); color: var(--wait); }
.tag--bad { background: var(--bad-soft); color: var(--bad); }
.tag--demo { background: repeating-linear-gradient(-45deg, var(--wait-soft) 0 6px, transparent 6px 12px); color: var(--wait); box-shadow: inset 0 0 0 1px var(--wait-line); }

.seg { display: flex; gap: 2px; padding: 3px; border-radius: 19px; background: var(--fill); }
.seg button { flex: 1 1 0; min-height: 34px; padding: 0 8px; border-radius: 16px; font-size: 13.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; transition: background-color .25s, color .25s; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); box-shadow: var(--shadow-1); }

.switch { position: relative; width: 50px; height: 30px; flex: none; border-radius: 999px; background: var(--fill-2); transition: background-color .25s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform var(--dur-bounce) var(--spring-bounce), width .2s; }
.switch:active::after { width: 32px; }
.switch[aria-checked="true"] { background: var(--done); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch[aria-checked="true"]:active::after { transform: translateX(14px); }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.conn-hero { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; background: var(--fill); }
.conn-hero .conn-dot { width: 12px; height: 12px; }
.conn-hero b { display: block; font-size: 16px; }
.conn-hero span { font-size: 13px; color: var(--text-2); }
.dev-row { display: flex; align-items: center; gap: 10px; }
.dev-row svg { width: 18px; height: 18px; color: var(--text-3); }

.demo-banner {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 16px; margin-bottom: 4px;
  font-size: 13px; line-height: 1.55; color: var(--text-2);
  background: repeating-linear-gradient(-45deg, var(--wait-soft) 0 8px, transparent 8px 16px); border: 1px solid var(--wait-line);
}
.demo-banner svg { width: 18px; height: 18px; color: var(--wait); margin-top: 1px; }
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.demo-grid .btn { height: auto; min-height: 48px; padding: 8px 14px; border-radius: 16px; white-space: normal; text-align: left; justify-content: flex-start; line-height: 1.35; font-size: 13.5px; }
.demo-grid .btn small { display: block; font-weight: 500; font-size: 11.5px; color: var(--text-3); }
.demo-status { font-size: 12.5px; color: var(--text-3); margin-top: 8px; font-variant-numeric: tabular-nums; }

/* ============ Layout menu (grows out of its button) ============ */
.menu {
  position: fixed; z-index: 70; min-width: 260px; max-width: calc(100vw - 16px);
  border-radius: 24px; padding: 6px; transform-origin: top right;
}
@media (prefers-reduced-motion: no-preference) { .menu:not([hidden]) { animation: menu-in var(--dur-bounce) var(--spring-bounce); } }
.menu-item { position: relative; z-index: 3; display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border-radius: 18px; text-align: left; font-size: 14.5px; min-height: 50px; transition: background-color .15s; }
.menu-item > svg { width: 20px; height: 20px; color: var(--text-3); }
.menu-item .mi-main { flex: 1; min-width: 0; }
.menu-item small { display: block; font-size: 12px; color: var(--text-3); line-height: 1.4; }
.menu-item .mi-check { width: 18px; height: 18px; color: var(--accent); visibility: hidden; }
.menu-item[aria-checked="true"] .mi-check { visibility: visible; }
.menu-item[aria-checked="true"] { background: var(--fill); }
.menu-item:active { background: var(--fill-2); }
@media (hover: hover) { .menu-item:hover { background: var(--fill); } }
.menu-sep { height: .5px; background: var(--line-2); margin: 5px 10px; }
.menu-foot { font-size: 12px; color: var(--text-3); padding: 6px 12px 6px; line-height: 1.5; }

/* ============ Toast ============ */
.toast-region {
  position: fixed; left: 0; right: 0; z-index: 80; pointer-events: none;
  bottom: var(--toast-bottom, calc(20px + var(--safe-bottom)));
  display: flex; justify-content: center; padding: 0 16px;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 9px; max-width: 460px;
  padding: 10px 10px 10px 16px; border-radius: 24px; min-height: 46px;
  background: var(--glass-tint-strong); color: var(--text);
  font-size: 13.5px; font-weight: 500; line-height: 1.45;
}
.toast > svg { width: 17px; height: 17px; color: var(--done); }
.toast[data-tone="bad"] > svg { color: var(--bad); }
.toast > * { position: relative; z-index: 3; }
.toast-act { height: 32px; padding: 0 12px; border-radius: 16px; font-weight: 700; font-size: 13px; background: var(--fill-2); }
.toast:not(:has(.toast-act)) { padding-right: 18px; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: toast-in var(--dur-bounce) var(--spring-bounce); } }

/* ============ Keyframes & motion ============ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes sheet-pop { from { transform: scale(.94); opacity: 0; } }
@keyframes sheet-out { to { transform: scale(.96); opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(105%); } }
@keyframes sheet-down { from { transform: translateY(var(--drag-y, 0px)); } to { transform: translateY(105%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes menu-in { from { transform: scale(.4, .3); opacity: 0; } 40% { opacity: 1; } }
@keyframes toast-in { from { transform: translateY(16px) scale(.9); opacity: 0; } }
@keyframes flash { from { background-color: var(--accent-soft); } }

@media (prefers-reduced-motion: no-preference) {
  .card.is-updated { animation: flash 1.2s ease-out; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
