@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --primary: #1d4ed8;
  --primary-ink: #ffffff;
  --accent: #1e40af;
  --success: #1d4ed8;
  --warning: #ea580c;
  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  --radius: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: #f8fafc;
  min-height: 100%;
}

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

.page {
  width: min(1120px, 92%);
  margin: 24px auto 48px;
}

.topbar {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
  background: #f8fafc;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(160deg, #1d4ed8 0%, #1745c1 100%);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
  overflow: hidden;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.title-wrap h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-family: "Fraunces", serif;
}

.title-wrap p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.hero {
  margin-top: 20px;
  padding: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(115deg, #ffffff 0%, #f8fafc 60%);
  box-shadow: var(--shadow);
}

.hero h2 {
  margin: 0 0 10px;
  font-size: 30px;
}

.hero p {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.55;
}

.fan-hero {
  background: linear-gradient(135deg, #f1f5f9 0%, #ffffff 55%, #f8fafc 100%);
}

.grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0;
  font-size: 17px;
}

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

.card-body {
  padding: 16px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--primary);
  color: var(--primary-ink);
}

.button-secondary {
  background: #f1f5f9;
  color: var(--ink);
  border: 1px solid var(--border);
}

.button-outline {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  font: inherit;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

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

.kpi {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 12px;
}

.kpi .label {
  font-size: 12px;
  color: var(--muted);
}

.kpi .value {
  margin-top: 6px;
  font-size: 23px;
  font-weight: 700;
}

.section-stack {
  display: grid;
  gap: 16px;
}

.list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.feed-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.feed-item:last-child {
  border-bottom: 0;
}

.feed-focus {
  background: #eff6ff;
  border-left: 3px solid #1d4ed8;
  padding-left: 10px;
}

.feed-time {
  color: var(--muted);
  font-size: 12px;
}

.feed-msg {
  margin-top: 3px;
  font-size: 14px;
}

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

.table th,
.table td {
  text-align: left;
  font-size: 13px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--muted);
  font-weight: 600;
}

.table tr[data-clickable="true"] {
  cursor: pointer;
}

.table tr[data-clickable="true"]:hover {
  background: #f8fafc;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
}

.pill-consent-yes {
  background: #eff6ff;
  color: #1d4ed8;
}

.pill-consent-no {
  background: #fef2f2;
  color: #b91c1c;
}

.pill-live {
  background: #eff6ff;
  color: #1e3a8a;
}

.pill-seed {
  background: #ede9f7;
  color: #55418f;
}

.pill-money {
  background: #eff6ff;
  color: #1d4ed8;
}

.pill-pipeline {
  background: #fdeecf;
  color: #7a4d02;
}

.info-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.info-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px;
}

.info-box dt {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-box dd {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 600;
}

.context-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.context-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
}

.fan-signal {
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  padding: 10px 14px;
}

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

.fan-signal-head span {
  display: inline-flex;
  min-width: 34px;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #0f5667;
  color: #f6fcff;
  font-size: 12px;
  font-weight: 700;
}

.fan-signal p {
  margin: 6px 0 0;
  font-size: 12px;
  color: #6a5945;
}

.chat-shell {
  max-width: 460px;
  margin: 20px auto 0;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.fan-shell {
  max-width: 560px;
}

.fan-mobile-page {
  width: min(460px, 100%);
  margin: 10px auto 22px;
  padding: 0 8px;
}

.fan-mobile-page .topbar {
  padding: 10px 12px;
}

.fan-mobile-page .title-wrap h1 {
  font-size: 18px;
}

.fan-mobile-page .hero {
  margin-top: 10px;
  padding: 14px;
}

.fan-mobile-shell {
  margin-top: 12px;
}

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

.chat-head strong {
  font-size: 15px;
}

.chat-mode {
  font-size: 12px;
  color: var(--muted);
}

.journey-progress {
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
  background: #f8f1e2;
}

.journey-track {
  height: 8px;
  border-radius: 999px;
  background: #e8deca;
  overflow: hidden;
}

.journey-fill {
  height: 100%;
  width: 0%;
  transition: width 220ms ease;
  background: linear-gradient(90deg, #b20f2b 0%, #e05b3f 100%);
}

.journey-pills {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.journey-pill {
  font-size: 11px;
  color: #8d7960;
  text-align: center;
  border: 1px solid #e5dac5;
  border-radius: 999px;
  padding: 4px 6px;
  background: #fff8e9;
}

.journey-pill.is-active {
  color: #fff7f0;
  border-color: #b20f2b;
  background: #b20f2b;
}

.journey-pill.is-done {
  color: #155a44;
  border-color: #b9e5d2;
  background: #e3f8ee;
}

.scene-card {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.scene-card h3 {
  margin: 0;
  font-size: 18px;
}

.scene-card p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.scene-highlight {
  margin-top: 10px;
}

.scene-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.offer-mini {
  border: 1px solid #ead9b9;
  background: #fff9eb;
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  color: #5a4733;
}

.offer-feature {
  border: 1px solid #ebc9a2;
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #fff4de 0%, #ffe7c5 100%);
  display: grid;
  gap: 4px;
}

.offer-feature strong {
  font-size: 15px;
}

.offer-feature span {
  font-size: 20px;
  font-weight: 800;
  color: #8e1730;
}

.offer-feature small {
  color: #6f5a41;
}

.chat-screen {
  min-height: 410px;
  max-height: 58vh;
  overflow-y: auto;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.msg {
  max-width: 88%;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.4;
}

.msg-bot {
  justify-self: start;
  background: #f1f5f9;
  color: #0f172a;
}

.msg-user {
  justify-self: end;
  background: #1d4ed8;
  color: #ffffff;
}

.chat-actions {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.option-grid {
  display: grid;
  gap: 8px;
}

.option-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
}

.option-btn:hover {
  background: #faf4e7;
}

.option-btn small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 500;
}

.inline-note {
  color: var(--muted);
  font-size: 13px;
}

.auth-grid {
  display: grid;
  gap: 10px;
}

.auth-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
}

.auth-btn:hover {
  background: #faf4e7;
}

.metric-bars {
  display: grid;
  gap: 9px;
}

.metric-row {
  display: grid;
  grid-template-columns: 120px 1fr 44px;
  gap: 8px;
  align-items: center;
}

.metric-track {
  height: 10px;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1d4ed8 0%, #60a5fa 100%);
}

.segment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.segment {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px;
}

.segment strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.qr-box {
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: #fff;
}

.qr-box img {
  width: 220px;
  height: 220px;
  background: #fff;
}

.footer-note {
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.sequence-row {
  display: grid;
  gap: 8px;
}

.sequence-step {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 10px;
  font-size: 14px;
}

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

.admin-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-kpi {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px;
}

.admin-kpi .label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-kpi .value {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  line-height: 1;
}

#admin-sla-risk[data-risk="low"] {
  color: #1d4ed8;
}

#admin-sla-risk[data-risk="medium"] {
  color: #d97706;
}

#admin-sla-risk[data-risk="high"] {
  color: #dc2626;
}

.admin-control-grid {
  display: grid;
  gap: 8px;
}

.admin-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-incident-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px;
}

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

.admin-incident-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.admin-incident-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 4px;
}

.admin-incident-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.incident-sev {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.incident-sev-high {
  background: rgba(234, 88, 12, 0.1);
  color: #ea580c;
  border-color: rgba(234, 88, 12, 0.3);
}

.incident-sev-medium {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.3);
}

.incident-sev-low {
  background: rgba(29, 78, 216, 0.1);
  color: #1d4ed8;
  border-color: rgba(29, 78, 216, 0.3);
}

.traffic-chart {
  height: 210px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fffdf7 0%, #f8f3e7 100%);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.traffic-col {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 6px;
}

.traffic-bar-wrap {
  height: 100%;
  display: flex;
  align-items: end;
}

.traffic-bar {
  width: 100%;
  min-height: 6px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #60a5fa 0%, #1d4ed8 100%);
}

.traffic-label {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

  .admin-kpis {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page {
    width: min(100%, 96%);
    margin-top: 12px;
  }

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

  .hero h2 {
    font-size: 24px;
  }

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

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

  .chat-shell {
    max-width: 100%;
  }

  .chat-screen {
    min-height: 380px;
  }

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

  .fan-mobile-page {
    width: 100%;
    margin-top: 4px;
    padding: 0 4px;
  }

  .fan-mobile-page .hero {
    display: none;
  }
}

/* 360Engage Pro Classic reskin */
.card,
.kpi,
.info-box,
.segment,
.admin-kpi,
.metric-track,
.traffic-chart,
.chat-shell,
.journey-pill,
.option-btn {
  border-color: rgba(15, 23, 42, 0.08);
}

.card,
.kpi,
.info-box,
.segment,
.admin-kpi,
.traffic-chart,
.chat-shell,
.option-btn,
.context-pill,
.fan-signal {
  background: #ffffff;
}

.title-wrap p,
.feed-time,
.traffic-label,
.context-pill,
.fan-signal p,
.option-btn small,
.inline-note,
.table th,
label,
.hero p {
  color: var(--muted);
}

.hero,
.fan-hero {
  background: #f8fafc;
}

.hero h2,
.card h3 {
  font-family: "Fraunces", serif;
}

.button-primary {
  background: linear-gradient(160deg, #1d4ed8 0%, #1e40af 100%);
  color: #ffffff;
}

.button-secondary {
  background: #f8fafc;
  color: var(--ink);
}

.button-outline,
input,
select {
  border-color: rgba(15, 23, 42, 0.08);
  background: #ffffff;
  color: var(--ink);
}

.table td {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

.table tr[data-clickable="true"]:hover {
  background: #f8fafc;
}

.pill-consent-yes,
.pill-live,
.pill-money {
  background: #eff6ff;
  color: #1d4ed8;
}

.pill-consent-no {
  background: #fef2f2;
  color: #b91c1c;
}

.pill-seed,
.pill-pipeline {
  background: #f1f5f9;
  color: var(--ink);
}

.metric-track {
  background: #f1f5f9;
}

.metric-fill,
.traffic-bar {
  background: linear-gradient(180deg, #60a5fa 0%, #1d4ed8 100%);
}

.fan-signal-head span {
  background: #eff6ff;
  color: #1d4ed8;
}

.badge {
  color: var(--muted);
  background: #f8fafc;
}

.button-secondary {
  background: #f8fafc;
  color: var(--ink);
}

input,
select {
  background: #ffffff;
  color: var(--ink);
}

select option {
  background: #ffffff;
  color: var(--ink);
}

.feed-item {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

.feed-focus {
  background: #eff6ff;
  border-left-color: #1d4ed8;
}

.table th,
.table td {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

.admin-incident-item {
  background: #ffffff;
  color: var(--ink);
}

.admin-incident-meta {
  color: var(--muted);
}

.incident-sev-high {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.3);
}

.incident-sev-medium {
  background: rgba(217, 119, 6, 0.1);
  color: #d97706;
  border-color: rgba(217, 119, 6, 0.3);
}

.incident-sev-low {
  background: rgba(29, 78, 216, 0.1);
  color: #1d4ed8;
  border-color: rgba(29, 78, 216, 0.3);
}

.traffic-chart {
  background: #ffffff;
}

.json-output {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: var(--ink);
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}