/* Caidrac One - quiet, dense, Linear-style. Brand: ink / bone / coral. */
:root {
  --ink: #141b2d; --bone: #ece7de;
  --bg: #141b2d; --side: #121828; --raise: #1c2438; --hover: rgba(236,231,222,.05); --active: rgba(236,231,222,.09);
  --line: rgba(236,231,222,.09); --line-2: rgba(236,231,222,.16);
  --text: #ece7de; --text-2: rgba(236,231,222,.74); --muted: rgba(236,231,222,.46); --accent: #f07c62; --on-accent: #1a1210;
  --code-bg: #0f1424; --ring: rgba(240,124,98,.28);
  --sans: "Geist", "Inter", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
}
[data-theme="light"] {
  --bg: #f3f0ea; --side: #ebe7de; --raise: #fff; --hover: rgba(20,27,45,.05); --active: rgba(20,27,45,.08);
  --line: rgba(20,27,45,.09); --line-2: rgba(20,27,45,.16);
  --text: #141b2d; --text-2: rgba(20,27,45,.74); --muted: rgba(20,27,45,.5); --accent: #de5f45; --on-accent: #fff;
  --code-bg: #141b2d; --ring: rgba(222,95,69,.25);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 13px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; letter-spacing: -.003em; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
kbd { font: 500 10.5px var(--mono); padding: 0 5px; line-height: 18px; border: 1px solid var(--line-2); border-radius: 4px; color: var(--muted); background: transparent; }
.muted { color: var(--muted); }
.wm-light, .sym-light { display: none !important; }
[data-theme="light"] .wm-light, [data-theme="light"] .sym-light { display: block !important; }
[data-theme="light"] .wm-dark, [data-theme="light"] .sym-dark { display: none !important; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 244px 1fr; height: 100vh; }
.app.collapsed { grid-template-columns: 0 1fr; }
.app.collapsed .sidebar { visibility: hidden; transform: translateX(-100%); }
.sidebar { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 8px; min-width: 0; overflow: hidden; }
.side-head { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 4px 0 6px; margin-bottom: 6px; }
.ws { display: flex; align-items: center; gap: 8px; flex: 1; font-weight: 500; font-size: 13px; min-width: 0; }
.ws img { height: 24px; width: auto; }
.ws .logo { width: 20px; height: 20px; border-radius: 5px; background: var(--raise); border: 1px solid var(--line-2); display: grid; place-items: center; }
.ws .logo img { width: 10px; height: auto; display: block; }
.icon-btn { width: 26px; height: 26px; border-radius: 5px; display: grid; place-items: center; color: var(--muted); transition: background .1s, color .1s; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg { width: 15px; height: 15px; }

.nav-row { display: flex; align-items: center; gap: 8px; width: 100%; height: 28px; padding: 0 8px; border-radius: 5px; color: var(--text-2); text-align: left; transition: background .1s; }
.nav-row:hover { background: var(--hover); color: var(--text); }
.nav-row svg { color: var(--muted); width: 15px; height: 15px; }
.nav-row kbd { margin-left: auto; }
.search { position: relative; }
.search svg { position: absolute; left: 8px; top: 7px; width: 15px; height: 15px; color: var(--muted); }
.search input { width: 100%; height: 28px; background: transparent; border: 0; border-radius: 5px; padding: 0 8px 0 31px; color: var(--text); font: inherit; outline: 0; }
.search input::placeholder { color: var(--text-2); }
.search input:hover { background: var(--hover); } .search input:focus { background: var(--active); }
.chat-list { flex: 1; overflow-y: auto; margin: 6px -4px 0; padding: 0 4px; }
.group-label { font-size: 11.5px; font-weight: 500; color: var(--muted); padding: 12px 8px 4px; }
.chat-item { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 8px; border-radius: 5px; cursor: pointer; color: var(--text-2); }
.chat-item span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-item:hover { background: var(--hover); color: var(--text); }
.chat-item.active { background: var(--active); color: var(--text); }
.chat-item .del { opacity: 0; width: 22px; height: 22px; border-radius: 4px; display: grid; place-items: center; color: var(--muted); }
.chat-item .del svg { width: 14px; height: 14px; }
.chat-item:hover .del { opacity: 1; } .chat-item .del:hover { background: var(--active); color: var(--text); }
.empty-list { color: var(--muted); padding: 10px 8px; }
.side-foot { display: flex; align-items: center; gap: 2px; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding-left: 4px; }
.me b { font-weight: 500; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { display: none; }
.avatar { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 10.5px; font-weight: 600; display: grid; place-items: center; flex: none; }

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border-bottom: 1px solid var(--line); flex: none; }
#openSide { display: none; } .app.collapsed #openSide { display: grid; }
.crumb { color: var(--muted); } .crumb-sep { color: var(--muted); opacity: .6; }
.topbar h2 { margin: 0; font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 2px 6px; border-radius: 4px; cursor: text; min-width: 0; }
.topbar h2:hover { background: var(--hover); }
.topbar h2[contenteditable="true"] { outline: 1px solid var(--accent); background: var(--raise); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 5px; font-size: 11.5px; color: var(--text-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.pill-btn { cursor: pointer; transition: border-color .12s, color .12s; } .pill-btn:hover, .pill-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--text); }
.pill-btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.pill-btn[data-preset]:not([data-preset="demo"])::before { background: #3ecf8e; }
.timgs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 2px; } .timgs img { display: block; max-width: min(100%, 420px); max-height: 300px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; box-shadow: var(--sh); }
.menu.models { width: 300px; padding: 6px; }
.menu.models button { height: auto; flex-direction: column; align-items: flex-start; gap: 3px; padding: 9px 10px; }
.menu.models button .mm-top { display: flex; align-items: center; justify-content: space-between; width: 100%; color: var(--text); font-size: 13px; }
.menu.models button .mm-top svg { width: 14px; height: 14px; color: var(--accent); fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.menu.models button .mm-sum { font-size: 12px; color: var(--muted); line-height: 1.4; white-space: normal; }
.menu.models button .mm-ids { font: 11.5px/1.5 var(--mono); color: var(--text-2); } .menu.models button .mm-ids i { font-style: normal; color: var(--muted); font-family: var(--sans); display: inline-block; width: 66px; }
.menu.models button .mm-off { font-size: 11.5px; color: #d9a441; }
.menu.models button[disabled] { opacity: .6; cursor: not-allowed; }
.menu.models button.on { background: var(--active); }
.scroll { flex: 1; overflow-y: auto; }
.thread { max-width: 704px; margin: 0 auto; padding: 8px 24px 28px; }

/* empty state */
.hero { padding-top: 14vh; }
.hero h1 { font-size: 18px; letter-spacing: -.015em; font-weight: 600; margin: 0 0 4px; }
.hero p { margin: 0; }
.suggest { margin-top: 22px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--raise); }
.suggest button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0 12px; height: 36px; text-align: left; border-top: 1px solid var(--line); color: var(--text-2); transition: background .1s; }
.suggest button:first-child { border-top: 0; }
.suggest button:hover { background: var(--hover); color: var(--text); }
.suggest svg { color: var(--muted); width: 15px; height: 15px; }
.suggest span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.suggest kbd { opacity: 0; } .suggest button:hover kbd { opacity: 1; }

/* messages */
.msg { margin: 20px 0; animation: rise .2s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .body { background: var(--bone); color: var(--ink); padding: 6px 12px; border-radius: 8px; max-width: 80%; white-space: pre-wrap; word-break: break-word; }
.msg.assistant { display: flex; gap: 10px; }
.msg.assistant .mark { flex: none; width: 20px; height: 20px; border-radius: 5px; background: var(--raise); border: 1px solid var(--line-2); display: grid; place-items: center; margin-top: 1px; }
.msg.assistant .mark img { width: 9px; height: auto; display: block; }
.msg.assistant .col { flex: 1; min-width: 0; }
.body { line-height: 1.6; }
.body p { margin: 0 0 10px; } .body p:last-child { margin: 0; }
.body h1, .body h2, .body h3 { margin: 16px 0 6px; letter-spacing: -.015em; line-height: 1.3; font-weight: 600; }
.body h1 { font-size: 16px; } .body h2 { font-size: 14.5px; } .body h3 { font-size: 13px; }
.body ul, .body ol { padding-left: 20px; margin: 0 0 10px; } .body li { margin: 2px 0; } .body li::marker { color: var(--muted); }
.body code { font: 12px var(--mono); background: var(--active); padding: 1px 5px; border-radius: 4px; }
.body pre { color: var(--bone); background: var(--code-bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; overflow-x: auto; margin: 0 0 10px; position: relative; }
.body pre code { background: none; padding: 0; font-size: 12px; line-height: 1.6; }
.body pre .lang { position: absolute; top: 6px; right: 10px; font: 10.5px var(--mono); color: rgba(236,231,222,.45); }
.body strong { font-weight: 600; }
.caret::after { content: ""; display: inline-block; width: 6px; height: 13px; background: var(--accent); margin-left: 2px; vertical-align: -2px; border-radius: 1px; animation: blink 1s steps(2) infinite; } @keyframes blink { 50% { opacity: 0; } }
.thinking { display: inline-flex; gap: 4px; height: 20px; align-items: center; }
.actions { display: flex; gap: 2px; margin-top: 6px; opacity: 0; transition: opacity .12s; }
.msg:hover .actions { opacity: 1; }
.actions button { color: var(--muted); padding: 0 6px; height: 24px; border-radius: 4px; font-size: 12px; display: flex; gap: 5px; align-items: center; }
.actions button:hover { background: var(--hover); color: var(--text); } .actions svg { width: 13px; height: 13px; }

/* composer */
.composer-wrap { position: relative; max-width: 704px; width: 100%; margin: 0 auto; padding: 0 24px 12px; }
.composer { background: var(--raise); border: 1px solid var(--line-2); border-radius: 10px; padding: 6px; transition: border-color .12s, box-shadow .12s; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea { flex: 1; min-width: 0; resize: none; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 13.5px; line-height: 1.5; max-height: 200px; padding: 5px 2px; display: block; }
.cbtn { flex: none; width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: var(--text-2); transition: background .12s, color .12s; }
.cbtn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cbtn:hover { background: var(--hover); color: var(--text); } .cbtn:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; } .cbtn[aria-busy="true"] { opacity: .5; pointer-events: none; }
.attach-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 4px 6px; } .attach-row[hidden] { display: none; }
.achip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; height: 26px; padding: 0 4px 0 8px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--bg); color: var(--text-2); font-size: 12px; }
.achip svg { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--accent); }
.achip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .achip em { font-style: normal; color: var(--muted); font-size: 11px; flex: none; }
.achip button { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 4px; color: var(--muted); flex: none; } .achip button:hover { background: var(--active); color: var(--text); }
.achip.up { opacity: .6; } .achip.bad { border-color: #e5686b; }
.composer.dropping { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.composer-foot { display: flex; align-items: center; gap: 10px; margin: 8px 2px 0; min-width: 0; } .composer-foot .disclaimer { flex: 1; min-width: 0; margin: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; } .msg.user .att { display: inline-flex; align-items: center; gap: 5px; max-width: 220px; height: 22px; padding: 0 7px; border-radius: 5px; background: rgba(20,27,45,.08); font-size: 11.5px; }
.msg.user .att svg { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; } .msg.user .att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer textarea::placeholder { color: var(--muted); }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.hint { flex: 1; color: var(--muted); font-size: 11.5px; }
.send { flex: none; width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; transition: filter .1s; }
.send svg { width: 14px; height: 14px; stroke-width: 2.2; } .send:hover:not(:disabled) { filter: brightness(1.08); }
.send:disabled { background: var(--active); color: var(--muted); cursor: default; }
.send.stop svg { fill: currentColor; } .send[hidden] { display: none; }
.disclaimer { text-align: center; font-size: 11px; color: var(--muted); margin: 8px 0 0; }
.to-bottom { position: absolute; top: -40px; left: 50%; transform: translateX(-50%); width: 28px; height: 28px; border-radius: 50%; background: var(--raise); border: 1px solid var(--line-2); display: none; place-items: center; }
.to-bottom.show { display: grid; }

@media (max-width: 860px) {
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); visibility: hidden; }
  .app.open .sidebar { transform: none; visibility: visible; }
  #openSide, .app.collapsed #openSide { display: grid; } .hint { display: none; }
}
::-webkit-scrollbar { width: 10px; } ::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
[data-theme="light"] .msg.user .body { background: var(--ink); color: var(--bone); }

/* subtle depth for better visibility */
:root { --sh: 0 1px 2px rgba(0,0,0,.28), 0 0 0 1px rgba(236,231,222,.05) inset; --sh-lg: 0 4px 14px -4px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.25); }
[data-theme="light"] { --sh: 0 1px 2px rgba(20,27,45,.1), 0 1px 1px rgba(20,27,45,.04); --sh-lg: 0 4px 14px -4px rgba(20,27,45,.16), 0 1px 2px rgba(20,27,45,.08); }
.search input { background: var(--raise); border: 1px solid var(--line-2); box-shadow: var(--sh); }
.search input:hover { background: var(--raise); border-color: var(--muted); }
.search input:focus { background: var(--raise); border-color: var(--accent); box-shadow: var(--sh), 0 0 0 3px var(--ring); }
.chat-item.active { background: var(--raise); border: 1px solid var(--line-2); box-shadow: var(--sh); }
.chat-item { border: 1px solid transparent; }
.icon-btn:hover { background: var(--raise); box-shadow: var(--sh); }
.pill { background: var(--raise); box-shadow: var(--sh); }
.suggest { box-shadow: var(--sh-lg); border-color: var(--line-2); }
.composer { box-shadow: var(--sh-lg); }
.composer:focus-within { box-shadow: var(--sh-lg), 0 0 0 3px var(--ring); }
.msg.user .body { box-shadow: var(--sh); }
.send:not(:disabled) { box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.avatar { box-shadow: var(--sh); }

/* projects */
.group-label.row { display: flex; align-items: center; justify-content: space-between; padding-right: 2px; }
.group-label.sub { padding-top: 8px; opacity: .8; font-weight: 400; }
.group-label.drop, .proj.drop { background: var(--active); outline: 1px dashed var(--accent); border-radius: 5px; }
.mini { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; display: grid; place-items: center; color: var(--muted); background: transparent; flex: none; }
.mini:hover { background: var(--hover); color: var(--text); } .mini:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; } .mini svg { width: 14px; height: 14px; display: block; }
.proj { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 6px; border-radius: 5px; cursor: pointer; color: var(--text-2); border: 1px solid transparent; }
.proj:hover { background: var(--hover); color: var(--text); }
.proj > svg { width: 14px; height: 14px; color: var(--muted); }
.proj .chev { width: 12px; height: 12px; transition: transform .12s; } .proj.open .chev { transform: rotate(90deg); }
.proj.open > svg:nth-child(2) { color: var(--accent); }
.proj .pname { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; }
.proj em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.proj .del, .chat-item .del { opacity: 0; width: 22px; height: 22px; border-radius: 4px; display: grid; place-items: center; color: var(--muted); }
.proj .del svg { width: 13px; height: 13px; }
.proj:hover .del { opacity: 1; } .proj:hover em { display: none; }
.proj .del:hover { background: var(--active); color: var(--text); }
.proj-chats { margin-left: 13px; padding-left: 6px; border-left: 1px solid var(--line-2); margin-bottom: 4px; }
.proj-chats .empty-list { padding: 4px 8px; }
.proj-new { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px; color: var(--muted); }
.proj-new svg { width: 14px; height: 14px; }
.proj-new input { flex: 1; min-width: 0; height: 24px; background: var(--raise); border: 1px solid var(--accent); border-radius: 4px; color: var(--text); font: inherit; padding: 0 6px; outline: 0; box-shadow: 0 0 0 3px var(--ring); }
.chat-item .del svg { width: 14px; height: 14px; }
.menu { position: fixed; z-index: 80; min-width: 180px; background: var(--raise); border: 1px solid var(--line-2); border-radius: 8px; padding: 4px; box-shadow: var(--sh-lg); }
.menu-h { font-size: 11.5px; color: var(--muted); padding: 5px 8px; }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; height: 28px; padding: 0 8px; border-radius: 5px; color: var(--text-2); text-align: left; }
.menu button svg { width: 14px; height: 14px; color: var(--muted); } .menu button:hover { background: var(--hover); color: var(--text); } .menu button.on { color: var(--accent); }

/* ---------- modes + code pane ---------- */
.work { flex: 1; display: flex; min-height: 0; position: relative; }
.chatcol { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar h2 { flex: 1; }
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--side); border: 1px solid var(--line-2); border-radius: 7px; box-shadow: var(--sh); }
.seg button { display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 5px; color: var(--muted); font-size: 12px; font-weight: 500; }
.seg button svg { width: 13px; height: 13px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--raise); color: var(--text); box-shadow: var(--sh); }
.seg.sm button { height: 20px; padding: 0 8px; font-size: 11.5px; }


/* tool calls in the transcript */
.md > :last-child { margin-bottom: 0; }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; } .md a:hover { text-decoration-thickness: 2px; }
.md blockquote { margin: 8px 0; padding: 1px 12px; border-left: 3px solid var(--line-2); color: var(--text-2); } .md blockquote p { margin: 4px 0; }
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 12px 0; }
.mdtable { overflow-x: auto; margin: 8px 0; max-width: 100%; }
.md table { border-collapse: collapse; font-size: 13px; min-width: 50%; }
.md th, .md td { border: 1px solid var(--line-2); padding: 5px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--raise); font-weight: 600; } .md tbody tr:nth-child(even) td { background: var(--hover); }
.msg.assistant .col .md p:last-child { margin-bottom: 0; }


@media (max-width: 640px) { .seg button { padding: 0 6px; } .seg button svg { display: none; } .composer-foot .disclaimer { display: none; } }


/* mode switcher lives in the sidebar */
.modes { display: flex; flex-direction: column; gap: 1px; margin: 8px 0 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.modes .nav-row { border: 1px solid transparent; }
.modes .nav-row.on { background: var(--raise); color: var(--text); border-color: var(--line-2); box-shadow: var(--sh); font-weight: 500; }
.modes .nav-row.on svg { color: var(--accent); }
.chat-list { margin-top: 4px; }

/* segmented "bubble" switcher, vertical */
.modes { position: relative; gap: 2px; padding: 3px; margin: 8px 0 6px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 9px; box-shadow: inset 0 1px 2px rgba(0,0,0,.12), var(--sh); }
.modes .bubble { position: absolute; left: 3px; right: 3px; top: 3px; height: 28px; border-radius: 6px; background: var(--raise); border: 1px solid var(--line-2); box-shadow: var(--sh-lg); transition: transform .28s cubic-bezier(.3,1.35,.5,1); transform: translateY(calc(var(--i, 0) * 30px)); pointer-events: none; }
.modes .nav-row { position: relative; z-index: 1; height: 28px; border-radius: 6px; transition: color .15s; }
.modes .nav-row.on { background: none; border-color: transparent; box-shadow: none; color: var(--text); font-weight: 500; }
.modes .nav-row:not(.on):hover { background: var(--hover); }
.modes .nav-row svg { transition: color .2s, transform .28s; }
.modes .nav-row.on svg { color: var(--accent); transform: scale(1.12); }

/* ---------- mode panes: generic chrome. The active mode's pane is shown by the shell (hidden attribute). ---------- */
.modepane { display: flex; flex: 1; min-width: 0; min-height: 0; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg); }
.modepane[hidden] { display: none; }
.app[data-has-pane] .chatcol { flex: 0 0 var(--chat-w, 380px); }
/* the draggable divider between the chat and the docked panel (zero width; the handle overlaps both sides) */
.splitter { display: none; position: relative; flex: none; width: 0; z-index: 20; }
.splitter::before { content: ""; position: absolute; top: 0; bottom: 0; left: -5px; width: 10px; cursor: col-resize; }
.splitter::after { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--accent); opacity: 0; transition: opacity .12s; pointer-events: none; }
.splitter:hover::after, .splitter:focus-visible::after, .splitter.drag::after { opacity: .75; }
.splitter:focus-visible { outline: 0; }
.app[data-has-pane]:not(.pane-off):not(.pane-min):not(.pane-float):not(.pane-max) .splitter { display: block; }
body.resizing { cursor: col-resize; user-select: none; } body.resizing iframe { pointer-events: none; }
@media (max-width: 1100px) { .splitter { display: none !important; } }
.app[data-has-pane] .hero { padding-top: 6vh; }
.app[data-has-pane] .thread, .app[data-has-pane] .composer-wrap { padding-left: 16px; padding-right: 16px; }
.app.pane-off .modepane:not(.is-detached) { display: none !important; }
.app.pane-off .chatcol { flex: 1 !important; }
@media (max-width: 1100px) {
  .modepane { position: absolute; inset: 0 0 0 auto; width: min(820px, 100%); z-index: 30; box-shadow: var(--sh-lg); }
  .app[data-has-pane] .chatcol { flex: 1; }
}

/* sidebar bubble: position driven by --i set from JS (works for any number of modes) */
.modes .bubble { transform: translateY(calc(var(--i, 0) * 30px)); }

/* toolbar used by the sheet / document / slides panes */
.pane-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--side); flex: none; }
.pane-bar button { display: inline-flex; align-items: center; gap: 5px; height: 26px; min-width: 26px; padding: 0 7px; justify-content: center; border-radius: 6px; color: var(--text-2); font-size: 12px; border: 1px solid transparent; }
.pane-bar button:hover { background: var(--hover); color: var(--text); }
.pane-bar button.on { background: var(--raise); border-color: var(--line-2); box-shadow: var(--sh); color: var(--text); }
.pane-bar svg { width: 14px; height: 14px; }
.pane-bar i { width: 1px; height: 18px; background: var(--line-2); margin: 0 3px; }
.pane-bar select { height: 26px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--raise); color: var(--text-2); font: inherit; font-size: 12px; padding: 0 6px; box-shadow: var(--sh); }
.clr { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.clr input { width: 22px; height: 22px; padding: 0; border: 1px solid var(--line-2); border-radius: 5px; background: none; }
.grow { flex: 1; }

/* project folders: mixed items with their mode icon */
.chat-item svg.mi { width: 14px; height: 14px; color: var(--muted); flex: none; }
.chat-item.active svg.mi, .chat-item:hover svg.mi { color: var(--accent); }
.proj-chats .chat-item { gap: 7px; }
.proj-chats.drop { background: var(--active); outline: 1px dashed var(--accent); border-radius: 5px; }
.menu button svg { flex: none; }

.seg button { white-space: nowrap; }

/* tool-call rows open the side panel (workspace only, not the read-only share page) */
.modepane.flash { animation: paneflash .9s ease-out; }
@keyframes paneflash { 0% { box-shadow: inset 0 0 0 2px var(--accent); } 100% { box-shadow: inset 0 0 0 2px transparent; } }


/* minimize: the panel collapses into a tab on the right edge */
.app.pane-min .modepane:not(.is-detached) { display: none !important; }
.app.pane-min .chatcol { flex: 1 !important; }
.dock { position: fixed; right: 0; top: 96px; z-index: 55; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.dock[hidden] { display: none; }
.dock-tab { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 34px; padding: 10px 0 12px; border: 1px solid var(--line-2); border-right: 0; border-radius: 10px 0 0 10px; background: var(--raise); color: var(--text-2); box-shadow: var(--sh-lg); animation: dockin .25s cubic-bezier(.3,1.3,.5,1); transition: width .15s, color .15s, border-color .15s; }
.dock-tab:hover { width: 40px; color: var(--text); border-color: var(--accent); }
.dock-tab svg { width: 15px; height: 15px; color: var(--accent); } .dock-tab svg.mi { width: 16px; height: 16px; }
.dock-tab span { writing-mode: vertical-rl; font-size: 12px; font-weight: 500; letter-spacing: .01em; }
@keyframes dockin { from { transform: translateX(100%); opacity: 0; } }

/* ---------- window chrome for mode panels ---------- */
.pane-head { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-bottom: 1px solid var(--line); background: var(--side); flex: none; user-select: none; }
.pane-title { font-size: 12.5px; font-weight: 500; color: var(--text-2); min-width: 0; }
.pane-title.has-tabs { flex: 1 1 auto; overflow: hidden; margin-right: 6px; }
.ptabs { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; } .ptabs::-webkit-scrollbar { display: none; }
.ptab { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; max-width: 190px; height: 26px; padding: 0 6px 0 8px; border-radius: 6px; color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; transition: background .12s, color .12s; }
.ptab > svg { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ptab .pt { overflow: hidden; text-overflow: ellipsis; }
.ptab:hover { background: var(--hover); color: var(--text); }
.ptab.on { background: var(--raise); color: var(--text); box-shadow: var(--sh); } .ptab.on > svg { color: var(--accent); }
.ptab:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.ptab .tx { display: grid; place-items: center; width: 16px; height: 16px; margin-left: 2px; border-radius: 4px; color: var(--muted); opacity: 0; flex: none; }
.ptab:hover .tx, .ptab.on .tx, .ptab:focus-within .tx { opacity: 1; } .ptab .tx:hover { background: var(--active); color: var(--text); }
.ptab .tx svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.wctl { display: flex; align-items: center; gap: 2px; }
.pane-title.has-tabs ~ .wctl [data-w="close"] { display: none; }          /* the tab's own x closes the panel */
.wbtn { width: 28px; height: 28px; padding: 0; display: grid; place-items: center; border-radius: 6px; color: var(--text-2); background: none; border: 0; transition: background .12s, color .12s; }
.wbtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.wbtn:hover { background: var(--hover); color: var(--text); } .wbtn:active { background: var(--active); }
.wbtn[aria-pressed="true"] { color: var(--text); background: var(--active); }
.wbtn:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.modepane { position: relative; }

/* small window */
.modepane.is-float { position: fixed; z-index: 45; flex: none; min-width: 0 !important; max-width: none !important; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: var(--bg);
  box-shadow: 0 28px 64px -16px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.08); animation: popin .18s ease-out; }
.modepane.is-float .pane-head { cursor: grab; } .modepane.is-float.dragging .pane-head { cursor: grabbing; }
.modepane.is-float.dragging { transition: none; user-select: none; } .modepane.is-float.dragging iframe { pointer-events: none; }
.app.pane-float .chatcol { flex: 1 !important; }
@keyframes popin { from { transform: scale(.97); opacity: .6; } }
.rz { display: none; position: absolute; z-index: 8; }
.is-float .rz { display: block; }
.rz.n, .rz.s { left: 12px; right: 12px; height: 8px; cursor: ns-resize; } .rz.n { top: -3px; } .rz.s { bottom: -3px; }
.rz.e, .rz.w { top: 12px; bottom: 12px; width: 8px; cursor: ew-resize; } .rz.e { right: -3px; } .rz.w { left: -3px; }
.rz.ne, .rz.nw, .rz.se, .rz.sw { width: 16px; height: 16px; } .rz.ne { top: -3px; right: -3px; cursor: nesw-resize; } .rz.nw { top: -3px; left: -3px; cursor: nwse-resize; }
.rz.se { bottom: -3px; right: -3px; cursor: nwse-resize; } .rz.sw { bottom: -3px; left: -3px; cursor: nesw-resize; }
.rz.se::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); opacity: .55; }

/* maximized: fills the work area, chat stays underneath */
.modepane.is-max { position: absolute; inset: 0; z-index: 35; width: auto !important; min-width: 0 !important; max-width: none !important; flex: none; border-left: 0; box-shadow: none; }
@media (max-width: 1100px) { .modepane.is-max { inset: 0; } }

.avatar[data-n="2"] { background: #5b8def; color: #fff; }

/* Quick Access label + the "More apps" row */
.side-label { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 0; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.side-label a { color: var(--muted); text-decoration: none; opacity: 0; transition: opacity .12s; font-weight: 400; }
.side-label:hover a, .side-label a:focus-visible { opacity: 1; } .side-label a:hover { color: var(--accent); }
.modes .nav-row.more { color: var(--muted); text-decoration: none; margin-top: 2px; border-top: 1px dashed var(--line-2); border-radius: 0 0 6px 6px; padding-top: 2px; height: 30px; }
.modes .nav-row.more svg { color: var(--accent); stroke-width: 2.2; }
.modes .nav-row.more:hover { color: var(--text); background: var(--hover); border-radius: 6px; }

/* ---------- activity rows and the plan card ---------- */
.acts { position: relative; margin: 6px 0; }
.md + .acts, .acts + .md, .acts + .plan, .plan + .acts, .md + .plan, .plan + .md { margin-top: 8px; }
.act { position: relative; }
.act-head { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 28px; padding: 2px 8px 2px 4px; border-radius: 8px; color: var(--text-2); text-align: left; transition: background .12s; }
.act-head[aria-expanded]:hover, .act-head[data-reveal]:hover, .plan-h:hover { background: var(--hover); }
.act-head:not([aria-expanded]):not([data-reveal]) { cursor: default; }
.act-head:focus-visible, .plan-h:focus-visible { outline: 2px solid var(--ring); outline-offset: -1px; }
.nd-wrap { flex: none; width: 18px; height: 18px; display: grid; place-items: center; }
.nd { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; } .nd svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.nd.ok { color: #3fb27f; background: color-mix(in srgb, #3fb27f 16%, transparent); } .nd.err { color: #e5686b; background: color-mix(in srgb, #e5686b 16%, transparent); }
.nd.stop { color: var(--muted); background: var(--active); } .nd.stop svg { fill: currentColor; stroke: none; }
.nd.pend { border: 1.5px solid var(--line-2); }
.nd.ok .chk { stroke-dasharray: 20; stroke-dashoffset: 0; animation: draw .35s ease-out; } @keyframes draw { from { stroke-dashoffset: 20; } }
.spin2 { width: 15px; height: 15px; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0%, var(--accent) 100%); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.2px), #000 calc(100% - 2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 2.2px), #000 calc(100% - 2px)); animation: sp .75s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.act-head .ico { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.act-title { font-size: 12.5px; font-weight: 500; color: var(--text); white-space: nowrap; }
.act.running .act-title, .step.active .stxt, .plan.planning .plan-title { background: linear-gradient(90deg, var(--text-2) 0%, var(--text) 40%, var(--accent) 50%, var(--text) 60%, var(--text-2) 100%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.act-sub { min-width: 0; flex: 1 1 auto; font: 12px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-time { flex: none; margin-left: auto; font: 11px var(--mono); color: var(--muted); } .act-sub + .act-time, .stat + .act-time { margin-left: 0; }
.act .chev { flex: none; width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s; } .act.open .chev, .plan:not(.folded) > .plan-h .chev { transform: rotate(90deg); }
.act.error .act-title { color: #e5686b; }
.stat { display: flex; gap: 6px; font: 11.5px var(--mono); } .stat i { font-style: normal; } .stat .add { color: #3fb27f; } .stat .del { color: #e5686b; }
.act-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.act.open > .act-body { grid-template-rows: 1fr; }
.act-in { overflow: hidden; min-height: 0; margin: 0 0 0 26px; border-left: 1px solid var(--line-2); padding: 0 0 0 12px; }
.act.open .act-in { padding-top: 6px; padding-bottom: 8px; }
.kv { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; margin: 2px 0 6px; } .kv span { flex: none; width: 44px; color: var(--muted); font-size: 11.5px; } .kv b { font-weight: 500; color: var(--text); min-width: 0; overflow-wrap: anywhere; } .kv a { color: var(--accent); }
.act-meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; } .act-meta code, .act-in code { font: 11.5px var(--mono); }
.act-note { margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.srcs { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.src { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 24px; padding: 0 9px 0 7px; border: 1px solid var(--line-2); border-radius: 99px; background: var(--raise); color: var(--text-2); text-decoration: none; font-size: 11.5px; transition: border-color .12s; }
.src:hover { border-color: var(--accent); color: var(--text); } .src svg { width: 12px; height: 12px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.8; } .src b { font-weight: 600; flex: none; } .src em { font-style: normal; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.act-open { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; margin-top: 4px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--raise); color: var(--text-2); font-size: 12px; } .act-open:hover { border-color: var(--accent); color: var(--text); } .act-open svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.codeblk { border: 1px solid var(--line-2); border-radius: 8px; background: var(--code-bg); overflow: hidden; margin: 2px 0 6px; }
.codeblk-h { display: flex; align-items: center; justify-content: space-between; height: 26px; padding: 0 6px 0 10px; border-bottom: 1px solid rgba(236,231,222,.08); font: 11px var(--mono); color: rgba(236,231,222,.5); text-transform: lowercase; }
.codeblk-h button { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 5px; font: 11px var(--sans); color: rgba(236,231,222,.6); } .codeblk-h button:hover { background: rgba(236,231,222,.1); color: #ece7de; } .codeblk-h svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.codeblk pre { margin: 0; padding: 10px 12px; max-height: 260px; overflow: auto; font: 12px/1.6 var(--mono); color: #ece7de; tab-size: 4; } .codeblk code { font: inherit; background: none; padding: 0; }
.codeblk i { font-style: normal; } .codeblk .k { color: #f07c62; } .codeblk .s { color: #9bd0a6; } .codeblk .c { color: rgba(236,231,222,.42); font-style: italic; } .codeblk .n { color: #e6c07b; } .codeblk .b { color: #8fb8ff; }
.act-in .out, .act-in .args { margin: 2px 0 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--code-bg); color: #ece7de; font: 12px/1.55 var(--mono); max-height: 170px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; } .act-in .out.bad { color: #f29b9e; } .act-in .args { color: rgba(236,231,222,.7); max-height: 110px; }
.act-in .timgs { margin: 4px 0; }
.plan { margin: 8px 0; border: 1px solid var(--line-2); border-radius: 10px; background: var(--raise); box-shadow: var(--sh); overflow: hidden; }
.plan-h { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px 6px 10px; text-align: left; color: var(--text); }
.plan-title { font-size: 12.5px; font-weight: 600; } .plan-count { margin-left: auto; font: 11px var(--mono); color: var(--muted); } .plan-h .chev { flex: none; width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s; }
.plan-bar { display: flex; gap: 3px; padding: 0 12px 10px; } .plan-bar i { flex: 1; height: 3px; border-radius: 3px; background: var(--active); transition: background .3s; }
.plan-bar i.done { background: #3fb27f; } .plan-bar i.active { background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 30%, transparent), var(--accent)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; } .plan-bar i.stopped { background: var(--muted); }
.plan-bar.indet { display: block; position: relative; height: 3px; margin: 0 12px 10px; padding: 0; border-radius: 3px; background: var(--active); overflow: hidden; } .plan-bar.indet i { position: absolute; top: 0; bottom: 0; width: 35%; height: auto; background: var(--accent); animation: slide 1.3s ease-in-out infinite; } @keyframes slide { from { left: -35%; } to { left: 100%; } }
.steps { list-style: none; margin: 0; padding: 0 8px 8px; } .plan.folded .steps { display: none; } .plan.folded .plan-bar { padding-bottom: 8px; }
.step { position: relative; display: grid; grid-template-columns: 18px 1fr; column-gap: 8px; padding: 4px 4px; border-radius: 8px; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.step .nd-wrap { margin-top: 1px; } .step.done .stxt { color: var(--text-2); } .step.active { background: var(--hover); } .step.active .stxt { font-weight: 500; } .step.pending .stxt { color: var(--muted); } .step.stopped .stxt { color: var(--muted); text-decoration: line-through; }
.step .acts.nested { grid-column: 2; margin: 4px 0 2px; } .step .acts.nested .act-head { min-height: 26px; }
@media (prefers-reduced-motion: reduce) { .spin2, .plan-bar i.active, .plan-bar.indet i, .act.running .act-title, .step.active .stxt, .plan.planning .plan-title { animation: none; } .act-body { transition: none; } }
/* ---- account button, its menu, and the usage modal */
button.me { background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; height: 32px; border-radius: 6px; padding-right: 6px; }
button.me:hover, button.me[aria-expanded="true"] { background: var(--hover); }
.me .chev { width: 14px; height: 14px; margin-left: auto; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.menu.account { width: 220px; }
.menu.account button svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.menu.account button em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.menu.account button.soft { color: var(--muted); cursor: default; }
.menu.account button.soft:hover { background: none; color: var(--muted); }
.modal-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; }
.modal { width: min(380px, 100%); background: var(--raise); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--sh-lg); }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 0 18px; }
.modal-h h2 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-h .icon-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.usage-body { padding: 18px; }
.usage-big { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.usage-big b { font-size: 34px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.usage-big span { color: var(--muted); font-size: 13px; }
.meter { height: 8px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.meter.hot i { background: #d9534f; }
.usage-note { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }
.btn-credit { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 34px; margin-top: 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--hover); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 500; cursor: default; }
.btn-credit svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ---------- file card: what the assistant made, in the conversation ---------- */
.fcard { display: flex; align-items: center; gap: 6px; max-width: 440px; margin: 10px 0 4px; padding: 6px 6px 6px 6px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--raise); transition: border-color .12s, box-shadow .12s; }
.fcard:hover { border-color: var(--accent); box-shadow: 0 2px 12px rgba(0,0,0,.14); }
.fc-main { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; padding: 2px 6px 2px 2px; border-radius: 9px; text-align: left; }
.fc-main:focus-visible, .fc-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.fc-ic { width: 34px; height: 34px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--active); color: var(--accent); }
.fc-ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.fc-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.fc-meta b { font-weight: 600; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-meta small { font-size: 11.5px; color: var(--muted); }
.fc-acts { display: flex; gap: 4px; flex: none; }
.fc-btn { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 500; color: var(--text-2); border: 1px solid var(--line-2); background: transparent; white-space: nowrap; }
.fc-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fc-btn:hover { background: var(--hover); color: var(--text); }
.fc-menu { position: fixed; z-index: 200; min-width: 200px; padding: 5px; background: var(--raise); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.35); display: flex; flex-direction: column; }
.fc-menu button { text-align: left; padding: 7px 10px; border-radius: 6px; font-size: 12.5px; } .fc-menu button:hover, .fc-menu button:focus-visible { background: var(--hover); outline: none; }
/* the card adapts to the width of the conversation column, not the window: below ~420px the buttons drop under the title */
.fcw { container-type: inline-size; max-width: 440px; }
.fcard { max-width: none; }
.fc-main { flex: 1 1 150px; }
.fc-meta b, .fc-meta small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@container (max-width: 420px) { .fcard { flex-wrap: wrap; } .fc-main { flex-basis: 100%; } .fc-acts { width: 100%; padding-left: 46px; flex-wrap: wrap; } }
@container (max-width: 250px) { .fc-acts { padding-left: 2px; } .fc-btn { flex: 1 1 auto; justify-content: center; } }


/* ---- sidebar items: an app tile, the title (file extension dimmed), what it is and when it changed */
.chat-item { height: auto; min-height: 44px; padding: 5px 4px 5px 6px; gap: 10px; position: relative; border-radius: 8px; }
.chat-item .ci-ico { --h: var(--muted); flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--h) 15%, transparent); color: var(--h); transition: background .15s, transform .15s; }
.chat-item .ci-ico svg.mi { width: 15px; height: 15px; color: inherit; }
.chat-item:hover .ci-ico, .chat-item.active .ci-ico { background: color-mix(in srgb, var(--h) 24%, transparent); }
.chat-item.active svg.mi, .chat-item:hover svg.mi { color: inherit; }
.ci-ico[data-mode="code"] { --h: #3fa66b; } .ci-ico[data-mode="design"] { --h: #8b6cf0; } .ci-ico[data-mode="board"] { --h: #1ea7a1; } .ci-ico[data-mode="sheet"] { --h: #2f9e5b; }
.ci-ico[data-mode="docs"] { --h: #3b82f6; } .ci-ico[data-mode="slides"] { --h: #f07c62; } .ci-ico[data-mode="chat"] { --h: #8a93a6; }
.chat-item .ci-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chat-item .ci-t { font-weight: 500; font-size: 13px; line-height: 1.25; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text); }
.chat-item .ci-x { font-style: normal; font-weight: 400; color: var(--muted); }
.chat-item .ci-m { font-size: 11.5px; line-height: 1.2; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-item.active::before { content: ""; position: absolute; left: -1px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--accent); }
.chat-item:hover:not(.active) { background: var(--hover); }
.proj-chats .chat-item { gap: 10px; margin-left: 4px; }
.group-label { text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; font-weight: 600; padding: 16px 8px 6px; }
.group-label.sub { text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 500; padding: 10px 8px 4px; opacity: .85; }
.empty-list { padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: 8px; margin: 2px 4px 8px; font-size: 12px; line-height: 1.45; }

/* ---- something is being written: a pulsing dot on its conversation and on its tab (work elsewhere goes on meanwhile) */
.run-dot { position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: #8b5cf6; box-shadow: 0 0 0 2px var(--side); animation: run-pulse 1.2s ease-in-out infinite; }
.chat-item .ci-ico { position: relative; }
.chat-item.running .ci-m .run-t { font-weight: 500; color: #8b5cf6; }
.ptab { position: relative; } .ptab .run-dot { position: static; display: inline-block; width: 7px; height: 7px; margin-left: 2px; box-shadow: none; flex: none; }
@keyframes run-pulse { 50% { transform: scale(1.35); opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .run-dot { animation: none; } }

/* ---- the side panel as an app window: one soft rounded card beside the chat, with its tabs and window controls in trays like Quick Access */
@media (min-width: 1101px) {
  .modepane:not(.is-float):not(.is-max) { margin: 8px 8px 8px 2px; border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; background: var(--side); box-shadow: var(--sh); }
  .modepane.is-max { inset: 8px; border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; box-shadow: var(--sh-lg); }
}
.modepane .pane-head { height: 42px; padding: 0 7px; gap: 8px; background: var(--side); border-bottom: 1px solid var(--line); }
.modepane .pane-title:not(.has-tabs) { padding-left: 6px; }
.ptabs { width: max-content; max-width: 100%; padding: 2px; gap: 2px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-2); }
.ptab { height: 26px; border-radius: 7px; border: 1px solid transparent; }
.ptab.on { background: var(--raise); border-color: var(--line-2); box-shadow: var(--sh-lg); }
.wctl { padding: 2px; gap: 1px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-2); }
.wctl .wbtn { width: 26px; height: 26px; border-radius: 7px; color: var(--muted); }
.wctl .wbtn svg { width: 15px; height: 15px; }
.wctl .wbtn:hover { color: var(--text); background: var(--hover); }

/* ---- the assistant at work: three quiet flat indicators (one per reply, chosen in transcript.js), no avatar, nothing blinks */
.msg.assistant { display: block; }
.msg.assistant .mark { display: none; }
.thinking { display: inline-flex; align-items: center; gap: 9px; height: 24px; }
.thinking-t { font-size: 13px; color: var(--muted); letter-spacing: .01em; }
.ind { position: relative; display: inline-block; width: 15px; height: 15px; flex: none; }
/* A · precision arc: a thin ring with a fading tail */
.ind-a { border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 28%, var(--accent)); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px)); animation: ind-spin .85s linear infinite; }
/* B · segment ring: eight ticks fading in turn */
.ind-b i { position: absolute; left: 6.75px; top: 0; width: 1.6px; height: 4.5px; border-radius: 1px; background: var(--accent); transform-origin: .8px 7.5px; animation: ind-fade 1s linear infinite; }
.ind-b i:nth-child(1) { transform: rotate(0deg); animation-delay: -.875s; } .ind-b i:nth-child(2) { transform: rotate(45deg); animation-delay: -.75s; }
.ind-b i:nth-child(3) { transform: rotate(90deg); animation-delay: -.625s; } .ind-b i:nth-child(4) { transform: rotate(135deg); animation-delay: -.5s; }
.ind-b i:nth-child(5) { transform: rotate(180deg); animation-delay: -.375s; } .ind-b i:nth-child(6) { transform: rotate(225deg); animation-delay: -.25s; }
.ind-b i:nth-child(7) { transform: rotate(270deg); animation-delay: -.125s; } .ind-b i:nth-child(8) { transform: rotate(315deg); animation-delay: 0s; }
/* C · dual arc: two arcs turning against each other */
.ind-c::before, .ind-c::after { content: ""; position: absolute; border-radius: 50%; border: 1.5px solid transparent; }
.ind-c::before { inset: 0; border-top-color: var(--accent); border-left-color: var(--accent); animation: ind-spin 1.2s linear infinite; }
.ind-c::after { inset: 3.5px; border-bottom-color: var(--accent); border-right-color: var(--accent); opacity: .6; animation: ind-spin .8s linear infinite reverse; }
@keyframes ind-spin { to { transform: rotate(360deg); } }
@keyframes ind-fade { from { opacity: 1; } to { opacity: .15; } }
/* while the words arrive: a small marker at the end of the text, in the same family as the reply's indicator (no blinking bar) */
.caret::after { content: ""; display: inline-block; width: 9px; height: 9px; margin-left: 6px; vertical-align: -1px; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 28%, var(--accent)); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.6px), #000 calc(100% - 1.2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 1.6px), #000 calc(100% - 1.2px)); animation: ind-spin .85s linear infinite; }
.msg[data-ind="b"] .caret::after { background: repeating-conic-gradient(var(--accent) 0 18deg, transparent 18deg 45deg); animation: ind-spin 1s steps(8) infinite; }
.msg[data-ind="c"] .caret::after { background: none; -webkit-mask: none; mask: none; border: 1.5px solid transparent; border-top-color: var(--accent); border-left-color: var(--accent); width: 8px; height: 8px; animation-duration: 1.2s; }
@media (prefers-reduced-motion: reduce) { .ind, .ind *, .ind::before, .ind::after, .caret::after { animation: none !important; } }
.thinking.working { display: flex; margin-top: 8px; }

/* the live status line: the phrase shimmers softly, each new phrase rises in, the elapsed time sits quietly after it */
.thinking-t { background: linear-gradient(90deg, var(--muted) 0%, var(--text-2) 42%, color-mix(in srgb, var(--accent) 75%, var(--text)) 50%, var(--text-2) 58%, var(--muted) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2.4s linear infinite; }
.thinking-t.swap { animation: shimmer 2.4s linear infinite, phrase-in .38s cubic-bezier(.2,.7,.2,1); }
@keyframes phrase-in { from { opacity: 0; transform: translateY(5px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
.thinking-s { font: 11px var(--mono); color: var(--muted); opacity: .75; } .thinking-s:empty { display: none; }
.thinking-s::before { content: "·"; margin-right: 6px; opacity: .6; }
/* what is new in a streaming reply glides in */
.msg.streaming .fresh { animation: glide-in .34s cubic-bezier(.2,.7,.2,1) both; }
@keyframes glide-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .thinking-t, .thinking-t.swap, .msg.streaming .fresh { animation: none; color: var(--muted); background: none; } }
#allProjects { color: inherit; text-decoration: none; } #allProjects:hover { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

/* ---- compact one-line rows: a small app glyph, the name, and when it was created on the right (actions take its place on hover) */
.chat-item { min-height: 30px; height: 30px; padding: 0 4px 0 8px; gap: 8px; border-radius: 6px; }
.chat-item .ci-ico { width: 16px; height: 16px; border-radius: 0; background: none !important; }
.chat-item .ci-ico svg.mi { width: 15px; height: 15px; }
.chat-item .ci-t { flex: 1; min-width: 0; font-size: 13px; font-weight: 400; color: var(--text-2); }
.chat-item:hover .ci-t, .chat-item.active .ci-t { color: var(--text); }
.chat-item.active .ci-t { font-weight: 500; }
.chat-item .ci-m { flex: none; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chat-item .ci-m.run-t { color: #8b5cf6; font-weight: 500; }
.chat-item .del { display: none; }
.chat-item:hover .ci-m, .chat-item:focus-within .ci-m { display: none; }
.chat-item:hover .del, .chat-item:focus-within .del { display: grid; opacity: 1; }
.chat-item.active::before { top: 7px; bottom: 7px; }
.chat-item .run-dot { width: 7px; height: 7px; right: -3px; top: -2px; }
.proj-chats .chat-item { gap: 8px; }
.chat-item .ci-pin { flex: none; display: grid; place-items: center; color: var(--muted); margin-right: -2px; }
.chat-item .ci-pin svg { width: 12px; height: 12px; }
.chat-item:hover .ci-pin, .chat-item:focus-within .ci-pin { display: none; }

/* ---- "+ New" for the app you are in, above Quick Access; Quick Access, projects and items scroll together under it */
.sidebar .side-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.sidebar .side-scroll .chat-list { flex: none; overflow: visible; margin: 4px 0 0; padding: 0; }
.new-item { display: flex; align-items: center; gap: 9px; width: 100%; height: 32px; margin: 8px 0 2px; padding: 0 8px 0 7px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--raise); color: var(--text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; box-shadow: var(--sh); transition: border-color .12s, background .12s; flex: none; }
.new-item:hover { border-color: var(--muted); } .new-item:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.new-item .ni-ico { position: relative; width: 18px; height: 18px; display: grid; place-items: center; color: var(--accent); flex: none; }
.new-item .ni-ico svg { width: 15px; height: 15px; }
.new-item .ni-ico i { position: absolute; right: -4px; bottom: -4px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); color: var(--on-accent, #fff); font-style: normal; font-size: 10px; font-weight: 700; line-height: 11px; text-align: center; box-shadow: 0 0 0 2px var(--raise); }
.new-item .ni-t { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.new-item kbd { font: inherit; font-size: 10.5px; font-weight: 400; color: var(--muted); padding: 1px 5px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--bg); }
/* Quick Access is labelled like Projects and the item groups */
.sidebar .side-label { text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; font-weight: 600; padding: 12px 8px 2px; }
.sidebar .side-label a { text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 500; }
.sidebar .side-scroll { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.sidebar .side-scroll:hover { scrollbar-color: var(--line-2) transparent; }
.sidebar .side-scroll::-webkit-scrollbar { width: 6px; } .sidebar .side-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar .side-scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 6px; } .sidebar .side-scroll:hover::-webkit-scrollbar-thumb { background: var(--line-2); }

/* ---- Pinned: items from every app at the top of the list; it doubles as the drop zone while dragging */
.pin-zone { margin: 0 0 2px; border-radius: 8px; border: 1px solid transparent; transition: background .12s, border-color .12s; }
.pin-zone .group-label { padding-top: 10px; }
.pin-zone.empty { border: 1px dashed var(--line-2); padding-bottom: 4px; margin-top: 8px; } .pin-zone.empty .group-label { padding-top: 6px; }
.pin-zone .empty-list { border: 0; margin: 0 4px; padding: 2px 6px 4px; }
.pin-zone.drop { background: color-mix(in srgb, var(--accent) 8%, transparent); border-color: var(--accent); border-style: dashed; }
#chatList.drop { outline: 1px dashed var(--line-2); outline-offset: -2px; border-radius: 8px; }

/* ---- the account bar: one compact row; theme and sign out live in its menu */
.side-foot { padding-top: 6px; margin-top: 2px; }
.side-foot button.me { height: 30px; gap: 7px; padding: 0 6px 0 4px; }
.side-foot .avatar { width: 20px; height: 20px; font-size: 10px; box-shadow: none; }
.side-foot .me b { font-size: 12.5px; }
.side-foot .me .chev { width: 13px; height: 13px; opacity: .7; }
.menu.account .acct-h { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px 7px; margin-bottom: 3px; border-bottom: 1px solid var(--line); min-width: 0; }
.menu.account .acct-h b { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu.account .acct-h small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .menu-sep { height: 1px; background: var(--line); margin: 3px 2px; }
.menu.account .switch { margin-left: auto; position: relative; width: 26px; height: 15px; border-radius: 99px; background: var(--line-2); transition: background .15s; flex: none; }
.menu.account .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--raise); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.menu.account .switch.on { background: var(--accent); } .menu.account .switch.on::after { transform: translateX(11px); background: #fff; }
.menu.account [data-act="logout"]:hover { color: #e5686b; } .menu.account [data-act="logout"]:hover svg { color: #e5686b; }

/* ---- the profile card: set apart from the item list by a full-width rule and a fade, then a soft rounded card */
.side-foot { position: relative; display: block; margin: 0 -8px -8px; padding: 8px; border-top: 1px solid var(--line-2); background: var(--side); }
.side-foot::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 18px; background: linear-gradient(to bottom, transparent, var(--side)); pointer-events: none; }
.side-foot button.me { width: 100%; height: 40px; gap: 9px; padding: 0 8px 0 7px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--raise); box-shadow: 0 1px 2px rgba(0,0,0,.06); transition: border-color .15s, background .15s, box-shadow .15s; }
.side-foot button.me:hover { background: var(--raise); border-color: color-mix(in srgb, var(--muted) 55%, var(--line-2)); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.side-foot button.me[aria-expanded="true"] { background: var(--raise); border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.side-foot button.me:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.side-foot .avatar { width: 26px; height: 26px; font-size: 11.5px; border-radius: 8px; }
.side-foot .me-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.2; }
.side-foot .me-t b { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .me-t small { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .me .chev { width: 14px; height: 14px; opacity: .8; transition: transform .2s; }
.side-foot button.me[aria-expanded="true"] .chev { transform: rotate(180deg); }
.menu.account { border-radius: 10px; }

/* the profile row blends with the sidebar: no card of its own, just the dividing rule above it and a tint on hover */
.side-foot { padding: 6px 8px; }
.side-foot::before { height: 14px; }
.side-foot button.me { height: 32px; gap: 8px; padding: 0 6px 0 5px; border: 1px solid transparent; border-radius: 8px; background: transparent; box-shadow: none; }
.side-foot button.me:hover { background: var(--hover); border-color: transparent; box-shadow: none; }
.side-foot button.me[aria-expanded="true"] { background: var(--hover); border-color: transparent; box-shadow: none; }
.side-foot button.me:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 2px var(--ring); }
.side-foot .avatar { width: 22px; height: 22px; font-size: 10.5px; border-radius: 7px; }
.side-foot .me-t b { font-weight: 500; color: var(--text-2); } .side-foot button.me:hover .me-t b, .side-foot button.me[aria-expanded="true"] .me-t b { color: var(--text); }

/* native controls (scrollbars, select lists, date pickers) follow the theme */
:root[data-theme="dark"] { color-scheme: dark; } :root[data-theme="light"] { color-scheme: light; }

/* opening an item from a link: the main area stays blank until it is ready (no flash of the last app's empty page) */
.app.opening .main > *, .app.opening #panes { visibility: hidden; }

/* ---- the composer: one compact row. The message on the left; the model, attach and send together on the right */
.composer-wrap { padding-bottom: 14px; }
.composer { border-radius: 14px; padding: 5px 5px 5px 14px; background: var(--raise); border-color: color-mix(in srgb, var(--line-2) 85%, transparent); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px -14px rgba(0,0,0,.28); }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2)); box-shadow: 0 0 0 3px var(--ring), 0 8px 24px -14px rgba(0,0,0,.28); }
.composer-row { align-items: flex-end; gap: 8px; }
.composer textarea { padding: 7px 0; font-size: 13px; }
.composer-tools { display: flex; align-items: center; gap: 2px; flex: none; min-height: 34px; }
.model-pick.pill { height: 26px; padding: 0 6px 0 8px; border: 0; border-radius: 8px; background: transparent; box-shadow: none; color: var(--muted); font-size: 12px; gap: 5px; max-width: 150px; }
.model-pick.pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-pick.pill:hover, .model-pick.pill[aria-expanded="true"] { background: var(--hover); color: var(--text); }
.model-pick.pill::before { width: 6px; height: 6px; flex: none; }
.composer-tools .cbtn { width: 32px; height: 32px; border-radius: 9px; color: var(--muted); }
.composer-tools .cbtn svg { width: 17px; height: 17px; stroke-width: 1.8; }
.composer-tools .cbtn:hover { color: var(--text); }
/* send: a quiet outline until there is something to send, then a bright accent with a soft glow; the arrow lifts on hover */
.composer-tools .send { width: 32px; height: 32px; margin-left: 2px; border-radius: 10px; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent)); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 4px 12px -4px color-mix(in srgb, var(--accent) 70%, transparent); transition: transform .14s ease, box-shadow .14s ease, background .14s ease, color .14s ease; }
.composer-tools .send svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .16s ease; }
.composer-tools .send:hover:not(:disabled) { filter: none; transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 7px 16px -5px color-mix(in srgb, var(--accent) 80%, transparent); }
.composer-tools .send:hover:not(:disabled) svg { transform: translateY(-1.5px); }
.composer-tools .send:active:not(:disabled) { transform: translateY(0) scale(.95); }
.composer-tools .send:disabled { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line-2); opacity: .8; }
.composer-tools .send.stop { background: var(--text); color: var(--bg); box-shadow: none; }
.composer-tools .send.stop svg { fill: currentColor; stroke: none; }
@media (max-width: 520px) { .model-pick.pill { max-width: 92px; } }
@media (prefers-reduced-motion: reduce) { .composer-tools .send, .composer-tools .send svg { transition: none; } }

/* the model picker sits just under the message box, on the right */
.composer-foot { justify-content: flex-end; margin: 4px 2px 0; }
.composer-foot .model-pick.pill { height: 22px; padding: 0 4px 0 8px; font-size: 11.5px; max-width: 180px; }

/* the model name: plain text in the theme's accent (no chip), the name in semibold and the version in mono */
.composer-foot .model-pick.pill { --mp: color-mix(in srgb, var(--accent) 82%, var(--text)); height: 24px; padding: 0 6px 0 8px; gap: 6px;
  border: 0; border-radius: 8px; background: transparent; box-shadow: none; color: var(--mp); transition: background .14s ease; }
[data-theme="light"] .composer-foot .model-pick.pill { --mp: color-mix(in srgb, var(--accent) 70%, var(--text)); }   /* readable on the light page */
.composer-foot .model-pick.pill::before { width: 6px; height: 6px; background: var(--accent); }
.composer-foot .model-pick.pill .mp-name { font: 600 12px/1 var(--sans); letter-spacing: .01em; color: var(--mp); }
.composer-foot .model-pick.pill .mp-ver { margin-left: 4px; font: 500 10.5px/1 var(--mono); font-style: normal; color: color-mix(in srgb, var(--mp) 70%, transparent); }
.composer-foot .model-pick.pill svg { width: 12px; height: 12px; opacity: .85; color: var(--mp); }
.composer-foot .model-pick.pill:hover, .composer-foot .model-pick.pill[aria-expanded="true"] { background: var(--hover); color: var(--mp); }
.composer-foot .model-pick.pill:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
@media (prefers-reduced-motion: reduce) { .composer-foot .model-pick.pill { transition: none; } }

/* a little more compact: about 40px tall for one line */
.composer { padding: 3px 4px 3px 13px; border-radius: 13px; }
.composer textarea { padding: 6px 0; line-height: 1.45; }
.composer-tools { min-height: 30px; }
.composer-tools .cbtn { width: 30px; height: 30px; border-radius: 8px; } .composer-tools .cbtn svg { width: 16px; height: 16px; }
.composer-tools .send { width: 30px; height: 30px; border-radius: 9px; } .composer-tools .send svg { width: 15px; height: 15px; }

/* ---- send is just the icon: an accent paper plane (grey until there is something to send) that nudges forward on hover; stop is a small square */
.composer-tools .send, .ss-send { width: 30px; height: 30px; border-radius: 8px; background: none !important; box-shadow: none !important; color: var(--accent); transform: none; display: grid; place-items: center; transition: color .15s ease, opacity .15s ease; }
.composer-tools .send svg, .ss-send svg { width: 19px; height: 19px; fill: currentColor; stroke: none; transition: transform .18s cubic-bezier(.2,.8,.2,1); }
.composer-tools .send:hover:not(:disabled), .ss-send:hover:not(:disabled) { transform: none; filter: none; color: color-mix(in srgb, var(--accent) 82%, var(--text)); }
.composer-tools .send:hover:not(:disabled) svg, .ss-send:hover:not(:disabled) svg { transform: translateX(2px); }
.composer-tools .send:active:not(:disabled) svg, .ss-send:active:not(:disabled) svg { transform: translateX(3px) scale(.92); }
.composer-tools .send:disabled, .ss-send:disabled { color: var(--muted); opacity: .45; box-shadow: none; }
.composer-tools .send.stop, .ss-send.stop { color: var(--text); }
.composer-tools .send.stop svg, .ss-send.stop svg { width: 18px; height: 18px; }
.composer-tools .send.stop:hover, .ss-send.stop:hover { color: var(--accent); }
.composer-tools .send:focus-visible, .ss-send:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.composer-tools .send[hidden], .ss-send[hidden] { display: none !important; }

/* ---- attach and send kept compact */
.composer-tools { gap: 0; min-height: 28px; }
.composer-tools .cbtn { width: 26px; height: 26px; border-radius: 7px; } .composer-tools .cbtn svg { width: 15px; height: 15px; }
.composer-tools .send, .ss-send { width: 26px; height: 26px; border-radius: 7px; }
.composer-tools .send.stop svg, .ss-send.stop svg { width: 16px; height: 16px; }
.composer { padding: 3px 3px 3px 13px; }

/* ---- send: a plain up arrow (stroked, accent; grey until there is something to send) that lifts slightly on hover */
.composer-tools .send svg.ic-up, .ss-send svg.ic-up { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.composer-tools .send:hover:not(:disabled) svg, .ss-send:hover:not(:disabled) svg { transform: translateY(-1.5px); }
.composer-tools .send:active:not(:disabled) svg, .ss-send:active:not(:disabled) svg { transform: translateY(-2px) scale(.94); }

/* ---- tablets and phones (under 1100px): one thing at a time. The item fills the work area with a "Chat" back button;
   the chat shows a chip above the message box to open the item. No side-by-side halves, no sideways scrolling. */
.pane-back { display: none; }
.pane-chip { display: none; }
@media (max-width: 1099.98px) {
  .work { position: relative; overflow: hidden; }
  .modepane:not(.is-detached), .modepane.is-max { position: absolute !important; inset: 0 !important; width: auto !important; height: auto !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; z-index: 30; }
  .modepane.is-float { left: 0 !important; top: 0 !important; }
  .app[data-has-pane] .chatcol { flex: 1 1 auto !important; min-width: 0; }
  .modepane .wctl [data-w="min"], .modepane .wctl [data-w="pop"], .modepane .wctl [data-w="max"], .modepane .wctl [data-w="close"], .modepane .rz { display: none !important; }
  .modepane .wctl:not(:has(.wbtn:not([data-w="min"]):not([data-w="pop"]):not([data-w="max"]):not([data-w="close"]))) { display: none; }
  .pane-back { display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 10px 0 4px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text-2); font: 500 12.5px var(--sans); flex: none; }
  .pane-back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .pane-back:hover { color: var(--text); background: var(--hover); }
  .modepane .pane-head { gap: 6px; } .modepane .pane-title { min-width: 0; overflow: hidden; }
  .pane-chip:not([hidden]) { display: flex; align-items: center; gap: 8px; width: 100%; height: 38px; margin: 0 0 8px; padding: 0 10px 0 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--raise); color: var(--text); box-shadow: var(--sh); font: 13px var(--sans); text-align: left; }
  .pane-chip:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
  .pane-chip svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .pane-chip .pc-ic { color: var(--accent); } .pane-chip .pc-go { color: var(--muted); }
  .pane-chip .pc-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
  .pane-chip .pc-k { color: var(--muted); font-size: 12px; flex: none; }
  .pane-chip.busy .pc-ic { animation: bdpulse 1.1s ease-in-out infinite; }
  .to-bottom { bottom: 100px; }
}
@keyframes bdpulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }

/* ---- the message box on small screens: the placeholder stays on one line; no scrollbar until the text needs one */
.composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer textarea { overflow-y: hidden; } .composer textarea.scroll { overflow-y: auto; }
@media (max-width: 1099.98px) { .app[data-has-pane]:not(.pane-off):not(.pane-min) .chatcol { visibility: hidden; } }

/* ---- the sidebar as a drawer on tablets and phones: slides in over a dimmed page; tap outside, Escape or its own button closes it */
.side-scrim { display: none; }
@media (max-width: 860px) {
  .sidebar { transition: transform .22s cubic-bezier(.2,.8,.2,1), visibility 0s .22s; box-shadow: none; }
  .app.open .sidebar { transition: transform .22s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .side-scrim { display: block; position: fixed; inset: 0; z-index: 49; background: rgba(8,10,18,.38); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .app.open .side-scrim { opacity: 1; pointer-events: auto; }
}
@media (max-width: 860px) and (prefers-reduced-motion: reduce) { .sidebar, .app.open .sidebar, .side-scrim { transition: none; } }

/* ---- desktop with the panel docked beside the chat: the chat is a matching window (same rounded card, same tray of tabs in its header) */
.chat-head { display: none; }
@media (min-width: 1101px) {
  .app[data-has-pane]:not(.pane-off):not(.pane-min):not(.pane-float):not(.pane-max) .chatcol { margin: 8px 2px 8px 8px; border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; background: var(--bg); box-shadow: var(--sh); }
  .app[data-has-pane]:not(.pane-off):not(.pane-min):not(.pane-float):not(.pane-max) .chat-head { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 7px; background: var(--side); border-bottom: 1px solid var(--line); flex: none; user-select: none; }
  .chat-head .ptabs { min-width: 0; }
  .chat-head .ctab { cursor: default; max-width: 100%; }
  .chat-head .ctab .ci { display: grid; place-items: center; flex: none; color: var(--accent); }
  .chat-head .ctab .ci svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .chat-head .ctab .pt { padding-right: 4px; }
}
.chat-head, .chat-head .ctab, .chat-head .pt { font-family: var(--sans); }

/* ---- tabs in the chat's and the panel's headers: a flat strip; tabs are plain labels, the active one is brighter with a thin accent
   underline (quiet and professional: no boxes, curves or colour blocks) */
.modepane .pane-head, .chat-head { align-items: stretch !important; padding: 0 8px 0 6px !important; height: 40px; gap: 6px; }
.modepane .pane-head > .wctl, .modepane .pane-head > .pane-back, .chat-head > .tab-new { align-self: center; }
.modepane .pane-head .pane-title { align-self: stretch; display: flex; align-items: stretch; }
.modepane .pane-title:not(.has-tabs) { align-self: center; }
.modepane .ptabs, .chat-head .ptabs { align-self: stretch; align-items: stretch; gap: 2px; padding: 0; margin: 0; height: auto; width: auto; background: none; border: 0; border-radius: 0; box-shadow: none; overflow-x: auto; overflow-y: hidden; }
.modepane .ptab, .chat-head .ptab { position: relative; height: auto; margin: 0; padding: 0 10px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--muted); font-weight: 500; }
.modepane .ptab:hover, .chat-head .ptab:not(.ctab):hover { color: var(--text); background: transparent; }
.modepane .ptab::before { display: none; }
.modepane .ptab::after, .chat-head .ptab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; top: auto; width: auto; height: 2px; border-radius: 2px 2px 0 0; background: transparent; transition: background .15s ease; }
.modepane .ptab.on, .chat-head .ptab.on { color: var(--text); background: transparent; border: 0; box-shadow: none; }
.modepane .ptab.on::after, .chat-head .ptab.on::after { background: var(--accent); }
.modepane .ptab:not(.on):hover::after { background: var(--line-2); }
.modepane .ptab.on > svg, .chat-head .ptab.on .ci { color: var(--accent); }
.modepane .ptab .tx { opacity: 0; } .modepane .ptab:hover .tx, .modepane .ptab.on .tx { opacity: .8; }
.chat-head .ctab { cursor: default; }
.chat-head .tab-new { display: grid; place-items: center; width: 26px; height: 26px; margin-left: 2px; border-radius: 7px; color: var(--muted); }
.chat-head .tab-new:hover { background: var(--hover); color: var(--text); }
.chat-head .tab-new svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.modepane .ptab.on { flex: 0 0 auto; max-width: min(240px, 62%); }
.modepane .ptab:not(.on) { flex: 0 1 auto; min-width: 34px; }

/* ---- two windows, each with tabs: the chat window (a chat icon per conversation, + for a new one) and the item window (+ adds any item) */
.chat-head { display: flex !important; align-items: stretch; gap: 4px; height: 40px; padding: 0 8px 0 6px; background: var(--side); border-bottom: 1px solid var(--line); flex: none; user-select: none; }
.chat-head .ctabs { flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; } .chat-head .ctabs::-webkit-scrollbar { display: none; }
.chat-head .ctab { cursor: pointer; max-width: 200px; flex: 0 1 auto; min-width: 44px; }
.chat-head .ctab.on { flex: 0 0 auto; max-width: 260px; }
.chat-head .ctab .ci { display: grid; place-items: center; flex: none; color: inherit; }
.chat-head .ctab.on .ci { color: var(--accent); }
.chat-head .ctab .ci svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-head .ctab:not(.on):hover { color: var(--text); }
.chat-head .ctab:not(.on):hover::after { background: var(--line-2); }
.chat-head .ctab .tx { display: grid; place-items: center; width: 16px; height: 16px; margin-left: 2px; border-radius: 4px; color: var(--muted); opacity: 0; flex: none; }
.chat-head .ctab:hover .tx, .chat-head .ctab.on .tx { opacity: .8; } .chat-head .ctab .tx:hover { background: var(--active); color: var(--text); opacity: 1; }
.chat-head .ctab .tx svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.modepane .tab-add { align-self: center; display: grid; place-items: center; width: 26px; height: 26px; margin-left: 2px; border-radius: 7px; color: var(--muted); flex: none; }
.modepane .tab-add:hover { background: var(--hover); color: var(--text); }
.modepane .tab-add svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.modepane .pane-title.has-tabs { display: flex; align-items: stretch; }
.menu.tabmenu { min-width: 230px; max-width: 300px; }
.menu.tabmenu button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu.tabmenu button svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }

/* ---- Quick Access as a row of app icons (the name shows on hover); clicking one opens that app beside the chat */
.modes.app-icons { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; margin: 0 8px 4px; }
.modes.app-icons .bubble { display: none; }
.app-ic { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--text-2); background: transparent; border: 0; transition: background .12s, color .12s, transform .12s; }
.app-ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-ic:hover, .app-ic:focus-visible { background: var(--hover); color: var(--accent); outline: none; }
.app-ic:active { transform: scale(.94); }
.app-ic.more { color: var(--muted); }
.app-ic[data-tip]::after { content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 6px); transform: translate(-50%, -2px); padding: 4px 8px; border-radius: 6px; background: var(--text); color: var(--bg); font: 500 11.5px var(--sans); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s .25s, transform .12s .25s; z-index: 60; }
.app-ic:hover::after, .app-ic:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }

/* ---- one Chats list: a chat icon, the title, the apps open in it, the time */
.chat-item .ci-apps { display: inline-flex; align-items: center; gap: 2px; flex: none; margin-left: 4px; color: var(--muted); }
.chat-item .ci-apps i { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: color-mix(in srgb, var(--hover) 70%, transparent); }
.chat-item .ci-apps svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-item .ci-apps b { font: 600 10px var(--sans); color: var(--muted); padding-left: 1px; }
.chat-item.active .ci-apps { color: var(--accent); }
.chat-item:hover .ci-apps { display: none; }
.chat-item .ci-ico[data-mode="chat"] svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- hovering a chat: a small card with its name, the apps in it and when it changed */
.ci-card { position: fixed; z-index: 70; width: 232px; padding: 10px 12px; border-radius: 10px; background: var(--raise); border: 1px solid var(--line-2); box-shadow: var(--sh-lg); color: var(--text); font: 12.5px var(--sans); opacity: 0; transform: translateX(-4px); pointer-events: none; transition: opacity .12s, transform .12s; }
.ci-card.on { opacity: 1; transform: none; }
.ci-card .cc-t { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ci-card .cc-apps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.ci-card .cc-apps span { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 6px; background: var(--hover); color: var(--text-2); font-size: 11.5px; }
.ci-card .cc-apps svg { width: 12px; height: 12px; fill: none; stroke: var(--accent); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ci-card .cc-none { margin-top: 6px; color: var(--muted); font-size: 12px; }
.ci-card .cc-m { margin-top: 8px; color: var(--muted); font-size: 11.5px; }
@media (prefers-reduced-motion: reduce) { .ci-card, .app-ic, .app-ic::after { transition: none; } }
#modeSeg.app-icons { flex-direction: row !important; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; margin: 6px 0 8px; }
#modeSeg.app-icons .app-ic { flex: 0 0 auto; }
#modeSeg.app-icons { flex-wrap: nowrap; justify-content: space-between; }
#modeSeg.app-icons .app-ic { width: 30px; height: 30px; border-radius: 8px; }
#modeSeg.app-icons .app-ic:first-child[data-tip]::after { left: 0; transform: translate(0, -2px); } #modeSeg.app-icons .app-ic:first-child:hover::after { transform: none; }
#modeSeg.app-icons .app-ic:last-child[data-tip]::after { left: auto; right: 0; transform: translate(0, -2px); } #modeSeg.app-icons .app-ic:last-child:hover::after { transform: none; }
.modepane .ptab.on { max-width: 240px; }

/* ---- tablets and phones: one tab strip for both windows (chat tabs, then the item tabs); no separate back button or chip */
.tab-sep { display: none; }
@media (max-width: 1099.98px) {
  .pane-back, .pane-chip { display: none !important; }
  .tab-sep { display: block; flex: none; width: 1px; align-self: center; height: 18px; margin: 0 4px; background: var(--line-2); }
  .chat-head .itab, .modepane .ctab { cursor: pointer; max-width: 170px; flex: 0 1 auto; min-width: 44px; }
  .chat-head .itab > svg, .modepane .ctab .ci svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .modepane .ctab .ci { display: grid; place-items: center; flex: none; }
  .chat-head .itab::after, .modepane .ctab::after { background: transparent !important; }
  .chat-head .itab:hover, .modepane .ctab:hover { color: var(--text); }
  .modepane .pane-head .pane-title.has-tabs { flex: 1 1 auto; min-width: 0; }
  .modepane .ptabs, .chat-head .ctabs { overflow-x: auto; scrollbar-width: none; } .modepane .ptabs::-webkit-scrollbar { display: none; }
  .to-bottom { bottom: 72px; }
}
/* the app icons share the row's width (never wider than the sidebar); with many apps they wrap to a second line */
#modeSeg.app-icons { flex-wrap: wrap; justify-content: space-between; gap: 2px; min-width: 0; overflow: visible; box-sizing: border-box; }
#modeSeg.app-icons .app-ic { flex: 1 1 26px; min-width: 0; max-width: 34px; width: auto; height: 30px; }

/* ---- desktop: the chat is always a window (rounded card with its tab strip), with or without an item window beside it */
@media (min-width: 1101px) {
  .chatcol { margin: 8px; border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; background: var(--bg); box-shadow: var(--sh); }
  .app[data-has-pane]:not(.pane-off):not(.pane-min):not(.pane-float):not(.pane-max) .chatcol { margin: 8px 2px 8px 8px; }
}

/* ---- tabs: separate rounded tabs in a soft tray; the active one is raised (light surface, hairline border, soft shadow); each has a close x */
.chat-head, .modepane .pane-head { height: 40px; padding: 0 8px !important; align-items: center !important; gap: 6px; background: var(--side); }
.chat-head .ctabs, .modepane .ptabs { align-self: center !important; align-items: center !important; gap: 4px; padding: 3px !important; margin: 0 !important; background: color-mix(in srgb, var(--bg) 55%, var(--side)) !important; border: 1px solid var(--line) !important; border-radius: 10px !important; box-shadow: inset 0 1px 2px rgba(0,0,0,.08) !important; height: auto !important; max-width: 100%; }
.chat-head .ptab, .modepane .ptab { height: 26px !important; padding: 0 4px 0 9px !important; gap: 6px; border-radius: 7px !important; border: 1px solid transparent !important; background: transparent !important; color: var(--muted); font: 500 12px var(--sans); box-shadow: none !important; margin: 0 !important; transition: background .12s, color .12s, box-shadow .12s; }
.chat-head .ptab::after, .modepane .ptab::after, .modepane .ptab::before { display: none !important; content: none !important; }
.chat-head .ptab:not(.on):hover, .modepane .ptab:not(.on):hover { background: color-mix(in srgb, var(--hover) 80%, transparent) !important; color: var(--text); }
.chat-head .ptab + .ptab:not(.on):not(:hover)::before, .modepane .ptab + .ptab:not(.on):not(:hover)::before { content: none; }
.chat-head .ptab.on, .modepane .ptab.on { background: var(--raise) !important; color: var(--text); border-color: var(--line-2) !important; box-shadow: 0 1px 2px rgba(0,0,0,.18), 0 2px 8px -4px rgba(0,0,0,.35) !important; }
.chat-head .ptab.on .ci, .modepane .ptab.on > svg { color: var(--accent); }
.chat-head .ptab .tx, .modepane .ptab .tx { display: grid !important; place-items: center; width: 18px; height: 18px; margin-left: 2px; border-radius: 5px; color: var(--muted); opacity: 0; flex: none; }
.chat-head .ptab.on .tx, .modepane .ptab.on .tx, .chat-head .ptab:hover .tx, .modepane .ptab:hover .tx { opacity: 1; }
.chat-head .ptab .tx:hover, .modepane .ptab .tx:hover { background: var(--active); color: var(--text); }
.chat-head .ptab .tx svg, .modepane .ptab .tx svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.chat-head .tab-new, .modepane .tab-add { margin-left: 0; }
.tab-sep { background: var(--line) !important; }
/* the chat window's own controls; with the chat hidden, a slim handle on the left brings it back */
.chat-head .grow { flex: 1; } .chat-wctl { display: none !important; }
.chat-handle { display: none; }
@media (min-width: 1101px) {
  .app[data-has-pane]:not(.pane-off):not(.pane-min) .chat-wctl { display: flex !important; }
  .app.chat-hidden[data-has-pane]:not(.pane-off):not(.pane-min) .chatcol { display: none !important; }
  .app.chat-hidden[data-has-pane]:not(.pane-off):not(.pane-min) .chat-handle { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; width: 34px; margin: 8px 0 8px 8px; padding: 10px 0; border: 1px solid var(--line-2); border-radius: 12px; background: var(--side); color: var(--muted); box-shadow: var(--sh); font: 500 11px var(--sans); writing-mode: vertical-rl; }
  .app.chat-hidden .chat-handle svg { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; writing-mode: horizontal-tb; }
  .app.chat-hidden .chat-handle:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
  .app.chat-hidden[data-has-pane] .modepane:not(.is-max) { margin-left: 6px !important; }
}
/* "+" menu: restore what was closed */
.menu.tabmenu button.restore em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--accent); flex: none; }
/* tabs keep a readable width; when the strip is full it scrolls sideways (the active tab is scrolled into view) */
.chat-head .ctabs, .modepane .ptabs { flex: 0 1 auto; min-width: 0; overflow-x: auto !important; overflow-y: hidden; scrollbar-width: none; }
.chat-head .ctabs::-webkit-scrollbar, .modepane .ptabs::-webkit-scrollbar { display: none; }
.chat-head .ptab, .modepane .ptab { flex: 0 0 auto !important; min-width: 0 !important; max-width: 150px !important; }
.chat-head .ptab.on, .modepane .ptab.on { max-width: 220px !important; }

/* ---- every window looks the same: the same card, the same header (tab tray, +, then the same four controls) */
@media (min-width: 1101px) {
  .chat-wctl { display: flex !important; }
  .chatcol, .modepane:not(.is-max) { border-radius: 14px !important; border: 1px solid var(--line-2) !important; box-shadow: var(--sh) !important; }
  .chatcol { background: var(--bg); }
  .modepane:not(.is-max) { margin: 8px 8px 8px 2px !important; }
  .app.pane-off .chatcol, .app.pane-min .chatcol, .app:not([data-has-pane]) .chatcol { margin: 8px !important; }
}
.chat-head, .modepane .pane-head { height: 40px !important; min-height: 40px; background: var(--side) !important; border-bottom: 1px solid var(--line) !important; }
.chat-head .wctl, .modepane .pane-head .wctl { padding: 2px; gap: 1px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-2); align-self: center; }
.chat-head .wctl .wbtn, .modepane .wctl .wbtn { width: 26px; height: 26px; border-radius: 7px; color: var(--muted); }
.chat-head .wctl .wbtn svg, .modepane .wctl .wbtn svg { width: 15px; height: 15px; }
.chat-head .wctl .wbtn:hover:not(:disabled), .modepane .wctl .wbtn:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.chat-head .wctl .wbtn:disabled { opacity: .35; cursor: default; }
.chat-head .tab-new, .modepane .tab-add { width: 26px; height: 26px; border-radius: 7px; }
@media (min-width: 1101px) { .modepane .pane-title.has-tabs ~ .wctl [data-w="close"] { display: grid !important; } }

/* ---- drag and drop: windows swap sides; tabs move within a strip; the sidebar drops into a window's tabs */
.chat-head[draggable="true"], .modepane .pane-head[draggable="true"] { cursor: grab; }
.chat-head[draggable="true"] :is(button, .ptab), .modepane .pane-head[draggable="true"] :is(button, .ptab) { cursor: pointer; }
.ptab.dragging { opacity: .45; }
.ptab.drop-l { box-shadow: inset 2px 0 0 var(--accent) !important; } .ptab.drop-r { box-shadow: inset -2px 0 0 var(--accent) !important; }
.strip-drop { outline: 1px dashed color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; }
.win-drop { outline: 2px solid var(--accent) !important; outline-offset: -2px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), var(--sh) !important; }
body.win-dragging .chatcol, body.win-dragging .modepane:not([hidden]) { transition: outline-color .12s, box-shadow .12s; }
/* swapped: the item window on the left, the chat on the right */
.app.swapped .work > .modepane { order: 1; } .app.swapped .work > .splitter { order: 2; } .app.swapped .work > .chatcol { order: 3; } .app.swapped .work > .chat-handle { order: 4; }
@media (min-width: 1101px) {
  .app.swapped[data-has-pane]:not(.pane-off):not(.pane-min):not(.pane-max) .chatcol { margin: 8px 8px 8px 2px !important; }
  .app.swapped[data-has-pane]:not(.pane-off):not(.pane-min):not(.pane-max) .modepane:not(.is-max) { margin: 8px 2px 8px 8px !important; }
  .app.swapped.chat-hidden .chat-handle { margin: 8px 8px 8px 0 !important; }
}

/* ---- the inside of an extra window (?embed=1): one item or one chat, without the app's chrome (the window around it draws the tabs) */
.app.embed { grid-template-columns: 1fr !important; }
.app.embed .sidebar, .app.embed .side-scrim, .app.embed .topbar, .app.embed .chat-head, .app.embed .chat-handle, .app.embed .splitter, .app.embed .modepane .pane-head, .app.embed .pane-chip, .app.embed #tray, .app.embed .tray { display: none !important; }
.app.embed .chatcol { margin: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
.app.embed-item .chatcol { display: none !important; }
.app.embed-item .modepane:not([hidden]) { position: relative !important; inset: auto !important; flex: 1 1 auto !important; width: auto !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; display: flex !important; }
.app.embed-chat .modepane { display: none !important; }

/* ---- extra windows: the same card and header as every window; the content is the app showing one item or one chat */
.xwin { display: flex; flex-direction: column; flex: 1 1 0; min-width: 300px; min-height: 0; margin: 8px 8px 8px 2px; border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; background: var(--bg); box-shadow: var(--sh); position: relative; }
.xwin[hidden] { display: none !important; }
.xwin .xwin-head { display: flex !important; }
.xwin-body { position: relative; flex: 1; min-height: 0; background: var(--bg); }
.xwin-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }
.xwin-frame[hidden] { display: none; }
.xwin .xtab .ci { display: grid; place-items: center; flex: none; }
.xwin .xtab .ci svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.xwin .xtab.on .ci { color: var(--accent); }
.xwin.xmax { position: absolute; inset: 8px; z-index: 36; margin: 0; }
body.resizing .xwin-frame, body.win-dragging .xwin-frame, .xwin-new ~ .xwin .xwin-frame { pointer-events: none; }
.app.has-xwin[data-has-pane]:not(.pane-off):not(.pane-min) .modepane:not(.is-max) { margin-right: 2px !important; }
/* windows waiting for room (or minimised) sit in a small dock at the bottom right */
.xwin-dock { position: absolute; right: 14px; bottom: 14px; z-index: 37; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 60%; }
.xwin-dock[hidden] { display: none; }
.xchip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--raise); color: var(--text-2); box-shadow: var(--sh-lg); font: 500 12px var(--sans); max-width: 220px; }
.xchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .xchip em { font-style: normal; color: var(--muted); font-size: 11px; }
.xchip svg { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.xchip:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
/* "New window": shown at the right while a tab is dragged */
.xwin-new { flex: 0 0 150px; margin: 8px 8px 8px 2px; border: 2px dashed var(--line-2); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font: 12px var(--sans); text-align: center; background: color-mix(in srgb, var(--hover) 40%, transparent); }
.xwin-new b { color: var(--text-2); font-weight: 600; } .xwin-new svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.xwin-new.on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.xwin-new.on b { color: var(--accent); }
@media (max-width: 1100px) { .xwin, .xwin-new { display: none !important; } }
.app.embed .modepane.is-detached, .app.embed .modepane.is-float { display: none !important; }
.app.embed-item .modepane[hidden] { display: none !important; }

/* ---- the chat window: an item of this workspace (or the New tab page) shown over the chat, under the window's tabs */
.chatcol { position: relative; }
.cw-body { position: absolute; left: 0; right: 0; bottom: 0; top: 40px; z-index: 6; background: var(--bg); }
.cw-body[hidden] { display: none; }
.chatcol.cw-item > #scroll, .chatcol.cw-item > .composer-wrap { visibility: hidden; }
.app.embed .cw-body { display: none !important; }

/* ---- the New tab page: one tile per app, and what was recently closed from this workspace */
.ntp-host { position: absolute; inset: 0; overflow: auto; background: var(--bg); z-index: 3; }
.ntp-host[hidden] { display: none; }
.modepane > .ntp-host { top: 40px; z-index: 8; }
.ntp { min-height: 100%; display: flex; justify-content: center; align-items: flex-start; padding: 52px 24px 32px; box-sizing: border-box; }
.ntp-in { width: min(620px, 100%); }
.ntp h2 { margin: 0 0 6px; font: 600 19px/1.25 var(--sans); letter-spacing: -.01em; color: var(--text); }
.ntp p { margin: 0 0 22px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.ntp p b { color: var(--text); font-weight: 600; }
.ntp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.ntp-app { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; padding: 13px 13px 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--raise); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.ntp-app:hover, .ntp-app:focus-visible { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2)); box-shadow: var(--sh); transform: translateY(-1px); outline: none; }
.ntp-app.busy, .ntp-row.busy { opacity: .55; pointer-events: none; }
.ntp-ic { display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 7px; border-radius: 9px; background: color-mix(in srgb, var(--accent) 11%, var(--bg)); color: var(--accent); }
.ntp-ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ntp-app b { font-size: 13.5px; font-weight: 600; }
.ntp-d { max-width: 100%; font-size: 11.5px; line-height: 1.35; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ntp h3 { margin: 28px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ntp-list { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: var(--raise); }
.ntp-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.ntp-row:first-child { border-top: 0; }
.ntp-row:hover, .ntp-row:focus-visible { background: var(--hover); outline: none; }
.ntp-row svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--text-2); }
.ntp-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ntp-row em { flex: none; font-style: normal; font-size: 11.5px; color: var(--muted); }
.ptab.ntab .ci, .ptab.ntab > svg { color: var(--muted); }
.modepane .ptab.ntab > svg { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@media (max-width: 600px) { .ntp { padding: 28px 16px; } .ntp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* many tabs in a narrow window: the others shrink (their names cut short) before the strip scrolls, so the workspace chat stays in view */
.chat-head .ptabs > .ptab:not(.on), .modepane .ptabs > .ptab:not(.on) { flex: 0 1 auto !important; min-width: 88px !important; }   /* an icon and a few letters; what does not fit folds into +N (tabflow.js) */
.chat-head .ptabs > .ptab .pt, .modepane .ptabs > .ptab .pt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .ptabs > .ptab.on { flex-shrink: 0; }

/* ---- a divider between the item window and an extra window, or between extra windows: drag to resize, double-click to share evenly */
.xsplit { position: relative; flex: none; width: 0; z-index: 20; }
.xsplit[hidden] { display: none; }
.xsplit::before { content: ""; position: absolute; top: 0; bottom: 0; left: -5px; width: 10px; cursor: col-resize; }
.xsplit::after { content: ""; position: absolute; top: 8px; bottom: 8px; left: -1px; width: 2px; border-radius: 2px; background: var(--accent); opacity: 0; transition: opacity .12s; pointer-events: none; }
.xsplit:hover::after, .xsplit.drag::after { opacity: .75; }
.xwin { min-width: 300px; }
.app.swapped .work > .xsplit, .app.swapped .work > .xwin { order: 5; }
@media (max-width: 1100px) { .xsplit { display: none !important; } }
/* while a tab is dragged, no window's content (an iframe) swallows the drag: every strip and "New window" can take the drop */
body.tab-dragging iframe { pointer-events: none; }

/* ---- maths in messages (KaTeX draws .math; until then, or without it, the TeX shows as quiet monospace) */
.md .math { font-family: var(--mono, ui-monospace, monospace); font-size: .95em; color: var(--text); }
.md .math[data-done] { font-family: inherit; font-size: inherit; }
.md .math-d { display: block; margin: 10px 0; padding: 6px 0; overflow-x: auto; overflow-y: hidden; text-align: center; }
.md .math-d .katex-display { margin: 0; }
.md .math.math-raw { padding: 1px 5px; border-radius: 5px; background: var(--hover); }
.md .katex { font-size: 1.08em; }

/* ---- Quick Access: each app is its icon (same size as before) over a very small name; + at the end opens every app */
#modeSeg.app-icons { flex-wrap: nowrap; justify-content: space-between; align-items: stretch; gap: 1px; padding: 3px; }
#modeSeg.app-icons .app-ic { flex: 1 1 0; min-width: 0; max-width: 40px; width: auto; height: auto; padding: 6px 0 4px; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; text-decoration: none; }
#modeSeg.app-icons .app-ic svg { width: 17px; height: 17px; flex: none; }
#modeSeg.app-icons .ai-n { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 500 8.5px/1.1 var(--sans); letter-spacing: -.01em; color: var(--muted); transition: color .12s; }
#modeSeg.app-icons .app-ic:hover .ai-n, #modeSeg.app-icons .app-ic:focus-visible .ai-n { color: var(--text-2); }
#modeSeg.app-icons .app-add { color: var(--muted); }
#modeSeg.app-icons .app-add svg { stroke-width: 2; }
#modeSeg.app-icons .app-add:hover { color: var(--accent); }
/* Quick Access as a grid: two rows of four (seven apps and +), each icon over its name */
#modeSeg.app-icons { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: auto; gap: 2px; padding: 4px; }
#modeSeg.app-icons .app-ic { max-width: none; width: auto; padding: 7px 2px 5px; gap: 4px; }
#modeSeg.app-icons .ai-n { font-size: 9.5px; letter-spacing: 0; }
#modeSeg.app-icons .app-ic:nth-child(4n+1)[data-tip]::after { left: 0; transform: translate(0, -2px); } #modeSeg.app-icons .app-ic:nth-child(4n+1):hover::after { transform: none; }
#modeSeg.app-icons .app-ic:nth-child(4n)[data-tip]::after { left: auto; right: 0; transform: translate(0, -2px); } #modeSeg.app-icons .app-ic:nth-child(4n):hover::after { transform: none; }

/* ---- sidebar sections that fold away: the header is a button with a chevron; a folded section shows how many it holds */
.sidebar .sect { display: inline-flex; align-items: center; gap: 4px; min-width: 0; margin: 0 0 0 -4px; padding: 2px 6px 2px 4px; border: 0; border-radius: 6px; background: none;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; transition: background .12s, color .12s; }
.sidebar .sect:hover, .sidebar .sect:focus-visible { background: var(--hover); color: var(--text-2); outline: none; }
.sidebar .sect-chev { width: 11px; height: 11px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.sidebar .sect[aria-expanded="false"] .sect-chev { transform: rotate(-90deg); }
.sidebar .sect-n { margin-left: 2px; padding: 0 5px; border-radius: 8px; background: var(--hover); font-style: normal; font-weight: 600; font-size: 9.5px; letter-spacing: 0; line-height: 15px; color: var(--muted); }
.sidebar .side-label.sect { display: flex; width: calc(100% - 4px); margin: 0 0 0 2px; justify-content: flex-start; }
.sidebar .side-label.sect span { flex: none; }
#modeSeg.app-icons.sect-shut { display: none !important; }
.pin-zone .sect-row { padding-top: 10px; }
@media (prefers-reduced-motion: reduce) { .sidebar .sect-chev { transition: none; } }
/* the Quick Access header matches the other section headers (PROJECTS, WORKSPACES) */
.sidebar .side-label.sect { width: auto; margin: 12px 0 2px 4px; padding: 2px 6px 2px 4px; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.sidebar .side-label.sect:hover, .sidebar .side-label.sect:focus-visible { color: var(--text-2); }
/* Pinned is always listed: empty, it is a quiet hint; the dashed drop outline appears only while an item is dragged */
.pin-zone.empty:not(.dragging) { border: 0; padding-bottom: 0; margin-top: 0; }
.pin-zone.empty:not(.dragging) .sect-row { padding-top: 16px; }
.pin-zone.empty .empty-list { padding-top: 2px; }
/* the Usage window's Upgrade plan link (was a disabled Add credit button) */
a.btn-credit { cursor: pointer; text-decoration: none; background: var(--accent); border-color: transparent; color: #fff; }
a.btn-credit:hover { filter: brightness(1.08); }
.menu.account [data-plan] { color: var(--accent); font-style: normal; font-weight: 600; }

/* ---- tab overflow (tabflow.js): tabs that do not fit fold into "+N"; it lists every tab of the window */
.ptab.tf-hide, .tab-sep.tf-hide { display: none !important; }
.tab-more { display: inline-flex; align-items: center; gap: 2px; flex: none; align-self: center; height: 24px; padding: 0 6px 0 7px; margin-left: 2px; border: 1px solid var(--line-2);
  border-radius: 7px; background: var(--raise); color: var(--text-2); font: 600 11px var(--sans); cursor: pointer; }
.tab-more:hover, .tab-more[aria-expanded="true"] { background: var(--hover); color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, var(--line-2)); }
.tab-more svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tf-menu { min-width: 260px; max-width: 340px; max-height: min(60vh, 460px); overflow-y: auto; padding: 6px; }
.tf-menu.tf-dragging { visibility: hidden; pointer-events: none; }
.tf-search { width: 100%; box-sizing: border-box; height: 30px; margin: 0 0 6px; padding: 0 9px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--bg); color: var(--text); font: 12.5px var(--sans); outline: none; }
.tf-search:focus { border-color: var(--accent); }
.tf-row { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 4px 0 8px; border-radius: 7px; cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.tf-row:hover, .tf-row:focus-visible { background: var(--hover); color: var(--text); outline: none; }
.tf-row.on { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text); font-weight: 600; }
.tf-row.folded .tf-t::after { content: ""; }
.tf-row[draggable="true"] { cursor: grab; }
.tf-ic { display: grid; place-items: center; flex: none; width: 16px; color: var(--muted); }
.tf-row.on .tf-ic { color: var(--accent); }
.tf-ic svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tf-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-x { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; opacity: .7; }
.tf-x:hover { background: var(--active); color: var(--text); opacity: 1; }
.tf-x svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.tf-ctx { min-width: 200px; }
.tf-ctx button[disabled] { opacity: .45; cursor: default; }
.app.embed .tab-more { display: none !important; }
/* a tab you are not on shows its × only on hover, so its name gets the room (the open tab always shows it) */
.chat-head .ptabs > .ptab:not(.on):not(:hover):not(:focus-within) .tx, .modepane .ptabs > .ptab:not(.on):not(:hover):not(:focus-within) .tx { display: none; }
.chat-head .ptabs > .ptab[data-chat]:not(.on) { min-width: 110px !important; }   /* the workspace chat keeps more of its name */

/* ---- storage: one total per account (all workspaces and Drive files), shown in the account menu and the Usage window */
.usage-store { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.usage-store .us-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13px; color: var(--text-2); }
.usage-store .us-h b { font-weight: 600; color: var(--text); }
.menu.account [data-st] { font-style: normal; }
.menu.account [data-st].hot { color: #e0625e; font-weight: 600; }

/* ---- the plan beside the name (sidebar foot), and Upgrade on Free */
.me .me-t { display: flex; align-items: center; gap: 6px; min-width: 0; }
.me .me-t b { min-width: 0; }
.me-plan { flex: none; padding: 1px 6px; border-radius: 99px; font-size: 9.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; line-height: 14px;
  color: var(--muted); border: 1px solid var(--line-2); background: transparent; }
.me-plan[data-plan="lite"] { color: var(--text-2); border-color: color-mix(in srgb, var(--accent) 35%, var(--line-2)); }
.me-plan[data-plan="pro"], .me-plan[data-plan="max"], .me-plan[data-plan="ultra"] { color: #fff; border-color: transparent; background: var(--accent); }
.me-plan[data-plan="ultra"] { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #7b5cff)); }
.me-up { flex: none; display: inline-flex; align-items: center; height: 24px; padding: 0 10px; margin-left: 4px; border-radius: 99px; background: var(--accent); color: #fff;
  font-size: 11.5px; font-weight: 600; text-decoration: none; transition: filter .12s; }
.me-up:hover { filter: brightness(1.08); }
.me-up[hidden], .me-plan[hidden] { display: none; }
/* one row at the foot of the sidebar: avatar, name, plan, (Upgrade) */
.side-foot { flex-wrap: nowrap !important; }
.side-foot button.me { flex: 1 1 auto; min-width: 0; }
.side-foot .me .me-t { flex-direction: row !important; align-items: center !important; justify-content: flex-start; text-align: left; gap: 6px; min-width: 0; flex: 0 1 auto; }
.side-foot .me .me-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .me-up { margin-left: 2px; }
.side-foot { display: flex !important; align-items: center; gap: 6px; }
.side-foot button.me { width: auto !important; }
.side-foot .me-up { height: 40px; padding: 0 12px; border-radius: 10px; margin-left: 0; }
.side-foot .me-up { height: 32px; padding: 0 9px; border-radius: 9px; font-size: 11px; }
.side-foot:has(.me-up:not([hidden])) .me .chev { display: none; }     /* on Free the arrow gives its room to the name */
.side-foot .me-plan { padding: 0 5px; font-size: 9px; }

/* Upgrade (Free only): a quiet outlined button that matches the account card; colour only on its arrow, and on hover */
.side-foot .me-up { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px 0 8px; border-radius: 9px;
  border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font: 500 11.5px var(--sans); letter-spacing: .01em;
  box-shadow: none; filter: none; transition: border-color .15s, color .15s, background .15s; }
.side-foot .me-up svg { width: 13px; height: 13px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.side-foot .me-up:hover, .side-foot .me-up:focus-visible { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2)); color: var(--text);
  background: color-mix(in srgb, var(--accent) 6%, transparent); filter: none; outline: none; }
.side-foot .me-plan[data-plan="free"] { color: var(--muted); border-color: var(--line-2); background: transparent; }

/* the account card: name on top, the plan in small text beneath it; Upgrade (Free) beside the card */
.side-foot button.me { height: 40px !important; }
.side-foot .me .me-t { flex-direction: column !important; align-items: flex-start !important; justify-content: center; gap: 1px; }
.side-foot .me .me-t b { max-width: 100%; line-height: 1.2; }
.side-foot .me-plan, .side-foot .me-plan[data-plan] { padding: 0; border: 0; border-radius: 0; background: none !important; text-transform: none; letter-spacing: 0;
  font-size: 10.5px; font-weight: 500; line-height: 1.2; color: var(--muted); }
.side-foot .me-plan[data-plan="lite"], .side-foot .me-plan[data-plan="pro"], .side-foot .me-plan[data-plan="max"], .side-foot .me-plan[data-plan="ultra"] { color: var(--accent); font-weight: 600; }
.side-foot .me-up { height: 40px; padding: 0 11px 0 9px; border-radius: 10px; }
.side-foot .me-up[hidden] { display: none !important; }      /* paid plans: no Upgrade (this beats the button's own display) */
/* Upgrade (Free only), final: a compact soft pill; a light wash of the accent, no border, sits centred beside the account card */
.side-foot .me-up { align-self: center; height: 26px; padding: 0 9px 0 7px; gap: 3px; border: 0; border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); font: 600 11px var(--sans); letter-spacing: .01em; }
.side-foot .me-up svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.2; }
.side-foot .me-up:hover, .side-foot .me-up:focus-visible { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); border: 0; }
.side-foot .me-up:active { transform: scale(.97); }
/* the user section: a thin, quiet border around the account card */
.side-foot button.me { border: 1px solid var(--line-2) !important; border-radius: 10px !important; background: var(--raise) !important; transition: border-color .15s, background .15s; }
.side-foot button.me:hover { border-color: color-mix(in srgb, var(--muted) 45%, var(--line-2)) !important; }
.side-foot button.me[aria-expanded="true"] { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2)) !important; }

/* the user section, final: one compact line, the plan as a pill after the name (Free and paid), Upgrade beside it on Free */
.side-foot button.me { height: 36px !important; gap: 7px; padding: 0 7px 0 6px !important; }
.side-foot .me .me-t { flex-direction: row !important; align-items: center !important; gap: 5px; min-width: 0; flex: 0 1 auto; }
.side-foot .me .me-t b { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.side-foot .me-plan, .side-foot .me-plan[data-plan] { flex: none; padding: 0 5px; border-radius: 99px; font-size: 9px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; line-height: 15px; border: 1px solid transparent; }
.side-foot .me-plan[data-plan="free"] { color: var(--muted); border-color: var(--line-2); background: none !important; }
.side-foot .me-plan[data-plan="lite"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); background: none !important; }
.side-foot .me-plan[data-plan="pro"], .side-foot .me-plan[data-plan="max"] { color: #fff; background: var(--accent) !important; }
.side-foot .me-plan[data-plan="ultra"] { color: #fff; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #7b5cff)) !important; }
.side-foot .me-up { height: 26px; padding: 0 8px 0 6px; }
/* a few pixels back for the name when Upgrade sits beside the card */
.side-foot { gap: 5px !important; }
.side-foot button.me { gap: 6px !important; padding: 0 6px 0 5px !important; }
.side-foot .avatar { width: 19px !important; height: 19px !important; }
.side-foot .me .me-t { gap: 4px !important; }
.side-foot .me-plan, .side-foot .me-plan[data-plan] { padding: 0 4px !important; }
.side-foot .me-up { padding: 0 7px 0 5px !important; gap: 2px !important; }
/* the menu chevron shows on every plan (it tells you the card opens a menu); on Free it is a touch smaller to leave room for the name */
.side-foot:has(.me-up:not([hidden])) .me .chev { display: block !important; width: 11px !important; height: 11px !important; margin-left: 1px; }
.side-foot:has(.me-up:not([hidden])) .me-up { font-size: 10.5px; padding: 0 6px 0 4px !important; }
.side-foot:has(.me-up:not([hidden])) .me-up svg { width: 11px; height: 11px; }
.side-foot:has(.me-up:not([hidden])) { gap: 4px !important; }
.side-foot:has(.me-up:not([hidden])) button.me { gap: 5px !important; padding: 0 5px 0 4px !important; }
.side-foot:has(.me-up:not([hidden])) .me .me-t { gap: 3px !important; }
.side-foot:has(.me-up:not([hidden])) .me .me-t b { font-size: 12px !important; }
.side-foot:has(.me-up:not([hidden])) .me-plan { letter-spacing: .02em !important; }
.side-foot:has(.me-up:not([hidden])) .me .chev { margin-left: 0 !important; }

/* a hairline between the name and the plan pill (shown only once the plan is known) */
.side-foot .me-sep { flex: none; width: 1px; height: 11px; background: var(--line-2); display: none; }
.side-foot .me-t:has(.me-plan:not([hidden])) .me-sep { display: block; }
/* the room it takes on the Free line comes back from the paddings there */
.side-foot:has(.me-up:not([hidden])) { gap: 3px !important; }
.side-foot:has(.me-up:not([hidden])) .me-plan { padding: 0 3px !important; }
.side-foot:has(.me-up:not([hidden])) .me-up { padding: 0 5px 0 3px !important; }

/* ---- the user section, final layout: on Free a slim Upgrade row sits above the card; the card is one clean line on every plan */
.side-foot { flex-direction: column !important; align-items: stretch !important; gap: 4px !important; }
.side-foot button.me { width: 100% !important; gap: 7px !important; padding: 0 8px 0 6px !important; }
.side-foot .avatar { width: 20px !important; height: 20px !important; }
.side-foot .me .me-t { gap: 6px !important; }
.side-foot .me .me-t b { font-size: 12.5px !important; }
.side-foot .me-plan, .side-foot .me-plan[data-plan] { padding: 0 5px !important; letter-spacing: .05em !important; }
.side-foot .me .chev { display: block !important; width: 13px !important; height: 13px !important; margin-left: auto !important; }
.side-foot .me-sep { display: none !important; }
.me-upsell { order: -1; display: flex; align-items: center; gap: 5px; height: 26px; padding: 0 6px 0 7px; border-radius: 8px; color: var(--accent);
  font-size: 11.5px; text-decoration: none; min-width: 0; transition: background .15s; }
.me-upsell[hidden] { display: none; }
.me-upsell b { font-weight: 600; flex: none; }
.me-upsell span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.me-upsell span::before { content: "·"; margin-right: 5px; color: var(--muted); }
.me-upsell svg { flex: none; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.me-upsell .up { width: 13px; height: 13px; stroke-width: 2.2; }
.me-upsell .go { width: 12px; height: 12px; stroke-width: 2; margin-left: auto; color: var(--muted); transition: transform .15s, color .15s; }
.me-upsell:hover, .me-upsell:focus-visible { background: color-mix(in srgb, var(--accent) 9%, transparent); outline: none; }
.me-upsell:hover .go { color: var(--accent); transform: translateX(2px); }
@media (prefers-reduced-motion: reduce) { .me-upsell .go { transition: none; } }

/* ---- AI usage: a rolling 5-hour window and a weekly limit (Sunday 00:00 IST), each with its own meter */
.usage-row { margin-bottom: 14px; }
.usage-row[hidden] { display: none; }
.usage-row .us-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13px; color: var(--text-2); }
.usage-row .us-h b { font-weight: 600; color: var(--text); }
.usage-row .usage-note { margin-top: 6px; }

/* ---- the Usage window: compact rows (label and reset time · a thin bar · how much is used) */
.modal.usage-modal { width: min(480px, 100%); padding: 18px 20px 16px; border-radius: 14px; }
.um-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.um-h h2 { margin: 0; font-size: 15px; font-weight: 650; }
.um-h .icon-btn { margin-left: auto; }
.um-h .icon-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.um-plan { padding: 1px 7px; border-radius: 99px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; line-height: 16px; color: var(--muted); border: 1px solid var(--line-2); }
.um-plan[data-plan="pro"], .um-plan[data-plan="max"] { color: #fff; border-color: transparent; background: var(--accent); }
.um-plan[data-plan="ultra"] { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #7b5cff)); }
.um-plan[data-plan="lite"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
.um-plan:empty { display: none; }
.um-alert { margin: 8px 0 4px; padding: 9px 11px; border-radius: 9px; font-size: 12.5px; line-height: 1.45; color: var(--text);
  background: color-mix(in srgb, var(--accent) 9%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.um-alert[hidden] { display: none; }
.um-rows { margin-top: 6px; border-top: 1px solid var(--line); }
.um-row { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.um-row[hidden] { display: none; }
.um-l { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.um-l b { font-size: 13px; font-weight: 600; color: var(--text); }
.um-l small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-bar { height: 5px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.um-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.um-bar.hot i { background: #e0625e; }
.um-v { min-width: 72px; text-align: right; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.um-free { margin: 12px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.um-free[hidden] { display: none; }
.um-f { display: flex; justify-content: flex-end; margin-top: 14px; }
.um-up { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 600; text-decoration: none; }
.um-up:hover { filter: brightness(1.08); }
.um-up[hidden] { display: none; }
@media (max-width: 520px) {
  .um-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .um-bar { grid-column: 1 / -1; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) { .um-bar i { transition: none; } }

/* ---- Free, near or at a limit: a small card under the top bar */
.usage-nudge { position: fixed; top: 52px; right: 16px; z-index: 80; display: flex; align-items: center; gap: 10px; max-width: min(420px, calc(100vw - 32px));
  padding: 10px 10px 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--raise); box-shadow: var(--sh-lg);
  animation: unIn .25s cubic-bezier(.2, .8, .2, 1); }
@keyframes unIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.un-ic { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); }
.usage-nudge.full .un-ic { background: color-mix(in srgb, #e0625e 15%, transparent); color: #e0625e; }
.un-ic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.un-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.un-t b { font-size: 12.5px; font-weight: 600; color: var(--text); }
.un-t span { font-size: 11.5px; color: var(--muted); }
.un-up { flex: none; display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; text-decoration: none; }
.un-up:hover { filter: brightness(1.08); }
.un-x { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.un-x:hover { background: var(--hover); color: var(--text); }
.un-x svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
@media (max-width: 600px) { .usage-nudge { left: 12px; right: 12px; max-width: none; } }
@media (prefers-reduced-motion: reduce) { .usage-nudge { animation: none; } }

/* ---- Usage: a light panel from the account card (quiet type, hairline bars, a heads-up only when it matters) */
.usage-pop { position: fixed; z-index: 85; width: min(360px, calc(100vw - 16px)); padding: 14px 16px 12px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--raise); box-shadow: var(--sh-lg); animation: upIn .18s cubic-bezier(.2, .8, .2, 1); }
@keyframes upIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.up-h { display: flex; align-items: baseline; gap: 8px; }
.up-h h2 { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--text); }
.up-plan { font-size: 12px; color: var(--muted); }
.up-x { margin-left: auto; align-self: center; display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.up-x:hover { background: var(--hover); color: var(--text); }
.up-x svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.up-alert { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.up-alert[hidden] { display: none; }
.up-alert p { margin: 0; flex: 1; font-size: 12.5px; font-weight: 600; line-height: 1.4; color: var(--text); }
.up-btn { flex: none; display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 7px; background: var(--text); color: var(--bg);
  font-size: 11.5px; font-weight: 600; text-decoration: none; }
.up-btn:hover { opacity: .9; }
.up-btn[hidden] { display: none; }
.up-sec { margin-top: 10px; padding-top: 4px; border-top: 1px solid var(--line); }
.up-sec[hidden] { display: none; }
.up-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) 70px; align-items: center; gap: 12px; padding: 7px 0; }
.up-l { display: flex; flex-direction: column; min-width: 0; }
.up-l span { font-size: 12.5px; color: var(--text); }
.up-l small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-bar { height: 4px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.up-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent); transition: width .45s cubic-bezier(.2, .8, .2, 1); }
.up-bar.hot i { background: #e0625e; }
.up-v { text-align: right; font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.up-free { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.45; color: var(--text-2); }
.up-free[hidden] { display: none; }
.up-link { margin-top: 8px; display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 500; color: var(--accent); text-decoration: none; }
.up-link:hover { text-decoration: underline; }
.up-link[hidden] { display: none; }
.up-link svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { .usage-pop { animation: none; } .up-bar i { transition: none; } }

.up-row { grid-template-columns: minmax(0, 1fr) 96px auto; }
.up-v { min-width: 58px; }
