:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --bg-elevated: #12141a;
  --panel: #14161c;
  --panel-solid: #181a21;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f2f3f5;
  --muted: #9aa3b2;
  --accent: #e8eaed;
  --accent-soft: rgba(232, 234, 237, 0.08);
  --accent-2: #c4b5a0;
  --accent-3: #a8b4c8;
  --danger: #ff8f8f;
  --composer: #1a1d26;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --sidebar-width: 280px;
  --chat-max: 720px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --display: "Instrument Serif", Georgia, serif;
  font-family: var(--font);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(180, 190, 210, 0.08), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(196, 181, 160, 0.05), transparent 50%);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 20;
  background: var(--text);
  color: #0b0c0f;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
}

.skip-link:focus {
  top: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Shell */

.app-shell {
  position: relative;
  display: flex;
  min-height: 100vh;
}

.sidebar-toggle {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 12;
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.sidebar {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  max-height: 100vh;
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  z-index: 10;
  transition: transform 0.2s ease, width 0.2s ease, margin 0.2s ease;
}

body.sidebar-collapsed .sidebar {
  width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
}

body.sidebar-collapsed .sidebar-toggle {
  display: inline-flex;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.logo-text {
  font-size: 0.95rem;
}

.sidebar-close {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  min-width: 36px;
  min-height: 36px;
  cursor: pointer;
}

.new-chat-btn {
  width: 100%;
  justify-content: flex-start;
  gap: 8px;
  background: var(--text);
  color: #0b0c0f;
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
}

.new-chat-btn:hover {
  filter: brightness(0.95);
}

.sidebar-search input {
  width: 100%;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 12px;
  font: inherit;
}

.sidebar-section-label {
  margin: 14px 4px 6px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tool-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  max-height: 38vh;
  overflow-y: auto;
}

.tool-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  min-height: 40px;
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
}

.tool-nav-btn:hover,
.tool-nav-btn[aria-current="page"] {
  background: var(--accent-soft);
}

.tool-nav-icon {
  width: 1.4rem;
  text-align: center;
  color: var(--muted);
  flex: 0 0 auto;
}

.tool-nav-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.tool-nav-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.tool-nav-status {
  font-size: 0.72rem;
  color: var(--muted);
}

.history-block {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 4px;
}

.history-group-label {
  margin: 10px 4px 4px;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.history-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-btn {
  width: 100%;
}

.sidebar-foot-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 4px 2px;
}

.sidebar-foot-link:hover {
  color: var(--text);
}

.sidebar-backdrop {
  display: none;
}

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

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: calc(var(--chat-max) + 80px);
  margin: 0 auto;
  padding: 20px 20px 18px;
  min-height: 0;
}

.chat-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: min(70vh, 720px);
}

.empty-copy {
  margin: 8px auto 0;
  max-width: 420px;
}

body:not(.has-chat) .empty-greeting {
  display: block;
}

body:not(.has-chat) .chat-log:empty + .chip-row {
  display: flex;
}

.empty-greeting {
  text-align: center;
  padding: 28px 12px 8px;
}

.greeting-line {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}

body.has-chat .empty-greeting,
body.has-chat #demo-chips-label,
body.has-chat #demo-chips,
body.has-chat #suggestion-chips {
  display: none;
}

#main-stage[data-view]:not([data-view="chat"]) .chat-stage {
  display: none;
}

#main-stage[data-view="chat"] .tool-view {
  display: none !important;
}

/* Landing blocks */

.hero {
  text-align: center;
  padding: 12px 0 8px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar-brand a {
  color: inherit;
  text-decoration: none;
}

.hero h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.hero-copy {
  margin: 0 auto;
  max-width: 560px;
  color: var(--muted);
}

.hero-lead {
  display: block;
  margin-top: 0.12em;
  color: var(--accent-2);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 16px auto 8px;
}

.hero-pricing-note {
  margin: 0 auto 4px;
  max-width: 520px;
  color: var(--muted);
  font-size: 0.9rem;
}

.capabilities,
.pricing,
.tools-roadmap {
  margin: 12px auto 4px;
  max-width: 720px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(20, 22, 28, 0.7);
  text-align: left;
}

.capabilities h2,
.pricing h2,
.tools-roadmap h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  text-align: center;
}

.tools-roadmap-lead {
  margin: 0 auto 14px;
  max-width: 520px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.tools-roadmap-list {
  display: grid;
  gap: 10px;
}

.roadmap-phase {
  padding: 12px 12px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(12, 14, 18, 0.45);
}

.roadmap-phase-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.roadmap-phase-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.roadmap-status {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
}

.roadmap-status[data-status="live"] {
  color: #b7d4b0;
  border-color: rgba(183, 212, 176, 0.35);
  background: rgba(183, 212, 176, 0.08);
}

.roadmap-status[data-status="in-progress"] {
  color: var(--accent-2);
  border-color: rgba(196, 181, 160, 0.4);
  background: rgba(196, 181, 160, 0.1);
}

.roadmap-status[data-status="coming-soon"] {
  color: var(--accent-3);
  border-color: rgba(168, 180, 200, 0.35);
  background: rgba(168, 180, 200, 0.08);
}

.roadmap-item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.roadmap-item {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.roadmap-item strong {
  display: block;
  margin-bottom: 1px;
  color: var(--text);
  font-weight: 500;
}

.roadmap-item-link {
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 6px;
  margin: -4px -6px;
}

.roadmap-item-link:hover,
.roadmap-item-link:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.capability-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.capability-list li,
.pricing li {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.capability-list strong,
.pricing strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
}

.capability-list a {
  color: var(--accent-3);
}

@media (max-width: 720px) {
  .capability-list,
  .roadmap-item-list {
    grid-template-columns: 1fr;
  }

  .roadmap-phase-head {
    align-items: flex-start;
  }
}

.notice {
  min-height: 1.2em;
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.notice:empty {
  display: none;
}

/* Chat messages */

.chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 8px 2px 16px;
  min-height: 0;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 100%;
  width: 100%;
}

.message.user {
  align-items: flex-end;
}

.message.assistant {
  align-items: flex-start;
}

.bubble {
  border-radius: 18px;
  padding: 12px 16px;
  border: 1px solid transparent;
  background: transparent;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.message.user .bubble {
  background: var(--accent-soft);
  border-color: var(--border);
  max-width: 85%;
}

.message.assistant .bubble {
  padding-left: 2px;
  border: 0;
}

.bubble .chart-host {
  margin-top: 12px;
  min-height: 120px;
}

.chart-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-frame {
  height: 280px;
  width: 100%;
}

.chart-svg {
  width: 100%;
  height: 100%;
  display: block;
  color: var(--muted);
}

.chart-svg text {
  font-size: 11px;
  fill: currentColor;
}

.chart-grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.chart-zero {
  stroke: rgba(232, 234, 237, 0.28);
  stroke-width: 1;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.swatch {
  display: inline-block;
  width: 22px;
  height: 0;
  border-top: 3px solid var(--accent-3);
  flex: 0 0 auto;
}

.swatch.is-dashed {
  border-top-style: dashed;
}

.swatch.is-band {
  height: 10px;
  border: 0;
  border-radius: 3px;
  opacity: 0.8;
}

.chart-host svg {
  max-width: 100%;
  height: auto;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.speak-btn,
.tool-used-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
}

.speak-btn:hover,
.speak-btn:focus-visible {
  border-color: var(--border-strong);
  color: var(--text);
}

.speak-btn[disabled] {
  opacity: 0.55;
  cursor: progress;
}

.inline-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0 4px;
  justify-content: center;
}

.chip-label {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  padding: 8px 14px;
  min-height: 36px;
  font-size: 0.88rem;
  cursor: pointer;
}

.chip:hover,
.chip:focus-visible {
  border-color: var(--border-strong);
  background: var(--accent-soft);
}

/* Composer */

.chat-form.composer {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 4px;
  background: linear-gradient(transparent, var(--bg) 28%);
  z-index: 4;
  isolation: isolate;
}

.composer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 24px;
  border: 1px solid var(--border-strong);
  background: var(--composer);
  box-shadow: var(--shadow);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
}

.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
  background: var(--accent-soft);
}

.icon-btn-small {
  width: 28px;
  height: 28px;
  font-size: 1rem;
  line-height: 1;
}

/* Phase 4: attached image preview + image in a user bubble */
.image-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  max-width: 100%;
  padding: 6px 8px 6px 6px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--composer);
}

.image-attachment[hidden] {
  display: none;
}

.image-attachment img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
}

.image-attachment-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted, inherit);
  font-size: 0.9rem;
}

.bubble-image {
  display: block;
  max-width: min(320px, 100%);
  max-height: 240px;
  margin-bottom: 8px;
  border-radius: 12px;
  object-fit: contain;
}

.mode-pill {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  min-height: 40px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

.mode-pill[aria-pressed="true"] {
  border-color: #f0c27a;
  background: rgba(240, 194, 122, 0.16);
  color: #f5d7a1;
}

.mode-pill[data-state="armed"] {
  border-color: #f0c27a;
  background: rgba(240, 194, 122, 0.16);
  color: #f5d7a1;
}

.mode-pill[data-state="listening"],
.mode-pill[data-state="thinking"],
.mode-pill[data-state="speaking"] {
  border-color: var(--accent-3);
  background: rgba(168, 180, 200, 0.18);
  color: var(--text);
}

.mode-pill[data-state="armed"],
.mode-pill[data-state="listening"] {
  display: inline-flex;
  align-items: center;
}

.mode-pill[data-state="armed"]::before,
.mode-pill[data-state="listening"]::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #7dffb1;
  box-shadow: 0 0 0 0 rgba(125, 255, 177, 0.7);
  animation: talk-pulse 1.4s ease-out infinite;
}

@keyframes talk-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(125, 255, 177, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(125, 255, 177, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(125, 255, 177, 0);
  }
}

.talk-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.talk-status:empty,
.talk-status[hidden] {
  display: none;
}

.talk-start-overlay {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: flex;
  justify-content: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  background: linear-gradient(transparent, rgba(11, 12, 15, 0.72) 45%);
}

.talk-start-overlay[hidden] {
  display: none;
}

.talk-start-card {
  pointer-events: auto;
  width: min(420px, 100%);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

.talk-start-card p {
  margin: 0;
}

#talk-start-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.talk-start-copy {
  color: var(--muted);
  font-size: 0.95rem;
}

.composer-row textarea,
.chat-form input,
.chat-form textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 160px;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 10px 4px;
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
}

.composer-row textarea:focus-visible {
  outline: none;
}

.send-btn {
  flex: 0 0 auto;
  border-radius: 999px;
  min-width: 72px;
}

.tools-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: min(320px, 92vw);
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 6;
}

.chat-form.composer {
  position: sticky;
}

.tools-menu-item {
  display: flex;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  font: inherit;
}

.tools-menu-item:hover {
  background: var(--accent-soft);
}

.tools-menu-item .muted {
  color: var(--muted);
  font-size: 0.78rem;
}

/* Tool views */

.tool-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 0 24px;
}

.tool-view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tool-view-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.8rem;
}

.side-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}

.side-panel summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 8px 14px;
  font-weight: 700;
}

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

.side-panel summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 400;
}

.side-panel[open] summary::after {
  content: "–";
}

.side-panel[open] summary {
  border-bottom: 1px solid var(--border);
}

.side-panel-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-panel-body h3 {
  margin: 6px 0 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.side-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.starter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.output {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #0a0b0e;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: pre-wrap;
  font-size: 0.85rem;
}

.table-wrap {
  overflow: auto;
}

.table-scroll {
  max-height: 260px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}

.pca-summary {
  margin: 0;
  line-height: 1.45;
}

.pca-groups-title {
  margin: 8px 0 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Shared controls */

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 18px;
  min-height: 44px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
}

.btn-small {
  min-height: 38px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn.primary {
  background: var(--text);
  color: #0b0c0f;
}

.btn.primary:hover {
  filter: brightness(0.95);
}

.btn.secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn.secondary:hover,
.btn.secondary:focus-visible {
  border-color: var(--border-strong);
  background: var(--accent-soft);
}

.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.linklike {
  background: none;
  border: none;
  color: var(--accent-3);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="search"],
input[type="file"],
select {
  width: 100%;
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.95rem;
  font-family: inherit;
}

/* Modals */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal {
  width: min(440px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  min-width: 36px;
  min-height: 36px;
  cursor: pointer;
}

.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Docs page inherits some of these tokens via docs.html */

.docs-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

/* Mobile drawer */

@media (max-width: 900px) {
  .sidebar-toggle {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-105%);
    box-shadow: var(--shadow);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-width);
    padding: 14px 12px;
    overflow: auto;
    border-right: 1px solid var(--border);
  }

  .sidebar-close {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9;
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  body:not(.sidebar-open) .sidebar-backdrop {
    display: none !important;
  }

  .chat-main {
    padding-top: 64px;
  }

  .composer-row {
    border-radius: 18px;
  }
}

/* Phase 5 world model simulator */
.sim-form fieldset.sim-scenario {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 10px;
  margin: 6px 0;
}
.sim-form fieldset.sim-scenario legend {
  padding: 0 4px;
  font-size: 0.85rem;
  opacity: 0.8;
}
.sim-form fieldset.sim-scenario label {
  display: flex;
  gap: 6px;
  align-items: center;
}
.sim-form fieldset.sim-scenario input[type="number"] {
  width: 5.5em;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 4px 6px;
}
.sim-form textarea {
  width: 100%;
  box-sizing: border-box;
}
.sim-scrub {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
}
.sim-scrub input[type="range"] {
  flex: 1;
  min-width: 0;
}
.sim-readout li {
  font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) {
  .sim-form fieldset.sim-scenario input[type="text"],
  .sim-form fieldset.sim-scenario select {
    flex: 1 1 100%;
  }
}

/* ------------------------------------------------------------------ Nous */

/* Auth state: landing for visitors, a gate before the app, the app after. */
body.auth-pending .app-shell,
body.auth-pending .landing,
body.auth-out .app-shell,
body.gate-open .app-shell,
body.gate-open .landing,
body.auth-in .landing,
body.auth-in .auth-gate {
  display: none !important;
}

body.auth-out:not(.gate-open) .auth-gate {
  display: none !important;
}

body.gate-open .auth-gate {
  display: flex !important;
}

body.auth-out #talk-start-overlay,
body.gate-open #talk-start-overlay,
body.auth-pending #talk-start-overlay {
  display: none !important;
}

.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f2f3f5, #a8b4c8);
  color: #0b0c0f;
  font-weight: 700;
  font-family: var(--display);
  font-size: 1.15rem;
}

.logo-mark-big {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  font-size: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.brand-center {
  justify-content: center;
}

/* Landing */
.landing {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 18px clamp(16px, 4vw, 40px);
}

.landing-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.landing-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.landing-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.landing-links a.btn {
  color: var(--text);
}

.landing-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 40px 0;
}

.landing-hero h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3rem, 10vw, 5.5rem);
  letter-spacing: -0.03em;
  line-height: 1;
}

.landing-tag {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
}

.landing-cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

.landing-cta .btn {
  min-width: 140px;
  min-height: 46px;
  font-size: 1rem;
}

.landing-pills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 0;
  margin: 18px 0 0;
}

.landing-pills li {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.landing-more {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.landing-more p {
  margin: 4px 0;
}

.landing-more a {
  color: var(--text);
}

/* Gate */
.auth-gate {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-card {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  text-align: center;
}

.gate-title {
  margin: 4px 0 6px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 2rem;
}

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

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

.gate-form input {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--composer);
  color: var(--text);
  padding: 0 14px;
  font: inherit;
  font-size: 1rem;
}

.gate-btn {
  min-height: 48px;
  border-radius: 14px;
  font-size: 1rem;
  width: 100%;
}

.gate-hint,
.gate-switch {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.gate-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.92rem;
}

.gate-secret {
  display: block;
  word-break: break-all;
  padding: 10px;
  border-radius: 10px;
  background: var(--panel-solid);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  user-select: all;
}

.gate-codes {
  text-align: left;
  columns: 2;
  margin: 0;
  padding-left: 22px;
  font-family: ui-monospace, monospace;
  font-size: 0.95rem;
  user-select: all;
}

.gate-signout {
  align-self: center;
  color: var(--muted);
}

/* Minimal opening screen */
.empty-greeting {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: clamp(40px, 16vh, 160px);
}

body:not(.has-chat) .empty-greeting {
  display: flex;
}

.action-chips {
  justify-content: center;
  gap: 8px;
  margin: 14px auto 0;
  max-width: 640px;
  order: 3;
}

.action-chips .chip {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
}

body:not(.has-chat) .chat-stage {
  justify-content: flex-start;
}

/* Grok/ChatGPT-style single composer box: text on top, tools below. */
.chat-form.composer {
  gap: 0;
  padding: 10px 12px 8px;
  border-radius: 26px;
  border: 1px solid var(--border-strong);
  background: var(--composer);
  box-shadow: var(--shadow);
  position: sticky;
  bottom: 12px;
  margin-top: 12px;
}

body:not(.has-chat) .chat-form.composer {
  position: relative;
  bottom: auto;
  order: 2;
  margin-top: 22px;
}

body:not(.has-chat) #chat-log {
  order: 4;
}

.chat-form.composer .composer-row {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 2px 4px;
  border-radius: 0;
}

.composer-toolbar {
  justify-content: space-between;
  flex-wrap: nowrap;
}

.composer-left,
.composer-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.composer-left {
  flex-wrap: wrap;
}

.composer-toolbar .icon-btn {
  width: 36px;
  height: 36px;
  font-size: 1rem;
}

.chat-form .send-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 999px;
  border: 0;
  background: var(--text);
  color: #0b0c0f;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.chat-form .send-btn:hover {
  opacity: 0.9;
}

.sidebar-foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.sidebar-foot-links .linklike {
  padding: 0;
  font-size: inherit;
}

.about-view .hero,
.about-view .capabilities,
.about-view .pricing,
.about-view .tools-roadmap,
.about-view .contact {
  text-align: left;
  margin: 18px 0;
}

@media (max-width: 900px) {
  .empty-greeting {
    padding-top: clamp(24px, 10vh, 90px);
  }

  .chat-form.composer {
    border-radius: 22px;
    bottom: 8px;
  }

  .composer-toolbar .mode-pill {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .landing-links a:not(.btn) {
    display: none;
  }
}

/* Brand: HTML "N" and "U" + the black hole O and swirl S images.
   Size it with font-size. Both images are cropped centred on the cap
   centre of the source letters (cap height 147px = 0.7em in Montserrat). */
.nous-wordmark {
  display: inline-flex;
  align-items: center;
  font-size: 22px;
  line-height: 1;
  color: #fff;
  white-space: nowrap;
}

.nous-wordmark .nou {
  font-family: "Montserrat", "Futura", "Century Gothic", "Avenir Next", sans-serif;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.nous-wordmark .nous-o {
  /* 241px tall in the source = 1.148em. */
  height: 1.148em;
  width: auto;
  margin: 0 0.01em 0 -0.01em;
  display: block;
}

.nous-wordmark .nous-s {
  /* 255px tall in the source = 1.214em. */
  height: 1.214em;
  width: auto;
  margin: -0.05em 0 -0.05em -0.02em;
  display: block;
}

.brand-mark {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.landing-wordmark {
  margin: 0;
  font-weight: inherit;
}

.landing-wordmark .nous-wordmark {
  font-size: clamp(56px, 11vw, 112px);
  margin-bottom: 0.08em;
}

.gate-wordmark {
  font-size: 40px;
  margin: 0 auto 0.08em;
}

.sidebar-logo .nous-wordmark {
  font-size: 20px;
}

.tool-nav-more > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 8px 10px;
  list-style: none;
}

.tool-nav-more > summary::before {
  content: "▸ ";
}

.tool-nav-more[open] > summary::before {
  content: "▾ ";
}

/* Pinned tools fit without scrolling; the "All tools" group scrolls inside. */
.tool-nav {
  max-height: none;
  overflow: visible;
  flex: 0 0 auto;
}

.tool-nav-more[open] {
  max-height: 34vh;
  overflow-y: auto;
}

.tool-nav-btn {
  min-height: 38px;
}

@media (max-width: 900px) {
  body.sidebar-open .sidebar-toggle {
    display: none !important;
  }

  .sidebar {
    overflow-y: auto;
  }
}

/* Voice & Nous Plus panel */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.stat-card span {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-card strong {
  font-size: 1rem;
}

#voice-plan .starter-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
}

#voice-plan .starter-card h3,
#voice-plan .starter-card p {
  margin: 0;
}

/* Unhinged switch: off by default, never restored from storage. */
.unhinged-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 4px 10px 4px 6px;
  border: 1px solid var(--line, #2a2f3a);
  border-radius: 999px;
  background: transparent;
  color: var(--muted, #9aa3b2);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.unhinged-switch .switch-track {
  position: relative;
  width: 30px;
  height: 18px;
  border-radius: 999px;
  background: #3a4050;
  transition: background 0.15s ease;
  flex: none;
}
.unhinged-switch .switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}
.unhinged-switch.is-on {
  color: #fff;
  border-color: #ff5a36;
}
.unhinged-switch.is-on .switch-track {
  background: #ff5a36;
}
.unhinged-switch.is-on .switch-thumb {
  transform: translateX(12px);
}
.unhinged-switch:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
