/* Bajuun AI · design system
   ------------------------------------------------------------------------ */
:root {
  --bg: #09090b;
  --bg-2: #0f0f12;
  --bg-3: #17171b;
  --bg-hover: #1d1d22;
  --surface: rgba(24, 24, 29, .72);
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --accent: #3d9bff;
  --accent-2: #22c3ff;
  --accent-soft: rgba(61, 155, 255, .13);
  --grad: linear-gradient(135deg, #1d4ed8 0%, #2f80ff 50%, #22c3ff 100%);
  --add: #4ade80;
  --add-bg: rgba(74, 222, 128, .09);
  --del: #f87171;
  --del-bg: rgba(248, 113, 113, .09);
  --warn: #fbbf24;
  --hunk: #818cf8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 16px 48px -12px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .04);
  --ring: 0 0 0 3px rgba(61, 155, 255, .3);
  --font: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  /* syntax */
  --sx-kw: #c4b5fd; --sx-str: #86efac; --sx-num: #fdba74; --sx-fn: #7dd3fc; --sx-com: #6b7280; --sx-tag: #f9a8d4; --sx-attr: #fcd34d;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-2: #f8f8fa;
  --bg-3: #f1f1f4;
  --bg-hover: #ebebef;
  --surface: rgba(255, 255, 255, .82);
  --line: rgba(10, 10, 20, .08);
  --line-2: rgba(10, 10, 20, .14);
  --text: #0b0b0f;
  --text-2: #52525b;
  --text-3: #8b8b95;
  --accent: #0a5fd6;
  --accent-2: #0891b2;
  --accent-soft: rgba(10, 95, 214, .08);
  --add: #16a34a;
  --add-bg: rgba(22, 163, 74, .08);
  --del: #dc2626;
  --del-bg: rgba(220, 38, 38, .07);
  --warn: #b45309;
  --hunk: #4f46e5;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow: 0 16px 48px -16px rgba(20, 20, 40, .22), 0 0 0 1px rgba(10, 10, 20, .05);
  --ring: 0 0 0 3px rgba(10, 95, 214, .2);
  --sx-kw: #7c3aed; --sx-str: #15803d; --sx-num: #c2410c; --sx-fn: #0369a1; --sx-com: #9ca3af; --sx-tag: #be185d; --sx-attr: #a16207;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.6 var(--font); letter-spacing: -.003em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow: hidden;
}
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); }
kbd {
  font: 500 10.5px/1 var(--mono); color: var(--text-3); background: var(--bg-3);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 3px 5px; white-space: nowrap;
}

/* ------------------------------------------------------------------ layout */
.app { display: flex; height: 100vh; height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.view { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.view.fixed { overflow: hidden; }
.view.enter > * { animation: rise .35s var(--ease) both; }

/* ----------------------------------------------------------------- sidebar */
.sidebar {
  width: 260px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px;
  padding: 12px 10px; background: var(--bg-2); border-right: 1px solid var(--line);
}
.app.sb-collapsed .sidebar { display: none; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 30px; height: 30px; flex-shrink: 0; display: block; }
.logo .mark { width: 100%; height: 100%; display: block; object-fit: contain; filter: drop-shadow(0 2px 8px rgba(47, 128, 255, .35)); }
:root[data-theme="light"] .logo .mark { filter: none; }
.logo.sm { width: 24px; height: 24px; }
.brand-name { font-size: 15.5px; font-weight: 600; letter-spacing: -.02em; }
.brand-name b { font-weight: 600; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.new-task {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; font-weight: 500;
  background: var(--bg-3); border: 1px solid var(--line); box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.04);
  transition: background .15s, border-color .15s;
}
.new-task:hover { background: var(--bg-hover); border-color: var(--line-2); }
.new-task kbd, .search kbd { margin-left: auto; }
.search {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--text-3); width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.search:hover { background: var(--bg-hover); color: var(--text-2); }

.main-nav { display: flex; flex-direction: column; gap: 1px; padding: 6px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.main-nav a, .nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 6.5px 10px; border-radius: 9px; color: var(--text-2); width: 100%;
  transition: background .12s, color .12s;
}
.main-nav a:hover, .nav-item:hover { background: var(--bg-hover); color: var(--text); }
.main-nav a.active, .nav-item.active { background: var(--bg-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.main-nav a.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad);
}
.main-nav svg { width: 17px; height: 17px; }
.nav-group { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); padding: 8px 10px 4px; }
.task-nav { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.nav-item { font-size: 13.5px; }
.nav-item .t { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nav-item svg { width: 15px; height: 15px; color: var(--text-3); }
.nav-empty { padding: 6px 10px; color: var(--text-3); font-size: 13px; }

.sidebar-bottom { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); padding: 4px 10px; border-radius: 8px; }
.status-line:hover { color: var(--text-2); }
.status-line .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 18%, transparent); }
.status-line.online .dot { background: var(--add); box-shadow: 0 0 0 3px var(--add-bg); }
.profile { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; text-align: left; }
.profile:hover { background: var(--bg-hover); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 600; font-size: 12.5px; }
.profile-text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; font-size: 13.5px; }
.profile-text small { color: var(--text-3); font-size: 12px; }
.profile > svg { color: var(--text-3); width: 16px; height: 16px; }

/* ------------------------------------------------------------------ topbar */
.topbar {
  height: 52px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 0 14px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px); position: relative; z-index: 5;
}
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; overflow: hidden; white-space: nowrap; color: var(--text-3); font-size: 13.5px; }
.crumbs b { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.crumbs .rename { cursor: text; padding: 2px 6px; margin-left: -6px; border-radius: 6px; }
.crumbs .rename:hover { background: var(--bg-hover); }
.rename-input { font-weight: 500; background: var(--bg-2); border: 1px solid var(--accent); box-shadow: var(--ring); border-radius: 7px; padding: 3px 8px; outline: 0; min-width: 240px; }
.crumbs .sep { opacity: .5; }
.topbar-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }
.only-mobile { display: none; }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 9px;
  font-weight: 500; font-size: 13.5px; border: 1px solid var(--line-2); background: var(--bg-2); white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, filter .15s, transform .1s;
}
.btn:hover { background: var(--bg-hover); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: var(--text); color: var(--bg); border-color: transparent;
  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 4px 14px -4px rgba(0,0,0,.4);
}
.btn.primary:hover:not(:disabled) { filter: brightness(.9); background: var(--text); }
.btn.danger { color: var(--del); }
.btn.round { width: 32px; padding: 0; border-radius: 50%; }
.btn svg { width: 15px; height: 15px; }
.split { display: inline-flex; position: relative; }
.split > .btn:first-child { border-radius: 9px 0 0 9px; }
.split > .btn:nth-child(2) { border-radius: 0 9px 9px 0; padding: 0 7px; margin-left: 1px; }
.menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; min-width: 240px; padding: 5px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); animation: pop .14s var(--ease);
}
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; font-size: 13.5px; }
.menu button:hover:not(:disabled) { background: var(--bg-hover); }
.menu button:disabled { opacity: .4; cursor: not-allowed; }
.menu button svg { width: 16px; height: 16px; color: var(--text-3); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* -------------------------------------------------------------------- home */
.page { max-width: 820px; margin: 0 auto; padding: 9vh 24px 72px; position: relative; }
.page.narrow { padding-top: 36px; }
.page.home { padding-top: 11vh; }
.hero-bg {
  position: absolute; inset: -40px -30vw auto; height: 560px; pointer-events: none; z-index: -1;
  background:
    radial-gradient(40% 55% at 30% 35%, rgba(29, 78, 216, .26), transparent 70%),
    radial-gradient(35% 50% at 72% 30%, rgba(34, 195, 255, .14), transparent 70%);
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px; opacity: .55;
  mask-image: radial-gradient(38% 60% at 50% 28%, #000 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(38% 60% at 50% 28%, #000 10%, transparent 70%);
}
:root[data-theme="light"] .hero-bg { opacity: .7; }
.page.home > :not(.hero-bg) { position: relative; }
.hero-badge {
  display: flex; width: fit-content; margin: 0 auto 20px; align-items: center; gap: 8px; padding: 5px 12px 5px 10px; border-radius: 99px;
  font-size: 12.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line-2); backdrop-filter: blur(8px);
  transition: border-color .15s, color .15s;
}
.hero-badge:hover { color: var(--text); border-color: var(--text-3); }
.hero-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 10px rgba(61, 155, 255, .9); }
.hero { font-size: clamp(30px, 5vw, 46px); line-height: 1.08; font-weight: 600; letter-spacing: -.04em; text-align: center; margin: 0 0 14px; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { text-align: center; color: var(--text-2); font-size: 15.5px; margin: 0 auto 32px; max-width: 520px; }
.page-title { font-size: 24px; font-weight: 600; letter-spacing: -.03em; margin: 0 0 4px; }
.page-sub { color: var(--text-3); margin: 0 0 24px; max-width: 620px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- composer */
.composer {
  position: relative; border-radius: 20px; padding: 16px 16px 12px;
  background: linear-gradient(var(--bg-2), var(--bg-2)) padding-box, linear-gradient(var(--line-2), var(--line-2)) border-box;
  border: 1px solid transparent; box-shadow: var(--shadow); transition: box-shadow .25s;
}
.composer:focus-within {
  background: linear-gradient(var(--bg-2), var(--bg-2)) padding-box, var(--grad) border-box;
  box-shadow: var(--shadow), 0 0 0 4px var(--accent-soft), 0 20px 60px -20px rgba(47, 128, 255, .45);
}
.composer textarea {
  width: 100%; resize: none; border: 0; outline: 0; background: transparent; font-size: 15.5px; line-height: 1.55;
  max-height: 240px; padding: 2px 4px; display: block; box-shadow: none;
}
.composer textarea::placeholder { color: var(--text-3); }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.pill {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 99px;
  border: 1px solid var(--line-2); color: var(--text-2); font-size: 13px; max-width: 220px; background: var(--bg); transition: background .12s, color .12s;
}
.pill:hover { background: var(--bg-hover); color: var(--text); }
.pill svg { width: 14px; height: 14px; color: var(--text-3); }
.pill select, .opt select { appearance: none; background: transparent; border: 0; outline: 0; cursor: pointer; min-width: 0; text-overflow: ellipsis; color: inherit; box-shadow: none; }
.pill select option, .opt select option { background: var(--bg-2); color: var(--text); }
.actions { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.composer .btn.primary[data-kind], .composer.follow .btn.primary.round {
  background: var(--grad); color: #fff; box-shadow: 0 6px 20px -6px rgba(47, 128, 255, .7), inset 0 1px 0 rgba(255,255,255,.25);
}
.composer .btn.primary[data-kind]:hover:not(:disabled), .composer.follow .btn.primary.round:hover:not(:disabled) { filter: brightness(1.08); background: var(--grad); }
.composer.follow { border-radius: 18px; padding: 12px 12px 10px; box-shadow: var(--shadow-sm); }
.composer.follow textarea { font-size: 14.5px; }
.hint { font-size: 12px; color: var(--text-3); }

.options-row { display: flex; flex-wrap: wrap; gap: 2px; margin: 10px 6px 0; }
.opt { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border-radius: 8px; color: var(--text-3); font-size: 12.5px; cursor: pointer; transition: background .12s, color .12s; }
.opt:hover { background: var(--bg-hover); color: var(--text-2); }
.opt svg { width: 14px; height: 14px; }
.opt.toggle.on { color: var(--accent); background: var(--accent-soft); }

.attachments { display: flex; gap: 8px; flex-wrap: wrap; }
.attachments:not(:empty) { margin-bottom: 12px; }
.thumb { position: relative; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); animation: pop .2s var(--ease); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.72); color: #fff; display: grid; place-items: center; }
.thumb button svg { width: 12px; height: 12px; }
.goal-box { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); }
.goal-box label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 4px; flex-wrap: wrap; }
.goal-box label small { font-weight: 400; color: var(--text-3); }
.goal-box label svg { width: 15px; height: 15px; }
.goal-box textarea { font-size: 14px; }
.review-target { margin-bottom: 10px; }
.review-target .select { font-size: 13px; padding: 5px 8px; }

/* slash / @ completion menu */
.complete {
  position: absolute; left: 10px; right: 10px; bottom: calc(100% + 8px); z-index: 30; max-height: 320px; overflow-y: auto; padding: 5px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); animation: pop .14s var(--ease);
}
.complete-head { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); padding: 6px 10px 4px; }
.complete button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 9px; text-align: left; font-size: 13.5px; }
.complete button.active { background: var(--bg-hover); }
.complete button svg { width: 15px; height: 15px; color: var(--text-3); }
.complete button.active svg { color: var(--accent); }
.complete .cl { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.complete .cd { color: var(--text-3); font-size: 12.5px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 10px; }

.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 22px 0 48px; }
.suggestion {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; border-radius: 14px; text-align: left;
  border: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(6px);
  transition: border-color .15s, background .15s, transform .15s;
}
.suggestion:hover { border-color: var(--line-2); background: var(--bg-2); transform: translateY(-1px); }
.s-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.s-ic svg { width: 16px; height: 16px; }
.s-body { display: flex; flex-direction: column; min-width: 0; }
.s-body b { font-weight: 500; font-size: 13.5px; }
.s-body small { color: var(--text-3); font-size: 12.5px; line-height: 1.45; }

/* --------------------------------------------------------------- task list */
.list-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); margin-bottom: 6px; gap: 10px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 12px; color: var(--text-3); font-weight: 500; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .12s; }
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.list-head .muted { font-size: 12.5px; white-space: nowrap; }

.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.task-row {
  display: flex; align-items: center; gap: 14px; padding: 12px; cursor: pointer; border-radius: 12px; border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.task-row:hover { background: var(--bg-2); border-color: var(--line); }
.task-row .body { flex: 1; min-width: 0; }
.task-row .title { font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.task-row .meta { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; margin-top: 1px; }
.task-row .right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.stat { font: 500 12px var(--mono); white-space: nowrap; }
.stat .a { color: var(--add); } .stat .d { color: var(--del); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--text-2); white-space: nowrap; }
.badge.running { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }
.badge.running::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.2s infinite; }
.badge.error { color: var(--del); border-color: color-mix(in srgb, var(--del) 35%, transparent); background: var(--del-bg); }
.badge.pr { color: #a78bfa; border-color: rgba(167, 139, 250, .35); background: rgba(167, 139, 250, .08); }
.badge.pr svg { width: 13px; height: 13px; }
.row-btn { opacity: 0; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); transition: opacity .12s; }
.task-row:hover .row-btn { opacity: 1; }
.row-btn:hover { background: var(--bg-hover); color: var(--text); }
.row-btn svg { width: 16px; height: 16px; }
.empty { text-align: center; padding: 48px 10px; color: var(--text-3); list-style: none; }
.empty svg { width: 28px; height: 28px; margin-bottom: 10px; opacity: .55; }

/* --------------------------------------------------------------- task view */
.task-split { display: flex; height: 100%; }
.task-split.resizing { cursor: col-resize; user-select: none; }
.task-split.resizing iframe { pointer-events: none; }
.conversation { flex: 0 0 var(--left, 48%); min-width: 0; display: flex; flex-direction: column; min-height: 0; position: relative; }
.task-split.no-inspector .conversation { flex: 1; }
.task-split.no-inspector .inspector, .task-split.no-inspector .resizer { display: none; }
.resizer { flex: 0 0 1px; background: var(--line); position: relative; cursor: col-resize; z-index: 3; }
.resizer::after { content: ""; position: absolute; inset: 0 -4px; }
.resizer:hover, .task-split.resizing .resizer { background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.versions { display: flex; gap: 4px; padding: 8px 16px; border-bottom: 1px solid var(--line); overflow-x: auto; flex-shrink: 0; }
.version { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 9px; font-size: 13px; color: var(--text-2); white-space: nowrap; transition: background .12s; }
.version:hover { background: var(--bg-hover); }
.version.active { background: var(--bg-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.version .spinner { width: 11px; height: 11px; }
.version .stat { font-size: 11px; }
.version svg { width: 14px; height: 14px; color: var(--del); }
.thread { flex: 1; overflow-y: auto; padding: 26px 26px 8px; }
.follow-wrap { padding: 0 18px 16px; }
.jump {
  position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 500; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.jump svg { width: 14px; height: 14px; }

.msg { max-width: 720px; margin: 0 auto 26px; }
.msg.user .kind { text-align: right; font-size: 11px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--text-3); margin-bottom: 5px; }
.bubble-wrap { display: flex; justify-content: flex-end; align-items: flex-start; gap: 6px; }
.msg.user .bubble {
  width: fit-content; max-width: 86%; background: var(--bg-3); border: 1px solid var(--line);
  padding: 10px 15px; border-radius: 18px 18px 5px 18px; white-space: pre-wrap; word-wrap: break-word;
}
.edit-btn { opacity: 0; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); margin-top: 4px; transition: opacity .12s; }
.bubble-wrap:hover .edit-btn { opacity: 1; }
.edit-btn:hover { background: var(--bg-hover); color: var(--text); }
.edit-btn svg { width: 15px; height: 15px; }
.edit-box { border: 1px solid var(--accent); box-shadow: var(--ring); border-radius: 16px; padding: 10px 12px; background: var(--bg-2); }
.edit-box textarea { width: 100%; resize: vertical; border: 0; outline: 0; background: transparent; font-size: 14.5px; min-height: 60px; box-shadow: none; }
.edit-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.edit-actions .hint { margin-right: auto; }
.msg-images { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin-bottom: 6px; }
.msg-images img { max-width: 200px; max-height: 150px; border-radius: 12px; border: 1px solid var(--line); }

.agent-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13.5px; }
.agent-head b { font-weight: 600; }
.agent-head .muted { font-size: 12.5px; }

.task-meta { max-width: 720px; margin: 0 auto 22px; display: flex; flex-wrap: wrap; gap: 6px; }
.task-meta span { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3); background: var(--bg-2); border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; }
.task-meta svg { width: 13px; height: 13px; }
.goal-card, .fork-note { max-width: 720px; margin: 0 auto 22px; display: flex; gap: 10px; align-items: flex-start; font-size: 13px; padding: 11px 13px; border-radius: 12px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text-2); }
.goal-card svg { color: var(--accent); margin-top: 1px; }
.goal-card b { color: var(--text); }
.fork-note { background: var(--bg-2); border-color: var(--line); align-items: center; }
.fork-note a { color: var(--accent); }

.plan { border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); padding: 10px 14px 8px; margin-bottom: 12px; }
.plan-head { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.plan-head svg { width: 15px; height: 15px; color: var(--text-3); }
.plan-head .muted { margin-left: auto; font-size: 12px; }
.plan ul { list-style: none; margin: 0; padding: 0; }
.plan li { display: flex; align-items: flex-start; gap: 10px; padding: 4px 0; font-size: 13px; color: var(--text-3); transition: color .2s; }
.plan li.in_progress { color: var(--text); }
.plan li.done { color: var(--text-2); }
.plan li.done > span:last-child { text-decoration: line-through; text-decoration-color: var(--text-3); }
.plan .pi { width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex-shrink: 0; }
.plan li.done .pi { background: var(--accent); border-color: var(--accent); color: #fff; }
.plan li.done .pi svg { width: 10px; height: 10px; stroke-width: 3; }
.plan li.in_progress .pi { border-color: var(--accent); }
.plan .pi .spinner { width: 10px; height: 10px; border-width: 1.5px; }
.plan code { font-size: 11.5px; }

.worklog { margin-bottom: 12px; }
.worklog summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; color: var(--text-3); font-size: 13px; padding: 3px 0; }
.worklog summary:hover { color: var(--text-2); }
.worklog summary::-webkit-details-marker { display: none; }
.worklog summary .chev { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.worklog[open] summary .chev { transform: rotate(90deg); }
.shimmer { background: linear-gradient(90deg, var(--text-3) 25%, var(--text) 50%, var(--text-3) 75%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.8s linear infinite; font-weight: 500; }
.worklog ol { margin: 8px 0 0 5px; padding: 0 0 0 16px; list-style: none; border-left: 1px solid var(--line-2); }
.worklog li { position: relative; padding: 4px 0; font-size: 13px; color: var(--text-2); }
.worklog li::before { content: ""; position: absolute; left: -20px; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--line-2); }
.worklog li.done::before { background: var(--accent); border-color: var(--accent); }
.worklog li.live::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 1s infinite; }
.worklog li .cmd { display: block; margin-top: 4px; font: 12px var(--mono); color: var(--text-3); background: var(--bg-2); border: 1px solid var(--line); border-radius: 7px; padding: 3px 9px; width: fit-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spinner { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .7s linear infinite; flex-shrink: 0; display: inline-block; }

.approval { border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 7%, var(--bg-2)); border-radius: 14px; padding: 13px; margin: 12px 0; }
.ap-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.ap-head b { font-weight: 600; }
.ap-head svg { color: var(--warn); }
.approval pre { margin: 9px 0 11px; font: 12.5px var(--mono); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; white-space: pre-wrap; word-break: break-all; }
.ap-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ap-done { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); margin: 4px 0 10px; flex-wrap: wrap; }
.ap-done svg { width: 14px; height: 14px; }
.ap-done code { font: 11.5px var(--mono); }

.changes { border: 1px solid var(--line); border-radius: 14px; margin-top: 16px; overflow: hidden; background: var(--bg-2); }
.changes-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 13px; font-size: 13px; font-weight: 500; border-bottom: 1px solid var(--line); }
.change { display: flex; align-items: center; gap: 9px; padding: 7px 13px; font: 12.5px var(--mono); color: var(--text-2); cursor: pointer; width: 100%; text-align: left; transition: background .12s; }
.change:hover { background: var(--bg-hover); color: var(--text); }
.change .path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.change svg { width: 14px; height: 14px; color: var(--text-3); }
.msg-actions { display: flex; gap: 2px; margin-top: 10px; }
.msg-actions button { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); transition: background .12s, color .12s; }
.msg-actions button:hover { background: var(--bg-hover); color: var(--text); }
.msg-actions svg { width: 15px; height: 15px; }
.error-text { display: flex; align-items: center; gap: 6px; color: var(--del); font-size: 13.5px; margin-top: 8px; }
.error-text svg { width: 15px; height: 15px; }

.queue { padding: 0 18px; display: flex; flex-direction: column; gap: 4px; }
.queue:not(:empty) { padding-bottom: 8px; }
.queued { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); background: var(--bg-2); border: 1px dashed var(--line-2); border-radius: 11px; padding: 7px 11px; }
.queued span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queued svg { width: 15px; height: 15px; color: var(--text-3); }
.queued button { color: var(--text-3); display: grid; place-items: center; }

/* ---------------------------------------------------------------- markdown */
.md { word-wrap: break-word; font-size: 14.5px; line-height: 1.68; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3, .md h4 { font-size: 15px; margin: 20px 0 8px; font-weight: 600; letter-spacing: -.01em; }
.md h1 { font-size: 18px; } .md h2 { font-size: 16px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 4px 0; }
.md li::marker { color: var(--text-3); }
.md a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; }
.md strong { font-weight: 600; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.md blockquote { margin: 0 0 12px; padding: 2px 0 2px 14px; border-left: 3px solid var(--line-2); color: var(--text-2); }
.md table { border-collapse: collapse; width: 100%; margin: 0 0 14px; font-size: 13.5px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 11px; text-align: left; }
.md th { background: var(--bg-2); font-weight: 600; }
.md :not(pre) > code { font: 12.5px var(--mono); background: var(--bg-3); border: 1px solid var(--line); padding: 1.5px 5px; border-radius: 6px; }
.md pre { position: relative; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 34px 16px 14px; overflow-x: auto; margin: 0 0 14px; }
.md pre code { font: 12.5px/1.65 var(--mono); background: none; padding: 0; }
.code-lang { position: absolute; top: 9px; left: 14px; font: 500 11px var(--mono); color: var(--text-3); text-transform: lowercase; }
.copy-btn { position: absolute; top: 6px; right: 7px; font-size: 11.5px; padding: 3px 9px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--bg-3); color: var(--text-2); opacity: 0; transition: opacity .15s; }
.md pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--text); }
.caret > :last-child::after, .caret:empty::after { content: ""; display: inline-block; width: 8px; height: 15px; margin-left: 3px; vertical-align: -2px; border-radius: 2px; background: var(--grad); animation: blink 1s steps(1) infinite; }

/* syntax highlighting (highlight.js classes) */
.hljs-keyword, .hljs-built_in, .hljs-selector-tag, .hljs-literal, .hljs-type { color: var(--sx-kw); }
.hljs-string, .hljs-regexp, .hljs-meta .hljs-string { color: var(--sx-str); }
.hljs-number, .hljs-symbol, .hljs-bullet { color: var(--sx-num); }
.hljs-title, .hljs-title.function_, .hljs-function .hljs-title, .hljs-property { color: var(--sx-fn); }
.hljs-comment, .hljs-quote { color: var(--sx-com); font-style: italic; }
.hljs-tag, .hljs-name, .hljs-selector-class, .hljs-selector-id { color: var(--sx-tag); }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-params { color: var(--sx-attr); }
.hljs-meta { color: var(--text-3); }

/* --------------------------------------------------------------- inspector */
.inspector { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-2); }
.inspector-tabs { display: flex; align-items: center; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); flex-shrink: 0; min-height: 45px; }
.itab { padding: 12px 10px 10px; color: var(--text-3); font-weight: 500; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 6px; align-items: center; transition: color .12s; }
.itab:hover { color: var(--text-2); }
.itab.active { color: var(--text); border-bottom-color: var(--accent); }
.itab .count:not(:empty) { font-size: 11px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; color: var(--text-2); }
#inspectorStat { margin-left: auto; }
.panel { flex: 1; overflow: auto; padding: 14px; }

.file-diff { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; background: var(--bg); overflow: hidden; box-shadow: var(--shadow-sm); }
.file-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 12px; background: var(--bg-3); border-bottom: 1px solid var(--line); font: 12.5px var(--mono); cursor: pointer; }
.file-diff.collapsed .file-head { border-bottom: 0; }
.file-diff.collapsed .diff { display: none; }
.file-head .chev { width: 14px; height: 14px; color: var(--text-3); transition: transform .15s; }
.file-diff.collapsed .chev { transform: rotate(-90deg); }
.file-head .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font: 500 11px var(--font); padding: 1px 8px; border-radius: 99px; background: var(--add-bg); color: var(--add); }
.tag.M { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); }
.tag.D { background: var(--del-bg); color: var(--del); }
.mini { font: 500 11.5px var(--font); padding: 2px 9px; border-radius: 7px; border: 1px solid var(--line-2); color: var(--text-2); background: var(--bg-2); }
.mini:hover { background: var(--bg-hover); color: var(--text); }
.file-diff.discarded { opacity: .5; }
.file-diff.discarded .name { text-decoration: line-through; }
.diff { font: 12px/1.7 var(--mono); overflow-x: auto; }
.diff .ln { display: grid; grid-template-columns: 40px 40px 18px 1fr; white-space: pre; min-width: fit-content; }
.diff .n { text-align: right; color: var(--text-3); padding-right: 8px; user-select: none; opacity: .7; }
.diff .s { color: var(--text-3); user-select: none; }
.diff .ln.add { background: var(--add-bg); } .diff .ln.add .s { color: var(--add); } .diff .ln.add .n:first-child { box-shadow: inset 2px 0 0 var(--add); }
.diff .ln.del { background: var(--del-bg); } .diff .ln.del .s { color: var(--del); } .diff .ln.del .n:first-child { box-shadow: inset 2px 0 0 var(--del); }
.diff .ln.hunk { display: block; color: var(--hunk); background: color-mix(in srgb, var(--hunk) 8%, transparent); padding: 2px 12px; }
.diff .ln > span:last-child { padding-right: 16px; }
.diff .ln.meta { display: block; color: var(--text-3); font-style: italic; padding: 0 12px 0 98px; }
.flash { animation: flash 1.2s; }

.panel.terminal { background: #050506; }
:root[data-theme="light"] .panel.terminal { background: #fbfbfc; }
.logs { margin: 0; font: 12px/1.75 var(--mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.logs .c { color: var(--accent-2); } .logs .ok { color: var(--add); } .logs .dim { color: var(--text-3); }
.panel.preview { display: flex; flex-direction: column; padding: 0; }
.preview-bar { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.preview-bar .input { flex: 1; font: 12.5px var(--mono); padding: 5px 12px; border-radius: 99px; }
.panel.preview iframe { flex: 1; border: 0; width: 100%; background: #fff; }
.panel-empty { height: 100%; display: grid; place-items: center; text-align: center; color: var(--text-3); font-size: 13px; padding: 30px; }

/* ---------------------------------------------------------- cards & forms */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--bg-2); display: flex; flex-direction: column; gap: 8px; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--line-2); }
.card h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card h3 svg { color: var(--accent); }
.card .row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); min-width: 0; }
.card .row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .row svg { width: 14px; height: 14px; color: var(--text-3); }
.card .foot { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; align-items: center; }
.card.add { align-items: center; justify-content: center; border-style: dashed; background: transparent; color: var(--text-3); min-height: 160px; cursor: pointer; }
.card.add:hover { color: var(--text); border-color: var(--text-3); transform: translateY(-1px); }

.section { border: 1px solid var(--line); border-radius: 16px; margin-bottom: 18px; overflow: hidden; background: var(--bg); }
.section h2 { font-size: 13.5px; font-weight: 600; margin: 0; padding: 12px 16px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.sec-head { display: flex; align-items: center; justify-content: space-between; }
.sec-head .btn { height: 28px; font-size: 12.5px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.field:last-child { border-bottom: 0; }
.field.col { flex-direction: column; align-items: stretch; }
.field .lbl { display: flex; flex-direction: column; min-width: 0; }
.field .lbl small { color: var(--text-3); font-size: 12.5px; }
.field .lbl b { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.field .lbl b svg { width: 15px; height: 15px; color: var(--text-3); }
.inline-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.input, .select, .textarea {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 9px; padding: 7px 10px; outline: 0; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }
.textarea { width: 100%; font: 12.5px/1.6 var(--mono); resize: vertical; min-height: 90px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.form label small { font-weight: 400; color: var(--text-3); }
.form label.inline { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: .2s var(--ease); cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }
.about-head { display: flex; align-items: center; gap: 14px; padding: 16px; border-bottom: 1px solid var(--line); }
.about-head img { width: 48px; height: 48px; object-fit: contain; }
.about-head div { display: flex; flex-direction: column; line-height: 1.3; }
.about-head b { font-size: 16px; font-weight: 600; }
.about-head small { color: var(--text-3); font-size: 12.5px; }
.memory { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.memory li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; padding: 4px 4px 4px 11px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--line); }
.memory li.muted { background: none; border: 0; padding-left: 0; }
.mem-add { display: flex; gap: 6px; }
.mem-add .input { flex: 1; }
.usage-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.usage-grid div { padding: 16px; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.usage-grid div:last-child { border-right: 0; }
.usage-grid b { font-size: 22px; font-weight: 600; letter-spacing: -.03em; }
.usage-grid small { color: var(--text-3); font-size: 12px; }
.bars { display: flex; gap: 10px; align-items: flex-end; height: 140px; padding: 16px 16px 10px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bar i { width: 100%; max-width: 36px; min-height: 3px; background: var(--grad); border-radius: 6px 6px 3px 3px; opacity: .9; }
.bar small { font-size: 11px; color: var(--text-3); }

/* -------------------------------------------------------------------- chat */
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; margin: 0 0 8px; border-radius: 11px; background: var(--bg); border: 1px solid var(--line); }
.mode-switch a { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 6px 8px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-3); transition: background .15s, color .15s; }
.mode-switch a svg { width: 15px; height: 15px; }
.mode-switch a:hover { color: var(--text); }
.mode-switch a.active { background: var(--bg-3); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line-2); }
.mode-switch a.active svg { color: var(--accent); }
.app.sb-chat .main-nav { display: none; }
.nav-del { margin-left: auto; opacity: 0; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: var(--text-3); flex-shrink: 0; }
.nav-item:hover .nav-del { opacity: 1; }
.nav-del:hover { background: var(--bg-3); color: var(--del); }
.nav-del svg { width: 14px; height: 14px; }

.chat { height: 100%; display: flex; flex-direction: column; position: relative; }
.chat-scroll { flex: 1; overflow-y: auto; }
.chat-col { max-width: 780px; margin: 0 auto; padding: 32px 24px 16px; }
.chat-dock { padding: 0 24px 14px; max-width: 828px; width: 100%; margin: 0 auto; }
.chat.is-empty { justify-content: center; }
.chat.is-empty .chat-scroll { flex: 0; }
.chat.is-empty .chat-dock { padding-bottom: 12vh; }
.chat-hero { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-bottom: 26px; text-align: center; }
.chat-hero .logo { width: 64px; height: 64px; }
.chat-hero h1 { margin: 0; font-size: clamp(24px, 4vw, 32px); font-weight: 600; letter-spacing: -.035em; }
.chatbox { border-radius: 24px; padding: 14px 14px 10px 18px; }
.chatbox textarea { font-size: 15.5px; }
.chatbox .btn.round { width: 34px; height: 34px; }
.composer .stop-btn { background: var(--text); color: var(--bg); border-color: transparent; }
.chat-foot { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 9px; }
.chat-suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.chat-suggest button { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); transition: background .15s, border-color .15s; }
.chat-suggest button:hover { background: var(--bg-2); border-color: var(--line-2); }
.chat-suggest b { font-weight: 500; font-size: 13.5px; }
.chat-suggest span { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cmsg { margin-bottom: 28px; }
.cmsg.user { display: flex; flex-direction: column; align-items: flex-end; }
.cmsg.user .bubble { width: fit-content; max-width: 80%; background: var(--bg-3); border: 1px solid var(--line); padding: 10px 16px; border-radius: 20px; white-space: pre-wrap; word-wrap: break-word; }
.cmsg.user .bubble-wrap { width: 100%; }
.cmsg.user .edit-box { width: 100%; max-width: 640px; }
.cmsg.bot { display: flex; gap: 14px; align-items: flex-start; }
.cmsg.bot > .logo { margin-top: 2px; }
.cbody { flex: 1; min-width: 0; }
.cbody .md { font-size: 15px; line-height: 1.72; }
.model-tag { font-size: 11.5px; color: var(--text-3); padding: 0 6px; align-self: center; }
.thinking { display: flex; gap: 5px; padding: 9px 0; }
.thinking span { width: 7px; height: 7px; border-radius: 50%; background: var(--grad); animation: bounce 1.2s infinite ease-in-out; }
.thinking span:nth-child(2) { animation-delay: .15s; }
.thinking span:nth-child(3) { animation-delay: .3s; }
.chat .jump { bottom: 130px; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.55); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }
@media (max-width: 760px) {
  .chat-col { padding: 20px 16px 10px; }
  .chat-dock { padding: 0 10px 10px; }
  .chat-suggest { grid-template-columns: 1fr; }
  .cmsg.user .bubble { max-width: 90%; }
  .cmsg.bot { gap: 10px; }
  .nav-del { opacity: 1; }
}

/* ------------------------------------------------------- modal & palette */
.modal-root:empty, .palette-root:empty { display: none; }
.modal-root, .palette-root { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); animation: fade .15s; }
.palette-root { place-items: start center; padding-top: 14vh; }
.modal { width: 100%; max-width: 540px; max-height: 88vh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); padding: 22px; animation: pop .18s var(--ease); }
.modal h2 { margin: 0 0 18px; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.shortcuts { display: flex; flex-direction: column; }
.shortcuts div { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.shortcuts div:last-child { border-bottom: 0; }
.shortcuts kbd { margin-left: 4px; }

.palette { width: 100%; max-width: 620px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow), 0 30px 80px -20px rgba(47, 128, 255, .3); overflow: hidden; animation: pop .16s var(--ease); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--text-3); }
.palette-input input { flex: 1; background: none; border: 0; outline: 0; font-size: 15.5px; color: var(--text); box-shadow: none; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.pg { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); padding: 10px 10px 4px; }
.pi-row { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border-radius: 10px; text-align: left; font-size: 13.5px; }
.pi-row svg { width: 16px; height: 16px; color: var(--text-3); }
.pi-row.active { background: var(--bg-hover); }
.pi-row.active svg { color: var(--accent); }
.pl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ph { margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; padding-left: 10px; }
.pi-row kbd { margin-left: auto; }
.pi-row .ph + kbd { margin-left: 8px; }
.palette-empty { padding: 28px; text-align: center; color: var(--text-3); }
.palette-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }
.palette-foot kbd { margin-right: 3px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 16px) scale(.98); opacity: 0; pointer-events: none; z-index: 70;
  display: flex; align-items: center; gap: 14px; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow); transition: opacity .2s, transform .25s var(--ease); max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.has-action.show { pointer-events: auto; }
.toast button { color: inherit; font-weight: 600; opacity: .7; text-decoration: underline; text-underline-offset: 3px; }
.toast button:hover { opacity: 1; }

/* -------------------------------------------------------------- motion */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes flash { from { box-shadow: 0 0 0 2px var(--accent); } to { box-shadow: 0 0 0 2px transparent; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .task-split { flex-direction: column; }
  .conversation { flex: 1 1 auto; border-bottom: 1px solid var(--line); }
  .inspector { flex: 0 0 40%; }
  .resizer { display: none; }
  .suggestions { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .only-mobile { display: grid; }
  .only-desktop { display: none; }
  .app.sb-collapsed .sidebar { display: flex; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow); width: 280px; }
  .app.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 20; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .topbar { padding: 0 8px; }
  .topbar .btn .lbl { display: none; }
  .page, .page.home { padding: 6vh 16px 40px; }
  .hero-sub { font-size: 14.5px; margin-bottom: 24px; }
  .thread { padding: 18px 16px; }
  .follow-wrap { padding: 0 10px 10px; }
  .pill { max-width: 150px; flex-shrink: 0; }
  .pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex-basis: 100%; }
  .pills::-webkit-scrollbar { display: none; }
  .task-row .badge:not(.running) { display: none; }
  .row-btn, .edit-btn { opacity: 1; }
  .inspector { flex-basis: 36%; }
  .form .row2 { grid-template-columns: 1fr; }
  .usage-grid { grid-template-columns: repeat(2, 1fr); }
  .usage-grid div:nth-child(2) { border-right: 0; }
  .usage-grid div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .field .input[style] { width: 100% !important; }
  .palette-root { padding-top: 8vh; }
  .palette-foot { display: none; }
  .new-task kbd, .search kbd { display: none; }
}

/* --------------------------------------------------------------- sign in */
.app[hidden] { display: none; }
.auth { position: fixed; inset: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg); }
.auth-bg { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(40% 40% at 30% 20%, rgba(29, 78, 216, .25), transparent 70%), radial-gradient(35% 35% at 75% 25%, rgba(34, 195, 255, .12), transparent 70%); }
.auth-card { position: relative; width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px 24px; border-radius: 20px; background: var(--bg-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.auth-brand img { width: 36px; height: 36px; object-fit: contain; }
.auth-brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-card h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.auth-card .sub { margin: -8px 0 4px; color: var(--text-3); }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.auth-card .input { padding: 10px 12px; font-size: 15px; }
.auth-card .primary { margin-top: 4px; padding: 11px; border: 0; border-radius: 11px; color: #fff; font-weight: 600; background: var(--grad); cursor: pointer; }
.auth-card .primary:disabled { opacity: .6; cursor: default; }
.auth-card .links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); }
.auth-card .links button { color: var(--accent); font-weight: 500; }
.auth-msg { font-size: 13px; min-height: 1em; }
.auth-msg.error { color: var(--del); }
.auth-msg.ok { color: var(--add); }
.auth-foot { position: relative; margin-top: 16px; font-size: 12px; color: var(--text-3); text-align: center; }
.auth-foot a { color: var(--text-2); }

/* ---------------------------------------------------- account & admin */
.theme-btn .sun { display: none; }
:root[data-theme="light"] .theme-btn .sun { display: block; }
:root[data-theme="light"] .theme-btn .moon { display: none; }
.app.chat-only .mode-switch { display: none; }
.user-menu-wrap { position: relative; }
.profile { width: 100%; }
.profile small.low { color: var(--warn); }
.user-menu { top: auto; bottom: calc(100% + 8px); left: 0; right: 0; min-width: 0; }
.um-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 6px; }
.um-head div { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.um-head small { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.um-balance { display: flex; align-items: center; gap: 8px; margin: 4px 6px; padding: 8px 10px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 500; }
.um-balance svg { width: 15px; height: 15px; }
.danger-item { color: var(--del); }
.danger-item svg { color: var(--del) !important; }
.avatar.xl { width: 64px; height: 64px; font-size: 24px; }
.profile-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.profile-hero .page-sub { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.big-num { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.seg button { padding: 5px 14px; border-radius: 8px; font-size: 13px; color: var(--text-2); }
.seg button.on { background: var(--bg-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.faq { border-bottom: 1px solid var(--line); }
.faq:last-child { border-bottom: 0; }
.faq summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; font-weight: 500; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .chev { width: 15px; height: 15px; color: var(--text-3); transition: transform .2s; }
.faq[open] summary .chev { transform: rotate(90deg); }
.faq p { margin: 0; padding: 0 16px 14px; color: var(--text-2); }
.center { text-align: center; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 8px 0 24px; }
.plan { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 22px 20px; border-radius: 18px; border: 1px solid var(--line); background: var(--bg-2); }
.plan.featured { background: linear-gradient(var(--bg-2), var(--bg-2)) padding-box, var(--grad) border-box; border: 1px solid transparent; box-shadow: 0 20px 50px -24px rgba(47, 128, 255, .5); }
.plan-tag { position: absolute; top: 14px; right: 14px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.plan h3 { margin: 0; font-size: 16px; }
.plan .price { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.plan-tokens { color: var(--accent); font-weight: 500; font-size: 13.5px; }
.plan ul { list-style: none; margin: 10px 0 16px; padding: 0; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.plan li { display: flex; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.plan li svg { width: 15px; height: 15px; color: var(--add); margin-top: 2px; }
.plan .btn { width: 100%; height: 38px; }
.page.wide { max-width: 1100px; }
.page-head .input { width: 240px; }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat-cards div { padding: 14px 16px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); display: flex; flex-direction: column; }
.stat-cards small { color: var(--text-3); font-size: 12px; }
.stat-cards b { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.table-wrap { border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th { text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px; padding: 10px 14px; background: var(--bg-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr.off td { opacity: .55; }
.admin-table .num { text-align: right; font-family: var(--mono); font-size: 12.5px; }
.admin-table .who { display: flex; align-items: center; gap: 10px; }
.admin-table .who div { display: flex; flex-direction: column; line-height: 1.3; }
.admin-table .who small { color: var(--text-3); font-size: 12px; }
.admin-table .avatar { width: 30px; height: 30px; font-size: 12px; }
.actions-cell { text-align: right; }
.actions-cell .btn { height: 28px; font-size: 12.5px; padding: 0 10px; }
.actions-cell .menu { top: 100%; }
.temp-pw { font: 600 18px var(--mono); letter-spacing: .05em; padding: 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-2); text-align: center; }
@media (max-width: 760px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .row2 { grid-template-columns: 1fr; }
  .page-head .input { width: 100%; }
}
.actions-cell { white-space: nowrap; }
.actions-cell .icon-btn { display: inline-grid; vertical-align: middle; margin-left: 4px; }

/* ------------------------------------------------ alignment & spacing */
/* Setting rows: label on the left, control on the right. On narrow screens a wide control moves
   to its own line but stays right-aligned, so every row lines up the same way. */
.field { flex-wrap: wrap; row-gap: 10px; }
.field > .lbl { flex: 1 1 180px; gap: 2px; }
.field > :not(.lbl) { margin-left: auto; flex-shrink: 0; }
.field.col > *, .field > .row2, .field > form { margin-left: 0; }
.field .select { min-width: 150px; }
.field .lbl small { line-height: 1.45; }
.textarea { font: 14px/1.6 var(--font); }
.textarea.mono { font: 12.5px/1.6 var(--mono); }
.options-row { margin: 10px 7px 0; }
.section h2 { letter-spacing: -.005em; }
.page-title + .page-sub { margin-top: 2px; }
.about-head + .field { border-top: 0; }
#nameForm .inline-actions .input { width: 220px; }
.profile-hero .page-title { margin: 0; }
.profile-hero > div { min-width: 0; }
@media (max-width: 760px) {
  .field { padding: 13px 14px; }
  .field > .inline-actions { flex: 1 1 100%; }
  .field > .inline-actions .input, #nameForm .inline-actions .input { flex: 1; width: auto !important; min-width: 0; }
  .field .select { min-width: 120px; }
  .section h2 { padding: 11px 14px; }
  .page-title { font-size: 22px; }
  .plans { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .field > .lbl { flex-basis: 130px; }
  /* Admin: one card per person instead of a wide table */
  .table-wrap { border: 0; overflow: visible; }
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody { display: block; }
  .admin-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 14px; margin-bottom: 10px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); }
  .admin-table td { display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; white-space: normal; }
  .admin-table td[data-label]::before { content: attr(data-label); font-size: 11.5px; color: var(--text-3); font-family: var(--font); }
  .admin-table td:first-child, .admin-table .actions-cell { grid-column: 1 / -1; }
  .admin-table .num { text-align: left; }
  .admin-table .actions-cell { flex-direction: row; justify-content: flex-start; gap: 6px; padding-top: 4px; border-top: 1px solid var(--line); }
  .admin-table .actions-cell:empty { display: none; }
}
.page-head { margin-bottom: 18px; }
.page-head .page-sub { margin-bottom: 0; }
.chat-suggest { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chat-suggest button { min-width: 0; }
@media (max-width: 760px) { .chat-suggest { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .chatbox .composer-bar { flex-wrap: nowrap; }
  .chatbox .pills { flex: 1 1 auto; flex-basis: auto; min-width: 0; }
}

/* ------------------------------------------------------------ add project */
.add-project { max-width: 560px; }
.seg.wide { display: grid; grid-template-columns: 1fr 1fr; width: 100%; margin-bottom: 16px; }
.seg.wide button { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 10px; }
.seg.wide svg { width: 15px; height: 15px; }
.ap-pane { display: flex; flex-direction: column; gap: 14px; }
.ap-pane .hint { margin: -4px 0 0; }
.drop { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 22px 16px;
  border: 1.5px dashed var(--line-2); border-radius: 14px; background: var(--bg); }
.drop > svg { width: 28px; height: 28px; color: var(--accent); }
.drop .inline-actions { justify-content: center; margin-top: 4px; }
.picked { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 7px 12px; border-radius: 10px; background: var(--accent-soft);
  color: var(--text); font-size: 13px; max-width: 100%; }
.picked svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.picked span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-progress { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.ap-progress .bar { height: 6px; border-radius: 99px; background: var(--bg-3); overflow: hidden; }
.ap-progress .bar i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 99px; transition: width .2s; }
.ap-progress.indeterminate .bar i { width: 35% !important; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.add-project .auth-msg:empty { display: none; }
.add-project .foot { margin-top: 6px; }

/* ------------------------------------------------------------ usage limits */
.usage-row { display: flex; flex-direction: column; gap: 5px; }
.usage-row + .usage-row { margin-top: 12px; }
.ur-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.ur-top b { font-weight: 500; }
.ur-top span { color: var(--text-2); }
.ur-bar { height: 6px; border-radius: 99px; background: var(--bg-3); overflow: hidden; }
.ur-bar i { display: block; height: 100%; background: var(--grad); border-radius: 99px; }
.usage-row.low .ur-bar i { background: var(--warn); }
.usage-row small { color: var(--text-3); font-size: 12px; }
.um-usage { margin: 6px 6px 4px; padding: 10px 12px; border-radius: 10px; background: var(--bg-3); }
.um-usage .usage-row + .usage-row { margin-top: 10px; }
.usage-field { padding-top: 16px; padding-bottom: 16px; }
.limits-now { padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.mini-usage { display: inline-block; width: 46px; height: 5px; border-radius: 99px; background: var(--bg-3); overflow: hidden; margin-right: 8px; vertical-align: middle; }
.mini-usage i { display: block; height: 100%; background: var(--grad); }

/* --------------------------------------------------- web search & knowledge */
.pill.toggle { cursor: pointer; padding: 0 11px; }
.pill.toggle.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.pill.toggle.on svg { color: var(--accent); }
.search-status { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; color: var(--text-3); }
.search-status svg { width: 16px; height: 16px; color: var(--accent); animation: spin 2.4s linear infinite; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.source { display: inline-flex; align-items: center; gap: 7px; max-width: 280px; padding: 4px 10px 4px 4px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--bg-2); font-size: 12.5px; color: var(--text-2); transition: border-color .15s, background .15s; }
a.source:hover { border-color: var(--line-2); background: var(--bg-3); color: var(--text); }
.source .sn { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 600; flex-shrink: 0; }
.source .st { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.source .sh { color: var(--text-3); flex-shrink: 0; }
.kb-add .seg.wide { grid-template-columns: repeat(4, 1fr); margin: 14px 16px 0; width: auto; }
.kb-form { padding: 14px 16px 16px; }
.kb-form [data-kb-pane] { display: flex; flex-direction: column; gap: 12px; }
.kb-form [data-kb-pane].hidden { display: none; }
.kb-form .foot { display: flex; justify-content: flex-end; }
.kb-form .auth-msg:empty { display: none; }
.kb-list-head { align-items: center; margin: 26px 0 12px; }
.sub-title { font-size: 16px; font-weight: 600; margin: 0; }
.kb-title { display: flex; flex-direction: column; min-width: 0; white-space: normal; }
.kb-title b { font-weight: 500; }
.kb-title a { color: var(--text-3); font-size: 12px; }
.kb-title a:hover { color: var(--accent); }
.kb-table td:first-child { max-width: 480px; }
@media (max-width: 760px) {
  .kb-add .seg.wide { grid-template-columns: 1fr; }
  .source { max-width: 100%; }
}

/* ------------------------------------------------------------ model picker */
.model-pick { position: relative; padding: 0; max-width: none; }
.model-pick > select { display: none; }
.mp-trigger {
  display: inline-flex; align-items: center; gap: 7px; height: 100%; padding: 0 10px 0 5px; border-radius: inherit;
  color: inherit; font: inherit; font-weight: 550; letter-spacing: -.005em; white-space: nowrap; cursor: pointer;
}
.opt.model-pick .mp-trigger { padding: 0 8px 0 4px; }
.mp-trigger:focus-visible { outline: none; box-shadow: var(--ring); }
.mp-trigger .mp-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.mp-trigger > svg { width: 13px; height: 13px; color: var(--text-3); transform: rotate(90deg); transition: transform .15s var(--ease); }
.mp-trigger[aria-expanded="true"] > svg { transform: rotate(-90deg); }

.mavatar {
  --tone: #3d9bff; flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  font-size: 13px; font-weight: 700; color: #fff; letter-spacing: 0;
  background: linear-gradient(140deg, color-mix(in srgb, var(--tone) 92%, #fff) 0%, color-mix(in srgb, var(--tone) 78%, #000) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 4px 12px -6px var(--tone);
}
.mavatar.own { background: color-mix(in srgb, var(--tone) 16%, var(--bg-3)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 45%, transparent); }
.mavatar.own .mark { width: 62%; height: 62%; object-fit: contain; }
.mavatar.sm { width: 22px; height: 22px; border-radius: 7px; font-size: 11px; }
.mavatar.xs { width: 16px; height: 16px; border-radius: 5px; font-size: 9px; box-shadow: none; }
.mavatar.t-blue { --tone: #3d8bff; } .mavatar.t-green { --tone: #22b07d; } .mavatar.t-violet { --tone: #8b6cff; }
.mavatar.t-amber { --tone: #e0803a; } .mavatar.t-teal { --tone: #14a38b; } .mavatar.t-gray { --tone: #71717a; }

.mp-menu {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 50; width: 300px; max-width: calc(100vw - 32px); max-height: 360px;
  overflow-y: auto; padding: 6px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: var(--shadow); animation: pop .14s var(--ease); color: var(--text);
}
.mp-menu.up { top: auto; bottom: calc(100% + 8px); }
.mp-group { padding: 8px 10px 4px; font-size: 10.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.mp-group:not(:first-child) { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.mp-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border-radius: 10px; text-align: left; cursor: pointer; transition: background .1s; }
.mp-item:hover, .mp-item:focus-visible { background: var(--bg-hover); outline: none; }
.mp-item.on { background: var(--accent-soft); }
.mp-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mp-text b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.mp-text small { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-check { display: grid; place-items: center; width: 18px; height: 18px; color: var(--accent); opacity: 0; }
.mp-check svg { width: 15px; height: 15px; }
.mp-item.on .mp-check { opacity: 1; }

.model-tag { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 760px) {
  .mp-trigger .mp-name { max-width: 110px; }
  .mp-menu { position: fixed; left: 16px; right: 16px; width: auto; top: auto; bottom: 88px; }
}
