:root {
  --ink: #0b0b08;
  --ink-2: #15140f;
  --panel: #f1eee4;
  --panel-2: #e4dfd0;
  --line: rgba(11, 11, 8, 0.16);
  --text: #171611;
  --muted: #6f6a5d;
  --acid: #c8ff45;
  --teal: #35b9a8;
  --coral: #ff684f;
  --violet: #9c7cff;
  --white: #fffdf4;
  --shadow: 0 24px 70px rgba(11, 11, 8, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    var(--ink);
  background-size: 34px 34px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar,
.workbench,
.lower-grid {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 88px;
  padding: 16px;
  border: 1px solid rgba(255, 253, 244, 0.14);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.brand-block,
.top-actions,
.status-strip,
.tile-label,
.coach-band,
.section-title,
.phase-switch,
.micro-actions,
.guardrail-list {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--ink);
  color: var(--acid);
  font-weight: 900;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4.8vw, 4.9rem);
  line-height: 0.86;
  letter-spacing: 0;
}

h2 {
  font-size: 1.05rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.top-actions {
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.consent-check,
.input-grid label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 760;
}

.primary-btn,
.icon-btn,
.phase-btn,
.micro-actions button {
  min-height: 42px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  font-weight: 850;
}

.primary-btn {
  padding: 0 18px;
  color: var(--ink);
  background: var(--acid);
}

.icon-btn {
  width: 44px;
  display: grid;
  place-items: center;
  background: var(--white);
}

.icon {
  display: block;
  position: relative;
}

.camera-icon {
  width: 21px;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 4px;
}

.camera-icon::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 2px;
  width: 6px;
  height: 8px;
  background: var(--ink);
  clip-path: polygon(0 18%, 100% 0, 100% 100%, 0 82%);
}

.workbench {
  grid-template-columns: minmax(0, 1fr) 390px;
  align-items: start;
}

.call-stage,
.insight-panel,
.timeline-panel,
.script-panel,
.guardrail-panel {
  border: 1px solid rgba(255, 253, 244, 0.14);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.call-stage {
  padding: 14px;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.status-strip {
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.status-pill.live {
  color: var(--ink);
  background: var(--acid);
  border-color: var(--ink);
}

.status-pill.local {
  color: var(--ink);
  background: rgba(53, 185, 168, 0.18);
}

.status-pill.heart {
  color: var(--ink);
  background: rgba(255, 104, 79, 0.18);
  border-color: rgba(255, 104, 79, 0.42);
}

.status-pill.hidden {
  display: none;
}

.video-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
}

.video-tile,
.mini-tile,
.stage-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 253, 244, 0.18);
  border-radius: 8px;
  background: var(--ink-2);
  color: var(--white);
}

.prospect-tile {
  min-height: 570px;
}

.seller-rail {
  display: grid;
  grid-template-rows: 250px auto;
  gap: 12px;
}

.seller-tile {
  min-height: 250px;
}

#cameraVideo,
.synthetic-face,
#signalCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#cameraVideo {
  object-fit: cover;
  opacity: 0;
  transform: scaleX(-1);
  transition: opacity 0.25s ease;
}

#cameraVideo.active {
  opacity: 0.86;
}

.synthetic-face {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(200, 255, 69, 0.08), transparent 34%),
    repeating-linear-gradient(0deg, rgba(255, 253, 244, 0.055) 0 1px, transparent 1px 14px),
    var(--ink-2);
  transition: opacity 0.25s ease;
}

.synthetic-face.hidden {
  opacity: 0;
}

.face-silhouette {
  position: relative;
  width: min(34vw, 280px);
  aspect-ratio: 0.78;
  border-radius: 48% 48% 42% 42%;
  background:
    linear-gradient(150deg, #d9aa82 0%, #9d6654 62%, #4d3132 100%);
  box-shadow: 0 38px 110px rgba(0, 0, 0, 0.45);
}

.brow,
.eye,
.nose,
.mouth {
  position: absolute;
  display: block;
  background: #19110e;
}

.brow {
  top: 33%;
  width: 18%;
  height: 3%;
  border-radius: 999px;
}

.brow-left {
  left: 26%;
  transform: rotate(5deg);
}

.brow-right {
  right: 26%;
  transform: rotate(-5deg);
}

.eye {
  top: 40%;
  width: 13%;
  height: 5%;
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(200, 255, 69, 0.22);
}

.eye-left {
  left: 30%;
}

.eye-right {
  right: 30%;
}

.nose {
  left: 48%;
  top: 46%;
  width: 5%;
  height: 14%;
  border-radius: 999px;
  opacity: 0.42;
}

.mouth {
  left: 35%;
  bottom: 26%;
  width: 30%;
  height: 4%;
  border-radius: 0 0 999px 999px;
}

.face-target {
  position: absolute;
  left: 31%;
  top: 13%;
  width: 38%;
  height: 61%;
  border: 1px solid rgba(200, 255, 69, 0.48);
  border-radius: 8px;
  box-shadow: 0 0 32px rgba(200, 255, 69, 0.12);
}

.face-target span {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: var(--acid);
}

.face-target span:nth-child(1) {
  left: -1px;
  top: -1px;
  border-left: 3px solid;
  border-top: 3px solid;
}

.face-target span:nth-child(2) {
  right: -1px;
  top: -1px;
  border-right: 3px solid;
  border-top: 3px solid;
}

.face-target span:nth-child(3) {
  left: -1px;
  bottom: -1px;
  border-left: 3px solid;
  border-bottom: 3px solid;
}

.face-target span:nth-child(4) {
  right: -1px;
  bottom: -1px;
  border-right: 3px solid;
  border-bottom: 3px solid;
}

.cue-chip {
  position: absolute;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid rgba(255, 253, 244, 0.24);
  border-radius: 8px;
  background: rgba(11, 11, 8, 0.74);
  color: var(--white);
  font-size: 0.78rem;
  font-weight: 850;
  backdrop-filter: blur(12px);
}

.cue-attention {
  left: 8%;
  top: 18%;
  color: var(--acid);
}

.cue-salience {
  right: 8%;
  top: 31%;
  color: var(--teal);
}

.cue-risk {
  left: 12%;
  bottom: 24%;
  color: var(--coral);
}

.heartbeat-overlay {
  position: absolute;
  right: 18px;
  bottom: 72px;
  width: min(280px, calc(100% - 36px));
  padding: 12px;
  border: 1px solid rgba(255, 104, 79, 0.48);
  border-radius: 8px;
  background: rgba(11, 11, 8, 0.76);
  color: var(--white);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 44px rgba(255, 104, 79, 0.16);
  z-index: 4;
}

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

.heartbeat-head span,
.heartbeat-cue {
  color: rgba(255, 253, 244, 0.66);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.heartbeat-head strong {
  color: var(--coral);
  font-size: 1.2rem;
}

.heartbeat-wave {
  width: 100%;
  height: 44px;
  display: block;
  overflow: visible;
}

.heartbeat-wave polyline {
  fill: none;
  stroke: var(--coral);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 290;
  stroke-dashoffset: 290;
  filter: drop-shadow(0 0 10px rgba(255, 104, 79, 0.65));
  animation: heartbeatTrace 1.25s linear infinite;
}

.heartbeat-cue {
  display: block;
  margin-top: 2px;
}

@keyframes heartbeatTrace {
  0% {
    stroke-dashoffset: 290;
    opacity: 0.35;
  }
  35% {
    opacity: 1;
  }
  70%,
  100% {
    stroke-dashoffset: 0;
    opacity: 0.76;
  }
}

#signalCanvas {
  pointer-events: none;
  opacity: 0.88;
}

.tile-label {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 253, 244, 0.18);
  border-radius: 8px;
  background: rgba(11, 11, 8, 0.72);
  backdrop-filter: blur(12px);
}

.tile-label span,
.tile-label strong {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tile-label strong {
  text-align: right;
  color: var(--acid);
}

.seller-avatar {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--ink);
  background:
    repeating-linear-gradient(135deg, rgba(255, 253, 244, 0.08) 0 1px, transparent 1px 12px),
    var(--teal);
  font-size: 2rem;
  font-weight: 950;
}

.stage-card {
  padding: 14px;
  background: var(--ink);
}

.phase-switch {
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
}

.phase-btn {
  width: 100%;
  color: var(--white);
  background: rgba(255, 253, 244, 0.07);
  border-color: rgba(255, 253, 244, 0.2);
}

.phase-btn.active {
  color: var(--ink);
  background: var(--acid);
  border-color: var(--acid);
}

.coach-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.coach-band article {
  min-height: 106px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.coach-band span,
.metric-label,
.script-stack strong,
.guardrail-list span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.coach-band strong {
  display: block;
  margin-top: 8px;
  font-size: 1.02rem;
  line-height: 1.28;
}

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

.panel-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.section-title {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.metric-list {
  display: grid;
  gap: 14px;
}

.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.metric-head strong {
  font-size: 1.2rem;
}

.metric-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-2);
}

.metric-bar span {
  display: block;
  width: 50%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--acid));
  transition: width 0.45s ease;
}

.metric-bar.risk span,
.metric-bar.load span {
  background: linear-gradient(90deg, var(--coral), var(--violet));
}

.coach-panel {
  background: var(--ink);
  color: var(--white);
}

blockquote {
  margin: 0 0 14px;
  padding: 0;
  font-size: 1.08rem;
  line-height: 1.34;
  font-weight: 760;
}

.micro-actions {
  gap: 8px;
  flex-wrap: wrap;
}

.micro-actions button {
  min-height: 36px;
  padding: 0 10px;
  color: var(--white);
  border-color: rgba(255, 253, 244, 0.22);
  background: rgba(255, 253, 244, 0.08);
  font-size: 0.78rem;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
}

.lower-grid {
  grid-template-columns: 1.2fr 1fr 0.8fr;
  margin-top: 16px;
}

.timeline-panel,
.script-panel,
.guardrail-panel {
  padding: 14px;
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.timeline-item time {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.timeline-item strong {
  font-size: 0.9rem;
}

.timeline-item span:last-child {
  min-width: 76px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.timeline-item.hot span:last-child {
  color: var(--ink);
  background: rgba(255, 104, 79, 0.24);
}

.timeline-item.warm span:last-child {
  color: var(--ink);
  background: rgba(200, 255, 69, 0.34);
}

.timeline-item.cool span:last-child {
  color: var(--ink);
  background: rgba(53, 185, 168, 0.22);
}

.script-stack {
  display: grid;
  gap: 10px;
}

.script-stack p {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  line-height: 1.38;
}

.script-stack strong {
  margin-bottom: 4px;
}

.guardrail-list {
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
}

.guardrail-list span {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
}

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

  .insight-panel {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .topbar,
  .video-grid,
  .coach-band,
  .insight-panel {
    grid-template-columns: 1fr;
  }

  .stage-header {
    flex-direction: column;
  }

  .prospect-tile {
    min-height: 480px;
  }

  .seller-rail {
    grid-template-rows: 170px auto;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 10px;
  }

  .top-actions,
  .status-strip {
    justify-content: flex-start;
  }

  .topbar {
    padding: 12px;
  }

  h1 {
    font-size: 2.3rem;
  }

  .prospect-tile {
    min-height: 420px;
  }

  .face-target {
    left: 22%;
    width: 56%;
  }

  .cue-chip {
    font-size: 0.72rem;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}
