/* ─── Reset & Base ─────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0e1a;
  --bg-card: rgba(255, 255, 255, .04);
  --bg-card-hover: rgba(255, 255, 255, .07);
  --border: rgba(255, 255, 255, .08);
  --border-active: rgba(59, 130, 246, .4);
  --text: #e2e8f0;
  --text-muted: #64748b;
  --text-dim: #475569;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, .15);
  --blue: #3b82f6;
  --green: #10b981;
  --purple: #8b5cf6;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

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

/* ─── Auth Gate ────────────────────────────────────────── */
.auth-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #121830 0%, #0a0e1a 70%);
}

.auth-card {
  text-align: center;
  padding: 48px 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  max-width: 380px;
  width: 100%;
}

.auth-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  margin: 0 auto 20px;
  box-shadow: 0 8px 32px rgba(59, 130, 246, .2);
}

.auth-card h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

.auth-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

/* ─── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all .15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: white;
  box-shadow: 0 4px 16px rgba(59, 130, 246, .25);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(59, 130, 246, .35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(99, 179, 237, 0.3);
}

.btn-ghost:hover {
  color: #fff;
  background: rgba(99, 179, 237, 0.15);
  border-color: var(--accent);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
  border-radius: var(--radius);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--accent-glow);
  color: var(--accent);
}

/* ─── Header ───────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 26, .8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand span {
  font-weight: 400;
}

.header h1 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ─── Search ───────────────────────────────────────────── */
.search-wrap {
  position: relative;
}

.search-wrap input {
  width: 300px;
  padding: 8px 12px 8px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}

.search-wrap input:focus {
  border-color: var(--accent);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #1a1f35;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}

.search-result {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.search-result:hover {
  background: var(--bg-card-hover);
}

.search-result:last-child {
  border-bottom: none;
}

.search-result .name {
  font-size: 13px;
  font-weight: 500;
}

.search-result .meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── User Info ────────────────────────────────────────── */
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

/* ─── Empty State ──────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
}

.empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.empty-state h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 400px;
}

/* ─── Main Grid ────────────────────────────────────────── */
.main-content {
  padding: 20px 24px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ─── Cards ────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ─── Contact Card ─────────────────────────────────────── */
.contact-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-dim);
}

.detail span:not(.detail-label) {
  font-size: 13px;
}

.custom-fields {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cf-item {
  font-size: 12px;
  color: var(--text-muted);
}

.cf-item strong {
  color: var(--text);
  font-weight: 500;
}

.cf-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

/* ─── Conversation Thread ──────────────────────────────── */
.conversation-thread {
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.conversation-thread::-webkit-scrollbar {
  width: 4px;
}

.conversation-thread::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.date-separator {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin: 4px 0;
}

.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.msg.inbound {
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.msg.outbound {
  background: linear-gradient(135deg, var(--accent), #2563eb);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg .msg-meta {
  font-size: 10px;
  color: rgba(255, 255, 255, .5);
  margin-top: 4px;
  display: flex;
  gap: 8px;
}

.msg.inbound .msg-meta {
  color: var(--text-dim);
}

.msg.email {
  background: rgba(139, 92, 246, .1);
  border: 1px solid rgba(139, 92, 246, .2);
  border-radius: var(--radius-sm);
  max-width: 95%;
  align-self: stretch;
}

.msg.email .email-subject {
  font-size: 11px;
  font-weight: 600;
  color: var(--purple);
  margin-bottom: 4px;
}

/* ─── Timer ────────────────────────────────────────────── */
.timer-card {
  padding: 14px 20px;
}

.timer-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#timer-value {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

.timer-controls {
  display: flex;
  gap: 8px;
}

/* ─── AI Call Script ───────────────────────────────────── */
.script-sections {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.script-sections details {
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color .2s;
}

.script-sections details[open] {
  border-color: var(--border-active);
}

.script-sections details summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  list-style: none;
  user-select: none;
  transition: background .1s;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, .03);
  border-bottom: 1px solid transparent;
}

.script-sections details[open] summary {
  border-bottom-color: var(--border);
  background: rgba(59, 130, 246, .06);
}

.script-sections details summary:hover {
  background: var(--bg-card-hover);
}

.script-sections details summary::marker,
.script-sections details summary::-webkit-details-marker {
  display: none;
}

.script-sections details summary::before {
  content: '▸';
  font-size: 10px;
  color: var(--accent);
  transition: transform .2s;
}

.script-sections details[open] summary::before {
  transform: rotate(90deg);
}

.script-sections details>div,
.script-sections details>ul {
  padding: 12px 16px 16px 16px;
}

.script-sections ul {
  padding-left: 20px;
  list-style: none;
}

.script-sections li {
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text-muted);
  line-height: 1.6;
  position: relative;
  padding-left: 16px;
}

.script-sections li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
}

.script-sections li strong {
  color: var(--text);
  font-weight: 600;
}

.script-sections li:last-child {
  margin-bottom: 0;
}

/* Script loading animation */
.script-sections .muted {
  padding: 20px;
  text-align: center;
  font-size: 14px;
}

@keyframes scriptPulse {

  0%,
  100% {
    opacity: .5;
  }

  50% {
    opacity: 1;
  }
}

.script-sections .muted:first-child:only-child {
  animation: scriptPulse 2s ease-in-out infinite;
}

/* ─── Section Notes ────────────────────────────────────── */
.section-notes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-section label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.section-note {
  width: 100%;
  resize: vertical;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
  line-height: 1.5;
}

.section-note:focus {
  border-color: var(--accent);
  background: rgba(59, 130, 246, .03);
}

.section-note:not(:placeholder-shown) {
  border-color: rgba(16, 185, 129, .2);
  background: rgba(16, 185, 129, .03);
}

.save-status {
  font-size: 11px;
  color: var(--green);
}

/* ─── Recap Card ───────────────────────────────────────── */
.recap-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.recap-output {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.recap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

#recap-body {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
}

#recap-body h3,
#recap-body h4 {
  color: var(--text);
  font-size: 13px;
  margin: 12px 0 4px;
  font-weight: 600;
}

#recap-body ul {
  padding-left: 18px;
  margin: 4px 0;
}

#recap-body li {
  margin-bottom: 4px;
}

#recap-body strong {
  color: var(--text);
}

/* ─── Complete Calculator ──────────────────────────────── */
.calc-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calc-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calc-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-dim);
  font-weight: 600;
}

.calc-select {
  padding: 8px 10px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.calc-select:focus {
  border-color: var(--accent);
}

.calc-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calc-input {
  width: 60px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  text-align: center;
}

.calc-input:focus {
  border-color: var(--accent);
}

.calc-detail {
  font-size: 11px;
  color: var(--text-dim);
  flex: 1;
}

.calc-amount {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 70px;
  text-align: right;
}

/* Features grid */
.calc-features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.calc-feature {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background .1s;
}

.calc-feature:hover {
  background: var(--bg-card-hover);
}

.calc-feature input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.calc-feature span {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
}

.calc-feature:has(input:checked) {
  color: var(--text);
  background: rgba(59, 130, 246, .08);
}

.calc-feature:has(input:checked) span {
  color: var(--accent);
}

.calc-divider {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 4px 0;
}

/* ═══ Premium Pricing Summary ════════════════════════════ */
.calc-pricing-summary {
  margin-top: 12px;
  border-top: 2px solid var(--border);
  padding-top: 16px;
}

.calc-pricing-hero {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(16, 185, 129, 0.12) 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin-bottom: 12px;
}

.pricing-hero-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pricing-hero-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.pricing-hero-amount {
  font-size: 32px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -0.5px;
  text-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.pricing-hero-deposit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.pricing-deposit-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--amber);
  font-weight: 600;
}

.pricing-deposit-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--amber);
}

.calc-pricing-recurring {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.calc-recurring-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.calc-recurring-item.total-first-month {
  grid-column: 1 / -1;
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.2);
}

.recurring-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recurring-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.total-first-month .recurring-amount {
  font-size: 18px;
  color: var(--green);
}

/* ═══ Inline Notes (inside script card) ══════════════════ */
.inline-notes {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.inline-note-header {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* ═══ Script Sections — cleaner format ═══════════════════ */
.script-section {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.script-section h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 0 0 6px;
}

.script-section p,
.script-section ul {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

.script-section ul {
  padding-left: 16px;
}

.script-section li {
  margin-bottom: 3px;
}

/* Notes injected below each script section */
.inline-script-note {
  margin: 0 0 16px 0;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.015);
  border-left: 3px solid rgba(255, 255, 255, 0.08);
  border-radius: 0 8px 8px 0;
}

.inline-script-note label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.inline-script-note textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  padding: 8px 10px;
  resize: vertical;
  font-family: 'Inter', sans-serif;
}

.inline-script-note textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.inline-script-note.general-note {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  border-left: 3px solid var(--amber);
}

/* ═══ Live Visitors Card ═════════════════════════════════ */
.visitors-dashboard {
  margin: 16px 24px 0;
}

.visitors-inner {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.visitors-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.visitors-header h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.visitor-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.visitors-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}

/* visitor-row is defined in the expanded visitor section below */


.visitor-row.known {
  border-left: 3px solid var(--green);
}

.visitor-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  white-space: nowrap;
}

.visitor-location .flag {
  font-size: 16px;
}

.visitor-page {
  color: var(--accent);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visitor-device {
  font-size: 14px;
  opacity: 0.7;
}

.visitor-time {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.visitor-name {
  font-weight: 600;
  color: var(--green);
  font-size: 12px;
}

.visitor-socials {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.visitor-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 11px;
  text-decoration: none;
  transition: background 0.2s;
}

.visitor-socials a:hover {
  background: rgba(99, 102, 241, 0.2);
}

.visitor-enriched {
  display: flex;
  align-items: center;
  gap: 6px;
}

.visitor-enriched img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.visitor-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.visitor-badge.known {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
}

.visitor-badge.new {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

.visitor-badge.enriched {
  background: rgba(139, 92, 246, 0.12);
  color: var(--purple);
}

/* Visitor row wrapper for expand */
.visitor-row-wrap {
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s;
}

.visitor-row-wrap.expanded {
  border: 1px solid var(--border-active);
  background: rgba(59, 130, 246, 0.03);
}

.visitor-row-wrap.expanded .visitor-row {
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.visitor-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  transition: background 0.2s;
  cursor: pointer;
}

.visitor-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.visitor-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}

.visitor-expand-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
  width: 16px;
  text-align: center;
}

/* Visitor Detail Panel */
.visitor-detail-panel {
  padding: 14px 16px;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }

  to {
    opacity: 1;
    max-height: 600px;
  }
}

.vd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.vd-photo {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.vd-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
}

.vd-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vd-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.vd-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  gap: 8px;
}

.vd-label {
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.vd-item>span:last-child {
  color: var(--text);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.vd-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.vd-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
}

.vd-pages-section {
  grid-column: 1 / -1;
}

.vd-pages-list {
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vd-page-entry {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  transition: background 0.1s;
}

.vd-page-entry:hover {
  background: rgba(255, 255, 255, 0.03);
}

.vd-page-time {
  color: var(--text-dim);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.vd-page-url {
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vd-socials {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.vd-enrich-btn {
  margin-top: 4px;
  border: 1px solid rgba(139, 92, 246, 0.3) !important;
  color: var(--purple) !important;
}

.vd-enrich-btn:hover {
  background: rgba(139, 92, 246, 0.1) !important;
}

/* ═══ Clarity Analytics Card ═════════════════════════════ */
.clarity-dashboard {
  margin: 16px 24px 0;
}

.clarity-inner {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.clarity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.clarity-header h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.clarity-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.clarity-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.clarity-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.clarity-metric-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.clarity-metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.clarity-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.clarity-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.clarity-link-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
}

/* ─── Mobile ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .search-wrap input {
    width: 200px;
  }

  .header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header h1 {
    display: none;
  }

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

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

@media (max-width: 600px) {
  .header {
    padding: 10px 12px;
  }

  .main-content {
    padding: 12px;
  }

  .card {
    padding: 14px;
  }

  .search-wrap input {
    width: 160px;
  }
}

/* ─── Live Ads Dashboard ──────────────────────────────────── */
.ads-dashboard {
  padding: 16px 24px 0;
}

.ads-dashboard-inner {
  max-width: 1400px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.ads-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ads-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.ads-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ads-updated {
  font-size: 11px;
  color: var(--text-dim);
}

.ads-platforms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.ads-platform-card {
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  transition: border-color .2s;
}

.ads-platform-card:hover {
  border-color: rgba(255, 255, 255, .12);
}

.platform-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.platform-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.platform-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.platform-dot.google {
  background: #4285F4;
  box-shadow: 0 0 8px rgba(66, 133, 244, .4);
}

.platform-dot.facebook {
  background: #1877F2;
  box-shadow: 0 0 8px rgba(24, 119, 242, .4);
}

.platform-status {
  font-size: 11px;
  font-weight: 500;
  color: var(--green);
}

.platform-status.error {
  color: var(--red);
}

.ads-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.ads-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
}

.ads-metric-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.2;
}

.ads-metric-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-dim);
  font-weight: 600;
}

.ads-sub-metrics {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

.ads-campaign-name {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
}

.ads-totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
  margin-bottom: 12px;
}

.ads-total {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ads-total-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--accent), var(--green));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ads-total-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-dim);
}

/* Weekly detail dropdown */
.ads-weekly-detail {
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ads-weekly-detail summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
  user-select: none;
  transition: background .1s;
}

.ads-weekly-detail summary:hover {
  background: var(--bg-card-hover);
}

.ads-weekly-detail summary::marker,
.ads-weekly-detail summary::-webkit-details-marker {
  display: none;
}

.ads-weekly-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

/* Spinning refresh animation */
@keyframes adsSpin {
  to {
    transform: rotate(360deg);
  }
}

.ads-refreshing {
  animation: adsSpin 1s linear infinite;
  display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
  .ads-platforms {
    grid-template-columns: 1fr;
  }

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

  .ads-totals {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .ads-dashboard {
    padding: 12px 12px 0;
  }
}

/* ═══ Lead Tabs ═══════════════════════════════════════════ */
.lead-tabs {
  display: flex;
  gap: 6px;
  padding: 0 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.lead-tabs::-webkit-scrollbar {
  display: none;
}

.lead-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.lead-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.lead-tab.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.lead-tab-name {
  cursor: pointer;
}

.lead-tab-close {
  font-size: 14px;
  line-height: 1;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.2s;
}

.lead-tab-close:hover {
  opacity: 1;
}

/* ═══ Full-Width Script Card ══════════════════════════════ */
.script-card-full {
  margin-bottom: 16px;
}

.script-empty-state {
  padding: 20px;
  text-align: center;
}

.script-empty-state p {
  font-size: 14px;
}

/* ═══ Contact Enrichment ══════════════════════════════════ */
.contact-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.enrichment-subtitle {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.contact-socials {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.contact-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
}

.contact-social-link:hover {
  background: var(--blue);
  color: #fff;
}

/* ═══ Contract Preview ══════════════════════════════════ */
.contract-editable {
  background: #161625;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin: 10px 0 0;
  max-height: 500px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  cursor: text;
}

.contract-editable:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(110, 87, 224, 0.2);
}

.contract-editable h1,
.contract-editable h3 {
  color: var(--text) !important;
}

.contract-editable p,
.contract-editable li {
  color: var(--text-muted) !important;
}

.contract-editable table td {
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
}

.contract-editable tr[style*="f8f9fa"] {
  background: rgba(255, 255, 255, 0.03) !important;
}

.contract-editable hr {
  border-color: var(--border) !important;
}