/* Clicker4AI — warm terminal palette, mono = machine, sans = conversation */

:root {
  --bg: #141210;
  --surface: #1e1b18;
  --surface2: #28241f;
  --surface3: #322d27;
  --border: #362f28;
  --text: #ede6de;
  --dim: #a2968a;
  --faint: #6e645a;
  --accent: #e8825e;          /* claude terracotta */
  --accent-soft: #3a2a22;
  /* translucent accent: visible on the page, cards and your own bubbles alike
     (accent-soft was nearly the colour of the dark background) */
  --selection: rgba(232, 130, 94, 0.45);
  --ok: #8fb573;
  --warn: #e0b054;
  --err: #e05d52;
  --user-bubble: #33261f;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius: 12px;
  --sat: env(safe-area-inset-top, 0px);
  /* app.js sets --sab to 0 while the on-screen keyboard is up: the home
     indicator it guards is under the keyboard then */
  --sab: env(safe-area-inset-bottom, 0px);
  /* the app's box: the web view (100% of a fixed box), which app.js fits
     to the area above the keyboard. Not lvh: after the keyboard a
     home-screen app on iOS may get a web view short by the status bar,
     with black below it, and lvh then put the composer under the black */
  --app-h: 100%;
  --app-top: 0px;
}
/* iPadOS 27 draws a Liquid Glass blur below the status bar of a
   home-screen app; no CSS turns it off, so the top bar moves below it.
   Only on an iPad: -webkit-touch-callout is iOS/iPadOS Safari only, and
   both sides from 700px leave out phones, also in landscape. */
@supports (-webkit-touch-callout: none) {
  @media (display-mode: standalone) and (min-width: 700px) and (min-height: 700px) {
    :root { --sat: calc(env(safe-area-inset-top, 0px) + 20px); }
  }
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f1ea;
    --surface: #fffdf9;
    --surface2: #f0e9e0;
    --surface3: #e7ddd1;
    --border: #ddd2c4;
    --text: #2a241e;
    --dim: #77695c;
    --faint: #a5988a;
    --accent: #c25e3a;
    --accent-soft: #f4ded3;
    --selection: rgba(194, 94, 58, 0.3);
    --ok: #5c8a41;
    --warn: #a97a1d;
    --err: #c03d33;
    --user-bubble: #f1e2d7;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; overflow: hidden; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
/* fixed and moved onto the visible area by app.js, so it stays there when
   iOS scrolls the page for the keyboard (the top bar went off the screen).
   The transform also makes #app the box its fixed sheets and drawer fill. */
#app {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--app-h); transform: translateY(var(--app-top));
  display: flex; flex-direction: column;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
::selection { background: var(--selection); }

/* ---------- top bar ---------- */
#topbar {
  padding: calc(var(--sat) + 8px) 14px 8px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  min-height: calc(var(--sat) + 48px);
  flex: none;
}
.tb-title {
  font-family: var(--mono);
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  min-width: 0; flex: 1;
}
.tb-title .crumb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-sub { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.tb-btn {
  font-size: 20px; padding: 6px 10px; border-radius: 9px; color: var(--dim);
  flex: none; line-height: 1;
}
.tb-btn:active { background: var(--surface2); }
.tb-btn.menu { color: var(--accent); font-family: var(--mono); font-weight: 700; font-size: 19px; padding: 8px 12px; }
/* open drawer: the same button, above the drawer (z 60), closes it */
.tb-btn.menu.open { position: relative; z-index: 61; }
/* ❯ ‹ as one pair: no bar gap between them, tap areas stay as they are */
.tb-btn.menu + .tb-btn { margin-left: -10px; }
.tb-chips { display: flex; gap: 6px; flex: none; align-items: center; }
.tb-spacer { flex: 1; }
.tb-btn.tb-text { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.tb-btn.tb-text:disabled { opacity: .35; }
.tb-btn.tv-on { color: var(--accent); font-weight: 700; }

/* Safari-style tab-count button */
.tabs-btn { padding: 5px 8px; }
.tabs-count {
  display: flex; align-items: center; justify-content: center;
  min-width: 25px; height: 25px; padding: 0 5px;
  border: 2px solid var(--dim); border-radius: 8px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 700; color: var(--dim);
}
.tabs-btn:active .tabs-count { border-color: var(--accent); color: var(--accent); }
/* a tab on this device waits for an approval */
.tabs-btn.alert .tabs-count {
  border-color: var(--warn); color: var(--warn);
  animation: pulse 1.2s ease-in-out infinite;
}

.chip {
  font-family: var(--mono); font-size: 11px;
  padding: 3px 8px; border-radius: 99px;
  background: var(--surface2); color: var(--dim);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.chip.accent { color: var(--accent); border-color: var(--accent-soft); }

/* ---------- main view ---------- */
#view { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.pad { padding: 14px; }

.eyebrow {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--faint);
  margin: 18px 2px 8px;
}
.eyebrow:first-child { margin-top: 4px; }
/* a quiet line above a list, explaining what it leaves out */
.list-note { font-size: 12.5px; color: var(--faint); margin: 4px 2px 10px; }
.list-note .link { color: var(--dim); text-decoration: underline; cursor: pointer; }

/* ---------- session cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.s-card { display: block; width: 100%; text-align: left; padding: 14px 16px; }
.s-card:active { background: var(--surface2); }
.s-card .row1 { display: flex; align-items: center; gap: 8px; }
.s-card .title {
  font-weight: 600; font-size: 16px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.s-card .proj { font-family: var(--mono); font-size: 12px; color: var(--dim); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-card .menu-btn { color: var(--faint); font-size: 17px; padding: 2px 6px; flex: none; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.dot.working { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.dot.awaiting { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.dot.compacting { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.dot.starting { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.dot.idle { background: var(--ok); }
.dot.error { background: var(--err); }
.dot.detached { background: var(--faint); }
@keyframes pulse { 50% { opacity: 0.35; } }
/* an open tab waits for an approval and a row of it is on screen — session
   card, Tabs card or a project's past session (app.js SESSION_ROWS,
   updateTabsAlert); the Tabs button stays calm meanwhile */
/* .on.alert: wins over the last tab's own frame (.tab-card.on, below) */
.s-card.alert, .tab-card.alert, .tab-card.on.alert, .item.alert {
  border-color: var(--warn); box-shadow: none;
  animation: border-pulse 1.2s ease-in-out infinite;
}
@keyframes border-pulse { 50% { border-color: var(--border); } }
@media (prefers-reduced-motion: reduce) {
  .dot, .caret, .tabs-count, .s-card.alert, .tab-card.alert, .item.alert { animation: none !important; }
}

/* the signature: live status ticker */
.ticker {
  font-family: var(--mono); font-size: 12px; color: var(--dim);
  margin-top: 6px; display: flex; gap: 7px; align-items: baseline;
  overflow: hidden; white-space: nowrap;
}
.ticker .caret { color: var(--accent); font-weight: 700; animation: blink 1.1s step-end infinite; }
.ticker.quiet .caret { animation: none; color: var(--faint); }
.ticker .t-text { overflow: hidden; text-overflow: ellipsis; }
@keyframes blink { 50% { opacity: 0.15; } }

/* last message preview (quiet cards) */
.s-card .last-msg { display: flex; gap: 8px; margin-top: 7px; align-items: baseline; }
.s-card .lm-who {
  flex: none; font-family: var(--mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint);
}
.s-card .last-msg.user .lm-who { color: var(--accent); }
.s-card .lm-text {
  min-width: 0; font-size: 13px; line-height: 1.45; color: var(--dim);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}

.s-card .meta-row {
  display: flex; gap: 10px; margin-top: 8px;
  font-family: var(--mono); font-size: 11px; color: var(--faint);
}
.s-card .meta-row .active { color: var(--accent); font-weight: 700; }
.s-card .meta-row .error { color: var(--err); font-weight: 700; }
.s-card .meta-row .running, .tab-card .tc-meta .running { color: var(--ok); font-weight: 700; }
.s-card .meta-row .stopped, .tab-card .tc-meta .stopped { color: var(--faint); font-weight: 700; }
/* last activity inside the prompt-cache TTL (ageSpan in app.js) */
.age.warm { color: var(--ok); }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--sab) + 20px);
  width: 54px; height: 54px; border-radius: 18px;
  background: var(--accent); color: #fff;
  font-size: 28px; line-height: 1;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 20;
}
.fab:active { transform: scale(0.94); }

.empty {
  text-align: center; color: var(--dim); padding: 48px 24px;
  font-size: 14px; line-height: 1.6;
}
.empty .glyph { font-family: var(--mono); font-size: 30px; color: var(--faint); display: block; margin-bottom: 10px; }

/* ---------- tabs view (open-session switcher) ---------- */
.tabs-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tab-card {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 11px 12px;
  min-height: 128px; min-width: 0;
}
.tab-card:active { background: var(--surface2); }
.tab-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tab-card .tc-head { display: flex; align-items: center; gap: 7px; min-width: 0; }
.tab-card .tc-title {
  flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tab-card .tc-menu {
  flex: none; width: 20px; height: 24px; margin: -3px 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--faint); font-size: 16px; line-height: 1;
}
.tab-card .tc-menu:active { color: var(--text); }
.tab-card .tc-close {
  flex: none; width: 24px; height: 24px; margin: -3px -5px -3px 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--surface2); color: var(--dim); font-size: 11px;
}
.tab-card .tc-close:active { background: var(--surface3); color: var(--text); }
.tab-card .tc-proj {
  font-family: var(--mono); font-size: 10.5px; color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tab-card .tc-body {
  flex: 1; font-size: 12.5px; line-height: 1.45; color: var(--dim);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.tab-card .tc-body.busy { font-family: var(--mono); font-size: 11.5px; color: var(--accent); }
.s-card .proj .missing, .tab-card .tc-proj .missing { color: var(--err); }
.tab-card .tc-meta { display: flex; flex-wrap: wrap; gap: 2px 8px; font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.tab-card .tc-meta .active { color: var(--accent); font-weight: 700; }
.tab-card .tc-meta .error { color: var(--err); font-weight: 700; }

/* ---------- drawer (left navigation panel) ---------- */
#drawer-root:empty { display: none; }
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,0.5);
  animation: fadein 0.15s ease;
}
.drawer {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: min(84vw, 320px);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: calc(var(--sat) + 9px) 12px calc(var(--sab) + 14px);
  display: flex; flex-direction: column;
  animation: slidein 0.2s ease;
}
@keyframes slidein { from { transform: translateX(-40px); opacity: 0.5; } }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-backdrop, .qo-panel, .qo-backdrop { animation: none; } }
.drawer-head {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 16px; font-weight: 700;
  /* left: room for the ❮ menu button sitting over the drawer */
  padding: 6px 10px 16px 46px;
  cursor: pointer;
}
.drawer-nav { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.nav-item {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  padding: 15px 12px; border-radius: 12px;
  font-size: 16.5px; font-weight: 600;
}
.nav-item:active { background: var(--surface2); }
.nav-item.on { background: var(--accent-soft); color: var(--accent); }
.nav-item .n-icon { width: 26px; text-align: center; font-size: 17px; color: var(--dim); flex: none; }
.nav-item.on .n-icon { color: var(--accent); }
.nav-item .n-label { flex: 1; }
.nav-item .n-count { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
/* something to do on the Agent SDK page (manage devices only) */
.attn-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 4px; vertical-align: top; }
.sdk-cmd { font-family: var(--mono); font-size: 12px; background: var(--surface2); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; word-break: break-all; user-select: text; }
.sdk-err { color: var(--err); }
.sdk-page .a-buttons { margin-top: 12px; }
.drawer-foot {
  border-top: 1px solid var(--border); padding: 12px 10px 0;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 11.5px;
}
.drawer-foot .conn-ok { color: var(--ok); }
.drawer-foot .conn-bad { color: var(--warn); }
.drawer-foot .foot-btn { color: var(--dim); font-family: var(--mono); font-size: 11.5px; padding: 4px 6px; }
.drawer-foot .foot-btn:active { color: var(--text); }
/* copyright, licence and source link: menu bottom and login screen */
.legal-line {
  font-family: var(--mono); font-size: 10.5px; line-height: 1.5; color: var(--faint);
  padding: 10px 10px 0; text-align: center;
}
.legal-line a { color: var(--dim); text-decoration: underline; }

/* ---------- home ---------- */
.home-h {
  font-size: 26px; font-weight: 700; letter-spacing: -0.02em;
  margin: 20px 2px 12px;
}
.home-link { cursor: pointer; }
.home-more { color: var(--dim); font-weight: 400; }
.home-empty { color: var(--dim); font-size: 14.5px; line-height: 1.5; }
.incognito-btn { width: 100%; margin-top: 14px; padding: 12px; }

.carousel {
  display: flex; gap: 10px;
  margin: 0 -14px; padding: 2px 14px 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel .s-card { flex: 0 0 min(86%, 360px); scroll-snap-align: center; margin-bottom: 2px; }

/* VS Code style recent-project rows */
.vs-list { display: flex; flex-direction: column; }
.vs-row {
  display: flex; align-items: baseline; gap: 12px;
  width: 100%; text-align: left;
  padding: 10px 2px; min-width: 0;
}
.vs-row .vs-name { color: var(--accent); font-size: 17px; font-weight: 500; white-space: nowrap; }
.vs-row .vs-path {
  color: var(--dim); font-family: var(--mono); font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vs-row:active .vs-name { text-decoration: underline; }

/* ---------- big list items ---------- */
.item {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 15px;
  margin-bottom: 10px;
}
.item:active { background: var(--surface2); }
.item-icon { flex: none; width: 28px; text-align: center; font-size: 19px; color: var(--dim); }
.item-main { flex: 1; min-width: 0; }
.item-title { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.item-title .item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.item-title.mono .item-name { font-family: var(--mono); font-size: 15.5px; }
.item-sub {
  font-size: 13.5px; color: var(--dim); margin-top: 4px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.item-side {
  flex: none; text-align: right;
  font-family: var(--mono); font-size: 11px; color: var(--faint); line-height: 1.6;
}
.item-list { padding-bottom: calc(var(--sab) + 20px); }

.search-input {
  width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 15px;
  font-size: 16px; color: var(--text); outline: none;
  margin-bottom: 12px; -webkit-appearance: none;
}
.search-input:focus { border-color: var(--accent); }

/* ---------- quick-open (More… project search) ---------- */
.qo-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,0.55);
  animation: fadein 0.15s ease;
}
.qo-panel {
  margin: calc(var(--sat) + 12px) 12px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  max-height: 72dvh;
  display: flex; flex-direction: column;
  animation: dropin 0.18s ease;
}
@keyframes dropin { from { transform: translateY(-16px); opacity: 0.5; } }
.qo-panel > div { display: flex; flex-direction: column; min-height: 0; }
.qo-panel .item-list { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }

/* ---------- key/value rows (sheets) ---------- */
.kv {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.kv .kv-k { color: var(--dim); flex: none; }
.kv .kv-v { font-family: var(--mono); font-size: 12.5px; text-align: right; word-break: break-all; }
.lib-detail-desc { font-size: 14.5px; line-height: 1.55; margin-bottom: 12px; }

/* ---------- chat ---------- */
#chat-wrap { display: flex; flex-direction: column; height: 100%; }
#msgs {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 12px 6px; -webkit-overflow-scrolling: touch;
}
.msg { margin-bottom: 12px; max-width: 100%; }

.m-user {
  background: var(--user-bubble);
  border-radius: 16px 16px 4px 16px;
  padding: 9px 13px;
  margin-left: 15%;
  font-size: 15px; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word;
}
.m-user { position: relative; }
/* "edit from here" on the last few prompts; the bubble itself stays plain
   text, so a long press selects it */
.m-edit {
  display: none; position: absolute; top: -8px; right: -8px;
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--dim); font-size: 13px; line-height: 24px; text-align: center;
  cursor: pointer; user-select: none; -webkit-user-select: none;
}
.m-user.can-edit .m-edit { display: block; }
.m-user.external::after {
  content: "⌁ sent from terminal";
  display: block; margin-top: 5px;
  font-size: 10.5px; letter-spacing: 0.03em;
  color: var(--dim, #8a8578); opacity: 0.8;
}
.m-assist { font-size: 15px; line-height: 1.55; word-break: break-word; }
.m-assist.streaming { white-space: pre-wrap; }
.m-assist p { margin: 0 0 8px; }
.m-assist p:last-child { margin-bottom: 0; }
.m-assist h1, .m-assist h2, .m-assist h3 { margin: 14px 0 6px; font-size: 1.05em; }
.m-assist h1 { font-size: 1.15em; }
.m-assist ul, .m-assist ol { margin: 4px 0 8px 22px; }
.m-assist li { margin-bottom: 3px; }
.m-assist code {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--surface2); border-radius: 4px; padding: 1px 5px;
}
.m-assist pre {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; margin: 8px 0;
  overflow-x: auto; font-size: 12.5px; line-height: 1.5;
}
/* Safari will not select anything on the last line of a block wide enough
   to scroll (neither padding nor a styled scrollbar helped), so the block
   gets one more, empty line. Generated content: it is never selected or
   copied along with the code. */
.m-assist pre code::after { content: "\A "; white-space: pre; }
.m-assist pre::-webkit-scrollbar { height: 12px; }
.m-assist pre::-webkit-scrollbar-track { background: transparent; }
.m-assist pre::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
.m-assist pre code { background: none; padding: 0; font-size: inherit; }
.code-wrap { position: relative; }
.code-copy {
  position: absolute; top: 6px; right: 6px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--dim); font-size: 14px; line-height: 1; padding: 6px 8px; cursor: pointer;
}
/* drawn, not text: a summary, a selection or find never picks it up */
.code-copy::before { content: "⧉"; }
.m-assist blockquote { border-left: 3px solid var(--border); padding-left: 10px; color: var(--dim); margin: 8px 0; }
.m-assist blockquote > :last-child { margin-bottom: 0; }
.m-assist table { border-collapse: collapse; margin: 8px 0; font-size: 13px; display: block; overflow-x: auto; }
.m-assist th, .m-assist td { border: 1px solid var(--border); padding: 5px 9px; text-align: left; }
.m-assist th { background: var(--surface2); font-weight: 600; }
.m-assist hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* thinking */
.m-think {
  border-left: 2px solid var(--border);
  padding: 2px 0 2px 10px;
  margin: 6px 0 10px;
}
.m-think summary {
  font-family: var(--mono); font-size: 11px; color: var(--faint);
  cursor: pointer; list-style: none; user-select: none;
}
.m-think summary::-webkit-details-marker { display: none; }
.m-think .think-body {
  color: var(--dim); font-size: 13px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; margin-top: 6px;
}

/* tool cards */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 8px 0;
  overflow: hidden;
  font-size: 13px;
}
.tool-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 11px;
  font-family: var(--mono); font-size: 12px;
  width: 100%; text-align: left;
}
.tool-row { display: flex; align-items: stretch; }
.tool-row .tool-head { flex: 1; min-width: 0; width: auto; }
.tool-row .t-open {
  flex: none; padding: 0 13px; font-size: 14px;
  color: var(--accent); border-left: 1px solid var(--border);
}
.tool-head .t-icon { flex: none; font-size: 13px; }
.tool-head .t-name { font-weight: 600; flex: none; }
.tool-head .t-sum { color: var(--dim); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-head .t-state { flex: none; font-size: 12px; color: var(--faint); }
.tool-head .t-state.ok { color: var(--ok); }
.tool-head .t-state.err { color: var(--err); }
.tool-head .t-state.spin { color: var(--accent); animation: pulse 1.1s infinite; }
.tool-body { border-top: 1px solid var(--border); padding: 9px 11px; display: none; }
.tool-card.open .tool-body { display: block; }
.tool-body pre {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  max-height: 300px; overflow-y: auto;
}
.tool-body .out-label { font-family: var(--mono); font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em; margin: 8px 0 4px; }
.tool-body .out-label:first-child { margin-top: 0; }
.diff-old { color: var(--err); }
.diff-new { color: var(--ok); }
.todo-list { list-style: none; margin: 0; }
.todo-list li { padding: 2px 0; font-size: 13px; }
.todo-list .td-done { color: var(--dim); text-decoration: line-through; }
.todo-list .td-active { color: var(--accent); }
.nested-tools { margin: 4px 0 4px 14px; border-left: 2px solid var(--border); padding-left: 8px; }

/* action cards: permission / question / plan */
.action-card {
  background: var(--surface);
  border: 1px solid var(--warn);
  border-radius: 12px;
  padding: 12px 13px;
  margin: 10px 0;
  /* a long unbroken rule or path must wrap, not widen the whole chat */
  overflow-wrap: anywhere;
}
.action-card.resolved { border-color: var(--border); opacity: 0.75; }
.action-card .a-head {
  display: flex; gap: 8px; align-items: center;
  font-family: var(--mono); font-size: 11px; color: var(--warn);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px;
}
.action-card.resolved .a-head { color: var(--faint); }
.action-card .a-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.action-card .a-desc { font-size: 13px; color: var(--dim); margin-bottom: 8px; }
.action-card pre {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  background: var(--surface2); border-radius: 8px; padding: 8px 10px;
  margin: 6px 0 10px; white-space: pre-wrap; word-break: break-word;
  max-height: 220px; overflow-y: auto;
}
.a-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  padding: 9px 15px; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--border);
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--err); border-color: var(--err); }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; }
/* last button of a row takes the space left after the others; on a narrow
   screen its label is cut ("Deny wi…") rather than wrapping to a new line */
.btn.a-fill {
  flex: 1 1 0; min-width: 4.5em; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.a-outcome { font-family: var(--mono); font-size: 12px; color: var(--dim); }

.q-option {
  display: block; width: 100%; text-align: left;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 7px;
}
.q-option:active, .q-option.sel { border-color: var(--accent); background: var(--accent-soft); }
.q-option .q-label { font-weight: 600; font-size: 14px; }
.q-option .q-desc { font-size: 12px; color: var(--dim); margin-top: 2px; }
.q-other-input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; font-size: 14px; margin-bottom: 7px;
  color: var(--text); outline: none;
}

/* dividers and notices */
.divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--faint); font-family: var(--mono); font-size: 11px;
  margin: 16px 0;
}
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.notice { font-family: var(--mono); font-size: 12px; color: var(--dim); margin: 8px 0; white-space: pre-wrap; word-break: break-word; }
.notice.error { color: var(--err); }
.notice.warn { color: var(--warn); }
.turn-result {
  font-family: var(--mono); font-size: 10.5px; color: var(--faint);
  margin: 2px 0 14px; text-align: right;
}
/* turns: folded, the prompt + the answer's last paragraph (3 lines) */
.turn-sum, .turn.folded > .turn-body, .turn.folded > .turn-fold { display: none; }
.turn.folded > .turn-sum { display: block; }
.turn-sum {
  width: 100%; margin: 0 0 14px; padding: 8px 10px; text-align: left;
  background: none; border: 1px dashed var(--border); border-radius: 10px;
  color: var(--text); font: inherit; cursor: pointer;
}
.turn-sum .ts-text {
  font-size: 14px; line-height: 1.45; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.turn-sum * + .ts-text, .turn-sum .ts-text + .ts-list { margin-top: 6px; }
.turn-sum .ts-list { font-size: 14px; line-height: 1.45; }
.turn-sum .ts-row { display: flex; gap: 6px; margin-bottom: 2px; }
.turn-sum .ts-n { flex: none; min-width: 1.2em; color: var(--dim); }
.turn-sum .ts-li {
  flex: 1; min-width: 0;
  word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.turn-sum .ts-more { font-size: 14px; color: var(--dim); }
.turn-sum .ts-meta { margin-top: 4px; font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.turn-fold {
  display: block; margin: -10px auto 12px 0; padding: 2px 4px;
  background: none; border: none; font-family: var(--mono); font-size: 10.5px;
  color: var(--faint); cursor: pointer;
}
.turn-fold.top { margin: -6px auto 8px 0; }
.turn:last-child > .turn-fold { display: none; }

/* status line + composer */
#status-line {
  flex: none;
  padding: 6px 14px;
  font-family: var(--mono); font-size: 12px; color: var(--dim);
  display: flex; gap: 8px; align-items: baseline;
  border-top: 1px solid var(--border);
  background: var(--bg);
  min-height: 28px;
}
#status-line .caret { color: var(--accent); font-weight: 700; animation: blink 1.1s step-end infinite; }
#status-line.quiet .caret { animation: none; color: var(--faint); }
#status-line .s-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#status-line .s-conn { color: var(--err); }
/* plan usage, right-aligned: "21% (5h) · 82% (7d)" */
#status-line .s-usage { flex: none; color: var(--faint); white-space: nowrap; }
#status-line .s-usage .mid { color: var(--warn); }
#status-line .s-usage .high { color: var(--err); }
/* chat while True View runs: the way back to the terminal */
#tv-bar {
  flex: none;
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  padding: 6px 14px;
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
#tv-bar.hidden { display: none; }
#tv-bar button {
  font-family: var(--mono); font-size: 12px; padding: 5px 12px;
  border: 1px solid var(--accent); border-radius: 8px;
  color: var(--accent); background: transparent;
}
/* the session's node is away (remote.py): the chat stays readable, nothing
   can be sent or answered until it is back */
#node-bar {
  flex: none;
  padding: 6px 14px;
  font-family: var(--mono); font-size: 12px; color: var(--dim);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
#node-bar.hidden { display: none; }
#chat-wrap.node-off .a-buttons button, #chat-wrap.node-off .c-btn { opacity: .45; pointer-events: none; }
/* a session (or node button) on a node that is offline or updating */
.s-card.node-off, .tab-card.node-off, .btn.node-off { opacity: .5; }
.node-switch { margin: 0 0 12px; flex-wrap: wrap; }

/* info sheet: a bar right under each plan-usage row */
.usage-row { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.usage-row .kv { border-bottom: none; padding-bottom: 2px; }

#composer {
  flex: none;
  display: flex; gap: 8px; align-items: flex-end;
  padding: 8px 12px calc(var(--sab) + 10px);
  background: var(--bg);
  /* --c-gap: 0 while iOS leaves a black band under a short web view */
  padding-bottom: calc(var(--sab) + var(--c-gap, 10px));
}
#composer .c-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 15px; line-height: 1.4;
  color: var(--text);
  resize: none; outline: none;
  max-height: 132px;
  min-height: 42px;
}
#composer .c-input:focus { border-color: var(--accent); }
.c-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  font-size: 18px; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--dim);
}
.c-btn.send { background: var(--accent); border-color: var(--accent); color: #fff; }
.c-btn.stop { background: var(--err); border-color: var(--err); color: #fff; }
#stop-btn.hidden { display: none; }
.c-btn:active { transform: scale(0.94); }
.c-btn:disabled { opacity: 0.4; }

/* mode strip above composer */
#mode-strip {
  flex: none; display: flex; gap: 6px; align-items: center;
  padding: 6px 14px 0;
  overflow-x: auto; scrollbar-width: none;
}
#mode-strip::-webkit-scrollbar { display: none; }

/* ---------- sheets ---------- */
#sheet-root:empty { display: none; }
.sheet-backdrop {
  /* above the drawer (60) and quick-open (70): a sheet opened from them,
     e.g. "sign out" in the drawer, must not open underneath */
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.55);
  display: flex; flex-direction: column; justify-content: flex-end;
  animation: fadein 0.15s ease;
}
@keyframes fadein { from { opacity: 0; } }
.sheet {
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  padding: 10px 14px calc(var(--sab) + 16px);
  max-height: 82dvh;
  display: flex; flex-direction: column;
  animation: slideup 0.2s ease;
}
@keyframes slideup { from { transform: translateY(40px); opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-backdrop { animation: none; } }
.sheet .grab { width: 38px; height: 4px; border-radius: 2px; background: var(--border); margin: 2px auto 12px; flex: none; }
.sheet .sheet-title { font-family: var(--mono); font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.sheet .sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* a fixed head over a .sheet-body list: without min-height the column grows
   past the sheet's max-height and the list below the screen cannot scroll */
.sheet .sheet-col { display: flex; flex-direction: column; min-height: 0; }
.sheet .sheet-foot { flex: none; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
/* project files: a file on a sheet (app.js fileSheet) */
.file-text { font-family: var(--mono); font-size: 12px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.file-find { position: sticky; top: 0; z-index: 1; background: var(--surface); display: flex; gap: 6px; align-items: center; padding-bottom: 8px; }
.sheet .file-find input[type="text"] { flex: 1; min-width: 0; margin-bottom: 0; }
.file-find .ff-count { font-family: var(--mono); font-size: 11px; color: var(--dim); flex: none; }
/* find in a file and in the chat (app.js findBar) */
mark.find-mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 2px; }
mark.find-mark.cur { background: var(--accent); color: var(--bg); }
.chat-find { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.file-img { display: block; max-width: 100%; height: auto; margin: 0 auto; background: repeating-conic-gradient(#8883 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.file-img-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.file-img-wrap.full .file-img { max-width: none; }
.file-img-wrap.zoomable .file-img { cursor: zoom-in; }
.file-img-wrap.zoomable.full .file-img { cursor: zoom-out; }
a.btn { display: inline-block; color: inherit; text-decoration: none; text-align: center; }
/* /btw: oldest first, earlier exchanges dimmed, the open one in full, box in the foot */
.btw-q { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.btw-a { margin: 8px 0 4px; overflow-wrap: anywhere; }
.btw-a.dim { color: var(--dim); font-style: italic; }
.btw-a.err { color: var(--err); }
.btw-meta { display: flex; gap: 10px; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 11px; color: var(--dim); }
.btw-old { display: block; width: 100%; text-align: left; padding: 9px 2px;
  border-bottom: 1px solid var(--border); opacity: 0.6; }
.btw-cur { padding: 10px 0 4px; }
.btw-cur:not(:last-child) { border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.btw-snip { font-size: 13px; color: var(--dim); margin-top: 2px; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.btw-foot { display: flex; flex-direction: column; gap: 8px; }
.btw-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 14px; padding: 9px 12px; font-size: 15px; line-height: 1.4;
  resize: none; outline: none; min-height: 42px; max-height: 120px;
}
.btw-input:focus { border-color: var(--accent); }
.sheet-item {
  display: flex; gap: 11px; align-items: center;
  width: 100%; text-align: left;
  padding: 12px 8px; font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.sheet-item:last-child { border-bottom: none; }
.sheet-item:active { background: var(--surface2); }
.sheet-item .si-icon { width: 24px; text-align: center; flex: none; font-size: 16px; }
.sheet-item .si-main { flex: 1; min-width: 0; }
.sheet-item .si-sub { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-top: 1px; }
.sheet-item.danger { color: var(--err); }
/* the default choice: accent, and ⏎ takes it with a keyboard */
.sheet-item.primary { color: var(--accent); font-weight: 600; }
.sheet-item .si-check { color: var(--accent); flex: none; }
.sheet input[type="search"], .sheet input[type="text"], .chat-find input[type="text"] {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; font-size: 15px; margin-bottom: 10px;
  color: var(--text); outline: none; -webkit-appearance: none;
}
/* after the rule above, which gives inputs a bottom margin */
.chat-find input[type="text"] { flex: 1; min-width: 0; margin-bottom: 0; }

/* ---------- scope badge ---------- */
.badge {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 3px 7px; border-radius: 6px;
  background: var(--surface3); color: var(--dim); flex: none;
  max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge.project { color: var(--accent); }
.badge.plugin { color: var(--warn); }

/* ---------- context meter ---------- */
.ctx-bar { height: 4px; background: var(--surface3); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.ctx-bar .fill { height: 100%; background: var(--ok); border-radius: 2px; transition: width 0.4s ease; }
.ctx-bar .fill.mid { background: var(--warn); }
.ctx-bar .fill.high { background: var(--err); }

/* ---------- login ---------- */
.login-box { max-width: 380px; margin: 16dvh auto 0; padding: 0 22px; text-align: center; }
.login-box .glyph { font-family: var(--mono); font-size: 44px; color: var(--accent); }
.login-box h1 { font-family: var(--mono); font-size: 19px; margin: 10px 0 4px; }
.login-box p { color: var(--dim); font-size: 13.5px; margin-bottom: 22px; line-height: 1.5; }
.login-box input {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; font-size: 15px;
  font-family: var(--mono); color: var(--text); outline: none;
  text-align: center; margin-bottom: 12px;
}
.login-box input:focus { border-color: var(--accent); }
.login-box .btn { width: 100%; padding: 12px; }
.login-err { color: var(--err); font-size: 13px; margin-top: 10px; font-family: var(--mono); }
/* login, lock and gate screens: the legal line sits at the bottom of the
   screen, or below the box when that is taller */
.gate-screen { min-height: 100%; display: flex; flex-direction: column; }
.gate-screen > .login-box { width: 100%; }
.gate-screen > .legal-line { margin-top: auto; padding: 28px 16px calc(var(--sab) + 14px); }
.login-box p.quiet { color: var(--faint); font-size: 12.5px; margin: 22px 0 0; text-align: left; }
.login-box p.quiet code { font-family: var(--mono); font-size: 12px; word-break: break-all; }
/* "or — sign in with passkey", shown only where WebAuthn can work */
.login-or {
  color: var(--dim); font-size: 12px; font-family: var(--mono);
  margin: 2px 0 10px; text-transform: uppercase; letter-spacing: 0.08em;
}

/* passkeys, under the device list */
.pk-section { margin-top: 26px; }
.pk-section .btn { width: 100%; margin-top: 12px; }

/* "new version" pill: the page is stale, a tap reloads it */
.update-pill {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--sab) + 16px); z-index: 120;
  background: var(--accent); color: #141210;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  padding: 10px 18px; border-radius: 99px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  animation: fadein 0.2s ease;
}

/* ---------- toasts ---------- */
#toast-root {
  position: fixed; top: calc(var(--sat) + 10px); left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 100; pointer-events: none;
}
.toast {
  background: var(--surface3); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-family: var(--mono);
  padding: 9px 16px; border-radius: 99px;
  max-width: 86vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: fadein 0.2s ease;
}
.toast.error { border-color: var(--err); color: var(--err); }

.conn-pill {
  font-family: var(--mono); font-size: 11px; color: var(--warn);
  text-align: center; padding: 4px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* ---------- true view (real claude TUI) ---------- */
/* Always dark: it's a terminal, and the TUI's ANSI palette assumes one. */
#term-wrap {
  display: flex; flex-direction: column;
  height: 100%; background: #141210;
}
#term-host { position: relative; flex: 1; min-height: 0; padding: 6px 0 0 8px; }
#term { height: 100%; }
#term .xterm { height: 100%; }
#term-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 20px; text-align: center;
  background: rgba(13, 11, 9, 0.85);
  font-family: var(--mono); font-size: 13px; color: #ede6de;
}
#term-overlay.hidden { display: none; }
#term-overlay .term-actions { display: flex; gap: 10px; }
#term-overlay button {
  font-family: var(--mono); font-size: 13px; padding: 8px 16px;
  border: 1px solid #4a4038; border-radius: 9px;
  color: #ede6de; background: #28241f;
}
#term-overlay button:active { border-color: #e8825e; color: #e8825e; }
#term-keys {
  flex: none; display: flex; gap: 6px; overflow-x: auto;
  padding: 8px 10px calc(var(--sab) + 8px);
  background: #1e1b18; border-top: 1px solid #362f28;
}
.term-key {
  font-family: var(--mono); font-size: 13px; color: #a2968a;
  border: 1px solid #362f28; background: #28241f; border-radius: 8px;
  padding: 7px 13px; flex: none; line-height: 1;
}
.term-key:active { color: #e8825e; border-color: #e8825e; }

.login-box .btn { margin-bottom: 10px; }

/* ---------- physical keyboard ---------- */
button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.btn:focus-visible { outline-offset: 2px; }
/* key hints and the active-card ring only where a mouse or trackpad suggests
   a physical keyboard; a phone looks as before. any-pointer: an iPad with a
   trackpad keyboard keeps the touch screen as its primary pointer */
.k-hint { display: none; }
@media (any-pointer: fine) {
  .k-hint {
    display: inline-block; margin-left: 7px; padding: 0 4px; min-width: 16px;
    border: 1px solid currentColor; border-radius: 4px; opacity: 0.6;
    font-family: var(--mono); font-size: 10.5px; font-weight: 600;
    line-height: 15px; text-align: center; vertical-align: 1px;
  }
  .q-label .k-hint { margin: 0 8px 0 0; }
  .action-card.kbd-target { box-shadow: 0 0 0 1px var(--warn); }
}

/* pins: a mark on a pinned tab card, a toggle on project list rows */
.tab-card .tc-pin {
  flex: none; width: 22px; height: 24px; margin: -3px 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1; opacity: .25; filter: grayscale(1);
}
.tab-card .tc-pin.on { opacity: 1; filter: none; }
.vs-row .vs-pin { flex: none; margin-left: auto; font-size: 12px; }
.item-pin {
  flex: none; align-self: stretch; display: flex; align-items: center;
  /* the whole right edge of the row is the target, not the glyph alone */
  margin: -16px -15px -16px -8px; padding: 0 15px 0 8px;
  font-size: 15px; line-height: 1; opacity: .25; filter: grayscale(1);
}
.item-pin.on { opacity: 1; filter: none; }

/* ---------- search (past sessions) ---------- */
.search-snip {
  font-size: 13.5px; color: var(--text); margin-top: 6px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.search-role { color: var(--faint); font-family: var(--mono); font-size: 11.5px; }

/* images waiting in the box, above it */
#c-images { display: flex; gap: 8px; padding: 6px 12px 0; overflow-x: auto; flex: none; }
#c-images.hidden { display: none; }
.c-img { position: relative; flex: none; }
.c-img img { display: block; height: 64px; max-width: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.c-img-x {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  font-size: 11px; display: flex; align-items: center; justify-content: center; padding: 0;
}
/* 🖼 in a sent message: opens the image */
.m-images { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.m-img { background: none; border: 1px solid currentColor; border-radius: 10px; padding: 3px 9px; font: inherit; font-size: 13px; color: inherit; opacity: 0.85; }
.m-img:disabled { opacity: 0.4; }
/* 📄 a long text pasted into the box (a chip, not the text) */
.c-paste {
  height: 64px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font: inherit; font-size: 13px; white-space: nowrap;
}
/* a paste or a whole message in a sheet */
.text-view {
  max-height: 60vh; overflow: auto; margin: 0; padding: 10px; border-radius: 8px;
  background: var(--surface2); font-family: var(--mono); font-size: 12px;
  white-space: pre-wrap; word-break: break-word;
}
