/* Pangea — black base, light-green plasma. */
:root {
  color-scheme: dark;

  /* surfaces */
  --bg: #050807;
  --bg-deep: #070c0a;
  --surface: #101613;
  --surface-2: #141c18;
  --surface-3: #1c2722;

  /* text */
  --ink: #e9f6ef;
  --ink-2: #a8c4b8;
  --ink-3: #6d8a7f;
  --ink-4: #47655b;

  /* hairlines */
  --line: rgba(125, 255, 201, 0.12);
  --line-strong: rgba(125, 255, 201, 0.26);

  /* plasma accent */
  --accent: #4ade80;
  --accent-2: #22d3ee;
  --accent-hi: #7cf5c0;
  --accent-ink: #4ade80;
  --accent-soft: rgba(74, 222, 128, 0.14);
  --accent-softer: rgba(74, 222, 128, 0.07);

  /* semantic */
  --sage: #4ade80;
  --sage-soft: rgba(74, 222, 128, 0.15);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.13);
  --blue: #38bdf8;

  --radius: 16px;
  --radius-sm: 10px;

  /* shadows / glows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.45), 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.65);
  --glow-sm: 0 0 12px rgba(74, 222, 128, 0.15);
  --glow: 0 0 24px rgba(74, 222, 128, 0.18);
  --glow-strong: 0 0 18px rgba(74, 222, 128, 0.28), 0 0 48px rgba(34, 211, 238, 0.14);

  --sans: "Segoe UI Variable Text", "Segoe UI", -apple-system, system-ui, sans-serif;
  --serif: "Segoe UI Variable Display", "Segoe UI", -apple-system, system-ui, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  position: relative;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font-family: inherit; color: inherit; }
.hidden { display: none !important; }
.hidden-input { display: none; }
::selection { background: rgba(74, 222, 128, 0.28); color: #ffffff; }
button:focus-visible, a:focus-visible, .crumb:focus-visible {
  outline: 2px solid rgba(124, 245, 192, 0.65);
  outline-offset: 2px;
}

/* dark scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(125, 255, 201, 0.16) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(125, 255, 201, 0.14);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(125, 255, 201, 0.26); }
::-webkit-scrollbar-corner { background: transparent; }

/* ── aurora ───────────────────────────────────────────────────────────── */
body::before, body::after, #app::before {
  content: "";
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  will-change: transform, opacity;
}
body::before {
  z-index: 0;
  width: 64vw; height: 64vw; min-width: 720px; min-height: 720px;
  top: -30vw; left: -18vw;
  background: radial-gradient(circle, rgba(74, 222, 128, 0.15) 0%, rgba(74, 222, 128, 0.05) 38%, transparent 68%);
  animation: aurora-a 34s ease-in-out infinite alternate;
}
body::after {
  z-index: 0;
  width: 58vw; height: 58vw; min-width: 640px; min-height: 640px;
  bottom: -28vw; right: -20vw;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.12) 0%, rgba(34, 211, 238, 0.04) 40%, transparent 70%);
  animation: aurora-b 40s ease-in-out infinite alternate;
}
#app::before {
  z-index: -1;
  width: 44vw; height: 44vw; min-width: 520px; min-height: 520px;
  top: -14vw; right: 4vw;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.10) 0%, rgba(45, 212, 191, 0.035) 42%, transparent 70%);
  animation: aurora-c 28s ease-in-out infinite alternate;
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 0;
  height: 100vh;
  transition: grid-template-columns 0.18s ease;
}
body.panel-open .app { grid-template-columns: 268px minmax(0, 1fr) 336px; }

/* ── sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  background: linear-gradient(180deg, #0b1210 0%, #070c0a 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 12px;
  gap: 14px;
  overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 4px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #03231a;
  display: grid; place-items: center;
  box-shadow: 0 0 16px rgba(74, 222, 128, 0.35), 0 2px 8px rgba(0, 0, 0, 0.4);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: 0.1px; }
.brand-tag { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.2px; }

.new-task {
  display: flex; align-items: center; gap: 9px;
  background: linear-gradient(180deg, #121b17, #0e1612);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(125, 255, 201, 0.06);
  color: var(--ink);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.new-task:hover {
  border-color: rgba(125, 255, 201, 0.4);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), var(--glow);
}
.new-task-hint { margin-left: auto; font-size: 10.5px; color: var(--ink-4); }
.new-task svg { color: var(--accent-hi); filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.55)); }

.side-section { display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.side-conversations { flex: 1; overflow: hidden; }
.side-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-3);
}
.side-list { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.side-row {
  position: relative;
  display: flex; align-items: center; gap: 2px; border-radius: 8px;
  color: var(--ink-2); min-width: 0;
  transition: background 0.12s, color 0.12s;
}
.side-row:hover { background: rgba(125, 255, 201, 0.07); color: var(--ink); }
.side-row.active { background: rgba(74, 222, 128, 0.09); color: var(--ink); box-shadow: var(--glow-sm); }
.side-row.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.55);
}
.side-row-main {
  display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0;
  padding: 7px 2px 7px 9px; text-align: left; color: inherit; border-radius: 8px;
}
.side-row-icon { color: var(--ink-3); display: grid; place-items: center; flex: none; }
.side-row.active .side-row-icon { color: var(--accent-hi); }
.side-row-label {
  flex: 1; min-width: 0; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-row-more {
  width: 26px; height: 26px; margin-right: 4px; border-radius: 7px;
  display: grid; place-items: center; color: var(--ink-3); flex: none;
  opacity: 0; transition: opacity 0.12s, background 0.12s, color 0.12s;
}
.side-row:hover .side-row-more, .side-row:focus-within .side-row-more { opacity: 1; }
.side-row-more:hover { background: var(--surface-3); color: var(--ink); }
.side-recent { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; }
.side-recent .side-list { flex: 1; min-height: 0; }
.side-filter {
  width: 100%; padding: 5px 11px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font-size: 12px; outline: none; color: var(--ink);
}
.side-filter::placeholder { color: var(--ink-4); }
.side-filter:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.14), var(--glow-sm); }
.side-empty { font-size: 12px; color: var(--ink-4); padding: 4px 9px; }
.side-footer {
  display: flex; align-items: center; gap: 7px; padding: 8px 9px 2px;
  border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-3);
}
.side-footer .engine-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.engine-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--sage); box-shadow: 0 0 0 3px var(--sage-soft), 0 0 10px rgba(74, 222, 128, 0.55); }
.engine-dot.error { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft), 0 0 10px rgba(248, 113, 113, 0.55); }
.side-settings-button { margin-left: auto; width: 26px; height: 26px; flex: none; }

.icon-button {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; color: var(--ink-3);
  transition: background 0.14s, color 0.14s;
}
.icon-button:hover { background: var(--surface-3); color: var(--ink); }
.icon-button.active { background: var(--accent-soft); color: var(--accent-hi); }

/* ── main ────────────────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; position: relative; }

/* home */
.home { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.home-inner {
  max-width: 780px; margin: 0 auto;
  padding: clamp(40px, 8vh, 96px) 32px 80px;
  display: flex; flex-direction: column; gap: 34px;
  animation: fade-up 0.22s ease both;
}
.hero { display: flex; flex-direction: column; gap: 6px; }
.hero-greeting { font-size: 13.5px; color: var(--accent-hi); letter-spacing: 0.4px; font-weight: 600; }
.hero-title {
  margin: 0; font-family: var(--serif); font-weight: 600;
  font-size: clamp(36px, 4.6vw, 50px); line-height: 1.14; letter-spacing: -1.2px;
  /* Gradient text clips to the line box; the padding + looser line-height keep
     descenders (the tail of the "g") inside the painted background. */
  display: inline-block; padding-bottom: 0.08em;
  background: linear-gradient(115deg, #f4fbf7 15%, #9df5c8 55%, #67e8f9 92%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { margin: 8px 0 0; color: var(--ink-2); font-size: 15px; max-width: 52ch; }

.home-section { display: flex; flex-direction: column; gap: 10px; }
.home-section-title { font-size: 11.5px; font-weight: 600; letter-spacing: 0.7px; text-transform: uppercase; color: var(--ink-3); }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.project-card {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 13px; padding: 13px 14px; min-width: 0;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s;
}
.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--glow);
  border-color: rgba(125, 255, 201, 0.32);
}
.project-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15), var(--glow);
}
.project-card-icon { color: var(--accent); filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.4)); }
.project-card-name { font-weight: 600; font-size: 13.5px; }
.project-card-path { font-size: 11px; color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.project-card-add { border-style: dashed; background: transparent; color: var(--ink-3); align-items: center; justify-content: center; min-height: 74px; }
.add-project-card {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 26px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  color: var(--ink-2); background: rgba(125, 255, 201, 0.03);
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s;
}
.add-project-card:hover { border-color: var(--accent); background: var(--accent-softer); box-shadow: var(--glow-sm); }
.add-project-icon { color: var(--accent); }
.add-project-title { font-weight: 600; font-size: 15px; }
.add-project-sub { font-size: 12.5px; color: var(--ink-3); }

.recent-list { display: flex; flex-direction: column; }
.recent-row {
  display: flex; align-items: center; gap: 11px; text-align: left;
  padding: 10px 12px; border-radius: 10px;
  transition: background 0.14s, box-shadow 0.14s;
}
.recent-row:hover { background: var(--surface); box-shadow: var(--glow-sm); }
.recent-icon { color: var(--ink-3); }
.recent-row:hover .recent-icon { color: var(--accent-hi); }
.recent-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.recent-title { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-meta { font-size: 11.5px; color: var(--ink-4); }
.recent-chevron { color: var(--ink-4); }
.recent-row:hover .recent-chevron { color: var(--accent-hi); }

/* ── composer ────────────────────────────────────────────────────────── */
.composer {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(125, 255, 201, 0.05);
  padding: 12px 12px 9px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.composer:focus-within {
  border-color: rgba(125, 255, 201, 0.45);
  box-shadow: var(--shadow-md), 0 0 0 4px rgba(74, 222, 128, 0.08), var(--glow);
}
.composer-home { padding: 16px 16px 11px; border-radius: 20px; }
.composer.drag-over {
  border-color: var(--accent); background: var(--accent-softer);
  box-shadow: var(--shadow-md), 0 0 0 4px rgba(74, 222, 128, 0.16), var(--glow-strong);
}
.composer.disabled textarea { color: var(--ink-3); cursor: not-allowed; }
.composer textarea {
  width: 100%; border: none; outline: none; resize: none; background: transparent;
  font-size: 15px; line-height: 1.55; padding: 2px 4px; max-height: 220px; min-height: 24px;
  caret-color: var(--accent-hi);
}
.composer textarea::placeholder { color: var(--ink-4); }
.composer-attachments { display: flex; flex-wrap: wrap; gap: 6px; }
.attachment-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 220px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 8px 3px 9px; font-size: 11.5px; color: var(--ink-2);
}
.attachment-chip.static { background: var(--surface-3); }
.attachment-icon { color: var(--ink-3); display: grid; place-items: center; }
.attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-remove { color: var(--ink-3); display: grid; place-items: center; padding: 1px; border-radius: 50%; }
.attachment-remove:hover { color: var(--red); background: var(--red-soft); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.project-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  font-size: 11.5px; color: var(--ink-2); max-width: 220px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.project-chip svg { color: var(--accent); }
.composer-hint { font-size: 11px; color: var(--ink-4); margin-right: 4px; }
.send-button {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04231a;
  display: grid; place-items: center;
  box-shadow: 0 2px 10px rgba(74, 222, 128, 0.4), 0 0 20px rgba(74, 222, 128, 0.3);
  transition: transform 0.14s, filter 0.14s, opacity 0.14s, box-shadow 0.14s;
}
.send-button:hover { filter: brightness(1.12); transform: translateY(-1px); box-shadow: 0 3px 12px rgba(74, 222, 128, 0.5), 0 0 30px rgba(74, 222, 128, 0.45); }
.send-button:active { transform: scale(0.95); }
.send-button:disabled { opacity: 0.4; pointer-events: none; box-shadow: none; }

/* ── session ─────────────────────────────────────────────────────────── */
.session { display: flex; flex-direction: column; height: 100vh; min-height: 0; }
.session-header {
  border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 11, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  position: relative; z-index: 5;
}
.header-inner { display: flex; align-items: center; gap: 10px; padding: 10px 18px; }
.header-titles { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.header-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-sub { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-3); }
.header-sub svg { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.usage-meter { display: flex; align-items: center; gap: 6px; }
.usage-inner { display: flex; align-items: center; gap: 6px; }
.usage-rail { width: 44px; height: 5px; border-radius: 999px; background: rgba(125, 255, 201, 0.1); overflow: hidden; }
.usage-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.55);
  transition: width 0.25s ease;
}
.usage-label { font-size: 10.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.model-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 9px; border-radius: 999px; font-size: 12px; color: var(--ink-2);
  border: 1px solid transparent; transition: background 0.14s, border-color 0.14s;
}
.model-chip:hover { background: var(--surface); border-color: var(--line); }
.model-chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 8px rgba(74, 222, 128, 0.7); }
.effort-chip { font-size: 10.5px; color: var(--ink-4); padding-left: 6px; border-left: 1px solid var(--line-strong); }
.model-chip-chevron { color: var(--ink-4); display: grid; place-items: center; }
.model-menu {
  position: absolute; top: 54px; right: 18px; z-index: 30;
  min-width: 260px; max-height: 70vh; overflow-y: auto;
  background: linear-gradient(180deg, #131c18, #101613);
  border: 1px solid var(--line); border-radius: 13px;
  box-shadow: var(--shadow-lg), var(--glow-sm); padding: 7px;
  animation: pop-in 0.14s ease both;
}
.menu-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-4); padding: 8px 9px 4px; }
.menu-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; padding: 7px 9px; border-radius: 8px; font-size: 13px;
  color: var(--ink-2);
}
.menu-row:hover { background: var(--surface-3); color: var(--ink); }
.menu-row.selected { color: var(--accent-hi); font-weight: 600; }
.menu-row.compact { font-size: 12.5px; }
.menu-check { color: var(--accent); display: grid; place-items: center; }
.menu-empty { padding: 12px; font-size: 12px; color: var(--ink-3); }

.thread {
  flex: 1; overflow-y: auto; padding: 26px 0 18px;
  scroll-behavior: smooth; overscroll-behavior: contain;
}
.thread > * { max-width: 780px; min-width: 0; margin-left: auto; margin-right: auto; padding-left: 32px; padding-right: 32px; }
.msg { animation: fade-up 0.22s ease both; }
.msg-user { display: flex; justify-content: flex-end; padding-top: 6px; padding-bottom: 14px; }
.msg-user-bubble {
  background: linear-gradient(180deg, #16241e, #101a15);
  border: 1px solid rgba(125, 255, 201, 0.18);
  border-radius: 16px 16px 6px 16px; padding: 10px 14px;
  max-width: 78%; min-width: 0; box-shadow: var(--shadow-sm), var(--glow-sm); white-space: pre-wrap;
  word-break: break-word; overflow-wrap: anywhere;
  font-size: 14.5px;
}
.msg-attachments { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.msg-assistant { padding-top: 2px; padding-bottom: 10px; }
.assistant-body { font-size: 15px; line-height: 1.68; color: var(--ink); word-break: break-word; overflow-wrap: anywhere; min-width: 0; }
.assistant-body .reveal { animation: fade-up 0.22s ease both; }
.md pre.reveal, .md .code-block.reveal { animation: fade-up 0.22s ease both; }
.md { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0.55em 0; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 1.1em 0 0.45em; letter-spacing: -0.3px; overflow-wrap: anywhere; }
.md h1 { font-size: 26px; } .md h2 { font-size: 21px; } .md h3 { font-size: 17.5px; } .md h4 { font-size: 15.5px; }
.md ul, .md ol { margin: 0.5em 0; padding-left: 1.35em; }
.md li { margin: 0.22em 0; overflow-wrap: anywhere; }
.md li::marker { color: var(--ink-4); }
.md a { color: var(--accent-hi); text-decoration: underline; text-decoration-color: rgba(74, 222, 128, 0.35); text-underline-offset: 3px; overflow-wrap: anywhere; word-break: break-all; }
.md a:hover { text-decoration-color: var(--accent-hi); }
.md blockquote { margin: 0.7em 0; padding: 2px 0 2px 14px; border-left: 3px solid rgba(74, 222, 128, 0.35); color: var(--ink-2); overflow-wrap: anywhere; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 1.4em 0; }
.md code.inline-code {
  font-family: var(--mono); font-size: 0.86em;
  background: rgba(125, 255, 201, 0.08); color: #c9e9da;
  border: 1px solid var(--line); border-radius: 5px; padding: 1.5px 5px;
  overflow-wrap: anywhere; word-break: break-all;
}
.md .table-wrap { overflow-x: auto; margin: 0.8em 0; max-width: 100%; }
.md table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; overflow-wrap: anywhere; word-break: break-word; }
.md th { background: rgba(125, 255, 201, 0.06); font-weight: 600; }
.code-block {
  position: relative; background: #0a0f0d; color: #d7eee3;
  border: 1px solid var(--line);
  border-radius: 12px; margin: 0.9em 0; overflow: hidden; box-shadow: var(--shadow-sm);
}
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; overflow-wrap: anywhere; }
.code-block code { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.code-copy {
  position: absolute; top: 8px; right: 8px; font-size: 10.5px; color: #9ab8a8;
  background: rgba(125, 255, 201, 0.08); border: 1px solid rgba(125, 255, 201, 0.12); border-radius: 6px; padding: 3px 8px;
  opacity: 0; transition: opacity 0.15s, background 0.15s;
}
.code-block:hover .code-copy { opacity: 1; }
.code-copy:hover { background: rgba(125, 255, 201, 0.16); color: #fff; }

.thought { margin: 4px auto 10px; }
.thought summary {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-3); cursor: pointer; list-style: none;
  padding: 3px 9px 3px 7px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line);
  transition: color 0.14s, border-color 0.14s;
}
.thought summary:hover { color: var(--ink-2); border-color: var(--line-strong); }
.thought summary::-webkit-details-marker { display: none; }
.thought-icon { color: var(--ink-4); display: grid; place-items: center; }
.thought[open] summary { color: var(--ink-2); border-color: rgba(125, 255, 201, 0.3); }
.thought[open] .thought-icon { color: var(--accent-hi); }
.thought-body {
  margin-top: 7px; padding: 10px 13px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2); white-space: pre-wrap;
  max-height: 260px; overflow-y: auto;
}
.tool-card {
  position: relative;
  margin: 6px auto 10px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden;
  transition: border-color 0.16s;
}
.tool-card.running { border-color: rgba(74, 222, 128, 0.45); background: linear-gradient(180deg, #121b17, #0e1612); }
.tool-card.running::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 18px rgba(74, 222, 128, 0.25), inset 0 0 14px rgba(74, 222, 128, 0.07);
  animation: glow-pulse 1.8s ease-in-out infinite;
}
.tool-head { display: flex; align-items: center; gap: 9px; padding: 8px 12px; }
.tool-icon { color: var(--ink-3); display: grid; place-items: center; }
.tool-card.running .tool-icon { color: #67e8f9; animation: glow-pulse 1.8s ease-in-out infinite; }
.tool-title { flex: 1; min-width: 0; font-size: 12.8px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-status { font-size: 10.5px; letter-spacing: 0.3px; padding: 2px 7px; border-radius: 999px; flex: none; }
.status-running { color: #67e8f9; background: rgba(34, 211, 238, 0.12); }
.tool-card.running .tool-status::after { content: "…"; }
.status-done { color: #6ee7a8; background: rgba(74, 222, 128, 0.13); }
.status-failed { color: #fda4a4; background: rgba(248, 113, 113, 0.13); }
.tool-detail { border-top: 1px solid var(--line); }
.tool-detail summary { padding: 6px 12px; font-size: 11.5px; color: var(--ink-3); cursor: pointer; transition: color 0.14s; }
.tool-detail summary:hover { color: var(--accent-hi); }
.tool-output {
  margin: 0; padding: 10px 13px; background: rgba(4, 8, 6, 0.5);
  font-family: var(--mono); font-size: 11.8px; line-height: 1.55; color: #b9d4c8;
  max-height: 240px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}
.permission-card {
  margin: 10px auto; border: 1px solid rgba(251, 191, 36, 0.35); border-radius: 14px;
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.07), rgba(251, 191, 36, 0.02)), var(--surface);
  padding: 13px 15px; box-shadow: 0 4px 18px rgba(251, 191, 36, 0.1);
  animation: fade-up 0.22s ease both;
}
.permission-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.permission-icon { color: var(--amber); display: grid; place-items: center; filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.5)); }
.permission-sub { font-size: 12.5px; color: var(--ink-2); margin: 5px 0 12px; }
.permission-actions { display: flex; gap: 8px; }
.permission-card.resolving { opacity: 0.6; pointer-events: none; }
.permission-card.resolved { background: var(--surface-2); border-color: var(--line); padding: 9px 13px; }
.permission-resolved { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); }
.button {
  padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 600;
  border: 1px solid transparent; transition: background 0.14s, transform 0.14s, border-color 0.14s, filter 0.14s, box-shadow 0.14s;
}
.button:active { transform: scale(0.97); }
.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #04231a;
  box-shadow: 0 2px 8px rgba(74, 222, 128, 0.35), 0 0 18px rgba(74, 222, 128, 0.25);
}
.button.primary:hover { filter: brightness(1.1); box-shadow: 0 3px 10px rgba(74, 222, 128, 0.45), 0 0 26px rgba(74, 222, 128, 0.35); }
.button.ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.button.ghost:hover { background: var(--surface-3); color: var(--ink); border-color: rgba(125, 255, 201, 0.4); }
.button.small { padding: 5px 10px; font-size: 12px; }
.button.danger { background: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(248, 113, 113, 0.3); }
.button.danger:hover { background: #f98a8a; }
.msg-error {
  display: flex; align-items: center; gap: 8px; margin: 10px auto;
  padding: 10px 13px; border-radius: 11px; background: var(--red-soft);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fda4a4; font-size: 13px;
}
.turn-foot { display: flex; align-items: center; gap: 12px; margin: 14px auto 4px; opacity: 0.75; }
.turn-rule { flex: 1; height: 1px; background: var(--line); }
.turn-meta { font-size: 10.5px; color: var(--ink-4); letter-spacing: 0.4px; text-transform: uppercase; }
.plan-card { margin: 10px auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 12px 15px; }
.plan-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--ink-3); margin-bottom: 6px; }
.plan-card ol { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }

/* Changed-files card under a finished turn */
.changes-card { margin: 10px auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 12px 15px; box-shadow: var(--shadow-sm); animation: fade-up 0.22s ease both; }
.changes-title { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 9px; }
.changes-title svg { color: var(--accent); }
.changes-groups { display: flex; flex-direction: column; gap: 8px; }
.changes-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-4); margin-bottom: 3px; }
.changes-group.tone-sage .changes-group-label { color: #6ee7a8; }
.changes-group.tone-amber .changes-group-label { color: #fcd34d; }
.changes-group.tone-red .changes-group-label { color: #fca5a5; }
.changes-group-files { display: flex; flex-wrap: wrap; gap: 4px; }
.changes-file {
  display: inline-flex; align-items: center; gap: 5px; max-width: 260px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px;
  padding: 3px 8px; font-size: 11.5px; color: var(--ink-2);
  transition: background 0.13s, border-color 0.13s;
}
.changes-file:hover { background: var(--surface-3); border-color: rgba(125, 255, 201, 0.35); }
.changes-file-icon { color: var(--ink-3); display: grid; place-items: center; flex: none; }
.changes-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.changes-more { font-size: 11px; color: var(--ink-4); padding: 2px 4px; }

.composer-dock { padding: 8px 0 18px; background: linear-gradient(180deg, rgba(5, 8, 7, 0), var(--bg) 40%); }
.composer-dock .composer { max-width: 780px; margin: 0 auto; }
.working-bar {
  display: flex; align-items: center; gap: 9px;
  margin: -30px auto 8px; max-width: 780px;
  padding: 5px 10px 5px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow-sm), var(--glow-sm); font-size: 12px; color: var(--ink-2);
  animation: fade-up 0.2s ease both;
}
.working-dots { display: inline-flex; gap: 3px; }
.working-dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px rgba(74, 222, 128, 0.8); animation: pulse 1.15s infinite ease-in-out; }
.working-dots span:nth-child(2) { animation-delay: 0.16s; }
.working-dots span:nth-child(3) { animation-delay: 0.32s; }
.working-dots.paused span { background: var(--amber); box-shadow: 0 0 6px rgba(251, 191, 36, 0.8); animation-play-state: paused; }
.working-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.working-elapsed { font-variant-numeric: tabular-nums; color: var(--ink-4); font-size: 11px; }
.working-stop { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-3); }
.working-stop:hover { background: var(--red-soft); color: var(--red); }

/* ── files panel ─────────────────────────────────────────────────────── */
.panel {
  border-left: 1px solid var(--line); background: var(--surface-2);
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px 8px 16px;
}
.panel-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.panel-title svg { color: var(--accent); }
.panel-actions { display: flex; gap: 2px; }
.panel-crumbs {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 0 16px 10px; font-size: 11.5px; color: var(--ink-3);
}
.crumb { color: var(--ink-3); padding: 1px 4px; border-radius: 5px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb:hover { background: var(--surface-3); color: var(--ink); }
.crumb-sep { color: var(--ink-4); }
.panel-list { flex: 1; overflow-y: auto; padding: 0 8px 16px; scroll-behavior: smooth; }
.file-row {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 6px 9px; border-radius: 8px; font-size: 12.8px; color: var(--ink-2);
  transition: background 0.12s, color 0.12s;
}
.file-row:hover { background: var(--surface); color: var(--ink); box-shadow: var(--glow-sm); }
.file-row .file-icon { color: var(--ink-3); display: grid; place-items: center; flex: none; }
.file-row.dir .file-icon { color: var(--accent); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 10.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.file-row.up { color: var(--ink-3); font-size: 12px; }
.panel-empty { font-size: 12px; color: var(--ink-4); padding: 10px 16px; }

/* ── modal ───────────────────────────────────────────────────────────── */
.modal-root { position: fixed; inset: 0; z-index: 100; display: none; }
.modal-root.open { display: block; }
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(2, 5, 4, 0.62);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 3vh 3vw;
  animation: fade 0.16s ease both;
}
.modal {
  width: min(960px, 94vw); max-height: 88vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #141d19, #0f1613);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-lg), var(--glow-sm); overflow: hidden;
  animation: pop-in 0.16s ease both;
}
.modal-small { width: min(480px, 92vw); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line);
}
.modal-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; min-width: 0; }
.modal-title svg { color: var(--accent); }
.modal-title span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-actions { display: flex; align-items: center; gap: 6px; }
.modal-body { flex: 1; overflow: auto; min-height: 120px; }
.modal-loading { padding: 40px; text-align: center; color: var(--ink-3); font-size: 13px; }
.modal-form { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.field-label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--ink-3); }
.text-input {
  border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 11px;
  font-size: 13.5px; outline: none; background: var(--surface-2); color: var(--ink);
}
.text-input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.12); }
.modal-hint { font-size: 11.5px; color: var(--ink-4); margin: 0; }
.modal-form .modal-actions { justify-content: flex-end; margin-top: 4px; }
.preview-text {
  margin: 0; padding: 18px 22px; font-family: var(--mono); font-size: 12.5px;
  line-height: 1.6; white-space: pre-wrap; word-break: break-word; color: #c9ded4;
}
.preview-markdown { padding: 22px 28px; }
.preview-image { display: block; max-width: 100%; margin: 0 auto; padding: 16px; }
.preview-note { padding: 8px 22px 16px; font-size: 11.5px; color: var(--ink-4); }
.preview-meta { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 44px 20px; }
.preview-meta-icon { color: var(--ink-4); }
.preview-meta-name { font-weight: 600; }
.preview-meta-sub { font-size: 12px; color: var(--ink-4); margin-bottom: 8px; }

/* ── toast ───────────────────────────────────────────────────────────── */
.toast-root {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 200; pointer-events: none;
}
.toast {
  background: #0e1813; color: #e9f6ef; font-size: 12.5px;
  border: 1px solid rgba(125, 255, 201, 0.22);
  padding: 8px 15px; border-radius: 999px;
  box-shadow: var(--shadow-lg), var(--glow-sm);
  animation: toast-in 0.22s ease both;
}
.toast-error { background: #251210; border-color: rgba(248, 113, 113, 0.4); }
.toast-warn { background: #221b0c; border-color: rgba(251, 191, 36, 0.4); }
.toast-out { animation: toast-out 0.3s ease both; }

.fatal { padding: 60px; text-align: center; font-size: 15px; color: #fda4a4; }

/* ── context menu ─────────────────────────────────────────────────────── */
.context-menu {
  position: fixed; z-index: 300; min-width: 200px; padding: 6px;
  background: linear-gradient(180deg, #131c18, #101613);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); animation: pop-in 0.14s ease both;
}
.context-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 7px 9px; border-radius: 8px; font-size: 13px; color: var(--ink-2);
}
.context-item:hover { background: var(--surface-3); color: var(--ink); }
.context-item.danger { color: #fda4a4; }
.context-item.danger:hover { background: var(--red-soft); }
.context-icon { display: grid; place-items: center; color: var(--ink-3); }
.context-item.danger .context-icon { color: var(--red); }
.context-divider { height: 1px; background: var(--line); margin: 5px 8px; }

/* ── slash command menu ───────────────────────────────────────────────── */
.slash-menu {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% + 8px); z-index: 20;
  background: linear-gradient(180deg, #131c18, #101613);
  border: 1px solid var(--line); border-radius: 13px;
  box-shadow: var(--shadow-lg), var(--glow-sm); padding: 6px; max-height: 300px; overflow-y: auto;
  animation: pop-in 0.14s ease both;
}
.slash-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: 8px; font-size: 13px; color: var(--ink-2);
}
.slash-item.selected { background: var(--accent-soft); color: var(--ink); }
.slash-cmd { font-family: var(--mono); font-size: 12px; color: var(--accent-hi); font-weight: 600; min-width: 56px; }
.slash-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── settings popover ─────────────────────────────────────────────────── */
.settings-popover {
  position: fixed; z-index: 300; width: 304px;
  background: linear-gradient(180deg, #131c18, #101613);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 8px 6px; animation: pop-in 0.14s ease both;
}
.settings-head {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--ink-4); padding: 6px 10px 8px;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 10px; border-radius: 9px; cursor: pointer;
}
.settings-row:hover { background: var(--surface-3); }
.settings-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.settings-label { font-size: 13px; }
.settings-warn { font-size: 10.5px; color: var(--ink-4); line-height: 1.35; }
.switch-input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px;
  background: rgba(125, 255, 201, 0.14); transition: background 0.18s, box-shadow 0.18s;
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #e9f6ef; box-shadow: var(--shadow-sm); transition: left 0.18s;
}
.switch-input:checked + .switch-track {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.4);
}
.switch-input:checked + .switch-track .switch-thumb { left: 16px; }
.settings-number {
  width: 64px; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface-2); font-size: 12.5px; outline: none; font-variant-numeric: tabular-nums; color: var(--ink);
}
.settings-number:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.12); }
.settings-log-section { border-top: 1px solid var(--line); margin-top: 6px; padding: 6px 4px 2px; }
.settings-log-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 7px 10px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2);
}
.settings-log-toggle:hover { background: var(--surface-3); }
.settings-chevron { display: grid; place-items: center; color: var(--ink-4); }
.settings-log-body { padding: 6px 10px 8px; }
.settings-log-hint { font-size: 11.5px; color: var(--ink-4); }
.settings-log-lines {
  margin: 0; max-height: 220px; overflow: auto;
  background: #060b09; color: #a9cbb9;
  border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-family: var(--mono); font-size: 10.8px;
  line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}

/* ── onboarding ───────────────────────────────────────────────────────── */
.modal-onboard { width: min(520px, 94vw); }
.onboard-inner {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 12px; padding: 34px 30px 28px; overflow-y: auto;
}
.onboard-mark {
  width: 54px; height: 54px; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #03231a;
  display: grid; place-items: center;
  box-shadow: 0 0 26px rgba(74, 222, 128, 0.4), 0 4px 18px rgba(34, 211, 238, 0.2);
}
.onboard-title { font-family: var(--serif); font-size: 28px; font-weight: 600; letter-spacing: -0.3px; }
.onboard-sub { margin: 0; color: var(--ink-2); font-size: 14px; max-width: 44ch; }
.onboard-samples { display: flex; flex-direction: column; gap: 7px; width: 100%; }
.onboard-chip {
  padding: 10px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2);
  font-size: 13px; color: var(--ink-2); text-align: left;
  transition: border-color 0.14s, background 0.14s, transform 0.14s, color 0.14s, box-shadow 0.14s;
}
.onboard-chip:hover { border-color: var(--accent); background: var(--accent-softer); color: var(--ink); transform: translateY(-1px); box-shadow: var(--glow-sm); }
.onboard-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ── upcoming components (JS will adopt without CSS changes) ──────────── */
/* composer voice input */
.mic-button {
  position: relative;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-3); flex: none;
  border: 1px solid transparent;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.mic-button:hover { color: var(--ink); background: var(--surface-3); }
.mic-button.recording {
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
}
.mic-button.recording::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid rgba(248, 113, 113, 0.55);
  animation: mic-ring 1.5s ease-out infinite;
}
.mic-button.recording.live {
  color: #7cf5c0;
  background: var(--accent-soft);
  border-color: rgba(74, 222, 128, 0.4);
}
.mic-button.recording.live::after { border-color: rgba(74, 222, 128, 0.55); }

/* tiny speak-aloud button under assistant messages */
.tts-button {
  width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center; flex: none;
  color: var(--ink-4); opacity: 0.45;
  margin: 2px 0 0;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.tts-button:hover { color: var(--accent-hi); opacity: 1; background: var(--accent-soft); }
.tts-button.speaking { color: #67e8f9; opacity: 1; animation: pulse 1.15s infinite ease-in-out; }

/* framed inline artifact preview in the thread */
.artifact-card {
  margin: 8px auto; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface-2); overflow: hidden;
  box-shadow: var(--shadow-sm), var(--glow-sm);
  animation: fade-up 0.22s ease both;
}
.artifact-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--ink-3); border-bottom: 1px solid var(--line);
}
.artifact-head svg { color: var(--accent); }
.artifact-frame { background: #060b09; }
.artifact-frame iframe {
  display: block; width: 100%; height: clamp(280px, 48vh, 460px);
  border: none; background: #050807;
}

/* home-section list of scheduled automations */
.automations-section { display: flex; flex-direction: column; gap: 8px; }
.automation-row {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.automation-row:hover {
  border-color: rgba(125, 255, 201, 0.35);
  box-shadow: var(--shadow-md), var(--glow);
  transform: translateY(-1px);
}
.automation-row .automation-label {
  flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.automation-status {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px;
  padding: 2px 8px; border-radius: 999px; flex: none;
}
.automation-status.scheduled { color: #67e8f9; background: rgba(34, 211, 238, 0.12); }
.automation-status.running { color: #6ee7a8; background: rgba(74, 222, 128, 0.13); box-shadow: 0 0 10px rgba(74, 222, 128, 0.3); animation: glow-pulse 1.8s ease-in-out infinite; }
.automation-status.done { color: var(--ink-3); background: rgba(125, 255, 201, 0.08); }
.automation-status.paused { color: #fcd34d; background: rgba(251, 191, 36, 0.13); }
.automation-status.error { color: #fda4a4; background: rgba(248, 113, 113, 0.13); }
.automation-actions { display: flex; gap: 4px; flex: none; }
.automation-actions .icon-button { width: 26px; height: 26px; border-radius: 7px; }

/* brand mark used in onboarding */
.brand-logo {
  width: 64px; height: 64px; border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #03231a;
  display: grid; place-items: center;
  box-shadow: 0 0 32px rgba(74, 222, 128, 0.35), 0 4px 18px rgba(34, 211, 238, 0.2);
}

/* ── sign-in gate ─────────────────────────────────────────────────────── */
.login-view {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1100px 640px at 28% -6%, rgba(74, 222, 128, 0.09), transparent 62%),
    radial-gradient(900px 560px at 104% 104%, rgba(34, 211, 238, 0.07), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(400px, 92vw);
  display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(180deg, #131c18, #0f1613);
  border: 1px solid var(--line); border-radius: 20px;
  padding: 32px 30px 26px; text-align: center;
  box-shadow: var(--shadow-lg), var(--glow);
  animation: pop-in 0.18s ease both;
}
.login-brand {
  width: 56px; height: 56px; margin: 0 auto; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #03231a;
  display: grid; place-items: center;
  box-shadow: 0 0 28px rgba(74, 222, 128, 0.4), 0 4px 18px rgba(34, 211, 238, 0.2);
}
.login-title { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: -0.3px; }
.login-sub { margin: 0 0 4px; color: var(--ink-2); font-size: 13px; }
.login-input { text-align: left; }
.login-error {
  color: #fda4a4; font-size: 12.5px; text-align: left;
  background: var(--red-soft); border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 9px; padding: 7px 10px; margin: 0;
}
.login-submit { width: 100%; padding: 10px 14px; font-size: 13.5px; }
.login-submit:disabled { opacity: 0.55; pointer-events: none; }
.login-hint { margin: 0; font-size: 11.5px; color: var(--ink-4); }

/* ── people ───────────────────────────────────────────────────────────── */
.people-view { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.people-inner {
  max-width: 780px; margin: 0 auto;
  padding: clamp(30px, 6vh, 60px) 32px 80px;
  display: flex; flex-direction: column; gap: 24px;
  animation: fade-up 0.22s ease both;
}
.view-header { display: flex; align-items: center; gap: 12px; }
.view-back { flex: none; width: 34px; height: 34px; }
.view-header-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.view-header-title { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -0.6px; line-height: 1.1; }
.view-header-sub { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }

.people-toggle-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 17px 20px; box-shadow: var(--shadow-sm);
  transition: border-color 0.16s, box-shadow 0.16s;
}
.people-toggle-card:hover { border-color: rgba(125, 255, 201, 0.32); box-shadow: var(--shadow-md), var(--glow); }
.people-toggle-icon { color: var(--accent); display: grid; place-items: center; flex: none; filter: drop-shadow(0 0 8px rgba(74, 222, 128, 0.4)); }
.people-toggle-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.people-toggle-title { font-size: 15px; font-weight: 600; }
.people-toggle-sub { font-size: 12.5px; color: var(--ink-3); }
.people-switch { cursor: pointer; flex: none; }
.switch-track-lg { width: 46px; height: 26px; }
.switch-track-lg .switch-thumb { width: 22px; height: 22px; }
.switch-input:checked + .switch-track-lg .switch-thumb { left: 22px; }

.people-add-card {
  display: flex; align-items: center; gap: 12px; text-align: left;
  border: 1.5px dashed var(--line-strong); border-radius: 14px;
  padding: 14px 18px; color: var(--ink-2); background: rgba(125, 255, 201, 0.03);
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s;
}
.people-add-card:hover { border-color: var(--accent); background: var(--accent-softer); box-shadow: var(--glow-sm); }
.people-add-icon { color: var(--accent); display: grid; place-items: center; flex: none; }
.people-add-text { display: flex; flex-direction: column; min-width: 0; }
.people-add-title { font-weight: 600; font-size: 14px; }
.people-add-sub { font-size: 12px; color: var(--ink-3); }

.people-section { display: flex; flex-direction: column; gap: 10px; }
.people-list { display: flex; flex-direction: column; gap: 8px; }
.people-row {
  display: flex; align-items: center; gap: 13px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.people-row:hover { border-color: rgba(125, 255, 201, 0.32); box-shadow: var(--shadow-md), var(--glow); transform: translateY(-1px); }
.avatar-initial {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.2), rgba(34, 211, 238, 0.16));
  border: 1px solid rgba(125, 255, 201, 0.28); color: var(--accent-hi);
  text-transform: uppercase; text-shadow: 0 0 12px rgba(74, 222, 128, 0.5);
}
.people-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.people-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; min-width: 0; }
.people-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-role {
  flex: none; font-size: 10px; letter-spacing: 0.4px; text-transform: uppercase; font-weight: 700;
  color: var(--ink-3); background: rgba(125, 255, 201, 0.08); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 7px;
}
.people-role.owner { color: var(--accent-hi); background: var(--accent-soft); border-color: rgba(74, 222, 128, 0.3); }
.people-email { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-usage { font-size: 11.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.people-status { flex: none; font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px; padding: 3px 9px; border-radius: 999px; }
.people-status.active { color: #6ee7a8; background: rgba(74, 222, 128, 0.13); }
.people-status.disabled { color: #fda4a4; background: rgba(248, 113, 113, 0.13); }
.people-more { flex: none; }
.people-empty { font-size: 13px; color: var(--ink-3); padding: 12px 4px; }
.people-loading, .people-error {
  padding: 28px 6px; color: var(--ink-3); font-size: 13px;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
}

.credentials-box {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
}
.credential-row { display: flex; flex-direction: column; gap: 1px; }
.credential-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-4); font-weight: 600; }
.credential-value { font-family: var(--mono); font-size: 13px; color: var(--accent-hi); word-break: break-all; }

/* ── memory card ──────────────────────────────────────────────────────── */
.memory-section { display: flex; flex-direction: column; gap: 10px; }
.memory-card {
  display: flex; align-items: flex-start; gap: 13px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.memory-card:hover { border-color: rgba(125, 255, 201, 0.32); box-shadow: var(--shadow-md), var(--glow); }
.memory-icon { color: var(--accent); display: grid; place-items: center; flex: none; margin-top: 2px; filter: drop-shadow(0 0 8px rgba(74, 222, 128, 0.4)); }
.memory-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.memory-title { font-weight: 600; font-size: 13.5px; }
.memory-preview {
  font-size: 12.5px; color: var(--ink-2); line-height: 1.5; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.memory-preview.empty { color: var(--ink-4); font-style: italic; }
.memory-actions { display: flex; gap: 8px; flex: none; align-items: center; }

/* ── animations ──────────────────────────────────────────────────────── */
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.35; transform: scale(0.85); } 40% { opacity: 1; transform: scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@keyframes glow-pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
@keyframes mic-ring { from { transform: scale(0.9); opacity: 1; } to { transform: scale(1.55); opacity: 0; } }
@keyframes aurora-a {
  0%   { transform: translate3d(0, 0, 0) scale(1); opacity: 0.85; }
  50%  { transform: translate3d(12vw, 8vh, 0) scale(1.12); opacity: 1; }
  100% { transform: translate3d(-5vw, 14vh, 0) scale(0.96); opacity: 0.7; }
}
@keyframes aurora-b {
  0%   { transform: translate3d(0, 0, 0) scale(1); opacity: 0.75; }
  50%  { transform: translate3d(-10vw, -10vh, 0) scale(1.18); opacity: 1; }
  100% { transform: translate3d(6vw, -4vh, 0) scale(0.92); opacity: 0.65; }
}
@keyframes aurora-c {
  0%   { transform: translate3d(0, 0, 0) scale(1); opacity: 0.6; }
  50%  { transform: translate3d(-8vw, 6vh, 0) scale(1.2); opacity: 0.9; }
  100% { transform: translate3d(8vw, -6vh, 0) scale(0.9); opacity: 0.5; }
}

@media (max-width: 1080px) {
  .app { grid-template-columns: 236px minmax(0, 1fr) 0; }
  body.panel-open .app { grid-template-columns: 236px minmax(0, 1fr) 300px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 0 minmax(0, 1fr) 0; }
  .sidebar { display: none; }
  .thread > * { padding-left: 18px; padding-right: 18px; }
  .composer-dock .composer { margin: 0 14px; }
  .working-bar { margin-left: 14px; margin-right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
