/* -----------------------------------------------------------------------
   ROIQ Analytics — stylesheet
   Design reference: qformative brand palette (amber accent, dark mode).
   ----------------------------------------------------------------------- */

/* ===== Shared constants (theme-independent) ============================== */
:root {
  --roiq-radius:    10px;
  --roiq-radius-sm: 6px;
}

/* ===== Design tokens — dark (default) ==================================== */
[data-theme="dark"],
:root {
  --roiq-bg:            #0F172A;
  --roiq-bg-card:       #1E293B;
  --roiq-bg-raised:     #263347;
  --roiq-bg-input:      #1E293B;
  --roiq-border:        #334155;
  --roiq-border-bright: #475569;

  --roiq-text:          #F1F5F9;
  --roiq-text-sub:      #94A3B8;
  --roiq-text-muted:    #64748B;

  --roiq-brand:         #F59E0B;
  --roiq-brand-light:   #FCD34D;
  --roiq-brand-glow:    rgba(245,158,11,0.12);
  --roiq-nav-bg:        rgba(15,23,42,0.95);
  --roiq-orange:        #FB923C;
  --roiq-orange-dim:    rgba(251,146,60,0.10);
  --roiq-orange-border: rgba(251,146,60,0.25);
  --roiq-blue:          #3B82F6;
  --roiq-blue-dim:      rgba(59,130,246,0.10);
  --roiq-blue-border:   rgba(59,130,246,0.28);

  --roiq-green:         #4ADE80;
  --roiq-green-dim:     rgba(74,222,128,0.15);
  --roiq-green-border:  rgba(74,222,128,0.3);

  --roiq-amber:         #FCD34D;
  --roiq-amber-dim:     rgba(252,211,77,0.12);
  --roiq-amber-border:  rgba(252,211,77,0.3);

  --roiq-red:           #F87171;
  --roiq-red-dim:       rgba(248,113,113,0.12);
  --roiq-red-border:    rgba(248,113,113,0.3);

  --roiq-purple:        #A78BFA;
  --roiq-purple-dim:    rgba(167,139,250,0.15);

  --roiq-shadow:        0 2px 16px rgba(0,0,0,0.4);
  --roiq-shadow-lg:     0 8px 32px rgba(0,0,0,0.5);
}


/* ===== Bootstrap theme overrides ======================================== */
[data-bs-theme="dark"] {
  --bs-body-bg:         var(--roiq-bg);
  --bs-body-color:      var(--roiq-text);
  --bs-border-color:    var(--roiq-border);
  --bs-secondary-color: var(--roiq-text-sub);
  --bs-code-color:      var(--roiq-brand-light);
}

/* ===== Base ============================================================= */
.roiq-body {
  background: var(--roiq-bg);
  color: var(--roiq-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Top loading bar ================================================== */
.roiq-topbar-loader {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--roiq-brand), var(--roiq-brand-light), var(--roiq-brand));
  background-size: 200% 100%;
  z-index: 9999;
  display: none;
  animation: roiq-loader-slide 1.2s linear infinite;
}
@keyframes roiq-loader-slide {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.htmx-request .roiq-topbar-loader,
.roiq-topbar-loader.htmx-request { display: block; }

/* ===== HTMX indicator (spinner buttons) ================================= */
.htmx-indicator          { display: none; }
.htmx-request            .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator            { display: inline-block; }

/* ===== Fade-in on HTMX swap ============================================= */
#workflow-container > *,
#chat-messages > * {
  animation: roiq-fadein 0.2s ease-out;
}
@keyframes roiq-fadein {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Navbar =========================================================== */
.roiq-navbar {
  background: var(--roiq-nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--roiq-border);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.roiq-navbar-inner {
  width: 100%;
  padding: 0 2rem 0 0.75rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
}
.roiq-navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.roiq-logo-mark {
  width: 28px;
  height: 28px;
  background: var(--roiq-brand);
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.roiq-logo-mark svg { width: 16px; height: 16px; fill: #1C0F00; }
.roiq-logo-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.roiq-logo-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--roiq-text);
  letter-spacing: -0.02em;
  line-height: 1;
}
.roiq-logo-by {
  font-size: 0.62rem;
  color: var(--roiq-text-muted);
  line-height: 1;
  font-weight: 400;
}
.roiq-logo-by span { color: var(--roiq-brand-light); font-weight: 500; }

/* ===== Main content area ================================================ */
.roiq-main {
  padding: 0;
  width: 100%;
}

/* ===== Page header ====================================================== */
.roiq-page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--roiq-border);
}
.roiq-page-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--roiq-text);
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--roiq-text) 40%, var(--roiq-brand));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.4rem;
}
.roiq-page-sub {
  color: var(--roiq-text-sub);
  font-size: 0.95rem;
  max-width: 620px;
  margin: 0;
}

/* ===== Step progress badges ============================================= */
.roiq-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.roiq-steps .step {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.roiq-steps .step.done    {
  background: var(--roiq-green-dim);
  color: var(--roiq-green);
  border: 1px solid var(--roiq-green-border);
}
.roiq-steps .step.active  {
  background: var(--roiq-brand-glow);
  color: var(--roiq-brand-light);
  border: 1px solid rgba(245,158,11,0.4);
}
.roiq-steps .step.pending {
  background: var(--roiq-bg-card);
  color: var(--roiq-text-muted);
  border: 1px solid var(--roiq-border);
}
.roiq-steps .arrow { color: var(--roiq-text-muted); }

/* ===== Cards ============================================================ */
.roiq-card {
  background: var(--roiq-bg-card);
  border: 1px solid var(--roiq-border);
  border-top: 3px solid var(--roiq-brand);
  border-radius: var(--roiq-radius);
  padding: 1.75rem;
  box-shadow: var(--roiq-shadow);
  max-width: 700px;
}
.roiq-card.step-active  { border-top-color: var(--roiq-brand); }
.roiq-card.step-success { border-top-color: var(--roiq-green); }
.roiq-card.step-error   { border-top-color: var(--roiq-red); }

/* Card headings */
.roiq-card h5 { color: var(--roiq-text); font-weight: 700; }

/* ===== Form controls on dark bg ========================================= */
.form-control, .form-select {
  background-color: var(--roiq-bg-input) !important;
  border-color: var(--roiq-border-bright) !important;
  color: var(--roiq-text) !important;
}
.form-control:focus, .form-select:focus {
  background-color: var(--roiq-bg-input) !important;
  border-color: var(--roiq-brand) !important;
  box-shadow: 0 0 0 3px var(--roiq-brand-glow) !important;
  color: var(--roiq-text) !important;
}
.form-control::placeholder { color: var(--roiq-text-muted) !important; }
.form-text { color: var(--roiq-text-muted) !important; }
.form-label { color: var(--roiq-text-sub) !important; font-size: 0.875rem; }

/* ===== Banners ========================================================== */
.roiq-done-banner {
  background: var(--roiq-green-dim);
  border: 1px solid var(--roiq-green-border);
  border-radius: var(--roiq-radius-sm);
  padding: 0.55rem 1rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  color: #86efac;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.roiq-skip-banner {
  background: var(--roiq-amber-dim);
  border: 1px solid var(--roiq-amber-border);
  border-radius: var(--roiq-radius-sm);
  padding: 0.55rem 1rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  color: #fcd34d;
}

/* ===== Badges =========================================================== */
.roiq-badge-optional {
  background: var(--roiq-bg-raised);
  color: var(--roiq-text-sub);
  border: 1px solid var(--roiq-border-bright);
  font-size: 0.68rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
}
.roiq-badge-fino {
  background: var(--roiq-brand-glow);
  color: var(--roiq-brand-light);
  border: 1px solid rgba(245,158,11,0.35);
  font-size: 0.68rem; padding: 2px 9px; border-radius: 20px; font-weight: 600;
}
.roiq-badge-mock {
  background: rgba(249,115,22,0.15);
  color: #fb923c;
  border: 1px solid rgba(249,115,22,0.3);
  font-size: 0.68rem; padding: 2px 9px; border-radius: 20px; font-weight: 600;
}
.roiq-badge-local {
  background: var(--roiq-purple-dim);
  color: #c084fc;
  border: 1px solid rgba(124,58,237,0.35);
  font-size: 0.68rem; padding: 2px 9px; border-radius: 20px; font-weight: 600;
}

/* ===== Skip divider ===================================================== */
.roiq-skip-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: var(--roiq-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.roiq-skip-divider::before,
.roiq-skip-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--roiq-border);
}

/* ===== Session info strip =============================================== */
.roiq-session-strip {
  font-size: 0.78rem;
  color: var(--roiq-text-muted);
  padding: 0.5rem 0;
}
.roiq-session-strip code { color: var(--roiq-brand-light); font-size: 0.82em; }

/* ===== Section cards (results) ========================================== */
.roiq-section {
  background: var(--roiq-bg-card);
  border: 1px solid var(--roiq-border);
  border-top: 3px solid var(--roiq-brand);
  border-radius: var(--roiq-radius);
  overflow: hidden;
  box-shadow: var(--roiq-shadow);
  margin-bottom: 1.5rem;
}
.roiq-section-header {
  padding: 0.7rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-bottom: 1px solid var(--roiq-border);
  color: var(--roiq-text);
  background: var(--roiq-bg-raised);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.roiq-section-header.over     { border-top-color: #c06868; color: #c98888; }
.roiq-section-header.under    { border-top-color: #d4893a; color: #e0a050; }
.roiq-section-header.checkout { border-top-color: #2dd4bf; color: #5eead4; }


/* View-switcher dropdown — lives inside .roiq-section-header (already a flex row) */
.roiq-view-select {
  appearance: auto;
  background: var(--roiq-bg-raised);
  border: 1px solid var(--roiq-border);
  border-radius: var(--roiq-radius-sm);
  color: var(--roiq-text);
  font-size: 0.78rem;
  padding: 3px 8px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s;
}
.roiq-view-select:hover  { border-color: var(--roiq-brand); }
.roiq-view-select:focus  { outline: none; border-color: var(--roiq-brand); box-shadow: 0 0 0 2px var(--roiq-brand-glow); }

/* ===== Tables =========================================================== */
.table {
  --bs-table-bg:          transparent;
  --bs-table-color:       var(--roiq-text);
  --bs-table-border-color: var(--roiq-border);
  --bs-table-hover-bg:    rgba(255,255,255,0.04);
  font-size: 0.85rem;
}
.table thead th {
  background: var(--roiq-bg-raised) !important;
  color: var(--roiq-text-sub) !important;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--roiq-border-bright) !important;
  padding: 0.55rem 0.75rem;
}
.table tbody td {
  color: var(--roiq-text);
  border-color: var(--roiq-border);
  padding: 0.5rem 0.75rem;
}
.table tfoot td {
  background: var(--roiq-bg-raised) !important;
  color: var(--roiq-text);
  font-weight: 700;
  border-color: var(--roiq-border-bright) !important;
}
.table-hover tbody tr:hover td { background: rgba(245,158,11,0.06); }

/* Monopoly highlight — replaces Bootstrap table-warning (light yellow) which
   is unreadable against white text in the dark theme. */
.roiq-row-monopoly td {
  background: rgba(220, 80, 60, 0.18) !important;
  border-color: rgba(220, 80, 60, 0.30) !important;
  color: #f8d0cc !important;
}

/* ===== Alerts =========================================================== */
.alert-warning {
  background: var(--roiq-amber-dim) !important;
  border-color: var(--roiq-amber-border) !important;
  color: #fcd34d !important;
}
.alert-info {
  background: rgba(245,158,11,0.08) !important;
  border-color: rgba(245,158,11,0.25) !important;
  color: var(--roiq-brand-light) !important;
}

/* ===== ECharts containers =============================================== */
.roiq-echarts-container {
  width: 100%;
  height: 360px;
  padding: 0.5rem;
}
.roiq-heatmap-dynamic {
  min-height: 280px;
  width: 100%;
  padding: 0.5rem;
}

/* ===== AI summary card ================================================== */
.roiq-ai-card {
  background: var(--roiq-bg-card);
  border: 1px solid rgba(245,158,11,0.2);
  border-left: 4px solid var(--roiq-brand);
  border-radius: var(--roiq-radius);
  overflow: hidden;
  box-shadow: var(--roiq-shadow);
}
.roiq-ai-card-header {
  background: rgba(245,158,11,0.1);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--roiq-brand-light);
  border-bottom: 1px solid rgba(245,158,11,0.15);
}
.roiq-ai-card-body {
  padding: 1rem;
  font-size: 0.9rem;
  color: var(--roiq-text);
  line-height: 1.65;
}
.roiq-ai-card-body h1,
.roiq-ai-card-body h2,
.roiq-ai-card-body h3  { font-size: 0.95rem; font-weight: 700; margin-top: 0.75rem; color: var(--roiq-text); }
.roiq-ai-card-body table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 0.5rem 0; }
.roiq-ai-card-body th  { background: var(--roiq-bg-raised); padding: 4px 8px; text-align: left; color: var(--roiq-text-sub); }
.roiq-ai-card-body td  { padding: 3px 8px; border-top: 1px solid var(--roiq-border); }
.roiq-ai-card-body p   { margin-bottom: 0.4rem; }
.roiq-ai-card-body ul,
.roiq-ai-card-body ol  { padding-left: 1.25rem; margin-bottom: 0.4rem; }

/* ===== Step-4 analysis option cards ===================================== */
.roiq-analysis-option {
  background: var(--roiq-bg-card);
  border: 1px solid var(--roiq-border);
  border-top: 4px solid var(--roiq-green);
  border-radius: var(--roiq-radius);
  padding: 1.5rem;
  height: 100%;
  box-shadow: var(--roiq-shadow);
  transition: box-shadow .2s, border-color .2s, transform .15s;
}
.roiq-analysis-option:hover {
  box-shadow: var(--roiq-shadow-lg);
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-2px);
}
.roiq-analysis-option-local { border-top-color: var(--roiq-purple); }
.roiq-analysis-option-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--roiq-text);
}

/* ===== Results content (padded to clear fixed chat panel) ============== */
.roiq-results-content {
  padding-bottom: 240px;
}

/* ===== Fixed chat panel ================================================= */
.roiq-chat-panel-fixed {
  position: fixed;
  bottom: 0;
  left: 260px; /* sidebar width */
  right: 0;
  z-index: 300;
  background: var(--roiq-bg-card);
  border-top: 2px solid var(--roiq-brand);
  box-shadow: 0 -6px 30px rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  min-height: 220px;
  max-height: 42vh;
  transition: max-height 0.2s ease;
}
.roiq-chat-panel-fixed.roiq-chat-collapsed {
  max-height: 36px;
  overflow: hidden;
}
.roiq-chat-panel-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--roiq-brand-light);
  border-bottom: 1px solid var(--roiq-border);
  flex-shrink: 0;
}
.roiq-chat-toggle {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--roiq-text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 4px;
}
.roiq-chat-toggle:hover { color: var(--roiq-text); }

/* ===== Chat section (legacy — inline use) ============================== */
.roiq-chat-section .roiq-section { border-top-color: var(--roiq-brand); }
.roiq-chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  scroll-behavior: smooth;
}
.roiq-chat-pair {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  animation: roiq-fadein 0.2s ease-out;
}
.roiq-chat-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--roiq-brand), var(--roiq-brand-light));
  color: #fff;
  border-radius: 16px 16px 3px 16px;
  padding: 0.55rem 1rem;
  max-width: 75%;
  font-size: 0.875rem;
  word-break: break-word;
  box-shadow: 0 2px 8px var(--roiq-brand-glow);
}
.roiq-chat-ai { align-self: flex-start; max-width: 92%; }
.roiq-chat-ai-body {
  background: var(--roiq-bg-raised);
  border: 1px solid var(--roiq-border-bright);
  border-radius: 3px 16px 16px 16px;
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
  color: var(--roiq-text);
  line-height: 1.6;
}
.roiq-chat-ai-body p   { margin-bottom: 0.3rem; }
.roiq-chat-ai-body ul,
.roiq-chat-ai-body ol  { padding-left: 1.2rem; margin-bottom: 0.3rem; }
.roiq-chat-ai-body pre {
  background: var(--roiq-bg);
  border: 1px solid var(--roiq-border);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  font-size: 0.8rem;
  overflow-x: auto;
}
.roiq-chat-ai-body code { font-size: 0.85em; color: var(--roiq-brand-light); background: rgba(245,158,11,0.1); padding: 1px 5px; border-radius: 3px; }
.roiq-chat-ai-body pre code { background: none; padding: 0; color: inherit; }

/* ===== Token badge ====================================================== */
.roiq-token-badge {
  font-size: 0.68rem;
  color: var(--roiq-text-muted);
  margin-top: 4px;
  padding-left: 4px;
}

/* ===== Chat spinner (shows while HTMX request is in flight) ============ */
.roiq-chat-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(245,158,11,0.2);
  border-top-color: var(--roiq-brand);
  border-radius: 50%;
  animation: roiq-spin 0.65s linear infinite;
  opacity: 0;
  transition: opacity 0.1s;
  flex-shrink: 0;
}
.roiq-chat-spinner.htmx-request { opacity: 1; }
@keyframes roiq-spin { to { transform: rotate(360deg); } }

/* ===== Query counter badge — matches .roiq-token-toggle styling ========== */
.roiq-query-counter {
  font-size: 0.72rem;
  color: var(--roiq-text-muted);
  white-space: nowrap;
  user-select: none;
}

/* ===== Limit-reached notice inside form controls ======================== */
.roiq-chat-limit-notice {
  font-size: 0.75rem;
  color: var(--roiq-amber, #f59e0b);
  text-align: center;
  padding: 0.3rem 0.5rem;
}

/* ===== Chat input row =================================================== */
.roiq-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: var(--roiq-bg-raised);
  border-top: 1px solid var(--roiq-border);
  flex-shrink: 0;
}
.roiq-chat-input-row .form-control { flex: 1; }
.roiq-chat-textarea {
  resize: none;
  line-height: 1.45;
  min-height: 62px;
  max-height: 120px;
  overflow-y: auto;
  background-color: var(--roiq-bg-input) !important;
  border-color: rgba(245,158,11,0.35) !important;
  color: var(--roiq-text) !important;
}
.roiq-chat-textarea:focus {
  background-color: var(--roiq-bg-raised) !important;
  border-color: var(--roiq-brand) !important;
  box-shadow: 0 0 0 3px var(--roiq-brand-glow) !important;
}
.roiq-token-toggle {
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  font-size: 0.72rem;
  color: var(--roiq-text-muted);
}

/* ===== Buttons ========================================================== */
.btn-primary {
  background: var(--roiq-brand) !important;
  border-color: var(--roiq-brand) !important;
  color: #1C0F00 !important;
  font-weight: 700;
}
.btn-primary:hover {
  background: var(--roiq-brand-light) !important;
  border-color: var(--roiq-brand-light) !important;
  color: #1C0F00 !important;
  box-shadow: 0 0 0 3px var(--roiq-brand-glow) !important;
}
.btn-success {
  background: var(--roiq-green) !important;
  border-color: var(--roiq-green) !important;
  color: #052e16 !important;
  font-weight: 600;
}
.btn-outline-secondary {
  color: var(--roiq-text-sub) !important;
  border-color: var(--roiq-border-bright) !important;
}
.btn-outline-secondary:hover {
  background: var(--roiq-bg-raised) !important;
  color: var(--roiq-text) !important;
}

/* ===== code tags ======================================================== */
code {
  color: var(--roiq-brand-light) !important;
  background: var(--roiq-brand-glow) !important;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.88em;
}
pre code { background: none !important; padding: 0; }

/* ===== Two-column layout ================================================ */
.roiq-layout {
  display: flex;
  min-height: calc(100vh - 53px);
}

#roiq-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--roiq-bg-card);
  border-right: 1px solid var(--roiq-border);
  position: sticky;
  top: 53px;
  height: calc(100vh - 53px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#roiq-content {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem;
  overflow-x: hidden;
}

/* ===== Sidebar internals ================================================ */
.roiq-step-nav {
  padding: 0.5rem 0;
}

.roiq-step-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1rem;
  height: 44px;
  cursor: pointer;
  /* button resets — must use !important to override Bootstrap dark-mode button defaults */
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  border-left: 3px solid transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
  text-align: left;
  outline: none;
  text-decoration: none;
  color: var(--roiq-text-sub);
  transition: background 0.12s, border-left-color 0.12s;
}
.roiq-step-item:hover {
  background: rgba(255,255,255,0.04) !important;
  color: var(--roiq-text);
}
.roiq-step-item.active {
  background: var(--roiq-brand-glow) !important;
  border-left-color: var(--roiq-brand) !important;
  color: var(--roiq-text);
}
.roiq-step-item.loaded {
  border-left-color: var(--roiq-green) !important;
  color: var(--roiq-text);
}
.roiq-step-item.error  { border-left-color: var(--roiq-red) !important; color: var(--roiq-text); }
.roiq-step-item.skipped { border-left-color: var(--roiq-text-muted) !important; }
.roiq-step-item:focus-visible {
  outline: 2px solid var(--roiq-brand) !important;
  outline-offset: -2px;
}

.roiq-step-num {
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--roiq-bg-raised);
  border: 1px solid var(--roiq-border-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.roiq-step-item.loaded  .roiq-step-num { background: var(--roiq-green-dim); border-color: var(--roiq-green-border); color: var(--roiq-green); }
.roiq-step-item.error   .roiq-step-num { background: var(--roiq-red-dim); border-color: var(--roiq-red-border); color: var(--roiq-red); }
.roiq-step-item.active  .roiq-step-num { background: var(--roiq-brand); border-color: var(--roiq-brand); color: #1C0F00; }

.roiq-step-name  { font-size: 0.82rem; font-weight: 600; line-height: 1.1; }
.roiq-step-sub   { font-size: 0.68rem; color: var(--roiq-text-muted); line-height: 1; margin-top: 2px; }
.roiq-step-item.active .roiq-step-sub { color: rgba(252,211,77,0.6); }

.roiq-sidebar-footer {
  margin-top: auto;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid var(--roiq-border);
}
.roiq-sidebar-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.45rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--roiq-text-sub);
  background: var(--roiq-bg-raised);
  border: 1px solid var(--roiq-border-bright);
  border-radius: var(--roiq-radius-sm);
  text-decoration: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.roiq-sidebar-reset:hover {
  background: var(--roiq-red-dim);
  border-color: var(--roiq-red-border);
  color: #fca5a5;
  text-decoration: none;
}

/* ===== Step content area ================================================ */
.roiq-step-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.roiq-step-header h4 {
  color: var(--roiq-text);
  font-weight: 700;
  font-size: 1.2rem;
  margin: 0;
}
.roiq-step-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.roiq-step-badge.required { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.roiq-step-badge.optional { background: var(--roiq-bg-raised); color: var(--roiq-text-muted); border: 1px solid var(--roiq-border-bright); }

.roiq-step-desc {
  color: var(--roiq-text-sub);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
  max-width: 600px;
}

.roiq-parse-ok {
  background: var(--roiq-green-dim);
  border: 1px solid var(--roiq-green-border);
  border-radius: var(--roiq-radius-sm);
  padding: 0.5rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: #86efac;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.roiq-parse-skip {
  background: var(--roiq-amber-dim);
  border: 1px solid var(--roiq-amber-border);
  border-radius: var(--roiq-radius-sm);
  padding: 0.5rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: #fcd34d;
}
.roiq-parse-error {
  background: var(--roiq-red-dim);
  border: 1px solid var(--roiq-red-border);
  border-radius: var(--roiq-radius-sm);
  padding: 0.65rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: #fca5a5;
}
.roiq-parse-stats {
  background: var(--roiq-bg-raised);
  border: 1px solid var(--roiq-border);
  border-radius: var(--roiq-radius-sm);
  padding: 0.55rem 1rem;
  margin-bottom: 1.2rem;
  font-size: 0.82rem;
  color: var(--roiq-text-sub);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.roiq-reparse-hint {
  font-size: 0.72rem;
  color: var(--roiq-text-muted);
  margin-left: auto;
}

.roiq-form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* ===== Remove roiq-card max-width restriction in step forms ============== */
#roiq-content .roiq-card { max-width: none; }

/* ===== Input mode tab toggle (Upload / Paste) =========================== */
.roiq-input-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--roiq-border-bright);
  border-radius: var(--roiq-radius-sm);
  overflow: hidden;
  width: fit-content;
}
.roiq-input-tab {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0.3rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--roiq-text-sub) !important;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.roiq-input-tab + .roiq-input-tab {
  border-left: 1px solid var(--roiq-border-bright) !important;
}
.roiq-input-tab.active {
  background: var(--roiq-brand-glow) !important;
  color: var(--roiq-brand-light) !important;
}
.roiq-input-tab:hover:not(.active) {
  background: rgba(255,255,255,0.04) !important;
  color: var(--roiq-text) !important;
}

/* ===== Paste content textarea =========================================== */
.roiq-paste-area {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  background-color: var(--roiq-bg-input) !important;
  border-color: rgba(245,158,11,0.3) !important;
  color: var(--roiq-text) !important;
  resize: vertical;
}
.roiq-paste-area:focus {
  background-color: var(--roiq-bg-raised) !important;
  border-color: var(--roiq-brand) !important;
  box-shadow: 0 0 0 3px var(--roiq-brand-glow) !important;
}

/* ===== Editable review tables =========================================== */
.roiq-table-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--roiq-text-muted);
  margin-bottom: 0.5rem;
}
.roiq-editable-table-wrap {
  border: 1px solid var(--roiq-border);
  border-radius: var(--roiq-radius-sm);
  overflow: auto;
  max-height: 420px;
}
.roiq-editable-table thead th {
  position: sticky;
  top: 0;
  background: var(--roiq-bg-raised) !important;
  z-index: 1;
  white-space: nowrap;
}
.roiq-cell-input {
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 3px !important;
  color: var(--roiq-text) !important;
  font-size: 0.83rem;
  padding: 2px 6px !important;
  width: 100%;
  min-width: 80px;
  transition: border-color 0.1s, background 0.1s;
}
.roiq-cell-input:hover {
  border-color: var(--roiq-border-bright) !important;
  background: var(--roiq-bg-raised) !important;
}
.roiq-cell-input:focus {
  outline: none !important;
  border-color: var(--roiq-brand) !important;
  background: rgba(245,158,11,0.07) !important;
  box-shadow: none !important;
}

/* Read-only identifier cell — muted text, no interaction */
.roiq-cell-static {
  display: block;
  font-size: 0.83rem;
  padding: 2px 6px;
  color: var(--roiq-text-muted);
  white-space: nowrap;
  user-select: text;
}

/* Dropdown cell — matches roiq-cell-input look */
.roiq-cell-select {
  appearance: auto;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 3px !important;
  color: var(--roiq-text) !important;
  font-size: 0.83rem;
  padding: 2px 4px !important;
  width: 100%;
  min-width: 140px;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}
.roiq-cell-select:hover {
  border-color: var(--roiq-border-bright) !important;
  background: var(--roiq-bg-raised) !important;
}
.roiq-cell-select:focus {
  outline: none !important;
  border-color: var(--roiq-brand) !important;
  background: rgba(245,158,11,0.07) !important;
  box-shadow: none !important;
}

/* Free-text input shown when "Other…" is selected in a dropdown */
.roiq-cell-other-input {
  background: transparent !important;
  border: 1px solid var(--roiq-border-bright) !important;
  border-radius: 3px !important;
  color: var(--roiq-text) !important;
  font-size: 0.83rem;
  padding: 2px 6px !important;
  width: 100%;
  margin-top: 3px;
  transition: border-color 0.1s, background 0.1s;
}
.roiq-cell-other-input:focus {
  outline: none !important;
  border-color: var(--roiq-brand) !important;
  background: rgba(245,158,11,0.07) !important;
  box-shadow: none !important;
}

/* Hint text next to table section label */
.roiq-table-hint {
  font-size: 0.72rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--roiq-text-muted);
  margin-left: 0.5rem;
}

/* Invalid price field highlight */
.roiq-price-invalid {
  border-color: #ef4444 !important;
  background: rgba(239,68,68,0.08) !important;
}
.roiq-price-invalid:focus {
  border-color: #ef4444 !important;
  background: rgba(239,68,68,0.12) !important;
}

/* ===== Config load / save UI ============================================ */
.roiq-config-load-section {
  border-top: 3px solid var(--roiq-green);
  margin-bottom: 1.25rem;
}

.roiq-divider-or {
  text-align: center;
  font-size: 0.75rem;
  color: var(--roiq-text-muted);
  padding: 0.5rem 0;
  border-top: 1px solid var(--roiq-border);
}

.roiq-config-saved-notice {
  color: #86efac;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ===== Remix Analysis — collapsible sections ============================ */
.roiq-remix-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.85rem;
  font-weight: 600;
  border-top: 3px solid transparent;
  border-bottom: 1px solid var(--roiq-border);
  transition: background 0.12s;
  user-select: none;
}
.roiq-remix-summary::-webkit-details-marker { display: none; }
.roiq-remix-summary::before {
  content: "▶";
  font-size: 0.6rem;
  transition: transform 0.18s;
  color: var(--roiq-text-muted);
}
details[open] > .roiq-remix-summary::before { transform: rotate(90deg); }
.roiq-remix-summary:hover { background: rgba(255,255,255,0.03); }

.roiq-remix-vr   { border-top-color: var(--roiq-brand); color: var(--roiq-brand-light); }
.roiq-remix-out  { border-top-color: #c06868; color: #c98888; }
.roiq-remix-in   { border-top-color: #d4893a; color: #e0a050; }
.roiq-remix-cost { border-top-color: #22c55e; color: #86efac; }
.roiq-remix-pred { border-top-color: #8b5cf6; color: #a78bfa; }

details { margin-bottom: 0; }
details > div.p-3 {
  border-left: 1px solid var(--roiq-border);
  border-right: 1px solid var(--roiq-border);
  border-bottom: 1px solid var(--roiq-border);
}

/* ===== Remix subsection headers ========================================= */
.roiq-remix-subsection-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--roiq-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--roiq-border);
}

/* ===== KPI cards ========================================================= */
.roiq-kpi-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.roiq-kpi-card {
  background: var(--roiq-bg-raised);
  border: 1px solid var(--roiq-border);
  border-radius: var(--roiq-radius-sm);
  padding: 0.6rem 1rem;
  min-width: 140px;
  text-align: center;
}
.roiq-kpi-card-alert { border-color: var(--roiq-red-border); }
.roiq-kpi-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--roiq-text);
  line-height: 1.2;
}
.roiq-kpi-label {
  font-size: 0.68rem;
  color: var(--roiq-text-muted);
  margin-top: 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===== Remix tag row (feature badges) ==================================== */
.roiq-remix-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}
.roiq-badge-remix-out {
  background: rgba(192,104,104,0.12);
  color: #c98888;
  border: 1px solid rgba(192,104,104,0.3);
  font-size: 0.68rem;
  font-weight: 400;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
}

/* ===== roiq-main: no padding (layout handles it) ========================= */


/* ===== Blob upload progress bar ========================================== */
.roiq-upload-bar-wrap {
  background: var(--roiq-bg-raised);
  border: 1px solid var(--roiq-border);
  border-radius: var(--roiq-radius-sm);
  height: 6px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}
.roiq-upload-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--roiq-brand), var(--roiq-brand-light));
  border-radius: var(--roiq-radius-sm);
  transition: width 0.15s ease-out;
}
.roiq-upload-label {
  font-size: 0.78rem;
  color: var(--roiq-text-sub);
  margin-bottom: 0.75rem;
}

/* ===== Upload debug panel ================================================= */
.roiq-debug-panel {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 440px;
  max-height: 260px;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 6px;
  font-size: 0.70rem;
  font-family: ui-monospace, SFMono-Regular, monospace;
  z-index: 9999;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.roiq-debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 10px;
  background: #1f2937;
  border-bottom: 1px solid #374151;
  font-weight: 600;
  color: #9ca3af;
  font-size: 0.72rem;
}
.roiq-debug-close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}
.roiq-debug-close:hover { color: #d1d5db; }
.roiq-debug-entries {
  overflow-y: auto;
  padding: 6px 10px;
  flex: 1;
}
.roiq-debug-entry { line-height: 1.6; padding: 0; word-break: break-all; }
.roiq-debug-entry.info  { color: #93c5fd; }
.roiq-debug-entry.ok    { color: #6ee7b7; }
.roiq-debug-entry.error { color: #fca5a5; }
.roiq-debug-entry.warn  { color: #fcd34d; }

/* ── HubSpot gate: lock zone, modal, verified badge ──────────────────────── */

.roiq-gate-lock {
  border: 1px dashed #4b5563;
  border-radius: 8px;
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: rgba(99,102,241,0.04);
}

.roiq-gate-lock:hover {
  border-color: #6366f1;
  background: rgba(99,102,241,0.08);
}

.roiq-gate-lock:hover .roiq-gate-lock-icon,
.roiq-gate-lock:hover .roiq-gate-lock-text { color: #a5b4fc; }

.roiq-gate-lock-icon {
  width: 32px;
  height: 32px;
  color: #6b7280;
  margin: 0 auto 0.6rem;
  display: block;
  transition: color 0.2s;
}

.roiq-gate-lock-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: #9ca3af;
  margin-bottom: 0.3rem;
  transition: color 0.2s;
}

.roiq-gate-lock-hint {
  font-size: 0.75rem;
  color: #6b7280;
}

/* verified badge — shown inline beside action buttons after unlock */
.roiq-verified-badge {
  display: none;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4ade80;
  background: rgba(74,222,128,0.1);
  border: 1px solid rgba(74,222,128,0.25);
  border-radius: 4px;
  padding: 0.25rem 0.65rem;
}

/* modal backdrop */
.roiq-verify-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1050;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: roiqFadeIn 0.2s ease;
}

.roiq-verify-modal.open { display: flex; }

@keyframes roiqFadeIn { from { opacity: 0; } to { opacity: 1; } }

.roiq-modal-card {
  background: #1e2433;
  border: 1px solid #374151;
  border-radius: 10px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 60px rgba(0,0,0,0.5);
  animation: roiqSlideUp 0.25s ease;
  padding: 2.25rem 2.25rem 2rem;
  position: relative;
}

@keyframes roiqSlideUp {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.roiq-modal-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

.roiq-modal-close:hover { background: #374151; color: #e5e7eb; }

.roiq-modal-eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #818cf8;
  margin-bottom: 0.45rem;
}

.roiq-modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 0.4rem;
  line-height: 1.25;
}

.roiq-modal-desc {
  font-size: 0.82rem;
  color: #9ca3af;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.roiq-modal-divider {
  height: 1px;
  background: #374151;
  margin-bottom: 1.5rem;
}

#roiq-hs-form-container { min-height: 160px; }


/* ===== Font ============================================================== */
body { font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* ===== Sidebar Jump-To section ========================================== */
.roiq-sb-jumpto {
  padding: 0.35rem 0;
  border-top: 1px solid var(--roiq-border);
  margin-top: 0.25rem;
}
.roiq-sb-jumpto-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--roiq-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 1rem 0.2rem;
}
.roiq-sb-jumpto-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.38rem 1rem;
  font-size: 0.78rem;
  color: var(--roiq-text-sub);
  cursor: pointer;
  border-radius: 0;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
}
.roiq-sb-jumpto-link:hover { background: rgba(255,255,255,.04); color: var(--roiq-text); }
.roiq-sb-jumpto-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== KPI summary cards ================================================ */
.roiq-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 1.25rem;
}
@media (max-width: 900px) {
  .roiq-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
.roiq-kpi-card {
  background: var(--roiq-bg-card);
  border: 1px solid var(--roiq-border);
  border-radius: 9px;
  padding: 14px 16px;
}
.roiq-kpi-card.warn  { border-color: var(--roiq-amber-border); }
.roiq-kpi-card.danger{ border-color: var(--roiq-red-border); }
.roiq-kpi-card.info  { border-color: var(--roiq-blue-border); }
.roiq-kpi-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--roiq-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.roiq-kpi-val {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 3px;
}
.roiq-kpi-val.amber { color: var(--roiq-brand-light); }
.roiq-kpi-val.red   { color: var(--roiq-red); }
.roiq-kpi-val.blue  { color: var(--roiq-blue); }
.roiq-kpi-val.green { color: var(--roiq-green); }
.roiq-kpi-sub {
  font-size: 0.7rem;
  color: var(--roiq-text-muted);
}

/* ===== Table value colour helpers ======================================= */
.roiq-val-red    { color: var(--roiq-red)    !important; font-weight: 600; }
.roiq-val-orange { color: var(--roiq-orange) !important; font-weight: 600; }
.roiq-val-amber  { color: var(--roiq-brand-light) !important; font-weight: 600; }
