    :root {
        --amber: #f59e0b;
        --amber-light: #fbbf24;
        --bg-amber-soft: #fffbeb;
        --bg-green-soft: #f0fdf4;
        --bg-light: #f8fafc;
        --bg-teal-soft: #f0fdfa;
        --bg-violet-soft: #f5f3ff;
        --border: #e2e8f0;
        --pink: #ec4899;
        --pink-light: #f472b6;
        --teal: #0d9488;
        --teal-dark: #065f46;
        --teal-light: #14b8a6;
        --text-primary: #1e293b;
        --text-secondary: #64748b;
        --violet: #8b5cf6;
        --violet-light: #a78bfa;
    }

body { background: var(--bg-light); }

/* ===== Trial Header ===== */
.trial-header {
    background: linear-gradient(135deg, var(--teal) 0%, var(--violet) 50%, var(--pink) 100%);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.trial-header::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 70%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 50%);
    animation: float 15s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(20px, -20px); }
}

.trial-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.trial-header a {
    position: relative;
    z-index: 2;
}

.trial-header p {
    position: relative;
    z-index: 2;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: 1px solid rgba(255,255,255,0.3);
}

.back-link:hover {
    background: white;
    color: var(--violet);
}

/* ===== Trial Badges ===== */
.trial-badge {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    border-radius: 25px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-right: 0.5rem;
}

.badge-teal {
    background: linear-gradient(135deg, var(--teal), var(--teal-light));
    color: white;
}

.badge-violet {
    background: linear-gradient(135deg, var(--violet), var(--violet-light));
    color: white;
}

.badge-amber {
    background: linear-gradient(135deg, var(--amber), var(--amber-light));
    color: #1a1a2e;
}

.badge-gray {
    background: linear-gradient(135deg, var(--text-secondary), var(--text-secondary));
    color: white;
}

.badge-pink {
    background: linear-gradient(135deg, var(--pink), var(--pink-light));
    color: white;
}

/* ===== Match Badge ===== */
.match-badge {
    padding: 0.4rem 0.85rem;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 700;
}

.match-badge.high {
    background: linear-gradient(135deg, var(--teal), var(--teal-light));
    color: white;
}

.match-badge.medium {
    background: linear-gradient(135deg, var(--amber), var(--amber-light));
    color: #1a1a2e;
}

.match-badge.low {
    background: linear-gradient(135deg, var(--text-secondary), var(--text-secondary));
    color: white;
}

/* ===== Trial Sections ===== */
.trial-section {
    background: white;
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

.trial-section:hover {
    border-color: var(--violet);
}

.trial-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trial-section h3 i {
    color: var(--violet);
}

/* ===== Info Grid ===== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-item {
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--bg-teal-soft), var(--bg-violet-soft));
    border-radius: 12px;
    border: 2px solid var(--border);
    transition: all 0.3s;
}

.info-item:hover {
    border-color: var(--violet);
}

.info-item label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.info-item span {
    font-weight: 600;
    color: var(--text-primary);
}

.info-item .text-teal { color: var(--teal); }
.info-item .text-violet { color: var(--violet); }
.info-item .text-amber { color: var(--amber); }
.info-item .text-gray { color: var(--text-secondary); }

/* ===== Match Reasons ===== */
.match-reasons {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--bg-green-soft), #a7f3d0);
    border-radius: 16px;
    border-left: 4px solid var(--teal);
}

.match-reasons h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--teal);
    margin-bottom: 0.5rem;
}

.match-reasons ul {
    margin: 0;
    padding-left: 1.25rem;
}

.match-reasons li {
    font-size: 0.85rem;
    color: var(--teal-dark);
    margin-bottom: 0.25rem;
}

/* ===== Match Warnings ===== */
.match-warnings {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--bg-amber-soft), #fde68a);
    border-radius: 12px;
    border-left: 4px solid var(--amber);
}

.match-warnings ul {
    margin: 0;
    padding-left: 1.25rem;
}

.match-warnings li {
    font-size: 0.85rem;
    color: #92400e;
}

/* ===== Matched Biomarkers Badge ===== */
.biomarker-badge {
    background: linear-gradient(135deg, var(--teal), var(--teal-light));
    color: white;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
}

/* ===== Buttons ===== */
.btn-primary {
    background: linear-gradient(135deg, var(--violet), var(--pink));
    border: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.btn-outline-primary {
    border: 2px solid var(--violet);
    color: var(--violet);
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, var(--violet), var(--violet-light));
    border-color: var(--violet);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--teal), var(--teal-light));
    border: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
}

.btn-outline-success {
    border: 2px solid var(--teal);
    color: var(--teal);
    border-radius: 12px;
    font-weight: 600;
}

.btn-outline-success:hover {
    background: linear-gradient(135deg, var(--teal), var(--teal-light));
    border-color: var(--teal);
    color: white;
}

/* ===== Eligibility Section ===== */
#eligibilityResults {
    background: linear-gradient(135deg, var(--bg-teal-soft), var(--bg-violet-soft));
    border-radius: 12px;
    padding: 1rem;
    border: 2px solid var(--border);
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .trial-header h1 { font-size: 1.1rem; }
    .trial-header { padding: 1.25rem 0; }
    .trial-header .back-link { font-size: 0.85rem; }
    .trial-section { padding: 1rem; margin-bottom: 1rem; }
    .trial-section h3 { font-size: 1rem; }
    .info-grid .info-item label { font-size: 0.75rem; }
    .info-grid .info-item span { font-size: 0.85rem; }
    .trial-badge { font-size: 0.7rem; padding: 0.25rem 0.6rem; }
    .d-flex.flex-wrap.gap-2 { gap: 0.35rem !important; }
}

@media (max-width: 768px) {
    .trial-header h1 { font-size: 1.25rem; }
    .trial-header { padding: 1.5rem 0; }
    .trial-section { padding: 1.25rem; margin-bottom: 1rem; }
    .trial-section h3 { font-size: 1.1rem; }
    /* Sidebar gets top margin when stacked */
    .col-lg-4 { margin-top: 0.5rem; }
    /* Action buttons in header */
    .d-flex.flex-wrap.gap-2 .btn { font-size: 0.8rem; padding: 0.4rem 0.7rem; }
    /* Eligibility criteria scroll area */
    #trialEligibility { max-height: 300px; font-size: 0.9rem; }
}

/* ─── G2: classes that replace inline styles in trial-detail.php ─────── */

/* Hero alert info pill (used to be: alert alert-info py-2 px-3 mb-2 + inline) */
.trial-hero-alert {
    border-radius: 12px;
    font-size: 0.82rem;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    display: inline-block;
}

/* Disqualified red badge (replaces inline style="background:#dc2626;color:#fff;") */
.match-badge.match-badge-disqualified {
    background: #dc2626;
    color: #fff;
}

/* Disqualified section card */
.trial-section.trial-section-disqualified {
    border-left: 4px solid #dc2626;
    background: #fef2f2;
}
.trial-section.trial-section-disqualified h3 {
    color: #dc2626;
}

/* Strong with primary color */
.text-primary-strong {
    color: var(--text-primary);
}

/* Scrollable boxes */
.scroll-y-200 { max-height: 200px; overflow-y: auto; }
.scroll-y-400 { max-height: 400px; overflow-y: auto; }

/* Sponsor name (font-weight 500) */
.fw-500 { font-weight: 500; }

/* Violet link */
.link-violet {
    color: var(--violet);
    font-weight: 500;
}

/* ─── G2: Eligibility criteria formatted (replaces nl2br'd text) ─────── */

#trialEligibility.elig-criteria-content {
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-primary);
}

.elig-criteria-content > *:first-child { margin-top: 0; }
.elig-criteria-content > *:last-child  { margin-bottom: 0; }

/* Subtitle (e.g., "Criterios de exclusión clave:") */
.elig-criteria-subtitle {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 1.5rem 0 0.6rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.elig-criteria-subtitle:first-child {
    margin-top: 0.25rem;
}

/* Bulleted list */
.elig-criteria-list {
    padding-left: 1.4rem;
    margin: 0.5rem 0 1rem;
    list-style-type: disc;
}
.elig-criteria-list li {
    margin-bottom: 0.5rem;
    line-height: 1.55;
    padding-left: 0.25rem;
}
.elig-criteria-list li::marker {
    color: var(--teal);
    font-size: 1.1em;
}

/* Plain paragraphs (intro text, etc.) */
.elig-criteria-paragraph {
    margin: 0 0 0.75rem;
    line-height: 1.55;
}
