:root {
  color-scheme: dark;
  --bg: #02030a;
  --bg-2: #070818;
  --panel: rgba(8, 11, 28, 0.86);
  --panel-strong: rgba(12, 16, 38, 0.96);
  --text: #f7f2ff;
  --muted: #b9b4cc;
  --soft: #89839f;
  --line: rgba(255, 255, 255, 0.105);
  --gold: #f7c86a;
  --gold-2: #f9e2a8;
  --violet: #9b7cff;
  --pink: #ff66c4;
  --blue: #77d5ff;
  --green: #75f0b5;
  --red: #ff8aa0;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius-lg: 24px;
  --radius-md: 16px;
  --max: 1280px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(111, 74, 255, 0.18), transparent 34rem),
    radial-gradient(circle at 90% 10%, rgba(247, 200, 106, 0.10), transparent 32rem),
    radial-gradient(circle at 50% 110%, rgba(119, 213, 255, 0.075), transparent 44rem),
    linear-gradient(180deg, var(--bg), #01020a 62%, #050411);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 86px 86px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.62;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(249, 226, 168, 0.92);
  outline-offset: 4px;
}

a {
  color: inherit;
  text-decoration: none;
}

#starfield {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100vw;
  height: 100vh;
  opacity: 0.62;
}

.app-shell {
  width: min(var(--max), calc(100% - 36px));
  min-height: 100vh;
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 14px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 14px auto 0;
  padding: 0.72rem 0.8rem 0.72rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(3, 4, 13, 0.86);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: #130e02;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  box-shadow: 0 0 18px rgba(247, 200, 106, 0.26);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0;
}

.brand span {
  white-space: nowrap;
}

.header-right,
.site-nav {
  display: flex;
  align-items: center;
}

.header-right {
  justify-content: flex-end;
  gap: 0.75rem;
  min-width: 0;
}

.site-nav {
  gap: 0.16rem;
}

.nav-item {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 0 0.78rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
  transition: 180ms ease;
}

.nav-item.active,
.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.powered-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.46rem;
  min-height: 42px;
  border: 1px solid rgba(155, 124, 255, 0.35);
  border-radius: 999px;
  padding: 0 0.82rem;
  color: var(--violet);
  background: rgba(155, 124, 255, 0.14);
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.powered-pill img {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  object-fit: cover;
  box-shadow: 0 0 12px rgba(247, 200, 106, 0.22);
}

main {
  min-width: 0;
  padding: 70px 0 54px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2rem;
  margin-bottom: 2rem;
}

.topbar > div:first-child {
  min-width: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  color: var(--gold-2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  font-weight: 850;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 0 0 rgba(247, 200, 106, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(247, 200, 106, 0.7); }
  70% { box-shadow: 0 0 0 13px rgba(247, 200, 106, 0); }
  100% { box-shadow: 0 0 0 0 rgba(247, 200, 106, 0); }
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.045em;
}

h1 {
  max-width: 920px;
  font-size: clamp(3rem, 7.2vw, 7.2rem);
  line-height: 1.14;
  padding-bottom: 0.12em;
}

h2 {
  font-size: clamp(1.05rem, 1.35vw, 1.32rem);
  line-height: 1.25;
}

.hero-lede {
  max-width: 820px;
  margin: 1.35rem 0 0;
  color: var(--muted);
  font-size: clamp(1.02rem, 1.6vw, 1.22rem);
  line-height: 1.65;
}

.topbar-actions,
.pill-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 1.18rem;
  font-weight: 850;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.primary-button {
  color: #130e02;
  background: linear-gradient(135deg, var(--gold), #fff1bd);
  border-color: rgba(255, 255, 255, 0.1);
}

.secondary-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-2px);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.store-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.metrics article,
.store-facts article,
.queue-panel,
.detail-panel,
.action-panel,
.owner-chat-panel,
.owner-message-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.028)),
    var(--panel);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.22);
}

.metrics article {
  position: relative;
  display: grid;
  gap: 0.55rem;
  overflow: hidden;
  min-height: 132px;
  padding: 1.15rem;
}

.store-facts article {
  display: grid;
  gap: 0.52rem;
  min-height: 118px;
  padding: 1.05rem;
  background:
    radial-gradient(circle at 14% 0%, rgba(155, 124, 255, 0.12), transparent 44%),
    rgba(255, 255, 255, 0.03);
}

.metrics article::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 20% 0%, rgba(247, 200, 106, 0.12), transparent 42%);
}

.metrics span,
.metrics em,
.store-facts span,
.store-facts em {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
}

.metrics span,
.store-facts span,
.guardrail-row span,
.route-label {
  letter-spacing: 0.03em;
}

.store-facts span {
  color: var(--gold-2);
  font-weight: 850;
  text-transform: uppercase;
}

.store-facts strong {
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.25;
}

.metrics strong {
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
}

.owner-agent-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.owner-chat-panel,
.owner-message-panel {
  min-width: 0;
  padding: 1.15rem;
}

.owner-intro {
  max-width: 760px;
  margin: -0.35rem 0 1rem;
  color: var(--muted);
  line-height: 1.58;
}

.visitor-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.visitor-fields input,
.owner-chat-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 1rem;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

.visitor-fields input::placeholder,
.owner-chat-form input::placeholder {
  color: var(--soft);
}

.owner-chat-timeline {
  display: grid;
  gap: 0.72rem;
  min-height: 220px;
  max-height: 360px;
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
  scrollbar-color: rgba(247, 200, 106, 0.55) rgba(255, 255, 255, 0.04);
}

.owner-turn {
  max-width: 86%;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.032);
  padding: 0.9rem 1rem;
}

.owner-turn.visitor {
  margin-left: auto;
  border-color: rgba(247, 200, 106, 0.2);
  background:
    radial-gradient(circle at 20% 0%, rgba(247, 200, 106, 0.11), transparent 48%),
    rgba(247, 200, 106, 0.045);
}

.owner-turn.owner_agent {
  border-color: rgba(155, 124, 255, 0.24);
  background:
    radial-gradient(circle at 20% 0%, rgba(155, 124, 255, 0.12), transparent 48%),
    rgba(155, 124, 255, 0.05);
}

.owner-turn strong {
  display: block;
  margin-bottom: 0.42rem;
  color: var(--text);
  font-size: 0.82rem;
}

.owner-turn p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.owner-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  margin-top: 1rem;
}

.compact-button {
  min-height: 38px;
  padding-inline: 0.95rem;
}

.owner-message-list {
  display: grid;
  gap: 0.72rem;
}

.owner-message-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 18% 0%, rgba(155, 124, 255, 0.1), transparent 42%),
    rgba(255, 255, 255, 0.028);
  padding: 1rem;
}

.owner-message-card strong {
  display: block;
  color: var(--text);
  line-height: 1.32;
}

.owner-message-card p {
  margin: 0.65rem 0;
  color: var(--muted);
  line-height: 1.5;
}

.owner-message-card span {
  color: var(--soft);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(390px, 1.35fr) minmax(300px, 0.95fr);
  gap: 1rem;
  align-items: start;
}

.queue-panel,
.detail-panel,
.action-panel {
  min-width: 0;
  padding: 1.15rem;
}

.section-heading,
.session-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.status-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgba(247, 200, 106, 0.18);
  border-radius: 999px;
  background: rgba(247, 200, 106, 0.08);
  color: var(--gold-2);
  padding: 0 0.72rem;
  font-size: 0.76rem;
  font-weight: 850;
}

.status-dot.ok {
  color: var(--green);
  border-color: rgba(117, 240, 181, 0.22);
  background: rgba(117, 240, 181, 0.08);
}

.status-dot.error {
  color: var(--red);
  border-color: rgba(255, 138, 160, 0.24);
  background: rgba(255, 138, 160, 0.08);
}

.session-list,
.timeline,
.action-list {
  display: grid;
  gap: 0.72rem;
}

.session-row {
  width: 100%;
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.028);
  color: var(--text);
  text-align: left;
  padding: 1rem;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.session-row.active,
.session-row:hover {
  transform: translateY(-1px);
  border-color: rgba(247, 200, 106, 0.32);
  background:
    radial-gradient(circle at 20% 0%, rgba(247, 200, 106, 0.13), transparent 42%),
    rgba(255, 255, 255, 0.036);
}

.session-row strong {
  display: block;
  margin-bottom: 0.7rem;
  color: var(--text);
  font-size: 1rem;
}

.session-row > span {
  display: block;
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.48;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.68rem;
  background: rgba(255, 255, 255, 0.032);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}

.pill.low,
.pill.active,
.pill.faq,
.pill.message,
.pill.appointment,
.pill.callback,
.pill.completed {
  color: var(--green);
  border-color: rgba(117, 240, 181, 0.2);
  background: rgba(117, 240, 181, 0.08);
}

.pill.medium,
.pill.waiting_on_caller,
.pill.proposed {
  color: var(--gold-2);
  border-color: rgba(247, 200, 106, 0.22);
  background: rgba(247, 200, 106, 0.08);
}

.pill.high,
.pill.handoff_pending,
.pill.human_handoff,
.pill.blocked {
  color: var(--red);
  border-color: rgba(255, 138, 160, 0.26);
  background: rgba(255, 138, 160, 0.09);
}

.timeline {
  min-height: 350px;
  max-height: 54vh;
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
  scrollbar-color: rgba(247, 200, 106, 0.55) rgba(255, 255, 255, 0.04);
}

.message {
  max-width: 88%;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.032);
  padding: 0.9rem 1rem;
}

.message.ai_agent {
  margin-left: auto;
  border-color: rgba(119, 213, 255, 0.18);
  background:
    radial-gradient(circle at 20% 0%, rgba(119, 213, 255, 0.1), transparent 48%),
    rgba(119, 213, 255, 0.055);
}

.message.system {
  max-width: 100%;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.024);
}

.message strong {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--text);
  font-size: 0.82rem;
}

.message p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.transcript-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  margin-top: 1rem;
}

.transcript-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 1rem;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

.transcript-form input::placeholder {
  color: var(--soft);
}

.action-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 18% 0%, rgba(247, 200, 106, 0.12), transparent 42%),
    rgba(255, 255, 255, 0.028);
  padding: 1rem;
}

.action-card header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.action-card strong {
  color: var(--text);
  line-height: 1.22;
}

.action-card p {
  margin-bottom: 0.9rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.action-card button {
  width: 100%;
  min-height: 44px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  padding: 1.3rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.022);
}

.guardrails {
  margin-top: 1.15rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.guardrail-row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  min-height: 44px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  align-items: center;
}

.guardrail-row span {
  color: var(--muted);
}

.guardrail-row strong {
  color: var(--gold-2);
}

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

  .action-panel {
    grid-column: 1 / -1;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .store-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .owner-agent-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .site-header {
    align-items: stretch;
    border-radius: 24px;
    flex-direction: column;
  }

  .header-right {
    align-items: stretch;
    flex-direction: column;
  }

  .site-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

@media (max-width: 720px) {
  .app-shell {
    width: calc(100% - 28px);
  }

  main {
    padding-top: 48px;
  }

  .brand span {
    display: block;
  }

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

  .powered-pill {
    justify-content: center;
    width: 100%;
  }

  h1 {
    max-width: 10em;
    font-size: clamp(2.2rem, 11vw, 3.1rem);
    line-height: 1.02;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
  }

  .eyebrow {
    line-height: 1.45;
  }

  .metrics,
  .store-facts,
  .owner-agent-shell,
  .visitor-fields,
  .workspace,
  .owner-chat-form,
  .transcript-form {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .session-header {
    flex-direction: column;
    align-items: stretch;
  }

  .pill-row {
    flex-wrap: wrap;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}

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