/* One motion system (docs/BUILD-WEB-NEXT.md item 7), on the tokens in design/mock.css.
   Screen change: fade + 8 px, 180 ms. Phone push: from the side, 240 ms, spring. New message or step: fade up, 160 ms,
   40 ms apart, at most 6 (morph.js marks them .sw-in). Progress bar: 400 ms. Press: 0.97 at 90 ms.
   Sheets and menus keep mock.css's scale .98 + fade. All of it is off under prefers-reduced-motion. */

@keyframes sw-screen-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes sw-push-in { from { opacity: .4; transform: translateX(calc(28px * var(--flip, 1))); } }
@keyframes sw-row-in { from { opacity: 0; transform: translateY(6px); } }

#app.sw-enter .w-main > * { animation: sw-screen-in 180ms var(--ease) both; }
#app.sw-enter .p-device > .phone { animation: sw-push-in 240ms var(--ease-spring) both; }
.sw-in { animation: sw-row-in 160ms var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }

#app button:not(:disabled):active, #app .chip:active, #app [data-action]:not(:disabled):active { transform: scale(.97); transition: transform 90ms var(--ease); }

/* ---------------------------------------------------------------- progress card (item 3) */
.wp { margin: 2px 0 8px; padding: 10px 12px 9px; border-radius: var(--r-md); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); max-width: 560px; }
.wp-bar { position: relative; height: 4px; border-radius: var(--r-pill); background: var(--chalk); overflow: hidden; }
.wp-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: inherit; background: var(--mint); transition: width 400ms var(--ease); }
.wp-bar.ind .wp-fill { width: 32%; animation: sw-wp-slide 1.4s var(--ease) infinite; }
@keyframes sw-wp-slide { from { transform: translateX(calc(-100% * var(--flip, 1))); } to { transform: translateX(calc(320% * var(--flip, 1))); } }
.wp-row { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; font-size: 14px; }
.wp-row b { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-row time { flex: none; font-size: 12px; color: var(--stone); font-variant-numeric: tabular-nums; }
.wp-done { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }
.wp-done li { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--stone); }
.wp-done li svg { width: 14px; height: 14px; flex: none; color: var(--green); }
.wp-end { max-height: 400px; animation: sw-wp-fold 600ms var(--ease) 900ms both; overflow: hidden; }
@keyframes sw-wp-fold { to { opacity: 0; max-height: 0; padding-block: 0; margin-block: 0; } }
html[data-theme="dark"] .wp { background: var(--graphite-2); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
html[data-theme="dark"] .wp-bar { background: rgba(255,255,255,.1); }

/* ---------------------------------------------------------------- no layout jumps */
/* Comparison tables scroll sideways on the phone instead of pushing the page wider. */
html[data-device="phone"] .bubble table, html[data-device="phone"] .sw-md table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (prefers-reduced-motion: reduce) {
  #app.sw-enter .w-main > *, #app.sw-enter .p-device > .phone, .sw-in, .wp-end { animation: none; }
  .wp-bar.ind .wp-fill { animation: none; inset-inline-start: 34%; }
  .wp-fill { transition: none; }
  #app button:active, #app .chip:active, #app [data-action]:active { transform: none; }
}

/* A text file the agent made: its first lines, in a fixed-height box so nothing moves when they arrive. */
.sw-peek-body { display: block; width: 100%; height: 132px; padding: 12px 14px; border: 0; background: var(--chalk); text-align: start; cursor: pointer; overflow: hidden; }
.sw-peek-t { margin: 0; font: 12.5px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--graphite); white-space: pre-wrap; word-break: break-word; overflow: hidden; max-height: 108px; }
.sw-peek.none .sw-peek-body { display: none; }
html[data-theme="dark"] .sw-peek-body { background: rgba(255,255,255,.06); }
html[data-theme="dark"] .sw-peek-t { color: var(--chalk); }

/* ---------------------------------------------------------------- Folders (item 1, folders.js) */
.fl-layer { position: fixed; inset: 0; z-index: 9500; display: grid; place-items: center; }
.fl-scrim { position: absolute; inset: 0; background: rgba(29,32,35,.38); animation: sw-row-in 160ms var(--ease) both; }
.fl-sheet { position: relative; width: min(520px, calc(100% - 28px)); max-height: calc(100% - 40px); overflow: auto; background: var(--paper); color: var(--graphite); border-radius: var(--r-lg); box-shadow: var(--s3); padding: 22px 22px 18px; animation: sw-sheet-in 160ms var(--ease) both; }
@keyframes sw-sheet-in { from { opacity: 0; transform: scale(.98); } }
.fl-sheet h2 { margin: 0 34px 14px 0; font: 600 19px/1.3 var(--display); }
.fl-x { position: absolute; top: 14px; inset-inline-end: 14px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--chalk); display: grid; place-items: center; cursor: pointer; }
.fl-x svg { width: 16px; height: 16px; }
.fl-sheet form label { display: grid; gap: 6px; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
.fl-sheet form label small { font-weight: 400; color: var(--stone); }
.fl-sheet input:not([type=file]), .fl-sheet textarea, .fl-sheet select { font: inherit; font-weight: 400; padding: 9px 11px; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; color: inherit; width: 100%; box-sizing: border-box; }
.fl-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.fl-note { color: var(--stone); font-size: 13px; margin: 10px 0 0; }
.btn.danger { color: var(--danger); }
.fl-ways { display: grid; gap: 8px; }
.fl-way { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.fl-way:hover { background: var(--chalk); }
.fl-way > svg { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.fl-way span { display: grid; gap: 3px; flex: 1; min-width: 0; }
.fl-way small { color: var(--stone); }
.fl-gh input { margin-top: 4px; }
.fl-gh .btn { justify-self: start; margin-top: 6px; }
.fl-prog { margin-bottom: 12px; display: grid; gap: 6px; }
.fl-prog small { color: var(--stone); }
.fl-files { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
.fl-files li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.fl-files li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-files li small { color: var(--stone); flex: none; }
.fl-pick { display: grid; gap: 4px; }
.fl-pick button { display: flex; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: var(--r-sm); background: none; text-align: start; font: inherit; cursor: pointer; color: inherit; }
.fl-pick button:hover, .fl-pick button.on { background: var(--chalk); }
.fl-pick svg { width: 18px; height: 18px; }
.sw-foldpill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; margin-inline-start: 6px; border: 0; border-radius: var(--r-pill); background: var(--mint-tint); color: var(--graphite); font: 600 13px var(--ui); cursor: pointer; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-dock > .sw-foldpill { margin: 0 4px 8px; }
.sw-foldhead h1 svg { width: 22px; height: 22px; vertical-align: -3px; }
.sw-foldempty svg { width: 40px; height: 40px; color: var(--stone); }
.sw-foldempty .acts { display: flex; gap: 8px; margin-top: 10px; }
.sw-foldchips .chip.add svg { width: 14px; height: 14px; }
.sw-foldbar { margin: 4px 0 10px; padding: 12px; border-radius: var(--r-md); background: var(--chalk); display: grid; gap: 4px; }
.sw-foldbar small { color: var(--stone); }
.sw-foldbar .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.sw-foldbar .chip svg { width: 14px; height: 14px; }
html[data-theme="dark"] .fl-sheet { background: var(--graphite-2); color: var(--chalk); }
html[data-theme="dark"] .fl-sheet input:not([type=file]), html[data-theme="dark"] .fl-sheet textarea, html[data-theme="dark"] .fl-sheet select { background: var(--graphite); border-color: rgba(255,255,255,.14); }
html[data-theme="dark"] .fl-x, html[data-theme="dark"] .fl-pick button.on, html[data-theme="dark"] .sw-foldbar { background: rgba(255,255,255,.08); }
@media (prefers-reduced-motion: reduce) { .fl-scrim, .fl-sheet { animation: none; } }

/* ---------------------------------------------------------------- Your keys and GitHub (item 4, keys.js) */
.kc-list { list-style: none; margin: 0 0 14px; padding: 0; }
.kc-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kc-list li > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.kc-list b { font: 600 13.5px ui-monospace, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; }
.kc-list small { color: var(--stone); font-size: 12.5px; }
.kc-acts { display: flex; gap: 4px; align-items: center; }
.kc-form { margin-top: 6px; }
.kc-code { font: 700 28px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .12em; text-align: center; margin: 12px 0; padding: 12px; border-radius: var(--r-md); background: var(--chalk); user-select: all; }
.kc-gh { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--graphite); color: #fff; flex: none; }
.kc-gh svg { width: 20px; height: 20px; }
.ps-li .kc-gh { width: 24px; height: 24px; border-radius: 7px; }
.ps-li .kc-gh svg { width: 15px; height: 15px; }
.sw-keyask input[name=secret] { width: 100%; box-sizing: border-box; margin: 6px 0 10px; letter-spacing: .08em; }
.sw-keyask .acts { flex-wrap: wrap; }
.sw-pushsum { white-space: pre-wrap; font-size: 13.5px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--chalk); max-height: 220px; overflow: auto; }
html[data-theme="dark"] .kc-code, html[data-theme="dark"] .sw-pushsum { background: rgba(255,255,255,.08); }

/* GitHub card (keys.js): Connect, or Choose repositories and Disconnect */
.kc-ghacts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.ps-li .pbtn + .pbtn { margin-left: 6px; }
/* GitHub repositories (repotask.js, repochoice.js) */
.rt-sheet { width: min(560px, 100%); }
.rt-search { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: inherit; font: inherit; margin: 6px 0 10px; }
.rt-repos { max-height: min(52vh, 420px); overflow-y: auto; overflow-x: hidden; }
.rt-list { display: flex; flex-direction: column; gap: 2px; }
.rt-repo { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; text-align: start; }
.rt-repo:hover, .rt-repo:focus-visible { background: color-mix(in srgb, var(--graphite) 7%, transparent); }
.rt-repo > svg, .rt-repo > .rt-mark { width: 16px; height: 16px; flex: none; margin-top: 2px; opacity: .8; }
.rt-repo .tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.rt-repo .tx b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-repo small { opacity: .7; }
.rt-repo .rt-desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-foot { margin-top: 10px; }
.rt-chip { display: inline-flex; align-items: center; gap: 6px; margin: 6px 8px 0; padding: 4px 6px 4px 10px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; max-width: calc(100% - 16px); }
.rt-chip svg, .rt-chip img { width: 14px; height: 14px; flex: none; }
.rt-chip b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-chip small { opacity: .65; }
.rt-chipx { all: unset; cursor: pointer; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; }
.rt-chipx:hover { background: color-mix(in srgb, var(--graphite) 10%, transparent); }
.rt-chipx svg { width: 12px; height: 12px; }
.w-int .kc-ghacts { flex-direction: column; align-items: stretch; flex: none; }
.bz-mention .rt-mark, .bz-mention img[src*="github"] { width: 16px; height: 16px; }
.msg.me .rt-sent { margin: 0 0 2px auto; }
.bz-mention { max-height: min(50vh, 380px); overflow-y: auto; }

.wp-now { display: block; margin-top: 4px; color: var(--stone); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
