/* OwlChat — design tokens shared with the Android app (docs/API.md). Flat, no borders on tiles, no 3D. */
:root, [data-theme="dark"] {
  --bg: #14161F; --surface: #1C1F2B; --surface2: #252938; --border: #2E3345;
  --text: #F4F1EA; --muted: #A3A6B4; --accent: #F5A524; --on-accent: #14161F;
  --user: #F5A52426; --danger: #E5484D; --ok: #46A758; --scrim: #0009;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F4F1EA; --surface: #FFFFFF; --surface2: #ECE8DF; --border: #DDD8CC;
  --text: #14161F; --muted: #5E6170; --accent: #F5A524; --on-accent: #14161F;
  --user: #F5A52433; --danger: #D93036; --ok: #2F8A3E; --scrim: #0005;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
body { overflow: hidden; }
#app { height: 100%; height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); }
.mono, code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 12px; background: var(--surface2); font-weight: 600; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.small { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; height: 42px; padding: 0 12px; border-radius: 12px; border: 0;
  background: var(--surface2); outline: none; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus { box-shadow: 0 0 0 2px var(--accent); }
.seg { display: inline-flex; background: var(--surface2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { height: 34px; padding: 0 14px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--accent); color: var(--on-accent); }
.switch { position: relative; width: 44px; height: 26px; border-radius: 13px; background: var(--surface2); flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 21px; background: var(--on-accent); }

/* login */
.login { height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login form { width: 100%; max-width: 360px; }
.login .brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 28px; }
.login .brand img { width: 120px; }
.login h1 { margin: 0; font-size: 24px; }
.err { color: var(--danger); font-size: 14px; min-height: 20px; margin: 6px 0 10px; }
.remember { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); margin: -2px 0 4px; cursor: pointer; }
.remember input { accent-color: var(--accent); }

/* layout */
.shell { display: flex; height: 100%; }
.side { width: var(--side-w, 300px); flex: none; background: var(--surface); display: flex; flex-direction: column; height: 100%; }
.side-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 10px 16px; }
.side-head img { width: 34px; }
.side-head b { font-size: 17px; flex: 1; }
.side-actions { display: flex; gap: 8px; padding: 0 12px 10px; }
.side-actions .btn { flex: 1; }
.tree { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.tree-label { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; display: flex; align-items: center; }
.tree-label span { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 6px 0 10px; border-radius: 10px; color: var(--text); width: 100%; text-align: left; }
.row:hover { background: var(--surface2); }
.row.on { background: var(--surface2); }
.row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .n { font-size: 12px; color: var(--muted); }
.row .more { opacity: 0; width: 30px; height: 30px; }
.row:hover .more, .row.on .more { opacity: 1; }
.row.chat { padding-left: 34px; min-height: 34px; font-size: 14px; }
.row.chat.top { padding-left: 10px; }
.row.sub { padding-left: 34px; min-height: 30px; font-size: 13px; color: var(--muted); }
.folder-caret { transition: transform .15s; }
.folder.open .folder-caret { transform: rotate(90deg); }
.side-foot { padding: 10px 12px 14px; display: flex; gap: 8px; align-items: center; }
.side-foot .who { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 60px; }
.topbar .title { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumb { font-size: 12px; color: var(--muted); }
.menu-btn { display: none; }
.model-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 12px; background: var(--surface2); font-weight: 600; font-size: 14px; max-width: 46vw; }
.model-btn .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.dot.omni { background: #7D76FF; }
.tok-chip { height: 36px; padding: 0 10px; border-radius: 12px; background: var(--surface2); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.tok-chip.heavy { color: var(--accent); }
.divider { display: flex; align-items: center; gap: 12px; width: 100%; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.divider:hover { color: var(--text); }
.compacting { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.summary-body { max-height: 55vh; overflow-y: auto; background: var(--surface2); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.tile-row.wrap { flex-wrap: wrap; }
.tile-row.wrap .grow { flex: 1 1 100%; }
.srv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.srv { display: flex; flex-direction: column; gap: 12px; }
.srv-row small { display: block; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.status-dot.on { background: var(--ok); } .status-dot.off { background: var(--danger); }
.srv-procs summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.srv-procs .tbl td { font-size: 12px; }
.db-wrap { display: flex; gap: 12px; align-items: flex-start; }
.db-side { width: 260px; flex: none; background: var(--surface); border-radius: 12px; padding: 6px; max-height: 70vh; overflow-y: auto; }
.db-side .row .n { font-size: 11px; }
.db-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.db-grid { overflow: auto; max-height: 60vh; background: var(--surface); border-radius: 12px; }
.db-grid .tbl { font-size: 12px; white-space: nowrap; }
.db-grid .tbl th { position: sticky; top: 0; background: var(--surface); }
.db-grid .tbl td { max-width: 360px; overflow: hidden; text-overflow: ellipsis; border-top: 1px solid var(--border); }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface2); }
@media (max-width: 767.98px) { .db-wrap { flex-direction: column; } .db-side { width: 100%; max-height: 30vh; } .srv-grid { grid-template-columns: 1fr; } }
.svc-list { max-height: 38vh; overflow-y: auto; background: var(--surface2); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.svc-list .group { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.svc-list .item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; font-size: 14px; }
.svc-list .item:hover, .svc-list .item.on { background: var(--surface); }
.svc-list .item .pill { flex: none; }
.svc-list .item.on { box-shadow: inset 0 0 0 2px var(--accent); }
.svc-list .desc { font-size: 12px; color: var(--muted); }
.svc-picked { display: flex; flex-direction: column; margin-bottom: 12px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; background: var(--surface2); margin-bottom: 8px; }
.opt:hover { filter: brightness(1.08); }
.opt.rec { box-shadow: inset 0 0 0 2px var(--accent); }
.opt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.opt-main small { color: var(--muted); }
.thinking { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.system-row { margin-bottom: 4px; } .system-row .n { font-size: 11px; }
.secret { white-space: pre-wrap; word-break: break-all; background: var(--surface2); border-radius: 10px; padding: 10px 12px; margin-top: 10px; font-size: 13px; }

.banner { margin: 0 12px 8px; padding: 10px 14px; border-radius: 12px; background: var(--surface2); font-size: 14px; display: flex; gap: 10px; align-items: center; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.msgs { flex: 1; overflow-y: auto; padding: 8px 16px 24px; scroll-behavior: auto; }
.msgs-inner { max-width: var(--col-w); margin: 0; display: flex; flex-direction: column; gap: 18px; }
.msg.user { align-self: flex-end; max-width: 85%; background: var(--user); padding: 10px 14px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; word-wrap: break-word; }
.msg.assistant { align-self: stretch; word-wrap: break-word; }
.msg .meta { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; gap: 12px; align-items: center; }
.msg .meta button { color: var(--muted); font-size: 12px; }
.msg .meta button:hover { color: var(--text); }
.msg.error .body { color: var(--danger); }
.msg .errline { color: var(--danger); font-size: 13px; margin-top: 4px; }
.cursor::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.md p { margin: 0 0 10px; } .md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 16px 0 8px; line-height: 1.3; } .md h1 { font-size: 20px; } .md h2 { font-size: 18px; } .md h3, .md h4 { font-size: 16px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md code { background: var(--surface2); padding: 1px 5px; border-radius: 6px; font-size: 13.5px; }
.md pre { position: relative; background: var(--surface2); padding: 12px 14px; border-radius: 12px; overflow-x: auto; margin: 0 0 10px; }
.md pre code { background: none; padding: 0; font-size: 13px; line-height: 1.5; }
.md pre .copy { position: absolute; top: 6px; right: 6px; font-size: 12px; color: var(--muted); padding: 4px 8px; border-radius: 8px; background: var(--surface); }
.md blockquote { margin: 0 0 10px; padding-left: 12px; border-left: 3px solid var(--accent); color: var(--muted); }
.md table { border-collapse: collapse; margin: 0 0 10px; display: block; overflow-x: auto; }
.md th, .md td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.md hr { border: 0; height: 1px; background: var(--border); margin: 14px 0; }

.composer { padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); }
.composer-inner { max-width: var(--col-w); margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; background: var(--surface); border-radius: 16px; padding: 8px; }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; resize: none; max-height: 40vh; min-height: 40px; padding: 9px 8px; line-height: 1.45; }
.send { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.send:disabled { opacity: .4; }
.send.stop { background: var(--surface2); color: var(--text); }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }
.empty img { width: 110px; opacity: .9; }
.empty h2 { margin: 0; font-size: 20px; }

/* popovers / sheets / modals */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }
.pop { position: fixed; z-index: 50; background: var(--surface); border-radius: 14px; padding: 6px; min-width: 200px; max-width: min(360px, 92vw);
  max-height: 70vh; overflow-y: auto; box-shadow: 0 8px 30px #0006; }
.pop .item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border-radius: 10px; font-size: 14px; }
.pop .item:hover, .pop .item.on { background: var(--surface2); }
.pop .item.danger { color: var(--danger); }
.pop .group { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 4px; }
.pop .item .desc { font-size: 12px; color: var(--muted); }
.pop input.input { margin: 4px 0 6px; height: 36px; }
.modal { position: fixed; z-index: 50; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; pointer-events: none; }
.modal .card { pointer-events: auto; background: var(--surface); border-radius: 16px; padding: 20px; width: 100%; max-width: 420px; }
.modal h3 { margin: 0 0 14px; font-size: 18px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw; }

/* settings */
.settings { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; }
.settings-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 60px; }
.settings-head b { font-size: 18px; flex: 1; }
.settings-body { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; justify-content: flex-start; padding: 0 16px 40px; }
.settings-wrap { width: 100%; min-width: 0; max-width: 1180px; display: flex; gap: 28px; }
.tabs { width: 180px; flex: none; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; align-self: flex-start; }
.tabs button { text-align: left; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; display: flex; gap: 10px; align-items: center; }
.tabs button.on { background: var(--surface); color: var(--text); }
.pane { flex: 1; min-width: 0; }
.pane h2 { font-size: 20px; margin: 6px 0 16px; }
.pane h4 { margin: 22px 0 10px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tile { background: var(--surface); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.tile-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; row-gap: 10px; }
/* The text keeps at least ~240px; if the controls would squeeze it thinner, they wrap underneath. */
.tile-row .grow { flex: 1 1 240px; min-width: 0; }
.tile-row .grow b { display: block; }
.tile-row .grow small { color: var(--muted); }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface2); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--ok); } .pill.bad { color: var(--danger); } .pill.amber { color: var(--accent); }
.bar { height: 8px; border-radius: 4px; background: var(--surface2); overflow: hidden; margin: 8px 0 4px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar.warn > i { background: #F08C2E; } .bar.danger > i { background: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats .tile b { font-size: 20px; display: block; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl td, .tbl th { padding: 8px 6px; text-align: left; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 12px; }
.tbl td.r, .tbl th.r { text-align: right; }
.days { display: flex; align-items: flex-end; gap: 3px; height: 80px; padding-top: 6px; }
.days i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.days i.omni { background: #7D76FF; }

/* phones */
@media (max-width: 767.98px) {
  .side { position: fixed; z-index: 45; left: 0; top: 0; bottom: 0; width: min(320px, 86vw); transform: translateX(-102%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .settings-wrap { flex-direction: column; gap: 8px; }
  .tabs { width: 100%; min-width: 0; max-width: 100%; flex-direction: row; overflow-x: auto; position: static; overscroll-behavior-x: contain; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .row .more { opacity: 1; }
  .system .tile > .tile-row { flex-wrap: wrap; row-gap: 8px; }
  .svc-row { flex-wrap: wrap; row-gap: 8px; }
  .svc-row > .grow { flex: 1 1 calc(100% - 30px); }
  .system .tile > .tile-row > .grow { flex: 1 1 100%; }
}

/* ───────────── desktop ───────────── */
/* Standard breakpoints (sm 640 · md 768 · lg 1024 · xl 1280 · 2xl 1536). Content is left-aligned and uses most of the width. */
:root { --col-w: 100%; }
@media (min-width: 768px)  { .msgs { padding: 12px 28px 28px; } .composer { padding: 8px 28px 16px; } .topbar { padding: 10px 20px; } }
@media (min-width: 1024px) { .msgs { padding: 16px 40px 32px; } .composer { padding: 8px 40px 18px; } .topbar { padding: 12px 32px; } }
@media (min-width: 1280px) { :root { --col-w: 1120px; } }
@media (min-width: 1536px) { :root { --col-w: 1320px; } }
.side-resize { width: 6px; margin-left: -3px; flex: none; cursor: col-resize; position: relative; z-index: 3; }
.side-resize:hover, body.resizing .side-resize { background: var(--accent); opacity: .5; }
body.resizing { cursor: col-resize; user-select: none; }
.shell.collapsed .side, .shell.collapsed .side-resize { display: none; }
.desk-only { display: inline-flex; }
.side-search { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; padding: 0 10px; height: 36px; border-radius: 10px; background: var(--surface2); color: var(--muted); }
.side-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 14px; }
.side-search svg { width: 16px; height: 16px; }
kbd { font: 11px ui-monospace, Menlo, monospace; padding: 2px 6px; border-radius: 6px; background: var(--surface); color: var(--muted); white-space: nowrap; cursor: default; }
.side-search kbd { cursor: pointer; }
.row.drop, .tree-label.drop { box-shadow: inset 0 0 0 2px var(--accent); background: var(--surface2); border-radius: 10px; }
.row.dragging { opacity: .45; }
.modal.palette { align-items: flex-start; padding-top: 12vh; }
.palette .card { max-width: 620px; padding: 12px; }
.pal-list { max-height: 52vh; overflow-y: auto; margin-top: 8px; }
.palette .group { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 4px; }
.palette .item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border-radius: 10px; font-size: 14px; }
.palette .item.on { background: var(--surface2); }
.pal-foot { font-size: 12px; padding: 8px 4px 0; }
.composer-hint { max-width: var(--col-w); margin: 6px 0 0; padding-left: 10px; font-size: 11.5px; color: var(--muted); }
.msg-user-wrap { align-self: flex-end; max-width: 85%; display: flex; flex-direction: column; align-items: flex-end; }
.msg-user-wrap .msg.user { max-width: 100%; }
.user-actions { display: flex; gap: 12px; font-size: 12px; margin-top: 4px; opacity: 0; transition: opacity .12s; }
.user-actions button { color: var(--muted); } .user-actions button:hover { color: var(--text); }
.msg-user-wrap:hover .user-actions, .msg-user-wrap:focus-within .user-actions { opacity: 1; }
@media (hover: none) { .user-actions { opacity: 1; } }
.msg .meta button:hover { text-decoration: underline; }
@media (min-width: 1024px) {
  .settings { top: 2vh; left: 2vw; right: 2vw; bottom: 2vh; border-radius: 18px; box-shadow: 0 0 0 100vmax #0008, 0 24px 70px #0009; }
  .settings-head { padding: 12px 24px; }
  .settings-body { padding: 4px 32px 40px; }
  .tabs { width: 210px; }
}
@media (max-width: 767.98px) { .desk-only, .side-resize, .composer-hint { display: none !important; } .shell.collapsed .side { display: flex; }
  /* phones: model + size live in the ⋯ menu so the title has room */
  .topbar .model-btn, .topbar .tok-chip { display: none; } }

/* Claude plan usage strip: phones at the very bottom, desktop (≥1024) at the top of the chat */
.plan-strip { display: flex; align-items: center; gap: 14px; padding: 6px 16px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.plan-strip.top { border-top: 0; border-bottom: 1px solid var(--border); padding: 6px 32px 8px; max-width: calc(var(--col-w) + 64px); }
.plan-spark { width: 16px; height: 16px; stroke-width: 2; flex: none; }
.plan-w { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.plan-strip.top .plan-w { flex: 0 1 240px; }
.plan-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; min-width: 40px; }
.plan-bar > i { display: block; height: 100%; background: var(--muted); border-radius: 3px; }
.plan-w.warn .plan-bar > i { background: var(--accent); } .plan-w.danger .plan-bar > i { background: var(--danger); }
.plan-w b, .plan-wk b { color: var(--text); font-weight: 600; } .plan-w span, .plan-wk span { color: var(--muted); }
.plan-wk { flex: none; white-space: nowrap; } .plan-wk.warn b { color: var(--accent); } .plan-wk.danger b { color: var(--danger); }
.plan-strip.top .plan-w { flex: 0 1 320px; }
.composer:has(+ .plan-strip) { padding-bottom: 8px; }

.viewer { overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 4px 2px; flex: 1; min-height: 0; }
.status-dot:not(.on):not(.off) { background: var(--border); }

/* /btw side question + cancel, shown in the message box while an answer is running */
.send.btw, .send.cancel { background: var(--surface2); color: var(--text); }
.send.cancel { color: var(--danger); }
.btw-panel { margin: 0 12px 8px; max-width: var(--col-w); padding: 10px 14px; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); max-height: 38vh; overflow-y: auto; }
.btw-panel .md { margin-top: 6px; font-size: 14px; }
@media (min-width: 768px)  { .btw-panel { margin: 0 28px 8px; } }
@media (min-width: 1024px) { .btw-panel { margin: 0 40px 8px; } }

/* attachments: chips above the message box, thumbnails in sent messages, drop overlay */
.chips { flex: 0 0 100%; display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px 2px; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 8px; max-width: 220px; min-height: 40px; padding: 4px 6px 4px 4px; border-radius: 10px; background: var(--surface2); border: 1px solid transparent; font-size: 13px; }
.chip.bad { border-color: var(--danger); }
.chip img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex: none; }
.chip-ico { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.chip-spin { position: absolute; left: 12px; top: 14px; background: var(--surface2); }
.chip-name { display: flex; flex-direction: column; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.25; }
.chip-name small { color: var(--muted); font-size: 11px; }
.chip-x { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.chip-x:hover { background: var(--surface); color: var(--text); }
.chip-x .i { width: 14px; height: 14px; }
.msg-atts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.att-img img { display: block; max-width: min(260px, 70vw); max-height: 220px; border-radius: 12px; object-fit: cover; }
.att-file { display: inline-flex; align-items: center; gap: 8px; max-width: 260px; padding: 8px 12px; border-radius: 12px; background: var(--user); color: inherit; text-decoration: none; font-size: 13px; }
.att-file span { display: flex; flex-direction: column; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file small { color: var(--muted); font-size: 11px; }
.main.dropping { position: relative; }
.main.dropping::after { content: 'Drop files to attach'; position: absolute; inset: 8px; z-index: 20; display: flex; align-items: center; justify-content: center; border: 2px dashed var(--accent); border-radius: 16px; background: color-mix(in srgb, var(--bg) 82%, transparent); font-size: 16px; pointer-events: none; }

/* Claude's activity: "Ran a command ▾" and "Thinking ▾" lines with details behind a caret */
.activity { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.act-head { display: flex; align-items: center; gap: 6px; min-height: 22px; }
.act-caret { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--muted); transition: transform .15s; flex: none; }
.act-caret:hover { background: var(--surface2); color: var(--text); }
.act-caret.open { transform: rotate(180deg); }
.act-caret .i { width: 14px; height: 14px; }
.act-detail { margin-top: 4px; padding: 8px 10px; border-radius: 10px; background: var(--surface2); max-height: 260px; overflow: auto; }
.act-text { white-space: pre-wrap; font-size: 12.5px; line-height: 1.45; }
.act-cmd { margin: 0; white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--text); }
.act-cmd + .act-cmd { margin-top: 6px; }

/* Questions from Claude, as cards with answer buttons */
.ask-wrap { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.ask-card { border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; background: var(--surface); }
.ask-q { font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.ask-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-opt { padding: 7px 12px; border-radius: 999px; background: var(--surface2); color: var(--text); font-size: 14px; border: 1px solid transparent; text-align: left; }
.ask-opt:hover:not(:disabled) { border-color: var(--accent); }
.ask-opt.on { background: var(--accent); color: var(--on-accent); }
.ask-opt.other { background: transparent; color: var(--muted); border: 1px dashed var(--border); }
.ask-wrap.done .ask-opt { opacity: .55; cursor: default; }
.ask-card small { display: block; margin-top: 6px; }
.ask-send { align-self: flex-start; }
.ask-other { display: flex; gap: 8px; margin-top: 8px; }
.ask-other .input { flex: 1; min-width: 0; height: 38px; }
.ask-opt.custom { max-width: 100%; overflow-wrap: anywhere; }

/* Messages waiting in the queue while an answer is running */
.msg-user-wrap.queued .msg.user { opacity: .6; border: 1px dashed var(--border); }
.queued-tag { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.queued-tag button { color: var(--danger); }
.send.queue { background: var(--surface2); color: var(--accent); }

/* Message box: text on top, a bar below: + · model · (spinner, /btw, mic, cancel) · send or commands */
.composer-inner { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 2px; border: 1px solid var(--border); border-radius: 24px; padding: 6px 8px 8px; }
.composer textarea { width: 100%; flex: none; padding: 10px 10px 4px; min-height: 44px; }
.composer-bar { display: flex; align-items: center; gap: 4px; min-width: 0; }
.composer-bar .grow { flex: 1; }
.composer-bar .send { border-radius: 50%; }
.send.cmd { background: var(--surface2); color: var(--text); }
.send.clear { background: var(--surface2); color: var(--muted); }
.model-chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: 18px; min-width: 0; color: var(--text); font-size: 15px; }
.model-chip:hover { background: var(--surface2); }
.model-chip .spark { color: var(--accent); width: 18px; height: 18px; }
.model-chip .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-chip .eff { color: var(--muted); white-space: nowrap; }
.busy-spin { margin: 0 6px; }
.icon-btn.mic.on { color: var(--danger); animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 50% { opacity: .35; } }
.agents-pill { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; margin: 0 0 8px 4px; border: 1px solid var(--border); border-radius: 16px; font-size: 13px; color: var(--muted); }
.composer-bar .send.cancel { background: var(--danger); color: #fff; }

/* Question cards: radio rows with descriptions, "Other…", Dismiss, Submit */
.ask-wrap { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 4px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.ask-card { border: 0; padding: 0; background: none; border-radius: 0; }
.ask-q { color: var(--muted); font-weight: 400; margin: 0 4px 8px; line-height: 1.45; }
.ask-list { display: flex; flex-direction: column; gap: 4px; }
.ask-row { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 12px; border-radius: 12px; background: transparent; color: var(--text); }
.ask-row:hover:not(:disabled) { background: var(--surface2); }
.ask-row.on { background: var(--surface2); }
.ask-mark { flex: none; position: relative; width: 20px; height: 20px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--muted); }
.ask-mark.box { border-radius: 5px; }
.ask-row.on .ask-mark { border-color: var(--ok); }
.ask-row.on .ask-mark::after { content: ''; position: absolute; inset: 3px; border-radius: inherit; background: var(--ok); }
.ask-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ask-label { font-size: 15px; }
.ask-desc { color: var(--muted); font-size: 14px; line-height: 1.45; }
.ask-other { width: 100%; height: 48px; margin-top: 4px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--surface2); color: var(--text); outline: none; }
.ask-other:focus { box-shadow: 0 0 0 2px var(--accent); }
.ask-dismiss, .ask-submit { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 44px; border-radius: 10px; font-weight: 600; }
.ask-dismiss { border: 1px solid var(--border); background: transparent; color: var(--muted); }
.ask-submit { background: var(--ok); color: #fff; }
.ask-submit:disabled { opacity: .45; cursor: default; }
.ask-wrap.done .ask-row { opacity: .6; cursor: default; }

/* ───────────── file manager (super admin) ───────────── */
.fm-places { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 8px; }
.fm-places::-webkit-scrollbar { display: none; }
.fm-place { cursor: pointer; padding: 5px 12px; font-size: 13px; flex: none; }
.fm-place:hover { color: var(--text); }
.fm-bar { display: flex; gap: 6px; align-items: center; }
.fm-bar .icon-btn:first-child svg { transform: none; }
.fm-path { flex: 1; min-width: 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14px; }
.fm-crumbs { display: flex; align-items: center; gap: 2px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; margin: 6px 0; font-size: 14px; }
.fm-crumbs::-webkit-scrollbar { display: none; }
.fm-crumbs button { padding: 4px 6px; border-radius: 8px; color: var(--muted); flex: none; }
.fm-crumbs button:hover, .fm-crumbs button.on { color: var(--text); background: var(--surface2); }
.fm-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.fm-tools .btn svg { width: 16px; height: 16px; }
.fm-sort { width: auto; height: 32px; border-radius: 10px; font-size: 14px; }
.fm-filter { flex: 1 1 180px; height: 32px; border-radius: 10px; font-size: 14px; }
.fm-progress { background: var(--surface); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; font-size: 13px; }
.fm-list { background: var(--surface); border-radius: 12px; overflow: hidden; outline: 2px dashed transparent; transition: outline-color .15s; }
.fm-list.drop { outline-color: var(--accent); }
.fm-empty { padding: 28px 16px; text-align: center; }
.fm-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 90px 150px 96px 140px 40px; align-items: center; gap: 8px; padding: 4px 8px;
  border-top: 1px solid var(--border); cursor: pointer; min-height: 44px; font-size: 14px; }
.fm-row:first-child { border-top: 0; }
.fm-row:hover, .fm-row:focus-visible { background: var(--surface2); outline: none; }
.fm-row.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.fm-headrow { cursor: default; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; min-height: 36px; }
.fm-headrow:hover { background: none; }
.fm-cb { display: flex; align-items: center; justify-content: center; height: 100%; cursor: pointer; }
.fm-check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.fm-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fm-label { display: flex; flex-direction: column; min-width: 0; }
.fm-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-meta { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.fm-ic { flex: none; width: 22px; height: 22px; color: var(--muted); }
.fm-ic.dir { color: var(--accent); }
.fm-c { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-c.size { text-align: right; }
.fm-c.perm { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
.fm-more { width: 36px; height: 36px; }
.fm-selbar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; padding: 10px 12px;
  background: var(--surface2); border-radius: 14px; box-shadow: 0 8px 30px #0006; }
.fm-selbar[hidden] { display: none; }
.fm-selbar .fm-count { flex: 1 1 auto; font-size: 14px; }
.fm-selbar .btn svg { width: 16px; height: 16px; }
.fm-sheet { max-width: 560px !important; max-height: 88vh; display: flex; flex-direction: column; padding: 16px 18px !important; }
.fm-sheet.wide { max-width: 980px !important; height: 88vh; }
.fm-sheet-head { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.fm-sheet-head h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-break { display: block; word-break: break-all; font-size: 12px; }
.fm-sheet-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.fm-sheet-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; }
.fm-props { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0 0 14px; font-size: 14px; }
.fm-props dt { color: var(--muted); }
.fm-props dd { margin: 0; word-break: break-word; }
.fm-info-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.fm-info-acts .btn svg { width: 16px; height: 16px; }
.fm-thumb { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; margin: 0 auto 12px; background: var(--surface2); }
.fm-pre { margin: 0; font-size: 12px; white-space: pre; overflow: auto; background: var(--surface2); border-radius: 10px; padding: 10px 12px; flex: 1; }
.fm-editor { flex: 1; min-height: 50vh; height: 100%; resize: none; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.45; white-space: pre; tab-size: 2; }

@media (max-width: 1023.98px) { .fm-row { grid-template-columns: 34px minmax(0, 1fr) 84px 130px 40px; } .fm-c.perm, .fm-c.own { display: none; } }
/* phones: one column, meta line under the name, bigger touch targets, bottom sheets, sticky action bar */
@media (max-width: 767.98px) {
  .fm-row { grid-template-columns: 34px minmax(0, 1fr) 40px; min-height: 56px; padding: 6px 4px; gap: 6px; }
  .fm-c, .fm-headrow .fm-name, .fm-headrow .fm-more { display: none; }
  .fm-headrow { grid-template-columns: 34px 1fr; min-height: 32px; }
  .fm-headrow::after { content: 'Select all'; text-transform: none; letter-spacing: 0; font-size: 13px; }
  .fm-meta { display: block; }
  .fm-n { font-size: 15px; }
  .fm-check { width: 20px; height: 20px; }
  .fm-tools .fm-filter { flex-basis: 100%; order: 9; }
  .fm-selbar { position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); margin: 0; justify-content: space-between; }
  .fm-selbar .fm-count { flex-basis: 100%; }
  .fm-selbar .btn { flex: 1; padding: 0 8px; }
  .fm-selbar .fm-bl { font-size: 13px; }
  .fm-list { margin-bottom: 110px; }
  .fm-modal { align-items: flex-end; padding: 0; }
  .fm-sheet, .fm-sheet.wide { max-width: none !important; width: 100%; border-radius: 18px 18px 0 0 !important; max-height: 92vh; padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important; }
  .fm-sheet.wide { height: 92vh; }
  .fm-props { grid-template-columns: 1fr; gap: 0; }
  .fm-props dt { font-size: 12px; margin-top: 8px; }
  .fm-info-acts .btn { flex: 1 1 calc(50% - 6px); }
  .fm-editor { font-size: 12px; }
}
@media (max-width: 380px) { .fm-selbar .fm-bl { display: none; } }

/* Status dot left of each chat title (4 px): thinking · done · question · error. Chats idle for over an hour: faint title. */
.cdot { flex: none; width: 4px; height: 4px; border-radius: 50%; margin-right: 8px; background: transparent; }
.cdot.running { background: #3B82F6; animation: cdot-blink 1s ease-in-out infinite; }
.cdot.done { background: var(--ok); }
.cdot.question { background: #EAB308; }
.cdot.error { background: var(--danger); }
@keyframes cdot-blink { 50% { opacity: .15; } }
.row.chat.idle .t { opacity: .45; }
.ask-wrap.done .ask-row.on { opacity: 1; }   /* the answer that was given stays clear on old cards */
.ask-row.custom { cursor: default; }

/* Settings → Servers: Monitor / Superuser switches on each card; password fields with an eye button */
.srv-switches { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.srv-sw { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.srv-switches .icon-btn { margin-left: auto; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap .input { padding-right: 44px; }
.pw-wrap .reveal { position: absolute; right: 2px; top: 1px; }
.pw-wrap .reveal.on { color: var(--accent); }

/* Settings → Servers: Claude row on each card, default AI server chooser */
.srv-claude { border-top: 0; padding-top: 0; margin-top: 8px; gap: 10px; }
.srv-claude-info { flex-basis: 100%; }
.srv-default { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.srv-default:empty { display: none; }

/* Files page (sidebar): wider column */
.msgs-inner.fm-page { max-width: 1100px; }

/* the activity pill pulses while sub-agents are working */
.agents-pill.live { color: var(--text); border-color: #3B82F6; animation: cdot-blink 1.6s ease-in-out infinite; }

/* Context ring in the message box: share of the 1M-token context window sent with the next message */
.ctx-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex: none; --c: var(--accent); }
.ctx-btn:hover { background: var(--surface2); }
.ctx-btn.warn { --c: #EAB308; } .ctx-btn.danger { --c: var(--danger); }
.ctx-ring { position: relative; width: 20px; height: 20px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p, 0) * 1%), var(--border) 0); }
.ctx-ring::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--surface); }
.ctx-row { padding: 6px 0; border-top: 1px solid var(--border); font-size: 14px; gap: 12px; }

/* Reply footer: while running = dots · fork · live timer; done = fork · Worked for … · model · retry */
.msg .meta .meta-ic { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; color: var(--muted); }
.msg .meta .meta-ic:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.msg .meta .meta-ic svg.i { width: 17px; height: 17px; }
.msg .meta .meta-model { opacity: .8; }
.dots { display: inline-flex; gap: 3px; align-items: center; height: 26px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: dots 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dots { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.activity.thinking { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }
/* "N working" pill: a spinning blue ring */
.agents-pill { gap: 8px; }
.agents-pill::before { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #3B82F6; border-right-color: transparent; animation: spin .8s linear infinite; flex: none; }
.agents-pill.live { animation: none; }

/* Agents sheet (tap the "N working" pill) */
button.agents-pill { background: none; font: inherit; cursor: pointer; }
button.agents-pill:hover { background: var(--surface2); }
.agents-card { max-width: 520px !important; max-height: 80vh; display: flex; flex-direction: column; }
.agents-list { overflow-y: auto; margin: 0 -8px; }
.ag-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 8px; border-radius: 10px; }
.ag-row.click { cursor: pointer; } .ag-row.click:hover { background: var(--surface2); }
.ag-t { font-size: 15px; font-weight: 500; }
.ag-s { font-size: 13px; margin-top: 2px; }
.ag-last { font: 12px ui-monospace, monospace; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-prompt { margin-top: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow-y: auto; cursor: text; }
.ag-spin { width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2px solid #3B82F6; border-right-color: transparent; animation: spin .8s linear infinite; flex: none; }
.ag-mark { width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex: none; color: #fff; background: #22C55E; }
.ag-mark.error { background: var(--danger); } .ag-mark.stopped { background: var(--muted); font-size: 7px; }

/* Clear (×): small faint cross at the top-left of the message box */
.composer-inner { position: relative; }
.composer-inner > .send.clear, .composer-bar .send.clear { position: absolute; top: 6px; left: 8px; width: 20px; height: 20px; min-width: 0; padding: 0; background: transparent; color: var(--muted); opacity: .45; border-radius: 50%; z-index: 2; }
.send.clear svg { width: 12px; height: 12px; }
.send.clear:hover { opacity: .9; }
.composer-inner:has(.send.clear:not(.hidden)) textarea { padding-top: 26px; }

/* Model in the top bar, next to the project name (tap to change) */
.topbar .crumb { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; white-space: nowrap; }
.topbar .crumb-t { overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.topbar .crumb-sep { flex: none; }
.topbar .model-chip { height: 20px; padding: 0 6px 0 2px; gap: 4px; font-size: 12px; font-weight: 500; color: var(--text); border-radius: 10px; flex: 0 1 auto; }
.topbar .model-chip .spark { width: 13px; height: 13px; }
.topbar .model-chip .chev { width: 12px; height: 12px; color: var(--muted); flex: none; }
/* Clear the message: a small × at the top right of the box */
.composer-inner { position: relative; }
.clear-x { position: absolute; top: 8px; right: 10px; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); background: transparent; z-index: 1; }
.clear-x:hover { background: var(--surface2); color: var(--text); }
.clear-x svg { width: 15px; height: 15px; }
.composer textarea { padding-right: 34px; }
.topbar .model-chip .chev { display: none; }

/* /btw: small, in the same row as the "N working" pill, aligned right */
.run-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; min-width: 0; }
.run-row:not(:has(> :not(.hidden))) { display: none; }
.run-row .agents-pill { margin: 0 0 0 4px; min-width: 0; }
.run-row .send.btw { width: 28px; height: 28px; margin-left: auto; border-radius: 50%; }
.run-row .send.btw svg { width: 15px; height: 15px; }

/* "working" panel: live Log tab */
.ag-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.ag-tab { padding: 6px 14px; border-radius: 10px; font-weight: 600; color: var(--muted); background: var(--surface2); }
.ag-tab.on { background: var(--accent); color: var(--on-accent); }
.agents-log { overflow-y: auto; flex: 1; min-height: 120px; max-height: 58vh; margin: 0 -8px; padding: 2px 8px; font-size: 13px; }
.lg { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.lg-t { color: var(--muted); font: 11px ui-monospace, monospace; }
.lg-k { color: var(--accent); font-weight: 600; font-size: 12px; text-transform: lowercase; justify-self: start; }
.lg-x { grid-column: 1 / -1; white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.lg-x.mono { font: 12px ui-monospace, monospace; color: var(--text); }
.lg-think .lg-x { color: var(--muted); font-style: italic; }
.lg-tool .lg-k { color: #3B82F6; } .lg-agent .lg-k { color: #7D76FF; } .lg-mark .lg-k { color: var(--muted); }

/* "N working" pill: very small, always one line, cut with … when it doesn't fit */
button.agents-pill, .run-row button.agents-pill { font-size: 11px; line-height: 1; height: 24px; padding: 0 10px; gap: 6px; max-width: 100%; min-width: 0; overflow: hidden; flex: 0 1 auto; }
.agents-pill::before { width: 9px; height: 9px; border-width: 1.5px; }
.agents-pill .ap-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.run-row { margin: 0 0 6px; }

/* model menu: Thinking level row */
.think-seg { display: flex; margin: 2px 6px 8px; }
.think-seg button { flex: 1; height: 30px; padding: 0 6px; font-size: 13px; }

/* GitHub page */
.gh-list { display: flex; flex-direction: column; gap: 8px; }
.gh-row { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid rgba(128,128,128,.25); border-radius: 10px; color: inherit; text-decoration: none; }
.gh-row:hover { background: rgba(128,128,128,.08); }

/* copy chips (md.js): tap to copy */
.md .cp { cursor: copy; }
.md span.cp { border-bottom: 1px dashed var(--muted); word-break: break-all; }
.md code.cp:hover, .md span.cp:hover { background: var(--surface2); outline: 1px solid var(--border); border-radius: 6px; }
.md .cp-link { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: 2px; vertical-align: -4px; border-radius: 6px; color: var(--muted); }
.md .cp-link:hover { background: var(--surface2); color: var(--text); }
.md .cp-link svg.i { width: 13px; height: 13px; }

/* search results, request times, welcome "Recent" */
.row.found { align-items: flex-start; padding-top: 6px; padding-bottom: 6px; }
.row.found .t { white-space: normal; display: flex; flex-direction: column; gap: 2px; }
.row.found .t > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.found-snip { color: var(--muted); font-size: 12px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.found-snip mark, .row.found mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.msg-time { font-size: 11px; color: var(--muted); margin-top: 3px; text-align: right; }
.msg-user-wrap .msg-time + .user-actions { justify-content: flex-end; }
.flash { animation: owl-flash 2.2s ease-out; border-radius: 12px; }
@keyframes owl-flash { 0%, 30% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 3px transparent; } }
.recent { width: 100%; max-width: 560px; margin-top: 10px; text-align: left; }
.recent-head { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 6px 6px; }
.recent-row { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 9px 12px; border-radius: 12px; text-align: left; color: var(--text); }
.recent-row:hover { background: var(--surface2); }
.recent-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.recent-top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.recent-time { margin-left: auto; padding-left: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.recent-req { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* steps of a finished reply: one pill in the footer (like the working pill), the list in a dialog */
.msg .meta .act-pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border: 1px solid var(--border); border-radius: 12px;
  font-size: 11px; color: var(--muted); max-width: 46vw; min-width: 0; overflow: hidden; }
.msg .meta .act-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #3B82F6; opacity: .8; flex: none; }
.msg .meta .act-pill:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.act-pill .ap-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.act-card { max-width: 640px !important; max-height: 80vh; display: flex; flex-direction: column; }
.act-card .act-list { overflow-y: auto; margin: 0 -6px; padding: 0 6px; }

/* project button in the top bar; project chips in "Recent" */
.topbar .crumb-proj { display: inline-flex; align-items: center; gap: 3px; min-width: 0; max-width: 45%; height: 20px; padding: 0 4px 0 2px; border-radius: 8px; color: var(--muted); font-size: 12px; }
.topbar .crumb-proj:hover { background: var(--surface2); color: var(--text); }
.topbar .crumb-proj svg.i { width: 13px; height: 13px; flex: none; }
.recent-sub { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 2px; }
.proj-chip { display: inline-flex; align-items: center; gap: 4px; flex: none; max-width: 45%; height: 20px; padding: 0 7px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface2); color: var(--text); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-chip.none { background: transparent; color: var(--muted); }
.proj-chip svg.i { width: 12px; height: 12px; flex: none; color: var(--muted); }
.recent-sub .recent-req { min-width: 0; }

/* while answering: does a new message interrupt or queue? */
.send-mode { display: inline-flex; align-items: center; height: 30px; padding: 2px; border-radius: 15px; background: var(--surface2); flex: none; }
.send-mode button { height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12px; color: var(--muted); }
.send-mode button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.send.interrupt { background: var(--danger, #e5484d); color: #fff; }

/* Menu search: an icon in the header; the box appears only after tapping it */
.side-search.hidden { display: none; }
.side-search .side-search-x { width: 26px; height: 26px; flex: none; }
.side-search .side-search-x svg { width: 14px; height: 14px; }
.side-head .icon-btn.on { color: var(--accent); }

/* ── AI replies: easier to read ── */
.msg.assistant .md { line-height: 1.62; }
.md > :first-child { margin-top: 0; }
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3, .md h4 { margin: 20px 0 8px; font-weight: 650; letter-spacing: -.01em; }
.md h1 { font-size: 21px; } .md h2 { font-size: 18.5px; padding-bottom: 5px; border-bottom: 1px solid var(--border); } .md h3 { font-size: 16.5px; } .md h4 { font-size: 15px; color: var(--muted); }
.md ul, .md ol { margin: 4px 0 12px; padding-left: 22px; }
.md li { margin: 5px 0; padding-left: 2px; }
.md li::marker { color: var(--muted); }
.md li > p { margin: 0 0 4px; }
.md li > ul, .md li > ol { margin: 4px 0; }
.md strong { font-weight: 650; color: var(--text); }
.md code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
.md pre { border: 1px solid var(--border); margin: 4px 0 14px; }
.md blockquote { padding: 8px 12px; background: var(--surface2); border-radius: 0 10px 10px 0; color: var(--text); }
.md table { border: 1px solid var(--border); border-radius: 10px; border-collapse: separate; border-spacing: 0; font-size: 14px; margin: 4px 0 14px; }
.md th { background: var(--surface2); font-weight: 600; }
.md tr:last-child td { border-bottom: 0; }
.md hr { margin: 18px 0; }
/* ── Minimize all AI replies (top bar toggle) ── */
.topbar .icon-btn.on { color: var(--accent); }
.msg.assistant.min:not(.live) { cursor: pointer; }
.msg.assistant.min:not(.live) .body { max-height: 3.3em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 30%, transparent); mask-image: linear-gradient(#000 30%, transparent); }
.msg.assistant.min:not(.live) > :not(.body):not(.meta) { display: none; }
.msg.assistant.min:not(.live) .meta::before { content: 'Tap to open'; color: var(--accent); margin-right: 6px; }
.msg.assistant.min:not(.live) .meta > button { display: none; }
/* ── Git page ── */
.git-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.git-head .grow, .git-commit .grow { flex: 1; min-width: 0; }
.git-sec { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; }
.git-row { text-align: left; background: none; font: inherit; cursor: pointer; width: 100%; }
.git-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.git-badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--surface2); color: var(--muted); }
.git-badge.warn { color: #EAB308; } .git-badge.ok { color: #22C55E; } .git-badge.acc { color: var(--accent); }
.git-last { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.git-link { font-size: 13px; }
.git-info { font-size: 13px; margin-bottom: 10px; word-break: break-all; }
.git-note { padding: 8px 12px; border-radius: 10px; background: var(--surface2); margin-bottom: 10px; color: #22C55E; }
.git-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.git-files, .git-commits { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.git-file { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: none; border: 0; border-bottom: 1px solid var(--border); font: inherit; text-align: left; cursor: pointer; color: inherit; }
.git-file:last-child, .git-commit:last-child { border-bottom: 0; }
.git-file:hover { background: var(--surface2); }
.git-file .p { font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; }
.git-commit { display: flex; gap: 10px; align-items: baseline; padding: 7px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
.git-commit .muted { font-size: 12px; white-space: nowrap; }
.git-diff-card { max-width: 900px !important; max-height: 85vh; display: flex; flex-direction: column; }
.git-diff { flex: 1; overflow: auto; margin: 0 0 10px; padding: 10px; border-radius: 10px; background: var(--surface2); font-size: 12.5px; line-height: 1.45; white-space: pre; }
.git-diff .a { color: #22C55E; } .git-diff .d { color: #EF4444; } .git-diff .m { color: var(--muted); }

/* ── Backups page ── */
.bk-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.bk-card.ok { border-color: rgba(34,197,94,.45); } .bk-card.bad { border-color: rgba(239,68,68,.55); } .bk-card.run { border-color: rgba(59,130,246,.55); }
.bk-state { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.bk-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; display: inline-block; }
.bk-dot.ok { background: #22C55E; } .bk-dot.bad { background: #EF4444; }
.bk-msg { font-size: 13px; }
.bk-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; font-size: 13px; }
.bk-fact { display: grid; gap: 1px; } .bk-fact span:last-child { word-break: break-all; }
.bk-log { margin-top: 12px; } .bk-log summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.bk-log pre { max-height: 320px; margin-top: 6px; }
