:root {
  --bg: #0b0c10;
  --bg-2: #0f1116;
  --panel: #12141a;
  --panel-2: #171a22;
  --panel-3: #1d212b;
  --border: #22262f;
  --border-2: #2c313c;
  --text: #e7e9ef;
  --text-2: #b9bfcc;
  --muted: #868d9c;
  --faint: #596070;
  --accent: #8aa4ff;
  --accent-2: #6f8cff;
  --accent-ink: #0b1030;
  /* Your messages in a chat: the accent, deep. */
  --mine: color-mix(in srgb, var(--accent-2) 30%, var(--bg));
  --working: #5cb2ff;
  --blocked: #ffb648;
  --idle: #42d392;
  --unknown: #6b7282;
  --danger: #ff6b6b;
  --mono: "JetBrains Mono", "SF Mono", SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --warn-ink: var(--warn-ink);
  --bad-ink: var(--bad-ink);
  --ok-ink: var(--ok-ink);
  --gk: var(--gk);
  --code-ink: var(--code-ink);
  --add-ink: var(--add-ink);
  --del-ink: var(--del-ink);
  --bar-bg: rgba(11,12,16,.92);
  --overlay: rgba(15,17,22,.88);
  --check-a: #1b1e26;
  --check-b: #12141a;
  --shadow: rgba(0,0,0,.42);
  --scrim: rgba(0,0,0,.55);
  /* Text size (Settings → Appearance) for conversations, terminals and files. */
  --ts: 1;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
/* Light (Settings → Appearance; "System" follows the phone). */
:root[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-2: #eceef2;
  --panel: #ffffff;
  --panel-2: #f1f3f6;
  --panel-3: #e6e9ef;
  --border: #dde1e8;
  --border-2: #c9cfd9;
  --text: #151820;
  --text-2: #363d4b;
  --muted: #5f6879;
  --faint: #868e9e;
  --accent: #3858d6;
  --accent-2: #2c49bd;
  --accent-ink: #ffffff;
  --mine: color-mix(in srgb, var(--accent) 11%, #ffffff);
  --working: #1971c2;
  --blocked: #b45f00;
  --idle: #138a50;
  --unknown: #8b93a3;
  --danger: #cf2f2f;
  --warn-ink: #7a4300;
  --bad-ink: #a32121;
  --ok-ink: #0d6e40;
  --gk: #0f7d4b;
  --code-ink: #2a3a8f;
  --add-ink: #0b6f38;
  --del-ink: #ad2323;
  --bar-bg: rgba(245,246,248,.9);
  --overlay: rgba(255,255,255,.92);
  --check-a: #e4e7ec;
  --check-b: #ffffff;
  --shadow: rgba(20,24,35,.16);
  --scrim: rgba(10,12,18,.35);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
#app { height: 100%; display: flex; flex-direction: column; }
.boot { margin: auto; color: var(--faint); font-weight: 650; letter-spacing: .04em; }

/* ---------------------------------------------------------------- chrome */
.bar {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-top) + 10px) 14px 10px;
  background: var(--bar-bg);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 5;
}
.bar h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .sub { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); flex: none; }
.icon-btn:active { background: var(--panel-3); }
.icon-btn svg { width: 20px; height: 20px; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 0 calc(var(--safe-bottom) + 24px); }

/* ---------------------------------------------------------------- home */
.home-bar { border-bottom-color: transparent; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; padding-bottom: 4px; }
.home-bar .grow { flex: 1; }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 17px; font-weight: 700; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.avatar svg { width: 20px; height: 20px; }
.avatar:active { opacity: .8; }
.round-btn { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--text); background: var(--panel-2); }
.round-btn svg { width: 20px; height: 20px; }
.round-btn:active, .round-btn.on { background: var(--panel-3); }
.round-btn[hidden] { display: none; }
.home-title { margin: 6px 16px 14px; font-size: 32px; font-weight: 750; letter-spacing: -.02em; }
.home-search { display: flex; align-items: center; gap: 8px; margin: 0 16px 12px; padding: 0 12px; height: 44px; border-radius: 12px; background: var(--panel-2); color: var(--muted); }
.home-search svg { width: 18px; height: 18px; flex: none; }
.home-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; }
.search-hint { padding: 6px 20px 12px; font-size: 13.5px; color: var(--muted); }
.tiles { display: flex; gap: 4px; padding: 0 12px 4px; overflow-x: auto; scrollbar-width: none; }
.tiles::-webkit-scrollbar { display: none; }
.tile { flex: none; display: flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 99px; color: var(--muted); transition: background .15s, color .15s; }
.tile:active { background: var(--panel-2); }
.tile.on { background: var(--panel-2); }
.tile-l { display: flex; align-items: baseline; gap: 6px; font-size: 14.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tile.on .tile-l { color: var(--text); }
.tile-l b { font-weight: 500; color: var(--faint); font-variant-numeric: tabular-nums; }
.tile.hot .tile-l b { color: var(--blocked); font-weight: 650; }
.group-head.pcs { padding-top: 26px; padding-right: 8px; }
.group-head.pcs .icon-btn { margin-left: auto; color: var(--muted); }
.icon-btn.spin svg { animation: turn .8s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
.pc-list { display: grid; padding: 0 8px; }
.pc-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pc-row { display: flex; flex: 1; align-items: center; gap: 14px; padding: 10px 8px; border-radius: 12px; text-align: left; min-width: 0; }
.pc-add { width: 36px; height: 36px; margin-right: 4px; }
.pc-add svg { width: 18px; height: 18px; }
.pc-row:active { background: var(--panel-2); }
.pc-ic { display: grid; flex: none; color: var(--faint); }
.pc-ic.on { color: var(--idle); }
.pc-ic svg { width: 24px; height: 24px; }
.pc-t { display: grid; gap: 2px; min-width: 0; }
.pc-t b { font-size: 15.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-t small { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .icon-btn.spin svg { animation: none; } }

/* ---------------------------------------------------------------- list */
.group-head { display: flex; align-items: center; gap: 8px; padding: 18px 16px 8px; font-size: 12px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.group-head .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; padding: 2px 8px; border-radius: 99px; background: var(--panel-3); color: var(--muted); white-space: nowrap; }
.pill.live { background: color-mix(in srgb, var(--idle) 12%, transparent); color: var(--idle); }
.pill.warn { background: color-mix(in srgb, var(--blocked) 12%, transparent); color: var(--blocked); }
.pill.bad { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.group-head .pill { margin-left: auto; }
.group-head.sub { padding-top: 14px; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text-2); }
.group-head .via { color: var(--faint); font-weight: 500; font-size: 12px; }
.group-head.fold { width: 100%; text-align: left; cursor: pointer; -webkit-user-select: none; user-select: none; }
.group-head.fold:active .name { color: var(--text-2); }
.fchev { display: grid; flex: none; margin: 0 -2px 0 -4px; color: var(--faint); transform: rotate(90deg); transition: transform .15s; }
.fchev svg { width: 14px; height: 14px; }
.group-head.shut .fchev { transform: none; }
.fsum { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); white-space: nowrap; }
.fsum b { font-weight: 600; color: var(--blocked); }
/* A host's folders on the home screen. */
.folder + .folder { margin-top: 6px; }
.folder-head { display: flex; align-items: center; gap: 4px; padding: 2px 10px 6px 26px; }
.folder .cards { padding-left: 26px; }
.ficon { display: grid; flex: none; margin-right: -2px; color: var(--muted); }
.ficon svg { width: 16px; height: 16px; }
.folder-fold { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px 0; text-align: left; -webkit-user-select: none; user-select: none; }
.folder-fold.shut .fchev { transform: none; }
.fname { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 650; color: var(--text-2); }
.fparent { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 11.5px var(--mono); color: var(--faint); }
.folder-fold .fsum { margin-left: auto; }
.group-head .chip.small { margin-left: auto; padding: 4px 10px; font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--text); white-space: nowrap; }
.cards { display: grid; gap: 8px; padding: 0 12px; }
.card {
  display: grid; grid-template-columns: auto 1fr; gap: 12px 12px; align-items: center;
  width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--border);
}
.card:active { background: var(--panel-2); }
.card.stale { opacity: .55; }
/* An agent's row: a square saying what it is, then its name, what it's
   about and how it stands, one line each. No box of its own. */
.alist { gap: 0; padding: 0 6px; }
.folder .alist { padding-left: 20px; }
.alist .card { grid-template-columns: 34px 1fr; gap: 0 12px; align-items: start; padding: 7px 10px; border: 0; border-radius: 12px; background: none; }
.alist .card:active, .haptic-hit.fwd:active + .alist .card { background: var(--panel-2); }
.card .kic, .side-agent .kic { grid-row: 1 / span 3; display: grid; place-items: center; width: 34px; height: 34px; margin-top: 2px; border-radius: 50%; background: var(--panel-2); color: var(--text-2); }
.card .kic svg, .side-agent .kic svg, .row > .kic svg { width: 16px; height: 16px; }
.card .nm { min-width: 0; font-size: 15px; font-weight: 600; line-height: 20px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .desc { min-width: 0; font-size: 13px; line-height: 18px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .st, .side-agent .st { display: flex; align-items: center; gap: 5px; min-width: 0; margin-top: 2px; font-size: 12px; font-weight: 600; line-height: 16px; color: var(--muted); white-space: nowrap; }
.card .st svg, .side-agent .st svg { flex: none; width: 12px; height: 12px; }
.card .st .where, .side-agent .st .where { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 500; color: var(--faint); }
/* A message the home screen's search found: two lines of it, the words found in bold. */
.card.hit .desc { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--text-2); }
.card.hit .desc b { color: var(--text); font-weight: 700; }
.card .st .where::before, .side-agent .st .where::before { content: "·"; margin: 0 6px 0 1px; }
.card .st.t-working svg, .side-agent .st.t-working svg { animation: turn 1.1s linear infinite; }
.card .st.t-idle, .side-agent .st.t-idle { color: var(--muted) !important; font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .card .st.t-working svg, .side-agent .st.t-working svg { animation: none; } }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--unknown); flex: none; }
.s-working { background: var(--working); box-shadow: 0 0 0 4px color-mix(in srgb, var(--working) 15%, transparent); animation: pulse 1.6s ease-in-out infinite; }
.s-blocked { background: var(--blocked); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blocked) 18%, transparent); }
.s-idle, .s-done { background: var(--idle); }
.t-working { color: var(--working) !important; }
.t-blocked { color: var(--blocked) !important; }
.t-idle, .t-done { color: var(--idle) !important; }
@keyframes pulse { 50% { opacity: .45; } }

.empty { margin: 12vh 24px 0; text-align: center; color: var(--muted); line-height: 1.6; }
.empty h2 { color: var(--text); font-size: 20px; margin: 18px 0 8px; }
.empty ol { text-align: left; display: inline-block; margin: 12px 0 0; padding-left: 20px; }
.empty code { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.empty a { color: var(--accent); }
.empty .help { margin-top: 18px; font-size: 14px; color: var(--muted); }
/* Signed out with something shared: signing in comes after it. */
.empty.after-shared { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--border); }
.empty-small { padding: 4px 16px 8px; color: var(--faint); font-size: 13px; }
/* Agents in the cloud (cloud.js). */
.cl-start { display: inline-flex; align-items: center; justify-content: center; gap: 10px; max-width: 360px; }
.cl-start svg { width: 22px; height: 22px; }
button.cl-pick { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
button.cl-pick.on { border-color: var(--accent); }
.cl-or { margin-top: 22px; font-size: 13px; color: var(--faint); text-transform: lowercase; }

/* ---------------------------------------------------------------- agent */
.agent-view { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.screen-wrap { flex: 1; min-height: 0; position: relative; background: var(--bg-2); }
.screen {
  position: absolute; inset: 0; overflow: auto; -webkit-overflow-scrolling: touch;
  margin: 0; padding: 12px 12px 18px;
  font: calc(11.5px * var(--ts)) / 1.45 var(--mono); color: var(--text-2);
  white-space: pre-wrap; word-break: break-word;
  user-select: text; -webkit-user-select: text;
}
.screen.wide { white-space: pre; word-break: normal; }
.screen .placeholder { color: var(--faint); font-family: var(--sans); font-size: 14px; }
.jump { position: absolute; right: 14px; bottom: 14px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--panel-3); color: var(--text-2); box-shadow: 0 4px 14px var(--shadow); }
.jump[hidden] { display: none; }
.jump svg { width: 17px; height: 17px; }
.jump:active { background: var(--panel-3); color: var(--text); }
/* The agent's browser: its page, live, under an address bar. */
.icon-btn.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.web-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg-2); }
.web-wrap[hidden] { display: none; }
.web-bar { flex: none; display: flex; align-items: center; gap: 4px; padding: 6px 8px 2px; }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.web-url, .web-text {
  flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--panel); color: var(--text); outline: none; font-size: 16px;
}
.web-url { text-overflow: ellipsis; }
.web-url:focus, .web-text:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.web-title { flex: none; padding: 0 14px 6px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 6px; }
.web-page { flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: none; display: flex; align-items: center; justify-content: center; }
.web-page img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; box-shadow: 0 1px 0 var(--border); background: #fff; }
.web-page.zoom { overflow: auto; touch-action: pan-x pan-y; align-items: flex-start; justify-content: flex-start; -webkit-overflow-scrolling: touch; }
.web-page.zoom img { width: 250%; max-width: none; flex: none; }
.web-wait { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); font-size: 14px; pointer-events: none; }
.web-wait[hidden] { display: none; }
.web-type { flex: none; display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); background: var(--panel); }
.web-type .key { min-width: 40px; padding: 0 10px; }
.dock { flex: none; background: var(--bg-2); padding: 8px 0 calc(var(--safe-bottom) + 8px); }
.keys { display: flex; gap: 6px; overflow-x: auto; padding: 0 10px 8px; scrollbar-width: none; }
.keys::-webkit-scrollbar { display: none; }
.key { flex: none; min-width: 44px; height: 36px; padding: 0 12px; border-radius: 9px; background: var(--panel-3); font: 600 13px/1 var(--mono); color: var(--text); }
.key:active { background: var(--accent); color: var(--accent-ink); }
.key.accent { background: color-mix(in srgb, var(--accent) 18%, var(--panel-3)); }
.compose {
  margin: 0 10px; padding: 8px; display: flex; flex-direction: column; gap: 4px;
  border-radius: 24px; background: var(--panel-2);
}
.compose textarea {
  width: 100%; min-height: 30px; max-height: 160px; resize: none; display: block;
  padding: 5px 8px 3px; border: 0; background: none; outline: none; font-size: 16px; line-height: 1.4;
}
.compose-bar { display: flex; align-items: center; gap: 8px; }
.compose-bar .grow { flex: 1; }
.compose-bar .round { width: 38px; height: 38px; }
/* The model and thinking beside the +: quiet, and the first to give way
   when the bar is short of room. */
.tune {
  flex: 0 1 auto; min-width: 0; height: 32px; padding: 0 12px; border-radius: 16px;
  background: var(--panel-3); color: var(--muted); font-size: 12.5px; font-weight: 600; line-height: 32px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;
}
.tune[hidden] { display: none; }
.tune .tm { color: var(--text-2); }
.tune:disabled { opacity: 1; cursor: default; }
.tune:active:not(:disabled) { background: var(--border-2); }
.tune.pending { opacity: .7; }
.compose-bar > .hit-cell:has(> .tune) { flex: 0 1 auto; min-width: 0; }
@media (max-width: 359px) { .tune .te { display: none; } }
.tune-sheet .sheet-title { margin-bottom: 6px; }
.tune-note { margin: 0 0 4px; }
.tune-group { margin-top: 16px; }
.tune-group .chip { background: var(--panel-2); border-color: transparent; }
.tune-group .chip.active { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.round { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.round svg { width: 20px; height: 20px; }
.send { background: var(--accent); color: var(--accent-ink); }
.send.stop { background: var(--text); color: var(--bg); }
.now-btn { border: 1.5px solid var(--accent); color: var(--accent); background: transparent; }
.now-btn svg { width: 21px; height: 21px; }
.now-btn:active { background: var(--accent); color: var(--accent-ink); }
/* Searching an agent's chat. */
.find-bar { flex: none; display: flex; align-items: center; gap: 2px; margin: 6px 10px 2px; padding: 0 4px 0 12px; height: 42px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border-2); }
.find-ic { display: grid; color: var(--muted); margin-right: 6px; }
.find-ic svg { width: 17px; height: 17px; }
.find-bar input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; }
.find-bar input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.find-n { flex: none; font-size: 12.5px; color: var(--muted); padding: 0 6px; white-space: nowrap; }
.find-bar .icon-btn:disabled { opacity: .35; }
#a-find.on { color: var(--accent); background: var(--panel-3); }
::highlight(find) { background-color: color-mix(in srgb, var(--blocked) 30%, transparent); }
::highlight(find-on) { background-color: var(--blocked); color: #111; }
.send:disabled { opacity: .45; }
.ghost-round { color: var(--muted); }
.ghost-round.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.banner { margin: 8px 12px 0; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; background: color-mix(in srgb, var(--blocked) 10%, transparent); color: var(--warn-ink); border: 1px solid color-mix(in srgb, var(--blocked) 30%, transparent); }
.banner.bad { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--bad-ink); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

/* ---------------------------------------------------------------- forms */
.form { padding: 8px 16px 32px; display: grid; gap: 18px; }
.label { font-size: 12px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border-2); font-weight: 600; font-size: 14px; }
.chip.active { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: var(--text); }
.input, .select, .area {
  width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border-2);
  background: var(--panel); outline: none; font-size: 16px;
}
.input:focus, .select:focus, .area:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.area { min-height: 110px; resize: vertical; line-height: 1.4; }
.spaced { margin-top: 10px; }
.stack { display: grid; gap: 8px; }
.mono { font-family: var(--mono); font-size: 14px; }
.help { margin-top: 6px; font-size: 12.5px; color: var(--faint); }
.primary { width: 100%; height: 48px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px; }
.primary:disabled { opacity: .45; }
.danger-btn { padding: 8px 12px; border-radius: 10px; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); font-size: 13px; font-weight: 600; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 12.5px; color: var(--muted); }
.note { font-size: 13px; color: var(--muted); line-height: 1.55; }

/* ---------------------------------------------------------------- toasts */
#toasts { position: fixed; left: 12px; right: 12px; top: calc(var(--safe-top) + 64px); z-index: 50; display: grid; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; padding: 11px 14px; border-radius: 12px; background: var(--panel-3); border: 1px solid var(--border-2); box-shadow: 0 10px 30px var(--shadow); font-size: 14px; display: flex; gap: 10px; align-items: center; animation: drop .18s ease-out; }
.toast.error { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.toast.attn { border-color: color-mix(in srgb, var(--blocked) 60%, transparent); }
@keyframes drop { from { transform: translateY(-8px); opacity: 0; } }

/* ---------------------------------------------------------------- chat */
.chat {
  position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px 14px 20px; overscroll-behavior: contain;
}
.chat-empty { margin: 18vh 12px 0; text-align: center; color: var(--muted); line-height: 1.55; }
.msg { margin: 0 0 14px; user-select: text; -webkit-user-select: text; }
.msg.user { display: flex; flex-direction: column; align-items: flex-end; }
.msg.user .bubble {
  max-width: 86%; padding: 9px 14px; border-radius: 18px 18px 6px 18px;
  background: var(--mine);
  white-space: pre-wrap; word-break: break-word; font-size: calc(15px * var(--ts));
}
.msg.user .bubble.cmd { font-family: var(--mono); font-size: calc(13.5px * var(--ts)); color: var(--accent); }
.msg.user .att { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.msg.user .att svg { width: 15px; height: 15px; }
.msg.user.pending .bubble { opacity: .6; }
.msg.user .sent { font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.msg.user.waiting .bubble { opacity: .6; }
.msg.user .sent .unqueue { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
/* Shared sessions: guest, gatekeeper and Claude. */
.msg .who { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); margin: 0 4px 4px; }
.msg .who svg { width: 13px; height: 13px; flex: none; }
.msg.user.other .bubble { background: var(--panel-2); }
.msg.gk { display: flex; flex-direction: column; align-items: flex-start; }
.msg.gk .who { color: var(--gk); }
.msg.gk .bubble {
  max-width: 86%; padding: 9px 14px; border-radius: 18px 18px 18px 6px;
  background: color-mix(in srgb, var(--idle) 8%, transparent); border: 1px solid color-mix(in srgb, var(--idle) 28%, transparent);
  white-space: pre-wrap; word-break: break-word; font-size: calc(15px * var(--ts));
}
.msg.gk.declined .who { color: var(--blocked); }
.msg.gk.declined .bubble { background: color-mix(in srgb, var(--blocked) 8%, transparent); border-color: color-mix(in srgb, var(--blocked) 35%, transparent); }
.msg.gk.checking .bubble { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.msg.gk .fwd {
  max-width: 86%; margin-top: 6px; padding: 8px 12px; border-radius: 12px;
  border: 1px dashed var(--border-2); color: var(--text-2);
  white-space: pre-wrap; word-break: break-word; font-size: 14px;
}
.msg.gk .who + .fwd { margin-top: 0; }
.msg.gk .fwd .lbl { display: block; font-size: 11px; color: var(--faint); margin-bottom: 2px; }
.msg.asst > .who { margin-left: 0; }
.note-line.warn span { color: var(--blocked); }
.note-line.gk-intro span { display: inline-flex; gap: 6px; align-items: flex-start; text-align: left; max-width: 340px; color: var(--muted); }
.note-line.gk-intro svg { width: 14px; height: 14px; flex: none; margin-top: 1px; color: var(--gk); }

.md { font-size: calc(15px * var(--ts)); line-height: 1.55; color: var(--text); word-break: break-word; }
.md p { margin: 0 0 10px; }
.md > :last-child { margin-bottom: 0; }
.md code { font-family: var(--mono); font-size: .84em; padding: 1px 5px; border-radius: 5px; background: var(--panel-3); color: var(--code-ink); }
.md b { font-weight: 650; }
.md a { color: var(--accent); text-decoration: none; word-break: break-all; }
.md .h { font-weight: 700; margin: 14px 0 8px; }
.md .h1 { font-size: 1.2em; } .md .h2 { font-size: 1.1em; } .md .h3 { font-size: 1em; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.md blockquote { margin: 0 0 10px; padding: 2px 0 2px 12px; border-left: 3px solid var(--border-2); color: var(--text-2); }
.md .list { margin: 0 0 10px; }
.md .li { display: flex; gap: 8px; margin: 3px 0; }
.md .li .mk { flex: none; min-width: 14px; color: var(--muted); text-align: right; }
.md .li .lt { min-width: 0; }
.md .li.d1 { padding-left: 18px; } .md .li.d2 { padding-left: 36px; } .md .li.d3 { padding-left: 54px; }
.md pre.code {
  position: relative; margin: 0 0 10px; padding: 10px 40px 10px 12px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--border); overflow-x: auto;
  font: calc(12px * var(--ts)) / 1.5 var(--mono); color: var(--text-2);
}
.md pre.code code { background: none; padding: 0; color: inherit; font-size: inherit; }
.md pre.code .lang { display: block; font-size: 10.5px; color: var(--faint); margin-bottom: 4px; text-transform: lowercase; }
.md .tbl { overflow-x: auto; margin: 0 0 10px; border: 1px solid var(--border); border-radius: 10px; }
.md table { border-collapse: collapse; font-size: .87em; min-width: 100%; }
.md th, .md td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; word-break: normal; overflow-wrap: break-word; }
.md td { min-width: 6em; }
.md th { background: var(--panel-2); font-weight: 650; white-space: nowrap; }
.md tr:last-child td { border-bottom: 0; }
@media (max-width: 699px) {
  .md .tbl.stack { overflow: visible; border: 0; border-radius: 0; }
  .md .tbl.stack table, .md .tbl.stack tbody, .md .tbl.stack tr, .md .tbl.stack td { display: block; min-width: 0; }
  .md .tbl.stack thead { display: none; }
  .md .tbl.stack tr { margin: 0 0 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
  .md .tbl.stack tr:last-child { margin-bottom: 0; }
  .md .tbl.stack td { padding: 0; border: 0; overflow-wrap: anywhere; }
  .md .tbl.stack td:first-child { font-weight: 650; font-size: 1.06em; margin-bottom: 2px; }
  .md .tbl.stack td + td { margin-top: 6px; }
  .md .tbl.stack td:empty { display: none; }
  .md .tbl.stack td[data-label]::before { content: attr(data-label); display: block; font-size: .8em; font-weight: 600; color: var(--muted); margin-bottom: 1px; }
}

.note-line { display: flex; justify-content: center; margin: 4px 0 14px; }
.note-line.read-note span, .note-line.studio-note span { display: inline-flex; align-items: center; gap: 5px; }
.note-line.read-note svg, .note-line.studio-note svg { width: 13px; height: 13px; flex: none; }
/* A shared chat (studio shared.rs): the agents added to it over the chat,
   their answers among its messages, and who was added or removed. */
.members-row { flex: none; padding: 6px 12px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.members-in { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.members-lbl { font-size: 12px; color: var(--muted); margin-right: 2px; }
.member-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-size: 13px; }
.member-chip small { color: var(--muted); font-size: 11.5px; }
.member-chip:not(:has(.member-x)) { padding-right: 10px; }
.member-x { width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.member-add { padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--border-2); background: none; color: var(--accent); font: 600 13px var(--sans); cursor: pointer; }
.member-mode { border: 0; background: none; padding: 0 2px; color: var(--accent); font: 600 11.5px var(--sans); cursor: pointer; }
.room-ask { white-space: normal; margin: 6px 0 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel-2); font-size: 13.5px; }
.room-ask b { display: block; color: var(--accent); margin-bottom: 4px; }
.room-ask p { margin: 0 0 8px; overflow-wrap: anywhere; }
.room-ask-btns { display: flex; justify-content: flex-end; gap: 8px; }
.room-ask-btns button { padding: 6px 14px; border-radius: 999px; font: 600 13px var(--sans); cursor: pointer; border: 1px solid var(--border-2); background: none; color: var(--text); }
.room-ask-btns .ask-yes { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.msg.asst.post { padding-left: 12px; border-left: 3px solid var(--accent); }
.msg.asst.post > .post-who { color: var(--text-2); font-weight: 500; }
.msg.asst.post > .post-who b { font-weight: 650; color: var(--text); }
.room-more { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); background: none; color: var(--accent); font: 600 12.5px var(--sans); cursor: pointer; }
.sheet .sheet-note { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.sheet .sheet-hint { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
/* A guest's own agent in a shared chat (Flow 1): whose it is, on its chip
   and its answers; the tip to connect one; the sheet's progress. */
.member-chip em { font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--accent); }
.msg.asst.post.guest-post { border-left-style: dashed; }
.connect-tip { display: flex; align-items: flex-start; gap: 10px; margin-top: 6px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); white-space: normal; }
.connect-tip > div { flex: 1; display: grid; gap: 4px; justify-items: start; }
.connect-tip small { color: var(--muted); font-size: 12.5px; }
.connect-x { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.sheet .connect-working { margin-top: 10px; font-size: 14px; color: var(--text-2); }
.sheet .sheet-title.small { font-size: 13px; margin-top: 8px; }
.sheet .connect-direct { display: block; margin: 4px 0 8px; font-size: 14px; }
.sheet .connect-direct small { display: block; color: var(--muted); font-size: 12.5px; margin-left: 22px; }
.member-open { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline dotted; }
/* Agents messaging agents: a message from one, one this agent sent. */
.msg.peer { display: flex; flex-direction: column; align-items: stretch; }
.msg.peer > .who { margin-left: 0; }
.peer-card {
  padding: 10px 14px; border-radius: 14px; background: var(--panel);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
}
.msg.peer.sent .peer-card { border-left-color: var(--border-2); }
.msg.peer.st-failed > .who { color: var(--danger); }
.msg.peer.st-failed .peer-card { border-left-color: var(--danger); }
.peer-text.folded { max-height: calc(9.3em * var(--ts)); overflow: hidden; -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent); }
.peer-more { margin-top: 6px; padding: 0; background: none; border: 0; font: 600 13px var(--sans); color: var(--accent); cursor: pointer; }
.peer-from { font-size: 13.5px; color: var(--muted); }
.peer-state { display: flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 12px; color: var(--faint); }
.peer-state svg { width: 13px; height: 13px; flex: none; }
.peer-state.bad { color: var(--danger); white-space: pre-wrap; word-break: break-word; }
.tname.read-label { flex: 1; min-width: 0; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-line span { font-size: 12px; color: var(--faint); white-space: pre-line; text-align: center; max-width: 90%; }

.tool { margin: 0 0 6px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); overflow: hidden; }
.tool + .msg, .tool + .note-line { margin-top: 12px; }
.tool-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; text-align: left; min-height: 36px; }
.tool-head:disabled { cursor: default; opacity: 1; }
.tool-head:active:not(:disabled) { background: var(--panel-2); }
.tdot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--idle); opacity: .8; }
.st-run .tdot { background: var(--working); animation: pulse 1.2s ease-in-out infinite; }
.st-err .tdot { background: var(--danger); }
.tname { flex: none; font-weight: 650; font-size: 13px; color: var(--text); }
.targ { flex: 1; min-width: 0; font: 12px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.targ.plain { font: 13px var(--sans); color: var(--text-2); }
.chev { flex: none; color: var(--faint); display: grid; transition: transform .15s; }
.chev svg { width: 14px; height: 14px; }
.tool.open .chev { transform: rotate(90deg); }
.tool-body { display: none; padding: 0 10px 10px; }
.tool.open .tool-body { display: block; }
.tool-pre {
  margin: 0 0 6px; padding: 8px 10px; border-radius: 8px; background: var(--bg-2);
  font: calc(11.5px * var(--ts)) / 1.5 var(--mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word;
  max-height: 340px; overflow: auto; user-select: text; -webkit-user-select: text;
}
.tool-pre:last-child { margin-bottom: 0; }
.pre-wrap { position: relative; margin: 0 0 6px; }
.pre-wrap:last-child { margin-bottom: 0; }
.pre-wrap .tool-pre { margin: 0; padding-right: 40px; }
.tool-pre.err { color: var(--bad-ink); }
.tool-pre.diff span { display: block; }
.tool-pre.diff .add { color: var(--add-ink); background: color-mix(in srgb, var(--idle) 8%, transparent); }
.tool-pre.diff .del { color: var(--del-ink); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.tool-pre.diff .more { color: var(--faint); }
.todos-card { padding: 10px 12px; }
.todo-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.todo-head svg { width: 16px; height: 16px; color: var(--muted); }
.todo { display: flex; gap: 8px; font-size: 13.5px; line-height: 1.4; margin: 4px 0; color: var(--text-2); }
.todo .tm { flex: none; width: 16px; text-align: center; color: var(--muted); }
.todo.completed { color: var(--faint); text-decoration: line-through; }
.todo.completed .tm { color: var(--idle); text-decoration: none; }
.todo.in_progress { color: var(--text); font-weight: 600; }
.todo.in_progress .tm { color: var(--working); }

.working { display: flex; align-items: center; gap: 10px; margin: 6px 0 4px; font-size: 13px; color: var(--muted); }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--working); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

.ask { margin: 8px 0 4px; padding: 12px; border-radius: 14px; background: color-mix(in srgb, var(--blocked) 8%, var(--panel)); }
.ask-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 650; color: var(--blocked); margin-bottom: 8px; }
.ask-ctx { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: var(--bg-2); font: 11.5px/1.5 var(--mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }
.ask-q { font-weight: 650; margin-bottom: 10px; }
.ask-opts { display: grid; gap: 6px; }
.ask-opt { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.ask-opt .n { flex: none; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font: 600 12px var(--mono); background: var(--panel-3); color: var(--muted); }
.ask-opt .l { min-width: 0; font-size: 14.5px; font-weight: 550; }
.ask-opt .d { display: block; font-size: 12.5px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.ask-opt.sel { background: color-mix(in srgb, var(--accent) 14%, var(--panel-2)); }
.ask-opt.sel .n { background: var(--accent); color: var(--accent-ink); }
.ask-opt:active, .ask-opt.chosen { background: color-mix(in srgb, var(--accent) 16%, transparent); }
/* An agent getting ready (setup.rs): installing, or signing in to Claude Code. */
.ask.setup { display: grid; gap: 10px; }
.ask.setup .ask-head { margin-bottom: 0; }
.setup-t { font-size: 14.5px; line-height: 1.45; }
.setup-link { display: grid; place-items: center; text-decoration: none; }
.setup-code { display: flex; gap: 8px; }
.setup-code .input { flex: 1; min-width: 0; }
.setup-code .key { flex: none; padding: 0 14px; }
.setup-err { font-size: 13.5px; color: var(--danger); }
/* Codex's sign-in: its one-time code, large, with Copy. */
.codex-code { display: flex; align-items: center; gap: 12px; }
.codex-code .mono { flex: 1; min-width: 0; font-size: 30px; font-weight: 700; letter-spacing: .04em; user-select: all; overflow-wrap: anywhere; }
.codex-code .key { flex: none; padding: 0 14px; }
.setup-ok { font-size: 14.5px; font-weight: 600; color: var(--ok-ink); }
.setup-warn { font-size: 13.5px; color: var(--warn-ink); }
.ask.setup button.key[data-codex] { justify-self: start; }
.input.bad { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.ask-opt:disabled:not(.chosen) { opacity: .5; }
.ask-keys { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ---------------------------------------------------------------- sheets */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0); transition: background .18s; display: flex; align-items: flex-end; }
.sheet-bg.in { background: var(--scrim); }
.sheet {
  width: 100%; max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--panel); border-top: 1px solid var(--border-2); border-radius: 18px 18px 0 0;
  padding: 6px 16px calc(var(--safe-bottom) + 18px);
  transform: translateY(100%); transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.sheet-bg.in .sheet { transform: none; }
.sheet .grab { width: 38px; height: 4px; border-radius: 2px; background: var(--border-2); margin: 4px auto 12px; }
.sheet-title { font-size: 17px; font-weight: 700; margin: 0 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-item { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 12px 6px; border-radius: 12px; }
.sheet-item:active { background: var(--panel-2); }
.sheet-item:disabled { opacity: .45; }
.sheet-item svg { width: 22px; height: 22px; flex: none; color: var(--text-2); }
.sheet-item span { min-width: 0; display: grid; gap: 2px; }
.sheet-item b { font-weight: 600; font-size: 15.5px; }
.sheet-item small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-item.danger b, .sheet-item.danger svg { color: var(--danger); }
.chip:disabled { opacity: .4; }

/* ---------------------------------------------------------------- changes */
.file-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); }
.file-row:active { background: var(--panel-2); }
.ftag { flex: none; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font: 700 11.5px var(--mono); background: color-mix(in srgb, var(--working) 14%, transparent); color: var(--working); }
.ftag.new { background: color-mix(in srgb, var(--idle) 14%, transparent); color: var(--idle); }
.ftag.del, .ftag.conflict { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.fpath { flex: 1; min-width: 0; display: grid; }
.fpath b { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fpath small { font: 11.5px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fpath small:empty { display: none; }
.file-row .chev { color: var(--faint); }
.diff-view { padding: 0; }
.diff-pre { margin: 0; padding: 10px 0 24px; font: calc(11.5px * var(--ts)) / 1.5 var(--mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word; user-select: text; -webkit-user-select: text; }
.diff-pre span { display: block; padding: 0 12px; }
/* Unwrapped: one row per line, as wide as the longest; the view scrolls sideways. */
.diff-pre.wide { white-space: pre; word-break: normal; width: max-content; min-width: 100%; }
.diff-pre .add { color: var(--add-ink); background: color-mix(in srgb, var(--idle) 9%, transparent); }
.diff-pre .del { color: var(--del-ink); background: color-mix(in srgb, var(--danger) 9%, transparent); }
.diff-pre .hunk { color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); margin-top: 6px; }
.diff-pre .meta { color: var(--faint); }
.diff-pre .placeholder { color: var(--faint); font-family: var(--sans); font-size: 14px; padding: 12px; }

/* ---------------------------------------------------------------- files */
a.flink { color: var(--accent); word-break: normal; overflow-wrap: anywhere; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 2px; -webkit-tap-highlight-color: transparent; }
a.flink:active { text-decoration-color: var(--accent); }
.msg.user a.flink { color: inherit; text-decoration-color: currentColor; }
.tool-file { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 6px; padding: 9px 10px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); font-size: 13.5px; text-align: left; }
.tool-file svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.tool-file span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-file:active { background: var(--panel-3); }
.file-view { padding: 0; }
.code-view { padding: 8px 0 28px; font: calc(11.5px * var(--ts)) / 1.55 var(--mono); color: var(--text-2); user-select: text; -webkit-user-select: text; }
.code-view .cl { display: flex; }
.code-view .ln { flex: none; width: var(--ln, 4ch); padding: 0 10px 0 8px; box-sizing: content-box; text-align: right; color: var(--faint); user-select: none; -webkit-user-select: none; }
.code-view .lc { flex: 1; min-width: 0; padding-right: 12px; white-space: pre-wrap; word-break: break-word; }
.code-view.wide { overflow-x: auto; }
.code-view.wide .cl { width: max-content; min-width: 100%; }
.code-view.wide .lc { white-space: pre; word-break: normal; flex: none; }
.code-view .hit { background: color-mix(in srgb, var(--accent) 13%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.code-view .hit .ln { color: var(--accent); }
.code-view .placeholder { color: var(--faint); font-family: var(--sans); font-size: 13.5px; padding: 6px 14px 10px; }

/* ---------------------------------------------------------------- voice */
.mic { position: relative; }
.mic.rec { color: #fff; background: var(--danger); box-shadow: 0 0 0 calc(var(--lvl, 0) * 10px + 2px) color-mix(in srgb, var(--danger) 28%, transparent); transition: box-shadow .1s; }
.mic.busy { color: var(--accent); }
.mic.busy svg { animation: pulse 1s ease-in-out infinite; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.eq i { width: 3px; background: var(--accent); border-radius: 1px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .2s; }
.eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.msg.asst { position: relative; }
.toggle { flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--panel-3); border: 1px solid var(--border-2); position: relative; transition: background .15s; }
.toggle i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.toggle.on { background: color-mix(in srgb, var(--accent) 30%, transparent); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.toggle.on i { transform: translateX(18px); background: var(--accent); }
.progress { height: 8px; border-radius: 4px; background: var(--panel-3); overflow: hidden; margin-top: 12px; }
.progress .bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.banner.ok { background: color-mix(in srgb, var(--idle) 10%, transparent); color: var(--ok-ink); border-color: color-mix(in srgb, var(--idle) 30%, transparent); margin: 12px 0 0; }
.sheet .banner { margin: 12px 0 0; }
.primary.danger { background: var(--danger); color: #fff; }
.sheet .note + .note { margin-top: 8px; }
.sheet .note code { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.invite-qr { display: flex; justify-content: center; margin: 4px 0 14px; }
.invite-qr svg { width: 220px; height: 220px; background: #fff; padding: 10px; border-radius: 12px; }
.form.flush { padding: 0; }

/* GitHub sign-in */
svg.gh { width: 22px; height: 22px; flex: none; color: var(--text); }
svg.gh.big { width: 52px; height: 52px; }
.login-card { display: flex; gap: 12px; align-items: flex-start; margin: 2px 12px 10px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border-2); font-size: 14px; color: var(--text-2); }
.login-card svg.gh { width: 28px; height: 28px; margin-top: 1px; }
.login-card .grow { flex: 1; min-width: 0; }
.login-card b { color: var(--text); }
.login-card .s { font-size: 13px; color: var(--muted); margin-top: 4px; }
.login-card .primary { margin-top: 12px; height: 44px; font-size: 15px; }
.label .opt { font-weight: 500; color: var(--faint); text-transform: none; letter-spacing: 0; margin-left: 4px; }
.row .t .s { font-weight: 500; }
/* Sign in with GitHub on the first screen */
.empty .gh-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: min(320px, 100%); height: 48px; font-size: 16px; margin-top: 18px; }
.empty .gh-btn svg.gh { width: 22px; height: 22px; color: inherit; }
.empty .provider-btn { display: flex; margin-left: auto; margin-right: auto; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px; font-weight: 600; }
.empty .provider-btn + .provider-btn { margin-top: 10px; }
.empty .or { margin-top: 22px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* Copy and reply */
.code-wrap { position: relative; }
.md .code-wrap pre.code { margin: 0 0 10px; }
.copy-btn {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; color: var(--muted); background: var(--overlay);
}
.copy-btn svg { width: 16px; height: 16px; }
.copy-btn:active { color: var(--accent); }
.copy-btn.done { color: var(--idle); }
.msg-acts { display: flex; gap: 2px; margin: 4px 0 0 -8px; user-select: none; -webkit-user-select: none; }
.msg-acts .act { width: 36px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--faint); }
.msg-acts .act svg { width: 17px; height: 17px; }
.msg-acts .act:active { color: var(--accent); background: var(--panel-2); }
.msg-acts .act.done { color: var(--idle); }
.uq {
  margin: 0 0 6px; padding: 1px 0 1px 9px; border-left: 3px solid var(--accent);
  color: var(--muted); font-size: 13.5px; max-height: 7.2em; overflow: hidden;
}
.uq-who { display: block; font-size: 11.5px; font-weight: 650; color: var(--accent); }
/* A forward's and a mention's label above what it says. */
.ulbl { font-size: 11.5px; font-weight: 600; color: var(--muted); margin: 0 0 4px; }
.ulbl.mention-lbl { color: var(--accent); }
.tag { color: var(--accent); font-weight: 600; }
.tag.me { background: color-mix(in srgb, var(--accent) 16%, transparent); border-radius: 5px; padding: 0 2px; }
.star-mark { display: inline-grid; vertical-align: -2px; margin-left: 6px; color: var(--blocked); }
.star-mark svg { width: 13px; height: 13px; }
.msg.asst > .star-mark { display: block; margin: 2px 0 0; }
/* A message of the owner's (or a guest's) shows its actions once tapped. */
.msg.user .msg-acts { display: none; margin: 4px -8px 0 0; }
.msg.user.acts .msg-acts { display: flex; }
@media (hover: hover) { .msg.user:hover .msg-acts { display: flex; } }
.mention-list { display: grid; gap: 2px; margin: 0 8px 8px; padding: 4px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); max-height: 220px; overflow-y: auto; }
.mention-opt { display: flex; align-items: baseline; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; }
.mention-opt:active, .mention-opt:first-child { background: var(--panel-2); }
.mention-opt b { font-weight: 650; color: var(--accent); }
.mention-opt small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star-list { display: grid; gap: 6px; margin-bottom: 16px; }
.star-row { display: flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.star-go { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; padding: 9px 12px; }
.star-who { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.star-text { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.star-x { color: var(--blocked); flex: none; }
.reply-bar { display: flex; align-items: center; gap: 6px; padding: 0 6px 8px 12px; }
.reply-bar .rq { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding: 1px 0 1px 9px; font-size: 13px; color: var(--text-2); }
.reply-bar .rq b { display: block; font-size: 11.5px; font-weight: 650; color: var(--accent); }
.reply-bar .rq span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-bar .icon-btn { width: 32px; height: 32px; }
.offscreen { position: fixed; top: 0; left: -9999px; opacity: 0; }

/* Images, audio and video in the file view */
.media-view { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 14px 14px 0; font-family: var(--sans); }
.media-img {
  max-width: 100%; height: auto; border-radius: 8px;
  background: repeating-conic-gradient(var(--check-a) 0 25%, var(--check-b) 0 50%) 0 0 / 16px 16px;
}
.media-video { width: 100%; max-height: 70vh; border-radius: 8px; background: #000; }
.media-audio { width: 100%; margin-top: 18px; }
.media-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; color: var(--muted); font-size: 12.5px; }
.media-meta .chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text); }
.media-meta .chip svg { width: 16px; height: 16px; }

/* Swiping between agents */
.screen-wrap.enter-next, .a-panel.enter-next { animation: enter-next .18s ease-out; }
.screen-wrap.enter-prev, .a-panel.enter-prev { animation: enter-prev .18s ease-out; }
@keyframes enter-next { from { transform: translateX(30%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes enter-prev { from { transform: translateX(-30%); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .screen-wrap.enter-next, .screen-wrap.enter-prev, .a-panel.enter-next, .a-panel.enter-prev { animation: none; }
}

/* Back to your previous message */
.jump.prev { top: 10px; bottom: auto; }
.msg .bubble.flash, .msg.flash { animation: flash 1.2s ease-out; }
.msg.asst.flash { border-radius: 10px; }
@keyframes flash { from { box-shadow: 0 0 0 2px var(--accent); } to { box-shadow: 0 0 0 2px transparent; } }

/* ---------------------------------------------------------------- attachments */
.att-tray { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.att-tray::-webkit-scrollbar { display: none; }
.att-chip { position: relative; flex: none; width: 68px; height: 68px; border-radius: 12px; overflow: hidden; background: var(--panel-3); border: 1px solid var(--border-2); }
.att-chip img, .att-chip video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.att-chip .att-play { position: absolute; left: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.55); color: #fff; }
.att-chip .att-play svg { width: 11px; height: 11px; }
.att-file { display: grid; place-items: center; align-content: center; gap: 2px; height: 100%; padding-bottom: 14px; color: var(--muted); }
.att-file svg { width: 22px; height: 22px; }
.att-file small { font: 700 10px/1 var(--mono); color: var(--text-2); }
.att-name { position: absolute; left: 4px; right: 4px; bottom: 5px; font-size: 10px; line-height: 1.2; color: var(--text-2); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-bar { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 2px; background: rgba(0,0,0,.45); overflow: hidden; }
.att-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.att-chip.sending img, .att-chip.sending video { opacity: .7; }
.att-chip.failed { border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.att-chip.failed img, .att-chip.failed video, .att-chip.failed .att-file { opacity: .35; }
.att-retry { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 5px 9px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 650; }
.att-x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.6); color: #fff; }
.att-x svg { width: 12px; height: 12px; }
.uatts { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; gap: 6px; margin-top: 6px; white-space: normal; }
.uatts:first-child { margin-top: 0; }
.uatt.pic { display: block; width: 112px; height: 112px; border-radius: 12px; overflow: hidden; background: var(--panel-2); }
.uatt.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.uatt.pic img:not([src]) { background: linear-gradient(110deg, var(--panel-2) 30%, var(--panel-3) 50%, var(--panel-2) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.uatt.chip-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); text-decoration: none; }
.uatt-ic { display: grid; flex: none; color: var(--muted); }
.uatt-ic svg { width: 15px; height: 15px; }
.uatt-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.uatt.chip-file .uatt-n { color: var(--accent); }

/* ---------------------------------------------------------------- file browser */
.browse-find { flex: none; padding: 4px 12px 10px; }
.browse-find input { width: 100%; height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--bg-2); outline: none; font-size: 16px; }
.browse-find input:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.ftag.ficon { background: none; color: var(--muted); }
.ftag.ficon svg { width: 19px; height: 19px; }

/* The message box's round buttons, and the + sheet. */
.fill-round { background: var(--panel-3); color: var(--text-2); }
.fill-round.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.fill-round:disabled { opacity: .45; }
.fill-round.mic.rec { color: #fff; background: var(--danger); }
/* Not `.empty`: that is the empty-state block, with a big margin. */
.send.dim { opacity: .45; }
.plus-head { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; margin: 0 0 16px; }
.plus-x { width: 40px; height: 40px; border-radius: 50%; background: var(--panel-3); }
.plus-title { text-align: center; font-size: 17px; font-weight: 700; }
.plus-link { justify-self: end; padding: 8px 2px; font-size: 16px; color: var(--text-2); }
/* The iPhone app: the newest photos, one tap from the message. */
.plus-recent { display: flex; gap: 8px; margin: 0 -16px 12px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.plus-recent::-webkit-scrollbar { display: none; }
.plus-photo { flex: none; width: 76px; height: 76px; border-radius: 16px; overflow: hidden; background: var(--panel-3); display: grid; place-items: center; }
.plus-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.plus-photo.more svg { width: 26px; height: 26px; color: var(--text-2); }
.plus-photo:active { opacity: .7; }
.plus-allow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 18px; border-radius: 22px; background: var(--panel-3); font-size: 14px; color: var(--text-2); text-align: left; }
.plus-allow svg { width: 22px; height: 22px; flex: none; }
.plus-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 12px; }
.plus-tile { height: 108px; border-radius: 22px; background: var(--panel-3); display: grid; place-items: center; align-content: center; gap: 8px; font-size: 16px; }
.plus-tile svg { width: 30px; height: 30px; color: var(--text); }
.plus-tile b, .plus-row b { font-weight: 550; }
.plus-row { display: flex; align-items: center; gap: 14px; width: 100%; height: 56px; padding: 0 20px; margin: 0 0 10px; border-radius: 28px; background: var(--panel-3); font-size: 16px; text-align: left; }
.plus-row svg { width: 22px; height: 22px; flex: none; color: var(--text-2); }
.plus-row b { flex: 1; }
.plus-val { color: var(--muted); }
.plus-tile:active, .plus-row:active, .plus-x:active { background: var(--border-2); }

/* Pictures in the chat. */
.msg.user .bubble.media { padding: 0; background: none; border: 0; }
.uatt.pic { width: 120px; height: 120px; }
.uatts.one .uatt.pic { width: auto; height: auto; max-width: min(280px, 72vw); }
.uatts.one .uatt.pic img { width: auto; height: auto; max-width: 100%; max-height: 340px; object-fit: contain; }
.uatts.one .uatt.pic img:not([src]) { width: 220px; height: 160px; }
.uatts.apics { justify-content: flex-start; margin-top: 8px; }
.uatts.tool-pic { justify-content: flex-start; margin: 0; padding: 0 10px 10px; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: calc(var(--safe-top, 0px) + 56px) 8px calc(var(--safe-bottom) + 16px); }
.lightbox img { width: 100%; height: 100%; object-fit: contain; }
.lb-bar { position: absolute; top: calc(var(--safe-top, 0px) + 10px); left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: center; }
.lb-x { color: #fff; background: rgba(255,255,255,.12); border-radius: 50%; }
.lb-bar .chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: #fff; background: rgba(255,255,255,.12); border-color: transparent; }
.lb-bar .chip svg { width: 16px; height: 16px; }

/* Sidebar: beside the view on wide screens, a drawer on phones */
.side { display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); }
.side-head { display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-top) + 14px) 16px 12px; color: var(--text); }
.side-logo { width: 28px; height: 28px; flex: none; }
.side-title { flex: 1; font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
.side-user { font-size: 12.5px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav { display: grid; gap: 2px; padding: 2px 8px 10px; }
.side-item { display: flex; align-items: center; gap: 12px; width: 100%; height: 42px; padding: 0 10px; border-radius: 10px; color: var(--text-2); font-size: 15px; font-weight: 600; text-align: left; }
.side-item svg { width: 19px; height: 19px; flex: none; }
.side-item.on { background: var(--panel-3); color: var(--text); }
.side-item:active { background: var(--panel-2); }
.side-agents { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 8px 12px; }
.side-group { padding: 12px 10px 6px; font-size: 11.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-agent { display: grid; grid-template-columns: 28px 1fr; gap: 0 10px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 10px; text-align: left; }
.side-agent .kic { grid-row: 1 / span 2; width: 28px; height: 28px; margin-top: 0; }
.side-agent .kic svg { width: 14px; height: 14px; }
.row > .kic { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2); color: var(--text-2); }
.side-agent .nm { min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-agent.on { background: var(--panel-3); }
.side-agent:active { background: var(--panel-2); }
.side-none { padding: 14px 10px; font-size: 13px; color: var(--faint); }
.side-lim { display: grid; gap: 7px; margin: 0 8px calc(var(--safe-bottom) + 10px); padding: 10px 12px; border-radius: 12px; background: var(--panel); text-align: left; }
.side-lim:active { background: var(--panel-2); }
.sl-head { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.sl-head svg { width: 16px; height: 16px; color: var(--muted); }
.sl-row { display: grid; grid-template-columns: 58px 1fr 34px; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.sl-row b { text-align: right; color: var(--text-2); font-weight: 650; }
.empty > svg { color: var(--text); }
.logo-frame { stroke: var(--accent); }
@media (max-width: 899px) {
  .side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 45; width: min(84vw, 320px);
    transform: translateX(-102%); visibility: hidden; box-shadow: 0 0 40px var(--shadow);
    transition: transform .22s ease, visibility 0s linear .22s;
  }
  body.side-open .side { transform: none; visibility: visible; transition: transform .22s ease; }
  .side-bg { position: fixed; inset: 0; z-index: 44; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.side-open .side-bg { opacity: 1; pointer-events: auto; }
}
@media (min-width: 900px) {
  body { display: flex; }
  .side { width: 280px; flex: none; height: 100%; }
  #app { flex: 1; min-width: 0; }
  .side-bg, .menu-btn { display: none !important; }
}

/* Plan limits */
.lim { padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); display: grid; gap: 12px; }
.lim-head { display: flex; align-items: center; gap: 10px; }
.lim-name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.lim-where { margin-left: auto; font-size: 12px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lim-row { display: grid; gap: 5px; }
.lim-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--text-2); }
.lim-top b { font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.lim-sub, .lim-foot { font-size: 12px; color: var(--faint); }
.lim-err { font-size: 13px; color: var(--blocked); }
.lim-actions { display: flex; }
.meter { height: 7px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.meter.sm { height: 5px; }
.meter i { display: block; height: 100%; border-radius: inherit; min-width: 2px; transition: width .3s; }
.meter i[data-pct="0"] { min-width: 0; }
.meter .lv-ok { background: var(--accent); }
.meter .lv-warn { background: var(--blocked); }
.meter .lv-bad { background: var(--danger); }

/* Web addresses in the terminal view and in tool output */
.screen a, .tool-pre a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 2px; }

/* ------------------------------------------------------------- tab bar */
/* Chat tapped twice goes home: no double-tap zoom on the tabs. */
.tabbar, .tabbar * { touch-action: manipulation; }
.tabbar {
  flex: none; display: flex;
  padding: 4px 0 calc(var(--safe-bottom) + 2px);
  background: var(--bar-bg);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.tab { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 0 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
.tab svg { width: 24px; height: 24px; }
/* iPhone haptics (see Haptic in app.js): an invisible switch over a control
   takes the tap, so Safari plays its haptic. */
.haptic { position: fixed; left: -100px; top: 0; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.tab-cell { position: relative; display: flex; }
.tab-cell { flex: 1; }
.tab-cell > .tab { flex: 1; }
.haptic-hit { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.haptic-hit:active + .tab svg { opacity: .7; }
.hit-cell { position: relative; display: grid; min-width: 0; }
.bar > .hit-cell, .compose-bar > .hit-cell, .reply-bar > .hit-cell, .web-type > .hit-cell { flex: none; }
.haptic-hit.fwd:active + .round, .haptic-hit.fwd:active + .now-btn, .haptic-hit.fwd:active + .key { opacity: .7; }
.hit-cell[hidden], .hit-cell:has(> [hidden]) { display: none; }
.haptic-hit.fwd:active + .card, .haptic-hit.fwd:active + .side-item, .haptic-hit.fwd:active + .tile { background: var(--panel-2); }
.haptic-hit.fwd:active + .icon-btn { opacity: .6; }
.tab.on { color: var(--accent); }
.tab:active svg { opacity: .7; }
.tab-n { position: absolute; top: 1px; left: calc(50% + 7px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; }
/* An agent's tabs (Chat, Dashboard, Settings): out of the way while typing. */
.agent-view.typing .tabbar { display: none; }
.agent-view:not(.typing):has(> .tabbar:not([hidden])) .dock { padding-bottom: 8px; }
.a-panel { flex: 1; min-height: 0; background: var(--bg); }
.a-panel .form { padding-top: 10px; }
.a-panel .actions { gap: 2px; padding: 4px 8px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); }
.a-panel .row .t.mono { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.dash-empty { margin-top: 10vh; }
.dash-empty > svg { width: 40px; height: 40px; color: var(--faint); }

/* ----------------------------------------------------------- dashboard */
.sub-head { display: flex; align-items: center; gap: 8px; padding: 6px 16px 8px; font-size: 13px; font-weight: 650; color: var(--text-2); }
.sub-head span { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--panel-3); color: var(--muted); }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 0 12px 8px; }
.app-card { display: flex; flex-direction: column; min-width: 0; text-align: left; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); overflow: hidden; }
.app-card:active { background: var(--panel-2); }
.app-shot { position: relative; display: block; aspect-ratio: 390 / 500; background: var(--bg-2); overflow: hidden; border-bottom: 1px solid var(--border); }
.app-shot img { display: block; width: 100%; height: auto; background: #fff; }
.app-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.app-ph svg { width: 30px; height: 30px; }
.app-live { position: absolute; left: 7px; top: 7px; display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 7px; border-radius: 99px; background: rgba(8,10,14,.72); color: #fff; font-size: 10.5px; font-weight: 650; }
.app-live i { width: 6px; height: 6px; border-radius: 50%; background: #42d392; }
.app-shot .pill { position: absolute; right: 7px; top: 7px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); background: color-mix(in srgb, var(--panel) 80%, transparent); }
.app-shot .pill.warn { color: var(--blocked); }
.app-shot .pill.bad { color: var(--danger); }
.app-body { display: grid; gap: 2px; padding: 9px 11px 11px; min-width: 0; }
.app-nm { font-weight: 650; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-meta { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.app-meta > span:last-child, .app-meta .by { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.app-meta.mono, .app-meta .mono, .page-row .meta.mono { font-family: var(--mono); font-size: 11.5px; }
.app-meta .dot, .page-row .dot { width: 7px; height: 7px; box-shadow: none; animation: none; }
.app-meta .gone, .page-row .gone { color: var(--faint); }
.page-list { display: grid; gap: 8px; padding: 0 12px 8px; }
.page-row { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; width: 100%; min-width: 0; padding: 10px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); text-align: left; color: inherit; text-decoration: none; }
.page-row:active { background: var(--panel-2); }
.page-shot { width: 46px; height: 60px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--border); color: var(--faint); }
.page-shot svg { width: 20px; height: 20px; }
.page-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; background: #fff; }
.page-body { display: grid; gap: 1px; min-width: 0; }
.page-row .nm { font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-row .meta { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-row .go { color: var(--faint); }
.page-row .go svg { width: 16px; height: 16px; display: block; }
/* The recap: where an agent's work stands, and the logbook of its session. */
.recap { margin: 10px 12px 14px; padding: 13px 14px 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border); }
.recap.needs { border-color: color-mix(in srgb, var(--blocked) 45%, var(--border)); }
.recap-top { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; margin-bottom: 6px; padding: 0; text-align: left; color: inherit; }
.recap.folded { padding: 11px 14px; }
.recap.folded .recap-top { margin-bottom: 0; flex-wrap: wrap; row-gap: 4px; }
.recap.folded .recap-top .fold-line { order: 5; flex-basis: 100%; padding-left: 22px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; font-size: 15px; }
.recap.folded .pill { margin-left: auto; }
.recap.folded .pill + .recap-when { margin-left: 0; }
.recap-top .chev, .lb-head .chev { transition: transform .15s; }
.recap-top[aria-expanded="true"] .chev, .lb-head[aria-expanded="true"] .chev { transform: rotate(90deg); }
.fold-line { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--text); }
.fold-line.none { font-weight: 500; color: var(--muted); }
.recap-top .pill { flex: none; }
.recap-top .pill.warn { color: var(--warn-ink); }
.recap-top .pill.bad { color: var(--bad-ink); }
.recap-top .recap-when { flex: none; }
.recap-k { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.recap-when { margin-left: auto; font-size: 12px; color: var(--faint); white-space: nowrap; }
.recap-h { font-size: 16.5px; font-weight: 680; line-height: 1.3; color: var(--text); overflow-wrap: anywhere; }
.recap-t { margin: 6px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--text-2); overflow-wrap: anywhere; }
.recap-t.recap-none { margin: 0; color: var(--muted); }
.recap.stale .recap-h, .recap.stale .recap-t { opacity: .78; }
.recap-needs { display: grid; gap: 2px; margin-top: 10px; padding: 9px 11px; border-radius: 11px; font-size: 14px; line-height: 1.45; background: color-mix(in srgb, var(--blocked) 11%, transparent); color: var(--warn-ink); border: 1px solid color-mix(in srgb, var(--blocked) 28%, transparent); overflow-wrap: anywhere; }
.recap-needs b { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.recap-needs a, .recap-t a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.recap-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border); font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.recap-foot > span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.recap-foot > span:first-of-type { flex: 1 1 180px; }
.recap-foot svg { width: 14px; height: 14px; flex: none; }
.recap-err { color: var(--bad-ink); }
.recap-go { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 12px; border-radius: 99px; font-size: 13px; font-weight: 650; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.recap-go:active { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.recap-busy { display: inline-flex !important; gap: 3px; flex: none !important; }
.recap-busy i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.recap-busy i:nth-child(2) { animation-delay: .15s; }
.recap-busy i:nth-child(3) { animation-delay: .3s; }
.lb-head { width: 100%; min-width: 0; text-align: left; }
.lb-head .chev { display: grid; }
.lb-head .fold-line { font-style: normal; font-size: 13px; font-weight: 500; color: var(--muted); }
.logbook { padding: 0 12px 10px; }
.logbook ol { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border-2); margin-left: 6px; display: grid; gap: 14px; }
.logbook li { position: relative; min-width: 0; }
/* Where a fork began: it stands out. */
.logbook li.lb-fork::before { background: var(--blocked); border-color: var(--blocked); }
.logbook .lb-fork .lb-entry { background: color-mix(in srgb, var(--blocked) 9%, transparent); border: 1px solid color-mix(in srgb, var(--blocked) 35%, transparent); padding: 6px 8px; }
.logbook .lb-fork b { display: flex; align-items: center; gap: 6px; color: var(--blocked); font-weight: 750; }
.logbook .lb-fork b svg { width: 15px; height: 15px; flex: none; }
.lb-entry { display: grid; gap: 2px; width: 100%; min-width: 0; padding: 2px 4px 4px; margin: -2px 0 -4px; border-radius: 8px; text-align: left; }
.lb-entry:active { background: var(--panel-2); }
.logbook li::before { content: ""; position: absolute; left: -21px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); box-sizing: border-box; }
.logbook li:first-child::before { background: var(--accent); }
.logbook time { font-size: 11.5px; color: var(--faint); }
.logbook b { font-size: 14px; font-weight: 650; color: var(--text); overflow-wrap: anywhere; }
.logbook li span { font-size: 13.5px; line-height: 1.45; color: var(--text-2); overflow-wrap: anywhere; }
.lb-more { display: block; margin: 12px 0 0; min-height: 32px; padding: 0 12px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--panel-2); border: 1px solid var(--border); }
.lb-kept { margin: 10px 0 0; font-size: 12px; color: var(--faint); }
.tab-dot { position: absolute; top: 4px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--blocked); box-shadow: 0 0 0 2px var(--bar-bg); }
.dash-help { padding: 18px 16px 8px; color: var(--faint); font-size: 12.5px; line-height: 1.55; }
.dash-help b { color: var(--muted); font-weight: 650; }
.app-view { border-top: 0; }

/* What an agent showed (`somelier show`): a card of its files in the chat,
   a tile each, full screen on a tap; Show on a reply's file outside the project. */
.msg.shown-card { display: flex; flex-direction: column; align-items: stretch; }
.msg.shown-card > .who { margin-left: 0; }
.msg.shown-card.bad > .who { color: var(--danger); }
.shown-cap { font-size: 14px; margin: 0 0 8px; white-space: pre-wrap; word-break: break-word; }
/* A results card (Visual chats): its title, version and how far it is. */
.results-card { border: 1px solid var(--border-2); background: var(--panel-2); border-radius: 14px; padding: 10px 12px; max-width: 560px; }
.results-card > .who { color: var(--text); font-weight: 600; flex-wrap: wrap; }
.results-card .card-v, .results-card .card-done { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--panel-3); color: var(--muted); }
.results-card .card-done { color: var(--idle); }
.results-card .card-status { font-size: 13px; color: var(--muted); margin: 2px 0 8px; }
.results-card .card-page { margin-top: 8px; align-self: flex-start; display: inline-flex; gap: 6px; align-items: center; }
.results-card .card-page svg { width: 16px; height: 16px; }
.info-btn { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border-2); background: none; color: var(--muted); font: italic 600 11px/16px Georgia, serif; padding: 0; margin-left: 4px; cursor: pointer; vertical-align: 1px; }
.info-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.card-line button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 12.5px; padding: 2px 6px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; text-align: left; }
.card-line button svg { width: 14px; height: 14px; flex: none; }
.card-line button:hover { color: var(--text); }
.shown-grid { display: grid; gap: 6px; max-width: 520px; }
.shown-grid.n1 { grid-template-columns: minmax(0, 320px); }
.shown-grid.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.shown-grid.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shown-tile { position: relative; display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--panel-2); color: var(--text-2); font: inherit; cursor: pointer; }
.shown-grid.n1 .shown-tile { aspect-ratio: auto; min-height: 140px; }
.shown-grid.n1 .shown-tile.has { min-height: 0; }
.shown-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.shown-grid.n1 .shown-tile img { height: auto; max-height: 360px; object-fit: contain; }
.shown-tile:disabled { cursor: default; opacity: .7; }
.shown-tile.k-video { background: #15171c; color: #f2f3f5; }
.shown-label { display: grid; justify-items: center; gap: 4px; max-width: 100%; padding: 10px; text-align: center; font-size: 12.5px; }
.shown-ic { display: grid; color: var(--muted); }
.shown-tile.k-video .shown-ic { color: #f2f3f5; }
.shown-ic svg { width: 26px; height: 26px; }
.shown-n { overflow-wrap: anywhere; }
.shown-note { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.shown-bar { display: block; width: 80%; max-width: 220px; height: 4px; border-radius: 2px; background: var(--border-2); overflow: hidden; }
.shown-bar span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .15s; }
.show-named { display: grid; gap: 8px; margin-top: 8px; }
.show-one { display: grid; justify-items: start; gap: 4px; }
.show-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 13px; }
.show-btn svg { width: 15px; height: 15px; }
.show-btn .spin { width: 13px; height: 13px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: shown-spin .8s linear infinite; }
@keyframes shown-spin { to { transform: rotate(360deg); } }
.shown-viewer { padding-bottom: calc(var(--safe-bottom) + 68px); }
.shown-viewer .sv-stage { display: grid; place-items: center; width: 100%; height: 100%; min-height: 0; overflow: auto; }
.shown-viewer .sv-stage img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; touch-action: pinch-zoom; }
.shown-viewer .sv-stage img.zoomed { width: auto; height: auto; max-width: none; max-height: none; object-fit: none; cursor: zoom-out; }
.shown-viewer .sv-stage video { max-width: 100%; max-height: 100%; }
.sv-note { display: grid; justify-items: center; gap: 10px; color: #f2f3f5; text-align: center; font-size: 14px; }
.sv-note svg { width: 32px; height: 32px; }
.sv-bar { gap: 6px; }
.sv-name { flex: 1; min-width: 0; color: #f2f3f5; font-size: 13px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-prev, .sv-next { color: #fff; }
.sv-prev:disabled, .sv-next:disabled { opacity: .35; }
.sv-acts { position: absolute; left: 10px; right: 10px; bottom: calc(var(--safe-bottom) + 12px); display: flex; justify-content: center; gap: 8px; }
.sv-acts .chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: #fff; background: rgba(255,255,255,.12); border-color: transparent; font: inherit; font-weight: 600; font-size: 14px; }
.sv-acts .chip svg { width: 16px; height: 16px; }
.sv-prev[hidden], .sv-next[hidden] { display: none; }

.daily-card {padding:14px;border:1px solid var(--line);border-radius:14px;margin-bottom:16px} .daily-card p {font-size:13px;opacity:.8;white-space:pre-wrap}.daily-video {display:block;width:100%;max-height:65vh;border-radius:10px}.daily-card details p {max-height:40vh;overflow:auto}

.agent-story-strip{display:flex;gap:16px;overflow-x:auto;padding:10px 4px}.agent-story-entry{display:flex;flex-direction:column;align-items:center;gap:8px;min-width:84px;max-width:100px}.agent-story-entry span{display:grid;place-items:center;width:64px;height:64px;border:3px solid var(--accent,#a99aff);border-radius:50%;background:rgba(145,125,255,.15)}.agent-story-video{display:block;width:100%;max-height:68dvh;aspect-ratio:9/16;background:#000}

/* Cloud in the launcher (cloud.js `formHtml`). */
.chip-ic { display: inline-flex; align-items: center; gap: 6px; }
.chip-ic svg { width: 16px; height: 16px; }
.cl-title { display: flex; align-items: center; gap: 8px; }
.cl-title svg { width: 20px; height: 20px; flex: none; }
.cl-f-list { margin-top: 8px; max-height: 280px; overflow-y: auto; }
.cl-f-list .s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-f-refused { color: var(--danger); }
