/* Mensarium: black frame, inset plum-lit panel, rendered glass orb as the agent's face.
   Dark is the product's own look and the default; [data-theme="light"] repaints the same tokens on paper.
   Everything theme-dependent lives in the two :root blocks below: surfaces, the ink overlays hairlines and
   hovers are mixed from, shadows, and the few gradients that assume a dark ground. Other palettes (theme.js)
   override the same tokens from a <style id="palette"> that index.html adds before the first paint. */

@font-face {
  font-family: "Onest";
  src: url("fonts/onest-cyrillic.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest";
  src: url("fonts/onest-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --frame: #050506;
  --panel: #0e0b10;
  --surface: #16141c;
  --surface-2: #1e1b26;
  --surface-3: #27232f;
  /* ink: what hairlines, hovers and dot grids are mixed from — light over a dark ground, dark over a light one */
  --ink: 255, 255, 255;
  --card: 22, 20, 28;
  --card-hi: 28, 25, 36;
  --veil: 14, 11, 16;
  --line: rgba(var(--ink), 0.075);
  --line-strong: rgba(var(--ink), 0.14);
  --text: #f3f1f7;
  --text-2: #cbc6d6;
  --muted: #8f8a9b;
  --faint: #6c6778;

  --accent: #a47bff;
  --accent-strong: #bb9cff;
  --accent-soft: rgba(164, 123, 255, 0.14);
  --accent-line: rgba(164, 123, 255, 0.45);
  --accent-btn: #7445f0;
  --accent-btn-hover: #8157f5;
  --accent-fg: #fff;
  --select: rgba(164, 123, 255, 0.35);
  --select-fg: #fff;

  --ok: #5ad49a;
  --warn: #f2b867;
  --orange: #f59a5b;
  --danger: #f47c7c;
  --danger-soft: rgba(244, 124, 124, 0.12);
  --warn-soft: rgba(242, 184, 103, 0.12);
  --add-soft: rgba(90, 212, 154, 0.1);
  --del-soft: rgba(244, 124, 124, 0.1);

  /* the plum haze lighting the panel from above, the memory field and the login page */
  --haze-panel:
    radial-gradient(90% 70% at 60% -18%, rgba(150, 85, 160, 0.17), rgba(150, 85, 160, 0.05) 50%, transparent 80%),
    radial-gradient(55% 40% at 0% 0%, rgba(90, 45, 140, 0.07), transparent 70%);
  --haze-stage: radial-gradient(55% 55% at 50% 52%, rgba(150, 85, 160, 0.15), rgba(150, 85, 160, 0.03) 55%, transparent 80%);
  --haze-login: radial-gradient(60% 55% at 50% -8%, rgba(150, 85, 160, 0.16), rgba(150, 85, 160, 0.04) 50%, transparent 80%);
  --hub-fill: linear-gradient(180deg, #1c1824, #141219);
  --cross-near: rgba(187, 156, 255, 0.75);
  --wedge: 0.05;

  --font: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --pop: 0 24px 60px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--line-strong);
  --shadow-md: 0 20px 40px -24px rgba(0, 0, 0, 0.8);
  --shadow-tile: 0 12px 26px -16px rgba(0, 0, 0, 0.95);
  --sidebar-w: 252px;
  --chat-w: 720px;
  --gutter: 44px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

/* Light: the same room by day — paper frame, white panel under a thinner haze, ink turned dark.
   Accents darken so violet on white keeps the contrast violet had on black. Set by index.html before first paint. */
:root[data-theme="light"] {
  --frame: #eeebf3;
  --panel: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f0f7;
  --surface-3: #ded9e8;
  --ink: 26, 20, 40;
  --card: 243, 241, 249;
  --card-hi: 234, 230, 244;
  --veil: 255, 255, 255;
  --line: rgba(var(--ink), 0.1);
  --line-strong: rgba(var(--ink), 0.16);
  --text: #17141f;
  --text-2: #433d52;
  --muted: #6d6780;
  --faint: #938da4;

  --accent: #7445f0;
  --accent-strong: #6231dc;
  --accent-soft: rgba(116, 69, 240, 0.1);
  --accent-line: rgba(116, 69, 240, 0.4);
  --accent-btn: #7445f0;
  --accent-btn-hover: #6636e2;
  --select: rgba(164, 123, 255, 0.3);
  --select-fg: #17141f;

  --ok: #12855f;
  --warn: #96681a;
  --orange: #b2571c;
  --danger: #c63f3f;
  --danger-soft: rgba(198, 63, 63, 0.1);
  --warn-soft: rgba(150, 104, 26, 0.12);
  --add-soft: rgba(18, 133, 95, 0.12);
  --del-soft: rgba(198, 63, 63, 0.1);

  --haze-panel:
    radial-gradient(90% 70% at 60% -18%, rgba(150, 85, 160, 0.09), rgba(150, 85, 160, 0.03) 50%, transparent 80%),
    radial-gradient(55% 40% at 0% 0%, rgba(90, 45, 140, 0.04), transparent 70%);
  --haze-stage: radial-gradient(55% 55% at 50% 52%, rgba(150, 85, 160, 0.08), rgba(150, 85, 160, 0.02) 55%, transparent 80%);
  --haze-login: radial-gradient(60% 55% at 50% -8%, rgba(150, 85, 160, 0.1), rgba(150, 85, 160, 0.03) 50%, transparent 80%);
  --hub-fill: linear-gradient(180deg, #ffffff, #f5f2fc);
  --cross-near: rgba(116, 69, 240, 0.5);
  --wedge: 0.07;

  --pop: 0 24px 60px -18px rgba(26, 20, 40, 0.3), 0 0 0 1px var(--line-strong);
  --shadow-md: 0 20px 40px -26px rgba(26, 20, 40, 0.45);
  --shadow-tile: 0 12px 26px -18px rgba(26, 20, 40, 0.45);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--frame);
  color: var(--text);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent);
  scrollbar-color: var(--surface-3) transparent;
}
#app { height: 100%; }
a { color: var(--accent-strong); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
::selection { background: var(--select); color: var(--select-fg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
h1, h2, h3 { text-wrap: balance; }

/* ---------- orb: the agent's face, a particle sphere drawn by orb.js ---------- */

.orb { display: block; flex: none; width: var(--s); height: var(--s); }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 32px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: rgba(var(--ink), 0.2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { border-color: transparent; color: var(--accent-fg); background: var(--accent-btn); }
.btn-primary:hover:not(:disabled) { background: var(--accent-btn-hover); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: rgba(244, 124, 124, 0.3); }
.btn-danger-solid { background: #d94f4f; border-color: transparent; color: #fff; }
.btn-danger-solid:hover:not(:disabled) { background: #e25c5c; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: transparent; border: 0; color: var(--muted); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="time"], input[type="datetime-local"], textarea {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r); padding: 10px 14px; font: 14px var(--font);
}
select {
  height: 34px; padding: 0 32px 0 11px; border-radius: var(--r); border: 1px solid var(--line-strong); color: var(--text);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f8a9b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center / 15px;
  font: 13.5px var(--font); appearance: none; cursor: pointer;
}
select:focus { outline: none; border-color: var(--accent-line); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus { outline: none; border-color: var(--accent-line); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.danger { background: var(--danger); }
.dot.accent { background: var(--accent); }
.dot.live { animation: dot 1.5s ease-in-out infinite; }
@keyframes dot { 50% { opacity: 0.35; } }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2); white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line-strong);
}
.pill.accent { color: var(--accent-strong); border-color: var(--accent-line); background: var(--accent-soft); }
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); border-color: rgba(242, 184, 103, 0.35); background: var(--warn-soft); }
.pill.orange { color: var(--orange); border-color: rgba(245, 154, 91, 0.35); }
.pill.danger { color: var(--danger); border-color: rgba(244, 124, 124, 0.35); background: var(--danger-soft); }
.pill.tag { font: 12px var(--mono); height: 22px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 20px; }

/* ---------- frame ---------- */

.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100%; transition: grid-template-columns 0.25s var(--ease); }
.shell.collapsed { grid-template-columns: 0 1fr; }
.shell.collapsed .sidebar { visibility: hidden; }

.sidebar { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; background: var(--frame); }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 12px 14px 18px; }
.brand-name { flex: 1; font-weight: 600; font-size: 15px; letter-spacing: -0.015em; }
.nav-head { display: flex; align-items: center; margin: 10px 12px 2px; }
.nav-section {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px;
  background: none; border: 0; cursor: pointer; color: var(--muted); font: 12.5px var(--font); text-align: left;
}
.nav-section:hover { color: var(--text-2); }
.nav-section .icon { width: 13px; height: 13px; transition: transform 0.2s var(--ease); }
.nav-section[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.nav-head:has(> [aria-expanded="false"]) + * { display: none; }
.nav-add { width: 26px; height: 26px; margin-right: 3px; }
.nav-add .icon { width: 15px; height: 15px; }
.nav-add.active { color: var(--accent-strong); }

.device-badge {
  position: relative; flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px;
  background: hsl(var(--hue) 65% 60% / 0.22); color: hsl(var(--hue) 90% 80%); font: 600 11px/1 var(--font);
}
.device-badge.off { background: hsl(var(--hue) 30% 50% / 0.1); color: hsl(var(--hue) 30% 70% / 0.5); }
/* the badge picks its hue per device, so light needs the lightness turned around rather than another token */
:root[data-theme="light"] .device-badge { background: hsl(var(--hue) 60% 52% / 0.16); color: hsl(var(--hue) 62% 34%); }
:root[data-theme="light"] .device-badge.off { background: hsl(var(--hue) 15% 45% / 0.12); color: hsl(var(--hue) 12% 40% / 0.6); }
.device-badge .dot { position: absolute; right: -3px; bottom: -3px; width: 8px; height: 8px; box-shadow: 0 0 0 2px var(--frame); }
.session:hover .device-badge .dot, .session.active .device-badge .dot,
.project-head:hover .device-badge .dot, .project-head.active .device-badge .dot { box-shadow: 0 0 0 2px var(--surface); }

.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 11px; border-radius: 9px;
  border: 1px solid transparent; background: none; color: var(--text-2);
  font: 13.5px var(--font); cursor: pointer; text-align: left; text-decoration: none;
}
.nav-item .icon { color: var(--muted); }
.nav-item:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.nav-item.active .icon { color: var(--accent-strong); }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }

.sessions { flex: 1; min-height: 0; overflow-y: auto; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 1px; }
.session {
  display: flex; align-items: center; gap: 9px; min-width: 0; padding: 6px 8px 6px 11px; border-radius: 9px;
  border: 1px solid transparent; color: var(--text-2); font-size: 13.5px; cursor: pointer; text-decoration: none;
}
.session:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.session.active { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.session-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-del { width: 26px; height: 26px; margin: -5px -2px -5px 0; display: none; }
.session-del .icon { width: 15px; height: 15px; }
.session-del:hover:not(:disabled) { color: var(--danger); background: var(--danger-soft); }
.session:hover .session-del, .session:focus-within .session-del { display: inline-grid; }
.sessions-empty { padding: 8px 12px; color: var(--muted); font-size: 13px; }
.sidebar-foot { margin-top: auto; padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.nav-automations { width: auto; margin: 0 12px 6px; }
.projects { flex: none; max-height: 40vh; overflow-y: auto; padding: 0 12px 6px; display: flex; flex-direction: column; gap: 1px; }
.projects:empty { display: none; }
.project-head { display: flex; align-items: center; border-radius: 9px; border: 1px solid transparent; }
.project-head:hover { background: var(--surface); }
.project-head.active { background: var(--surface); border-color: var(--line-strong); }
.project-link {
  flex: 1; display: flex; align-items: center; gap: 9px; min-width: 0; padding: 6px 8px 6px 11px;
  color: var(--text-2); font-size: 13.5px; text-decoration: none;
}
.project-link:hover, .project-head.active .project-link { color: var(--text); text-decoration: none; }
.session-add { width: 26px; height: 26px; margin-right: 3px; display: none; }
.session-add .icon { width: 15px; height: 15px; }
.project-head:hover .session-add, .project-head:focus-within .session-add { display: inline-grid; }

.main { min-width: 0; min-height: 0; height: 100%; padding: 10px 10px 10px 0; }
.shell.collapsed .main { padding-left: 10px; }
.panel {
  position: relative; height: 100%; display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  border-radius: var(--r-xl); border: 1px solid var(--line);
  background: var(--haze-panel), var(--panel);
}

.topbar { display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 8px 14px; flex: none; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 13.5px; }
.crumbs .icon { width: 16px; height: 16px; }
.crumbs .sep { color: var(--faint); }
.crumb-device { display: inline-flex; align-items: center; gap: 8px; flex: none; }
a.crumb-device { color: inherit; }
a.crumb-device:hover { color: var(--text); text-decoration: none; }
.crumbs .current { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.topbar-actions .pill { margin-right: 6px; }
.open-nav { display: none; }
.shell.collapsed .open-nav { display: inline-grid; }

/* ---------- chat ---------- */

.project-layout { flex: 1; min-height: 0; display: flex; }
.project-layout-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.project-chats { flex: none; width: 250px; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.project-chats-head { display: flex; align-items: center; gap: 4px; min-height: 50px; padding: 8px 12px 8px 14px; }
.project-chats-name {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  color: var(--text); font-size: 13.5px; font-weight: 500; text-decoration: none;
}
.project-chats-name:hover { text-decoration: none; color: var(--accent-strong); }
.project-chats-name .icon { flex: none; width: 16px; height: 16px; color: var(--muted); }
.project-chats-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* thread and composer share one column: same width, same gutter, so every edge lines up with the input */
.thread { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-anchor: none; scrollbar-gutter: stable both-edges; }
.thread-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; container-type: inline-size; }
.thread-nav { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); z-index: 3; }
.thread-nav[hidden] { display: none; }
.thread-nav-rail { position: relative; display: flex; flex-direction: column; max-height: min(60vh, 520px); overflow-y: auto; scrollbar-width: none; }
.thread-nav-rail::-webkit-scrollbar { display: none; }
.thread-nav-tick { --grow: 0; --base: 10px; flex: none; display: flex; align-items: center; width: 40px; height: 11px; padding: 0; border: 0; background: none; cursor: pointer; }
.thread-nav-tick::before {
  content: ""; width: calc(var(--base) + var(--grow) * (36px - var(--base))); height: 2px; border-radius: 1px;
  background: var(--line-strong); transition: width 0.18s var(--ease), background 0.15s;
}
.thread-nav-tick.user { --base: 15px; }
.thread-nav-tick.user::before { background: var(--faint); }
.thread-nav-tick:focus-visible { --grow: 0.6; }
.thread-nav-tick:hover::before, .thread-nav-tick:focus-visible::before { background: var(--text-2); }
.thread-nav-tick.active::before { background: var(--text); }
.thread-nav-tick:focus-visible { outline: none; }
.thread-nav-tip {
  position: absolute; left: 48px; width: 260px; transform: translateY(-50%); pointer-events: none;
  padding: 9px 12px; border-radius: var(--r); background: var(--surface-2); box-shadow: var(--pop); font-size: 13px;
}
.thread-nav-tip[hidden] { display: none; }
.thread-nav-tip-label { margin-bottom: 3px; font-size: 12px; font-weight: 500; color: var(--muted); }
.thread-nav-tip-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); }
@container (max-width: 900px) { .thread-nav { display: none; } }
.thread-more { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 0 14px; color: var(--muted); font-size: 12.5px; }
.thread-more > .spinner { width: 13px; height: 13px; }
.thread-more[hidden] { display: none; }
.chat-split { flex: 1; min-height: 0; display: flex; position: relative; }
.chat-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.changes-btn { display: inline-flex; gap: 7px; width: auto; min-width: 30px; padding: 0 7px; }
.changes-btn.active { background: var(--surface-2); color: var(--text); }
.pill.tag.branch-pill { display: inline-flex; align-items: center; gap: 5px; max-width: 220px; }
.branch-pill span { overflow: hidden; text-overflow: ellipsis; }
.branch-pill .icon { width: 13px; height: 13px; flex: none; }
.row-value .change-stat { margin-right: 12px; }
.changes { width: 340px; flex: none; display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); }
.changes-head { display: flex; align-items: center; gap: 2px; padding: 4px 8px 0 16px; }
.changes-head h2 { flex: 1; margin: 0; font-size: 14px; font-weight: 600; }
.changes-sum { display: flex; gap: 8px; min-height: 18px; padding: 0 16px 8px; font-size: 12.5px; color: var(--muted); }
.changes-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 12px; }
.changes-empty { padding: 14px 8px; color: var(--muted); font-size: 13px; }
.changes-group { padding: 12px 8px 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.changes-group:first-child { padding-top: 4px; }
.change-commit { display: flex; gap: 8px; min-width: 0; padding: 3px 8px; font-size: 13px; color: var(--text-2); }
.change-commit code { flex: none; font: 12px var(--mono); color: var(--muted); }
.change-commit span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.change-row {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 5px 8px; border: 0; border-radius: var(--r);
  background: none; color: var(--text); font: 13px var(--font); text-align: left; cursor: pointer;
}
.change-row:hover { background: var(--surface-2); }
.change-st { width: 14px; flex: none; font: 600 11px var(--mono); text-align: center; color: var(--warn); }
.change-st.st-A { color: var(--ok); }
.change-st.st-D { color: var(--danger); }
.change-path { flex: 1; min-width: 0; display: flex; overflow: hidden; white-space: nowrap; }
.change-dir { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.change-name { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.change-stat { display: inline-flex; gap: 6px; flex: none; font: 12px var(--mono); }
.changes-sum .add, .change-stat .add { color: var(--ok); }
.changes-sum .del, .change-stat .del { color: var(--danger); }
.change-bin { color: var(--muted); }
.modal.modal-diff { max-width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.diff-head { gap: 12px; }
.diff-head h2 { min-width: 0; display: flex; overflow: hidden; white-space: nowrap; font: 600 14px var(--mono); }
.diff-body { flex: 1; min-height: 0; overflow: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--frame); }
.diff { min-width: max-content; padding: 4px 0; font: 12.5px/1.55 var(--mono); }
.dl { display: grid; grid-template-columns: 52px 52px 1fr; }
.dl .ln { padding: 0 10px; color: var(--faint); text-align: right; user-select: none; }
.dl .dt { padding-right: 20px; white-space: pre; color: var(--text-2); }
.dl.add { background: var(--add-soft); }
.dl.add .dt { color: var(--text); }
.dl.del { background: var(--del-soft); }
.dl.del .dt { color: var(--text); }
.dl.hunk { margin-top: 4px; background: var(--accent-soft); }
.dl.hunk .dt, .dl.meta .dt { color: var(--muted); }
.thread-inner { flex: none; width: 100%; max-width: calc(var(--chat-w) + 2 * var(--gutter)); margin: auto auto 0; padding: 8px var(--gutter) 36px; }

.msg { display: grid; grid-template-columns: 26px 1fr; column-gap: 12px; margin: 18px 0; }
.msg-agent { margin-left: -38px; }
.msg-body { min-width: 0; padding-top: 3px; }
.msg.cont { margin-top: 8px; }
.msg.cont > .orb { visibility: hidden; height: 0; }
.msg-user { display: flex; justify-content: flex-end; margin: 20px 0; }
.bubble-user {
  max-width: min(78%, 580px); padding: 9px 15px; border-radius: 18px 18px 6px 18px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  white-space: pre-wrap; word-wrap: break-word;
}

.prose { word-wrap: break-word; max-width: 70ch; }
.prose p { margin: 0 0 12px; }
.prose p:last-child { margin-bottom: 0; }
.prose h2 { font-size: 16px; margin: 22px 0 10px; font-weight: 650; }
.prose h3 { font-size: 14.5px; margin: 20px 0 8px; font-weight: 650; }
.prose > :first-child { margin-top: 0; }
.prose a { text-decoration: underline; text-decoration-color: var(--accent-line); }
.prose a:hover { text-decoration-color: currentColor; }
.prose del { color: var(--muted); }
.prose blockquote { margin: 10px 0 12px; padding: 2px 0 2px 14px; border-left: 2px solid var(--line-strong); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line-strong); margin: 18px 0; }
.prose .table-wrap { overflow-x: auto; margin: 10px 0 14px; border: 1px solid var(--line); border-radius: var(--r); }
.prose table { border-collapse: collapse; min-width: 100%; font-size: 13.5px; }
.prose th, .prose td { padding: 7px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.prose th + th, .prose td + td { border-left: 1px solid var(--line); }
.prose th { font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }
.prose ul, .prose ol { margin: 6px 0 12px; padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 650; }
.prose code { font-size: 13px; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.prose pre {
  background: var(--frame); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.55; margin: 10px 0;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.step { margin: 6px 0; }
.tool { border: 1px solid var(--line); border-radius: var(--r); background: rgba(var(--card), 0.7); overflow: hidden; }
.tool-head {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px;
  background: none; border: 0; color: var(--text-2); cursor: pointer; text-align: left; font: 13px var(--font);
}
.tool-head:hover { background: var(--surface); }
.tool-head .icon { width: 16px; height: 16px; color: var(--muted); }
.tool-display { font: 12.5px var(--mono); color: var(--text-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-state { flex: none; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.tool-state .icon { width: 14px; height: 14px; }
.tool-state.ok { color: var(--ok); }
.tool-state.bad { color: var(--danger); }
.tool-out {
  display: none; margin: 0; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--frame);
  font: 12px/1.55 var(--mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto;
}
.tool.open .tool-out { display: block; }
.tool-note { display: none; padding: 0 14px 10px; font-size: 12px; color: var(--muted); background: var(--frame); }
.tool.open .tool-note { display: block; }
.tool.undone .tool-head { opacity: .6; }
.tool-undo { margin-top: 6px; }
.tool-state.muted { color: var(--muted); }

.check-card { border: 1px solid var(--line); border-radius: var(--r); background: rgba(var(--card), 0.7); padding: 10px 12px; margin: 6px 0; }
.check-card.ok { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.check-card.fail { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.check-card.warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.check-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.check-marker { flex: none; }
.check-sha { color: var(--muted); }
.check-time { margin-left: auto; font-size: 12px; color: var(--muted); }
.check-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.check-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.check-code {
  flex: none; display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px;
  font: 11.5px var(--mono); border: 1px solid var(--line-strong); color: var(--muted); background: var(--surface);
}
.check-code.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line-strong)); background: var(--add-soft); }
.check-code.fail { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line-strong)); background: var(--danger-soft); }
.check-code.skip { color: var(--faint); }
.check-cmd { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-output { flex-basis: 100%; margin: 0; padding: 10px 12px; border-radius: var(--r); background: var(--frame); border: 1px solid var(--line); font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto; }
.check-stale { margin-top: 8px; font-size: 12px; color: var(--muted); }
.check-badge { margin-right: 2px; font-size: 13px; }

.note { display: flex; align-items: flex-start; gap: 9px; padding: 4px 2px; font-size: 13px; color: var(--muted); }
.note .icon { width: 16px; height: 16px; margin-top: 2px; }
.note.error { color: var(--danger); }
/* activity of one agent turn: a rolling line while it works, a folded log afterwards */
.work { margin: 6px 0; }
.work-head {
  display: flex; align-items: center; gap: 10px; width: calc(100% + 6px); max-width: 566px; margin-left: -6px; padding: 5px 10px 5px 6px;
  border: 0; border-radius: 10px; background: none; color: var(--text-2); font: 13.5px var(--font); text-align: left; cursor: pointer;
}
.work-head:hover { background: var(--surface); }
.work-head > .icon { width: 15px; height: 15px; color: var(--muted); }
.work-head > .icon:last-child { width: 14px; height: 14px; margin-left: auto; transform: rotate(-90deg); transition: transform 0.2s var(--ease); }
.work.open .work-head > .icon:last-child { transform: none; }
.work.running .work-head > .icon:last-child { opacity: 0; }
.work.running .work-head:hover > .icon:last-child { opacity: 1; }
.spinner {
  width: 15px; height: 15px; flex: none; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 22%, transparent); border-top-color: var(--accent-strong);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ticker { position: relative; flex: 1; min-width: 0; height: 22px; overflow: hidden; }
.ticker-line {
  position: absolute; inset: 0; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: transform 0.35s var(--ease), opacity 0.35s var(--ease);
}
.ticker-line.enter { transform: translateY(100%); opacity: 0; }
.ticker-line.leave { transform: translateY(-100%); opacity: 0; }
.work.done .work-head { display: inline-flex; width: auto; max-width: 100%; }
.work.done .ticker { height: auto; color: var(--muted); }
.work.done .ticker-line { position: static; display: block; }
.work.done .work-head > .icon:last-child { margin-left: 0; }
.work-meta { flex: none; font-size: 12px; color: var(--faint); }
.work-log { display: none; flex-direction: column; gap: 6px; margin: 6px 0 4px 13px; padding-left: 14px; border-left: 1px solid var(--line); }
.work.open .work-log { display: flex; }
.work-thought { max-width: none; font-size: 13px; color: var(--muted); }
.work-log .approval { margin: 0; }

.approval {
  border-radius: var(--r-lg); padding: 16px 18px; margin: 4px 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, transparent), color-mix(in srgb, var(--accent) 2%, transparent)), var(--surface);
  border: 1px solid var(--accent-line);
  box-shadow: 0 12px 30px -16px color-mix(in srgb, var(--accent-btn) 55%, transparent);
}
.approval.risk-destructive { border-color: rgba(244, 124, 124, 0.55); background: linear-gradient(180deg, rgba(244, 124, 124, 0.08), transparent), var(--surface); box-shadow: none; }
.approval.decided { border-color: var(--line); background: var(--surface); box-shadow: none; }
.approval-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.approval-title { font-weight: 600; }
.approval-timer { margin-left: auto; font: 12px var(--mono); color: var(--muted); }
.approval-cmd {
  margin: 0 0 10px; padding: 11px 13px; border-radius: var(--r); background: var(--frame); border: 1px solid var(--line);
  font: 13px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.approval-stdin { max-height: 240px; overflow: auto; }
.approval-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 12px; font-size: 13px; }
.approval-meta dt { color: var(--muted); }
.approval-meta dd { margin: 0; font: 12.5px var(--mono); word-break: break-all; }
.approval-sub { margin: 4px 0 6px; font-size: 12.5px; color: var(--muted); }
.approval-confirm { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 13px; color: var(--danger); }
.approval-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.approval-result { font-size: 13px; color: var(--muted); }

/* composer */
.composer-wrap { flex: none; padding: 0 var(--gutter) 20px; }
.composer {
  max-width: var(--chat-w); margin: 0 auto; padding: 12px 10px 8px 14px; border-radius: 18px;
  background: rgba(var(--card), 0.86); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s;
}
.composer:focus-within { border-color: var(--accent-line); }
.composer-notice:empty { display: none; }
.composer-notice { margin: -12px -10px 10px -14px; }
.limit-strip { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 17px 17px 0 0; background: rgba(242, 184, 103, 0.12); border-bottom: 1px solid rgba(242, 184, 103, 0.35); color: var(--warn); font-size: 13px; font-weight: 600; }
.limit-strip.danger { background: rgba(248, 113, 113, 0.12); border-bottom-color: rgba(248, 113, 113, 0.4); color: var(--danger); }
.limit-strip > .icon { flex: none; }
.limit-strip > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.limit-strip .link-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.composer-keybar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; margin: -12px -10px 10px -14px; border-radius: 17px 17px 0 0; background: rgba(248, 113, 113, 0.12); border-bottom: 1px solid rgba(248, 113, 113, 0.4); color: var(--danger); font-size: 13px; }
.composer-keybar[hidden] { display: none; }
.composer-keybar > span { flex: 1; min-width: 0; }
.composer-input { display: flex; align-items: flex-start; padding-left: 9px; }
.composer textarea {
  display: block; flex: 1; resize: none; border: 0; background: transparent; padding: 2px 0 12px;
  font: 14.5px/1.5 var(--font); color: var(--text); min-height: 26px; max-height: 240px;
}
.composer textarea:focus { outline: none; }
.composer-bar { display: flex; align-items: center; gap: 4px; }
.composer-bar .spacer { flex: 1; }
.composer-bar .divider { width: 1px; height: 16px; background: var(--line-strong); margin: 0 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; min-width: 0;
  border-radius: 999px; border: 0; background: transparent; color: var(--text-2);
  font: 13px var(--font); cursor: pointer; white-space: nowrap;
}
.chip .icon { width: 16px; height: 16px; }
.chip > .icon:last-child:not(:first-child) { width: 14px; height: 14px; color: var(--muted); }
.chip:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.chip.accent { color: var(--accent-strong); }
.chip.full { color: var(--orange); }
.chip-label { overflow: hidden; text-overflow: ellipsis; }
a.chip:hover { text-decoration: none; }
.send {
  width: 32px; height: 32px; flex: none; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--accent-fg); background: var(--accent-btn);
  transition: background 0.15s;
}
.send:hover:not(:disabled) { background: var(--accent-btn-hover); }
.send:disabled { background: var(--surface-3); color: var(--faint); cursor: not-allowed; }
.send.stop { animation: send-pulse 1.6s ease-in-out infinite; }
.send.stop:disabled, .send.resume:disabled { background: var(--accent-btn); color: var(--accent-fg); opacity: 0.6; cursor: progress; }
@keyframes send-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-btn) 45%, transparent); transform: scale(1); }
  50% { box-shadow: 0 0 0 6px transparent; transform: scale(0.94); }
}
.send .icon { width: 17px; height: 17px; stroke-width: 2.2; }
.composer .attach { margin-left: -4px; }
.composer.drop { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent-btn) 8%, transparent); }
.mic { width: 32px; height: 32px; flex: none; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.mic:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.mic:disabled { opacity: 0.35; cursor: not-allowed; }
.mic.unavailable { opacity: 0.45; }
.mic.listening { color: #fff; background: var(--danger); border-color: transparent; animation: mic-pulse 1.4s ease-in-out infinite; }
.mic .icon { width: 16px; height: 16px; }
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(248, 113, 113, 0); }
}
.attach-strip:empty { display: none; }
.attach-strip { display: flex; flex-direction: column; gap: 6px; margin: 0 4px 10px 0; }
.attach-row { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; min-width: 0; }
.attach-row > .icon { flex: none; color: var(--muted); }
.attach-row img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; flex: none; }
.attach-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-meta { color: var(--muted); font: 12px var(--mono); flex: none; }
.attach-row.uploading .attach-meta { color: var(--accent-strong); }
.attach-row.failed { border-color: rgba(248, 113, 113, 0.5); }
.attach-remove { width: 26px; height: 26px; }
.attach-remove .icon { width: 14px; height: 14px; }
.bubble-text { white-space: pre-wrap; }
.bubble-text + .attachments { margin-top: 10px; }
.attachments { display: flex; flex-direction: column; gap: 6px; white-space: normal; }
.attachment { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 13px; min-width: 0; text-align: left; cursor: pointer; }
.attachment:hover { text-decoration: none; border-color: var(--accent-line); }
.attachment > .icon { flex: none; color: var(--muted); margin-left: 2px; }
.attachment-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-meta { color: var(--muted); font: 12px var(--mono); flex: none; }
.attachment.is-image img { display: block; width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex: none; background: rgba(var(--ink), 0.12); }
.modal.modal-picture { width: fit-content; min-width: 320px; max-width: min(92vw, 1200px); padding: 12px; }
.picture-full { display: block; max-width: 100%; max-height: calc(100vh - 120px); margin: 0 auto; border-radius: 8px; }
.picture-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; }
.picture-foot .spacer { flex: 1; }

.templates { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: var(--chat-w); margin: 0 auto 12px; }
.template {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgba(var(--card), 0.7); color: var(--text-2);
  font: 13px var(--font); cursor: pointer;
}
.template .icon { width: 15px; height: 15px; color: var(--muted); }
.template:hover { background: var(--surface-2); color: var(--text); }

.pop-catcher { position: fixed; inset: 0; z-index: 69; }
.popover { position: fixed; z-index: 70; min-width: 250px; max-width: 340px; padding: 6px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--pop); }
.menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border-radius: 10px;
  background: none; border: 0; color: var(--text-2); font: 13.5px var(--font); cursor: pointer; text-align: left;
}
.menu-item:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.menu-item:disabled { opacity: 0.45; cursor: not-allowed; }
.menu-item.selected { color: var(--text); }
.menu-item > .icon:last-child:not(:first-child) { margin-left: auto; color: var(--accent-strong); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.popover-sub { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.mode-item { align-items: flex-start; }
.mode-item > .icon:first-child { margin-top: 2px; }
.mi-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.mi-desc { font-size: 12px; line-height: 1.4; color: var(--muted); white-space: normal; }
.chip-model .chip-label { max-width: 190px; }
.info-section { margin-top: 20px; }
.info-section h3 { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
.info-section > .row-desc { margin: 0 0 10px; }
.project-instructions { margin-bottom: 8px; min-height: 120px; }
.base-select { min-width: 260px; max-width: 100%; }
.info-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.project-doc-row + .project-doc-row { border-top: 1px solid var(--line); }
.project-doc { max-height: 320px; overflow: auto; margin: 0; padding: 10px 16px 14px; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; color: var(--text-2); }
.model-pop { width: 320px; }
.popover-search { position: relative; margin-bottom: 4px; }
.popover-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.popover-search input { padding: 8px 12px 8px 33px; font-size: 13.5px; background: var(--frame); }
.model-list { max-height: min(320px, 50vh); overflow-y: auto; }
.mi-model { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12.5px var(--mono); }
.popover-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.menu-group { display: flex; align-items: center; gap: 6px; padding: 10px 10px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.menu-group:first-child { padding-top: 4px; }
.menu-group .provider-id { text-transform: none; letter-spacing: 0; }

/* plan above the composer */
.plan { max-width: var(--chat-w); margin: 0 auto 8px; border-radius: 14px; border: 1px solid var(--line); background: rgba(var(--card), 0.6); overflow: hidden; }
.plan[hidden] { display: none; }
.plan-head {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 12px; border: 0; background: none;
  color: var(--text-2); font: 13px var(--font); text-align: left; cursor: pointer;
}
.plan-head:hover { background: var(--surface); }
.plan-head > .icon { width: 15px; height: 15px; color: var(--muted); }
.plan-head > .icon:last-child { margin-left: auto; width: 14px; height: 14px; transition: transform 0.2s var(--ease); }
.plan.folded .plan-head > .icon:last-child { transform: rotate(-90deg); }
.plan-title { font-weight: 600; }
.plan-count { font: 12px var(--mono); color: var(--muted); }
.plan-list { display: flex; flex-direction: column; gap: 2px; max-height: 180px; overflow-y: auto; padding: 0 12px 9px; }
.plan.folded .plan-list { display: none; }
.plan-item { display: flex; align-items: flex-start; gap: 9px; padding: 3px 0; font-size: 13px; color: var(--text-2); }
.plan-item > .icon, .plan-item > .spinner { width: 14px; height: 14px; flex: none; margin-top: 3px; }
.plan-item > .icon { color: var(--ok); }
.plan-box { width: 14px; height: 14px; flex: none; margin-top: 3px; border-radius: 4px; border: 1.5px solid var(--faint); }
.plan-item.done { color: var(--muted); }
.plan-item.done .plan-text { text-decoration: line-through; text-decoration-color: rgba(var(--ink), 0.25); }
.plan-item.in_progress { color: var(--text); }
.plan-text { min-width: 0; overflow-wrap: anywhere; }

/* sub-agents */
.chip-agents[hidden] { display: none; }
.chip-usage[hidden] { display: none; }
.chip-usage .chip-label { font: 12.5px var(--mono); }
.chip-usage[data-level="high"] .chip-label { color: var(--orange); }
.chip-usage[data-level="critical"] .chip-label { color: var(--danger); }
/* context fill as a ring: the arc grows with the percent and warms up as the window fills */
.ctx-ring { display: inline-flex; flex: none; width: 16px; height: 16px; color: var(--accent); }
.ctx-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ctx-ring circle { fill: none; stroke-width: 3; }
.ctx-ring-track { stroke: var(--line-strong); }
.ctx-ring-fill { stroke: currentColor; stroke-linecap: round; transition: stroke-dasharray 0.35s var(--ease), stroke 0.25s var(--ease); }
.ctx-ring[data-level="mid"] { color: var(--warn); }
.ctx-ring[data-level="high"] { color: var(--orange); }
.ctx-ring[data-level="critical"] { color: var(--danger); }
.usage-pop { width: min(520px, calc(100vw - 16px)); max-width: none; padding: 14px 16px 12px; }
.usage-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.usage-head strong { font-size: 13.5px; font-weight: 600; }
.usage-scroll { overflow-x: auto; }
.usage-table { width: 100%; border-collapse: collapse; }
.usage-table th { padding: 4px 6px; border-bottom: 1px solid var(--line); color: var(--muted); font: 500 11.5px var(--font); text-align: right; white-space: nowrap; }
.usage-table td { padding: 6px; color: var(--text-2); font: 13px var(--font); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.usage-table th:first-child, .usage-table td:first-child { text-align: left; }
.usage-table td:first-child { max-width: 150px; overflow: hidden; text-overflow: ellipsis; color: var(--text); font: 12px var(--mono); }
.usage-provider { display: block; font-size: 11px; color: var(--muted); }
.usage-table tfoot td { border-top: 1px solid var(--line); color: var(--text); }
.ctx { margin: 0 -16px 12px; padding: 0 16px 14px; border-bottom: 1px solid var(--line); }
.ctx [data-part="system"] { --c: #3987e5; }
.ctx [data-part="tools"] { --c: #d95926; }
.ctx [data-part="plugins"] { --c: #199e70; }
.ctx [data-part="instructions"] { --c: #c98500; }
.ctx [data-part="skills"] { --c: #d55181; }
.ctx [data-part="memory"] { --c: #008300; }
.ctx [data-part="messages"] { --c: #9085e9; }
.ctx-head { display: flex; align-items: baseline; gap: 8px; }
.ctx-head strong { font-size: 13.5px; font-weight: 600; }
.ctx-model { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 11.5px var(--mono); color: var(--muted); }
.ctx-total { display: flex; align-items: baseline; gap: 7px; margin: 2px 0 14px; font-variant-numeric: tabular-nums; }
.ctx-used { font: 600 24px/1.2 var(--font); letter-spacing: -0.02em; color: var(--text); }
.ctx-of { font-size: 13px; color: var(--muted); }
.ctx-pct-total { margin-left: auto; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font: 12px/1.6 var(--mono); }
.ctx-body { display: flex; align-items: center; gap: 22px; }
.ctx-grid { flex: none; display: grid; grid-template-columns: repeat(10, 14px); gap: 3px; }
.ctx-cell { aspect-ratio: 1; border-radius: 3.5px; background: var(--c); transition: opacity 0.15s var(--ease); }
.ctx-cell[data-part="free"] { background: none; box-shadow: inset 0 0 0 1px var(--line-strong); }
.ctx [data-part="reserve"] { --c: repeating-linear-gradient(135deg, rgba(var(--ink), 0.09) 0 1.5px, transparent 1.5px 4px); }
.ctx-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ctx-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) 4.4em 3.4em; align-items: center; column-gap: 10px; margin: 0 -8px; padding: 3.5px 8px; border-radius: var(--r-sm); font-size: 12.5px; transition: opacity 0.15s var(--ease), background 0.15s var(--ease); }
.ctx-row:hover { background: var(--surface-2); }
.ctx-swatch { width: 8px; height: 8px; border-radius: 2.5px; background: var(--c); }
.ctx-row[data-part="free"] .ctx-swatch { background: none; box-shadow: inset 0 0 0 1px var(--muted); }
.ctx-row[data-part="reserve"] .ctx-swatch { box-shadow: inset 0 0 0 1px var(--faint); }
.ctx-row[data-part="reserve"] .ctx-name { color: var(--muted); }
.ctx-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.ctx-count { margin-left: 6px; font: 11px var(--mono); color: var(--faint); }
.ctx-tokens, .ctx-pct { text-align: right; font: 12px var(--mono); font-variant-numeric: tabular-nums; }
.ctx-tokens { color: var(--text); }
.ctx-pct { color: var(--muted); }
.ctx .dim { opacity: 0.22; }
.ctx-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.ctx-window { color: var(--text-2); }
.ctx-window.over { color: var(--danger); }
@media (max-width: 520px) {
  .usage-table th, .usage-table td { padding: 5px 3px; }
  .usage-table td:first-child { max-width: 92px; }
  .ctx-body { flex-direction: column; align-items: stretch; gap: 12px; }
  .ctx-grid { grid-template-columns: repeat(20, 1fr); }
}
.chip-agents .chip-label { font: 12.5px var(--mono); }
.chip-agents .dot { width: 6px; height: 6px; }
.modal-agents { max-width: 760px; }
.agents-list { display: flex; flex-direction: column; gap: 10px; }
.agent { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--frame); padding: 12px 14px; }
.agent-head { display: flex; align-items: center; gap: 9px; min-width: 0; }
.agent-head > .icon { width: 16px; height: 16px; color: var(--muted); flex: none; }
.agent-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-model { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12px var(--mono); color: var(--muted); }
.agent-head .pill { margin-left: auto; flex: none; gap: 6px; }
.agent-task { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.agent-task summary { cursor: pointer; }
.agent-task-text { margin-top: 6px; padding: 10px 12px; border-radius: var(--r); background: var(--surface); color: var(--text-2); white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto; }
.agent-log { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.agent-log:empty { display: none; }
.agent-log .approval { margin: 0; }
.agent-result:empty { display: none; }
.agent-result { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13.5px; }
.agent-result-title { margin-bottom: 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

/* new chat */
.welcome { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 28px 7vh; overflow-y: auto; }
.welcome-hero { display: flex; flex-direction: column; align-items: center; gap: 22px; margin-bottom: 34px; text-align: center; }
.welcome h1 { margin: 0; font-size: clamp(22px, 2.4vw, 28px); font-weight: 500; letter-spacing: -0.025em; }
.welcome .composer-wrap { padding: 0; }
.welcome-hint { max-width: var(--chat-w); margin: 14px auto 0; text-align: center; color: var(--muted); font-size: 13px; }
.welcome-hint:empty { display: none; }
.welcome-empty { max-width: 460px; margin: 0 auto; text-align: center; color: var(--text-2); }
.welcome-empty p { margin: 0 0 20px; color: var(--muted); }

/* ---------- settings ---------- */

.back-link {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 18px 20px 6px;
  background: none; border: 0; color: var(--text-2); font: 13.5px var(--font); cursor: pointer;
}
.back-link:hover { color: var(--text); }
.back-link .kbd { margin-left: auto; padding: 1px 7px; border: 1px solid var(--line-strong); border-radius: 6px; font: 11px var(--mono); color: var(--muted); }
.settings-title { margin: 14px 20px 14px; font-size: 19px; font-weight: 500; letter-spacing: -0.02em; }
.settings-search { position: relative; margin: 0 12px 6px; }
.settings-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.settings-search input { padding-left: 36px; background: var(--surface); }
.settings-nav { flex: 1; overflow-y: auto; padding: 0 12px 12px; }

.page { flex: 1; overflow-y: auto; }
.page-inner { max-width: 820px; margin: 0 auto; padding: 28px 28px 64px; }
.page-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.page-head h1 { margin: 0 0 6px; font-size: 24px; font-weight: 500; letter-spacing: -0.025em; }
.page-head p { margin: 0; max-width: 560px; color: var(--muted); font-size: 13.5px; }
.title-edit { cursor: text; border-radius: 6px; padding: 0 4px; margin: 0 -4px; }
.title-edit:hover, .title-edit:focus-visible { background: var(--surface-2); outline: none; }
.page-head input.title-input { font: inherit; letter-spacing: inherit; line-height: inherit; height: auto; width: min(100%, 520px); padding: 0 4px; margin: -1px -5px; border-color: var(--accent-line); border-radius: 6px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex: none; }

.section { margin-top: 28px; }
.section-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }

.hero { display: flex; align-items: center; gap: 20px; padding: 22px 24px; border-radius: var(--r-lg); border: 1px solid var(--line); background: rgba(var(--card), 0.7); }
.hero h2 { margin: 0 0 4px; font-size: 17px; font-weight: 500; letter-spacing: -0.015em; }
.hero p { margin: 0; color: var(--muted); font-size: 13.5px; }
.hero-text { flex: 1; }
.hero-update { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-update code { font-size: 12.5px; color: var(--text-2); }
.device-update { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.rows { border: 1px solid var(--line); border-radius: var(--r-lg); background: rgba(var(--card), 0.7); overflow: hidden; }
.row { display: flex; align-items: center; gap: 16px; padding: 12px 18px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row-text { flex: 1; min-width: 0; }
.row-title { display: flex; align-items: center; gap: 10px; font-weight: 550; }
.row-desc { margin-top: 2px; color: var(--muted); font-size: 13px; word-wrap: break-word; }
.row-desc code { font-size: 12px; color: var(--text-2); }
.row-desc.warn { color: var(--warn); }
.row-value { flex: none; max-width: 55%; display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13.5px; text-align: right; }
.row-value.mono { font-size: 12.5px; word-break: break-all; }
.row-extra { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 16px; margin-top: -4px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }

.device { border-top: 1px solid var(--line); }
.device:first-child { border-top: 0; }
.device-head {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 20px;
  background: none; border: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.device-head:hover { background: rgba(var(--ink), 0.02); }
.device-head > .icon { width: 16px; height: 16px; color: var(--muted); transform: rotate(-90deg); transition: transform 0.2s var(--ease); }
.device.open .device-head > .icon { transform: none; }
.device-body { padding: 0 20px 18px 50px; }
.device-sub { display: flex; flex-direction: column; gap: 2px; margin: 18px 0 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.device-sub:first-child { margin-top: 4px; }
.device-sub span { font-weight: 400; color: var(--muted); }
.device-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.device-text { margin: 0; font-size: 13px; color: var(--muted); }
.device-actions { margin-top: 18px; }
.tool-rows { border: 1px solid var(--line); border-radius: var(--r); background: var(--frame); }
.tool-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.tool-row:first-child { border-top: 0; }
.tool-row > .icon { width: 16px; height: 16px; color: var(--muted); }
.tool-row-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13.5px; font-weight: 550; }
.tool-row-title code { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.switch {
  position: relative; flex: none; width: 40px; height: 24px; padding: 0; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface-3); transition: background 0.15s, border-color 0.15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: transform 0.2s var(--ease), background 0.15s;
}
.switch[aria-checked="true"] { background: var(--accent-btn); border-color: transparent; }
.switch[aria-checked="true"]::after { transform: translateX(16px); background: var(--accent-fg); }
.switch:disabled { opacity: 0.6; cursor: progress; }

.code-line { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--frame); }
.code-line code { flex: 1; min-width: 0; font-size: 12.5px; overflow-x: auto; white-space: nowrap; }

.audit-item { display: grid; grid-template-columns: 148px 1fr; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 13px; }
.audit-item:first-child { border-top: 0; }
.audit-time { color: var(--muted); font-size: 12px; }
.audit-type { font-weight: 550; }
.audit-actor { color: var(--muted); font-weight: 400; }
.audit-payload { margin-top: 3px; font-size: 12.5px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }

.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 15px; font-weight: 600; }
.empty p { margin: 0 0 18px; }

/* marketplace */
.market-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.market-search { flex: 1; min-width: 220px; margin: 0; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); }
.seg { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: 500 13px var(--font); cursor: pointer; }
.seg:hover { color: var(--text); }
.seg.active { background: var(--surface-3); color: var(--text); }
.seg-count { font-size: 11.5px; color: var(--muted); }
.market-note { margin: -4px 0 14px; font-size: 12.5px; color: var(--warn); }
.market-groups { display: flex; flex-direction: column; gap: 22px; }
.market-group-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 14.5px; font-weight: 600; }
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.market-groups > .empty { border: 1px solid var(--line); border-radius: var(--r-lg); }
.market-grid > .empty { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: var(--r-lg); }
.market-card {
  display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: var(--r-lg); cursor: pointer;
  border: 1px solid var(--line); background: rgba(var(--card), 0.7); transition: border-color 0.15s, background 0.15s;
}
.market-card:hover { border-color: var(--line-strong); background: var(--surface); }
.market-card.installed { border-color: var(--accent-line); }
.market-card-head { display: flex; align-items: center; gap: 12px; }
.market-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); }
.market-title { min-width: 0; font-weight: 600; }
.market-meta { font-size: 12px; font-weight: 400; color: var(--muted); }
.market-summary { flex: 1; margin: 0; font-size: 13px; color: var(--text-2); }
.market-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pill.tag-kind { height: 24px; font-size: 11.5px; padding: 0 10px; }
.market-foot { display: flex; align-items: center; min-height: 30px; }
.market-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.switch-label { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.modal.modal-wide { max-width: 680px; max-height: calc(100vh - 32px); overflow-y: auto; }
.ws-status { display: flex; align-items: center; gap: 8px; min-height: 22px; margin: 10px 0 12px; font-size: 13px; color: var(--text-2); }
.ws-status.bad { color: var(--danger); }
.ws-toggle { margin: 4px 0 6px; font-size: 14px; color: var(--text); }
.modal p.ws-hint { margin: 0 0 14px; }
.ws-status .pill { height: 22px; font-size: 11.5px; padding: 0 9px; flex: none; }
.ws-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; margin-bottom: 4px; }
.ws-list .empty { padding: 14px 10px; color: var(--muted); font-size: 13px; }
.ws-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; border-radius: var(--r); background: none; color: var(--text); font: 13.5px var(--font); text-align: left; cursor: pointer; }
.ws-item:hover, .ws-item.selected { background: var(--surface-2); }
.ws-item .icon { width: 15px; height: 15px; color: var(--muted); flex: none; }
.ws-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12.5px; }
.ws-name.remote { color: var(--muted); }
.ws-item .pill { height: 20px; font-size: 11px; padding: 0 8px; flex: none; }
.modal .market-meta { margin: -2px 0 12px; }
.market-tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.market-tool { padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--frame); }
.market-tool-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.market-tool-head code { font-size: 12.5px; color: var(--text); }
.market-tool .pill { height: 22px; font-size: 11.5px; padding: 0 9px; }
.market-argv { margin: 8px 0 0; font: 12px/1.5 var(--mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.market-instructions { max-height: 320px; overflow-y: auto; padding: 12px 14px; margin-bottom: 18px; border-radius: var(--r); border: 1px solid var(--line); background: var(--frame); font-size: 13.5px; }
.market-yaml { font: 12.5px/1.5 var(--mono); resize: vertical; margin-bottom: 16px; background: var(--frame); }

/* memory: the map fills the panel, the central note sits in a lit hub, other notes are tiles on rings */
.page-inner.page-wide { max-width: 1180px; }
.muted { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.graph-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.graph-toolbar .spacer { flex: 1; }
.graph-search { flex: 0 1 320px; margin: 0; }
.zoom-sign { font-size: 21px; line-height: 1; }
.mem-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mem-title { flex: none; margin-right: 10px; font-size: 15px; font-weight: 550; }
.mem-tabs .seg { height: 28px; }
.mm-stage {
  position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; cursor: grab; user-select: none;
  background: var(--haze-stage);
}
.mm-stage.mm-grabbing { cursor: grabbing; }
.mm-stage::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(var(--ink), 0.075) 1px, transparent 1.3px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(85% 80% at 50% 50%, #000 30%, transparent 90%); mask-image: radial-gradient(85% 80% at 50% 50%, #000 30%, transparent 90%);
}
.mm-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.mm-lines { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.mm-ring { fill: none; stroke: rgba(var(--ink), 0.06); }
.mm-ring.faint { stroke: rgba(var(--ink), 0.035); }
.mm-wedge { fill: var(--c); fill-opacity: var(--wedge); stroke: var(--c); stroke-opacity: 0.1; stroke-width: 1; transition: fill-opacity 0.3s var(--ease); }
.mm-area-label { fill: var(--c); font: 600 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; pointer-events: auto; cursor: pointer; opacity: 0.85; transition: opacity 0.2s; }
.mm-area-label:hover { opacity: 1; }
.mm-section-label { fill: var(--c); font: 500 9px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.6; }
.mm-divider { fill: none; stroke: var(--c); stroke-opacity: 0.14; stroke-width: 1; stroke-dasharray: 3 4; }
.mm-only .mm-section-label, .mm-only .mm-divider { opacity: 0.25; }
.mm-only .mm-wedge:not(.in) { fill-opacity: 0; stroke-opacity: 0.04; }
.mm-only .mm-node:not(.in) { opacity: 0.1; pointer-events: none; }
.mm-only .mm-edge:not(.in), .mm-only .mm-cross:not(.in) { stroke-opacity: 0.04; }
.mm-edge { fill: none; stroke: var(--c); stroke-opacity: 0.5; stroke-width: 1.5; stroke-linecap: round; transition: stroke-opacity 0.3s var(--ease); }
.mm-edge.implicit { stroke-dasharray: 4 6; stroke-opacity: 0.35; }
.mm-edge.on { stroke-opacity: 1; stroke-width: 2; }
.mm-cross { fill: none; stroke: rgba(var(--ink), 0.13); stroke-width: 1.2; stroke-dasharray: 2 5; transition: stroke 0.3s var(--ease); }
.mm-cross.on { stroke: var(--cross-near); }
.mm-focus .mm-edge:not(.on) { stroke-opacity: 0.12; }
.mm-focus .mm-cross:not(.on) { stroke: rgba(var(--ink), 0.05); }
.hub-edge {
  border: 1.5px solid transparent;
  background: var(--hub-fill) padding-box, linear-gradient(140deg, var(--orb-1, #96aaff), var(--orb-2, #a47bff) 35%, var(--orb-3, #d66cf0) 68%, var(--orb-4, #ff86c4)) border-box;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 6%, transparent), 0 24px 60px -24px color-mix(in srgb, var(--accent) 55%, transparent);
}
.mm-hub {
  position: absolute; left: 0; top: 0; z-index: 2; transform: translate(-50%, -50%); width: 280px; padding: 12px 14px 14px; border-radius: 34px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text);
}
.mm-hub-head { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; padding: 2px 0 0; border: 0; border-radius: 22px; background: none; color: inherit; font: inherit; cursor: pointer; }
.mm-hub-head:hover .mm-hub-title { color: var(--accent-strong); }
.mm-hub-title { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 550; transition: color 0.2s; }
.mm-hub-sub { font-size: 12px; color: var(--muted); }
.mm-files { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; }
.mm-file {
  display: flex; align-items: center; gap: 7px; min-width: 0; height: 32px; padding: 0 10px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--line-strong); background: rgba(var(--ink), 0.035); color: var(--text-2); font: 12px var(--mono);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.mm-file .icon { width: 14px; height: 14px; color: var(--muted); flex: none; }
.mm-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.mm-file-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.mm-file.custom .mm-file-dot { background: var(--accent); }
.mm-file.over { border-color: rgba(242, 184, 103, 0.5); }
.mm-file:hover, .mm-file:focus-visible { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); outline: none; }
.mem-file-icon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-strong); }
.mem-file-icon .icon { width: 15px; height: 15px; }
.mm-node {
  position: absolute; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 150px; padding: 0; border: 0;
  background: none; color: var(--text-2); font: 12.5px/1.3 var(--font); cursor: pointer; transform: translate(-50%, -23px); transition: opacity 0.3s var(--ease);
}
.mm-tile {
  position: relative; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; color: var(--c);
  border: 1px solid var(--line-strong); background: linear-gradient(180deg, var(--surface-2), var(--surface)); box-shadow: var(--shadow-tile);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.mm-tile .icon { width: 20px; height: 20px; }
.mm-tile::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--surface); }
.mm-node.pinned .mm-tile { border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.mm-node.ghost .mm-tile { border-radius: 50%; border-style: dashed; border-color: rgba(var(--ink), 0.22); background: rgba(var(--card), 0.6); box-shadow: none; }
.mm-node.ghost .mm-tile::after { display: none; }
.mm-label {
  max-width: 116px; padding: 1px 7px; border-radius: 7px; background: rgba(var(--veil), 0.78); text-align: center; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; transition: opacity 0.2s;
}
.mm-node:hover .mm-tile, .mm-node:focus-visible .mm-tile, .mm-node.sel .mm-tile { border-color: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent), var(--shadow-tile); }
.mm-node:focus-visible { outline: none; }
.mm-node.sel .mm-label, .mm-node:hover .mm-label { color: var(--text); }
.mm-focus .mm-node:not(.lit) { opacity: 0.28; }
.mm-far .mm-node:not(.sel):not(:hover):not(.key) .mm-label { opacity: 0; }
.mm-node.arrived .mm-tile { animation: mm-arrive 0.7s var(--ease); }
@keyframes mm-arrive { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 60%, transparent); } to { box-shadow: 0 0 0 16px transparent; } }
.mm-packet {
  position: absolute; left: 0; top: 0; z-index: 3; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; pointer-events: none; background: var(--c);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent), 0 0 16px 2px color-mix(in srgb, var(--c) 60%, transparent);
}
.mm-tools { position: absolute; z-index: 5; top: 14px; left: 16px; width: min(320px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px; }
.mm-tools .graph-search { flex: none; }
.mm-tools .graph-search input { background: rgba(var(--card), 0.88); }
.mm-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.mm-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(var(--card), 0.88); color: var(--text-2); font: 11.5px var(--mono);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.mm-chip .kind-dot { background: var(--c); }
.mm-chip-n { color: var(--muted); }
.mm-chip:hover { color: var(--text); border-color: var(--line-strong); }
.mm-chip.active { color: var(--text); border-color: color-mix(in srgb, var(--c, var(--accent)) 60%, transparent); background: color-mix(in srgb, var(--c, var(--accent)) 12%, rgba(var(--card), 0.88)); }
.mm-chip .icon { width: 13px; height: 13px; color: var(--muted); }
.mm-chip.kind { --c: var(--accent); }
.graph-side-members { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 12px; }
.graph-side-members .mm-chip { max-width: 100%; height: auto; min-height: 24px; padding: 3px 9px; text-align: left; }
.graph-side-members .mm-chip .icon { color: var(--c); }
.topic-pill { cursor: pointer; }
.note-path { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.note-path .pill { height: 24px; font-size: 11.5px; padding: 0 10px; }
.note-path-sep { color: var(--faint); }
.mem-kind-icon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; margin-top: 2px; border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.mem-kind-icon .icon { width: 15px; height: 15px; }
.note-groups { display: flex; flex-direction: column; gap: 18px; }
.note-group-head { display: flex; align-items: flex-start; gap: 6px; padding: 0 0 8px; border-bottom: 1px solid var(--line-strong); }
.note-group-head .row-text { flex: 1; min-width: 0; }
.note-group-head .row-title { font-size: 14.5px; font-weight: 600; }
.note-group-head .count { margin-left: 8px; color: var(--muted); font-weight: 400; }
.note-item.archived { opacity: 0.55; }
.dream-proposals { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.dream-proposal { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line); background: rgba(var(--ink), 0.025); }
.dream-proposal .row-text { flex: 1; min-width: 0; }
.dream-proposal .row-title { font-size: 13.5px; }
.dream-proposal .row-title .pill { margin-left: 8px; height: 20px; font-size: 11px; padding: 0 8px; }
.dream-proposal details { margin-top: 4px; }
.dream-proposal summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.dream-proposal-actions { display: flex; gap: 6px; flex: none; }
.dream-proposal-batch { display: flex; align-items: center; gap: 8px; padding: 2px 0 4px; }
.dream-proposal-batch .market-meta { flex: 1; }
.dream-proposal.applied, .dream-proposal.dismissed { opacity: 0.6; }
.auto-state { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.auto-state-list { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 13px; }
.auto-state-list dt { color: var(--muted); font-family: var(--mono); }
.auto-state-list dd { margin: 0; overflow-wrap: anywhere; }
.mm-zoom { position: absolute; z-index: 5; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: 14px; border: 1px solid var(--line); background: rgba(var(--card), 0.88); }
.mm-legend { position: absolute; z-index: 5; left: 16px; bottom: 16px; max-width: calc(100% - 110px); margin: 0; padding: 7px 12px; border-radius: 12px; background: rgba(var(--veil), 0.72); }
.graph-side { z-index: 6; }
.graph-side-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.graph-side .graph-side-actions .btn { margin-top: 0; }
.graph-side {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(340px, calc(100% - 24px)); overflow-y: auto;
  padding: 14px 16px 16px; border-radius: var(--r-lg); background: rgba(var(--card), 0.95); border: 1px solid var(--line-strong); box-shadow: var(--pop);
}
.graph-side-head { display: flex; align-items: flex-start; gap: 8px; }
.graph-side-head h3 { flex: 1; margin: 6px 0 10px; font-size: 15.5px; font-weight: 600; overflow-wrap: anywhere; }
.graph-side-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.graph-side-meta .pill, .graph-side-meta .pill.tag { height: 24px; font-size: 11.5px; padding: 0 10px; }
.graph-side-meta .pill .icon { width: 13px; height: 13px; }
.graph-side-body { margin-bottom: 12px; font-size: 13.5px; }
.graph-side .btn { margin-top: 12px; }
.graph-side-list { display: flex; flex-direction: column; }
.graph-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.graph-legend span { display: inline-flex; align-items: center; gap: 6px; }
.kind-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.pill.kind-pill { gap: 6px; }
.wikilink { color: var(--accent-strong); border-bottom: 1px dashed var(--accent-line); }
.wikilink:hover { text-decoration: none; border-bottom-style: solid; }
.note-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.note-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.note-field { display: flex; flex-direction: column; gap: 5px; }
.note-field > span { font-size: 12px; color: var(--muted); }
.note-body { min-height: 200px; resize: vertical; font: 13.5px/1.55 var(--font); }
.note-backlinks { font-size: 13px; color: var(--muted); }
.modal-actions .spacer { flex: 1; }
.note-item {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 14px 20px; border: 0; border-top: 1px solid var(--line);
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.note-item:first-child { border-top: 0; }
.note-item:hover { background: rgba(var(--ink), 0.025); }
.note-item > .kind-dot { margin-top: 8px; }
.note-item-meta { margin-top: 4px; font-size: 12px; color: var(--faint); }
.note-pin .icon { width: 14px; height: 14px; color: var(--accent-strong); }
.dream-card { display: flex; align-items: center; gap: 24px; padding: 22px 24px; border-radius: var(--r-lg); border: 1px solid var(--line); background: rgba(var(--card), 0.7); }
.dream-card.running { border-color: var(--accent-line); }
.dream-text { flex: 1; min-width: 0; }
.dream-text h2 { margin: 0 0 6px; font-size: 17px; font-weight: 500; letter-spacing: -0.015em; }
.dream-text p { margin: 0 0 14px; max-width: 640px; color: var(--muted); font-size: 13.5px; }
.dream-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dream-controls .spacer { flex: 1; }
.dream-phases { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.dream-phase { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: rgba(var(--card), 0.5); opacity: 0.5; }
.dream-phase.done, .dream-phase.current { opacity: 1; }
.dream-phase.current { border-color: var(--accent-line); background: var(--accent-soft); }
.dream-phase-title { font-size: 13.5px; font-weight: 600; }
.dream-phase-dot { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--surface-3); font-size: 11.5px; }
.dream-phase-dot .icon { width: 14px; height: 14px; }
.dream-phase.done .dream-phase-dot { color: var(--ok); }
.dream-phase.current .dream-phase-dot { background: var(--accent-btn); color: var(--accent-fg); animation: dot 1.5s ease-in-out infinite; }
.dream-diary-head { margin-top: 32px; }
.dream-runs { display: flex; flex-direction: column; gap: 10px; }
.dream-entry { padding: 16px 20px; border-radius: var(--r-lg); border: 1px solid var(--line); background: rgba(var(--card), 0.7); }
.dream-entry-head { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; flex-wrap: wrap; }
.dream-entry-head .pill { height: 24px; font-size: 11.5px; padding: 0 10px; }
.dream-date { font-weight: 600; }
.dream-diary { margin: 10px 0; max-width: none; color: var(--text-2); }
.dream-error { margin: 8px 0 0; color: var(--danger); font-size: 13px; }
.dream-entry .muted { margin: 8px 0 0; }
.dream-entry .market-tags { margin-top: 8px; }
.dream-changes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dream-change { height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); font: 12.5px var(--font); cursor: pointer; }
.dream-change:hover { background: var(--surface-2); color: var(--text); }
.dream-change.created { color: var(--ok); border-color: rgba(90, 212, 154, 0.35); }
.dream-change.reinforced { color: var(--accent-strong); border-color: var(--accent-line); }

/* plugin settings */
.plugin-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.plugin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plugin-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.plugin-field-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.plugin-field-head .req { font-size: 11.5px; color: var(--faint); }
.plugin-field .row-desc { margin: 0; font-size: 12px; }
.plugin-field select { width: 100%; }
.secret-field { display: flex; align-items: center; gap: 8px; }
.secret-field input { flex: 1; min-width: 0; }
.secret-field .pill { height: 22px; font-size: 11.5px; flex: none; }
.link-btn { padding: 0; border: 0; background: none; color: var(--danger); font: 12.5px var(--font); cursor: pointer; flex: none; }
.plugin-mcp { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.plugin-mcp .field-label { margin: 4px 0 0; }
.plugin-mcp .market-argv { margin: 0; padding: 9px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--frame); }
.plugin-status { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: var(--r); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.plugin-status.error { border-color: rgba(244, 124, 124, 0.35); color: var(--danger); }
.plugin-status .spacer { flex: 1; }
.plugin-status .btn .spinner { width: 13px; height: 13px; }
.plugin-provides { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; margin-bottom: 8px; border-radius: var(--r); border: 1px solid var(--line); background: var(--frame); }
.plugin-provides > .icon { margin-top: 2px; color: var(--accent-strong); }
.plugin-risk { margin-top: 10px; max-width: 320px; }
.provider-hero { margin-bottom: 8px; }
.provider-cards { display: flex; flex-direction: column; gap: 10px; }
.provider-cards .provider-hero { margin: 0; }
.provider-hero .hero-text p { overflow-wrap: anywhere; }
.provider-card { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.provider-card:hover, .provider-card:focus-visible { border-color: var(--line-strong); background: rgba(var(--card-hi), 0.8); outline: none; }
.provider-card h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.provider-card > .icon { color: var(--muted); }
.provider-id { font-size: 12px; color: var(--muted); }
.plugin-status.ok { color: var(--text-2); }
.plugin-skill { margin-bottom: 16px; font-size: 13px; color: var(--text-2); }
.plugin-skill summary { cursor: pointer; margin-bottom: 8px; }
.market-actions .pill { height: 22px; font-size: 11.5px; }

/* automations */
a.row-text { color: inherit; }
a.row-text:hover { text-decoration: none; }
a.row-text:hover .row-title { color: var(--accent-strong); }
.auto-next { white-space: nowrap; }
.autos .row-desc { font-variant-ligatures: none; }
.empty > .orb { margin: 0 auto 14px; }
.empty > .orb ~ p { max-width: 460px; margin-inline: auto; }
.auto-prompt { min-height: 120px; resize: vertical; font: 14px/1.55 var(--font); }
.auto-inline { display: flex; gap: 8px; }
.auto-inline input { flex: 0 0 96px; }
.auto-inline select { flex: 1; min-width: 0; }
.auto-days { grid-column: 1 / -1; }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chip {
  position: relative; display: inline-grid; place-items: center; min-width: 44px; height: 34px; padding: 0 10px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font-size: 13px; cursor: pointer;
}
.day-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-chip:hover { color: var(--text); }
.day-chip:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-strong); }
.day-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
input.mono { font-family: var(--mono); font-size: 13px; }
.auto-preview p { margin: 0; }
.auto-actions { display: flex; align-items: center; gap: 8px; margin-top: 28px; }
.auto-actions .spacer { flex: 1; }
.runs .row-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.runs .pill { height: 22px; font-size: 11.5px; padding: 0 9px; }
.runs .pill .dot { width: 6px; height: 6px; }

/* projects */
.source-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.source-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px; text-align: left;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--text-2); cursor: pointer; font: 13.5px var(--font);
}
.source-tile:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.source-tile.active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.source-tile.active .icon { color: var(--accent-strong); }
.source-tile:disabled { opacity: 0.45; cursor: default; }
.source-tile .icon { width: 20px; height: 20px; color: var(--muted); }
.source-tile-label { font-weight: 500; }
.source-tile-hint { font-size: 12px; color: var(--muted); }
.browser { display: flex; flex-direction: column; gap: 8px; }
.browser-bar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.browser-path { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.browser-list { max-height: 320px; overflow-y: auto; transition: opacity 0.15s; }
.browser-list:empty { display: none; }
.browser-list.loading { opacity: 0.5; pointer-events: none; }
.browser-error { margin: 0; font-size: 12.5px; color: var(--warn); overflow-wrap: anywhere; }
.browser-error:empty { display: none; }
.browser-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 16px; border: 0; border-top: 1px solid var(--line);
  background: none; color: var(--text-2); font: 13.5px var(--font); text-align: left; cursor: pointer;
}
.browser-item:first-child { border-top: 0; }
.browser-item:hover { background: rgba(var(--ink), 0.025); color: var(--text); }
.browser-item .icon { width: 16px; height: 16px; color: var(--muted); }
.browser-item .pill { height: 22px; font-size: 11.5px; padding: 0 9px; }
.browser-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser-chosen { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--accent-line); background: var(--accent-soft); }
.browser-chosen:empty { display: none; }
.browser-chosen-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.browser-chosen-head .icon { color: var(--accent-strong); }
.browser-chosen-head code { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.browser-chosen .row-desc { margin: 0; font-size: 12.5px; }
.note-banner.busy { border-color: var(--accent-line); background: var(--accent-soft); }
.note-banner > .spinner { flex: none; }
.skipped { white-space: pre-line; text-align: left; }
.modal .modal-check { display: flex; margin: -6px 0 18px; }

/* modal */
.backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(3, 2, 6, 0.7); }
.modal { width: 100%; max-width: 540px; padding: 24px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--pop); }
.modal-head { display: flex; align-items: center; margin-bottom: 8px; }
.modal-head h2 { flex: 1; margin: 0; font-size: 17px; font-weight: 650; }
.modal p { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.pair-code {
  margin-bottom: 8px; padding: 18px 10px; border-radius: var(--r-lg); text-align: center;
  font: 600 28px var(--mono); letter-spacing: 0.06em; color: var(--accent-strong);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.pair-timer { margin-bottom: 20px; text-align: center; color: var(--muted); font-size: 12.5px; }
.field-label { margin: 14px 0 6px; font-size: 12.5px; color: var(--muted); }

/* login */
.login { height: 100%; display: grid; place-items: center; padding: 16px; background: var(--haze-login), var(--frame); }
.login { position: relative; }
.login-lang { position: absolute; top: 16px; right: 16px; }
.segmented.lang-compact .seg { height: 26px; padding: 0 10px; font-size: 12px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.login-card h1 { margin: 22px 0 6px; font-size: 24px; font-weight: 500; letter-spacing: -0.025em; }
.login-card p { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.login-card .btn { width: 100%; margin-top: 10px; height: 38px; }

#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { max-width: 380px; padding: 11px 16px; border-radius: var(--r); background: var(--surface-2); box-shadow: var(--pop); font-size: 13.5px; }
.toast.error { color: var(--danger); }

/* ---------- responsive ---------- */

@media (max-width: 1080px) { .project-chats { display: none; } }

@media (max-width: 860px) {
  .pill.tag.branch-pill { display: none; }
  .changes { position: absolute; inset: 0 0 0 auto; z-index: 5; width: min(100%, 360px); background: var(--surface); box-shadow: var(--pop); }
  .shell, .shell.collapsed { grid-template-columns: 1fr; }
  .shell.collapsed .sidebar { visibility: visible; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(300px, 86vw);
    transform: translateX(-100%); transition: transform 0.25s var(--ease);
  }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--pop); }
  .nav-backdrop { display: none; }
  .shell.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(3, 2, 6, 0.6); }
  .open-nav, .shell.collapsed .open-nav { display: inline-grid; }
  .collapse-nav { display: none; }
  .main, .shell.collapsed .main { padding: 0; }
  .panel { border-radius: 0; border: 0; }
  .topbar { min-height: 54px; padding: 8px 10px; }
  :root { --gutter: 12px; }
  .thread-inner { padding: 4px var(--gutter) 28px; }
  .composer-wrap { padding: 0 var(--gutter) 10px; }
  .welcome { padding: 0 14px 4vh; }
  .msg { grid-template-columns: 24px 1fr; column-gap: 10px; }
  .msg-agent { margin-left: 0; grid-template-columns: 1fr; }
  .msg-agent > .orb { display: none; }
  .msg > .orb { --s: 24px !important; }
  .bubble-user { max-width: 88%; }
  .chip-compact .chip-label { display: none; }
  .composer textarea, .auto-prompt, input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="time"], input[type="datetime-local"] { font-size: 16px; }
  .crumb-device { display: none; }
  .templates { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin: 0 -14px 12px; padding: 0 14px; scrollbar-width: none; }
  .templates::-webkit-scrollbar { display: none; }
  .template { flex: none; }
  .page-inner { padding: 20px 16px 56px; }
  .page-head { flex-direction: column; }
  .page-head .actions { margin-left: 0; }
  .row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .row-value { max-width: 100%; text-align: left; }
  .autos .row-value { flex-wrap: wrap; justify-content: flex-end; }
  .autos .auto-next { white-space: normal; }
  .audit-item { grid-template-columns: 1fr; gap: 4px; }
  .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .mm-chips, .mem-title, .mem-new-label { display: none; }
  .mem-new { width: 30px; padding: 0; }
  .mm-tools { top: 10px; left: 10px; width: calc(100% - 20px); }
  .mm-zoom { right: 10px; bottom: 10px; }
  .graph-side { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 58%; }
  .dream-card { flex-direction: column; align-items: flex-start; }
  .dream-phases { grid-template-columns: 1fr 1fr; }
  .segmented::-webkit-scrollbar { display: none; }
  .seg { flex: none; padding: 0 11px; }
  .market-grid { grid-template-columns: 1fr; }
  .plugin-grid { grid-template-columns: 1fr; }
  .device-head { padding: 14px 16px; gap: 10px; }
  .device-head .status-label { display: none; }
  .device-body { padding: 0 16px 16px; }
  .hero { flex-direction: column; text-align: center; }
}

@media (min-width: 861px) { .nav-backdrop { display: none; } }
@media (hover: none) { .session.active .session-del, .project-head.active .session-add { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* skills */
.skill-row .market-icon { font-size: 16px; }
.skill-row .row-title code { font-size: 13px; color: var(--text); }
.skill-row .row-value { gap: 12px; }
.skill-body { min-height: 260px; margin-bottom: 0; }
.row-desc.over { color: var(--danger); }
.skill-advanced summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.skill-advanced .plugin-form { margin: 12px 0 0; }
.check-row { display: flex; flex-wrap: wrap; gap: 14px; min-height: 34px; align-items: center; }
.check-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.check-label input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.empty.rows { padding: 28px 20px; }

/* core offline banner (gateway) */
.offline-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 7px 14px; background: rgba(242, 184, 103, 0.14); border-bottom: 1px solid rgba(242, 184, 103, 0.35); color: var(--text); font-size: 13px; }
.offline-banner > .icon { color: var(--warn); }
body.core-offline #app { padding-top: 34px; }

/* outdated device banner */
.note-banner { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: var(--r); border: 1px solid rgba(242, 184, 103, 0.35); background: rgba(242, 184, 103, 0.08); color: var(--text-2); font-size: 13px; }
.note-banner > .icon { flex: none; color: var(--warn); }
.note-banner > span { flex: 1; min-width: 0; }
.note-banner code { font-size: 12px; }
.welcome-banner:empty, .thread-banner:empty { display: none; }
.welcome-banner > * + *, .thread-banner > * + * { margin-top: 8px; }
.sidebar-foot-row { display: flex; align-items: center; gap: 4px; }
.sidebar-foot-row > .nav-item { flex: 1; min-width: 0; }
.limits-list { display: flex; flex-direction: column; gap: 14px; }
.modal .limits-list { margin-bottom: 18px; }
.modal.modal-wide > .modal-actions { padding-bottom: 2px; }
.icon-btn.spinning .icon { animation: spin 0.8s linear infinite; }
.lang-select { height: 32px; padding: 0 34px 0 14px; border-radius: 999px; background-color: var(--surface); background-position: right 12px center; line-height: 30px; }
.limit-provider { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); }
.limit-provider-head { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 13.5px; }
.limit-provider-head > strong { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.limit-provider-head > .spacer { flex: 1; }
.limit-row { display: flex; flex-direction: column; gap: 4px; }
.limit-label { display: flex; justify-content: space-between; font-size: 13px; }
.limit-label > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.limit-pct { font-variant-numeric: tabular-nums; color: var(--text-2); }
.limit-row.warn .limit-pct { color: var(--warn); }
.limit-row.danger .limit-pct { color: var(--danger); }
.meter { height: 6px; border-radius: 999px; background: rgba(var(--ink), 0.08); overflow: hidden; }
.meter-fill { height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.3s; }
.limit-row.warn .meter-fill { background: var(--warn); }
.limit-row.danger .meter-fill { background: var(--danger); }
.welcome-banner { margin-top: 14px; }
.thread-banner { max-width: calc(var(--chat-w) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter) 8px; }

/* screenshots and desktop permissions */
.tool-shot { display: block; margin: 8px 12px 4px; max-width: 420px; }
.msg-shot { display: block; margin-top: 10px; max-width: 560px; }
.tool-shot img, .msg-shot img { display: block; width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.device-desktop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 4px; }
.device-desktop .row-desc { flex-basis: 100%; }

/* appearance: theme cards with their palette dots, the tweakcn import below them */
.theme-box { border: 1px solid var(--line); border-radius: var(--r-lg); background: rgba(var(--card), 0.7); overflow: hidden; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; padding: 16px; }
.theme-slot { position: relative; min-width: 0; }
.theme-card {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 58px; padding: 0 16px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 500 14px var(--font); text-align: left; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.theme-card:hover { border-color: var(--line-strong); }
.theme-card.active { border-color: var(--accent-line); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent-line); }
.theme-card .icon { color: var(--accent); }
.theme-slot.removable .theme-card { padding-right: 40px; }
.theme-slot .icon-btn { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); }
.theme-dots { display: inline-flex; gap: 5px; flex: none; }
.theme-dots i { width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(var(--ink), 0.14); }
.theme-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-box > .row, .theme-import { border-top: 1px solid var(--line); }
.theme-import[hidden] { display: none; }
.theme-import { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px 18px; }
.theme-import h3 { margin: 0; font-size: 14px; font-weight: 600; }
.theme-import p { margin: 0; color: var(--muted); font-size: 13px; }
.theme-import a { display: inline-flex; align-items: center; gap: 6px; width: fit-content; color: var(--accent); font-size: 13px; text-decoration: none; }
.theme-import a:hover { text-decoration: underline; }
.theme-import .actions { display: flex; gap: 8px; }
