/* Insights ROI calculator - premium visual treatment.
   Tailwind-adjacent tokens but hand-written so the calculator can stand
   on its own without depending on which utility classes are available. */

:root {
  --roi-ink: #1c1917;         /* stone-900 */
  --roi-ink-2: #292524;       /* stone-800 */
  --roi-body: #44403c;        /* stone-700 */
  --roi-muted: #78716c;       /* stone-500 */
  --roi-line: #e7e5e4;        /* stone-200 */
  --roi-line-2: #d6d3d1;      /* stone-300 */
  --roi-bg: #ffffff;
  --roi-bg-2: #fafaf9;        /* stone-50 */
  --roi-bg-3: #f5f5f4;        /* stone-100 */
  --roi-accent: #b45309;      /* amber-700 - warm, distinct from stone */
  --roi-accent-2: #78350f;    /* amber-900 */
  --roi-accent-bg: #fef3c7;   /* amber-100 */
  --roi-link: #1d4ed8;        /* blue-700 for citation superscripts */
  --roi-radius-lg: 20px;
  --roi-radius-md: 12px;
  --roi-radius-sm: 8px;
  --roi-shadow-md: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px -8px rgba(0,0,0,0.12);
  --roi-shadow-lg: 0 4px 6px -1px rgba(0,0,0,0.06), 0 24px 40px -12px rgba(0,0,0,0.18);
}

/* ---------- Citation superscripts (article body) ---------- */
.prose sup.citation {
  font-size: 0.7em;
  vertical-align: super;
  line-height: 0;
  margin-left: 0.1em;
}
.prose sup.citation a.citation-link,
sup.citation a.citation-link {
  color: var(--roi-link);
  text-decoration: none;
  font-weight: 600;
}
.prose sup.citation a.citation-link:hover,
sup.citation a.citation-link:hover {
  color: #1e3a8a; /* blue-900 */
  text-decoration: none;
}

/* ---------- Shell ---------- */
.roi-shell {
  font-family: inherit;
  color: var(--roi-body);
  margin-inline: calc(-1 * ((100vw - min(100%, 100%)) / 2));
}
.roi-card {
  background: linear-gradient(180deg, var(--roi-bg) 0%, var(--roi-bg-2) 100%);
  border: 1px solid var(--roi-line);
  border-radius: var(--roi-radius-lg);
  box-shadow: var(--roi-shadow-lg);
  padding: 40px 32px 32px;
}

@media (min-width: 640px) {
  .roi-card { padding: 48px 40px 40px; }
}

/* ---------- Header ---------- */
.roi-card-head {
  text-align: center;
  max-width: 620px;
  margin: 0 auto 32px;
}
.roi-eyebrow {
  color: var(--roi-accent-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 12px;
}
.roi-headline {
  color: var(--roi-ink);
  font-size: clamp(28px, 3.2vw, 38px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.roi-lede {
  color: var(--roi-body);
  font-size: 16px;
  line-height: 1.55;
  margin: 0;
}

/* ---------- Chat pane ---------- */
.roi-chat {
  border: 1px solid var(--roi-line-2);
  border-radius: var(--roi-radius-md);
  background: var(--roi-bg);
  margin-bottom: 28px;
  overflow: hidden;
}
.roi-chat[open] {
  box-shadow: var(--roi-shadow-md);
}
.roi-chat-summary {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: var(--roi-ink-2);
  font-weight: 600;
  list-style: none;
  transition: background 120ms ease;
}
.roi-chat-summary::-webkit-details-marker { display: none; }
.roi-chat-summary:hover { background: var(--roi-bg-3); }
.roi-chat-badge {
  background: var(--roi-accent-bg);
  color: var(--roi-accent-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}
.roi-chat-title { flex: 1; font-size: 15px; }
.roi-chat-caret {
  font-size: 22px;
  color: var(--roi-muted);
  transition: transform 150ms ease;
  transform: rotate(0deg);
  line-height: 1;
}
.roi-chat[open] .roi-chat-caret { transform: rotate(90deg); }

.roi-chat-body {
  border-top: 1px solid var(--roi-line);
  padding: 20px;
  background: var(--roi-bg-2);
}
.roi-chat-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 12px;
}
.roi-chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.roi-chat-msg.is-user { flex-direction: row-reverse; }
.roi-chat-avatar {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--roi-ink);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.roi-chat-msg.is-user .roi-chat-avatar {
  background: var(--roi-accent);
}
.roi-chat-bubble {
  background: white;
  border: 1px solid var(--roi-line);
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--roi-body);
  font-size: 15px;
  line-height: 1.5;
  max-width: 78%;
}
.roi-chat-msg.is-user .roi-chat-bubble {
  background: var(--roi-accent-bg);
  border-color: var(--roi-accent-bg);
  color: var(--roi-accent-2);
}
.roi-chat-msg.is-typing .roi-chat-bubble {
  color: var(--roi-muted);
  font-style: italic;
}
.roi-chat-input {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.roi-chat-input input {
  flex: 1;
  background: white;
  border: 1px solid var(--roi-line-2);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  color: var(--roi-ink);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.roi-chat-input input:focus {
  border-color: var(--roi-accent);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.15);
}
.roi-chat-send {
  background: var(--roi-ink);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease;
}
.roi-chat-send:hover { background: var(--roi-accent-2); }
.roi-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
.roi-chat-note {
  color: var(--roi-muted);
  font-size: 12px;
  margin: 10px 0 0;
  text-align: center;
}

/* ---------- Framing note above the form ---------- */
.roi-team-note {
  max-width: 720px;
  margin: 0 0 24px;
  padding: 14px 18px;
  border-left: 3px solid var(--roi-accent);
  background: var(--roi-accent-bg);
  color: var(--roi-accent-2);
  font-size: 14px;
  line-height: 1.55;
  border-radius: 6px;
}

/* ---------- Form: segmented buttons + sliders (single column at all sizes) ---------- */
.roi-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  margin-bottom: 32px;
  max-width: 720px;
}
.roi-field-wide { grid-column: 1 / -1; }

/* Small helper text under a slider, e.g. "People on your reg-affairs team..." */
.roi-slider-hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--roi-muted);
}

.roi-field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--roi-muted);
  margin-bottom: 10px;
}
.roi-readout {
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  font-size: 13px;
  color: var(--roi-accent-2);
  font-variant-numeric: tabular-nums;
}
.roi-field.is-just-filled .roi-readout {
  animation: roiFlash 900ms ease-out;
}
@keyframes roiFlash {
  0% { background: #fbbf24; color: var(--roi-ink); padding: 2px 6px; border-radius: 4px; }
  100% { background: transparent; }
}

/* ---------- Segmented pill button group ---------- */
.roi-segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.roi-seg-btn {
  flex: 1 1 auto;
  min-width: 0;
  background: white;
  border: 1.5px solid var(--roi-line-2);
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--roi-ink-2);
  cursor: pointer;
  transition: all 140ms ease;
  font-family: inherit;
  text-align: center;
  white-space: nowrap;
}
.roi-seg-btn:hover {
  border-color: var(--roi-accent);
  color: var(--roi-accent-2);
  background: var(--roi-accent-bg);
}
.roi-seg-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.28);
}
.roi-seg-btn.is-selected {
  background: var(--roi-ink);
  border-color: var(--roi-ink);
  color: white;
  box-shadow: 0 4px 12px -3px rgba(28, 25, 23, 0.35);
}
.roi-seg-btn.is-selected:hover {
  background: var(--roi-ink-2);
  border-color: var(--roi-ink-2);
  color: white;
}

/* ---------- Slider ---------- */
.roi-slider {
  --roi-slider-pct: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(to right,
    var(--roi-accent) 0%,
    var(--roi-accent) var(--roi-slider-pct),
    var(--roi-line) var(--roi-slider-pct),
    var(--roi-line) 100%);
  outline: none;
  margin: 6px 0 8px;
  cursor: pointer;
}
.roi-slider:focus-visible { box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.22); }
.roi-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  border: 2.5px solid var(--roi-accent);
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.roi-slider::-webkit-slider-thumb:hover { transform: scale(1.12); }
.roi-slider::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.05); }
.roi-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  border: 2.5px solid var(--roi-accent);
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.roi-slider-ticks {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 11px;
  color: var(--roi-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}


/* ---------- Results: two-panel current-vs-savings layout ---------- */
.roi-output {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 32px;
}
@media (min-width: 900px) {
  .roi-output[data-state="engaged"] { grid-template-columns: 1fr 1fr; gap: 20px; }
  .roi-output[data-state="engaged"] .roi-total { grid-column: 1 / -1; }
}

/* State gating: idle card until any field is touched; then reveal panels + total */
.roi-output[data-state="idle"] .roi-panel,
.roi-output[data-state="idle"] .roi-total { display: none; }
.roi-output[data-state="engaged"] .roi-idle { display: none; }

/* ---------- Idle empty state ---------- */
.roi-idle {
  border: 1.5px dashed var(--roi-line-2);
  background: var(--roi-bg-2);
  border-radius: var(--roi-radius-md);
  padding: 56px 32px;
  text-align: center;
  color: var(--roi-muted);
}
.roi-idle-inner {
  max-width: 380px;
  margin: 0 auto;
}
.roi-idle-icon {
  color: var(--roi-line-2);
  margin: 0 auto 12px;
  display: block;
}
.roi-idle-headline {
  font-size: 18px;
  font-weight: 700;
  color: var(--roi-ink-2);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.roi-idle-sub {
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

.roi-panel {
  border-radius: var(--roi-radius-md);
  padding: 24px;
  transition: box-shadow 200ms ease;
}
.roi-panel:hover { box-shadow: var(--roi-shadow-md); }
.roi-panel-current {
  background: var(--roi-ink);
  border: 1px solid var(--roi-ink);
  color: white;
}
.roi-panel-savings {
  background: white;
  border: 1px solid var(--roi-line);
}
.roi-panel-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.roi-panel-current .roi-panel-eyebrow { color: rgba(255,255,255,0.6); }
.roi-panel-savings .roi-panel-eyebrow { color: var(--roi-accent-2); }
.roi-panel-headline {
  font-size: clamp(30px, 3.6vw, 44px);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
  line-height: 1.05;
  color: white;
  transition: opacity 150ms ease;
}
.roi-panel-headline.is-updating { opacity: 0.5; }
.roi-panel-headline-sm {
  font-size: 18px;
  font-weight: 700;
  color: var(--roi-ink);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.roi-panel-sub {
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 20px;
}
.roi-panel-current .roi-panel-sub { color: rgba(255,255,255,0.6); }
.roi-panel-savings .roi-panel-sub { color: var(--roi-muted); }

.roi-panel-breakdown {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.roi-panel-breakdown li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 14px;
}
.roi-bd-label {
  color: rgba(255,255,255,0.7);
}
.roi-bd-val {
  color: white;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: opacity 150ms ease;
}
.roi-bd-val.is-updating { opacity: 0.5; }

.roi-saving {
  padding: 16px 0;
  border-bottom: 1px solid var(--roi-line);
}
.roi-saving:last-child { border-bottom: none; padding-bottom: 4px; }
.roi-saving:first-child { padding-top: 4px; }
.roi-saving-bucket {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--roi-muted);
  margin: 0 0 6px;
}
.roi-saving-value {
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 800;
  color: var(--roi-accent);
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  transition: opacity 150ms ease;
}
.roi-saving-value.is-updating { opacity: 0.5; }
.roi-saving-worth {
  font-size: 13px;
  color: var(--roi-body);
  margin: 0 0 6px;
}
.roi-saving-worth [data-slot] {
  font-weight: 700;
  color: var(--roi-ink);
  font-variant-numeric: tabular-nums;
}
.roi-saving-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--roi-muted);
  margin: 0;
}

/* ---------- Total annual savings footer card ---------- */
.roi-total {
  background: linear-gradient(135deg, var(--roi-accent) 0%, var(--roi-accent-2) 100%);
  color: white;
  border-radius: var(--roi-radius-md);
  padding: 32px 28px;
  box-shadow: 0 10px 30px -10px rgba(180, 83, 9, 0.5);
}
.roi-total-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.roi-total-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  margin: 0 0 10px;
}
.roi-total-value {
  font-size: clamp(38px, 5.2vw, 64px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 12px;
  color: white;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.roi-total-note {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255,255,255,0.82);
  margin: 0;
  max-width: 520px;
  margin: 0 auto;
}
.roi-stat {
  background: white;
  border: 1px solid var(--roi-line);
  border-radius: var(--roi-radius-md);
  padding: 20px;
  transition: box-shadow 200ms ease;
}
.roi-stat:hover { box-shadow: var(--roi-shadow-md); }
.roi-stat-primary {
  background: var(--roi-ink);
  border-color: var(--roi-ink);
  color: white;
}
.roi-stat-primary .roi-stat-label { color: rgba(255,255,255,0.65); }
.roi-stat-primary .roi-stat-value { color: white; }
.roi-stat-primary .roi-stat-sub { color: rgba(255,255,255,0.55); }
.roi-stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--roi-muted);
  margin: 0 0 10px;
}
.roi-stat-value {
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 800;
  color: var(--roi-ink);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  line-height: 1.1;
  transition: opacity 150ms ease, transform 200ms cubic-bezier(0.2,0.7,0.3,1.2);
}
.roi-stat-value.is-updating {
  opacity: 0.5;
}
.roi-stat-sub {
  font-size: 12px;
  line-height: 1.4;
  color: var(--roi-muted);
  margin: 0;
}

/* ---------- Report / lead capture ---------- */
.roi-report {
  border-top: 1px solid var(--roi-line);
  padding-top: 28px;
  display: grid;
  gap: 16px;
}
@media (min-width: 900px) {
  .roi-report {
    grid-template-columns: 320px 1fr;
    align-items: start;
    gap: 32px;
  }
}
.roi-report-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--roi-ink);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.roi-report-sub {
  color: var(--roi-muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}
.roi-report-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 640px) {
  .roi-report-form {
    grid-template-columns: 1fr 1fr;
  }
}
.roi-report-form input,
.roi-report-form select,
.roi-report-form textarea {
  width: 100%;
  background: white;
  border: 1px solid var(--roi-line-2);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--roi-ink);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  font-family: inherit;
}
.roi-report-form input:focus,
.roi-report-form select:focus,
.roi-report-form textarea:focus {
  border-color: var(--roi-accent);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.15);
}
.roi-report-form .roi-report-notes {
  grid-column: 1 / -1;
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}
.roi-report-form button {
  grid-column: 1 / -1;
  background: var(--roi-ink);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
}
.roi-report-form button:hover { background: var(--roi-accent-2); }
.roi-report-form button:disabled { opacity: 0.6; cursor: not-allowed; }
.roi-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.roi-report-status {
  font-size: 14px;
  margin: 4px 0 0;
  min-height: 20px;
}
.roi-report-status.is-error { color: #7f1d1d; }
.roi-report-status.is-ok { color: #14532d; }
@media (min-width: 900px) {
  .roi-report-status { grid-column: 2 / 3; }
}
