/* ============================================================
   ClinIA — Clinical Luxury Design System
   Drop-in replacement stylesheet
   ============================================================ */

/* ── Google Fonts loaded in HTML ── */

/* ── Design Tokens ── */
:root {
    /* Clinical Ivory Base */
    --bg-primary:    #f8fafc; 
    --bg-card:       #ffffff; 
    --bg-card-hover: #f1f5f9;
    
    --border-color:  rgba(148, 163, 184, 0.2);
    --border-hover:  rgba(148, 163, 184, 0.4);
    
    /* Clean, soft shadows */
    --shadow-card:   0 1px 3px rgba(0,0,0,0.05), 0 10px 24px rgba(0,0,0,0.03);
    --shadow-glow:   none; 
    --shadow-btn:    0 2px 4px rgba(15, 23, 42, 0.05);

    /* Text Colors for Light Theme */
    --text-primary:  #334155; 
    --text-secondary: #64748b;
    --text-muted:    #94a3b8;
    --white:         #0f172a; /* Re-mapped to dark for h2 headings */
    
    /* Variables kept for spacing/radii */
    --spacing-xs:  0.5rem;
    --spacing-sm:  0.75rem;
    --spacing-md:  1.25rem;
    --spacing-lg:  2rem;
    --spacing-xl:  2.75rem;
    --radius-sm:  6px;
    --radius-md:  12px;
    --radius-lg:  18px;
    --radius-xl:  24px;
    --transition-fast:   0.18s ease;
    --transition-medium: 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.65;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;

    /* Subtle grid texture */
    background-image:
        linear-gradient(rgba(123,156,239,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(123,156,239,0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    background-attachment: fixed;
}

/* ── Layout Container ── */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-md);
    animation: fadeUp 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

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

/* ── Header ── */
.header {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md) var(--spacing-lg);
    position: relative;
}

.header::after {
    content: '';
    display: block;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--teal-400), transparent);
    margin: var(--spacing-md) auto 0;
}

.header h1 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(2.8rem, 6vw, 4rem);
    letter-spacing: -0.01em;
    -webkit-text-fill-color: #0f172a; /* Removes the white/teal gradient */
    margin-bottom: 0.4rem;
    line-height: 1.1;

    /* Subtle gradient shimmer */
    background: linear-gradient(135deg, var(--white) 30%, var(--teal-300) 100%);
    -webkit-background-clip: text;
/*     -webkit-text-fill-color: transparent; */
    background-clip: text;
}

.subtitle {
    font-size: 0.95rem;
    font-weight: 300;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.version-badge {
    display: inline-block;
    margin-top: var(--spacing-sm);
    padding: 0.25rem 0.85rem;
    background: rgba(212, 168, 67, 0.12);
    border: 1px solid rgba(212, 168, 67, 0.35);
    color: var(--gold-300);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: 'DM Mono', monospace;
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg) var(--spacing-xl);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-card), var(--shadow-glow);
    transition: border-color var(--transition-medium), box-shadow var(--transition-medium);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--teal-400), transparent);
    opacity: 0.5;
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-card), 0 0 40px rgba(123,156,239,0.18);
}

/* Section headings inside cards */
.card h2 {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: 1.55rem;
    color: var(--white);
    margin-bottom: var(--spacing-md);
    letter-spacing: -0.01em;
}

.card h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--teal-300);
    margin-bottom: var(--spacing-md);
}

.card h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

/* ── Buttons ── */
/* ── Universal Aluminum Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.03em;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
    max-width: 280px;
    text-decoration: none;
    white-space: nowrap;
    
    /* Brushed Aluminum Texture */
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 40%, #e2e8f0 100%);
    color: #334155 !important; /* Forces dark gray text */
    border: 1px solid #cbd5e1;
    box-shadow: inset 0 1px 0 #ffffff, var(--shadow-btn);
}

.btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 40%, #cbd5e1 100%);
    border-color: #94a3b8;
    box-shadow: inset 0 1px 0 #ffffff, 0 4px 12px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(1px) scale(0.985);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f1f5f9;
}

/* ── Specific Icon Colors ── */
/* Assuming you use these classes for your respective actions */

/* Iniciar grabación (Green) */
.btn-success .btn-icon { color: #10b981; }

/* Detener (Red) */
.btn-danger .btn-icon { color: #ef4444; }

/* Cargar audio (Blue) */
.btn-secondary .btn-icon { color: #3b82f6; }

/* Procesar y generar nota (Orange) */
.btn-primary .btn-icon { color: #f97316; }

/* ── Recording Controls ── */
.recording-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
    margin-bottom: var(--spacing-md);
}

/* ── Recording Status ── */
.status-message {
    background: rgba(224, 82, 82, 0.08);
    border: 1px solid rgba(224, 82, 82, 0.25);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-family: 'DM Mono', monospace;
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--danger);
    margin-bottom: var(--spacing-xs);
}

.pulse-dot {
    width: 12px;
    height: 12px;
    background: var(--danger);
    border-radius: 50%;
    display: inline-block;
    animation: pulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(224,82,82,0.6);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.35); opacity: 0.6; }
}

.warning-text {
    font-size: 0.8rem;
    color: rgba(224,82,82,0.7);
    letter-spacing: 0.03em;
}

/* ── Audio Player ── */
#audioPlayerContainer {
    margin: var(--spacing-md) 0;
    padding: var(--spacing-md) var(--spacing-md);
    background: #f1f5f9; /* Light slate */
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
}

#audioPlayer {
    width: 100%;
    height: 40px;
    margin-bottom: var(--spacing-sm);
    accent-color: var(--teal-400);
    border-radius: var(--radius-sm);
}

.audio-info {
    display: flex;
    gap: var(--spacing-md);
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: #334155;
}

/* ── Options Section ── */
.options-section {
    padding: var(--spacing-md) var(--spacing-xl);
}

.options-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 0;
    align-items: stretch;
}

.options-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    padding: 0 0.5rem;
    border-left: 1px solid var(--border-color);
}

.options-col:first-child {
    border-left: none;
    padding-left: 0;
}

.options-col-consent {
    justify-content: center;
}

@media (max-width: 600px) {
    .options-grid {
        grid-template-columns: 1fr;
    }
    .options-col {
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding: 0.5rem 0;
    }
    .options-col:first-child {
        border-top: none;
    }
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.checkbox-label:hover {
    background: rgba(123,156,239,0.05);
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-hover);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--teal-400);
    border-color: var(--teal-400);
}

/* Patient consent — LFPDPPP */
.consent-label {
    font-size: 0.97rem;
    color: var(--text-primary);
    border-top: 1px solid var(--border-color);
    padding-top: 0.85rem;
    margin-top: 0.25rem;
    line-height: 1.45;
}

.consent-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.options-grid select {
    font-size: 0.92rem;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-sm);
    padding: 0.15rem 0.4rem;
    cursor: pointer;
}

.speakers-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.5rem 0.75rem;
}

.speakers-label {
    font-size: 0.92rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.speakers-select {
    font-size: 0.92rem;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-sm);
    padding: 0.15rem 0.4rem;
    cursor: pointer;
    flex: 1;
    max-width: 260px;
}

.speakers-select:focus {
    outline: none;
    border-color: #7b9cef;
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: var(--navy-950);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

/* ── Progress Section ── */
.progress-section {
    animation: fadeUp 0.4s ease both;
}

.progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--teal-400), var(--teal-300));
    border-radius: 999px;
    transition: width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 0%;
    box-shadow: 0 0 12px rgba(123,156,239,0.5);
}

.progress-text {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-family: 'DM Mono', monospace;
    margin-bottom: var(--spacing-md);
}

.progress-steps {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 999px;
    font-size: 0.82rem;
    color: var(--text-muted);
    transition: all var(--transition-medium);
}

.step.active {
    background: rgba(123,156,239,0.1);
    border-color: var(--teal-400);
    color: var(--teal-300);
}

.step.completed {
    background: rgba(34,197,94,0.1);
    border-color: var(--success);
    color: var(--success);
}

.step-number {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    flex-shrink: 0;
}

.step.active   .step-number { background: var(--teal-400); color: var(--navy-950); }
.step.completed .step-number { background: var(--success);  color: var(--navy-950); }

.step-label {
    font-size: 0.82rem;
}

/* ── Results Section ── */
.results-section {
    animation: fadeUp 0.4s ease both;
}

.result-card {
    background: rgba(6,13,26,0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    transition: border-color var(--transition-fast);
}

.result-card:hover {
    border-color: var(--border-hover);
}

.doc-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--teal-300);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    letter-spacing: 0.02em;
    padding: 0.6rem 1rem;
    border: 1px solid rgba(123,156,239,0.3);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.doc-link:hover {
    background: rgba(123,156,239,0.1);
    border-color: var(--teal-400);
    transform: translateX(3px);
}

.transcript-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.transcript-meta span {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.06);
}

.transcript-text {
    font-size: 0.92rem;
    line-height: 1.8;
    color: var(--text-secondary);
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    border-left: 3px solid var(--teal-400);
    font-style: italic;
    white-space: pre-wrap;
}

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: var(--spacing-md);
    background: #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border-color);
    width: fit-content;
}

.tab-btn {
    padding: 0.45rem 1.1rem;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.04em;
    border: none;
    cursor: pointer;
    border-radius: calc(var(--radius-sm) - 2px);
    color: #64748b;
    background: transparent;
    transition: all var(--transition-fast);
}

.tab-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.tab-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeUp 0.25s ease both;
}

/* Result Cards & Transcription */
.result-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}


/* ── JSON Pre ── */
#jsonData {
    font-family: 'DM Mono', monospace;
    font-size: 0.82rem;
    background: #f1f5f9;
    color: #0f172a;
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    line-height: 1.7;
    border: 1px solid rgba(123,156,239,0.1);
    white-space: pre;
}

/* ── Error Section ── */
.error-section {
    border-color: rgba(224,82,82,0.3);
    background: rgba(224,82,82,0.05);
    animation: fadeUp 0.4s ease both;
}

.error-section h3 {
    color: var(--danger);
}

.error-message {
    font-size: 0.92rem;
    color: rgba(224,82,82,0.85);
    margin-bottom: var(--spacing-md);
    line-height: 1.7;
    font-family: 'DM Mono', monospace;
}

/* ── Review Section ── */
.review-section {
    animation: fadeUp 0.4s ease both;
}

/* ── Review two-panel layout ── */
.review-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-top: var(--spacing-md);
}

.review-panel {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    max-height: 80vh;
}

.review-transcript-panel {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.review-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.review-panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0;
}

.review-readonly-badge {
    font-size: 0.72rem;
    font-weight: 500;
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
    border-radius: 99px;
    padding: 0.15rem 0.6rem;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.review-transcript-text {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.review-speaker-label {
    color: #7b9cef;
    font-weight: 600;
}

.review-form-panel {
    overflow-y: auto;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

/* Sticky confirm/cancel footer inside form panel */
.review-form-panel .review-actions {
    position: sticky;
    bottom: 0;
    background: #ffffff;
    z-index: 2;
    /* border-top and padding already set on .review-actions */
}

/* Toggle — hidden on desktop, shown on tablet/mobile */
.review-transcript-toggle {
    display: none;
}

.review-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: rgba(212, 168, 67, 0.1);
    border: 1px solid rgba(212, 168, 67, 0.35);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    color: #7a4f04;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.55;
}

.review-notice-icon {
    flex-shrink: 0;
    margin-top: 2px;
    color: #d4a843;
}

.review-group {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.review-group:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

.review-group-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.review-field {
    margin-bottom: var(--spacing-sm);
}

.review-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.review-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.review-input,
.review-textarea {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    padding: 0.55rem 0.85rem;
    line-height: 1.5;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
}

.review-textarea {
    resize: vertical;
    min-height: 72px;
}

.review-input:focus,
.review-textarea:focus {
    outline: none;
    border-color: #7b9cef;
    box-shadow: 0 0 0 3px rgba(123,156,239,0.15), inset 0 1px 2px rgba(0,0,0,0.03);
}

.review-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

@media (max-width: 600px) {
    .review-actions .btn {
        max-width: 100%;
        width: 100%;
    }
}

/* ── Review panel — tablet/mobile stacked layout ── */
@media (max-width: 900px) {
    .review-layout {
        flex-direction: column;
    }

    .review-panel {
        max-height: none;
        overflow-y: visible;
        width: 100%;
    }

    /* Transcript panel collapses; toggle button appears */
    .review-transcript-panel {
        max-height: 200px;
        overflow-y: hidden;
        position: relative;
    }

    .review-transcript-panel.is-expanded {
        max-height: none;
        overflow-y: visible;
    }

    .review-transcript-toggle {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.82rem;
        color: #7b9cef;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.5rem 0 0.25rem;
        margin-top: var(--spacing-xs);
        font-family: 'Outfit', sans-serif;
        font-weight: 500;
    }

    .review-transcript-toggle:hover {
        opacity: 0.8;
    }

    .toggle-chevron {
        font-size: 1rem;
        line-height: 1;
        transition: transform 0.2s ease;
        display: inline-block;
    }

    .toggle-chevron.rotated {
        transform: rotate(180deg);
    }

    /* Form panel not independently scrollable on mobile — page scroll handles it */
    .review-form-panel {
        max-height: none;
        overflow-y: visible;
    }

    /* Unstick the footer on mobile — let it scroll naturally */
    .review-form-panel .review-actions {
        position: static;
    }
}

@media (max-width: 600px) {
    .review-transcript-panel {
        max-height: 150px;
    }
}

/* ── Footer ── */
.footer {
    text-align: center;
    padding: var(--spacing-lg) 0 var(--spacing-xl);
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 2;
    border-top: 1px solid var(--border-color);
    margin-top: var(--spacing-lg);
}

.disclaimer {
    color: rgba(212,168,67,0.55);
    font-size: 0.75rem;
    letter-spacing: 0.03em;
}

/* ── SVG Icons ── */

/* Header logo mark */
.header-logo {
    display: flex;
    justify-content: center;
    margin-bottom: var(--spacing-sm);
}

.logo-icon {
    width: 52px;
    height: 52px;
    color: var(--teal-400);
    opacity: 0.9;
    filter: drop-shadow(0 0 12px rgba(123,156,239,0.4));
}

/* Icons inside h2/h3 headings */
.heading-icon {
    width: 1.15em;
    height: 1.15em;
    vertical-align: -0.2em;
    margin-right: 0.45em;
    color: var(--teal-400);
    flex-shrink: 0;
}

.card h2,
.card h3,
.card h4 {
    display: flex;
    align-items: center;
}

/* Smaller icons inside h4 labels */
.heading-icon-sm {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    margin-right: 0.4em;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Icons inside buttons — sized to match text */
.btn-icon {
    margin-right: 0.6rem;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.btn-icon svg {
    width: 1.1em;
    height: 1.1em;
}

/* External link arrow in doc-link */
.link-arrow {
    width: 0.95em;
    height: 0.95em;
    margin-left: 0.4em;
    vertical-align: -0.1em;
    flex-shrink: 0;
}

/* Warning icon in footer disclaimer */
.disclaimer-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    margin-right: 0.35em;
    color: var(--gold-400);
    flex-shrink: 0;
}

.disclaimer {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Footer links ── */
.footer-links {
    margin-top: 0.25rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.footer-sep {
    margin: 0 0.25rem;
    opacity: 0.5;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: #7b9cef;
}

/* Inline "Ver Aviso de Privacidad" link inside consent label */
.aviso-inline-link {
    color: #7b9cef;
    text-decoration: none;
    font-size: inherit;
    white-space: nowrap;
}

.aviso-inline-link:hover {
    text-decoration: underline;
}

/* ── Aviso de Privacidad Modal ── */
.aviso-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.aviso-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 680px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.aviso-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.75rem 2rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.aviso-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.2rem;
}

.aviso-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.aviso-draft-badge {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    background: rgba(212, 168, 67, 0.12);
    color: #7a4f04;
    border: 1px solid rgba(212, 168, 67, 0.35);
    border-radius: 99px;
    padding: 0.2rem 0.65rem;
    white-space: nowrap;
    margin-top: 0.15rem;
}

.aviso-body {
    overflow-y: auto;
    flex: 1;
    padding: 1.5rem 2rem;
    line-height: 1.65;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.aviso-body p {
    margin-bottom: 0.85rem;
}

.aviso-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7b9cef;
    margin: 1.5rem 0 0.65rem;
}

.aviso-section-title:first-child {
    margin-top: 0;
}

.aviso-email-link {
    color: #7b9cef;
    text-decoration: none;
}

.aviso-email-link:hover {
    text-decoration: underline;
}

.aviso-legal-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    border-top: 1px solid var(--border-color);
    padding-top: 0.85rem;
    margin-top: 1.25rem;
}

.aviso-footer {
    padding: 1rem 2rem 1.5rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .aviso-card {
        width: 95%;
        max-height: 90vh;
    }

    .aviso-header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1.25rem 1.25rem 1rem;
    }

    .aviso-body {
        padding: 1rem 1.25rem;
    }

    .aviso-footer {
        padding: 0.75rem 1.25rem 1.25rem;
    }
}

/* ── Main Content ── */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .container {
        padding: var(--spacing-md) var(--spacing-sm);
    }

    .card {
        padding: var(--spacing-md);
        border-radius: var(--radius-lg);
    }

    .recording-controls {
        flex-direction: column;
    }

    .btn {
        max-width: 100%;
    }

    .progress-steps {
        flex-direction: column;
    }

    .header h1 {
        font-size: 2.6rem;
    }

    .result-card {
        padding: var(--spacing-md);
    }
}

@media (min-width: 601px) {
    .recording-controls {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
    }

    .options-grid {
        flex-direction: row;
        gap: var(--spacing-lg);
    }
}

/* ── Enforce Specific Icon Colors ── */
.btn-success .btn-icon, 
.btn-success .btn-icon svg { 
    color: #10b981 !important; /* Green for Iniciar */
    fill: currentColor;
}

.btn-danger .btn-icon, 
.btn-danger .btn-icon svg { 
    color: #ef4444 !important; /* Red for Detener */
    fill: currentColor;
}

.btn-secondary .btn-icon, 
.btn-secondary .btn-icon svg { 
    color: #3b82f6 !important; /* Blue for Cargar */
    fill: currentColor;
}

.btn-primary .btn-icon, 
.btn-primary .btn-icon svg { 
    color: #f97316 !important; /* Orange for Procesar */
    fill: currentColor;
}

/* Amber for Pausar */
.btn-pause .btn-icon,
.btn-pause .btn-icon svg {
    color: #f59e0b !important;
    fill: currentColor;
}

/* Teal for Reanudar */
.btn-resume .btn-icon,
.btn-resume .btn-icon svg {
    color: #0d9488 !important;
    fill: currentColor;
}

/* ── Restore List & Bullet Indentation in Results ── */
.result-card ul, 
.result-card ol,
.tab-content ul, 
.tab-content ol {
    padding-left: 1.5rem;     /* Pushes the bullets in */
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.result-card li,
.tab-content li {
    margin-bottom: 0.4rem;    /* Adds breathing room between items */
    padding-left: 0.2rem;
    line-height: 1.6;
}

/* Ensure nested lists (sub-bullets) look clean */
.result-card ul ul,
.result-card ol ol,
.tab-content ul ul,
.tab-content ol ol {
    margin-top: 0.4rem;
    margin-bottom: 0;
}

/* ── Floating Feedback Button ── */
.feedback-floating {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15); /* Slightly stronger shadow to lift it off the page */
    margin-top: 0; /* Overrides the default btn-small margin */
}

/* Mobile responsive behavior */
@media (max-width: 600px) {
    .feedback-floating {
        top: 15px;
        right: 15px;
        padding: 0.6rem;       /* Shrinks padding to make it circular */
        width: auto;           /* Overrides the 100% width rule */
        border-radius: 50%;    /* Makes the button a perfect circle */
    }
    
    /* Hide the text, keep the icon */
    .feedback-floating .feedback-text {
        display: none;
    }
    
    /* Remove the margin pushing the icon away from the hidden text */
    .feedback-floating .btn-icon {
        margin-right: 0;
        width: 20px;
        height: 20px;
    }
}

/* ── Email delivery row — options section ── */
.email-delivery-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 4px 0;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.email-delivery-label {
    font-size: var(--font-size-sm, 13px);
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.email-delivery-input {
    font-size: var(--font-size-sm, 13px);
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-default, #cbd5e1);
    border-radius: var(--radius-sm, 4px);
    padding: 3px 8px;
    flex: 1;
    min-width: 180px;
    max-width: 260px;
}

.email-delivery-input:focus {
    outline: none;
    border-color: var(--teal-400, #0F6E56);
}

.email-save-indicator {
    font-size: 11px;
    color: var(--teal-400, #0F6E56);
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.email-save-indicator.visible {
    opacity: 1;
    display: inline !important;
}

/* ── Consent 2 — NOM-004 treatment consent block on review screen ── */
.consent-treatment-block {
    background: #FAEEDA;
    border: 0.5px solid #F0DCB0;
    border-left: 3px solid #BA7517;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

#cie11-field-block {
    position: relative;
}

/* ── Consent card ───────────────────────────────────────────────────── */
.consent-card {
    margin-bottom: var(--spacing-md);
}

.consent-card-body {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.consent-card-icon {
    flex-shrink: 0;
    color: var(--teal, #0F6E56);
    margin-top: 2px;
}

.consent-card-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.consent-card-label input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--teal, #0F6E56);
    cursor: pointer;
}

/* ── Toggle switches ─────────────────────────────────────────────────── */
.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    padding: 4px 0;
}

.toggle-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-default, #ccc);
    border-radius: 999px;
    transition: background 0.2s;
    cursor: pointer;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--teal, #0F6E56);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

.personas-select {
    font-size: 0.88rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    cursor: pointer;
    width: 52px;
}
