:root {
  color-scheme: light;
  --bg: #F4F7FE;
  --bg2: #ECEFF7;
  --panel: rgba(252, 252, 252, 0.96);
  --panel-soft: rgba(240, 244, 255, 0.9);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --line: rgba(217, 223, 241, 0.9);
  --text: #2B3674;
  --muted: #707EAE;
  --accent: #4434DD;
  --accent-2: #4253F0;
  --good: #8CCA81;
  --warn: #FB7A7A;
  --bad: #F86565;
  --shadow: 0 14px 36px rgba(68, 52, 221, 0.08);
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  color: var(--text);
  background: #F4F7FE;
  font-family:
    "Geist", "Avenir Next", "SF Pro Display", "Segoe UI", sans-serif;
  font-weight: var(--fw-regular);
  letter-spacing: -0.01em;
}

h1,
h2,
h3 {
  margin: 0;
}

h1,
h2,
strong {
  font-weight: var(--fw-semibold);
}

.eyebrow,
.metric-label,
.tab-btn,
.pill,
.search span,
.project-label,
.sop-subtitle,
.nudge-category,
.nudge-meta,
.conversation-status,
.tag {
  font-weight: var(--fw-medium);
}

button,
input {
  font: inherit;
}

.bg-orb {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(54px);
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
}

.bg-orb-a {
  width: 300px;
  height: 300px;
  right: -100px;
  top: 20px;
  background: rgba(68, 52, 221, 0.12);
}

.bg-orb-b {
  width: 240px;
  height: 240px;
  left: -90px;
  bottom: 60px;
  background: rgba(151, 92, 215, 0.1);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1600px, calc(100vw - 20px));
  margin: 0 auto;
  height: 100vh;
  min-height: 0;
  padding: 10px 0 12px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.card {
  background: linear-gradient(
    180deg,
    rgba(252, 252, 252, 0.97),
    rgba(240, 244, 255, 0.93)
  );
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.topbar {
  border-radius: 18px;
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

.topbar-brand h1 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.64rem;
  color: var(--accent);
}

.tab-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(68, 52, 221, 0.04);
  border: 1px solid rgba(68, 52, 221, 0.1);
}

.tab-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.tab-btn:hover {
  transform: translateY(-1px);
  color: var(--text);
}

.tab-btn[data-active="true"] {
  background: linear-gradient(68.09deg, #4434DD 4.47%, #8076EE 74.96%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(68, 52, 221, 0.28);
}

.topbar-meta {
  display: grid;
  grid-auto-flow: column;
  justify-content: end;
  gap: 8px;
}

.theme-toggle {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.metric {
  min-width: 102px;
  padding: 7px 9px;
  border-radius: 14px;
  background: rgba(252, 252, 252, 0.9);
  border: 1px solid var(--line);
}

.metric-label {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric strong {
  font-size: 0.88rem;
}

.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-icon svg {
  width: 18px;
  height: 18px;
  color: var(--text);
}

.view-panel {
  min-height: 0;
  display: none;
}

.view-panel[data-active="true"] {
  display: grid;
}

#historyTabPanel {
  grid-template-columns: minmax(290px, 0.36fr) minmax(0, 0.64fr);
  grid-template-rows: 1fr;
  gap: 8px;
}

#liveTabPanel {
  grid-template-columns: minmax(210px, 0.18fr) minmax(0, 0.52fr) minmax(
      310px,
      0.29fr
    );
  grid-template-rows: 1fr;
  gap: 8px;
}

.pane {
  min-height: 0;
  border-radius: 18px;
  padding: 9px 11px 11px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.pane-head.compact h2 {
  font-size: 0.95rem;
  line-height: 1;
  margin-top: 1px;
}

.pane-stats {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ghost-button {
  border: 1px solid rgba(68, 52, 221, 0.22);
  background: rgba(68, 52, 221, 0.06);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.search {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.search span {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(252, 252, 252, 0.9);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}

.search input:focus {
  border-color: rgba(68, 52, 221, 0.35);
  box-shadow: 0 0 0 3px rgba(68, 52, 221, 0.06);
}

.conversation-list,
.nudge-list,
.sop-list {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  display: grid;
  gap: 8px;
}

.conversation-list {
  flex: 1 1 auto;
}

.nudge-list {
  flex: 1 1 auto;
}

/* .live-nudges .nudge-list — see full definition further down */

.conversation-item {
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(252, 252, 252, 0.85);
  border-radius: 14px;
  padding: 10px;
  color: inherit;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.conversation-item:hover {
  border-color: rgba(68, 52, 221, 0.2);
  box-shadow: 0 2px 8px rgba(68, 52, 221, 0.06);
}

.conversation-item[data-selected="true"] {
  border-color: rgba(68, 52, 221, 0.38);
  background: linear-gradient(
    180deg,
    rgba(68, 52, 221, 0.07),
    rgba(252, 252, 252, 0.94)
  );
  box-shadow: 0 2px 12px rgba(68, 52, 221, 0.1);
}

.conversation-item-top,
.conversation-stats,
.nudge-head,
.sop-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.conversation-id {
  font-size: 0.92rem;
}

.conversation-preview {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.nudge-card,
.sop-card {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(252, 252, 252, 0.9);
  padding: 10px 12px;
}

.nudge-card {
  --nudge-accent: #4434DD;
  border-color: rgba(68, 52, 221, 0.12);
  background:
    radial-gradient(
      circle at top right,
      rgba(68, 52, 221, 0.04),
      transparent 42%
    ),
    linear-gradient(
      180deg,
      rgba(252, 252, 252, 0.96),
      rgba(240, 244, 255, 0.92)
    );
  position: relative;
}

.nudge-card[data-state="draft"] {
  border-style: dashed;
  opacity: 0.98;
}

.nudge-card[data-rank="latest"] {
  box-shadow:
    0 20px 42px rgba(68, 52, 221, 0.1),
    0 0 0 1px rgba(68, 52, 221, 0.14);
}

.nudge-card[data-category="pricing"] {
  --nudge-accent: #4434DD;
  border-color: rgba(68, 52, 221, 0.14);
}

.nudge-card[data-category="location"] {
  --nudge-accent: #4253F0;
  border-color: rgba(66, 83, 240, 0.14);
}

.nudge-card[data-category="payment_plan"] {
  --nudge-accent: #5a9a50;
  border-color: rgba(90, 154, 80, 0.14);
}

.nudge-card[data-category="brochure"] {
  --nudge-accent: #8076EE;
  border-color: rgba(128, 118, 238, 0.14);
}

.nudge-card[data-category="floor_plans"] {
  --nudge-accent: #975CD7;
  border-color: rgba(151, 92, 215, 0.14);
}

.nudge-card[data-category="objection_handling"] {
  --nudge-accent: #F86565;
  border-color: rgba(248, 101, 101, 0.14);
}

.nudge-card[data-category="streaming"],
.nudge-card[data-category="general"] {
  --nudge-accent: #707EAE;
  border-color: rgba(112, 126, 174, 0.14);
}

.nudge-heading {
  font-size: 1rem;
  line-height: 1.2;
  color: var(--nudge-heading-color, #2B3674);
  text-decoration: none;
  font-weight: var(--fw-semibold);
}

.sop-title {
  font-size: 0.94rem;
  line-height: 1.2;
}

.nudge-category,
.sop-weight,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(68, 52, 221, 0.06);
  color: var(--text);
}

.nudge-card .nudge-category {
  background: transparent;
  border: 1px solid var(--nudge-accent);
  color: var(--nudge-accent);
}

.nudge-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 2px 6px;
}

.nudge-divider::before,
.nudge-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1 1 auto;
}

.nudge-featured {
  flex: 0 0 auto;
}

.nudge-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding-right: 2px;
  overflow-anchor: none;
}

.live-nudges .nudge-divider {
  margin: 6px 4px 2px;
  opacity: 0.7;
}

.detail-meta {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.detail-meta .action-strip {
  width: 100%;
  align-self: stretch;
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
  gap: 6px;
  padding-top: 8px;
}

.wa-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(252, 252, 252, 0.9);
}

.wa-btn {
  width: 36px;
  height: 32px;
  border-radius: 12px;
  border: 1px solid rgba(68, 52, 221, 0.18);
  background: rgba(68, 52, 221, 0.05);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.wa-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(68, 52, 221, 0.35);
  background: rgba(68, 52, 221, 0.08);
}

.wa-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.wa-btn[data-hot="true"] {
  border-color: rgba(140, 202, 129, 0.6);
  background: rgba(140, 202, 129, 0.14);
  box-shadow:
    0 0 0 2px rgba(140, 202, 129, 0.16),
    0 10px 30px rgba(140, 202, 129, 0.12);
  animation: waPulse 1.25s ease-in-out infinite;
}

.wa-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(37, 211, 102, 0.08);
  border: 1px solid rgba(37, 211, 102, 0.24);
  color: #1a7a3c;
  white-space: nowrap;
}

.wa-pill svg {
  width: 24px;
  height: 24px;
  display: block;
  flex: 0 0 auto;
}

.wa-pill-text {
  line-height: 1;
  color: var(--text);
}

.wa-pill[data-kind="sent"] {
  border-color: rgba(140, 202, 129, 0.45);
  background: rgba(140, 202, 129, 0.1);
}

.wa-pill[data-kind="error"] {
  border-color: rgba(248, 101, 101, 0.36);
  background: rgba(248, 101, 101, 0.08);
}

@keyframes waPulse {
  0% {
    box-shadow: 0 0 0 2px rgba(140, 202, 129, 0.12);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(140, 202, 129, 0.08);
  }
  100% {
    box-shadow: 0 0 0 2px rgba(140, 202, 129, 0.12);
  }
}

.detail {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.nudges-panel {
  padding: 16px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.detail-header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  min-height: 0;
  flex: 1 1 auto;
}

.timeline-wrap,
.nudge-wrap {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

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

.timeline,
.nudge-list {
  display: grid;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 10px;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(68, 52, 221, 0.08);
}

.timeline-body {
  border: 1px solid var(--line);
  background: rgba(252, 252, 252, 0.9);
  border-radius: 18px;
  padding: 14px;
}

.timeline-type {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
}

.timeline-time {
  font-size: 0.8rem;
}

.timeline-text {
  margin-top: 10px;
  font-size: 0.96rem;
  line-height: 1.55;
}

.timeline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(68, 52, 221, 0.06);
  color: var(--muted);
  font-size: 0.75rem;
}

.nudge-points {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  font-size: small;
}

.nudge-points li {
  line-height: 1.45;
  color: var(--text);
  overflow-wrap: anywhere;
}

.nudge-points strong {
  color: var(--nudge-accent, #4434DD);
}

.nudge-points li::marker {
  color: var(--accent-2);
}

/* ── Conversation flag verbatim box ── */
.nudge-verbatim {
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nudge-verbatim-label {
  font-size: 0.62rem;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--nudge-accent, #4434DD);
  opacity: 0.75;
}

.nudge-verbatim-text {
  display: block;
  padding: 10px 13px;
  border-radius: 10px;
  border-left: 3px solid var(--nudge-accent, #4434DD);
  background: rgba(68, 52, 221, 0.05);
  font-size: 0.9rem;
  font-weight: var(--fw-medium);
  line-height: 1.5;
  color: var(--text);
  overflow-wrap: anywhere;
}

.nudge-verbatim-pending {
  opacity: 0.45;
  font-style: italic;
}

/* ── Conversation flag card variant — identical look to .flag-slot ── */
.nudge-card[data-flag="true"] {
  border-radius: 12px;
  border: 1.5px solid rgba(248, 101, 101, 0.35) !important;
  background: linear-gradient(150deg, rgba(248, 101, 101, 0.08) 0%, rgba(255, 248, 248, 0.96) 100%) !important;
  box-shadow: 0 3px 14px rgba(248, 101, 101, 0.1) !important;
}

.nudge-point-pending {
  opacity: 0.4;
  letter-spacing: 0.1em;
}

/* Live streaming point — currently being typed by the LLM */
.nudge-point-streaming {
  opacity: 0.85;
}

/* Blinking cursor shown while LLM is still generating text */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 0.9em;
  background: currentColor;
  border-radius: 1px;
  margin-left: 2px;
  vertical-align: text-bottom;
  opacity: 0.7;
  animation: streaming-blink 0.65s step-end infinite;
}
@keyframes streaming-blink {
  0%, 100% { opacity: 0.7; }
  50%       { opacity: 0;   }
}

.nudge-meta {
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.empty-state {
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: rgba(240, 244, 255, 0.5);
  color: var(--muted);
  font-size: 0.84rem;
}

.sop-list {
  gap: 7px;
}

.sop-card {
  display: grid;
  gap: 7px;
}

.sop-card[data-state="active"] {
  position: sticky;
  top: 0;
  z-index: 1;
}

.sop-card[data-parameter="opening"] {
  --sop-accent: #4253F0;
}

.sop-card[data-parameter="product_pitch"] {
  --sop-accent: #4434DD;
}

.sop-card[data-parameter="objection_handling"] {
  --sop-accent: #F86565;
}

.sop-card[data-parameter="soft_skills"] {
  --sop-accent: #5a9a50;
}

.sop-card[data-parameter="closing_summary"] {
  --sop-accent: #975CD7;
}

.sop-main-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sop-check {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(112, 126, 174, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  flex: 0 0 auto;
}

.sop-card[data-state="done"] .sop-check,
.sop-card[data-state="active"] .sop-check {
  background: rgba(140, 202, 129, 0.14);
  border-color: rgba(140, 202, 129, 0.5);
  color: #5a9a50;
}

.sop-card[data-state="done"] .sop-check::after,
.sop-card[data-state="active"] .sop-check::after {
  content: "✓";
  font-size: 0.68rem;
  line-height: 1;
  color: #5a9a50;
}

.sop-card[data-state="locked"] {
  opacity: 0.74;
}

.sop-card[data-state="active"] {
  border-color: rgba(68, 52, 221, 0.18);
  box-shadow:
    inset 3px 0 0 var(--sop-accent, rgba(68, 52, 221, 0.4)),
    inset 0 0 0 1px rgba(68, 52, 221, 0.04);
}

.sop-card[data-state="active"] .sop-title {
  color: var(--sop-accent, #2B3674);
}

.sop-subtitle {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.sop-subpoints {
  margin: 0;
  padding: 0 0 0 4px;
  list-style: none;
  display: none;
  gap: 5px;
}

.sop-card[data-state="active"] .sop-subpoints,
.sop-card[data-state="done"] .sop-subpoints {
  display: grid;
}

.sop-subpoints li {
  line-height: 1.35;
  font-size: 0.78rem;
  color: var(--text);
}

.sop-subpoints strong {
  color: var(--sop-accent, #4434DD);
}

.details-pane {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  padding-right: 4px;
}

.project-card {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(252, 252, 252, 0.9);
  padding: 10px 12px;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.project-card {
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.customer-grid div {
  display: grid;
  gap: 3px;
}

.customer-grid dt {
  font-size: 0.68rem;
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.customer-grid dd {
  margin: 0;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

/* WhatsApp section redesign */
.wa-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wa-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.wa-section-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.wa-section-title {
  font-size: 0.82rem;
  font-weight: var(--fw-semibold);
  color: var(--text);
  letter-spacing: -0.01em;
  flex: 1 1 auto;
}

#waSendState[data-kind="sent"] {
  color: #1a7a3c;
}

#waSendState[data-kind="error"] {
  color: var(--bad);
}

.wa-actions-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.wa-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px 7px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(252, 252, 252, 0.95);
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

.wa-action-btn:hover {
  border-color: rgba(37, 211, 102, 0.35);
  background: rgba(37, 211, 102, 0.05);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 211, 102, 0.1);
}

.wa-action-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.wa-action-btn[data-hot="true"] {
  border-color: rgba(37, 211, 102, 0.55);
  background: rgba(37, 211, 102, 0.1);
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.14), 0 8px 20px rgba(37, 211, 102, 0.1);
  animation: waPulse 1.25s ease-in-out infinite;
}

.wa-action-btn[data-hot="true"]:hover {
  background: rgba(37, 211, 102, 0.16);
  border-color: rgba(37, 211, 102, 0.72);
}

.wa-action-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: block;
}

.wa-action-label {
  font-size: 0.6rem;
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  line-height: 1;
  text-align: center;
}


.action-strip {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(92px, 1.15fr) repeat(4, minmax(0, 0.92fr));
  gap: 8px;
  align-items: stretch;
}

.action-chip {
  border: 1px solid var(--line);
  background: rgba(252, 252, 252, 0.95);
  color: var(--text);
  border-radius: 12px;
  min-height: 52px;
  min-width: 0;
  flex: 1 1 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 5px 5px;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  position: relative;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.action-chip:hover:not(.action-whatsapp) {
  border-color: rgba(68, 52, 221, 0.2);
  background: rgba(240, 244, 255, 0.98);
  transform: translateY(-1px);
}

.action-chip[data-hot="true"] {
  border-color: rgba(140, 202, 129, 0.55);
  background: rgba(140, 202, 129, 0.12);
  box-shadow:
    0 0 0 2px rgba(140, 202, 129, 0.12),
    0 10px 24px rgba(140, 202, 129, 0.1);
  transform: translateY(-1px);
}

.action-chip[data-hot="true"]:hover {
  background: rgba(140, 202, 129, 0.18);
  border-color: rgba(140, 202, 129, 0.72);
}

.action-chip svg {
  width: 24px;
  height: 24px;
  display: block;
  margin: 0 auto;
  fill: currentColor;
}

.action-chip::after {
  content: attr(data-label);
  display: block;
  font-size: 0.52rem;
  line-height: 1;
  color: inherit;
  opacity: 0.9;
}

.action-chip[data-category="location"] {
  color: #4253F0;
}

.action-chip[data-category="payment_plan"] {
  color: #5a9a50;
}

.action-chip[data-category="brochure"] {
  color: #8076EE;
}

.action-chip[data-category="floor_plans"] {
  color: #975CD7;
}

.action-whatsapp {
  color: #25d366;
  background: transparent;
  border-color: transparent;
  cursor: default;
  width: auto;
  min-width: 0;
  flex: 0 0 auto;
  padding: 0;
  box-shadow: none;
  min-height: 46px;
  flex-direction: row;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
}

.action-whatsapp svg {
  width: 30px;
  height: 30px;
}

.action-whatsapp::after {
  content: "";
}

.project-table-wrap {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  max-height: 100%;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  padding-right: 2px;
}

.project-table {
  width: 100%;
  border-collapse: collapse;
}

.project-table-wrap[data-topic="location"] {
  --project-accent: #4253F0;
}

.project-table-wrap[data-topic="pricing"] {
  --project-accent: #4434DD;
}

.project-table-wrap[data-topic="payment"] {
  --project-accent: #5a9a50;
}

.project-table-wrap[data-topic="amenities"] {
  --project-accent: #8076EE;
}

.project-table-wrap[data-topic="configuration"] {
  --project-accent: #975CD7;
}

.project-table-wrap[data-topic="possession"] {
  --project-accent: #F86565;
}

.project-table-wrap[data-topic="brand"] {
  --project-accent: #4434DD;
}

.project-table-wrap[data-topic="overview"] {
  --project-accent: #707EAE;
}

#customerTopic[data-topic="location"],
#projectFocus[data-topic="location"] {
  border-color: rgba(66, 83, 240, 0.18);
  color: #4253F0;
}

#customerTopic[data-topic="pricing"],
#projectFocus[data-topic="pricing"] {
  border-color: rgba(68, 52, 221, 0.18);
  color: #4434DD;
}

#customerTopic[data-topic="payment"],
#projectFocus[data-topic="payment"] {
  border-color: rgba(90, 154, 80, 0.18);
  color: #5a9a50;
}

.project-row {
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.project-row th,
.project-row td {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  vertical-align: top;
  text-align: left;
  transition: padding 0.4s ease, color 0.4s ease, font-size 0.4s ease, font-weight 0.4s ease;
}

.project-label {
  width: 30%;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-right: 12px;
}

.project-value {
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* .project-row[data-active] styles defined further down (more prominent version) */

.status-live {
  color: #5a9a50;
}

.status-idle {
  color: var(--muted);
}

.status-warn {
  color: var(--warn);
}

/* ─── Sentiment display ─────────────────────────────────────────── */
.sentiment-display {
  font-size: 0.9rem;
}
.sentiment-positive { color: #3a9a50; }
.sentiment-neutral  { color: var(--muted); }
.sentiment-negative { color: #d94f4f; }

.metric-mood {
  display: block;
  font-size: 0.66rem;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* ─── Customer profile expand button ────────────────────────────── */
.customer-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(252,252,252,0.9);
  color: var(--muted);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.customer-expand-btn:hover {
  background: rgba(68,52,221,0.06);
  border-color: rgba(68,52,221,0.2);
  color: var(--accent);
}

.customer-expand-btn svg {
  transition: transform 220ms ease;
}

.customer-expand-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.customer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px 10px;
  margin: 0;
  padding-top: 2px;
}

.customer-grid[hidden] {
  display: none;
}

/* ─── Project detail — more prominent active row ────────────────── */
.project-row[data-active="true"] {
  background: rgba(68, 52, 221, 0.07);
  box-shadow: inset 4px 0 0 var(--project-accent, #4434DD);
}

.project-row[data-active="true"] th,
.project-row[data-active="true"] td {
  padding-left: 14px;
  padding-top: 14px;
  padding-bottom: 14px;
  background: transparent;
}

.project-row[data-active="true"] .project-label {
  color: var(--project-accent, #4434DD);
  font-weight: var(--fw-semibold);
  font-size: 0.76rem;
  /* padding-left inherited from the th,td rule (14px) — clears the 4px inset border */
}

.project-row[data-active="true"] .project-value {
  color: #1a1f5e;
  font-weight: var(--fw-semibold);
  font-size: 0.9rem;
}

/* ─── Conversation flag slot — fixed "Say This" lane above nudge feed ─── */
/* Container holds one or more stacked Say-This cards, newest on top */
.flag-slot-container {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.flag-slot-container:empty {
  display: none;
  margin-bottom: 0;
}

.flag-slot {
  border-radius: 12px;
  border: 1.5px solid rgba(248, 101, 101, 0.35);
  background: linear-gradient(150deg, rgba(248, 101, 101, 0.08) 0%, rgba(255, 248, 248, 0.96) 100%);
  box-shadow: 0 3px 14px rgba(248, 101, 101, 0.1);
  overflow: hidden;
  animation: flagSlide 180ms ease-out;
}

@keyframes flagSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.flag-slot-inner {
  padding: 10px 14px 11px;
}

.flag-slot-label {
  display: block;
  font-size: 0.6rem;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #c0392b;
  margin-bottom: 5px;
}

.flag-slot-text {
  margin: 0;
  font-size: 1.05rem;
  font-weight: var(--fw-medium);
  line-height: 1.65;
  color: var(--text);
  overflow-wrap: anywhere;
}

.flag-slot-bar {
  height: 3px;
  background: rgba(248, 101, 101, 0.65);
  transform-origin: left center;
}

/* ─── Live nudge list — single scrollable feed, no fixed zones ─── */
.live-nudges .nudge-list {
  display: grid;
  align-content: start;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ─── Latest nudge card — dominant, immediate focus ────────────── */
.nudge-card[data-rank="latest"] {
  border: 1.5px solid rgba(68, 52, 221, 0.32);
  background: linear-gradient(150deg, rgba(68,52,221,0.07) 0%, rgba(236,241,255,0.85) 100%);
  box-shadow: 0 3px 18px rgba(68,52,221,0.11);
  border-radius: 16px;
}

.nudge-card[data-rank="latest"] .nudge-heading {
  font-size: 1.18rem;
  letter-spacing: -0.03em;
  color: #1e1a6e;
}

.nudge-card[data-rank="latest"] .nudge-points li {
  font-size: 1.02rem;
  line-height: 1.65;
  padding: 2px 0;
}

.nudge-card[data-rank="latest"] .nudge-verbatim-text {
  font-size: 1.05rem;
  line-height: 1.65;
}

.nudge-card[data-rank="latest"] .nudge-category {
  font-size: 0.68rem;
}

/* Flag nudges in the feed — keep font smaller even when latest, no inner box */
.nudge-card[data-flag="true"][data-rank="latest"] .nudge-verbatim-text {
  font-size: 0.93rem;
  line-height: 1.65;
  border-left: none !important;
  background: transparent !important;
  padding: 0 !important;
}

/* No heading, category pill, or meta — identical layout to the flag slot */
.nudge-card[data-flag="true"] .nudge-head,
.nudge-card[data-flag="true"] .nudge-meta {
  display: none;
}

.nudge-card[data-flag="true"] .nudge-verbatim-label {
  display: block;
  font-size: 0.6rem;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #c0392b;
  margin-bottom: 5px;
}

.nudge-card[data-flag="true"] .nudge-verbatim-text {
  /* strip the inner box — no border-left bar, no blue background */
  border-left: none !important;
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  /* match flag-slot-text */
  font-size: 0.93rem;
  font-weight: var(--fw-medium);
  line-height: 1.65;
  color: var(--text);
}

@media (max-width: 1280px) {
  .shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  body {
    overflow: auto;
    height: auto;
  }

  .topbar {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .topbar-meta {
    justify-content: start;
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #historyTabPanel,
  #liveTabPanel {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 860px) and (min-width: 1281px) {
  .shell {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .pane {
    padding: 8px 10px 10px;
  }

  .topbar {
    padding: 8px 12px;
  }

  .topbar-brand h1 {
    font-size: 0.98rem;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 14px, 1600px);
    padding-top: 6px;
  }

  .tab-switcher {
    width: 100%;
  }

  .tab-btn {
    flex: 1 1 0;
  }

  .customer-grid {
    grid-template-columns: 1fr;
  }

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

  .pane-head {
    flex-direction: column;
    align-items: start;
  }
}
