/* ═══════════════════════════════════════════════════════════════
   THE SIGNAL — Design System  v2.0
   Editorial Medical · Dark-first · CSS-only
   Tokens: tokens.css (imported below)
═══════════════════════════════════════════════════════════════ */

@import './tokens.css';

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'liga' 1, 'calt' 1;
}

/* ── ACCESSIBILITY — Global focus indicator ── */

/* Keyboard focus: visible ring */
:focus-visible {
    outline: 2px solid var(--indigo);
    outline-offset: 2px;
    border-radius: 3px;
}

/* Remove outline for pointer/touch interactions */
:focus:not(:focus-visible) {
    outline: none;
}

/* Skip-to-main link (shown on keyboard Tab) */
.skip-link {
    position: absolute;
    top: -80px;
    left: 16px;
    z-index: 9999;
    background: var(--indigo);
    color: var(--white);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: top var(--transition);
    white-space: nowrap;
}
.skip-link:focus {
    top: 16px;
    outline: 2px solid var(--white);
    outline-offset: 3px;
}

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

/* ════════════════════════════════════════════════════════
   NAVIGATION
════════════════════════════════════════════════════════ */

.nav {
    height: var(--nav-height);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--gutter);
    top: 0;
    background: var(--nav-bg);
    backdrop-filter: saturate(1.2) blur(10px);
    -webkit-backdrop-filter: saturate(1.2) blur(10px);
    z-index: 100;
}

.nav-brand {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 11px;
}

.nav-icon-thesignal {
    width: 52px;
    height: auto;
}
.footer-icon-thesignal {
    width: 52px;
    height: auto;
}

.nav-brand-dot {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 3px rgba(156, 253, 156, 0.3);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 26px;
    font-size: 14.5px;
    font-weight: 500;
}

.nav-link {
    position: relative;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--ink);
    opacity: 0.78;
    text-decoration: none;
    transition: opacity var(--transition);
    display: inline-flex;
    align-items: center;
}

.nav-link:hover { opacity: 1; }

.nav-link.active {
    opacity: 1;
    font-weight: 600;
    color: var(--ink);
}

/* Theme toggle button */
.nav-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: none;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    transition: color var(--transition), border-color var(--transition), background var(--transition);
    flex-shrink: 0;
}
.nav-theme-toggle:hover {
    color: var(--text);
    border-color: var(--indigo);
    background: var(--indigo-soft);
}

/* ════════════════════════════════════════════════════════
   PAGE LAYOUT
════════════════════════════════════════════════════════ */

.page {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.page-narrow {
    max-width: 520px;
    margin: 0 auto;
    padding: 60px 24px 80px;
}

/* ════════════════════════════════════════════════════════
   TYPOGRAPHY
════════════════════════════════════════════════════════ */

.display {
    font-family: var(--font-serif);
    font-size: 42px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.03em;   /* tighter on display size */
    color: var(--text);
}

.display em {
    font-style: italic;
    color: var(--indigo);
}

h1, .h1 {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text);
}

h2, .h2 {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
}

h3, .h3 {
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 750;      /* variable font — between 700 and 800 */
    letter-spacing: -0.01em;
    color: var(--text);
}

.label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.075em;
    color: var(--text-muted);
}

.lead {
    font-size: 16px;
    line-height: 1.75;
    color: var(--text-secondary);
}

.muted { color: var(--text-muted); }

/* ════════════════════════════════════════════════════════
   SCREENS (multi-step flows)
════════════════════════════════════════════════════════ */

.screen { display: none; }
.screen.active {
    display: block;
    animation: fadeUp 0.35s ease both;
}

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

/* ════════════════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition), color var(--transition),
                border-color var(--transition), box-shadow var(--transition),
                transform var(--transition);
    text-decoration: none;
    white-space: nowrap;
    padding: 12px 22px;
    min-height: 44px;
}

/* Micro-interactions */
.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.btn:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
    box-shadow: none;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* Focus ring — accessibility */
.btn:focus-visible {
    outline: 2px solid var(--indigo);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--cta);
    color: var(--cta-ink);
}
.btn-primary:hover:not(:disabled) {
    background: var(--gray-100);
    color: var(--cta);
}

[data-theme="dark"] .btn-primary {
    background: var(--text);
    color: var(--bg);
}
[data-theme="dark"] .btn-primary:hover:not(:disabled) {
    background: var(--gray-900);
}

.btn-indigo {
    background: var(--indigo);
    color: var(--white);
}
.btn-indigo:hover:not(:disabled) { background: var(--indigo-dark); }

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { color: var(--cta); border-color: var(--cta); }

.btn-outline-indigo {
    background: transparent;
    color: var(--indigo);
    border: 1.5px solid var(--indigo);
}
.btn-outline-indigo:hover:not(:disabled) {
    background: var(--indigo-soft);
}

.btn-lg { padding: 15px 28px; font-size: 15px; min-height: 50px; }
.btn-sm { padding: 8px 14px; font-size: 12px; min-height: 36px; }
.btn-full { width: 100%; }

.btn-actions {
    display: flex;
    gap: 10px;
    margin-top: 36px;
}

/* ════════════════════════════════════════════════════════
   FORM ELEMENTS
════════════════════════════════════════════════════════ */

.field { margin-bottom: 22px; }

.field-label {
    display: block;
    font-size: 11px;
    font-weight: 750;          /* variable weight — crisp at small sizes */
    text-transform: uppercase;
    letter-spacing: 0.075em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.field-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.6;
}

input[type="email"],
input[type="text"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    line-height: 1.5;
}

/* Visible placeholder in both modes */
input::placeholder,
textarea::placeholder { color: var(--text-muted); opacity: 1; }

input:focus, textarea:focus, select:focus {
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(107, 107, 255, 0.14);
    background: var(--surface-raised);
}

textarea { resize: vertical; }

.input-row {
    display: flex;
    gap: 10px;
}

.input-row input { flex: 1; }

/* ════════════════════════════════════════════════════════
   CARDS
════════════════════════════════════════════════════════ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.card-elevated {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 48px;
    box-shadow: var(--shadow-lg);
}

/* ════════════════════════════════════════════════════════
   OPTION CARDS (selectable)
════════════════════════════════════════════════════════ */

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

.option-card {
    background: var(--surface);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
    user-select: none;
    font-family: var(--font-sans);
    font-size: inherit;
    text-align: left;
    width: 100%;
    display: block;
}

.option-card:hover {
    border-color: var(--indigo);
    background: var(--surface-hover);
    box-shadow: var(--shadow-sm);
}
.option-card:focus-visible {
    outline: 2px solid var(--indigo);
    outline-offset: 2px;
    border-color: var(--indigo);
}

.option-card.selected {
    border-color: var(--indigo);
    background: var(--indigo-soft);
}

.option-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 4px;
}

.option-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.option-time {
    display: inline-block;
    margin-top: 10px;
    background: var(--surface-raised);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ════════════════════════════════════════════════════════
   BADGES & STATUS
════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 5px 12px;
    border-radius: 20px;
}

.badge-indigo  { background: var(--indigo-soft); color: var(--indigo); }
.badge-green   { background: rgba(156, 253, 156, 0.15); color: var(--green-dark); border: 1px solid rgba(156, 253, 156, 0.4); }
.badge-gray    { background: var(--surface-raised); color: var(--text-muted); }
.badge-warning { background: rgba(251, 191, 36, 0.12); color: #d97706; border: 1px solid rgba(251, 191, 36, 0.3); }

/* ════════════════════════════════════════════════════════
   FEEDBACK MESSAGES
════════════════════════════════════════════════════════ */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.6;
    display: none;
}

.alert-show { animation: alertSlide 0.28s var(--ease-out) both; }

@keyframes alertSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert-error {
    background: var(--red-soft);
    border: 1px solid var(--red-border);
    color: var(--red);
}

.alert-success {
    background: rgba(156, 253, 156, 0.12);
    border: 1px solid rgba(156, 253, 156, 0.4);
    color: var(--green-dark);
}

.alert-info {
    background: var(--indigo-soft);
    border-left: 3px solid var(--indigo);
    color: var(--indigo);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    display: block;
}

/* ════════════════════════════════════════════════════════
   INFO BOX
════════════════════════════════════════════════════════ */

.info-box {
    background: var(--surface-raised);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 18px 22px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 32px;
}

.info-box strong { color: var(--text); }

/* ════════════════════════════════════════════════════════
   DIVIDERS
════════════════════════════════════════════════════════ */

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 32px 0;
}

/* ════════════════════════════════════════════════════════
   STEP INDICATOR (nav dots)
════════════════════════════════════════════════════════ */

.step-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.step-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border-strong);
    transition: background var(--transition), transform var(--transition);
}

.step-dot.active  { background: var(--indigo); transform: scale(1.3); }
.step-dot.done    { background: var(--green); }

/* ════════════════════════════════════════════════════════
   STEP HEADER (form sections)
════════════════════════════════════════════════════════ */

.step-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 36px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.step-num {
    width: 40px;
    height: 40px;
    background: var(--text);
    color: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.step-meta h2 {
    font-family: var(--font-serif);
    font-size: 22px;
    color: var(--text);
    margin-bottom: 4px;
}

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

/* ════════════════════════════════════════════════════════
   SPINNERS & LOADING
════════════════════════════════════════════════════════ */

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

.spinner-dark {
    border-color: var(--border-strong);
    border-top-color: var(--text);
}

.spinner-lg {
    width: 48px;
    height: 48px;
    border-width: 3px;
    border-color: var(--border);
    border-top-color: var(--indigo);
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
    text-align: center;
    padding: 72px 20px;
}

/* ════════════════════════════════════════════════════════
   PROGRESO POR ETAPAS
   ────────────────────────────────────────────────────────
   El spinner solo dice "algo pasa". Esto dice QUÉ pasa, y
   cada paso lo mueve el servidor cuando el tramo real
   empieza — no un temporizador. Por eso, si el modelo se
   demora, el paso se queda quieto: esa quietud es la
   información que distingue "va lento" de "se colgó".
════════════════════════════════════════════════════════ */

.etapas {
    list-style: none;
    margin: 24px auto 0;
    padding: 0;
    max-width: 320px;
    text-align: left;
}

.etapas li {
    position: relative;
    padding: 0 0 18px 28px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
    opacity: 0.4;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.etapas li:last-child { padding-bottom: 0; }

/* el hilo que une los pasos */
.etapas li::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 17px;
    bottom: 2px;
    width: 1px;
    background: var(--border);
}

.etapas li:last-child::before { display: none; }

/* el punto de cada paso */
.etapas li::after {
    content: "";
    position: absolute;
    left: 1px;
    top: 4px;
    width: 12px;
    height: 12px;
    box-sizing: border-box;
    border: 1.5px solid var(--border-strong);
    border-radius: 50%;
    background: var(--surface);
}

.etapas li.hecha { opacity: 0.55; }
.etapas li.hecha::after {
    background: var(--border-strong);
    border-color: var(--border-strong);
}

.etapas li.actual {
    opacity: 1;
    color: var(--text);
    font-weight: 600;
}
.etapas li.actual::after {
    background: var(--indigo);
    border-color: var(--indigo);
    animation: etapa-latido 1.6s ease-in-out infinite;
}

@keyframes etapa-latido {
    0%, 100% { box-shadow: 0 0 0 0   var(--indigo-soft); }
    50%      { box-shadow: 0 0 0 6px var(--indigo-soft); }
}

/* Cuánto puede tardar, dicho antes de que el usuario se lo pregunte. */
.espera-aviso {
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.7;
    margin-top: 20px;
    line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
    .etapas li.actual::after { animation: none; }
}

/* ════════════════════════════════════════════════════════
   SKELETON LOADING
════════════════════════════════════════════════════════ */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--surface-raised) 25%,
        var(--surface-hover) 50%,
        var(--surface-raised) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-sweep 1.5s ease infinite;
    border-radius: var(--radius-md);
}

.skeleton-text       { height: 14px; margin-bottom: 8px; border-radius: 6px; }
.skeleton-text.wide  { width: 80%; }
.skeleton-text.med   { width: 55%; }
.skeleton-text.short { width: 30%; }
.skeleton-block      { width: 100%; height: 80px; }

@keyframes skeleton-sweep {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ════════════════════════════════════════════════════════
   TOAST
════════════════════════════════════════════════════════ */

.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--surface-raised);
    color: var(--text);
    border: 1px solid var(--border-strong);
    padding: 12px 22px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    white-space: nowrap;
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
}

.toast-dot {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    flex-shrink: 0;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ════════════════════════════════════════════════════════
   SUCCESS SCREEN
════════════════════════════════════════════════════════ */

.success-center {
    text-align: center;
    padding: 64px 20px;
}

.success-icon {
    width: 72px;
    height: 72px;
    background: var(--green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 28px;
    animation: popIn 0.5s var(--spring) both;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
}

.countdown-track {
    background: var(--surface-raised);
    border-radius: 100px;
    height: 4px;
    overflow: hidden;
    margin: 28px 0 12px;
}

.countdown-fill {
    height: 100%;
    background: var(--indigo);
    border-radius: 100px;
    width: 100%;
    transition: width 1s linear;
}

/* ════════════════════════════════════════════════════════
   AUDITOR — STATUS BAR
════════════════════════════════════════════════════════ */

.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-raised);
    padding: 8px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 28px;
    font-size: 13px;
}

.status-bar.visible { display: flex; }

/* Theme toggle inside the status bar */
.status-theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition), background var(--transition);
    min-width: 28px;
    min-height: 28px;
    flex-shrink: 0;
}
.status-theme-toggle:hover { color: var(--text); background: var(--surface-hover); }

/* Dual logo: dark logo shown by default; light logo shown in light theme */
.logo-dark  { display: block; }
.logo-light { display: none; }
[data-theme="light"] .logo-dark  { display: none; }
[data-theme="light"] .logo-light { display: block; }

.status-email { color: var(--text-secondary); font-weight: 500; }

.status-credits {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text);
}

.credits-dot {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
}

/* ════════════════════════════════════════════════════════
   AUDITOR — FORM
════════════════════════════════════════════════════════ */

.audit-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
}

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

/* ════════════════════════════════════════════════════════
   AUDITOR — TRIAGE SCORES
════════════════════════════════════════════════════════ */

.triage-wrap {
    margin: 36px 0;
}

.triage-comparison {
    display: grid;
    grid-template-columns: 1fr 48px 1fr;
    gap: 16px;
    align-items: center;
}

.triage-col-label {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.scores-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.score-card {
    border-radius: var(--radius-md);
    padding: 16px 12px;
    text-align: center;
}

.score-card.original {
    background: var(--surface-raised);
    border: 1px solid var(--border);
}

.score-card.optimized {
    background: rgba(156, 253, 156, 0.10);
    border: 1px solid rgba(156, 253, 156, 0.3);
}

.score-value {
    display: block;
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 6px;
}

.score-card.original .score-value  { color: var(--text-secondary); }
.score-card.optimized .score-value { color: var(--green-dark); }

.score-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.score-delta {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    margin-left: 4px;
}

.delta-up   { color: var(--green-dark); }
.delta-down { color: var(--red); }
.delta-same { color: var(--text-muted); }

.triage-arrow {
    text-align: center;
    font-size: 20px;
    color: var(--border-strong);
}

.rationale-box {
    background: var(--indigo-soft);
    border-left: 3px solid var(--indigo);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 14px 18px;
    margin-top: 16px;
    font-size: 13px;
    color: var(--indigo);
    line-height: 1.6;
}

/* Abre el reporte, antes de los puntajes: fija el marco de la lectura. */
.closing-note {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.summary-box {
    background: var(--surface-raised);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 18px 22px;
    margin-top: 12px;
    font-size: 14px;
    font-style: italic;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.7;
}

/* ════════════════════════════════════════════════════════
   AUDITOR — AUDIT CARDS
════════════════════════════════════════════════════════ */

.audit-card {
    border: 1px solid var(--border);
    border-top: 3px solid var(--indigo);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}

.audit-card-title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.audit-problem {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 18px;
    padding: 10px 14px;
    background: var(--surface-raised);
    border-radius: var(--radius-sm);
    line-height: 1.6;
}

.comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.comparison-box {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.7;
}

.box-before {
    background: var(--red-soft);
    border: 1px solid var(--red-border);
    color: var(--red);
}

.box-after {
    background: rgba(156, 253, 156, 0.10);
    border: 1px solid rgba(156, 253, 156, 0.3);
    color: var(--green-dark);
    font-weight: 500;
}

.comparison-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.6;
    display: block;
    margin-bottom: 6px;
}

.justification-box {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ════════════════════════════════════════════════════════
   AUDITOR — OPTIMIZED CONTENT
════════════════════════════════════════════════════════ */

.optimized-content {
    border: 1.5px solid var(--indigo);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-top: 36px;
}

.optimized-header {
    background: var(--indigo);
    color: var(--white);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.02em;
}

.optimized-header-dot {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
}

.optimized-body {
    padding: 28px;
    font-size: 14px;
    line-height: 1.85;
    color: var(--text-secondary);
    white-space: pre-wrap;
    background: var(--surface);
}

/* ════════════════════════════════════════════════════════
   AUDITOR — PDF BUTTON
════════════════════════════════════════════════════════ */

.btn-pdf {
    display: none;
    width: 100%;
    margin-top: 20px;
    background: var(--surface-raised);
    color: var(--text-secondary);
    border: 1.5px solid var(--border-strong);
    font-weight: 600;
}

.btn-pdf:hover:not(:disabled) {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

/* ════════════════════════════════════════════════════════
   PROFILE — ASSET CARDS
════════════════════════════════════════════════════════ */

.asset-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow var(--transition), border-color var(--transition);
    margin-bottom: 20px;
}

.asset-card:focus-within {
    box-shadow: 0 0 0 3px rgba(107, 107, 255, 0.14);
    border-color: var(--indigo);
}

.asset-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-raised);
}

.asset-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.asset-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    background: var(--surface);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.asset-title { font-weight: 600; font-size: 14px; color: var(--text); }
.asset-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.asset-textarea {
    width: 100%;
    min-height: 160px;
    padding: 20px 22px;
    border: none;
    outline: none;
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-secondary);
    resize: vertical;
    background: transparent;
}

.asset-footer {
    padding: 8px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.char-count { font-size: 11px; color: var(--text-muted); }

/* ════════════════════════════════════════════════════════
   PROFILE — SAVE BAR
════════════════════════════════════════════════════════ */

.save-bar {
    position: sticky;
    bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    color: var(--text);
    padding: 14px 22px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    gap: 16px;
}

.save-bar-text { font-size: 13px; color: var(--text-secondary); }
.save-bar-text strong { color: var(--text); }

.save-bar-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn-save {
    background: var(--green);
    color: var(--black);
    font-weight: 700;
    padding: 9px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 13px;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
    min-height: 36px;
}

.btn-save:hover   { opacity: 0.85; }
.btn-save:active  { transform: scale(0.97); }
.btn-save:disabled { opacity: 0.4; cursor: not-allowed; }

/* ════════════════════════════════════════════════════════
   ONBOARDING — PATH CARDS
════════════════════════════════════════════════════════ */

.path-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 20px 0;
}

.path-card {
    background: var(--surface);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    cursor: pointer;
    transition: border-color var(--transition), transform var(--transition),
                box-shadow var(--transition), background var(--transition);
    text-align: left;
    font-family: var(--font-sans);
    font-size: inherit;
    width: 100%;
    display: block;
}

.path-card:hover {
    border-color: var(--indigo);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    background: var(--surface-hover);
}

.path-card:focus-visible {
    outline: 2px solid var(--indigo);
    outline-offset: 2px;
    border-color: var(--indigo);
}

.path-card.selected {
    border-color: var(--indigo);
    background: var(--indigo-soft);
}

.path-emoji { font-size: 28px; margin-bottom: 14px; display: block; }
.path-title { font-weight: 600; font-size: 15px; color: var(--text); margin-bottom: 8px; }
.path-desc  { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ════════════════════════════════════════════════════════
   ONBOARDING — PROMPT BOX
════════════════════════════════════════════════════════ */

.prompt-box {
    background: #09090f;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.prompt-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.35);
}

.copy-btn {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    border: none;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    font-family: var(--font-sans);
}

.copy-btn:hover  { background: rgba(255, 255, 255, 0.14); }
.copy-btn.copied { background: var(--green); color: var(--black); }

.prompt-text {
    padding: 20px 18px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    line-height: 1.85;
    white-space: pre-wrap;
    font-family: var(--font-sans);
}

.ai-links {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.ai-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: border-color var(--transition), color var(--transition);
    font-family: var(--font-sans);
    min-height: 44px;
}

.ai-link:hover { border-color: var(--indigo); color: var(--indigo); }

/* ════════════════════════════════════════════════════════
   ACTIVATE PAGE
════════════════════════════════════════════════════════ */

.activate-bg {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.activate-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 52px 48px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.4s ease both;
}

.activate-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 24px;
}

.activate-icon.expired { background: var(--red-soft); }
.activate-icon.invalid { background: rgba(251, 191, 36, 0.12); }

/* ════════════════════════════════════════════════════════
   HERO — marketing / auth-gate sections
════════════════════════════════════════════════════════ */

.hero-section {
    position: relative;
    padding: 64px 0 88px;
    overflow: hidden;
}

/* Ambient glow — indigo top-left + green bottom-right, inset only */
.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

/* ── Split layout (text left / visual right) ── */
.hero-split {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 56px;
    align-items: center;
}

/* ── Centered layout ── */
.hero-centered {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 560px;
    margin: 0 auto;
}

/* ── Eyebrow label ── */
.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: var(--indigo);
    margin-bottom: 22px;
}

.hero-eyebrow::before {
    content: '';
    width: 20px;
    height: 1.5px;
    background: var(--indigo);
    display: block;
    flex-shrink: 0;
}

.hero-centered .hero-eyebrow {
    justify-content: center;
}
.hero-centered .hero-eyebrow::before { display: none; }

/* ── Typography ── */
.hero-title {
    font-family: var(--font-serif);
    font-size: 40px;
    font-weight: 700;
    line-height: 1.13;
    letter-spacing: -0.025em;
    color: var(--text);
    margin-bottom: 18px;
}

.hero-title em {
    font-style: italic;
    color: var(--indigo);
}

.hero-centered .hero-title { font-size: 36px; }

.hero-subtitle {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 32px;
}

.hero-split .hero-subtitle { max-width: 420px; }

/* ── CTAs ── */
.hero-ctas {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── Visual column (video) ── */
.hero-visual {
    position: relative;
}

/* Decorative offset accent frame */
.hero-visual::before {
    content: '';
    position: absolute;
    top: 14px;
    left: -14px;
    right: 14px;
    bottom: -14px;
    border: 1.5px solid var(--indigo-soft);
    border-radius: var(--radius-lg);
    z-index: -1;
    transition: border-color var(--transition-md);
}

.hero-visual-frame {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    background: var(--surface-raised);
}

.hero-visual-frame iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

/* ── Feature pills ── */
.hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 32px;
}

.hero-feature-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
    transition: border-color var(--transition), color var(--transition);
}

.hero-feature-pill:hover {
    border-color: var(--indigo);
    color: var(--indigo);
}

.hero-feature-pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--indigo);
    flex-shrink: 0;
}

/* ── Organic wave divider at base of hero ── */
.hero-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    overflow: hidden;
    pointer-events: none;
    z-index: 2;
}

.hero-wave::before {
    content: '';
    position: absolute;
    bottom: -22px;
    left: -5%;
    right: -5%;
    height: 44px;
    background: var(--bg);
    border-radius: 50%;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .hero-split {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .hero-visual::before { display: none; }
}

@media (max-width: 640px) {
    .hero-section { padding: 44px 0 64px; }
    .hero-title { font-size: 28px !important; }
    .hero-centered .hero-title { font-size: 26px !important; }
}

/* ════════════════════════════════════════════════════════
   REDUCED MOTION — accessibility override
════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    html { scroll-behavior: auto; }
}

/* ════════════════════════════════════════════════════════
   PRINT STYLES
════════════════════════════════════════════════════════ */

@media print {
    @page { size: A4; margin: 15mm; }

    body { background: white !important; color: black !important; font-size: 11pt; }

    .nav, #auditForm, .status-bar, .btn-pdf, .spinner { display: none !important; }

    #report-area, #render-target { display: block !important; width: 100% !important; }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .score-card.original  { background-color: #f4f4f4 !important; }
    .score-card.optimized { background-color: rgba(156, 253, 156, 0.15) !important; }
    .box-before { background-color: #fff5f5 !important; color: #c53030 !important; }
    .box-after  { background-color: rgba(156, 253, 156, 0.12) !important; color: #26a326 !important; }
    .audit-card { page-break-inside: avoid; margin-bottom: 16px; }
    .optimized-header { background-color: #4949e9 !important; color: white !important; }
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
    .nav { padding: 0 16px; }
    .page { padding: 28px 16px 60px; }
    .page-narrow { padding: 36px 16px 60px; }
    .path-cards { grid-template-columns: 1fr; }
    .options-grid { grid-template-columns: 1fr; }
    .triage-comparison { grid-template-columns: 1fr; }
    .triage-arrow { display: none; }
    .comparison { grid-template-columns: 1fr; }
    .audit-form-grid { grid-template-columns: 1fr; }
    .save-bar { flex-direction: column; align-items: stretch; }
    .input-row { flex-direction: column; }
    .activate-card { padding: 36px 24px; }
    .card-elevated { padding: 28px 20px; }

    .audit-form { padding: 20px 16px; }

    .source-type-grid {
        grid-template-columns: 1fr !important;
    }

    input[type="url"] {
        width: 100%;
        box-sizing: border-box;
        min-width: 0;
    }

    /* Pricing modal — single column */
    #pricing-modal [style*="grid-template-columns:1fr 1fr 1fr"],
    #pricing-modal [style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    #pricing-modal > div {
        padding: 28px 20px !important;
        max-height: 95vh;
    }

    .idea-detail-grid {
        grid-template-columns: 1fr !important;
    }

    #results-area .audit-card > div:first-child {
        flex-wrap: wrap;
    }

    #faq-modal > div {
        padding: 28px 20px !important;
        margin: 8px;
    }

    #login-modal > div {
        padding: 28px 20px !important;
    }

    #regen-modal > div {
        padding: 28px 20px !important;
        margin: 8px;
    }

    #global-status-bar {
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px 16px;
        font-size: 11px;
    }
}

/* ════════════════════════════════════════════════════════
   FOOTER — unified with the marketing site (thesignal.health)
   Dark editorial footer; matches partials/footer.html on Netlify.
════════════════════════════════════════════════════════ */
.footer {
    background: var(--ink);
    color: var(--bg);
    padding: 64px 0 40px;
    margin-top: 96px;
}
.footer-wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.footer-top {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 48px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.footer-brand { margin-bottom: 16px; }
.footer .footer-icon-thesignal { width: 52px; height: auto; }
.footer-col h5 {
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    margin: 0 0 18px;
    font-weight: 400;
}
.footer-col a {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 15px;
    margin-bottom: 12px;
    text-decoration: none;
    transition: color var(--transition);
}
.footer-col a:hover { color: var(--accent); }
.footer-blurb {
    color: rgba(255, 255, 255, 0.6);
    font-size: 15px;
    line-height: 1.55;
    max-width: 30ch;
    margin-top: 8px;
}
.footer-social {
    display: flex;
    gap: 14px;
    margin-top: 22px;
}
.footer-social a {
    display: inline-flex;
    color: rgba(255, 255, 255, 0.6);
    transition: color var(--transition);
}
.footer-social a:hover { color: var(--accent); }
.footer-social svg { width: 19px; height: 19px; }
.footer-legal {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: center;
}
.footer-legal a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color var(--transition);
}
.footer-legal a:hover { color: var(--accent); }
.footer-credit {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 600;
}
.footer-credit:hover { color: var(--accent); }
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 28px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.5);
    flex-wrap: wrap;
    gap: 16px;
}

@media (max-width: 920px) {
    .footer-top { grid-template-columns: 1fr 1fr; gap: 28px; }
}
@media (max-width: 540px) {
    .footer-top { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; align-items: flex-start; gap: 12px; }
    .footer-legal { justify-content: flex-start; }
}
