:root {
  --bg: #08090a;
  --bg-2: #0d0f10;
  --surface: rgba(18, 20, 21, 0.78);
  --surface-2: rgba(25, 27, 29, 0.72);
  --line: rgba(96, 99, 101, 0.54);
  --line-soft: rgba(255, 255, 255, 0.07);
  --text: #f4f0e8;
  --muted: #9d9a93;
  --muted-2: #6e716e;
  --gold: #f6c542;
  --gold-2: #ffd76a;
  --ok: #73d39a;
  --warn: #f3b45b;
  --danger: #ef6a6a;
  --radius: 7px;
  --hairline: 0.5px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 72% 10%, rgba(246, 197, 66, 0.12), transparent 24rem),
    radial-gradient(circle at 18% 2%, rgba(255, 255, 255, 0.06), transparent 18rem),
    linear-gradient(135deg, #050607 0%, var(--bg) 44%, #0f1112 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(246, 197, 66, 0.82);
  outline-offset: 3px;
}

#noise-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  opacity: 0.28;
  pointer-events: none;
  image-rendering: pixelated;
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100dvh;
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100dvh;
  padding: 22px;
  border-right: var(--hairline) solid var(--line);
  background: rgba(7, 8, 9, 0.82);
  backdrop-filter: blur(22px);
}

.brand,
.rail-foot,
.topbar,
.auth-band,
.login-panel,
.session-panel,
.section-head,
.composer,
.plan-card,
.attachment-card,
.todo-note,
.alert-lane,
.file-panel,
.dropzone,
.upload-status,
.file-row,
.metric-strip > div,
.gate-card,
.funnel-card,
.agent-node,
.event-row,
.message,
.hero-panel,
.plan-pane {
  border: var(--hairline) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.24);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
}

.brand-logo {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: var(--radius);
  border: var(--hairline) solid rgba(246, 197, 66, 0.38);
  background: rgba(0, 0, 0, 0.32);
  box-shadow: 0 0 28px rgba(246, 197, 66, 0.12);
}

.brand strong {
  display: block;
  font-size: 15px;
  line-height: 1.1;
}

.brand small,
.rail-foot,
.eyebrow,
.status-pill,
.metric-strip small,
.message-meta,
.node-meta,
.gate-card small,
.funnel-card small {
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  color: var(--muted);
  border: var(--hairline) solid transparent;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  border-color: rgba(246, 197, 66, 0.34);
  background: rgba(246, 197, 66, 0.08);
}

.nav-item:active,
.gold-btn:active,
.ghost-btn:active {
  transform: translateY(1px);
}

.nav-ico {
  display: inline-flex;
  width: 20px;
  height: 20px;
}

.nav-ico svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 11px;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted-2);
}

.dot.live {
  background: var(--ok);
  box-shadow: 0 0 18px rgba(115, 211, 154, 0.62);
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  position: sticky;
  top: 22px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  backdrop-filter: blur(22px);
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.eyebrow.gold,
.gold {
  color: var(--gold);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 650;
}

h2 {
  font-size: clamp(22px, 3vw, 36px);
  font-weight: 650;
  line-height: 1.05;
}

h3 {
  font-size: 15px;
  font-weight: 620;
}

.top-actions,
.composer-actions,
.login-panel,
.session-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.gold-btn,
.ghost-btn,
.login-panel input {
  min-height: 44px;
  border-radius: var(--radius);
  border: var(--hairline) solid var(--line);
  padding: 10px 14px;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.gold-btn {
  color: #17130a;
  border-color: rgba(246, 197, 66, 0.82);
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: 0 0 28px rgba(246, 197, 66, 0.18);
}

.ghost-btn {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.ghost-btn.danger {
  color: var(--danger);
}

.gold-btn:disabled,
.ghost-btn:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.ghost-btn:hover {
  border-color: rgba(246, 197, 66, 0.34);
  background: rgba(246, 197, 66, 0.08);
}

.login-panel input {
  min-width: min(260px, 100%);
  color: var(--text);
  background: rgba(0, 0, 0, 0.2);
}

.login-panel input::placeholder {
  color: var(--muted-2);
}

.auth-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 12px;
}

.login-brand {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 6px 0 2px;
}

.login-brand img {
  width: min(190px, 34vw);
  height: 44px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 0 18px rgba(246, 197, 66, 0.1));
}

.session-panel {
  align-items: center;
  justify-content: space-between;
  flex: 1 1 auto;
}

.view {
  display: none;
  padding-top: 18px;
}

.view.active {
  display: block;
  animation: viewIn 220ms ease-out;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cockpit-grid {
  display: grid;
  gap: 14px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 24px;
  min-height: 310px;
  padding: clamp(22px, 4vw, 42px);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(246, 197, 66, 0.11), transparent 32%),
    radial-gradient(circle at 88% 18%, rgba(246, 197, 66, 0.2), transparent 22rem),
    rgba(14, 16, 17, 0.84);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 760px;
  gap: 16px;
}

.hero-copy p:last-child {
  max-width: 640px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.signal-stack {
  display: grid;
  align-content: end;
  gap: 10px;
}

.signal-stack div,
.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px;
  border: var(--hairline) solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
}

.signal-stack span,
.metric-strip span {
  color: var(--muted);
  font-size: 12px;
}

.signal-stack strong {
  font-size: 28px;
  color: var(--gold);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-strip > div {
  display: grid;
  gap: 7px;
  padding: 16px;
}

.metric-strip strong {
  font-size: 22px;
  font-weight: 650;
}

.alert-lane {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.file-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.section-head.inline {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.file-picker {
  position: relative;
  overflow: hidden;
}

.file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone {
  display: grid;
  gap: 5px;
  min-height: 96px;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  border-style: dashed;
  background: rgba(246, 197, 66, 0.04);
  text-align: center;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.dropzone strong {
  color: var(--text);
  font-size: 15px;
}

.dropzone span {
  max-width: 620px;
  font-size: 13px;
  line-height: 1.45;
}

.dropzone.is-dragover {
  color: var(--text);
  border-color: rgba(246, 197, 66, 0.82);
  background: rgba(246, 197, 66, 0.13);
  transform: translateY(-1px);
}

.upload-status {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.upload-status[hidden] {
  display: none;
}

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

.upload-status-top span {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transition: width 160ms ease;
}

#upload-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 12px;
}

.file-list {
  display: grid;
  gap: 8px;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
}

.file-row.attached {
  border-color: rgba(246, 197, 66, 0.7);
  background: rgba(246, 197, 66, 0.09);
}

.file-main {
  display: grid;
  justify-items: start;
  text-align: left;
}

.file-main span {
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  padding: 16px;
  color: var(--muted);
  border: var(--hairline) solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

.alert-item {
  justify-content: flex-start;
}

.alert-item span {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--ok);
}

.alert-item.warn span {
  background: var(--warn);
}

.alert-item.gold-line span {
  background: var(--gold);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 16px;
}

.flow {
  display: grid;
  justify-items: center;
  gap: 0;
  padding: 8px 0 40px;
}

.flow-tier {
  display: grid;
  width: min(980px, 100%);
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 14px;
}

.flow-line {
  width: var(--hairline);
  height: 28px;
  background: linear-gradient(var(--gold), transparent);
}

.agent-node {
  display: grid;
  gap: 10px;
  min-height: 132px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.agent-node::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--node-color, var(--gold));
}

.node-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.node-title strong {
  font-size: 15px;
}

.node-meta {
  line-height: 1.5;
}

.node-detail {
  display: none;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.show-details .node-detail {
  display: block;
}

.status-pill,
.mini-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  border: var(--hairline) solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(255, 255, 255, 0.04);
}

.mini-pill {
  color: var(--gold);
  font-size: 11px;
}

.gate-grid,
.funnels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.gate-card,
.funnel-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.gate-top,
.funnel-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.gate-actions,
.funnel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stage-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.stage-bar span {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.stage-bar span.on {
  background: var(--gold);
}

.timeline {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.event-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
}

.event-row time {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.event-row p {
  color: var(--muted);
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: minmax(360px, calc(100dvh - 214px)) auto;
  gap: 14px;
}

.chat-history,
.plan-pane {
  min-height: 0;
  overflow: auto;
}

.chat-history {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px;
}

.message {
  max-width: min(760px, 92%);
  padding: 14px;
}

.message.operator {
  align-self: flex-end;
  background: rgba(246, 197, 66, 0.11);
  border-color: rgba(246, 197, 66, 0.42);
}

.message.system {
  align-self: flex-start;
}

.message.error {
  border-color: rgba(239, 106, 106, 0.5);
  background: rgba(239, 106, 106, 0.08);
}

.message p {
  margin-top: 6px;
  color: var(--text);
  line-height: 1.5;
}

.plan-pane {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
}

.plan-card,
.todo-note {
  display: grid;
  gap: 9px;
  padding: 13px;
}

.plan-card ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.todo-note,
.attachment-card {
  color: var(--muted);
  font-size: 13px;
  background: rgba(246, 197, 66, 0.06);
  border-color: rgba(246, 197, 66, 0.22);
}

.composer {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.composer textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border: 0;
  color: var(--text);
  background: transparent;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: var(--muted-2);
}

.composer-actions {
  justify-content: space-between;
}

.composer-left {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.chat-attach {
  display: inline-flex;
  align-items: center;
}

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

  .rail {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: var(--hairline) solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rail-foot {
    margin-top: 0;
  }

  .topbar {
    top: 10px;
  }

  .metric-strip,
  .gate-grid,
  .funnels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
}

@media (max-width: 720px) {
  .workspace,
  .rail {
    padding: 14px;
  }

  .topbar,
  .section-head,
  .hero-panel {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .nav-list,
  .metric-strip,
  .gate-grid,
  .funnels,
  .flow-tier {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: 0;
  }

  .event-row {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .composer-actions,
  .login-panel,
  .session-panel,
  .file-row {
    display: grid;
  }

  .auth-band {
    display: grid;
  }

  .login-brand img {
    width: min(210px, 78vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
