:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);
    
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-primary: #6366f1;
    --accent-hover: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    
    --success: #10b981;
    --danger: #ef4444;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Outfit', 'Inter', sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --shadow-card: 0 20px 40px -15px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(168, 85, 247, 0.12) 0%, transparent 40%);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-0: 0;
}

/* DESIGN-FIX-001: skip-link, shared by index.html and business/index.html —
   same pattern already shipping on business/how-it-works/how-it-works.css,
   reused here (not reinvented) so all three public pages behave identically
   for keyboard users. Hidden until focused; the target anchor already
   exists on each page (#mainContent / #b2bMain). */
.skip-link {
    position: absolute;
    top: -48px;
    left: 12px;
    z-index: 100;
    background: var(--accent-primary);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 12px;
}

@media (prefers-reduced-motion: reduce) {
    .skip-link {
        transition: none;
    }
}

.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 40px;
}

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

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.logo-text {
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: linear-gradient(180deg, #ffffff 0%, #d1d5db 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-tag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* B2B-LANDING-001: header link to the corporate page — additive only. */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* B2B-MANIFEST-001-FIX-01: the visual treatment now comes entirely from
   the existing .btn-secondary component (applied alongside this class in
   index.html) — this rule only adds what an <a> needs that a <button>
   already gets for free, so the two classes compose cleanly instead of
   fighting over color/padding/radius/font/transition. */
.business-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    white-space: nowrap;
}

.business-link:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.lang-select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.lang-select:hover, .lang-select:focus {
    border-color: var(--border-focus);
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 40px;
}

/* CHG-UI-001: small brand overline above the H1 — replaces the former
   "Demo MVP" pill badge. Same class selector kept free of the old pill
   chrome (no background/border) so it reads as a quiet kicker, not a tag. */
.hero-overline {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #c084fc;
    margin-bottom: 16px;
}

.hero-section h1 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 28px;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

/* CHG-UI-001: the Insight -> Matrix -> Movement narrative. Deliberately NOT
   three separate .card boxes — a single flowing reveal, each step marked
   only by a small numbered label, connected by a thin rule so the eye reads
   top-to-bottom as one continuous thought rather than three modules. */
.hero-narrative {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 620px;
    margin: 0 auto;
    text-align: left;
    counter-reset: narrative-step;
}

.narrative-step {
    padding-left: 20px;
    border-left: 2px solid rgba(168, 85, 247, 0.35);
    counter-increment: narrative-step;
}

.narrative-step-label {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.narrative-step-label::before {
    content: counter(narrative-step, decimal-leading-zero) " — ";
    color: #c084fc;
}

.narrative-step-body {
    color: var(--text-primary);
    font-size: 1.02rem;
    line-height: 1.55;
}

/* Cards & Workspace */
.workspace-section {
    flex: 1;
}

.chatgpt-hint {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.card-header {
    margin-bottom: 24px;
}

.card-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.situation-textarea {
    width: 100%;
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: all 0.2s ease;
}

.situation-textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.tip-box {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-primary {
    background: var(--accent-gradient);
    color: #ffffff;
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

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

/* DESIGN-FIX-001: previously only the inner text span dimmed during
   loading (via inline opacity in app.js) — the button itself kept its full
   gradient/shadow and default cursor, so a disabled submit/answer/confirm
   button still read as clickable. This rule wins over :hover/:active above
   by source order (equal specificity), matching the :disabled pattern
   already used for .b2b-cta-btn / .hiw-final-btn elsewhere in this project. */
.btn-primary:disabled,
.btn-primary:disabled:hover,
.btn-primary:disabled:active {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* SITE-DESIGN-FIX-001-ACCESSIBILITY-FIX (M-1): --border-focus at 0.5 alpha
   composites to ~1.9:1 against the dark surfaces these two buttons render
   on (page background and .card), under WCAG 1.4.11's 3:1 non-text-contrast
   guideline. Scoped to .btn-primary/.btn-secondary only — reuses the
   existing opaque --accent-primary token (already used elsewhere for these
   same buttons' own fill/badges) rather than editing --border-focus, which
   is shared by other already-shipped focus rings (.business-link,
   .hiw-nav-link, etc.) not covered by this fix's authorized scope. */
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Dialog Card / Active State */
.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--success);
}

.context-box {
    background: rgba(11, 15, 25, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.context-box h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.context-text {
    font-size: 1.05rem;
    white-space: pre-wrap;
}

.session-info {
    display: flex;
    gap: 24px;
}

.info-item {
    font-size: 0.875rem;
}

.info-label {
    color: var(--text-muted);
    margin-right: 6px;
}

.info-value {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Alert */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-top: 20px;
    font-size: 0.9rem;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.hidden {
    display: none !important;
}

/* Question & Result Box Styling */
.question-box, .retry-box, .result-box {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.step-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.question-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.answer-textarea {
    width: 100%;
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    margin-bottom: 12px;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.result-card {
    background: rgba(11, 15, 25, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.result-card.highlight {
    grid-column: span 2;
    border-color: rgba(168, 85, 247, 0.4);
    background: rgba(168, 85, 247, 0.08);
}

.result-card.action {
    grid-column: span 2;
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.08);
}

/* DESIGN-FIX-001: replaces the emoji previously used as section markers
   (🎯 👁️ ⚖️ ⚡ 💡 ❓ 🚀) with one calm, uniform CSS marker — same shape/color
   for every card, deliberately not varying by card type, so it reads as
   structure rather than decoration. */
.result-header h3::before,
.result-card h4::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 8px;
    border-radius: 1px;
    background: var(--accent-primary);
    vertical-align: middle;
}

.result-card h4 {
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: #d1d5db;
}

.result-card p, .result-card ul {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.result-card ul {
    padding-left: 18px;
}

/* Footer */
.main-footer {
    text-align: center;
    padding: 24px 0 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Confirm / Correct / Safe Card / Referral (CHG-04-009) */
.text-warning {
    color: #fbbf24;
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.actions-box, .safe-card-panel {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

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

.correction-form {
    margin-top: 16px;
}

.pending-box {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.confirmed-badge {
    margin-top: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
    font-weight: 600;
    font-size: 0.9rem;
}

.panel-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.card-selector-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.selector-group {
    display: flex;
}

.safe-card-display {
    margin-top: 20px;
}

.safe-card-content {
    background: rgba(11, 15, 25, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.safe-card-content h4 {
    color: #d1d5db;
    font-size: 0.9rem;
    margin-top: 12px;
    margin-bottom: 4px;
}

.safe-card-content h4:first-child {
    margin-top: 0;
}

.referral-link-box {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.referral-link-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.referral-link-input {
    flex: 1;
    min-width: 200px;
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
}

.btn-danger {
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
}

/* CHG-UI-001 (corrected in the follow-up patch): wide-screen layout —
   narrative on the left, the form on the right — applies ONLY while
   .main-content carries .entry-layout (plain entry form / referral preview /
   invalid-referral screen). Once a dialog is started or restored,
   .entry-layout is removed by setEntryLayout(false) and .main-content falls
   back to the single-column flow below, so dialogCard/questions/result never
   get squeezed into the narrow right grid track. */
@media (min-width: 960px) {
    .app-container {
        max-width: 1160px;
    }
    .main-content.entry-layout {
        display: grid;
        grid-template-columns: 1.05fr 0.95fr;
        gap: 56px;
        align-items: start;
    }
    .main-content.entry-layout .hero-section {
        text-align: left;
        margin-bottom: 0;
        padding-top: 8px;
    }
    .main-content.entry-layout .hero-narrative {
        margin: 0;
    }
    .main-content.entry-layout .workspace-section {
        position: sticky;
        top: 24px;
    }
}

@media (max-width: 640px) {
    /* CHG-UI-001: compact vertical rhythm so the form is reachable without
       excessive scrolling on real phone heights (risk explicitly flagged in
       the change card: poetic positioning must not push the form below the
       first screen). Targets spacing/gaps, not text legibility. */
    .app-container {
        padding-top: 16px;
    }
    .main-header {
        margin-bottom: 20px;
        /* B2B-LANDING-001: the added business-link (.header-actions now
           holds two items instead of one) no longer fits beside the logo
           on narrow phones without overflowing — let it wrap onto its own
           row instead of clipping/forcing horizontal scroll. */
        flex-wrap: wrap;
        row-gap: 12px;
    }
    .header-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    .hero-overline {
        margin-bottom: 8px;
    }
    .hero-section {
        margin-bottom: 14px;
    }
    .hero-section h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    .hero-narrative {
        gap: 8px;
    }
    .narrative-step {
        padding-left: 14px;
    }
    .narrative-step-label {
        margin-bottom: 2px;
    }
    .narrative-step-body {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    .card {
        padding: 20px;
    }
    .card-header {
        margin-bottom: 14px;
    }
    .situation-textarea {
        height: 110px;
    }
    .form-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-primary {
        justify-content: center;
    }
    .result-grid {
        grid-template-columns: 1fr;
    }
    .result-card.highlight, .result-card.action {
        grid-column: span 1;
    }
    .actions-row, .card-selector-row, .referral-link-row {
        flex-direction: column;
        align-items: stretch;
    }
}
