/* LiveGPT — voice home, hybrid orb view, and workstream conversations. */

:root {
  --bg: #07080a;
  --surface: #0e1012;
  --rail-bg: #121417;
  --card-bg: #15171a;
  --border: #1c1f23;
  --border-soft: #22262b;
  --border-strong: #2b3036;
  --text: #e8eaed;
  --text-mid: #b3b9c1;
  --text-dim: #8b9099;
  --text-faint: #6f757e;
  --text-ghost: #5f656d;
  --amber: #f5a97f;
  --amber-dim: #c99f80;
  --amber-border: #3c2a20;
  --amber-bg: #2a1a12;
  --blue: #7fa8d9;
  --blue-dim: #9db8d9;
  --blue-border: #24354a;
  --blue-bg: #131a24;
  --bubble-user: #26466d;
  --bubble-agent: #17191d;
  --green: #7fb894;
  --green-border: #2b3a31;
  --green-bg: #121614;
  --red: #e0796b;
  --red-border: #3a2724;
  --red-bg: #161112;
  --sans: "Geist", system-ui, sans-serif;
  --mono: var(--sans);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button,
select,
a,
input,
summary {
  touch-action: manipulation;
}

.spacer {
  flex: 1;
}

.shell {
  display: flex;
  height: 100dvh;
  background: var(--surface);
  position: relative;
}

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.bar-select {
  appearance: none;
  background: #17191d;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: #c9ced6;
  font: 500 12.5px var(--sans);
  height: 34px;
  padding: 0 12px;
  cursor: pointer;
  min-width: 0;
}

.bar-select:hover {
  background: #1e2126;
}

.bar-chip {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #17191d;
  color: #c9ced6;
  font: 500 12.5px var(--sans);
  text-decoration: none;
  white-space: nowrap;
}

.bar-chip:hover {
  background: #1e2126;
}

.bar-chip.connected {
  color: var(--green);
  border-color: var(--border-strong);
}

button.bar-chip {
  cursor: pointer;
}

/* ─────────────────────────── Onboarding gate ─────────────────────────── */

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  width: min(380px, 100%);
  padding: 36px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-align: center;
}

.auth-orb {
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 34% 30%,
    #cfe2f7 0%,
    #7fa8d9 38%,
    #26466d 78%,
    #131a24 100%
  );
  box-shadow: 0 0 32px rgba(127, 168, 217, 0.45);
}

.auth-title {
  margin: 0;
  font: 500 21px var(--sans);
  letter-spacing: -0.02em;
  color: var(--text);
}

.auth-sub {
  margin: 8px 0 22px;
  font: 300 13px/1.55 var(--sans);
  color: var(--text-mid);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form input {
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text);
  font: 400 13px var(--sans);
  outline: none;
}

.auth-form input:focus {
  border-color: var(--blue-border);
}

.auth-form input::placeholder {
  color: var(--text-faint);
}

.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text);
  font: 500 13px var(--sans);
  text-decoration: none;
  cursor: pointer;
}

.auth-btn:hover {
  background: #1e2126;
}

.auth-btn.primary {
  background: var(--bubble-user);
  border-color: var(--bubble-user);
  color: #eaf1fa;
}

.auth-btn.primary:hover {
  background: #2d5280;
}

a.auth-btn {
  margin-bottom: 10px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  font: 400 12px var(--sans);
  color: var(--text-faint);
}

.auth-divider span {
  height: 1px;
  flex: 1;
  background: var(--border-soft);
}

.auth-error {
  font: 400 12px var(--sans);
  color: var(--red);
  text-align: left;
}

.auth-link {
  margin-top: 14px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font: 400 12px var(--sans);
  cursor: pointer;
}

.auth-link:hover {
  color: var(--text-mid);
}

/* Stage */
.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 0 48px;
}

.orb-wrap {
  position: relative;
  width: 260px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(122, 160, 210, 0.5);
  opacity: 0;
  pointer-events: none;
}

.orb-wrap.working .ring-1 {
  animation: orb-ring 3.2s ease-out infinite;
}

.orb-wrap.working .ring-2 {
  border-color: rgba(122, 160, 210, 0.32);
  animation: orb-ring 3.2s ease-out infinite 1.6s;
}

.orb {
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 70% 78%, rgba(255, 255, 255, 0.14), transparent 55%),
    radial-gradient(circle at 32% 28%, #9db8d9 0%, #4a6d99 35%, #1d2b3d 80%);
  box-shadow:
    0 0 90px 18px rgba(122, 160, 210, 0.35),
    inset 0 -18px 40px rgba(0, 0, 0, 0.35);
  transition: filter 400ms ease, opacity 400ms ease;
}

.orb.idle {
  filter: saturate(0.35) brightness(0.6);
}

.orb.connecting {
  filter: saturate(0.5) brightness(0.75);
  animation: orb-breathe 3.2s ease-in-out infinite;
}

.orb.listening {
  animation: orb-breathe 3.2s ease-in-out infinite;
}

.orb.speaking {
  animation: orb-talk 1.1s ease-in-out infinite;
}

.stage-text {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.orb-label {
  font: 400 14px var(--sans);
  color: var(--text-mid);
}

.utterance {
  font: 300 21px/1.5 var(--sans);
  color: var(--text);
  text-wrap: pretty;
}

.status-line {
  font: 300 13px/1.5 var(--sans);
  color: var(--text-faint);
  min-height: 18px;
}

.delegation {
  font: 300 13px/1.5 var(--sans);
  font-style: italic;
  color: var(--blue-dim);
}

/* Result card (task lands mid-conversation) */
.result-card {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  width: min(540px, calc(100% - 48px));
  border: 1px solid var(--green-border);
  border-radius: 16px;
  background: var(--green-bg);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  z-index: 5;
}

.result-card.failed {
  border-color: var(--red-border);
  background: var(--red-bg);
}

.result-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid #1e2823;
}

.result-card.failed .result-card-header {
  border-bottom-color: #291b19;
}

.result-card-label {
  font: 500 12.5px var(--sans);
  color: var(--green);
}

.result-card.failed .result-card-label {
  color: var(--red);
}

.result-close {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-faint);
  font: 400 13px var(--sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #c9ced6;
}

.result-close svg {
  width: 16px;
  height: 16px;
}

.result-card-body {
  padding: 18px;
}

.result-card-title {
  font: 400 19px/1.3 var(--sans);
  color: var(--text);
}

.result-card-text {
  font: 300 14.5px/1.6 var(--sans);
  color: var(--text-mid);
  margin: 12px 0 0;
  text-wrap: pretty;
  max-height: 130px;
  overflow-y: auto;
}

.result-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.result-card-links:empty {
  display: none;
}

.result-card-links a {
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  font: 500 12.5px var(--sans);
  text-decoration: none;
  border: 1px solid var(--border-strong);
  color: #c9ced6;
}

.result-card-links a:hover {
  background: #1b1f22;
}

.result-card-links a.primary {
  background: var(--green);
  border-color: var(--green);
  color: #0d1a12;
}

.result-card-links a.primary:hover {
  background: #96c9a8;
}

/* Bottom dock */
.dock {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 24px 30px;
  border-top: 1px solid var(--border);
}

/* Call-style centered controls: mic + end-session, ChatGPT voice-mode style. */
.dock-center {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dock-center .mic-btn {
  width: 60px;
  height: 60px;
}

.dock-center .mic-btn svg {
  width: 25px;
  height: 25px;
}

.dock-center .home-compose-btn {
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.dock-center .home-compose-btn svg {
  width: 25px;
  height: 25px;
}

.connect-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-color: var(--blue-border);
  background: var(--blue-bg);
  color: var(--blue);
}

.connect-btn:hover:not(:disabled) {
  background: #182230;
  border-color: #33496a;
}

.connect-btn .icon-x {
  display: none;
  width: 22px;
  height: 22px;
}

.connect-btn.live {
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: 50%;
  flex: none;
  border-color: var(--red-border);
  background: var(--red-bg);
  color: var(--red);
}

.connect-btn.live:hover:not(:disabled) {
  background: #241615;
  border-color: #4d312d;
}

.connect-btn.live .icon-x {
  display: block;
}

.connect-btn.live .connect-label {
  display: none;
}

.bar-btn {
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #17191d;
  color: #c9ced6;
  font: 500 12.5px var(--sans);
  cursor: pointer;
}

.bar-btn:hover:not(:disabled) {
  background: #1e2126;
  border-color: #3a4048;
}

.bar-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.bar-btn.accent {
  border-color: var(--blue-border);
  background: var(--blue-bg);
  color: var(--blue);
}

.bar-btn.accent:hover:not(:disabled) {
  background: #182230;
  border-color: #33496a;
}

.bar-btn.stop {
  border-color: var(--red-border);
  background: var(--red-bg);
  color: var(--red);
}

/* Round icon-only composer button (send arrow / stop square) */
.conv-send {
  width: 32px;
  height: 32px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--text);
  color: var(--surface);
}

.conv-send:hover:not(:disabled) {
  border: 0;
  background: #d9dde3;
}

.conv-send svg {
  width: 14px;
  height: 14px;
  display: block;
}

.conv-send svg[hidden] {
  display: none;
}

.bar-btn.stop:hover:not(:disabled) {
  background: #2a1a1c;
  border-color: #5a3238;
}

.bar-btn.muted {
  border-color: var(--red-border);
  background: var(--red-bg);
  color: var(--red);
}

/* Icon-only round mic button */
.mic-btn {
  width: 40px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.mic-btn svg {
  width: 18px;
  height: 18px;
}

.mic-btn .icon-mic-off,
.mic-btn.muted .icon-mic {
  display: none;
}

.mic-btn.muted .icon-mic-off {
  display: block;
}

.mic-btn.small {
  width: 32px;
  height: 32px;
  flex: none;
}

.mic-btn.small svg {
  width: 15px;
  height: 15px;
}

/* Home top-left toggles: sessions expand + settings */
.corner-btn {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: #17191d;
  color: #c9ced6;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font: 400 16px var(--sans);
  padding: 0;
}

.corner-btn:hover {
  background: #1e2126;
  color: var(--text);
}

.corner-btn svg {
  width: 16px;
  height: 16px;
}

.home-panel {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 300px;
  background: var(--rail-bg);
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
  z-index: 30;
  display: flex;
  flex-direction: column;
}

.home-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.home-panel-title {
  font: 500 13px var(--sans);
  letter-spacing: 0.02em;
  color: var(--text);
}

.home-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px 16px;
}

.home-panel-section {
  font: 500 12px var(--sans);
  color: var(--text-dim);
  margin: 14px 0 8px;
}

.home-panel-section:first-child {
  margin-top: 2px;
}

.home-panel-note {
  font: 300 12px/1.5 var(--sans);
  color: var(--text-dim);
  margin: 8px 0;
}

.sign-out-btn {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: transparent;
  color: #c9ced6;
  font: 500 12.5px var(--sans);
  cursor: pointer;
  white-space: nowrap;
}

.sign-out-btn:hover {
  background: #1e2126;
}

.home-panel-row {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  text-decoration: none;
}

.home-panel-row:hover {
  background: var(--card-bg);
  border-color: var(--border-soft);
}

.home-panel-row-title {
  font: 400 13px var(--sans);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-panel-row-sub {
  font: 400 11.5px var(--sans);
  color: var(--text-dim);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-panel-row-sub.running {
  color: var(--blue);
}

.home-panel-row-sub.failed {
  color: var(--red);
}

.home-panel-select {
  width: 100%;
  margin-bottom: 4px;
}

/* ============ Views ============ */
.home-view {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.work-view {
  flex: 1;
  min-width: 0;
  display: flex;
  position: relative;
}

.session-drop-hint {
  position: absolute;
  inset: 8px;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(86, 156, 255, 0.7);
  border-radius: 14px;
  background: rgba(19, 29, 44, 0.94);
  color: #7db2ff;
  font: 500 13px var(--sans);
  pointer-events: none;
}

.work-view.drag-active .session-drop-hint {
  display: flex;
}

/* The orb is a single element moved between three slots. */
.orb-home-slot {
  display: flex;
  align-items: center;
  justify-content: center;
}

.orb-stage-slot .orb-wrap {
  width: 170px;
  height: 170px;
}

.orb-stage-slot .orb {
  width: 132px;
  height: 132px;
  box-shadow:
    0 0 50px 10px rgba(122, 160, 210, 0.3),
    inset 0 -12px 26px rgba(0, 0, 0, 0.35);
}

.orb-head-slot .orb-wrap {
  width: 44px;
  height: 44px;
}

.orb-head-slot .orb {
  width: 36px;
  height: 36px;
  box-shadow:
    0 0 18px 4px rgba(122, 160, 210, 0.35),
    inset 0 -4px 9px rgba(0, 0, 0, 0.35);
}

.orb-head-slot:empty {
  display: none;
}

/* Session-start repository prompt */
.repo-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.repo-prompt-hint {
  font: 400 13px var(--sans);
  color: var(--text-dim);
}

.repo-prompt-select {
  max-width: min(80vw, 340px);
  text-overflow: ellipsis;
}

/* Starter suggestions (home, before any workstream) */
.starter-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.starter-hint {
  font: 400 13px var(--sans);
  color: var(--text-dim);
}

.starter-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 240px));
  justify-content: center;
  gap: 12px;
}

.starter-card {
  background: var(--rail-bg);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 12px 16px;
  font: 400 13px var(--sans);
  color: var(--text-mid);
  cursor: pointer;
  text-align: left;
}

.starter-card:hover {
  border-color: var(--blue);
  background: var(--card-bg);
  color: var(--text-hi);
}

/* Home workstream cards */
.home-ws-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 0 24px 18px;
  flex-wrap: wrap;
}

.home-ws-card {
  background: var(--rail-bg);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 12px 16px;
  width: 250px;
  cursor: pointer;
  min-width: 0;
  transition: transform 0.15s ease, border-color 0.15s ease,
    background 0.15s ease;
}

.home-ws-card:hover,
.home-ws-card:focus-visible {
  border-color: var(--blue);
  background: var(--card-bg);
  transform: translateY(-1px);
}

.home-ws-card.attention {
  animation: card-attention 1.5s ease-in-out 3;
}

@keyframes card-attention {
  0%,
  100% {
    border-color: var(--border-soft);
    box-shadow: 0 0 0 0 rgba(127, 168, 217, 0);
  }
  50% {
    border-color: var(--blue);
    box-shadow: 0 0 16px 0 rgba(127, 168, 217, 0.35);
  }
}

.home-ws-open {
  margin-top: 8px;
  font: 500 11.5px var(--sans);
  color: var(--text-faint);
}

.home-ws-card:hover .home-ws-open,
.home-ws-card.attention .home-ws-open {
  color: var(--blue);
}

.home-ws-title {
  font: 400 13px var(--sans);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-ws-status {
  font: 400 11.5px var(--sans);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-ws-status.running,
.ws-status.running {
  color: var(--blue);
}

.home-ws-status.needs,
.ws-status.needs {
  color: var(--amber);
}

.home-ws-status.done,
.ws-status.done {
  color: var(--green);
}

.home-ws-status.failed,
.ws-status.failed {
  color: var(--red);
}

/* ============ Work view: sidebar ============ */
.side {
  width: 300px;
  flex: none;
  background: var(--rail-bg);
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

.side-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.side-home-link {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: 600 13px var(--sans);
  cursor: pointer;
}

.side-home-link:hover {
  color: #fff;
}

.side-home-logo {
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--text);
  color: #111318;
  font: 700 11px var(--sans);
}

.side-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px 16px;
}

.side-back {
  background: none;
  border: none;
  color: var(--text-dim);
  font: 400 18px var(--sans);
  cursor: pointer;
  padding: 0 6px 2px 0;
  line-height: 1;
}

.side-back:hover {
  color: var(--text);
}

.side-brand {
  font: 500 13px var(--sans);
  letter-spacing: 0.02em;
  color: var(--text);
}

.side.collapsed {
  display: none;
}

.side-collapse {
  background: none;
  border: none;
  color: var(--text-dim);
  font: 400 14px var(--sans);
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 6px;
}

.side-collapse:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

/* Floating button that brings the collapsed sidebar back */
.side-expand {
  position: absolute;
  top: 14px;
  left: 10px;
  z-index: 20;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--rail-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font: 400 13px var(--sans);
  cursor: pointer;
}

.side-expand:hover {
  color: var(--text);
}

.side.collapsed ~ .conv-col .conv-head {
  padding-left: 58px;
}

.side-expand svg {
  width: 16px;
  height: 16px;
}

/* Drag handles between the panels, agent-UI style */
.panel-resizer {
  position: relative;
  z-index: 20;
  width: 8px;
  flex: 0 0 8px;
  margin: 0 -4px;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
  outline: none;
}

.panel-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 1px;
  background: transparent;
  transition: width 0.12s, left 0.12s, background-color 0.12s;
}

.panel-resizer:hover::after,
.panel-resizer:focus-visible::after,
.panel-resizer.dragging::after {
  left: 2px;
  width: 3px;
  background: var(--blue);
}

body.resizing-panels {
  cursor: col-resize;
  user-select: none;
}

body.resizing-panels img {
  pointer-events: none;
}

.side-action-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #c9ced6;
  font: 500 12.5px var(--sans);
}

.side-action-row + .side-action-row {
  margin-top: 2px;
}

.side-action-row svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.side-action-row:disabled {
  opacity: 0.5;
  cursor: default;
}

.side-action-row:disabled:hover {
  background: transparent;
  border-color: transparent;
}

.draft-hint {
  padding: 32px 12px;
  text-align: center;
  color: var(--text-dim);
  font: 400 13px var(--sans);
}

.ws-list {
  min-height: 0;
}

.ws-item {
  display: block;
  font: inherit;
  color: inherit;
}

.ws-item:hover {
  background: var(--card-bg);
}

.ws-item.active {
  background: transparent;
  border-color: transparent;
}

.ws-dot {
  display: none;
}

.ws-dot.working::before {
  content: "🛠";
}

.ws-dot.needs::before {
  content: "⚠️";
}

.ws-dot.idle::before {
  content: "✅";
}

.ws-dot.failed::before {
  content: "❌";
}

.ws-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid transparent;
}

.ws-dot.working::after {
  border-top-color: var(--blue);
  animation: spin 1.4s linear infinite;
}

.ws-dot.needs::after {
  border-color: var(--amber);
}

.ws-meta {
  flex: 1;
  min-width: 0;
}

.ws-title {
  font: 400 13px var(--sans);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-status {
  font: 400 11.5px var(--sans);
  color: var(--text-dim);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side .ws-status {
  color: var(--text-dim);
}

.ws-time {
  display: none;
}

.side-foot {
  display: none;
}

.bar-btn.small {
  height: 32px;
  padding: 0 12px;
  font-size: 11.5px;
  flex: 1;
}

.bar-btn.small.mic-btn {
  padding: 0;
  flex: none;
}

/* ============ Work view: conversation ============ */
.conv-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.conv-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  min-height: 61px;
}

.conv-title-wrap {
  flex: 1;
  min-width: 0;
}

.conv-title {
  font: 600 14.5px var(--sans);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #17191d;
  color: #c9ced6;
  font: 500 11.5px var(--sans);
  cursor: pointer;
  white-space: nowrap;
}

.conv-btn:hover {
  background: #1e2126;
}

.conv-icon-btn {
  width: 32px;
  padding: 0;
  display: grid;
  place-items: center;
}

.conv-icon-btn svg {
  width: 16px;
  height: 16px;
}

.conv-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Big orb above the transcript (hybrid mode) */
.orb-stage {
  position: relative;
  display: flex;
  flex: 0 0 var(--orb-stage-height, 248px);
  box-sizing: border-box;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(ellipse 55% 90% at 50% 0%, rgba(122, 160, 210, 0.07), transparent);
}

.orb-stage-label {
  font: 400 12px var(--sans);
  color: var(--text-dim);
}

.orb-resizer {
  position: absolute;
  z-index: 10;
  right: 0;
  bottom: -7px;
  left: 0;
  height: 14px;
  cursor: row-resize;
  touch-action: none;
  outline: none;
}

.orb-resizer-grip {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 34px;
  height: 3px;
  border-radius: 999px;
  background: var(--border-strong);
  transform: translateX(-50%);
  transition: width 0.12s, background-color 0.12s;
}

.orb-resizer:hover .orb-resizer-grip,
.orb-resizer:focus-visible .orb-resizer-grip,
.orb-resizer.dragging .orb-resizer-grip {
  width: 48px;
  background: var(--blue);
}

body.resizing-orb {
  cursor: row-resize;
  user-select: none;
}

/* Conversation feed */
.conv-feed-host {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* Jump-to-latest pill: shown when new activity lands while the reader
   is scrolled up */
.feed-latest {
  position: absolute;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  z-index: 15;
  background: var(--rail-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font: 400 12px var(--sans);
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.feed-latest:hover {
  border-color: var(--blue);
}

/* Older feed entries hidden behind "Load earlier messages" */
.feed-hidden {
  display: none !important;
}

.feed-earlier {
  display: flex;
  justify-content: center;
  padding: 4px 0;
}

.feed-earlier button {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 999px;
  color: var(--text-dim);
  font: 400 12px var(--sans);
  padding: 5px 14px;
  cursor: pointer;
}

.feed-earlier button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.conv-feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px max(6%, 20px);
}

.bubble {
  max-width: 640px;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 14px;
  font: 400 13.5px/1.5 var(--sans);
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

.bubble.user {
  align-self: flex-end;
  background: var(--bubble-user);
  border: 1px solid transparent;
  color: var(--text);
  border-bottom-right-radius: 4px;
}

/* Speech still streaming in — settles into a normal bubble once routed */
.bubble.user.speaking {
  opacity: 0.7;
  border-color: var(--border);
}

.bubble.agent {
  align-self: flex-start;
  background: var(--bubble-agent);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

/* Markdown inside agent bubbles */
.bubble.agent p {
  margin: 0 0 8px;
}

.bubble.agent p:last-child,
.bubble.agent ul:last-child,
.bubble.agent ol:last-child,
.bubble.agent pre:last-child {
  margin-bottom: 0;
}

.bubble.agent ul,
.bubble.agent ol {
  margin: 0 0 8px;
  padding-left: 18px;
}

.bubble.agent code {
  font: 400 12px var(--mono);
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  padding: 1px 5px;
}

.bubble.agent pre {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.bubble.agent pre code {
  background: none;
  padding: 0;
}

.bubble.agent a {
  color: var(--blue);
}

.bubble.agent h1,
.bubble.agent h2,
.bubble.agent h3,
.bubble.agent h4 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.bubble-via {
  display: block;
  font: 400 10.5px var(--sans);
  color: var(--blue-dim);
  margin-top: 4px;
}

.bubble-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.bubble-links a {
  font: 400 12.5px var(--sans);
  color: var(--blue);
  text-decoration: none;
}

.bubble-links a:hover {
  text-decoration: underline;
}

.sysrow {
  align-self: center;
  display: flex;
  align-items: center;
}

.sys-pill {
  font: 400 11.5px var(--sans);
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 2px 10px;
}

.sysrow.error .sys-pill {
  color: var(--red);
  border-color: var(--red-border);
  background: var(--red-bg);
}

.activity {
  align-self: flex-start;
  width: 100%;
  max-width: 640px;
}

.activity summary {
  list-style: none;
  cursor: pointer;
  min-width: 0;
  margin: 0 -4px;
  padding: 2px 4px;
  border-radius: 6px;
  font: 400 12px var(--sans);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  user-select: none;
}

.activity summary:hover {
  color: var(--text-mid);
  background: rgba(255, 255, 255, 0.03);
}

.activity summary::-webkit-details-marker {
  display: none;
}

.activity-chevron {
  width: 12px;
  height: 12px;
  flex: none;
  transition: transform 0.15s;
}

.activity[open] .activity-chevron {
  transform: rotate(90deg);
}

.activity-label {
  flex: none;
}

.activity-live {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-dim);
  animation: live-pulse 1.6s ease-in-out infinite;
}

.activity-when {
  margin-left: auto;
  flex: none;
  color: var(--text-ghost);
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.15s;
}

.activity:hover .activity-when,
.activity[open] .activity-when {
  opacity: 0.65;
}

.activity-diffstats {
  flex: none;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  padding: 1px 6px;
  font: 400 11px var(--sans);
  cursor: pointer;
}

.activity-diffstats:hover {
  background: rgba(255, 255, 255, 0.09);
}

.activity-diffstats span:first-child {
  color: var(--green);
}

.activity-diffstats span:last-child {
  color: var(--red);
}

.activity-body {
  margin: 4px 0 0 5px;
  padding-left: 12px;
  border-left: 1px solid var(--border-soft);
  max-height: 288px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.act-line {
  font: 400 12px/1.6 var(--sans);
  color: var(--text-dim);
  padding: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.act-line.error,
.act-error {
  color: var(--red);
}

.act-tool {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.act-verb {
  flex: none;
  text-transform: capitalize;
}

.act-args,
.act-tail {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-mid);
}

.act-tail {
  font-family: var(--mono);
  color: var(--text-dim);
}

.act-error {
  flex: none;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.act-secs {
  margin-left: auto;
  flex: none;
  color: var(--text-ghost);
}

.act-line.progress {
  animation: live-pulse 1.6s ease-in-out infinite;
}

.act-line a {
  color: var(--blue);
  text-decoration: none;
}

.act-line a:hover {
  color: var(--blue-dim);
}

/* Live "agent is doing X right now" line */
.live-line {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 640px;
  font: 400 11.5px/1.6 var(--mono);
  color: var(--text-dim);
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: live-pulse 1.6s ease-in-out infinite;
}

.live-line-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

@keyframes live-pulse {
  0%,
  100% {
    opacity: 0.9;
  }
  50% {
    opacity: 0.45;
  }
}

/* Agent's computer: live browser preview card */
.computer-card {
  align-self: flex-start;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.computer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.computer-title {
  font: 500 12px var(--sans);
  color: var(--text-mid);
}

.computer-head .badge {
  font: 400 11px var(--sans);
  padding: 2px 8px;
  border-radius: 20px;
}

.computer-head .badge.live {
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid var(--green-border);
}

.computer-card.ended .badge.live {
  color: var(--text-dim);
  background: transparent;
  border-color: var(--border);
}

.computer-frame {
  display: block;
  width: 100%;
  background: #000;
  cursor: pointer;
}

.computer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}

.cc-btn {
  height: 26px;
  padding: 0 12px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font: 500 11px var(--sans);
  text-decoration: none;
  cursor: pointer;
}

.cc-btn:hover {
  color: var(--text);
  border-color: var(--border-soft);
}

.cc-btn-icon {
  width: 26px;
  padding: 0;
  justify-content: center;
  flex: none;
}

.cc-btn-icon svg {
  width: 13px;
  height: 13px;
}

.cc-btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.cc-btn.primary:hover {
  background: var(--blue-dim);
  border-color: var(--blue-dim);
  color: #fff;
}

.cc-note {
  margin-left: auto;
  font: 400 10.5px var(--mono);
  color: var(--text-dim);
  opacity: 0.7;
}

/* Action needed (approval / secret gate) */
.needs-card {
  align-self: flex-start;
  width: 100%;
  max-width: 640px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-radius: 16px;
  padding: 12px 14px;
}

.needs-card.resolved {
  opacity: 0.6;
  border-color: var(--border-soft);
  background: var(--rail-bg);
}

.needs-title {
  font: 500 12.5px var(--sans);
  color: var(--amber);
  margin-bottom: 6px;
}

.needs-card.resolved .needs-title {
  color: var(--green);
}

.needs-body {
  font: 400 13px/1.5 var(--sans);
  color: var(--text-mid);
}

.needs-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.needs-card.resolved .needs-actions {
  display: none;
}

.needs-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  font: 500 12px var(--sans);
  text-decoration: none;
  border: 1px solid var(--amber-border);
  background: #352016;
  color: var(--amber);
}

.needs-btn:hover {
  background: #3f2719;
}

.needs-btn.ghost {
  background: transparent;
  color: var(--text-mid);
  border-color: var(--line);
  cursor: pointer;
}

.needs-secret {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.needs-secret-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--amber-border);
  background: #1a120c;
  color: var(--text);
  font: 400 13px var(--mono);
}

.needs-secret-input:focus {
  outline: none;
  border-color: var(--amber);
}

.needs-secret button {
  cursor: pointer;
}

.needs-secret input:disabled,
.needs-secret button:disabled {
  opacity: 0.5;
  cursor: default;
}

.voice-hint {
  align-self: center;
  font: 400 11px var(--mono);
  color: var(--text-dim);
  opacity: 0.8;
}

/* Composer */
.conv-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px max(6%, 20px) 16px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: #17191d;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.conv-composer:focus-within {
  border-color: #3a4048;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.22);
}

#conv-input {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 400 13.5px var(--sans);
}

#conv-input::placeholder {
  color: var(--text-ghost);
}

#conv-input:focus {
  outline: none;
}

.conv-composer-actions {
  display: flex;
  align-items: center;
  min-height: 32px;
  gap: 8px;
}

.composer-attach {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}

.composer-attach:hover:not(:disabled) {
  border-color: #3a4048;
  background: #1e2126;
  color: var(--text);
}

.composer-attach:disabled {
  opacity: 0.45;
  cursor: default;
}

.composer-attach svg {
  width: 14px;
  height: 14px;
}

.composer-attachments:empty {
  display: none;
}

.composer-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.composer-attachment {
  display: inline-flex;
  align-items: center;
  max-width: 240px;
  gap: 6px;
  padding: 4px 5px 4px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #1e2126;
  color: var(--text-dim);
  font: 400 11px var(--sans);
}

.composer-attachment > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-attachment-status {
  color: var(--text-faint);
  font-size: 10px;
}

.composer-attachment.failed,
.composer-attachment.failed .composer-attachment-status {
  border-color: rgba(235, 87, 87, 0.45);
  color: #ee8d8d;
}

.composer-attachment button {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  line-height: 16px;
}

.composer-attachment button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.composer-repo {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.composer-repo-button {
  position: relative;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.composer-repo-button svg {
  width: 14px;
  height: 14px;
}

.composer-repo-button:hover,
.composer-repo-button[aria-expanded="true"] {
  border-color: #3a4048;
  background: #1e2126;
  color: var(--text);
}

.composer-repo-indicator {
  position: absolute;
  right: -2px;
  top: -2px;
  width: 8px;
  height: 8px;
  border: 1px solid #17191d;
  border-radius: 50%;
  background: var(--blue);
  opacity: 0;
}

.composer-repo-button.has-selection .composer-repo-indicator {
  opacity: 1;
}

.composer-repo-chip {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 160px;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: 400 11px var(--sans);
  cursor: pointer;
}

.composer-repo-chip[hidden] {
  display: none;
}

.composer-repo-chip:hover {
  border-color: #3a4048;
  color: var(--text);
}

.composer-repo-chip svg {
  width: 12px;
  height: 12px;
  flex: none;
  color: var(--text-faint);
}

#composer-repo-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-repo-menu,
.composer-repo-submenu {
  position: absolute;
  bottom: calc(100% + 10px);
  z-index: 40;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #17191d;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

.composer-repo-menu {
  left: 0;
  width: 240px;
  padding: 6px;
}

.composer-repo-submenu {
  left: 248px;
  width: 256px;
  overflow: hidden;
}

.composer-repo-menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font: 400 12px var(--sans);
  text-align: left;
  cursor: default;
}

.composer-repo-menu-row:hover {
  background: var(--card-bg);
  color: var(--text);
}

.composer-repo-menu-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-faint);
}

.composer-repo-menu-meta svg,
.composer-repo-menu-check {
  width: 12px;
  height: 12px;
}

#composer-repo-count.selected {
  color: var(--blue);
}

.composer-repo-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 7px;
  border-bottom: 1px solid var(--border);
}

.composer-repo-search-wrap svg {
  width: 12px;
  height: 12px;
  flex: none;
  color: var(--text-faint);
}

#composer-repo-search {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 400 12px var(--sans);
}

#composer-repo-search::placeholder {
  color: var(--text-faint);
}

.composer-repo-options {
  max-height: 224px;
  padding: 6px;
  overflow-y: auto;
}

.composer-repo-owner {
  padding: 6px 8px 4px;
  color: var(--text-faint);
  font: 400 11px var(--sans);
}

.composer-repo-option {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font: 400 12px var(--sans);
  text-align: left;
  cursor: default;
}

.composer-repo-option:hover {
  background: var(--card-bg);
  color: var(--text);
}

.composer-repo-checkbox {
  width: 14px;
  height: 14px;
  display: inline-grid;
  place-items: center;
  flex: none;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: transparent;
}

.composer-repo-checkbox svg {
  width: 10px;
  height: 10px;
}

.composer-repo-option[aria-selected="true"] {
  color: var(--text);
}

.composer-repo-option[aria-selected="true"] .composer-repo-checkbox {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}

.composer-repo-option-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-repo-lock,
.composer-repo-lock svg {
  width: 10px;
  height: 10px;
  flex: none;
  color: var(--text-faint);
}

.composer-repo-branch {
  margin-left: auto;
  flex: none;
  color: var(--text-faint);
  font-size: 10px;
}

.composer-repo-empty {
  padding: 7px 8px;
  color: var(--text-faint);
  font: 400 12px var(--sans);
}

/* Animations */
@keyframes orb-ring {
  0% {
    transform: scale(0.72);
    opacity: 0.55;
  }
  100% {
    transform: scale(1.18);
    opacity: 0;
  }
}

@keyframes orb-breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes orb-talk {
  0%,
  100% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.07);
  }
  60% {
    transform: scale(0.98);
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(340%);
  }
}

/* Narrow screens */
@media (max-width: 900px) {
  .stage {
    padding: 0 24px;
    gap: 28px;
  }

  .orb-home-slot .orb-wrap {
    width: 200px;
    height: 200px;
  }

  .orb-home-slot .orb {
    width: 160px;
    height: 160px;
  }

  .side {
    width: 200px;
  }

  .side-foot {
    flex-direction: column;
  }

  .result-card {
    bottom: 24px;
  }
}

/* Touch devices: no hover, so keep hover-only affordances visible and
   avoid tiny targets */
@media (hover: none) {
  .conv-feed-host,
  .ws-list,
  .ws-panel-body,
  .activity-body,
  .act-preview,
  .result-card-text {
    -webkit-overflow-scrolling: touch;
  }
}

/* ============ Workspace panel (hidden until an inline item opens it) ============ */
.ws-panel {
  width: var(--ws-panel-width, min(44%, 560px));
  flex: none;
  min-width: 0;
  background: var(--rail-bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.ws-panel[hidden] {
  display: none;
}

.ws-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  flex: none;
  padding: 0 16px;
}

.ws-panel-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
}

.ws-tab {
  flex: none;
  font: 400 12px var(--sans);
  color: var(--text-dim);
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}

.ws-tab:hover {
  color: var(--text-mid);
}

.ws-tab.active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-soft);
}

.ws-panel-head a {
  flex: none;
  font: 400 12px var(--sans);
  color: var(--blue);
  text-decoration: none;
}

.ws-panel-head a:hover {
  color: var(--blue-dim);
}

.ws-panel-body {
  flex: 1;
  min-height: 0;
  margin: 0 12px 12px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  scrollbar-width: thin;
}

.ws-browser-frame {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #000;
}

.ws-browser-note {
  font: 400 12px var(--sans);
  color: var(--text-dim);
}

.ws-browser-note.live {
  color: var(--green);
}

.ws-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ws-shell-row .act-line {
  font: 400 12px/1.55 var(--mono);
  color: var(--text-mid);
  white-space: normal;
  word-break: break-word;
}

.ws-shell-row .act-line.error,
.ws-shell-row .err {
  color: var(--red);
}

.ws-shell-row .ok {
  color: var(--green);
}

.ws-shell-row .act-preview {
  margin: 4px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  font: 400 12px/1.55 var(--mono);
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
}

.ws-prs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ws-pr-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--rail-bg);
  color: var(--text);
  font: 400 13px var(--sans);
  text-decoration: none;
}

.ws-pr-link:hover {
  background: #1b1f22;
}

.ws-pr-open {
  font: 400 12px var(--sans);
  color: var(--blue);
}

.inline-pr-card {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 10px;
  padding: 10px 13px;
  border: 1px solid rgba(126, 92, 255, 0.35);
  border-radius: 12px;
  background: rgba(126, 92, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.inline-pr-card:hover {
  background: rgba(126, 92, 255, 0.14);
}

.inline-pr-label {
  color: #b8a7ff;
  font: 600 12px var(--sans);
}

.inline-pr-detail {
  color: var(--text-dim);
  font: 400 12px var(--sans);
}

.ws-pr-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}

.ws-pr-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ws-pr-top a {
  color: var(--text-dim);
  font: 400 12px var(--sans);
  text-decoration: none;
}

.ws-pr-badge {
  padding: 3px 8px;
  border: 1px solid rgba(78, 190, 119, 0.35);
  border-radius: 999px;
  color: var(--green);
  background: rgba(78, 190, 119, 0.1);
  font: 600 11px var(--sans);
}

.ws-pr-badge.draft {
  color: var(--text-dim);
  border-color: var(--border-strong);
  background: var(--rail-bg);
}

.ws-pr-badge.merged {
  color: #b8a7ff;
  border-color: rgba(126, 92, 255, 0.35);
  background: rgba(126, 92, 255, 0.1);
}

.ws-pr-badge.closed {
  color: var(--red);
  border-color: rgba(255, 92, 92, 0.35);
  background: rgba(255, 92, 92, 0.08);
}

.ws-pr-repo,
.ws-pr-meta {
  color: var(--text-dim);
  font: 400 11px var(--sans);
}

.ws-pr-view h2 {
  margin: 0;
  color: var(--text);
  font: 600 17px/1.3 var(--sans);
}

.ws-pr-summary,
.ws-diff-stats {
  color: var(--text-dim);
  font: 400 11px var(--mono);
}

.ws-pr-summary b,
.ws-diff-stats b {
  color: var(--green);
  font-weight: 500;
}

.ws-pr-summary i,
.ws-diff-stats i {
  color: var(--red);
  font-style: normal;
}

.ws-pr-description {
  color: var(--text-mid);
  font: 400 12px/1.55 var(--sans);
}

.ws-pr-description p:last-child {
  margin-bottom: 0;
}

.ws-pr-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.ws-pr-shell .ws-pr-view {
  flex: none;
}

.ws-pr-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-pr-meta img,
.ws-pr-item-head img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.ws-pr-action {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px 7px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #17191d;
  color: var(--text-dim);
  font: 500 12px var(--sans);
}

.ws-pr-action .conflicted {
  color: var(--red);
}

.ws-pr-action button {
  margin-left: auto;
  min-height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: var(--text);
  color: #111318;
  font: 600 11px var(--sans);
  cursor: pointer;
}

.ws-pr-action button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.ws-pr-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
}

.ws-pr-tabs button {
  flex: none;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--text-dim);
  font: 500 11px var(--sans);
  cursor: pointer;
}

.ws-pr-tabs button:hover {
  color: var(--text-mid);
}

.ws-pr-tabs button.active {
  border-color: var(--border-soft);
  background: #1b1e23;
  color: var(--text);
}

.ws-pr-body {
  flex: 1;
  min-height: 0;
  padding-top: 12px;
}

.ws-pr-empty {
  color: var(--text-dim);
  font: 400 12px var(--sans);
}

.ws-pr-commits,
.ws-pr-comments {
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--rail-bg);
}

.ws-pr-commits-row,
.ws-pr-comments-row {
  border-bottom: 1px solid var(--border-soft);
}

.ws-pr-commits-row:last-child,
.ws-pr-comments-row:last-child {
  border-bottom: 0;
}

.ws-pr-item-head {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--text-mid);
  font: 400 11px var(--sans);
}

.ws-pr-item-head span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-pr-item-head a {
  flex: none;
  color: var(--text-dim);
  font-family: var(--mono);
  text-decoration: none;
}

.ws-pr-comment-body {
  padding: 0 10px 10px 36px;
  color: var(--text-mid);
  font: 400 12px/1.55 var(--sans);
}

.ws-pr-review {
  height: max(420px, calc(100vh - 390px));
  min-height: 0;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #121418;
}

.ws-pr-files {
  width: 210px;
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border-soft);
  background: var(--rail-bg);
}

.ws-pr-file-controls {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 8px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-dim);
  font: 500 10px var(--sans);
}

.ws-pr-layouts {
  margin-left: auto;
  display: flex;
  padding: 2px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
}

.ws-pr-layouts button,
.ws-pr-nav-actions button {
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-dim);
  font: 500 9px var(--sans);
  cursor: pointer;
}

.ws-pr-layouts button.active {
  background: var(--surface);
  color: var(--text);
}

.ws-pr-nav-actions {
  width: 100%;
  display: flex;
  gap: 4px;
}

.ws-pr-nav-actions button {
  flex: 1;
  min-width: 0;
  padding: 5px 2px;
  border: 1px solid var(--border-soft);
  background: #17191d;
}

.ws-pr-files nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
}

.ws-pr-folder {
  padding: 7px 6px 3px;
  overflow: hidden;
  color: var(--text-faint);
  font: 500 11px var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-pr-file-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-dim);
  font: 400 10px var(--mono);
  cursor: pointer;
  text-align: left;
}

.ws-pr-file-row:hover,
.ws-pr-file-row.active {
  background: rgba(91, 138, 219, 0.13);
  color: var(--text);
}

.ws-pr-file-row.viewed > span:nth-child(2) {
  opacity: 0.45;
}

.ws-pr-file-row > span:nth-child(2) {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-pr-file-row .ws-diff-stats {
  flex: none;
  font-size: 8px;
}

.ws-pr-file-status {
  width: 16px;
  height: 16px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #e6c472;
  background: rgba(230, 196, 114, 0.12);
  font: 700 9px var(--sans);
}

.ws-pr-file-status.added {
  color: var(--green);
  background: rgba(78, 190, 119, 0.12);
}

.ws-pr-file-status.removed,
.ws-pr-file-status.deleted {
  color: var(--red);
  background: rgba(255, 92, 92, 0.1);
}

.ws-pr-file-status.renamed {
  color: var(--blue);
  background: rgba(91, 138, 219, 0.12);
}

.ws-pr-diffs {
  min-width: 0;
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.ws-pr-diff-card {
  margin-bottom: 10px;
  scroll-margin-top: 10px;
}

.ws-pr-diff-card .ws-diff-head {
  justify-content: flex-start;
}

.ws-pr-diff-card .ws-diff-head > span:nth-child(2) {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-pr-diff-card .ws-diff-head label {
  flex: none;
  color: var(--text-dim);
  font: 400 9px var(--sans);
  white-space: nowrap;
}

.ws-pr-fold {
  flex: none;
  border: 0;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
}

.ws-diff-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ws-diff-file {
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--rail-bg);
}

.ws-diff-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  background: #17191d;
  color: var(--text);
  font: 500 11px var(--mono);
  cursor: pointer;
  text-align: left;
}

.ws-diff-patch {
  margin: 0;
  padding: 8px 0;
  overflow-x: auto;
  color: var(--text-mid);
  font: 400 11px/1.55 var(--mono);
  tab-size: 2;
}

.ws-diff-patch span {
  display: block;
  min-width: max-content;
  padding: 0 10px;
  white-space: pre;
}

.ws-diff-patch .added {
  color: #a5dfb7;
  background: rgba(78, 190, 119, 0.1);
}

.ws-diff-patch .removed {
  color: #f0aaa7;
  background: rgba(255, 92, 92, 0.09);
}

.ws-diff-patch .hunk {
  color: #9eb9e9;
  background: rgba(91, 138, 219, 0.08);
}

@media (max-width: 900px) {
  #ws-panel-resizer {
    display: none;
  }

  .ws-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(92vw, 440px);
    z-index: 30;
    box-shadow: -18px 0 48px rgba(0, 0, 0, 0.55);
  }
}

/* Phones: sidebar collapses to a strip above the conversation */
@media (max-width: 640px) {
  .work-view {
    flex-direction: column;
  }

  .panel-resizer,
  .side-collapse,
  .side-expand {
    display: none;
  }

  .side {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex: none;
  }

  .ws-list {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 10px;
    gap: 6px;
    scrollbar-width: none;
  }

  .ws-item {
    min-width: 180px;
  }

  .side-foot {
    display: none;
  }

  /* iOS zooms the page when a focused input is under 16px */
  #conv-input,
  .auth-form input {
    font-size: 16px;
  }

  .conv-composer {
    margin: 10px 14px calc(12px + env(safe-area-inset-bottom));
    padding: 12px 14px;
  }

  .conv-head {
    padding: 10px 14px;
    gap: 10px;
  }

  .conv-feed {
    padding: 16px 14px;
    gap: 12px;
  }

  .bubble {
    max-width: 88%;
  }

  .orb-stage-slot .orb-wrap {
    width: 120px;
    height: 120px;
  }

  .orb-stage-slot .orb {
    width: 92px;
    height: 92px;
    box-shadow:
      0 0 36px 8px rgba(122, 160, 210, 0.3),
      inset 0 -9px 20px rgba(0, 0, 0, 0.35);
  }

  .orb-stage {
    padding: 12px 0 8px;
  }

  .ws-panel {
    width: 100vw;
    box-shadow: none;
  }
}

/* Phones: minimum 44px touch targets and readable type */
@media (max-width: 640px) {
  .top-bar {
    gap: 10px;
  }

  .bar-select,
  .bar-chip {
    height: 44px;
  }

  .bar-btn {
    height: 44px;
  }

  .mic-btn {
    width: 44px;
    border-radius: 50%;
  }

  .conv-send {
    width: 40px;
    height: 40px;
  }

  .mic-btn svg {
    width: 20px;
    height: 20px;
  }

  .dock-center .mic-btn,
  .connect-btn.live {
    width: 64px;
    height: 64px;
  }

  .dock-center {
    gap: 20px;
  }

  #conv-input {
    height: 28px;
  }

  .conv-composer {
    gap: 8px;
  }

  .composer-repo-button {
    width: 36px;
    height: 36px;
  }

  .composer-repo-menu,
  .composer-repo-submenu {
    left: 0;
    bottom: calc(100% + 8px);
    max-width: calc(100vw - 56px);
  }

  .conv-btn {
    height: 44px;
    padding: 0 14px;
    font-size: 12.5px;
  }

  .result-close,
  .side-expand {
    width: 40px;
    height: 40px;
  }

  .needs-btn {
    height: 44px;
  }

  .cc-btn {
    height: 40px;
    padding: 0 14px;
    font-size: 12px;
  }

  .cc-btn-icon {
    width: 40px;
  }

  .cc-btn-icon svg {
    width: 16px;
    height: 16px;
  }

  .ws-tab {
    padding: 10px 12px;
  }

  .feed-latest {
    padding: 11px 18px;
    font-size: 13px;
  }

  .feed-earlier button {
    padding: 11px 18px;
    font-size: 13px;
  }

  .starter-card {
    min-height: 48px;
    display: flex;
    align-items: center;
    font-size: 14px;
  }

  .ws-item {
    padding: 12px;
  }

  .side-back {
    padding: 8px 12px 10px 4px;
    font-size: 20px;
  }

  .auth-form input,
  .auth-btn {
    height: 48px;
  }

  .auth-link {
    padding: 12px;
  }

  .activity summary {
    padding: 4px;
    font-size: 12.5px;
  }

  /* Readable type on small screens */
  .bubble {
    font-size: 15px;
    padding: 11px 15px;
  }

  .orb-label {
    font-size: 15px;
  }

  .status-line,
  .delegation {
    font-size: 14px;
  }

  .ws-title,
  .home-ws-title,
  .starter-hint {
    font-size: 14px;
  }

  .ws-status,
  .home-ws-status {
    font-size: 12.5px;
  }

  .conv-title {
    font-size: 15.5px;
  }

  .act-line {
    font-size: 12.5px;
  }

  .result-card-title {
    font-size: 17px;
  }

  .result-card-links a {
    height: 44px;
  }

  .bubble-links a {
    font-size: 13.5px;
    padding: 4px 0;
    display: inline-block;
  }

  .sys-pill {
    font-size: 12.5px;
    padding: 5px 12px;
  }
}

/* Very narrow screens: compact top bar and stage */
@media (max-width: 480px) {
  .top-bar {
    gap: 8px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  }

  .bar-select {
    flex: 0 1 auto;
    max-width: 38vw;
    text-overflow: ellipsis;
    padding: 0 8px;
  }

  .bar-chip {
    display: none;
  }

  .stage {
    padding: 0 18px;
    gap: 20px;
  }

  .orb-home-slot .orb-wrap {
    width: 170px;
    height: 170px;
  }

  .orb-home-slot .orb {
    width: 136px;
    height: 136px;
    box-shadow:
      0 0 60px 12px rgba(122, 160, 210, 0.35),
      inset 0 -12px 28px rgba(0, 0, 0, 0.35);
  }

  .utterance {
    font-size: 18px;
  }

  .starter-cards {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .starter-card {
    padding: 11px 14px;
  }

  .dock {
    padding: 16px 18px calc(20px + env(safe-area-inset-bottom));
  }

  .home-ws-row {
    padding: 0 14px 14px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .home-ws-card {
    flex: none;
    width: 220px;
  }

  .result-card {
    width: calc(100% - 28px);
    bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .auth-card {
    padding: 28px 20px;
  }
}

/* --- Voice debug drawer (Ctrl/Cmd+Shift+D) --- */

#debugPanel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-top: 1px solid var(--border-strong);
  font-family: var(--sans);
  font-size: 12px;
  z-index: 90;
}

.debug-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.debug-title {
  color: var(--text-mid);
  font-weight: 600;
  margin-right: 8px;
}

.debug-chip {
  background: var(--card-bg);
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 2px 10px;
  font: inherit;
  cursor: pointer;
}

.debug-chip.active {
  color: var(--text);
  border-color: var(--border-strong);
}

.debug-chip:last-child {
  margin-left: auto;
}

.debug-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.debug-row summary {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 2px 10px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  list-style: none;
}

.debug-row summary::-webkit-details-marker {
  display: none;
}

.debug-row:hover summary {
  background: var(--card-bg);
}

.debug-time {
  color: var(--text-ghost);
  flex: none;
}

.debug-tag {
  flex: none;
  width: 62px;
  text-align: right;
}

.debug-to_live .debug-tag { color: var(--amber); }
.debug-from_live .debug-tag { color: #8ab4f8; }
.debug-from_client .debug-tag { color: #81c995; }
.debug-router .debug-tag { color: #c58af9; }

.debug-text {
  color: var(--text-mid);
  overflow: hidden;
  text-overflow: ellipsis;
}

.debug-row pre {
  margin: 0;
  padding: 6px 10px 10px 84px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}
