/* ==========================================================================
   CREED8 LOOP DIAGNOSTIC - DESIGN SYSTEM & VISUAL STYLING
   Visual Tone: Optimistic Retro-Futurism (Sleek, Geometric, Breathable)
   ========================================================================== */

/* --- Custom Property Configuration --- */
:root {
  --primary-teal: #2C7A7B;
  --secondary-teal: #38B2AC;
  --accent-coral: #FF6B6B;
  /* Loop-state colors (brand-locked: status only, never the CTA) */
  --bad-amber: #EF9F27;
  --broken-red: #E24B4A;
  --dark-neutral: #2D2D2D;
  --light-neutral: #F8F9FA;
  --off-white: #FCFDFD;
  --glass-bg: rgba(252, 253, 253, 0.85);
  --glass-border: rgba(56, 178, 172, 0.25);
  --soft-shadow: 0 12px 36px rgba(45, 45, 45, 0.08);
  --glow-shadow: 0 0 20px rgba(56, 178, 172, 0.4);
  --coral-glow: 0 0 20px rgba(255, 107, 107, 0.3);
  
  --font-headings: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  
  --transition-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Global Reset & Architectural Foundations --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

body {
  font-family: var(--font-body);
  background-color: var(--light-neutral);
  color: var(--dark-neutral);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  position: relative;
  line-height: 1.6;
}

/* Inside the /audit iframe the page sizes to its content (app.js reports the
   height to the parent), so drop the full-viewport stretch. */
.is-embedded body { min-height: 0; }
.is-embedded .app-wrapper { flex-grow: 0; }

/* Custom Styled Scrollbar for premium visual look inside iframes */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(56, 178, 172, 0.05);
}
::-webkit-scrollbar-thumb {
  background: rgba(44, 122, 123, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-teal);
}

/* --- Optimistic Retro-Futurism Elements --- */
/* Digital blueprint grid background */
.retro-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    linear-gradient(rgba(56, 178, 172, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 178, 172, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center center;
  z-index: -3;
  pointer-events: none;
}

/* Ambient glowing geometric orbs */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(64px);
  z-index: -2;
  opacity: 0.45;
  pointer-events: none;
  animation: floatOrb 12s ease-in-out infinite alternate;
  will-change: transform;
}

.main-orb {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(56, 178, 172, 0.25) 0%, transparent 70%);
  top: -10%;
  right: -10%;
}

.secondary-orb {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(44, 122, 123, 0.16) 0%, transparent 70%);
  bottom: -10%;
  left: -10%;
  animation-delay: -6s;
}

@keyframes floatOrb {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(20px) scale(1.1); }
}

/* Respect reduced-motion: hold background/loaders still */
@media (prefers-reduced-motion: reduce) {
  .glow-orb, .pulse-dot::after, .infinity-node-dot, .neon-pulse::after,
  .infinity-glow, .card.active { animation: none !important; }
}

/* --- Layout Wrapper --- */
.app-wrapper {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* --- Brand Header Section --- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(56, 178, 172, 0.1);
}

.logo-wrapper {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  margin-bottom: 4px !important;
  flex-wrap: nowrap !important;
  text-decoration: none !important;
  transition: opacity 0.2s ease;
}
.logo-wrapper:hover { opacity: 0.82; }

.brand-logo-img {
  width: 96px !important;
  height: 96px !important;
  max-width: 96px !important;
  max-height: 96px !important;
  object-fit: contain !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
}

.brand-text-logo-img {
  width: 210px !important;
  height: 38px !important;
  max-width: 210px !important;
  max-height: 38px !important;
  object-fit: contain !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
}

.report-logo-wrapper {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
  text-decoration: none !important;
  transition: opacity 0.2s ease;
}
.report-logo-wrapper:hover { opacity: 0.82; }

.report-logo-img {
  width: 60px !important;
  height: 60px !important;
  max-width: 60px !important;
  max-height: 60px !important;
  object-fit: contain !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
}

.report-text-logo-img {
  width: 130px !important;
  height: 24px !important;
  max-width: 130px !important;
  max-height: 24px !important;
  object-fit: contain !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
}

.brand-tagline {
  font-size: 0.95rem;
  color: #718096;
  font-weight: 500;
  margin-top: 2px;
}

.status-badge {
  display: flex;
  align-items: center;
  background-color: var(--off-white);
  border: 1.5px solid var(--secondary-teal);
  padding: 8px 16px;
  border-radius: 30px;
  box-shadow: 0 4px 12px rgba(56, 178, 172, 0.08);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--secondary-teal);
  border-radius: 50%;
  margin-right: 10px;
  position: relative;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: var(--secondary-teal);
  animation: pulseGlow 1.8s infinite ease-in-out;
}

@keyframes pulseGlow {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}

.badge-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--primary-teal);
}

/* --- Progress Bar Section --- */
.progress-bar-container {
  margin-bottom: 32px;
}

.progress-steps-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.step-num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--primary-teal);
  font-weight: 600;
}

.step-title-display {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark-neutral);
}

.progress-track {
  width: 100%;
  height: 6px;
  background-color: rgba(56, 178, 172, 0.1);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-teal), var(--secondary-teal));
  border-radius: 10px;
  transition: width 0.4s ease-out;
}

/* --- Card Deck Core Architecture --- */
.diagnostic-container {
  flex-grow: 1;
  position: relative;
  display: flex;
  flex-direction: column;
}

.card-deck {
  position: relative;
  width: 100%;
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.card {
  display: none;
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  border-radius: 16px;
  padding: 48px;
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  position: relative;
  transform-origin: center center;
}

.card.active {
  display: flex;
  animation: cardFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Slide animations for step transitions */
.slide-out-left {
  animation: slideOutLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.slide-in-right {
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes slideOutLeft {
  to { opacity: 0; transform: translateX(-40px); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* --- Step Content Headers --- */
.card-header {
  margin-bottom: 32px;
  position: relative;
}

.node-id {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: bold;
  color: rgba(56, 178, 172, 0.15);
  line-height: 1;
  position: absolute;
  top: -24px;
  left: 0;
  user-select: none;
}

.node-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--secondary-teal);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
  margin-top: 16px;
}

.card-title {
  font-family: var(--font-headings);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--dark-neutral);
  line-height: 1.35;
  margin-top: 4px;
  letter-spacing: -0.3px;
}

.card-subtitle {
  font-size: 1.05rem;
  color: #5A6A80;
  margin-top: 16px;
  max-width: 720px;
}

/* --- Form Fields (Entry Node) --- */
.form-group {
  margin-bottom: 32px;
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--dark-neutral);
  margin-bottom: 10px;
}

.text-input {
  width: 100%;
  padding: 16px 20px;
  border-radius: 10px;
  border: 2px solid rgba(56, 178, 172, 0.2);
  background-color: var(--off-white);
  color: var(--dark-neutral);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: var(--transition-fast);
  outline: none;
}

.text-input:focus {
  border-color: var(--secondary-teal);
  box-shadow: var(--glow-shadow);
}

.text-input:disabled {
  background-color: #E2E8F0;
  border-color: rgba(56, 178, 172, 0.1);
  color: #A0AEC0;
  cursor: not-allowed;
}

/* Custom Checkbox Design */
.setup-bypass-container {
  margin-top: 12px;
}

.checkbox-container {
  display: inline-flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  color: #4A5568;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: relative;
  height: 20px;
  width: 20px;
  background-color: var(--off-white);
  border: 2px solid rgba(56, 178, 172, 0.3);
  border-radius: 5px;
  margin-right: 10px;
  transition: var(--transition-fast);
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--secondary-teal);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--secondary-teal);
  border-color: var(--secondary-teal);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 6px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-text {
  font-weight: 500;
}

/* Stage Selectors (Growth Focus Profile) */
.growth-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
}

.stage-button {
  background-color: var(--off-white);
  border: 2px solid rgba(56, 178, 172, 0.2);
  border-radius: 12px;
  padding: 20px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: var(--transition-smooth);
}

.stage-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  margin-bottom: 10px;
  border-radius: 8px;
  transition: var(--transition-fast);
}

.stage-button:hover .stage-img,
.stage-button.active .stage-img {
  transform: scale(1.06);
}

.stage-title {
  font-family: var(--font-headings);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dark-neutral);
  margin-bottom: 4px;
}

.stage-desc {
  font-size: 0.8rem;
  color: #718096;
  font-weight: 500;
}

.stage-button:hover {
  border-color: var(--secondary-teal);
  transform: translateY(-2px);
  box-shadow: var(--soft-shadow);
}

.stage-button.active {
  border-color: var(--primary-teal);
  background-color: rgba(56, 178, 172, 0.05);
  box-shadow: var(--glow-shadow);
}

.stage-button.active .stage-icon {
  transform: scale(1.15);
}

/* --- Options Container (Steps 1 to 4) --- */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.option-btn {
  background: var(--off-white);
  border: 2px solid rgba(56, 178, 172, 0.15);
  border-radius: 12px;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-smooth);
  width: 100%;
  outline: none;
}

.option-badge {
  font-family: var(--font-mono);
  background-color: rgba(56, 178, 172, 0.1);
  color: var(--primary-teal);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  margin-right: 20px;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.option-content {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--dark-neutral);
  font-weight: 500;
  line-height: 1.45;
}

.option-btn:hover {
  border-color: var(--secondary-teal);
  box-shadow: var(--soft-shadow);
  transform: translateX(4px);
}

.option-btn:hover .option-badge {
  background-color: var(--secondary-teal);
  color: white;
  box-shadow: 0 0 10px rgba(56, 178, 172, 0.3);
}

.option-btn:focus {
  border-color: var(--secondary-teal);
  box-shadow: var(--glow-shadow);
}

/* Keyboard shortcut map panel */
.keyboard-guide {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #718096;
  text-align: center;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.kbd-key {
  background-color: var(--off-white);
  border: 1.5px solid rgba(56, 178, 172, 0.3);
  border-radius: 4px;
  padding: 2px 6px;
  font-weight: bold;
  box-shadow: 0 2px 0 rgba(0,0,0,0.05);
}

/* --- Structural Base Buttons --- */
.primary-btn {
  font-family: var(--font-headings);
  background: linear-gradient(135deg, var(--primary-teal) 0%, var(--secondary-teal) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 18px 32px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--soft-shadow);
  transition: var(--transition-smooth);
  outline: none;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-shadow);
}

.primary-btn:active {
  transform: translateY(0);
}

.btn-arrow {
  margin-left: 10px;
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

.primary-btn:hover .btn-arrow {
  transform: translateX(4px);
}

.secondary-btn {
  font-family: var(--font-headings);
  background-color: transparent;
  color: var(--primary-teal);
  border: 2px solid var(--primary-teal);
  border-radius: 10px;
  padding: 16px 30px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.secondary-btn:hover {
  background-color: rgba(56, 178, 172, 0.05);
  box-shadow: 0 4px 12px rgba(56, 178, 172, 0.05);
}

.utility-btn {
  font-family: var(--font-mono);
  background-color: var(--off-white);
  border: 1.5px solid rgba(56, 178, 172, 0.3);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-teal);
  cursor: pointer;
  transition: var(--transition-fast);
}

.utility-btn:hover {
  border-color: var(--secondary-teal);
  background-color: rgba(56, 178, 172, 0.05);
}

/* Button Pulse Animation */
.neon-pulse {
  position: relative;
  overflow: hidden;
}

.neon-pulse::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to bottom right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(45deg);
  animation: shineReflect 4s infinite linear;
}

@keyframes shineReflect {
  0% { transform: translate(-30%, -30%) rotate(45deg); }
  100% { transform: translate(30%, 30%) rotate(45deg); }
}

/* --- Inline Terminal Viewport (Loading State) --- */
#card-loading {
  padding: 32px;
  min-height: 400px;
}

.terminal-container {
  width: 100%;
  background-color: #1A1A1A;
  border: 2px solid var(--secondary-teal);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--glow-shadow);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.terminal-header {
  background-color: #2D2D2D;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #404040;
  position: relative;
}

.terminal-buttons {
  display: flex;
  gap: 6px;
}

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

.term-dot.close { background-color: #FF5F56; }
.term-dot.minimize { background-color: #FFBD2E; }
.term-dot.expand { background-color: #27C93F; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #A0AEC0;
  margin-left: 20px;
}

.terminal-body {
  padding: 24px;
  font-family: var(--font-mono);
  color: #38B2AC;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  position: relative;
  min-height: 280px;
}

/* Analog CRT monitor scanline texture overlay */
.terminal-body::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  z-index: 2;
  background-size: 100% 4px, 6px 100%;
  pointer-events: none;
}

.spinner-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  margin-top: 10px;
}

/* Infinity Loop Loader */
.infinity-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
  height: 100px;
}
.infinity-loader {
  overflow: visible;
}
.infinity-track {
  stroke-dasharray: none;
}
.infinity-glow {
  opacity: 0.8;
  filter: drop-shadow(0 0 2px rgba(56, 178, 172, 0.3));
}
.infinity-node-dot {
  fill: #38B2AC;
  filter: drop-shadow(0 0 6px #38B2AC);
  offset-path: path("M 100 50 C 75 15, 30 15, 30 50 C 30 85, 75 85, 100 50 C 125 15, 170 15, 170 50 C 170 85, 125 85, 100 50");
  animation: moveNode 2s infinite linear;
}
@keyframes moveNode {
  0% { offset-distance: 0%; }
  100% { offset-distance: 100%; }
}

.terminal-overlay-text {
  text-align: center;
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 24px;
  color: #E2E8F0;
  letter-spacing: 0.5px;
}

.terminal-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex-grow: 1;
  max-height: 180px;
  border-top: 1px dashed rgba(56, 178, 172, 0.2);
  padding-top: 16px;
}

.log-line {
  color: #38B2AC;
  white-space: pre-wrap;
  animation: lineScan 0.15s ease-out;
}

.log-line.warn { color: var(--bad-amber); }
.log-line.success { color: #48BB78; }

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

/* --- Final Report Display Layer --- */
.report-view-wrapper {
  display: flex;
  flex-direction: column;
}

.report-meta-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(56, 178, 172, 0.15);
  padding-bottom: 16px;
  margin-bottom: 32px;
}

.report-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background-color: rgba(56, 178, 172, 0.1);
  color: var(--primary-teal);
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* Markdown rendered report layout details */
.report-markdown-body h1 {
  font-family: var(--font-headings);
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--dark-neutral);
  letter-spacing: -0.5px;
}

.report-markdown-body p {
  font-size: 1.05rem;
  color: #4A5568;
  margin-bottom: 20px;
  line-height: 1.65;
}

.report-markdown-body h2 {
  font-family: var(--font-headings);
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 16px;
  color: var(--dark-neutral);
  letter-spacing: -0.2px;
}

.report-markdown-body h3 {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--dark-neutral);
}

.report-markdown-body hr {
  border: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(56, 178, 172, 0.25) 0%, transparent 100%);
  margin: 32px 0;
}

/* 🟢 Good Loops Highlight Layout */
.report-markdown-body h3:has(span, em, strong, .green, .good-loop), 
.report-markdown-body h3[id*="good"], 
.report-markdown-body h3:contains("🟢") {
  color: var(--primary-teal) !important;
}

/* Format specific sections dynamically */
.report-markdown-body p:has(strong) {
  margin-bottom: 16px;
}

/* --- High-Impact Conversion CTA Block --- */
.report-cta-container {
  background: linear-gradient(135deg, rgba(56, 178, 172, 0.05) 0%, rgba(255, 107, 107, 0.03) 100%);
  border: 2px dashed rgba(56, 178, 172, 0.3);
  border-radius: 16px;
  padding: 40px;
  margin-top: 48px;
  box-shadow: var(--soft-shadow);
}

.cta-heading {
  font-family: var(--font-headings);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--dark-neutral);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
  text-align: center;
}

.cta-subheading {
  font-size: 1rem;
  color: #5A6A80;
  margin-bottom: 32px;
  text-align: center;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.cta-plans-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 40px;
}

.plan-card {
  background-color: var(--off-white);
  border: 1.5px solid rgba(56, 178, 172, 0.15);
  border-radius: 12px;
  padding: 28px;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
}

.plan-header {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.plan-badge {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--secondary-teal);
  font-weight: bold;
  background-color: rgba(56, 178, 172, 0.08);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.plan-badge.text-coral {
  color: var(--primary-teal);
  background-color: rgba(56, 178, 172, 0.1);
}

.plan-title {
  font-family: var(--font-headings);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark-neutral);
}

.plan-text {
  font-size: 0.9rem;
  color: #64748B;
  line-height: 1.5;
  flex-grow: 1;
}

.plan-card.highlight {
  border-color: rgba(56, 178, 172, 0.35);
  box-shadow: 0 8px 24px rgba(56, 178, 172, 0.06);
}

.plan-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--soft-shadow);
}

.plan-card.highlight:hover {
  box-shadow: 0 12px 30px rgba(56, 178, 172, 0.12);
  border-color: var(--secondary-teal);
}

.cta-anchor-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.cta-anchor-actions .primary-btn {
  width: 100%;
  max-width: 500px;
  font-size: 1.05rem;
  padding: 18px 32px;
  /* The single coral element per the brand system: this is THE conversion CTA. */
  background: var(--accent-coral);
  box-shadow: var(--soft-shadow), var(--coral-glow);
}

.cta-secondary-row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 500px;
}

.cta-secondary-row .secondary-btn {
  flex: 1;
  text-align: center;
  padding: 12px 18px;
  font-size: 0.88rem;
  white-space: nowrap;
}

@media (max-width: 580px) {
  .cta-secondary-row {
    flex-direction: column;
    gap: 10px;
  }
  .cta-secondary-row .secondary-btn {
    width: 100%;
  }
}

.cta-anchor-actions .primary-btn:hover {
  box-shadow: var(--soft-shadow), 0 0 28px rgba(255, 107, 107, 0.55);
}

/* --- Application Footer Area --- */
.app-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(56, 178, 172, 0.1);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.footer-links a {
  color: var(--primary-teal);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-fast);
}

.footer-links a:hover {
  color: var(--secondary-teal);
  text-decoration: underline;
}

.footer-divider {
  color: rgba(56, 178, 172, 0.3);
  font-size: 0.8rem;
}

.footer-copy {
  font-size: 0.8rem;
  color: #A0AEC0;
}

/* --- Multi-device Responsive Adaptability --- */
@media (max-width: 768px) {
  .app-wrapper {
    padding: 24px 16px;
  }
  
  .app-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 32px;
  }
  
  .status-badge {
    align-self: flex-start;
  }

  .card {
    padding: 28px 20px;
    min-height: auto;
  }

  .card-title {
    font-size: 1.3rem;
  }

  .growth-selector-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .option-btn {
    padding: 16px 20px;
  }

  .option-badge {
    margin-right: 12px;
    width: 32px;
    height: 32px;
  }

  .option-content {
    font-size: 0.95rem;
  }

  .keyboard-guide {
    display: none; /* Hide on mobile since touch interfaces are primary */
  }

  .cta-plans-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .report-cta-container {
    padding: 24px 16px;
  }
  
  .report-markdown-body h1 {
    font-size: 1.8rem;
  }
}

/* ==========================================================================
   V2 ADDITIONS - AI TOGGLE + STRUCTURED LOOP REPORT
   ========================================================================== */

/* Node id can now hold the infinity mark */
.node-id { font-size: 3rem; }

/* --- AI Enhancement Toggle --- */
.ai-toggle-group {
  background: rgba(56, 178, 172, 0.04);
  border: 1.5px solid rgba(56, 178, 172, 0.18);
  border-radius: 12px;
  padding: 18px 20px;
}
.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  cursor: pointer;
}
.switch-track {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 26px;
  background: #CBD5E0;
  border-radius: 20px;
  transition: var(--transition-fast);
  margin-top: 2px;
}
.switch-track input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: var(--transition-fast);
}
.switch-track input:checked ~ .switch-thumb { transform: translateX(20px); }
.switch-track:has(input:checked) { background: var(--secondary-teal); }
.switch-copy { display: flex; flex-direction: column; gap: 3px; }
.switch-title { font-weight: 600; font-size: 0.95rem; color: var(--dark-neutral); }
.switch-desc { font-size: 0.82rem; color: #718096; line-height: 1.45; }

/* --- Email capture step --- */
.email-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}
.email-footer .primary-btn { width: 100%; }
.text-skip {
  background: none;
  border: none;
  color: #718096;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: var(--transition-fast);
}
.text-skip:hover { color: var(--primary-teal); }

/* --- Report body spacing --- */
#report-content-body { display: flex; flex-direction: column; gap: 8px; }

/* --- Summary (score ring + headline) --- */
.rp-summary {
  display: flex;
  align-items: center;
  gap: 28px;
  padding-bottom: 28px;
  border-bottom: 2px solid rgba(56, 178, 172, 0.12);
  margin-bottom: 8px;
}
.rp-score-ring {
  flex-shrink: 0;
  width: 128px; height: 128px;
  border-radius: 50%;
  background: conic-gradient(var(--secondary-teal) calc(var(--pct) * 1%), rgba(56,178,172,0.12) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(56,178,172,0.15);
}
.rp-score-inner {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: var(--off-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.rp-score-num { font-family: var(--font-headings); font-size: 2.6rem; font-weight: 800; color: var(--primary-teal); line-height: 1; }
.rp-score-of { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; color: #718096; margin-top: 4px; }
.rp-summary-text { flex: 1; }
.rp-title { font-family: var(--font-headings); font-size: 1.9rem; font-weight: 800; color: var(--dark-neutral); letter-spacing: -0.5px; margin-bottom: 2px; }
.rp-site { font-family: var(--font-mono); font-size: 0.85rem; color: var(--secondary-teal); margin-bottom: 12px; word-break: break-all; }
.rp-headline { font-size: 1.05rem; color: #4A5568; line-height: 1.55; margin-bottom: 12px; }
.rp-compression { display: inline-block; font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.5px; color: var(--primary-teal); background: rgba(56,178,172,0.08); padding: 6px 12px; border-radius: 6px; }

/* --- Scan facts strip --- */
.rp-scanfacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 20px 0 4px;
}
.rp-fact {
  background: var(--off-white);
  border: 1.5px solid rgba(56,178,172,0.12);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rp-fact.tone-ok { border-left-color: #48BB78; }
.rp-fact.tone-warn { border-left-color: #ECC94B; }
.rp-fact.tone-bad { border-left-color: var(--broken-red); }
.rp-fact.tone-info { border-left-color: var(--secondary-teal); }
.rp-fact-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.6px; color: #718096; font-weight: 600; }
.rp-fact-val { font-size: 0.95rem; font-weight: 600; color: var(--dark-neutral); }
.rp-scannote { grid-column: 1 / -1; font-size: 0.85rem; color: #718096; font-style: italic; margin-top: 4px; }

/* --- Analytics / under the hood --- */
.rp-analytics {
  margin-top: 20px;
  background: #F1F8F8;
  border: 1px solid rgba(56,178,172,0.22);
  border-radius: 12px;
  padding: 18px 20px;
}
.rp-analytics-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-teal);
  margin-bottom: 12px;
}
.rp-analytics-rows {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin-bottom: 12px;
}
.rp-analytics-row { display: flex; flex-direction: column; gap: 2px; }
.rp-analytics-k { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.5px; color: #8A9299; font-weight: 600; }
.rp-analytics-v { font-size: 0.98rem; font-weight: 600; color: var(--dark-neutral); }
.rp-analytics-note { font-size: 0.92rem; color: #4A5568; line-height: 1.55; margin: 0; }

/* --- Email confirmation banner --- */
.rp-email-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary-teal);
  background: rgba(56,178,172,0.08);
  border: 1px solid rgba(56,178,172,0.25);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 24px;
}
.rp-email-confirm::before { content: '✉'; font-size: 1rem; }

/* --- Disclaimer --- */
.rp-disclaimer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px dashed rgba(56,178,172,0.25);
  font-size: 0.82rem;
  line-height: 1.55;
  color: #8A9299;
  font-style: italic;
}

/* --- Sections --- */
.rp-section { margin-top: 36px; }
.rp-section-title { font-family: var(--font-headings); font-size: 1.4rem; font-weight: 700; color: var(--dark-neutral); letter-spacing: -0.2px; margin-bottom: 6px; }
.rp-section-sub { font-size: 0.98rem; color: #5A6A80; margin-bottom: 20px; line-height: 1.55; max-width: 760px; }

/* --- Loop grid --- */
.rp-loop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rp-loop-card {
  background: var(--off-white);
  border: 1.5px solid rgba(56,178,172,0.14);
  border-top: 4px solid rgba(56,178,172,0.3);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rp-loop-head { display: flex; align-items: center; gap: 10px; }
.rp-loop-num { font-family: var(--font-mono); font-size: 0.85rem; color: #A0AEC0; font-weight: 700; }
.rp-loop-name { font-family: var(--font-headings); font-size: 1.05rem; font-weight: 700; color: var(--dark-neutral); flex: 1; }
.rp-loop-pill { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; padding: 4px 9px; border-radius: 20px; white-space: nowrap; }
.rp-loop-flow { font-family: var(--font-mono); font-size: 0.72rem; color: #94A3B8; line-height: 1.5; }
.rp-loop-finding { font-size: 0.92rem; color: #4A5568; line-height: 1.55; }

.rp-loop-card.st-strong { border-top-color: #48BB78; }
.rp-loop-card.st-strong .rp-loop-pill { background: rgba(72,187,120,0.12); color: #2F855A; }
.rp-loop-card.st-watch { border-top-color: #ECC94B; }
.rp-loop-card.st-watch .rp-loop-pill { background: rgba(214,158,46,0.14); color: #B7791F; }
.rp-loop-card.st-break { border-top-color: var(--broken-red); }
.rp-loop-card.st-break .rp-loop-pill { background: rgba(226,75,74,0.14); color: #C53030; }
.rp-loop-card.st-unknown { border-top-color: #CBD5E0; }
.rp-loop-card.st-unknown .rp-loop-pill { background: rgba(160,174,192,0.16); color: #718096; }

/* --- Breaks --- */
.rp-break-list { display: flex; flex-direction: column; gap: 14px; }
.rp-break-item {
  background: var(--off-white);
  border: 1.5px solid rgba(226,75,74,0.16);
  border-left: 5px solid var(--broken-red);
  border-radius: 10px;
  padding: 18px 22px;
}
.rp-break-item.sev-medium { border-left-color: #ECC94B; border-color: rgba(214,158,46,0.16); }
.rp-break-item.sev-low { border-left-color: #A0AEC0; border-color: rgba(160,174,192,0.16); }
.rp-break-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.rp-break-type { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700; color: var(--broken-red); background: rgba(226,75,74,0.1); padding: 3px 8px; border-radius: 5px; }
.rp-break-item.sev-medium .rp-break-type { color: #B7791F; background: rgba(214,158,46,0.12); }
.rp-break-item.sev-low .rp-break-type { color: #718096; background: rgba(160,174,192,0.14); }
.rp-break-title { font-family: var(--font-headings); font-size: 1.05rem; font-weight: 700; color: var(--dark-neutral); }
.rp-break-impact { font-size: 0.92rem; color: #4A5568; line-height: 1.6; }

/* --- L.O.O.P. method roadmap --- */
.rp-loop-method { display: flex; flex-direction: column; gap: 14px; }
.rp-method-block {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 18px;
  background: var(--off-white);
  border: 1.5px solid rgba(56,178,172,0.14);
  border-radius: 12px;
  padding: 20px 22px;
  align-items: start;
}
.rp-method-head { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rp-method-letter {
  font-family: var(--font-headings);
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  width: 46px; height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-teal), var(--secondary-teal));
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow-shadow);
}
.rp-method-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700; color: var(--primary-teal); }
.rp-method-body { display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
.rp-method-line { font-size: 0.94rem; color: #4A5568; line-height: 1.55; }
.rp-method-line::before { content: '→ '; color: var(--secondary-teal); font-weight: 700; }
.rp-method-block:first-child .rp-method-line::before,
.rp-method-block:last-child .rp-method-line::before { content: ''; }

@media (max-width: 768px) {
  .rp-summary { flex-direction: column; text-align: center; gap: 18px; }
  .rp-loop-grid { grid-template-columns: 1fr; }
  .rp-site { text-align: center; }
  .rp-method-block { grid-template-columns: 48px 1fr; gap: 12px; padding: 16px; }
  .rp-method-letter { width: 40px; height: 40px; font-size: 1.3rem; }
}

.cta-contact-info {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #718096;
}

.phone-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(56, 178, 172, 0.1);
  color: var(--primary-teal);
  flex-shrink: 0;
}

.phone-label {
  color: #718096;
  font-weight: 500;
}

.phone-link {
  color: var(--primary-teal);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: var(--transition-fast);
}

.phone-link:hover {
  color: var(--secondary-teal);
  text-decoration: underline;
}

/* --- AI Coming Soon Badge --- */
.ai-coming-soon-group {
  margin-top: 10px;
}

.ai-coming-soon-badge {
  display: flex;
  flex-direction: column;
  background: rgba(56, 178, 172, 0.05);
  border: 1px dashed rgba(56, 178, 172, 0.4);
  border-radius: 12px;
  padding: 16px 20px;
  position: relative;
}

/* Title and pill share one flex row so the pill stays vertically centered on
   the title instead of floating in the corner of the box. */
.ai-badge-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.ai-coming-soon-badge .ai-title {
  font-family: var(--font-headings);
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary-teal);
}

.badge-pill {
  background-color: var(--secondary-teal);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  line-height: 1.5;
}

.ai-coming-soon-badge .ai-desc {
  font-size: 0.85rem;
  color: #718096;
  line-height: 1.4;
}

/* --- Entry card disclaimer (under the Run my audit button) --- */
.entry-disclaimer {
  margin-top: 14px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #8A9299;
  max-width: 560px;
}
.entry-disclaimer a {
  color: var(--primary-teal);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.entry-disclaimer a:hover { color: var(--secondary-teal); }

/* --- Multi-Category Breakdown --- */
.rp-summary-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 32px;
}

.rp-category-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px dashed rgba(56, 178, 172, 0.2);
}

.rp-cat-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rp-cat-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark-neutral);
}

.rp-cat-track {
  width: 100%;
  height: 8px;
  background-color: rgba(56, 178, 172, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.rp-cat-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease-out;
}

@media (max-width: 580px) {
  .rp-summary-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }
  .rp-category-breakdown {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   PRINT & PDF DOWNLOAD LAYOUT SYSTEM
   ========================================================================== */
@media print {
  html, body {
    background: #ffffff !important;
    color: #1A202C !important;
    overflow: visible !important;
    height: auto !important;
  }
  .retro-grid, .glow-orb, .app-header, .progress-bar-container, .card:not(#card-report), .report-actions, .app-footer {
    display: none !important;
  }
  .app-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }
  .card#card-report {
    display: block !important;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .rp-loop-card, .rp-break-item, .rp-method-block, .rp-fact, .plan-card { break-inside: avoid; page-break-inside: avoid; }
  .rp-section-title, .rp-title { page-break-after: avoid; }
  .rp-loop-grid { grid-template-columns: 1fr 1fr !important; }
  .report-cta-container { background: none !important; border: 1px solid #ccc !important; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}
