/* Copied verbatim from kaptin/apps/desktop/src/styles.css so the demo
 * renders with the real app styles. Re-copy when the app styles change;
 * demo-only additions live in css/app-demo.css. */
/* Kaptin shell — light workspace theme by default, dark when the OS
 * asks for it. The Tauri webviews propagate the system theme to
 * prefers-color-scheme on macOS, Windows, and Linux, so no native code
 * is needed; and because the base rules below ARE the light theme, an
 * unknown or absent system setting always lands on light.
 * Rounded cards, pill tabs, and status pills; system palette, no gradients. */
:root {
  color-scheme: light dark;
  --bg: #f3f3f1;
  --panel: #ffffff;
  --panel-soft: #f6f6f4;
  --border: #e4e4e0;
  --border-strong: #d6d6d1;
  --text: #1d1d1b;
  --muted: #6f6f6a;
  --faint: #9a9a94;
  --accent: #2f6bff;
  --accent-soft: #e8efff;
  --accent-faint: #f1f5ff;
  --accent-text: #1f4fd6;
  --amber-bg: #fdf0d3;
  --amber-text: #96690a;
  --green-bg: #e2f4e7;
  --green-text: #1d7a3d;
  --blue-bg: #e3edff;
  --blue-text: #2b55c4;
  --danger: #b3261e;
  --gate-bg: #f6f5f0;
  --gate-raised: #e9e9e6;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 20, 15, 0.06);
  --shadow-lg: 0 8px 24px rgba(20, 20, 15, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101014;
    --panel: #1c1c21;
    --panel-soft: #26262b;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.12);
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --faint: #71717a;
    --accent-soft: rgba(47, 107, 255, 0.18);
    --accent-faint: rgba(47, 107, 255, 0.1);
    --accent-text: #8ab0ff;
    --amber-bg: rgba(242, 201, 121, 0.13);
    --amber-text: #f2c979;
    --green-bg: rgba(34, 163, 85, 0.15);
    --green-text: #4ade80;
    --blue-bg: rgba(91, 140, 255, 0.15);
    --blue-text: #8ab0ff;
    --danger: #f87171;
    --gate-bg: #101014;
    --gate-raised: #303036;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45);
  }
  /* Brand chips keep their pastel fills; a hairline keeps the dark
   * ones (notably the black codex chip) defined on dark panels. */
  .tag { border: 1px solid var(--border); }
}

/* Manual theme override (Settings → General): beats the media block
 * by specificity, so it holds on any OS theme. Mirrors the base
 * :root (light) and the dark media vars — keep all three in sync
 * when tokens change. Absent data-theme, the OS media rule governs. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f3f1;
  --panel: #ffffff;
  --panel-soft: #f6f6f4;
  --border: #e4e4e0;
  --border-strong: #d6d6d1;
  --text: #1d1d1b;
  --muted: #6f6f6a;
  --faint: #9a9a94;
  --accent-soft: #e8efff;
  --accent-faint: #f1f5ff;
  --accent-text: #1f4fd6;
  --amber-bg: #fdf0d3;
  --amber-text: #96690a;
  --green-bg: #e2f4e7;
  --green-text: #1d7a3d;
  --blue-bg: #e3edff;
  --blue-text: #2b55c4;
  --danger: #b3261e;
  --gate-bg: #f6f5f0;
  --gate-raised: #e9e9e6;
  --shadow: 0 1px 2px rgba(20, 20, 15, 0.06);
  --shadow-lg: 0 8px 24px rgba(20, 20, 15, 0.12);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101014;
  --panel: #1c1c21;
  --panel-soft: #26262b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #71717a;
  --accent-soft: rgba(47, 107, 255, 0.18);
  --accent-faint: rgba(47, 107, 255, 0.1);
  --accent-text: #8ab0ff;
  --amber-bg: rgba(242, 201, 121, 0.13);
  --amber-text: #f2c979;
  --green-bg: rgba(34, 163, 85, 0.15);
  --green-text: #4ade80;
  --blue-bg: rgba(91, 140, 255, 0.15);
  --blue-text: #8ab0ff;
  --danger: #f87171;
  --gate-bg: #101014;
  --gate-raised: #303036;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45);
}
[data-theme="dark"] .tag { border: 1px solid var(--border); }
[data-theme="light"] .tag { border: 0; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

button {
  font: inherit;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--panel-soft); }
button:disabled { opacity: 0.5; cursor: default; }

input, textarea, select {
  font: inherit;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.app { display: flex; flex-direction: column; height: 100vh; }

/* ---- top bar: project pills + actions ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.tabs { display: flex; gap: 8px; flex: 1; align-items: center; overflow-x: auto; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 999px;
  padding: 5px 14px 5px 6px;
  font-weight: 600;
  white-space: nowrap;
}
.tab:hover { background: var(--panel-soft); }
.tab.active { background: var(--panel-soft); border-color: var(--border); }
.tab .avatar {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #4a7dff;
}
.tab .count, h2 .count {
  font-size: 12px;
  font-weight: 700;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 7px;
  color: var(--muted);
}
h2 .count { margin-left: 8px; }
.tab.add {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 5px 16px;
}
.tab.add:hover { background: var(--accent); filter: brightness(0.92); }
.topbar .iconbtn {
  border-radius: 50%;
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar .iconbtn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.bell { position: relative; }
.bell .badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 320px;
  max-height: 420px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 30;
}
.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.notif-list li { padding: 8px; border-radius: var(--radius-sm); }
.notif-list li + li { border-top: 1px solid var(--border); }
.notif-list p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

/* ---- onboarding coachmark ---- */
/* ---- product tour: dim layers never take pointer events, so the
 *  app stays fully usable while the card is up. ---- */
.tour-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 12, 0.28);
  z-index: 200;
  pointer-events: none;
}
.tour-highlight {
  position: fixed;
  z-index: 201;
  pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 0 0 4000px rgba(15, 15, 12, 0.28);
}
.tour-tip {
  position: fixed;
  z-index: 202;
  width: 320px;
  max-width: calc(100vw - 16px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 16px;
}
.tour-tip.centered {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.tour-brand {
  margin: 0 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tour-brand svg { color: var(--accent); flex-shrink: 0; }
.tour-tip h2 { margin: 0 0 6px; font-size: 17px; }
.tour-tip p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.tour-tip p strong { color: var(--text); }
.tour-progress { font-variant-numeric: tabular-nums; }
.tour-actions { display: flex; align-items: center; gap: 12px; }
.tour-tip .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
}
.tour-tip .linklike { border: 0; background: none; color: var(--muted); }
.tour-close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
}

/* ---- body layout ---- */
.body { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 12px;
  /* Only the conversation list scrolls — the usage footer stays
   *  pinned to the bottom. (Overlays are fixed-position, unaffected.) */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.convo-list { flex: 1; min-height: 0; overflow-y: auto; }
.section-tabs { display: flex; gap: 4px; flex-shrink: 0; }
.section-tabs button {
  border-color: transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  white-space: nowrap;
  padding-left: 10px;
  padding-right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.section-tabs button svg { flex-shrink: 0; }
/* Sidebar row: three pills share one line — tighter padding, and the
 * labels may shrink/clip on narrow sidebars instead of overflowing. */
.sidebar .section-tabs button {
  min-width: 0;
  overflow: hidden;
  padding-left: 6px;
  padding-right: 6px;
}
/* Drag handles between the panes. */
.resize-handle {
  width: 7px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  border: 0;
  padding: 0;
}
.resize-handle:hover,
.resize-handle:focus-visible {
  background: var(--border-strong);
  outline: none;
}
.section-tabs button.active {
  background: var(--panel-soft);
  border-color: var(--border);
  color: var(--text);
  font-weight: 600;
}

/* ---- full-width pages (Files, Workflows): span all lanes ---- */
.page {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 20px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.page-head { display: flex; align-items: center; gap: 12px; }
.page-head h1 { margin: 0; font-size: 24px; }
.page-head .spacer { flex: 1; }
.page-head .search { margin-bottom: 0; width: 280px; flex-shrink: 1; min-width: 0; }
.newfile-menu { position: relative; flex-shrink: 0; }
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.doc-card { cursor: pointer; min-height: 170px; }
.doc-card h3 { margin: 0 0 6px; font-size: 15px; }
.doc-excerpt {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.doc-add {
  min-height: 170px;
  border-style: dashed;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
}
.doc-editor textarea { width: 100%; min-height: 220px; font-size: 14px; }
.doc-editor .fileeditor-head input { flex: 1; min-width: 0; }

/* ---- workflows page ---- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 999px;
  padding: 4px 14px;
  color: var(--muted);
}
.chips button.active { background: var(--panel-soft); border-color: var(--border); color: var(--text); font-weight: 600; }
.wf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.wf-card.active { border-color: var(--accent, #2f6bff); }
.wf-open {
  border: 0;
  background: none;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.wf-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--panel-soft);
  font-size: 13px;
  flex-shrink: 0;
}
.wf-name { overflow: hidden; text-overflow: ellipsis; }
.wf-desc {
  margin: 8px 0;
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}
.page-foot { display: flex; align-items: center; gap: 12px; }
.page-foot .spacer { flex: 1; }
.newcollection input { border: 0; background: transparent; width: 180px; }
.native-caps summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.native-caps ul { font-size: 13px; display: flex; flex-direction: column; gap: 6px; }

/* ---- conversations list ---- */
.convo-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.convo-head h2 { margin: 0; font-size: 17px; flex: 1; display: flex; align-items: center; gap: 7px; }
.convo-head h2 svg, .usage h2 svg, .activity-bar h2 svg { flex-shrink: 0; }
.convo-head .newbtn {
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-size: 18px;
  line-height: 1;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--faint);
  /* Same 8px rhythm as the conversation cards below. */
  margin-bottom: 8px;
}
.search input { border: 0; background: none; padding: 0; flex: 1; min-width: 0; }
.search input:focus-visible { outline: none; }
.search:focus-within { border-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button {
  border-color: transparent;
  background: transparent;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  color: var(--muted);
}
.chips button.active { background: var(--panel-soft); border-color: var(--border); color: var(--text); font-weight: 600; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  margin: 8px 0;
}
.convo-card { cursor: pointer; }
.convo-card:hover { border-color: var(--border-strong); }
.needs-head { margin: 8px 0 0; font-size: 12px; font-weight: 600; color: var(--accent-text); }
/* Side inset: the scrolling list clips at its own box, so the stack
 *  sits 10px inside on each side to give the glow room to render. */
.needs-stack { display: flex; flex-direction: column; gap: 8px; margin: 6px 10px 12px; }
.needs-card {
  border-color: var(--accent);
  animation: needs-pulse 2.4s ease-in-out infinite;
}
@keyframes needs-pulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--accent), 0 0 8px rgba(47, 107, 255, 0.25); }
  50% { box-shadow: 0 0 0 2px var(--accent), 0 0 20px rgba(47, 107, 255, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  .needs-card { animation: none; box-shadow: 0 0 0 1px var(--accent), 0 0 16px rgba(47, 107, 255, 0.35); }
}
.ctxmenu {
  position: fixed;
  z-index: 42;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.ctxmenu button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}
.ctxmenu button:hover { background: var(--panel-soft); }
.trace-turn { border-bottom: 1px solid var(--border); padding: 10px 0; }
.trace-turn:last-child { border-bottom: 0; }
.trace-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.trace-head .meta { color: var(--muted); }
.trace-head .spacer { flex: 1; }
.trace-steps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.trace-steps li { display: flex; gap: 8px; align-items: baseline; }
.trace-steps .tname { font-weight: 600; }
.trace-steps .done-mark { color: var(--accent-text); }
.convo-card.selected { background: var(--accent-soft); border-color: #c3d4ff; }
.convo-card h3 { margin: 6px 0 4px; font-size: 14px; }
.convo-card .card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.convo-card .card-top .spacer { flex: 1; }
.convo-card .snippet {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.convo-card .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.convo-card .meta .spacer { flex: 1; }
.convo-card .meta .agent { display: inline-flex; align-items: center; gap: 4px; }
.convo-card .meta .agent svg { flex-shrink: 0; }
.convo-card .card-actions { display: flex; gap: 8px; margin-top: 8px; }
.convo-card .card-actions button { padding: 3px 12px; font-size: 13px; }
.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
}
.tag.t-claude { background: #fbe9dd; color: #d97757; }
.tag.t-codex { background: #000000; color: #ffffff; }
.tag.t-muse { background: #e3edff; color: #0866ff; }
.tag.t-opencode { background: #ececea; color: #111111; }
.tag.t-ollama { background: #f5e9e2; color: #9a5b3c; }
.tag.t-plain { background: var(--panel-soft); color: var(--muted); border: 1px solid var(--border); }
.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.pill.working { background: var(--amber-bg); color: var(--amber-text); }
.pill.native { background: var(--blue-bg); color: var(--blue-text); }
.exec-env { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 12px; margin: 0 0 16px; }
.exec-env legend { font-weight: 600; padding: 0 4px; }
.exec-env label { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; cursor: pointer; }
.exec-env label span { display: flex; flex-direction: column; }
.exec-env label small { color: var(--muted); }
.exec-env .hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.exec-wrap { position: relative; display: inline-block; }
.exec-ind { border: 0; cursor: pointer; font-variant-numeric: tabular-nums; }
.exec-pop {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: 300px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  z-index: 41;
}
.exec-pop-sub { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.exec-pop ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.exec-pop li + li { border-top: 1px solid var(--border); padding-top: 8px; }
.exec-pop-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.exec-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.exec-pop-activity { margin: 2px 0; font-size: 13px; }
.exec-pop-status { margin: 0; font-size: 12px; color: var(--green-text); }
.exec-stale { color: var(--muted); }
.pill.needs { background: var(--blue-bg); color: var(--blue-text); }
.pill.done { background: var(--green-bg); color: var(--green-text); }
.pill.failed { background: #fbe3e3; color: #b3261e; }
/* Capability can't be verified right now (e.g. its CLI is missing). */
.pill.unknown { background: transparent; color: var(--muted); border: 1px dashed var(--border); }
.convo-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  margin-top: auto;
  padding-top: 8px;
}
.convo-foot label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---- thread ---- */
.conversation {
  flex: 1;
  min-width: 0;
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.thread { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.thread.empty { align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.thread.empty .suggestions { align-items: stretch; width: 100%; }
.thread.empty .empty-mark { display: inline-flex; margin-bottom: 4px; filter: drop-shadow(0 4px 12px rgba(43, 127, 255, 0.25)); }
.thread-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.thread-head h1 { font-size: 21px; margin: 0; font-weight: 650; }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.crumb code.agent { display: inline-flex; align-items: center; gap: 5px; }
.crumb code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 7px;
}
.msg {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  font-size: 14px;
  max-width: 100%;
}
.msg.user { background: var(--accent-soft); border-color: #c3d4ff; }
/* Side exchanges (/btw): set apart — never part of the task. */
.msg.side_question, .msg.side_answer { border-style: dashed; background: transparent; font-size: 13px; }
.msg .who { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.agentline { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; font-size: 13px; }
.agentline strong { font-size: 14px; }
.agentline time { color: var(--faint); }

/* decision card (needs-you) */
.decision { padding: 16px; }
.decision .count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
}
.decision h2 { margin: 10px 0 12px; font-size: 17px; }
.decision .options { display: flex; flex-direction: column; gap: 8px; }
.decision .options button {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
}
.decision .options button:hover:not(:disabled) { border-color: var(--accent); }
.decision .options button.picked { border-color: var(--accent); background: var(--accent-soft); }
.decision .options .radio {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: inline-block;
}
.decision .options button.picked .radio { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px #fff; }
/* Multi-question blocks: one fieldset per question, same 8px
 * rhythm as the single layout. The checkbox mirrors the radio
 * glyph, square with a filled check when picked. */
.decision .qblock { border: 0; margin: 12px 0 0; padding: 0; }
.decision .qblock legend { margin-bottom: 8px; padding: 0; font-size: 15px; font-weight: 600; }
.decision .qblock input { width: 100%; }
/* Typed "Other" answer under the options (AskUserQuestion). */
.decision .other-answer { display: block; width: 100%; margin-top: 8px; }
/* Option label with the agent's description / preview under it. */
.decision .options .opt-text { display: flex; flex-direction: column; gap: 2px; text-align: left; min-width: 0; }
.decision .opt-desc { color: var(--muted); font-size: 12px; font-weight: 400; }
.decision .opt-preview { margin: 4px 0 0; padding: 6px 8px; font-size: 12px; background: var(--surface-2, rgba(0,0,0,0.04)); border-radius: 6px; white-space: pre-wrap; overflow-x: auto; max-width: 100%; }
/* Structured tool approval: what would run, where, and why. */
.decision .approval-body { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 4px 0 12px; font-size: 13px; }
.decision .approval-body dt { color: var(--muted); }
.decision .approval-body dd { margin: 0; display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.decision .approval-diff { margin: 0; width: 100%; max-height: 240px; overflow: auto; padding: 6px 8px; font-size: 12px; background: var(--surface-2, rgba(0,0,0,0.04)); border-radius: 6px; white-space: pre; }
.decision .options .checkbox {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 2px solid var(--border-strong);
  display: inline-block;
}
.decision .options button.picked .checkbox { border-color: var(--accent); background: var(--accent); color: #fff; font-size: 12px; line-height: 12px; text-align: center; }
.decision .options button.picked .checkbox::after { content: '✓'; }
.decision .confirm {
  margin-top: 12px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
  padding: 8px 22px;
}
.decision .confirm:disabled { opacity: 0.45; cursor: default; }
.decision .confirm-row { display: flex; gap: 8px; margin-top: 12px; }
.decision .confirm-row .confirm { margin-top: 0; }
.decision .cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  font-weight: 600;
  padding: 8px 22px;
}
.decision .cancel:hover:not(:disabled) { border-color: var(--text); }
.decision .cancel:disabled { opacity: 0.45; cursor: default; }
.decision .answer-row { display: flex; gap: 8px; margin-top: 4px; }
.decision .answer-row input { flex: 1; min-width: 0; }
.decision .answer-row .confirm { margin-top: 0; }
.statusline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

/* ---- prompt box ---- */
.prompt {
  margin-top: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prompt textarea {
  border: 0;
  resize: none;
  min-height: 44px;
  padding: 2px 4px;
  font-size: 14px;
}
.prompt textarea:focus-visible { outline: none; }
.prompt:focus-within { border-color: var(--accent); }
.prompt-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* Round controls never shrink: at narrow widths they move into the
 * ☰ / send menus (composerLayout) instead of squashing into ovals. */
.prompt-row .attach {
  border-radius: 50%;
  width: 30px;
  height: 30px;
  flex: none;
  padding: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.prompt-row .agentmenu-wrap { min-width: 0; flex: 0 1 auto; }
.prompt-row .agentmenu-toggle { max-width: 100%; min-width: 0; }
.agentmenu-toggle.compact { padding: 4px 6px 4px 4px; gap: 4px; }
.prompt-row .contextpill, .prompt-row .side-ask { flex: none; white-space: nowrap; }
.composer-menu-wrap { position: relative; flex: none; }
.menu-list.composer-menu { left: 0; right: auto; top: auto; bottom: calc(100% + 6px); min-width: 220px; }
.menu-list.composer-menu button { display: flex; align-items: center; gap: 10px; }
.send-group { position: relative; display: inline-flex; align-items: center; gap: 2px; flex: none; }
.send-group .send-more { width: 24px; height: 34px; padding: 0; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: 12px; flex: none; }
.menu-list.send-menu { right: 0; left: auto; top: auto; bottom: calc(100% + 6px); min-width: 180px; }
.prompt-row select { border-color: transparent; background: transparent; color: var(--muted); }
.prompt-row .contextpill {
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-soft);
  border-color: var(--border);
}
.prompt-row .spacer { flex: 1; }
.prompt-row .send {
  border-radius: 50%;
  width: 34px;
  height: 34px;
  flex: none;
  padding: 0;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---- files / workflows / settings panes ---- */
.gitline { font-size: 13px; color: var(--muted); }
.filelist { list-style: none; padding: 0; margin: 4px 0; font-size: 14px; }
.filelist li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}
.filelist li:last-child { border-bottom: 0; }
.filelist button { padding: 3px 10px; font-size: 13px; }
.filelist small { color: var(--muted); }
.filelist .spacer { flex: 1; }
.filelist .filerow { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.filelist .fileopen {
  border: 0;
  background: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}
.filelist .fileopen:hover { color: var(--accent-text); text-decoration: underline; }
.filelist .fileattach { margin-left: auto; flex-shrink: 0; }
.filelist .dirnode { flex-direction: column; align-items: stretch; gap: 0; }
.filelist .chevron { display: inline-block; width: 1em; color: var(--muted); }
.filelist .nested { margin-left: 18px; }
.newfile { display: flex; gap: 6px; margin-top: 8px; }
.newfile input { flex: 1; min-width: 0; }
.fileeditor { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: var(--panel-soft); }
.fileeditor-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.fileeditor-head code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.fileeditor textarea { width: 100%; min-height: 160px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.fileeditor .options { display: flex; gap: 8px; margin-top: 8px; }
.runs h3 { font-size: 14px; margin: 12px 0 4px; }
.run-detail { cursor: default; }
.run-detail .options { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.run-detail form { display: flex; gap: 6px; margin-top: 8px; }
.run-detail input { flex: 1; min-width: 0; }
.card.credential { cursor: default; }
.card.credential form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.card.credential form label { display: flex; flex-direction: column; gap: 4px; }
.card.credential .options { display: flex; gap: 8px; flex-wrap: wrap; }
.card.credential .options button.active { border-color: var(--border-strong); font-weight: 600; }
.card.credential .meta { color: var(--muted); font-size: 12px; }
.caps { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.caps .pill { margin-right: 6px; }
.caps-list { margin-top: 8px; }
.caps-list summary { cursor: pointer; font-size: 13px; color: var(--muted); }
/* Route comparison: two columns side by side, stacking on narrow cards. */
.caps-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 16px; margin-top: 6px; }
.caps-col > p { margin: 0; font-size: 13px; }
.gitops { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
.gitops form { display: flex; flex-direction: column; gap: 8px; }
.gitops .options { display: flex; gap: 8px; }
.gitops textarea { width: 100%; min-height: 76px; font-family: inherit; font-size: 13px; }
.changerow { display: flex; align-items: center; gap: 8px; }
.changerow label { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.changepath { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.changebadges { display: inline-flex; gap: 2px; }
.badge { display: inline-block; min-width: 16px; text-align: center; font-style: normal; font-size: 12px; font-weight: 700; border-radius: 4px; padding: 0 3px; }
.badge.empty { min-width: 16px; }
.badge.added { color: var(--success, #1a7f37); }
.badge.modified { color: var(--accent); }
.badge.deleted { color: var(--danger, #cf222e); }
.badge.renamed { color: var(--muted); }
.badge.untracked { font-weight: 400; color: var(--muted); }
.badge.conflict { color: var(--danger, #cf222e); }
.diffpreview { max-height: 240px; overflow: auto; font-size: 12px; white-space: pre-wrap; word-break: break-word; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.updates { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
.updates h3 { font-size: 14px; margin: 0 0 4px; }
.updates p { font-size: 13px; color: var(--muted); }

/* ---- usage footer ---- */
.usage { margin-top: auto; flex-shrink: 0; border-top: 1px solid var(--border); padding-top: 10px; }
.usage h2 { font-size: 13px; margin: 0 0 4px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.usage p { font-size: 13px; margin: 0; }
.usage-total { font-weight: 700; }
.usage-list { list-style: none; padding: 0; margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.usage-list li { margin: 2px 0; }

/* ---- browser panel ---- */
.browser {
  width: 420px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.browser-bar { display: flex; gap: 6px; align-items: center; padding: 10px; border-bottom: 1px solid var(--border); }
/* Fullscreen overlay: same panel, stretched over the window. The
 * element stays mounted, so the frame keeps its page and history. */
.browser.full {
  position: fixed;
  inset: 0;
  width: auto;
  z-index: 60;
  border-left: 0;
}
.browser-bar input { flex: 1; min-width: 0; background: var(--panel-soft); border-color: var(--border); }
/* Site icon left of the address bar: hidden until a candidate
 * loads (display:none still fires load/error), so pages without
 * an icon leave no gap. */
.browser-bar img.favicon { width: 16px; height: 16px; flex-shrink: 0; border-radius: 4px; }
.browser-bar img.favicon.pending { display: none; }
.browser-status {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
.browser-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }
.browser-status .dot.on { background: #22a355; }
.browser-status button { margin-left: auto; font-size: 13px; }
.preview-entry { padding: 4px 10px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.browser-body { flex: 1; min-height: 0; }
.browser-body iframe { width: 100%; height: 100%; min-height: 280px; border: 0; background: var(--panel); }
.browser-body p { padding: 14px; font-size: 14px; color: var(--muted); }

/* ---- agent activity panel ---- */
.activity {
  width: 360px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.activity-bar { display: flex; gap: 6px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.activity-bar h2 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.activity-bar .spacer { flex: 1; }
.activity-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; }
.act-scope { margin: 0 0 4px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-counts { margin: 0 0 12px; font-size: 13px; font-weight: 600; }
.act-empty { font-size: 13px; color: var(--muted); }
.act-roots, .act-children { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.act-children { margin-top: 10px; padding-left: 14px; border-left: 2px solid var(--border); }
.act-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--panel-soft); }
.act-card-head { display: flex; align-items: center; gap: 8px; }
.act-card-head .spacer { flex: 1; }
.act-twist { border: 0; background: transparent; padding: 0 2px; cursor: pointer; min-width: 18px; color: var(--muted); }
.act-agent { display: inline-flex; align-items: center; gap: 6px; }
.act-task { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
/* Vendor-runtime task tag (CLI subagent / background task). */
.act-kind { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; }
.act-activity { margin: 6px 0 0; font-size: 13px; }
.act-activity + .act-activity { margin-top: 2px; }
.act-fresh { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.act-error { margin: 6px 0 0; font-size: 13px; color: var(--danger); }
.act-result { margin: 6px 0 0; font-size: 13px; color: var(--green-text); }
.act-conflict { margin: 6px 0 0; font-size: 13px; color: var(--amber-text); }
.act-shared { margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.act-cancel { margin-top: 8px; font-size: 13px; }
.act-cancel-row { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.act-cancel-row button { font-size: 13px; }
.act-more { font-size: 12px; color: var(--muted); padding: 4px 2px; }
.pill.muted { background: var(--panel-soft); color: var(--muted); border: 1px solid var(--border); }
.exec-view-all { margin-top: 10px; width: 100%; font-size: 13px; }

/* Rename / archive / location / workflow-create / notifications. */
.cardx {
  border: 0;
  background: transparent;
  padding: 0 4px;
  font-size: 15px;
  line-height: 1;
  color: var(--faint);
}
.cardx:hover:not(:disabled) { background: transparent; color: var(--text); }
.convo-card h3[role='button'] { cursor: pointer; }
.rename-input { width: 100%; font-size: inherit; font-weight: inherit; }
.thread-head .spacer { flex: 1; }
.thread-head h1 { cursor: pointer; }
.tabwrap { display: inline-flex; align-items: center; }
.tabwrap.droptarget .tab { border-color: var(--accent); border-style: dashed; }
/* Draggable tabs: no text-selection drag to fight the tab drag. */
.tabs .tab { cursor: grab; user-select: none; -webkit-user-select: none; }
.tabx {
  border: 0;
  background: transparent;
  padding: 2px 6px;
  font-size: 14px;
  line-height: 1;
  color: var(--faint);
  border-radius: var(--radius-sm);
}
.tabx:hover:not(:disabled) { background: var(--panel-soft); color: var(--text); }
.location { font-size: 13px; color: var(--muted); margin: 2px 0 8px; }
.location code { color: var(--text); }
.location-form { display: flex; gap: 6px; margin-top: 6px; }
.location-form input { flex: 1; min-width: 0; }
.wf-create { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.wf-create h3 { margin: 0; }
.wf-create label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.wf-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.wf-step-head { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.wf-steps input, .wf-steps select { width: 100%; margin-top: 4px; }
.wf-examples summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.wf-examples ul { font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.wf-examples code, .wf-steps code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.run-detail h3 .run-tail {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: normal;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
  display: inline-block;
  vertical-align: bottom;
}
.notif-panel { min-width: 280px; }
.notif-head, .notif-row { display: flex; align-items: center; gap: 6px; }
.notif-head .spacer, .notif-row .spacer { flex: 1; }
.notif-head { padding: 8px 8px 4px; }

/* Settings tabs + agent sub-tabs. */
.settings-tabs { flex-wrap: wrap; margin-bottom: 10px; }

/* New-project modal. */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 15, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  width: 380px;
  max-width: calc(100vw - 40px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal h2 { margin: 0; font-size: 17px; }
.modal label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.modal .location-row { display: flex; gap: 6px; }
.modal .location-row input { flex: 1; min-width: 0; }
.modal .checkline { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.props { display: flex; flex-direction: column; gap: 8px; margin: 0; font-size: 13px; }
.props div { display: flex; gap: 8px; }
.props dt { flex: 0 0 120px; color: var(--muted); }
.props dd { margin: 0; word-break: break-all; }
.about-head { display: flex; align-items: center; gap: 12px; }
.about-head h2 { margin: 0; }
.about-head p { margin: 0; color: var(--muted); }

/* Empty-thread prompt suggestions. */
.suggestions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; max-width: 560px; }
.suggestions p { margin: 0; color: var(--muted); font-size: 13px; }
.suggestions button { text-align: left; }

/* Title-bar menu + wide settings modal. */
.titlemenu { position: relative; }
.menu-scrim { position: fixed; inset: 0; z-index: 40; }
.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 160px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  list-style: none;
  margin: 0;
  z-index: 41;
}
.menu-list button { width: 100%; text-align: left; border: 0; background: transparent; }
.menu-list button:hover:not(:disabled) { background: var(--panel-soft); }
.modal-wide { width: 640px; height: min(600px, calc(100vh - 80px)); overflow: hidden; }
.modal-body { flex: 1; min-height: 0; overflow-y: auto; }
.modal-head { display: flex; align-items: center; gap: 6px; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-head .spacer { flex: 1; }

/* ---- composer agent + model menu ---- */
.agentmenu-wrap { position: relative; }
.agentmenu-toggle {
  border-color: transparent;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  max-width: 260px;
}
.agentmenu-toggle .agentcol { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.agentmenu-toggle .agentname { font-weight: 600; font-size: 13px; }
.agentmenu-toggle .agentsub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.tag.avatar {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.tag.avatar svg {
  width: 18px;
  height: 18px;
  display: block;
}
.agentmenu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 290px;
  max-width: 340px;
  max-height: 340px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 41;
}
.agentmenu:focus { outline: none; }
.agentrow { border-radius: var(--radius-sm); }
.agentpick {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
}
/* Row tints, all flat, no glow: hovering or selecting tints the whole
 *  two-line row uniformly; at rest the model line keeps a lighter wash
 *  so it reads as clickable. */
.agentrow:hover, .agentrow.selected { background: var(--accent-soft); }
.agentrow:hover button.modelpick, .agentrow.selected button.modelpick { background: transparent; }
.agentpick .spacer { flex: 1; }
.modelpick {
  display: block;
  width: calc(100% - 46px);
  margin: 0 0 4px 46px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
  padding: 2px 10px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
button.modelpick { background: var(--accent-faint); }
button.modelpick:hover { color: var(--text); }
.modelpick.dim { cursor: default; }
.modellist {
  margin: 0 6px 8px 46px;
  background: var(--panel-soft);
  border-radius: var(--radius-sm);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.modellist button {
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.modellist button:hover:not(:disabled) { background: var(--panel); }
.modellist button.checked { font-weight: 600; }
.modellist button .spacer { flex: 1; }
.modellist button .modelname {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modellist .customrow { display: flex; gap: 6px; padding: 4px; }
.modellist .customrow input { flex: 1; min-width: 0; font-size: 13px; }
.modellist .envnote { color: var(--muted); padding: 4px 8px; }
.modellist [role='status'] { color: var(--muted); padding: 2px 8px; }
.modellist [role='alert'] { color: var(--danger); padding: 2px 8px; }

/* ---- image attachments ---- */
.prompt.drag-over { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.attach-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.attach-chips li { display: flex; align-items: center; gap: 8px; background: var(--panel-soft); border: 1px solid var(--border); border-radius: 10px; padding: 4px 8px 4px 4px; font-size: 12px; color: var(--muted); }
.attach-chips img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.attach-chips svg { flex-shrink: 0; }
.prompt-row .attach.recording { color: var(--danger); border-color: var(--danger); }
.voice-live { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); }
.voice-live .spacer { flex: 1; }
.voice-live button { padding: 3px 10px; font-size: 13px; }
.voice-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex-shrink: 0; animation: voice-pulse 1.2s ease-in-out infinite; }
@keyframes voice-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .voice-dot { animation: none; } }
.voice-partial { font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-review { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--panel-soft); }
.voice-review small { color: var(--muted); font-size: 12px; }
.voice-review .options { display: flex; gap: 8px; }
.voice-review .options button { padding: 3px 10px; font-size: 13px; }
.attach-chips button { border: 0; background: transparent; font-size: 16px; line-height: 1; color: var(--muted); padding: 2px 4px; }
.msg-images { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.msg-images img { max-width: 220px; max-height: 160px; border-radius: 8px; border: 1px solid var(--border); }

/* ---- browser screenshot menu ---- */
.browser-body { position: relative; }
.browser-menu { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--border); }
.browser-menu button { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.browser-menu .shot-note { font-size: 12px; color: var(--muted); margin-left: auto; text-align: right; }
.browser-menu .shot-error { font-size: 12px; color: var(--danger); margin-left: auto; text-align: right; }
.shot-overlay { position: absolute; inset: 0; z-index: 5; cursor: crosshair; background: rgba(0, 0, 0, 0.12); }
.shot-rect { position: absolute; border: 1.5px dashed var(--accent); background: rgba(255, 255, 255, 0.18); }
.shot-hint { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: 12px; white-space: nowrap; }

/* ---- CLI sign-in dialog ---- */
.login-output { white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto; background: var(--panel-soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; }

/* ---- CLI install dialog ---- */
.install-command { white-space: pre-wrap; word-break: break-all; background: var(--panel-soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; }

/* ---- welcome / first-run gate ---- */
.welcome-error { color: var(--danger); font-size: 13px; }

/* ---- boot splash (follows system like the gates) ---- */
.boot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; height: 100vh; background: var(--gate-bg); color: var(--muted); font-size: 14px; }
.boot-mark { width: 64px; height: 64px; border-radius: 18px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
.boot p { margin: 0; }
.offline-banner { padding: 6px 12px; font-size: 12px; text-align: center; background: var(--panel-soft); border-bottom: 1px solid var(--border); color: var(--muted); }

/* ---- settings account panel ---- */
.account .row { display: flex; align-items: center; gap: 12px; }
.account-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.account-who { min-width: 0; }
.account-who strong, .account-email { display: block; overflow-wrap: anywhere; }
.account-email { font-size: 13px; }
.account .spacer { flex: 1; }
.account .muted { color: var(--muted); font-size: 13px; }
.account-status { margin: 12px 0; }
.account .primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.account h3 { margin: 20px 0 8px; font-size: 14px; }
.device-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.device-list li { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }

/* ---- updates panel + toast ---- */
.updates progress { width: 100%; height: 10px; margin-top: 8px; }
.updates-hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.update-box { position: fixed; right: 16px; bottom: 16px; z-index: 45; width: 360px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 14px 16px; color: var(--text); }
.update-box-x { position: absolute; top: 8px; right: 10px; background: none; border: none; padding: 2px 6px; color: var(--muted); font-size: 16px; cursor: pointer; }
.update-box-x:hover:not(:disabled) { color: var(--text); background: none; }
.update-box-title { font-weight: 600; font-size: 14px; padding-right: 20px; }
.update-box-notes { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.update-box-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.update-box-link { background: none; border: none; padding: 6px 0; color: #5b8cff; font-size: 13px; cursor: pointer; }
.update-box-link:hover:not(:disabled) { text-decoration: underline; background: none; }
.update-box-cta { padding: 8px 16px; border: 1px solid #2f6bff; border-radius: 10px; background: #2f6bff; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.update-box-cta:hover:not(:disabled) { background: #4d84ff; border-color: #4d84ff; }
.update-box-cta:disabled, .update-box-link:disabled, .update-box-x:disabled { opacity: 0.5; cursor: default; }

/* ---- trial / renewal gate ---- */
.trial { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gate-bg); padding: 24px; }
.trial-card { width: 400px; max-width: calc(100vw - 48px); background: var(--panel); border: 1px solid var(--border); border-radius: 24px; padding: 32px 32px 24px; color: var(--text); text-align: center; }
.trial-card h1 { font-size: 27px; margin: 14px 0 12px; letter-spacing: -0.01em; }
.trial-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.trial-marks { position: relative; display: flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.trial-marks::before { content: ''; position: absolute; left: 22%; top: 2px; width: 8px; height: 8px; border-radius: 50%; background: #f0a8c0; }
.trial-marks::after { content: ''; position: absolute; right: 22%; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: #f2c979; }
.trial-mark { display: inline-flex; align-items: center; justify-content: center; }
.trial-mark-main { width: 76px; height: 76px; border-radius: 22px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; z-index: 1; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); }
.trial-mark-left { width: 56px; height: 56px; border-radius: 16px; background: #f2c979; color: #7a5410; transform: rotate(-8deg); margin-right: -10px; }
.trial-mark-right { width: 56px; height: 56px; border-radius: 16px; background: #8fdcc9; color: #0b6b5a; transform: rotate(8deg); margin-left: -10px; }
.trial-pill { display: inline-block; margin: 0; padding: 6px 14px; border-radius: 999px; background: var(--amber-bg); color: var(--amber-text); font-size: 13px; font-weight: 600; }
.trial-feats { list-style: none; margin: 0 0 18px; padding: 0 0 18px; border-bottom: 1px solid var(--border); text-align: left; }
.trial-feats li { position: relative; padding-left: 28px; font-size: 15px; }
.trial-feats li::before { content: '✓'; position: absolute; left: 4px; color: #5b8cff; font-weight: 700; }
.trial-prices { display: flex; gap: 16px; margin: 0 0 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); text-align: left; }
.trial-prices > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.trial-prices strong { font-size: 21px; letter-spacing: -0.01em; }
.trial-prices span { color: var(--muted); font-size: 13px; }
.trial-prices-single > div { text-align: center; }
.trial-cta { width: 100%; padding: 13px; border: 1px solid #2f6bff; border-radius: 12px; background: #2f6bff; color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; }
.trial-cta:hover:not(:disabled) { background: #4d84ff; border-color: #4d84ff; }
.trial-quiet { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; margin-top: 14px; }
.trial-quiet button { background: none; border: none; padding: 4px 2px; color: var(--muted); font-size: 13px; cursor: pointer; }
.trial-quiet button:hover:not(:disabled) { color: var(--text); text-decoration: underline; }
.trial-fine { color: var(--faint); font-size: 12px; margin: 14px 0 0; }
.trial-error { color: var(--danger); font-size: 13px; margin: 14px 0 0; }
.trial-error button { background: none; border: none; padding: 0; color: var(--danger); font-size: 13px; cursor: pointer; text-decoration: underline; }
.trial-error button:hover:not(:disabled) { background: none; }

/* ---- login gate (no card panel) ---- */
.login { position: relative; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gate-bg); padding: 72px 24px 24px; }
.login-top { position: absolute; top: 18px; left: 22px; display: flex; align-items: center; gap: 10px; }
.login-brand { width: 32px; height: 32px; display: inline-flex; flex: none; }
.login-brand-name { color: var(--text); font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.login-card { width: 460px; max-width: calc(100vw - 48px); color: var(--text); text-align: center; }
.login-card h1 { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 44px; }
.login-swoosh { position: relative; display: inline-block; }
.login-swoosh .login-chain { position: absolute; left: -6px; top: calc(100% - 7px); width: 140px; height: 42px; }
.login-marks { position: relative; display: flex; align-items: center; justify-content: center; margin-bottom: 22px; }
.login-marks::before { content: ''; position: absolute; left: 26%; top: 0; width: 8px; height: 8px; border-radius: 50%; background: #f0a8c0; }
.login-marks::after { content: ''; position: absolute; right: 25%; top: 6px; width: 6px; height: 6px; border-radius: 50%; background: #f2c979; }
.login-mark { display: inline-flex; align-items: center; justify-content: center; }
.login-mark-main { width: 88px; height: 88px; border-radius: 26px; background: #fff; color: var(--accent); display: flex; align-items: center; justify-content: center; transform: rotate(3deg); z-index: 1; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); }
.login-mark-files { width: 62px; height: 62px; border-radius: 18px; background: #f2c979; color: #7a5410; transform: rotate(-8deg); margin-right: -12px; }
.login-mark-workflows { width: 62px; height: 62px; border-radius: 18px; background: #8fdcc9; color: #0b6b5a; transform: rotate(8deg); margin-left: -12px; }
.login-google { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border: 1px solid var(--border-strong); border-radius: 16px; background: var(--panel-soft); color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer; }
.login-google:hover:not(:disabled) { background: var(--gate-raised); border-color: rgba(128, 128, 128, 0.45); }
.login-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--faint); font-size: 13px; }
.login-or::before, .login-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-email { width: 100%; padding: 15px; border: 1px solid #2f6bff; border-radius: 999px; background: #2f6bff; color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; }
.login-email:hover:not(:disabled) { background: #4d84ff; border-color: #4d84ff; }
.login-hint { color: var(--faint); font-size: 12px; margin: 12px 0 20px; }
.login-links { display: flex; justify-content: center; gap: 28px; }
.login-links button { display: inline-flex; align-items: center; gap: 7px; background: none; border: none; padding: 4px 2px; color: var(--muted); font-size: 14px; cursor: pointer; }
.login-links button:hover:not(:disabled) { color: var(--text); background: none; }
.login-pending p { color: var(--muted); font-size: 14px; }
.login-fallback code { display: block; margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--panel-soft); color: var(--text); font-size: 12px; word-break: break-all; }
.login-ghost { margin-top: 12px; padding: 10px 22px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; color: var(--text); font-size: 14px; cursor: pointer; }
.login-ghost:hover:not(:disabled) { background: var(--panel-soft); }
.login-error { color: var(--danger); font-size: 13px; margin: 16px 0 0; }
.login-error button { background: none; border: none; padding: 0; color: var(--danger); font-size: 13px; cursor: pointer; text-decoration: underline; }
.login-error button:hover:not(:disabled) { background: none; }
.login-fine { color: var(--faint); font-size: 12px; margin: 20px 0 0; }
.login-legal { margin: 10px 0 0; font-size: 12px; }
.login-legal a { color: var(--muted); }

/* Composer: Queue states what Send would do while the agent works;
 * Ask on the side (/btw) never interrupts it. */
.prompt .send.queue { width: auto; padding: 0 12px; gap: 6px; display: inline-flex; align-items: center; border-radius: 999px; }
.prompt .send .send-label { font-size: 13px; font-weight: 600; }
.prompt .side-ask { border: 1px dashed var(--border); background: transparent; color: var(--text); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.prompt .side-ask:disabled { opacity: 0.5; cursor: default; }

/* Fork action in the thread header. */
.fork-btn { border: 1px solid var(--border); background: transparent; color: var(--text); border-radius: 999px; padding: 2px 10px; font-size: 12px; }

/* A feature this agent's route only partly supports (e.g. images
 * described in text): said plainly, never alarming. */
.limit-notice { margin: 4px 0 0; color: var(--muted); }

/* ---- resize resilience ----
 * Panes give up width in a fixed order instead of crushing the
 * conversation, round controls keep their shape (flex: none), and
 * long unbroken text (paths, commands, URLs) wraps inside its card. */
.sidebar { min-width: 220px; flex-shrink: 1; }
.browser, .activity { min-width: 260px; flex-shrink: 1; }
.conversation { min-width: 320px; }
.resize-handle { flex: none; }
.topbar .iconbtn, .convo-head .newbtn, .convo-head button { flex: none; }
.tabs .tabwrap, .tabs .tab { flex: none; }
.convo-head h2 { min-width: 0; }
.msg { min-width: 0; overflow-wrap: anywhere; }
.msg pre { max-width: 100%; overflow-x: auto; white-space: pre; }
.act-card { min-width: 0; overflow-wrap: anywhere; }
.act-card-head { flex-wrap: wrap; row-gap: 4px; min-width: 0; }
.act-agent { min-width: 0; }
.act-task, .act-activity, .act-fresh, .act-error, .act-result, .act-conflict, .act-shared, .act-counts { overflow-wrap: anywhere; }
.activity-bar h2, .browser-bar h2 { min-width: 0; }
@media (max-width: 1100px) {
  .conversation { padding: 14px 16px; }
}
.thread-head h1 { min-width: 0; overflow-wrap: anywhere; }
.tabs .tabwrap.dragging { opacity: 0.55; }
.tabs.reordering, .tabs.reordering * { cursor: grabbing !important; }

/* ---- Settings → Models: connection block ---- */
.connect { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-soft); }
.connect-verdict { margin: 0; font-size: 14px; font-weight: 600; }
.connect-verdict.done { color: var(--green-text); }
.connect-verdict.working { color: var(--amber-text); }
.connect-verdict.failed { color: var(--danger); }
.connect-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--border); }
.connect-what { display: flex; flex-direction: column; gap: 2px; flex: 1 1 220px; min-width: 0; }
.connect-what small { color: var(--muted); overflow-wrap: anywhere; }
.connect-actions { display: flex; gap: 6px; flex: none; }
.connect-rule { color: var(--muted); }
/* Narrow sidebar: section pills wrap to a second line instead of
 * clipping their labels. */
.sidebar .section-tabs { flex-wrap: wrap; row-gap: 4px; }
.sidebar .section-tabs button { flex: none; overflow: visible; }

/* ---- tab and agent icons ---- */
.chips button { display: inline-flex; align-items: center; gap: 6px; }
.chips button > svg { flex: none; }
.tag.avatar.mini { width: 20px; height: 20px; border-radius: 6px; vertical-align: -5px; }
.tag.avatar.mini svg { width: 15px; height: 15px; }
.msg .who { display: flex; align-items: center; gap: 6px; }
code.agent { display: inline-flex; align-items: center; gap: 6px; }

/* ---- live activity tail on conversation cards ---- */
.card-live { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 6px; min-width: 0; }
.card-live-toggle { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 2px 0; font-size: 12px; color: var(--muted); cursor: pointer; }
.card-live-toggle:hover { color: var(--text); }
.card-live-caret { width: 12px; display: inline-block; text-align: center; font-size: 13px; }
.card-live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber-text); animation: card-live-pulse 1.4s ease-in-out infinite; }
@keyframes card-live-pulse { 50% { opacity: 0.35; } }
.card-live-lines { list-style: none; margin: 4px 0 0; padding: 6px 8px; border-radius: 6px; background: var(--panel-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.card-live-lines li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-live-lines li::before { content: '› '; opacity: 0.6; }
.card-live-lines li.latest { color: var(--text); }
@media (prefers-reduced-motion: reduce) { .card-live-dot { animation: none; } }
