/* Chat-view chrome for ui.js (replaced mobile.css 2026-11-04). Linked after style.css.
   Everything that changes the old layout is scoped to body.ui-v2, which ui.js sets once
   it has built the new bar — if ui.js fails to load, the old composer row still works.
   Phones = ≤700 px (same breakpoint as ui.js PHONE). */

.ui-phone, .ui-hbtn.ui-phone { display: none; }

/* ── HEADER ─────────────────────────────────────────────────────────────── */
.ui-v2 #view-toggle,
.ui-v2 #logout-btn { display: none; }            /* both live in the ⋯ menu */
.ui-v2 .header-right { display: flex; align-items: center; gap: 8px; }
.ui-v2 .header-inner { max-width: 860px; }
.ui-hbtn {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ui-hbtn:hover { border-color: var(--border-hi); }
/* Pending-approval count on ⋯, shown on phones where 🔔 is hidden. */
.ui-hbtn[data-badge]:not([data-badge=""])::after {
    content: attr(data-badge);
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    line-height: 16px;
    display: none;
}

/* ── COMPOSER CARD ──────────────────────────────────────────────────────── */
.ui-v2 .composer {
    border-top: none;
    padding: 6px 16px 14px;
}
.ui-v2 .composer-row { display: none; }          /* its controls live in the sheets */
.ui-v2 .msg-input {
    display: block;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    padding: 12px 14px 6px;
    font-size: 13px;
    min-height: 3.2em;
    box-shadow: none;
}
.ui-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 8px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 16px 16px;
}
.ui-v2 .ui-bar { display: flex; }
.ui-v2 .composer:focus-within .msg-input,
.ui-v2 .composer:focus-within .ui-bar { border-color: var(--acc-dim); }
.ui-v2 .msg-input:focus { box-shadow: none; }
/* Tier tint (app.js onAgentChange): the input card is a darker shade of the user bubble it
   will become — blue for cloud, red for local. Both views. */
.composer.tier-cloud .ui-bar, .composer.tier-cloud:not(.condensing) .msg-input { background: #181e30; border-color: #2c3656; }
.composer.tier-local .ui-bar, .composer.tier-local:not(.condensing) .msg-input { background: #301818; border-color: #562c2c; }
.composer.tier-cloud:focus-within .msg-input, .composer.tier-cloud:focus-within .ui-bar { border-color: #3a4670; }
.composer.tier-local:focus-within .msg-input, .composer.tier-local:focus-within .ui-bar { border-color: #703a3a; }
/* Claude queue chats: the box runs Claude orange to a darker orange, left to right (user
   2026-11-11; the lavender it had first was too bright for a box you type in). */
.composer.tier-cq .ui-bar, .composer.tier-cq:not(.condensing) .msg-input {
    background: linear-gradient(90deg, var(--claude), #7a3218); border-color: #7a3218; color: #fff3ec; }
.composer.tier-cq .msg-input { caret-color: #fff3ec; }
.composer.tier-cq .msg-input::placeholder { color: rgba(255, 243, 236, .65); }
/* The chat list says the same per chat: each row fades from clear (left) into its user-bubble
   colour (right). background-image only, so hover/active colours still show beneath. */
#recents-list .recent-item.rt-cloud { background-image: linear-gradient(90deg, transparent 0%, #28324f 100%); }
#recents-list .recent-item.rt-local { background-image: linear-gradient(90deg, transparent 0%, #4f2828 100%); }
#recents-list .recent-item.rt-locked { background-image: linear-gradient(90deg, transparent 0%, #000 100%); }

/* Group numbers (app.js recentRow): a plain numeral on a solid pill, one muted colour per
   group, chosen to stay clear of the colours that mean something (blue cloud, red local,
   yellow lenovo, pink legion). Was a circled ①, too faint to see (2026-11-05). */
.grp-badge { display: inline-flex; align-items: center; justify-content: center; flex: none;
    min-width: 15px; height: 15px; padding: 0 3px; margin-right: 3px; border-radius: 4px; box-sizing: border-box;
    font: 700 10px/1 var(--mono); color: #fff; background: #555; }
.grp-1 { background: #2a9d8f; } .grp-2 { background: #7b5ea7; } .grp-3 { background: #b5651d; }
.grp-4 { background: #3d7a3a; } .grp-5 { background: #8a3f6b; } .grp-6 { background: #4a6a8a; }
.grp-7 { background: #8a7a2a; } .grp-8 { background: #2a7a8a; } .grp-9 { background: #6a6a6a; }

/* Tool turns (app.js renderTurn, 2026-11-05): the "🔧 tool output" title in the source colour
   (cloud blue, local red). */
.turn.tool.src-cloud { --src: var(--acc); }
.turn.tool.src-local { --src: var(--red); }
.turn.tool .turn-meta .tool-tag { color: var(--src, var(--green)); }
.turn.subtask .turn-meta .tool-tag { color: var(--indigo); }
/* Guest accounts (guests.js, 2026-11-06): main-only controls are hidden; the usage chip
   sits in the bottom bar. */
html.guest #target-pick, html.guest #perms-btn, html.guest #align-btn, html.guest #bb-target,
html.guest #pending-btn { display: none !important; }
.bb-guest { color: var(--indigo); white-space: nowrap; }
.bb-guest.over { color: var(--red, #ff6b6b); }   /* sub-agent answers */
/* Agent left bars (app.js paintAgentBars, 2026-11-06): replies solid in their source colour,
   tool output in its machine colour, thoughts grey, each non-reply fading from the reply
   above it to its own colour to the reply below it (--bar-a → --bar-b → --bar-c). The bar
   takes the element's left corners, so mid-chain bars are square like their boxes. */
/* One border width for all, so every bar sits on the same x (tool bubbles had 2px, which
   shifted their bars 1px right of the reply and tray bars). */
.agent-bar { position: relative; border-left: 1px solid transparent !important; }
.agent-bar::before {
    content: ''; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px;
    pointer-events: none; z-index: 1;
    border-top-left-radius: inherit; border-bottom-left-radius: inherit;
    background: linear-gradient(to bottom, var(--bar-a), var(--bar-b), var(--bar-c));
}

/* "Group 3: Fantasy Writing" headings when the list is sorted by group (app.js recentsByGroup). */
.recents-group-head { margin: 10px 8px 3px; font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recents-group-head:first-child { margin-top: 2px; }

/* Approvals (app.js checkPending/openPending, 2026-11-05): a new request pops up with a
   30 s bar; untouched, it closes and 🔔 (⋯ on phones) shimmers in rainbow until opened. */
.tool-perm-timer { height: 3px; margin: -16px -18px 12px; border-radius: 8px 8px 0 0;
    background: var(--green); transform-origin: left; animation: perm-timer linear forwards; }
@keyframes perm-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.pending-shimmer {
    background-image: linear-gradient(90deg, #ff6b6b, #ffb87b, #ffdd7b, #6bffb8, #7aadff, #c9a8ff, #ffb8dd, #ff6b6b) !important;
    background-size: 300% 100% !important; color: #0e0e11 !important; border-color: transparent !important;
    animation: pending-rainbow 2.5s linear infinite;
}
@keyframes pending-rainbow { from { background-position: 0 0; } to { background-position: 300% 0; } }
@media (prefers-reduced-motion: reduce) { .pending-shimmer { animation: none; } .tool-perm-timer { animation: none; } }

/* Send later (ui.js schedulePicker, app.js scheduleSend): Send fills while held; the picker
   is a tooltip (tips.js .tip look) that takes clicks. */
.ui-send { position: relative; overflow: hidden; }
.ui-send::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: rgba(255, 255, 255, .35); transform: scaleY(0); transform-origin: bottom; }
.ui-send.holding::after { transform: scaleY(1); transition: transform 1s linear; }
.tip.ui-sched { pointer-events: auto; max-width: 300px; width: 280px; z-index: 10001; white-space: normal; }
.ui-sched-title { font-weight: 700; }
.ui-sched-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 9px 0 7px; }
.ui-sched-chip, .ui-sched-no, .ui-sched-go {
    padding: 4px 9px; border-radius: 12px; border: 1px solid #3a3a44; background: #1c1c22;
    color: #ececf1; font: inherit; font-size: 11.5px; cursor: pointer; }
.ui-sched-chip:hover, .ui-sched-no:hover { border-color: #5a5a68; }
.ui-sched-at { width: 100%; box-sizing: border-box; padding: 6px 8px; border-radius: 8px; border: 1px solid #3a3a44;
    background: #141418; color: #ececf1; font: inherit; color-scheme: dark; }
.ui-sched-btns { display: flex; justify-content: flex-end; gap: 6px; margin-top: 9px; }
.ui-sched-go { background: var(--acc, #7aadff); border-color: transparent; color: #0e0e11; font-weight: 700; }
.queue-item.scheduled .queue-when { flex: none; margin-right: 8px; color: var(--text); opacity: .8; font-size: 11px; white-space: nowrap; }
.ui-spacer { flex: 1; }
.ui-plus, .ui-send {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    line-height: 1;
}
.ui-plus {
    border: 1px solid var(--border-hi);
    background: none;
    color: var(--text);
    font-size: 20px;
}
.ui-plus:hover { background: var(--bg2); }
.ui-send {
    border: none;
    background: var(--acc);
    color: var(--bg);
    font-size: 18px;
    font-weight: 700;
}
.ui-send:hover { background: var(--acc2); }
.ui-pill {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 12px;
    border-radius: 17px;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text);
    font-family: var(--mono);
    font-size: 12px;
    cursor: pointer;
}
.ui-pill:hover { border-color: var(--tgt, var(--border-hi)); }
.ui-pill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-pill-warn { color: var(--orange); }
.ui-pill-caret { color: var(--dim); font-size: 10px; }
.ui-v2 .ui-bar .meter-btn { flex: none; }

/* ── BOTTOM BAR ─────────────────────────────────────────────────────────── */
.ui-v2 .bb-left { flex-wrap: wrap; row-gap: 2px; }
.ui-v2 .bb-left > * { white-space: nowrap; }
.ui-v2 .bottombar {
    border-top: none;
    background: none;
    padding: 0 16px 8px;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    font-size: 13px;
}

/* ── SHEETS ─────────────────────────────────────────────────────────────── */
/* Desktop: centred dialog. Phones: bottom sheet (below). z-index over the scanline
   (999), drawer (1000) and fullscreen canvas (1001); under the toast. */
.ui-sheet-back {
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: rgba(8, 8, 11, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
.ui-sheet-back.open { background: rgba(8, 8, 11, .7); }
.ui-sheet {
    width: min(460px, calc(100vw - 32px));
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
    opacity: 0;
    transform: scale(.97);
    transition: opacity .2s, transform .2s;
}
.ui-sheet-back.open .ui-sheet { opacity: 1; transform: none; }
.ui-sheet-head {
    position: relative;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    padding: 0 16px;
}
.ui-sheet-grip { display: none; }
.ui-sheet-x {
    position: absolute;
    left: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
}
.ui-sheet-title { font-family: var(--sans); font-size: 16px; font-weight: 700; color: #fff; }
.ui-sheet-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 14px 16px;
    font-size: 13px;
}
.ui-group-label {
    margin: 14px 6px 6px;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dim);
}
.ui-group {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}
.ui-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    padding: 8px 14px;
    background: none;
    border: none;
    border-top: 1px solid var(--border);
    color: var(--text);
    font: inherit;
    text-align: left;
}
.ui-row:first-child { border-top: none; }
button.ui-row { cursor: pointer; }
button.ui-row:hover { background: rgba(255, 255, 255, .03); }
.ui-row.dim .ui-row-label { color: var(--dim); }
.ui-row.dim .ui-switch { opacity: .4; }
.ui-row-ico { flex: none; width: 22px; text-align: center; font-size: 15px; }
.ui-row-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ui-row-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-row-sub { font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-warn { color: var(--orange); }
.ui-check { flex: none; width: 18px; color: var(--acc); font-size: 16px; }
.ui-model.on .ui-row-label { color: #fff; }
/* Gauntlet rank badges (app.js gauntletBadge): D ash grey; C copper, B silver, A gold with a
   shimmer; S red with an iridescent sweep. F and E stay plain. */
.gx { display: inline-block; min-width: 1.3em; margin-right: 6px; padding: 0 4px; border-radius: 4px;
    border: 1px solid currentColor; font: 700 10px/1.5 var(--mono); text-align: center;
    color: var(--dim); text-decoration: none; vertical-align: 1px; flex: none; }
.gx-D { color: #b2beb5; }
.gx-C, .gx-B, .gx-A, .gx-S, .gx-X { background-size: 250% 100%; animation: gx-shine 3s linear infinite; }
.gx-C { color: #d08a4f; background-image: linear-gradient(110deg, rgba(184,115,51,.15) 40%, rgba(255,214,170,.55) 50%, rgba(184,115,51,.15) 60%); }
.gx-B { color: #d6d9de; background-image: linear-gradient(110deg, rgba(192,192,192,.12) 40%, rgba(255,255,255,.6) 50%, rgba(192,192,192,.12) 60%); }
.gx-A { color: #e8c34a; background-image: linear-gradient(110deg, rgba(212,175,55,.15) 40%, rgba(255,240,180,.65) 50%, rgba(212,175,55,.15) 60%); }
.gx-S { color: #8fdcff; background-image: linear-gradient(110deg, rgba(120,210,255,.18) 40%, rgba(225,247,255,.7) 50%, rgba(120,210,255,.18) 60%); }
.gx-X { color: #ff5a5a; background-image: linear-gradient(110deg, rgba(255,77,77,.25), rgba(255,180,90,.45), rgba(120,255,200,.4), rgba(110,160,255,.45), rgba(220,120,255,.45), rgba(255,77,77,.25));
    animation-duration: 4s; }
.gx-stale { opacity: .55; }
/* A quick-gauntlet verdict (app.js gauntletBadge, 2026-11-24): dashed, not a full rank. */
.gx-quick { border-style: dashed; animation: none; background-image: none; }
/* Purpose pill (app.js purposePill, 2026-11-24): what a model is for when it isn't text and
   tools; amber so it reads as a caution, not a rank. */
.mp { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px;
    border: 1px solid #6b5420; background: rgba(232, 180, 60, .12); color: #e8c06a;
    font: 600 10px/1.6 var(--mono); vertical-align: 1px; white-space: nowrap; }
/* A 250% wide background repeats every 2.5 widths, which is 166.67% of background-position:
   the sweeps move exactly one repeat, or the band snaps at the loop (gx-shine, ui-shimmer,
   think-shimmer). */
@keyframes gx-shine { from { background-position: 133.33% 0; } to { background-position: -33.33% 0; } }
@media (prefers-reduced-motion: reduce) { .gx { animation: none !important; } }
/* Soft-queue (app.js softSend): a strip above the composer and a pulsing last message
   while a send waits for its receipt. */
.send-wait { display: flex; align-items: center; gap: 8px; margin: 0 auto 6px; padding: 6px 12px;
    max-width: 100%; width: fit-content; border: 1px solid var(--border-hi); border-radius: 999px;
    background: var(--bg3); color: var(--dim); font: 12px var(--mono); }
.send-wait[hidden] { display: none; }
.send-wait-dots { display: inline-flex; gap: 3px; }
.send-wait-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--yellow);
    animation: send-wait-dot 1.2s ease-in-out infinite; }
.send-wait-dots i:nth-child(2) { animation-delay: .2s; }
.send-wait-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes send-wait-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
body.send-waiting .turn.user:last-of-type .bubble { animation: send-wait-pulse 1.6s ease-in-out infinite; }
@keyframes send-wait-pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
    .send-wait-dots i, body.send-waiting .turn.user:last-of-type .bubble { animation: none; }
}
/* Prices (app.js priceHtml): input red ↑, cached input green ↑, output blue ↓. */
.pr-in { color: var(--red); }
.pr-cache { color: var(--green); }
.pr-out { color: var(--acc); }
.pr-free { color: var(--green); }
/* Paid-only models (app.js isPaid): struck through and greyed for everyone. */
.ui-model.unusable .ui-row-label { color: var(--dim); text-decoration: line-through; }
#agent option.unusable { color: #777; }
.ui-empty { padding: 18px; text-align: center; color: var(--dim); }
/* Scheduled calendar (ui.js calendarSheet, 2026-11-11): days with a send-later message get a
   blue circle; every other day is just its number. */
.ui-cal-nav { display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; }
.ui-cal-month { flex: 1; text-align: center; font-weight: 700; }
.ui-cal-step { background: none; border: 1px solid var(--border); border-radius: 8px; color: var(--text);
    width: 32px; height: 32px; font-size: 18px; cursor: pointer; }
.ui-cal-step:hover { border-color: var(--border-hi); }
.ui-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 14px; justify-items: center; }
.ui-cal-wd { color: var(--dim); font-size: 11px; padding: 2px 0 4px; }
.ui-cal-day { width: 36px; height: 36px; border-radius: 50%; border: 1px solid transparent; background: none;
    color: var(--text); font: inherit; cursor: pointer; }
.ui-cal-day:hover { border-color: var(--border-hi); }
.ui-cal-day.today { color: var(--acc); font-weight: 700; }
.ui-cal-day.has { background: var(--acc); color: var(--bg); font-weight: 700; }
.ui-cal-day.sel { border-color: var(--text); }
/* Right pane (ui.js paintPane, 2026-11-11): like the Claude app's session pane, but inside the
   conversation, in the open margin right of the 860 px message column. Shown only when that
   margin is wide enough (chat area ≥ 1380 px), sized to it, never over the messages. */
#chat-view { position: relative; container-type: inline-size; }
.side-pane { display: none; }
@container (min-width: 1380px) {
    .side-pane:not([hidden]) {
        display: block; position: absolute; top: 16px; right: 20px; z-index: 2;
        width: min(340px, calc((100cqw - 860px) / 2 - 40px));
        max-height: calc(100% - 230px); overflow-y: auto; box-sizing: border-box;
        background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 6px 16px;
    }
}
.sp-sec { padding: 10px 0 14px; border-bottom: 1px solid var(--border); }
.sp-sec:last-child { border-bottom: none; }
.sp-head { display: flex; align-items: baseline; margin-bottom: 8px; }
.sp-title { flex: 1; font-weight: 700; font-size: 13px; }
.sp-right { color: var(--dim); font-size: 12px; }
.sp-line { display: flex; align-items: flex-start; gap: 9px; padding: 4px 0; font-size: 13px; }
.sp-line.dim { color: var(--dim); }
.sp-ico { width: 18px; text-align: center; flex-shrink: 0; }
.sp-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-main { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-sub { color: var(--dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A project @github has mirrored (2026-11-11): purple name, grey tag */
.sp-mirrored .sp-main { color: var(--violet); }
.sp-mirror-tag { color: var(--dim); font-weight: 400; }
.sp-bar { height: 6px; border-radius: 3px; background: var(--bg3); overflow: hidden; }
.sp-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.sp-note { color: var(--dim); font-size: 11px; margin-top: 6px; }
.sp-x { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 12px; padding: 0 2px; }
.sp-x:hover { color: var(--red); }
.sp-empty { color: var(--dim); font-size: 13px; padding: 12px 0; }
.sp-badges { display: flex; gap: 6px; margin: 4px 0 0 27px; }
.sp-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--dim); margin-top: 6px; }
.sp-kv .sp-v { color: var(--text); text-align: right; }
.sp-subhead { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 2px; }
.sp-tool { width: 100%; background: none; border: none; color: inherit; font: inherit; text-align: left; cursor: pointer; align-items: center; }
.sp-tool:disabled { cursor: default; }
.sp-tool .ui-switch { flex-shrink: 0; }
.sp-kv .sp-v.bb-spent-v { color: #ffd166; }
/* Secondary functions (ui.js hint/withHint, 2026-11-11): orange, like "show more". */
.ui-hint { color: var(--orange); }
.sp-note { display: block; }
/* Tools primer picker (ui.js toolPickSheet, 2026-11-11). */
.ui-pick-bar { display: flex; gap: 6px; margin-bottom: 8px; }
.ui-pick-note { color: var(--dim); font-size: 12px; margin-bottom: 8px; }
.ui-pick-send { display: block; width: 100%; margin-top: 12px; padding: 10px; }
.ui-pick-send:disabled { opacity: .5; cursor: default; }
.sp-line .sp-right { color: var(--dim); font-size: 11px; white-space: nowrap; }
.sp-click { cursor: pointer; border-radius: 6px; }
.sp-click:hover { background: var(--bg3); }
/* Desktop with the pane showing: the footer keeps only who/where (slug, model, tier, machine,
   warnings); context size, capabilities, cost and conversation size live in the pane. Phones
   keep their own footer rules above. */
@container (min-width: 1380px) {
    #chat-view:has(.side-pane:not([hidden])) .bottombar :is(#bb-ctx, #bb-caps, .bb-right) { display: none !important; }
    /* What's left sits centred under the composer. */
    #chat-view:has(.side-pane:not([hidden])) .bottombar { justify-content: center; }
    #chat-view:has(.side-pane:not([hidden])) .bottombar .bb-left { justify-content: center; }
}
@media (max-width: 700px) {               /* phones: the bottom sheet, finger-sized days */
    .ui-cal-day { width: 42px; height: 42px; font-size: 15px; }
    .ui-cal-step { width: 40px; height: 40px; }
}
/* Found chats (adopted from legion, never used here): their own collapsible section. */
.found-toggle { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 10px;
    padding: 6px 8px; background: none; border: 0; border-top: 1px solid var(--border);
    color: var(--dim); font: inherit; font-size: 11px; text-align: left; cursor: pointer; }
.found-toggle:hover { color: var(--text); }
.found-list { display: flex; flex-direction: column; gap: 2px; }
.found-list[hidden] { display: none; }
.found-list .recent-title { opacity: .75; }

/* Conversation notifications (app.js renderRecents): a silver shimmer sweeps the title while
   the agent is working; a gold one, slower, once it has answered and you haven't looked.
   Not scoped to .ui-v2, so the classic view shows them too. */
.recent-item.awaiting .recent-title,
.recent-item.unseen .recent-title {
    background-size: 250% 100%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
    animation: ui-shimmer 2.4s linear infinite;
}
.recent-item.awaiting .recent-title {
    background-image: linear-gradient(100deg, #8d939c 0%, #8d939c 35%, #f2f4f7 50%, #8d939c 65%, #8d939c 100%);
}
.recent-item.unseen .recent-title {
    background-image: linear-gradient(100deg, #c9a227 0%, #c9a227 35%, #fff1b8 50%, #c9a227 65%, #c9a227 100%);
    animation-duration: 3.6s;
    font-weight: 600;
}
.recent-item.unseen .tgt-dot { box-shadow: 0 0 0 2px rgba(201, 162, 39, .45); }
/* Tooltips (tips.js): bold title, optional dim subtitle. Replaces native `title` tooltips
   on mouse devices, in both views. */
.tip {
    position: fixed; z-index: 10000; pointer-events: none;
    max-width: 260px; padding: 7px 10px; border-radius: 8px;
    background: #26262c; border: 1px solid #3a3a44; color: #ececf1;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
    font: 500 12.5px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif;
    opacity: 0; transform: translateY(3px); transition: opacity .12s ease, transform .12s ease;
    white-space: pre-line; overflow-wrap: anywhere;
}
.tip.below { transform: translateY(-3px); }
.tip.on { opacity: 1; transform: none; }
.tip-sub { margin-top: 3px; color: #a3a3ad; font-weight: 400; font-size: 11.5px; line-height: 1.35; }
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }

/* Red in place of gold: the unseen reply is a failed response. */
.recent-item.unseen.failed .recent-title {
    background-image: linear-gradient(100deg, #c94a3d 0%, #c94a3d 35%, #ffd0c8 50%, #c94a3d 65%, #c94a3d 100%);
}
.recent-item.unseen.failed .tgt-dot { box-shadow: 0 0 0 2px rgba(201, 74, 61, .5); }
/* Unsent text in the chat's input box (app.js drafts), in the chat's machine colour (--tgt:
   legion pink, lenovo yellow; was blue until 2026-11-05, which now means cloud). Ranks
   below silver, gold and red, which are about the agent. */
.recent-item.drafted .recent-title {
    background-image: linear-gradient(100deg, var(--tgt) 0%, var(--tgt) 35%,
        color-mix(in srgb, var(--tgt) 30%, #fff) 50%, var(--tgt) 65%, var(--tgt) 100%);
    background-size: 250% 100%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
    animation: ui-shimmer 3s linear infinite;
}
@keyframes ui-shimmer { from { background-position: 133.33% 0; } to { background-position: -33.33% 0; } }
@media (prefers-reduced-motion: reduce) {
    .recent-item.awaiting .recent-title, .recent-item.unseen .recent-title,
    .recent-item.drafted .recent-title { animation: none; background-position: 50% 0; }
}

/* Failed and unsent turns recede: the model never saw them as an exchange (failed and
   cancelled replies are left out of its history), so they shouldn't read like one.
   Failed keeps a red edge and tag so it is still findable; full strength on hover/focus. */
.ui-v2 .bubble.error { opacity: .55; border-style: dashed; border-color: rgba(255, 107, 107, .5);
    background: transparent; }
.ui-v2 .bubble.error .bubble-body { color: var(--dim); }
.ui-v2 .bubble.cancelled { opacity: .5; }
/* Unsent: the user message whose reply failed or was cancelled. A Claude queue message that
   was consumed (read) looks the same (app.js dispatchQueued, user 2026-11-10). */
.ui-v2 .turn.user:has(+ .turn.assistant .bubble.error) .bubble,
.ui-v2 .turn.user:has(+ .turn.assistant .bubble.cancelled) .bubble,
.ui-v2 .turn.user .bubble.cq-consumed {
    opacity: .5; border-style: dashed; background: transparent; }
/* The queue's "Consumed …" reply is not a model answer: the same cancelled look, edged in
   Claude orange (app.js cq-stamp, user 2026-11-11). */
.ui-v2 .turn.assistant .bubble.cq-stamp {
    opacity: .5; border-style: dashed; border-color: var(--claude); background: transparent; }
.ui-v2 .turn.assistant .bubble.cq-stamp .bubble-body { color: var(--claude); }
/* No agent bar on it (a model's reply colour would break the dashed orange edge). */
.ui-v2 .bubble.cq-stamp.agent-bar { border-left: 1px dashed var(--claude) !important; }
.ui-v2 .bubble.cq-stamp.agent-bar::before { display: none; }
.ui-v2 .bubble.error, .ui-v2 .bubble.cancelled, .ui-v2 .bubble.cq-stamp, .ui-v2 .turn.user .bubble { transition: opacity .15s; }
.ui-v2 .turn:hover .bubble, .ui-v2 .turn:focus-within .bubble { opacity: 1; }

/* Commands sheet: syntax in mono, then use / Fails / example stacked under it. */
.ui-cmd-intro { font-size: 12.5px; color: var(--dim); line-height: 1.45; }
.ui-row.ui-cmd { align-items: flex-start; }
.ui-cmd-syntax { font-family: var(--mono, ui-monospace, Consolas, monospace); font-size: 12.5px; word-break: break-word; }
.ui-cmd-sub { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
.ui-cmd-use { color: var(--text); opacity: .85; white-space: normal; }
.ui-cmd-fail { font-size: 11.5px; white-space: normal; }
.ui-cmd-eg { font-family: var(--mono, ui-monospace, Consolas, monospace); font-size: 11.5px; color: var(--acc, inherit);
    background: var(--bg3); border-radius: 6px; padding: 2px 6px; align-self: flex-start; word-break: break-all; }
.ui-filter, .ui-timeout {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--mono);
    outline: none;
}
.ui-filter { width: 100%; margin-top: 14px; padding: 9px 12px; font-size: 13px; }
/* Commands filter stays at the top while the list scrolls under it, so you can keep typing
   (2026-11-05). The shadow in the sheet colour hides rows sliding past its edges. */
/* Keyboard shortcuts list and search hits (ui.js shortcutsSheet / searchSheet). */
.ui-kbd { flex: none; padding: 2px 7px; border: 1px solid var(--border-hi); border-bottom-width: 2px;
    border-radius: 6px; background: var(--bg3); color: var(--text); font: 11px var(--mono); white-space: nowrap; }
.ui-wrap .ui-row-label { white-space: normal; }
.ui-hit .ui-row-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ui-row-sub mark { background: rgba(255, 255, 255, .16); color: var(--text); border-radius: 2px; }
/* Send a skill (ui.js skillSheet, 2026-11-23): descriptions wrap to 3 lines in a lighter grey;
   ⓘ (.open) shows the whole description. */
.ui-skill { align-items: flex-start; }
.ui-skill .ui-row-ico { margin-top: 1px; }
.ui-skill .ui-row-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    margin-top: 3px; line-height: 1.45; color: #9a9ab0; }
.ui-skill.open .ui-row-sub { display: block; -webkit-line-clamp: unset; color: var(--text); }
.ui-skill-info { flex: none; padding: 0 6px; border-radius: 999px; color: #9a9ab0; font-size: 16px; line-height: 22px; cursor: pointer; }
.ui-skill-info:hover, .ui-skill.open .ui-skill-info { color: var(--acc); background: rgba(255, 255, 255, .07); }
/* The ⟳ row under the model filter: clear of the filter's 8px sticky shadow. */
.ui-group.ui-refresh { margin-top: 12px; }
.ui-sheet-body .ui-filter { position: sticky; top: 0; z-index: 2; box-shadow: 0 0 0 8px var(--bg2); }
.ui-timeout { width: 74px; padding: 6px 8px; font-size: 13px; text-align: center; }
.ui-filter:focus, .ui-timeout:focus { border-color: var(--acc-dim); }
.ui-row .image-opts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.ui-switch {
    flex: none;
    position: relative;
    width: 40px;
    height: 24px;
    border-radius: 12px;
    background: var(--border-hi);
    transition: background .15s;
}
.ui-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform .15s;
}
.ui-switch.on { background: var(--acc); }
.ui-switch.on::after { transform: translateX(16px); }

.ui-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 2px; }
.ui-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 84px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.ui-tile:hover { border-color: var(--border-hi); }
.ui-tile-ico { font-size: 22px; }

.ui-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ui-seg-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}
.ui-seg-btn.on { border-color: var(--tgt); background: var(--tgt-tint); }
.ui-seg-sub { margin-left: auto; font-size: 10px; color: var(--dim); }

/* Toasts from sheet actions must show over the sheet. */
.ui-v2 .toast { z-index: 2000; }

/* Conversation ✎ / ✕: hover-only and 12 px on desktop, unusable by finger. On touch
   screens they show on every row as 36 px targets. */
@media (pointer: coarse), (max-width: 700px) {
    .recent-item { min-height: 48px; }
    .recent-item .recent-actions { display: flex; gap: 2px; margin-right: -6px; }
    .recent-actions button {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 15px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .recent-actions button:active { background: var(--bg3); }
    .recent-actions button.del:active { color: var(--red); }
}

/* ── PHONES ─────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
    .ui-phone, .ui-hbtn.ui-phone { display: inline-flex; }

    /* Sidebar → off-canvas drawer. Above thread images (style.css .bubble-body img, 1000,
       raised over the scanline overlay): at 1000 the drawer tied with them and the images,
       later in the page, covered the conversation picker (fixed 2026-11-10). The backdrop
       goes above them too, under the drawer; sheets (1500) and toasts (2000) stay on top. */
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 280px;
        max-width: 82%;
        background: var(--bg2);
        z-index: 1100;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, .3);
        overflow-y: auto;
    }
    #app.sb-open #sidebar { transform: none; }
    #sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .5);
        z-index: 1050;
        opacity: 0;
        visibility: hidden;
        transition: opacity .25s ease;
    }
    #sidebar-backdrop.sb-open { opacity: 1; visibility: visible; }
    #main { margin-left: 0 !important; width: 100%; min-width: 0; }

    /* Header: ☰  [offser]  ……  ● ⋯ */
    header { padding: 0 12px; padding-top: env(safe-area-inset-top, 0px); height: calc(52px + env(safe-area-inset-top, 0px)); }
    .header-inner { gap: 10px; justify-content: flex-start; }
    .ui-v2 .header-right { margin-left: auto; }
    .logo { font-size: 17px; }
    .logo-sub { display: none; }
    .ui-v2 #pending-btn { display: none; }      /* count shows on ⋯ */
    .ui-hbtn[data-badge]:not([data-badge=""])::after { display: block; }
    .ui-v2 .status-pill { padding: 0; width: 34px; height: 34px; justify-content: center; border-radius: 50%; }
    .ui-v2 #status-text { display: none; }
    .ui-hbtn { width: 38px; height: 38px; }

    /* Thread: use the width */
    .thread { padding: 14px 12px; }
    .turn { max-width: 100%; }
    .turn.user { max-width: 90%; }
    .bubble { font-size: 13px; }

    /* Composer */
    .ui-v2 .composer { padding: 4px 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
    .msg-input, .ui-v2 .msg-input { font-size: 16px; }   /* stops iOS zoom-on-focus */
    .ui-plus, .ui-send { width: 40px; height: 40px; }
    .ui-pill { height: 40px; border-radius: 20px; font-size: 13px; }
    .ui-v2 .bottombar { padding: 0 14px calc(4px + env(safe-area-inset-bottom, 0px)); }
    /* Only warnings are worth phone space: model, target and caps are on the pill and in
       the model sheet, size is on the meter. */
    .ui-v2 .bottombar .bb-left > :not(.bb-unusable),
    .ui-v2 .bottombar .bb-right { display: none !important; }
    .ui-v2 .bottombar:not(:has(.bb-unusable:not([hidden]))) { display: none; }
    .ui-filter, .ui-timeout { font-size: 16px; }

    /* Full-screen sheet (2026-11-05; was an 88 % bottom sheet). It still slides up and
       still closes on a swipe down from the header. ✕ is always top-left, 48 px. */
    .ui-sheet-back { align-items: flex-end; }
    .ui-sheet {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
        opacity: 1;
        transform: translateY(100%);
        transition: transform .22s ease;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-sizing: border-box;
    }
    .ui-wrap-phone .ui-row-label, .ui-wrap-phone .ui-row-sub { white-space: normal; }
    .ui-sheet-head { height: 64px; touch-action: none; }
    .ui-sheet-grip {
        display: block;
        position: absolute;
        top: 7px;
        left: 50%;
        width: 38px;
        height: 4px;
        margin-left: -19px;
        border-radius: 2px;
        background: var(--border-hi);
    }
    .ui-sheet-x { width: 48px; height: 48px; left: 10px; font-size: 20px; }
    .ui-sheet-body { font-size: 15px; padding: 0 14px 18px; }
    .ui-row { min-height: 56px; }
    .ui-row-sub { font-size: 12px; }

    /* Classic view: one column */
    #classic-view main { grid-template-columns: 1fr; }
    .btn-primary, .btn-secondary { min-height: 40px; }
}

/* ── Manager chats (managers.js, 2026-11-05) ─────────────────────────────────
   Run by the server: the whole bottom input area is hidden and one giant Interject
   button stands in. 1in is only 96 CSS px (~0.6 real inch on a 3x phone), hence the
   150 px floor. Interject brings the composer back with Cancel right of Send. */
body.managed-view #composer { display: none !important; }
#interject-btn, #archive-done-btn { display: none; }
body.managed-view #archive-done-btn:not([hidden]) {
    display: block; box-sizing: border-box; width: calc(100% - 32px); max-width: 760px; margin: 8px auto 0;
    padding: 10px 14px; border-radius: 14px; border: 1px solid var(--dim, #888);
    background: none; color: inherit; font: inherit; cursor: pointer;
}
body.managed-view #archive-done-btn.armed { border-color: var(--yellow, #e6c84f); color: var(--yellow, #e6c84f); }
body.managed-view #interject-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    box-sizing: border-box; width: calc(100% - 32px); max-width: 760px; margin: 8px auto 16px;
    min-height: max(1in, 150px); border-radius: 22px; border: 2px solid var(--accent, #c96442);
    background: color-mix(in srgb, var(--accent, #c96442) 18%, transparent);
    color: inherit; font: inherit; font-size: 1.7rem; font-weight: 700; cursor: pointer;
}
body.managed-view #interject-btn small { font-size: .85rem; font-weight: 400; opacity: .75; }
body.managed-view #interject-btn:disabled { cursor: default; opacity: .55; border-style: dashed; }
body.interjecting .ui-plus,
body.interjecting .ui-pill { display: none !important; }
.ui-cancel { display: none; }
body.interjecting .ui-cancel {
    display: inline-flex; align-items: center; margin-left: 8px; padding: 0 14px; height: 36px;
    border-radius: 18px; border: 1px solid currentColor; background: transparent; color: inherit;
    font: inherit; cursor: pointer; opacity: .8;
}
.mgr-badge { font-size: .8em; margin-right: 2px; }
/* Locked chats (app.js setConvLocked): a 🔒 in the list, a dimmed read-only box, and the
   + sheet's hold-to-unlock row, whose fill sweeps across over --hold-ms while pressed. */
.lock-badge { font-size: .75em; margin-right: 2px; opacity: .8; }
body.locked-view #msg { opacity: .6; cursor: not-allowed; }
body.locked-view #send-btn, body.locked-view .ui-send { opacity: .4; pointer-events: none; }
.ui-hold { position: relative; overflow: hidden; user-select: none; -webkit-user-select: none;
    touch-action: none; -webkit-touch-callout: none; }
.ui-hold::before { content: ''; position: absolute; inset: 0; transform-origin: left;
    transform: scaleX(0); background: color-mix(in srgb, var(--acc, #4a8fe0) 30%, transparent);
    pointer-events: none; }
.ui-hold.holding::before { transform: scaleX(1); transition: transform var(--hold-ms, 5s) linear; }
.ui-hold > * { position: relative; }
.mgr-log { margin: 0; padding: 8px 12px; font-size: .75rem; white-space: pre-wrap; opacity: .75; }
/* 🛡 permissions button and panel (perms.js, 2026-11-06). Green rim while "keep
   permissions" is on (green = tools and approvals). */
#perms-btn.keep-on { border-color: var(--green, #1e8e4e); color: var(--green, #1e8e4e); }
.perms-x { background: none; border: 1px solid transparent; border-radius: 6px; color: #c94a3d;
    font-size: 14px; min-width: 32px; min-height: 32px; cursor: pointer; flex: none; }
.perms-x:hover { border-color: #8e2a20; background: rgba(142, 42, 32, .15); }
.perms-note { padding: 4px 14px 10px; overflow-wrap: anywhere; white-space: normal; }
.ui-sheet .ui-group > .ui-row-sub:only-child { display: block; padding: 10px 14px; }
.ui-sheet .perms-keep .ui-row-sub { white-space: normal; }
@media (max-width: 760px) {
    .ui-v2 #perms-btn { width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: 13px; }
    .ui-v2 #perms-btn .perms-ico { display: none; }
}

/* ── UNIVERSAL SEARCH (2026-11-27; ui.js buildUniversalSearch) ─────────────
   The header's centre: a pill box that grows to fill the space between the logo and the
   buttons, with a dropdown of grouped results. Phones: a 🔍 button that opens the box
   across the whole header. */
.us { position: relative; flex: 1 1 auto; min-width: 0; max-width: 420px; margin: 0 16px; }
.us-field {
    display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px;
    border: 1px solid var(--border); border-radius: 17px; background: var(--bg3);
}
.us-field:focus-within { border-color: var(--acc); box-shadow: 0 0 0 2px rgba(122, 173, 255, .18); }
.us-ico { font-size: 12px; opacity: .7; }
.us-input {
    flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent;
    color: var(--text); font: inherit; font-size: 13px;
}
.us-input::-webkit-search-cancel-button { filter: invert(.6); }
.us-kbd {
    font-family: var(--mono); font-size: 10px; color: var(--dim); white-space: nowrap;
    border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
}
.us-field:focus-within .us-kbd { display: none; }
.us-list {
    position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    width: min(560px, 92vw); max-height: min(70vh, 560px); overflow-y: auto; z-index: 1200;
    padding: 6px; border: 1px solid var(--border-hi); border-radius: 10px;
    background: var(--bg2); box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}
.us-group {
    padding: 8px 8px 4px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
    color: var(--dim);
}
.us-item {
    display: flex; align-items: flex-start; gap: 10px; padding: 7px 8px; border-radius: 6px;
    cursor: pointer;
}
.us-item.on { background: var(--bg3); outline: 1px solid var(--border-hi); }
.us-item-ico { width: 18px; flex: none; text-align: center; }
.us-item-txt { display: flex; flex-direction: column; min-width: 0; }
.us-item-label { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.us-item-sub {
    font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.us-item mark { background: rgba(122, 173, 255, .22); color: #fff; border-radius: 2px; }
.us-empty { padding: 14px; text-align: center; color: var(--dim); font-size: 12px; }
@media (max-width: 700px) {
    .us { flex: 0 0 auto; margin: 0 4px 0 auto; max-width: none; position: static; }
    .us-field { display: none; }
    .us.open .us-field {
        display: flex; position: absolute; left: 8px; right: 8px; top: 9px; z-index: 1201;
        background: var(--bg2);
    }
    .us.open .us-open { visibility: hidden; }
    .us-kbd { display: none; }
    .us-list { position: absolute; left: 8px; right: 8px; top: 52px; transform: none; width: auto; }
}
/* The header (sticky, z-index 100) is the dropdown's stacking context, so raise it while the
   search is open, or chat images and canvases draw over the results. */
header:has(.us.open) { z-index: 1150; }
