:root {
  --bg: #f5f7fb;
  --surface: rgba(255,255,255,.86);
  --surface-strong: #fff;
  --text: #18212f;
  --muted: #687386;
  --line: rgba(24,33,47,.08);
  --shadow: 0 18px 40px rgba(24,33,47,.08);
  --accent: #355cff;
  --accent-soft: rgba(53,92,255,.1);
  --brand-cyan: #00ddf2;
  --brand-green: #7cff49;
  --terminal-bg: #202329;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(114,137,255,.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(255,188,87,.18), transparent 24%),
    var(--bg);
}

.app-shell { min-height: 100vh; }
.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(14px);
}
.brand, .status-group, .agent-tabs { display: flex; align-items: center; gap: 12px; }
.demo-control {
  border: none;
  border-radius: 999px;
  padding: 10px 13px;
  color: #101318;
  background: color-mix(in srgb, var(--brand-green) 78%, white);
  cursor: pointer;
}
.demo-control.secondary {
  color: var(--text);
  background: rgba(24,33,47,.06);
}
.demo-control:disabled {
  opacity: .56;
  cursor: wait;
}
.brand-wordmark {
  width: 236px;
  height: 64px;
  display: block;
}
.brand-product {
  min-height: 28px;
  display: flex;
  align-items: center;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .02em;
}
.terminal-status,
.terminal-inline-status,
.terminal-empty,
.task-status,
.profile-kicker,
.eyebrow {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: .04em;
}
.terminal-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--terminal-bg);
  color: rgba(255,255,255,.88);
  font-size: 12px;
  box-shadow: 0 10px 24px rgba(24,33,47,.14);
}
.terminal-status span {
  color: var(--brand-green);
  font-weight: 700;
}
.terminal-status::after,
.terminal-inline-status::after {
  content: "";
  width: 7px;
  height: 12px;
  margin-left: 3px;
  background: var(--brand-green);
  display: inline-block;
  animation: terminal-blink 1s steps(2, start) infinite;
}
.tab {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.72);
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.tab.active { color: var(--text); border-color: transparent; background: var(--accent-soft); }
.tab:hover,
.ghost-btn:hover,
.hero-actions button:hover,
.quick-actions button:hover,
#sendBtn:hover,
.boot-card button:hover {
  transform: translateY(-1px);
}
.pill {
  padding: 8px 12px; border-radius: 999px; font-size: 13px;
}
.pill.neutral { background: rgba(24,33,47,.06); }
.pill.model-mode {
  color: var(--brand-cyan);
  background: rgba(0,221,242,.1);
  font: 12px/1.4 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(640px, 1fr) 360px;
  gap: 18px;
  padding: 18px;
}
.left-rail, .right-rail, .center-stage { display: flex; flex-direction: column; gap: 18px; }
.agent-profile-card, .panel, .hero-card {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  border-radius: 24px;
}
.agent-switcher { padding-bottom: 14px; }
.vertical-tabs { display: grid; gap: 8px; }
.vertical-tabs .tab {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  gap: 10px;
}
.tab-slot {
  color: var(--brand-green);
  background: var(--terminal-bg);
  border-radius: 999px;
  padding: 4px 7px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
}
.vertical-tabs .tab.active {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent);
}
.agent-profile-card {
  overflow: hidden;
  padding: 0;
}
.portrait-wrap {
  position: relative;
  min-height: 198px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, var(--accent-soft), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.72));
}
.agent-portrait-image {
  width: 144px;
  height: 144px;
  object-fit: cover;
  border-radius: 38px;
  box-shadow: 0 22px 50px color-mix(in srgb, var(--accent) 24%, transparent);
  position: relative;
  z-index: 2;
}
.portrait-glow {
  position: absolute;
  inset: auto 28px 20px;
  height: 80px;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
}
.profile-copy { padding: 18px; }
.profile-kicker {
  color: var(--brand-cyan);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.agent-profile-card h1 { margin: 0 0 6px; font-size: 22px; }
.agent-meta {
  margin-bottom: 10px;
  color: var(--muted);
  font: 11px/1.4 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
.agent-profile-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.panel { padding: 18px; }
.soft-panel { background: rgba(255,255,255,.62); }
.orientation-panel p { margin: 14px 0 14px; }
.orientation-steps {
  display: grid;
  gap: 10px;
}
.orientation-steps div {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}
.orientation-steps span {
  min-width: 28px;
  color: var(--brand-green);
  background: var(--terminal-bg);
  border-radius: 999px;
  padding: 4px 7px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
}
.demo-progress {
  display: grid;
  gap: 10px;
}
.demo-progress-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}
.demo-progress-item span {
  border-radius: 999px;
  padding: 5px 7px;
  color: rgba(255,255,255,.84);
  background: var(--terminal-bg);
  font: 11px/1.4 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
.demo-progress-item strong {
  color: var(--text);
  font-size: 13px;
}
.demo-progress-item em {
  color: var(--muted);
  font-style: normal;
  font: 11px/1.4 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
.demo-progress-item.done span,
.demo-progress-item.done em {
  color: #101318;
  background: color-mix(in srgb, var(--brand-green) 76%, white);
}
.panel-title { font-weight: 700; margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 13px; }
.stack-list { display: grid; gap: 10px; }
.stack-item {
  padding: 12px; border-radius: 16px; background: rgba(255,255,255,.8);
  border: 1px solid var(--line);
}
.ghost-btn, .hero-actions button {
  border: none; background: rgba(24,33,47,.06); color: var(--text);
  border-radius: 14px; padding: 10px 13px; cursor: pointer;
}
.hero-card { padding: 26px; }
.eyebrow {
  color: var(--brand-cyan);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "// ";
  color: var(--brand-green);
}
.hero-card h2 { margin: 10px 0 8px; font-size: 28px; }
.hero-card p { margin: 0 0 18px; color: var(--muted); max-width: 680px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions button.primary, #sendBtn, .modal button {
  background: var(--accent); color: #fff;
}
.main-panel { min-height: 250px; }
.result-panel { min-height: 210px; }
.panel-head {
  display: flex; justify-content: space-between; align-items: start; gap: 12px;
  margin-bottom: 16px;
}
.object-card, .result-card {
  border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface-strong); padding: 18px;
}
.result-kicker {
  margin-bottom: 10px;
  color: var(--brand-green);
  font: 11px/1.4 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  text-transform: uppercase;
}
.object-card.is-updated {
  animation: object-refresh .5s ease-out both;
}
.terminal-empty {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--brand-green);
  background: var(--terminal-bg);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 11px;
}
.object-card h3, .result-card h3 { margin-top: 0; }
.object-card ul, .result-card ul { margin-bottom: 0; padding-left: 18px; }
.quick-actions { display: grid; gap: 10px; }
.quick-actions button {
  text-align: left; border: 1px solid var(--line); background: #fff;
  padding: 13px; border-radius: 16px; cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.quick-actions button:hover {
  border-color: color-mix(in srgb, var(--brand-green) 42%, var(--line));
  box-shadow: 0 10px 24px rgba(24,33,47,.06);
}
.quick-actions button::before {
  content: "> ";
  color: var(--brand-green);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-weight: 700;
}
.artifact-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.artifact-list span {
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(24,33,47,.05);
  font-size: 12px;
}
.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.result-actions button {
  border: none;
  border-radius: 999px;
  padding: 9px 12px;
  color: #101318;
  background: color-mix(in srgb, var(--brand-green) 76%, white);
  cursor: pointer;
}
.chat-workbench {
  min-height: 620px;
  height: calc(100vh - 206px);
  display: flex;
  flex-direction: column;
}
.chat-history {
  display: grid;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  align-content: start;
  margin-bottom: 18px;
}
.welcome-block {
  max-width: 720px;
  margin: 8px 0 10px;
}
.welcome-block h3 {
  font-size: 28px;
  margin: 0 0 8px;
}
.welcome-block p {
  margin: 0;
  color: var(--muted);
}
.task-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 20px;
  padding: 16px;
  max-width: 82%;
}
.task-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.task-status {
  color: var(--brand-green);
  background: var(--terminal-bg);
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
}
.artifact-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.artifact-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(255,255,255,.76);
  cursor: pointer;
}
.bubble {
  padding: 14px 16px; border-radius: 18px; max-width: 78%;
  background: #fff; border: 1px solid var(--line); font-size: 14px;
}
.bubble.user {
  justify-self: end;
}
.bubble.agent { background: var(--accent-soft); border-color: transparent; }
.bubble.system {
  max-width: 100%;
  color: var(--muted);
  background: rgba(24,33,47,.04);
}
.bubble.system.warning {
  color: #8a5a00;
  background: rgba(255,188,87,.16);
  border-color: rgba(255,188,87,.32);
}
.bubble.system.error {
  color: #9f2331;
  background: rgba(229,72,77,.1);
  border-color: rgba(229,72,77,.22);
}
.run-card {
  max-width: 78%;
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  color: rgba(255,255,255,.86);
  background: var(--terminal-bg);
}
.run-head {
  display: flex;
  gap: 8px;
  color: var(--brand-cyan);
  font: 12px/1.4 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
.run-head span {
  color: var(--brand-green);
}
.run-step {
  color: rgba(255,255,255,.72);
  font-size: 13px;
}
.run-step::before {
  content: "✓ ";
  color: var(--brand-green);
}
.chat-compose { display: grid; gap: 10px; }
.large-compose {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 12px;
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.large-compose:focus-within {
  border-color: color-mix(in srgb, var(--brand-cyan) 50%, var(--line));
  box-shadow: 0 0 0 4px rgba(0,221,242,.08);
}
.chat-compose textarea {
  min-height: 118px; resize: none; border: none;
  border-radius: 16px; padding: 8px; font: inherit;
  outline: none;
}
.compose-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.terminal-inline-status {
  color: var(--muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
}
.terminal-inline-status::before {
  content: "> ";
  color: var(--brand-green);
}
.context-items {
  display: grid;
  gap: 10px;
}
.context-item {
  border-radius: 16px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
}
.device-grid {
  display: grid;
  gap: 10px;
}
.device-grid div {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  align-items: center;
}
.device-grid span {
  color: var(--muted);
  font: 11px/1.4 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
.device-grid strong {
  font-size: 13px;
}
#sendBtn, .modal button {
  border: none; border-radius: 14px; padding: 12px 14px; cursor: pointer;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 18%, rgba(0,221,242,.18), transparent 28%),
    radial-gradient(circle at 72% 72%, rgba(124,255,73,.12), transparent 24%),
    #12151a;
}
.boot-screen.hidden { display: none; }
.boot-card {
  width: min(520px, calc(100vw - 32px));
  display: grid;
  justify-items: start;
  gap: 18px;
  padding: 28px;
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(32,35,41,.9);
  box-shadow: 0 30px 90px rgba(0,0,0,.34);
  animation: boot-rise .45s ease-out both;
}
.boot-kicker {
  color: var(--brand-green);
  font: 12px/1.4 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: .08em;
}
.boot-wordmark {
  width: 236px;
  height: 64px;
}
.boot-console {
  width: 100%;
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(10,12,16,.82);
  color: rgba(255,255,255,.8);
  font: 13px/1.5 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
.boot-line::before {
  content: "> ";
  color: var(--brand-green);
}
.boot-line {
  opacity: 0;
  transform: translateY(4px);
  animation: boot-line-in .36s ease-out forwards;
}
.boot-line:nth-child(1) { animation-delay: .08s; }
.boot-line:nth-child(2) { animation-delay: .18s; }
.boot-line:nth-child(3) { animation-delay: .28s; }
.boot-line:nth-child(4) { animation-delay: .38s; }
.boot-line.ready {
  color: var(--brand-cyan);
}
.boot-card button {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--brand-green);
  color: #101318;
  font-weight: 700;
  cursor: pointer;
}
.boot-actions {
  display: flex;
  gap: 10px;
}
.boot-card .boot-secondary {
  color: rgba(255,255,255,.84);
  background: rgba(255,255,255,.08);
}
.workspace-live .hero-card {
  animation: workspace-rise .5s ease-out both;
}
.workspace-live .agent-profile-card {
  animation: workspace-rise .5s .06s ease-out both;
}
.workspace-live .main-panel {
  animation: workspace-rise .5s .12s ease-out both;
}
.agent-switched .agent-profile-card {
  animation: agent-pulse .42s ease-out both;
}

.modal-backdrop {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(12,16,24,.32); backdrop-filter: blur(10px);
}
.hidden { display: none; }
.modal {
  width: min(480px, calc(100vw - 32px));
  border-radius: 24px; background: #fff; padding: 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,.18);
}
.modal-kicker { color: var(--accent); font-weight: 700; font-size: 13px; }
.modal h3 { margin: 8px 0; font-size: 24px; }
.modal p { color: var(--muted); }
.modal ol { line-height: 1.8; }

@keyframes terminal-blink {
  50% { opacity: 0; }
}
@keyframes boot-rise {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes workspace-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes boot-line-in {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes agent-pulse {
  0% { transform: scale(.985); }
  100% { transform: scale(1); }
}
@keyframes object-refresh {
  0% { box-shadow: 0 0 0 0 rgba(124,255,73,.26); }
  100% { box-shadow: 0 0 0 12px rgba(124,255,73,0); }
}

body[data-theme="growth"] {
  --accent: #e54d8c;
  --accent-soft: rgba(229,77,140,.12);
}
body[data-theme="commerce"] {
  --accent: #f08a24;
  --accent-soft: rgba(240,138,36,.14);
}

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 1fr; }
}

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