/* ============================================================
   A.B.I.D.I.N — Clinical White Design System
   Digital Twin Healthcare Platform · Flask Stylesheet
   ============================================================ */

/* ----------------------------------------------------------------
   1. DESIGN TOKENS
   ---------------------------------------------------------------- */
:root {
    /* Brand */
    --navy:        #0d2166;
    --navy-deep:   #07124a;
    --teal:        #0097a7;
    --teal-hover:  #007b8c;
    --teal-bright: #26d0e0;
    --indigo:      #4f46e5;
    --violet:      #7c3aed;
    --violet-bg:   #f3e8ff;

    /* Surfaces */
    --bg:          #f0f4f8;
    --card:        #ffffff;
    --field:       #f8fafc;

    /* Borders */
    --border:      #e2e8f0;
    --border-soft: #e8eef6;
    --border-faint:#f1f5f9;

    /* Text */
    --ink:         #1e293b;
    --text:        #334155;
    --muted:       #64748b;
    --faint:       #94a3b8;

    /* Status */
    --green:        #16a34a;
    --green-bg:     #f0fdf4;
    --green-border: #86efac;
    --red:          #dc2626;
    --red-bg:       #fef2f2;
    --red-border:   #fca5a5;
    --amber:        #92400e;
    --amber-bg:     #fff8e1;
    --amber-border: #fcd34d;

    /* Effects */
    --grad-brand:  linear-gradient(135deg, #0d2166 0%, #0097a7 100%);
    --grad-bubble: linear-gradient(135deg, #0097a7 0%, #0d2166 100%);
    --shadow-sm:   0 2px 8px rgba(13, 33, 102, 0.05);
    --shadow-card: 0 2px 12px rgba(13, 33, 102, 0.07);
    --shadow-pop:  0 8px 32px rgba(13, 33, 102, 0.14);

    --font: "Noto Sans Mono", "Courier New", monospace;
    --radius: 12px;
}

/* ----------------------------------------------------------------
   2. RESET / BASE
   ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font-family: var(--font); }

/* ----------------------------------------------------------------
   3. SHARED PRIMITIVES
   ---------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 22px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: filter 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.btn:disabled { background: #cbd5e1 !important; cursor: not-allowed; box-shadow: none !important; }

.btn-primary {
    background: var(--grad-brand);
    color: #fff;
    box-shadow: 0 3px 12px rgba(0, 151, 167, 0.28);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }

.btn-ghost {
    background: #fff;
    color: var(--navy);
    border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: #f1f5f9; }

.badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
}

/* ================================================================
   4. LOGIN  (Responsive — Clinical White)
   ================================================================ */
.login-page {
    display: flex;
    height: 100vh;
    background: var(--bg);
}

/* -- Left brand panel -- */
.login-brand {
    flex: 0 0 55%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: var(--navy);
}
.login-brand__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    opacity: 0.55;
}
.login-brand__scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
        rgba(10, 25, 90, 0.30) 0%,
        rgba(10, 25, 90, 0.80) 55%,
        rgba(7, 18, 70, 1.00) 72%);
}
.login-brand__glow {
    position: absolute;
    bottom: -80px;
    right: -60px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 210, 210, 0.18) 0%, transparent 70%);
}
.login-brand__inner {
    position: relative;
    z-index: 2;
    padding: 40px 48px;
}
.login-brand__logo {
    height: 58px;
    margin-bottom: 24px;
    filter: brightness(0) invert(1);
}
.login-brand__title {
    color: #fff;
    font-size: 30px;
    font-weight: 800;
    margin: 0 0 10px;
    line-height: 1.25;
}
.login-brand__lead {
    color: rgba(200, 230, 255, 0.85);
    font-size: 14.5px;
    line-height: 1.75;
    margin: 0 0 24px;
    max-width: 400px;
}
.login-stats { display: flex; gap: 24px; margin-bottom: 28px; }
.login-stat { text-align: center; }
.login-stat__val {
    color: var(--teal-bright);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.login-stat__lbl {
    color: rgba(180, 210, 240, 0.70);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Disclaimer — shared base styles (desktop + mobile) */
.login-disclaimer {
    background: rgba(0, 0, 0, 0.35);
    border-left: 3px solid var(--teal-bright);
    border-radius: 0 8px 8px 0;
    padding: 13px 16px;
}
.login-disclaimer__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 0;
    background: none;
    border: none;
    cursor: default;
    text-align: left;
    font: inherit;
    color: inherit;
}
.login-disclaimer__label {
    color: var(--teal-bright);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    display: block;
    margin-bottom: 0;
}
.login-disclaimer__chev {
    display: none; /* hidden on desktop; shown on mobile via media query */
    flex: none;
    color: var(--teal-bright);
}
.login-disclaimer__body { display: block; }
.login-disclaimer p {
    color: rgba(180, 210, 230, 0.80);
    font-size: 11.5px;
    line-height: 1.65;
    margin: 6px 0 0;
}

/* -- Right form panel -- */
.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 40px 32px;
}
.login-disclaimer-slot { /* desktop: invisible slot — disclaimer lives in brand panel */ }
.login-card { width: 100%; max-width: 380px; }
.login-head { margin-bottom: 32px; }
.login-head__logo { height: 40px; margin-bottom: 20px; }
.login-head h2 {
    color: var(--navy);
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 6px;
    letter-spacing: -0.5px;
}
.login-head p { color: var(--muted); font-size: 14px; margin: 0; }

.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-field label {
    color: var(--navy);
    font-size: 12.5px;
    font-weight: 700;
    display: block;
    margin-bottom: 7px;
    letter-spacing: 0.3px;
}
.login-input-wrap { position: relative; }
.login-input-wrap > svg {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}
.login-input {
    width: 100%;
    background: var(--field);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--navy);
    font-size: 14px;
    padding: 12px 14px 12px 40px;
    outline: none;
    transition: border-color 0.15s;
}
.login-input:focus { border-color: var(--teal); }

.login-eye-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    color: var(--muted);
    opacity: 0.6;
}
.login-eye-btn:hover { opacity: 1; color: var(--navy); }
.login-input--password { padding-right: 44px; }

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.login-remember {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    color: var(--text);
    font-size: 13px;
}
.login-remember input { accent-color: var(--navy); width: 15px; height: 15px; }
.login-forgot {
    color: var(--teal);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
}

.login-submit {
    width: 100%;
    background: var(--grad-brand);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 13px;
    cursor: pointer;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 14px rgba(13, 33, 102, 0.25);
    transition: filter 0.15s;
}
.login-submit:hover { filter: brightness(1.06); }

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--faint);
    font-size: 12px;
}
.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}
.login-sso {
    width: 100%;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--navy);
    font-size: 14px;
    font-weight: 600;
    padding: 12px;
    cursor: pointer;
}
.login-sso:hover { background: var(--field); }
.login-altrow { text-align: center; color: var(--muted); font-size: 13px; }
.login-altrow a { color: var(--teal); text-decoration: none; font-weight: 700; }
.login-fineprint {
    margin-top: 28px;
    padding: 14px 16px;
    background: var(--field);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.login-fineprint p { color: var(--faint); font-size: 11px; line-height: 1.6; margin: 0; }

/* Error banner */
.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--red-bg);
    border: 1.5px solid var(--red-border);
    color: var(--red);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 13px;
    margin-bottom: 18px;
}

/* Forgot-password popup */
.login-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(7, 18, 70, 0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.login-popup-overlay.active { display: flex; }
.login-popup {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 32px 28px;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(7, 18, 70, 0.35);
}
.login-popup-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none; border: none;
    font-size: 24px; color: var(--faint); cursor: pointer;
}
.login-popup-icon {
    width: 56px; height: 56px;
    margin: 0 auto 14px;
    border-radius: 14px;
    background: var(--field);
    color: var(--teal);
    display: flex; align-items: center; justify-content: center;
}
.login-popup-title { color: var(--navy); font-size: 18px; font-weight: 800; margin: 0 0 8px; }
.login-popup-text { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0 0 14px; }
.login-popup-email { color: var(--teal); font-weight: 700; text-decoration: none; }

/* -- Login responsive (phones / small tablets ≤860px) -- */
@media (max-width: 860px) {
    .login-page {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        position: relative;
    }

    /* HCP photo becomes a fixed full-screen backdrop */
    .login-brand {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        flex: none;
        z-index: 0;
    }
    .login-brand__glow  { display: none; }
    .login-brand__inner { display: none; } /* brand text/stats hidden; disclaimer moves below card */

    /* Card column scrolls on top of the backdrop */
    .login-form-panel {
        position: relative;
        z-index: 1;
        background: transparent;
        min-height: 100vh;
        min-height: 100dvh;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 16px;
        padding: 28px 16px;
    }

    /* Frosted-glass card */
    .login-card {
        width: 100%;
        max-width: 420px;
        margin: 0;
        background: rgba(255, 255, 255, 0.96);
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
        border: 1px solid rgba(255, 255, 255, 0.6);
        border-radius: 16px;
        padding: 24px 20px;
        box-shadow: 0 18px 50px rgba(7, 18, 70, 0.45);
    }
    .login-head { margin-bottom: 22px; }

    /* Disclaimer slot — contains the accordion below the card */
    .login-disclaimer-slot {
        width: 100%;
        max-width: 420px;
    }

    /* Disclaimer accordion styles on mobile */
    .login-disclaimer {
        background: rgba(7, 18, 70, 0.82);
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
        border-radius: 12px;
        border-left: 3px solid var(--teal-bright);
        box-shadow: 0 10px 30px rgba(7, 18, 70, 0.35);
    }
    .login-disclaimer__toggle { cursor: pointer; }
    .login-disclaimer__label  { margin-bottom: 0; }
    .login-disclaimer__chev   { display: block; transition: transform 0.2s ease; }
    .login-disclaimer.is-open .login-disclaimer__chev { transform: rotate(180deg); }
    .login-disclaimer__body   { display: none; }
    .login-disclaimer.is-open .login-disclaimer__body { display: block; margin-top: 8px; }
}

/* ================================================================
   5. HOME  (Homepage V3 — Hero Masonry)
   ================================================================ */
.home { background: var(--bg); min-height: 100vh; }

.home-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(13, 33, 102, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 48px;
    height: 58px;
    box-shadow: 0 2px 12px rgba(13, 33, 102, 0.06);
}
.home-nav__logo { height: 32px; }
.home-nav__links { display: flex; gap: 28px; }
.home-nav__link {
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
}
.home-nav__link.is-active { color: var(--navy); font-weight: 700; border-bottom-color: var(--teal); }
.home-nav__avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--grad-brand);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 12px; font-weight: 700;
}

/* Hero */
.home-hero { position: relative; overflow: hidden; }
.home-hero__img { width: 100%; height: 180px; object-fit: cover; object-position: 60% center; }
.home-hero__scrim {
    position: absolute; inset: 0;
    background: linear-gradient(to right, transparent 40%, rgba(6, 12, 42, 0.55) 60%, rgba(6, 12, 42, 0.72) 100%);
}
.home-hero__title-wrap { position: absolute; inset: 0; display: flex; align-items: center; }
.home-hero__title {
    color: #fff;
    font-size: 28px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.3px;
    line-height: 1.2;
    margin-left: 50%;
    padding-right: 48px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

/* Stats bar */
.home-statsbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    padding: 14px 60px;
    gap: 48px;
    align-items: center;
}
.home-stat { display: flex; align-items: center; gap: 10px; }
.home-stat__val { color: var(--navy); font-weight: 800; font-size: 18px; }
.home-stat__lbl { color: var(--faint); font-size: 12px; font-weight: 500; }

.home-lang { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.home-lang__caption { color: var(--faint); font-size: 11px; font-weight: 500; margin-right: 4px; }
.home-lang__btn {
    display: flex; align-items: center; gap: 6px;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}
.home-lang__btn img { width: 20px; height: 15px; border-radius: 2px; object-fit: cover; }
.home-lang__btn.is-active { background: #f1f5f9; border-color: var(--navy); color: var(--navy); }

/* Masonry */
.home-main { max-width: 1200px; margin: 0 auto; padding: 40px 32px 60px; }
.home-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}
.home-section-head h2 { color: var(--navy); font-size: 20px; font-weight: 800; margin: 0 0 4px; }
.home-section-head p { color: var(--faint); font-size: 13px; margin: 0; }
.home-filters { display: flex; gap: 8px; }
.home-filter {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: #fff;
    color: var(--muted);
    border: 1px solid var(--border);
}
.home-filter.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }

.home-grid { display: grid; gap: 20px; margin-bottom: 20px; }
.home-grid--a { grid-template-columns: 2fr 1fr 1fr; }
.home-grid--b { grid-template-columns: 1fr 1fr 2fr; }

.mod-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card);
    padding: 26px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.mod-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.mod-card__top { display: flex; align-items: flex-start; justify-content: space-between; }
.mod-card__icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}
.mod-card__tag { padding: 4px 10px; }
.mod-card__title { color: var(--navy); font-weight: 700; font-size: 15px; }
.mod-card__desc { color: var(--muted); font-size: 13px; line-height: 1.7; flex-grow: 1; }
.mod-card__cta {
    background: #fff;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, color 0.15s;
}
/* accent themes — navy / teal */
.mod-card--teal  .mod-card__icon { background: rgba(0, 151, 167, 0.08); }
.mod-card--teal  .mod-card__tag  { background: rgba(0, 151, 167, 0.08); color: var(--teal); }
.mod-card--teal  .mod-card__cta  { border: 1.5px solid var(--teal); color: var(--teal); }
.mod-card--teal  .mod-card__cta:hover { background: var(--teal); color: #fff; }
.mod-card--navy  .mod-card__icon { background: rgba(13, 33, 102, 0.08); }
.mod-card--navy  .mod-card__tag  { background: rgba(13, 33, 102, 0.08); color: var(--navy); }
.mod-card--navy  .mod-card__cta  { border: 1.5px solid var(--navy); color: var(--navy); }
.mod-card--navy  .mod-card__cta:hover { background: var(--navy); color: #fff; }

.home-cta-section {
    padding: 0 32px 48px;
}
.home-cta-banner {
    border-radius: 16px;
    background: var(--grad-brand);
    padding: 24px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.home-cta-banner__title { color: #fff; font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.home-cta-banner__text { color: rgba(200, 235, 255, 0.78); font-size: 13px; }
.home-cta-banner img { height: 70px; opacity: 0.85; }

/* ---------- HOME (mobile, ≤860px) ---------- */
@media (max-width: 860px) {
    /* Nav: logo + avatar stay on same row, links wrap into a
       horizontally-scrollable strip below them */
    .home-nav {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 16px;
        gap: 8px 12px;
    }
    .home-nav__links {
        order: 3;           /* pushes links below logo + avatar */
        width: 100%;
        gap: 18px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none;  /* Firefox */
    }
    .home-nav__links::-webkit-scrollbar { display: none; }
    .home-nav__link { white-space: nowrap; font-size: 13px; }

    /* Hero: shorter, title repositioned left so it's fully readable */
    .home-hero__img { height: 140px; }
    .home-hero__scrim {
        background: linear-gradient(to right,
            rgba(6, 12, 42, 0.35) 0%,
            rgba(6, 12, 42, 0.70) 100%);
    }
    .home-hero__title {
        margin-left: 16px;
        padding-right: 16px;
        font-size: 17px;
        line-height: 1.25;
    }

    /* Stats bar: items wrap, language selector gets its own full row */
    .home-statsbar {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 10px 24px;
    }
    .home-lang {
        margin-left: 0;
        width: 100%;
        flex-wrap: wrap;
        padding-top: 4px;
        border-top: 1px solid var(--border-faint);
    }

    /* Main section padding */
    .home-main { padding: 24px 16px 40px; }

    /* Section head stacks title + filters vertically */
    .home-section-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 18px;
    }
    .home-filters { flex-wrap: wrap; gap: 6px; }
    .home-filter  { font-size: 11.5px; padding: 5px 12px; }

    /* Both module grids collapse to a single column */
    .home-grid--a,
    .home-grid--b {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-bottom: 14px;
    }

    /* Cards get slightly tighter padding on mobile */
    .mod-card { padding: 20px 18px; gap: 12px; }
    .mod-card__title { font-size: 14.5px; }

    /* CTA banner stacks text + logo vertically */
    .home-cta-section { padding: 0 16px 32px; }
    .home-cta-banner {
        flex-direction: column;
        text-align: center;
        gap: 14px;
        padding: 22px 20px;
    }
    .home-cta-banner img { height: 52px; margin: 0 auto; }
}

/* ================================================================
   6. APP SHELL  (Chat / Objection / Training — shared)
   ================================================================ */
.app-shell { display: flex; height: 100vh; overflow: hidden; background: var(--bg); }

/* -- Sidebar -- */
.app-sidebar {
    width: 272px;
    min-width: 272px;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}
.app-sidebar__logo {
    padding: 18px 0 14px;
    border-bottom: 1px solid var(--border-faint);
    display: flex;
    justify-content: center;
}
.app-sidebar__logo img { height: 42px; }
.app-sidebar__body { padding: 0 16px 28px; flex-grow: 1; }
.app-sidebar__group { margin-top: 22px; }
.app-sidebar__label {
    font-size: 10px;
    font-weight: 700;
    color: var(--faint);
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin: 0 0 10px;
}

/* Language radio cards */
.lang-cards { display: flex; gap: 8px; }
.lang-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    border: none;
    cursor: pointer;
    padding: 8px 6px;
    border-radius: 8px;
    background: transparent;
    outline: 2px solid transparent;
}
.lang-card img { width: 32px; height: 24px; border-radius: 3px; object-fit: cover; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.lang-card span { font-size: 11px; color: var(--muted); font-weight: 500; }
.lang-card input { display: none; }
.lang-card input:checked + img + span,
.lang-card.is-active span { color: var(--navy); font-weight: 700; }
.lang-card.is-active { background: #eef7ff; outline-color: var(--teal); }

/* Quick-nav links */
.app-nav { display: flex; flex-direction: column; gap: 7px; }
.app-nav__link {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--field);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
}
.app-nav__link:hover { background: #eef2fb; }
.app-nav__icon { font-size: 14px; }

/* Sidebar form fields */
.app-field { margin-top: 10px; }
.app-field > label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}
.app-select {
    width: 100%;
    padding: 7px 10px;
    border-radius: 7px;
    border: 1.5px solid var(--border);
    font-size: 12px;
    color: var(--text);
    background: #fff;
    cursor: pointer;
    outline: none;
}
.app-select:focus { border-color: var(--teal); }

/* -- Main column -- */
.app-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Banner */
.app-banner { position: relative; flex-shrink: 0; height: 72px; }
.app-banner img { width: 100%; height: 72px; object-fit: cover; object-position: 60% center; }
.app-banner__scrim {
    position: absolute; inset: 0;
    background: linear-gradient(to right, transparent 30%, rgba(6, 12, 42, 0.52) 58%, rgba(6, 12, 42, 0.70) 100%);
}
.app-banner__logo {
    position: absolute; inset: 0;
    display: flex; align-items: center; padding-left: 50%;
}
.app-banner__logo img {
    width: auto; height: 26px;
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

/* History accordion */
.history { flex-shrink: 0; background: #fff; border-bottom: 1px solid var(--border); }
.history__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
}
.history__icon { font-size: 15px; }
.history__title { font-weight: 700; font-size: 13px; color: var(--navy); flex-grow: 1; text-align: left; }
.history__count { font-weight: 400; font-size: 12px; color: var(--faint); margin-left: 8px; }
.history__chevron { transition: transform 0.22s; color: var(--faint); }
.history__toggle.is-open .history__chevron { transform: rotate(180deg); }
.history__list { display: none; border-top: 1px solid var(--border-faint); padding: 6px 0 8px; }
.history__list.is-open { display: block; }
.history__empty { padding: 24px 20px; text-align: center; color: var(--faint); font-size: 13px; }
.hist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    cursor: pointer;
    background: #fff;
    transition: background 0.15s;
}
.hist-item:hover { background: var(--field); }
.hist-item__title { font-size: 13px; color: var(--text); font-weight: 500; }
.hist-item__title-wrap { display: flex; align-items: center; gap: 8px; }
.hist-item__date { font-size: 11px; color: var(--faint); flex-shrink: 0; }
.hist-item__preview {
    font-size: 10.5px;
    color: var(--faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-style: italic;
}

/* -- Chat stream -- */
.chat-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.chat-scroll::-webkit-scrollbar { width: 5px; }
.chat-scroll::-webkit-scrollbar-track { background: var(--border-faint); }
.chat-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.msg-row { display: flex; gap: 12px; align-items: flex-start; }
.msg-row--user { justify-content: flex-end; align-items: flex-end; gap: 10px; }

.avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.bubble-user {
    max-width: 62%;
    background: var(--grad-bubble);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.65;
    box-shadow: 0 3px 12px rgba(0, 151, 167, 0.22);
}
.bubble-user__label {
    font-size: 10px;
    font-weight: 700;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 4px;
    text-align: right;
}
.bubble-user-wrap { max-width: 62%; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bubble-user-wrap .bubble-user { max-width: 100%; }

.bubble-ai {
    flex: 1;
    background: #fff;
    border-radius: 4px 18px 18px 18px;
    border: 1px solid var(--border-soft);
    box-shadow: 0 2px 12px rgba(13, 33, 102, 0.06);
    padding: 14px 20px;
}
.bubble-ai__label {
    font-size: 11px;
    font-weight: 700;
    color: var(--teal);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Markdown rendered inside AI bubbles */
.md h3 { font-size: 14px; font-weight: 800; color: var(--navy); margin: 14px 0 5px; letter-spacing: -0.2px; }
.md p  { font-size: 13px; color: var(--text); margin: 5px 0; line-height: 1.75; }
.md ul { margin: 4px 0 10px 18px; padding: 0; }
.md li { font-size: 13px; color: var(--text); line-height: 1.75; margin-bottom: 2px; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.md strong { color: var(--navy); }
.md blockquote, .md .voc {
    font-size: 12px;
    color: var(--muted);
    font-style: italic;
    background: var(--border-faint);
    border-left: 3px solid var(--teal);
    padding: 8px 12px;
    border-radius: 0 6px 6px 0;
    margin: 8px 0;
    line-height: 1.65;
}

/* Welcome / empty state */
.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 48px;
    text-align: center;
    gap: 14px;
}
.chat-welcome__icon { font-size: 48px; line-height: 1; }
.chat-welcome h2 { font-size: 20px; font-weight: 800; color: var(--navy); margin: 0; }
.chat-welcome p { font-size: 13px; color: var(--muted); line-height: 1.7; max-width: 420px; margin: 0; }
.chat-welcome__tip {
    background: var(--amber-bg);
    border: 1.5px solid var(--amber-border);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--amber);
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 420px;
    text-align: left;
}

/* -- Input row -- */
.chat-input-row {
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-input {
    flex: 1;
    padding: 11px 16px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text);
    background: var(--field);
    outline: none;
    resize: none;
}
.chat-input:focus { border-color: var(--teal); }
.send-btn {
    width: 44px; height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
    background: var(--teal);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 151, 167, 0.30);
    transition: background 0.15s;
}
.send-btn:hover { background: var(--teal-hover); }

/* -- Hamburger sidebar toggle (mobile) -- */
.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 400;
    background: var(--navy);
    border: none;
    border-radius: 9px;
    cursor: pointer;
    color: #fff;
    box-shadow: 0 3px 12px rgba(13, 33, 102, 0.30);
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(7, 18, 70, 0.45);
    z-index: 390;
}
.sidebar-overlay.is-active { display: block; }

@media (max-width: 768px) {
    .sidebar-toggle { display: flex; }
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100%;
        z-index: 395;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }
    .app-sidebar.is-open { transform: translateX(0); }

    /* Training: tighten horizontal spacing */
    .quiz-progress  { padding: 12px 14px 6px; }
    .quiz-card      { margin: 10px 14px 0; }
    .quiz-footer    { margin: 16px 14px 0; flex-wrap: wrap; gap: 10px; }
    .quiz-footer__right { flex: 1; justify-content: flex-end; }

    /* Results: 2-col stat grid, stacked actions */
    .results-wrap   { padding: 16px 14px 24px; }
    .results-stats  { grid-template-columns: repeat(2, 1fr); }
    .results-actions { flex-direction: column; align-items: stretch; }
    .results-actions button { width: 100% !important; }

    /* Landing: reduce padding on small screens */
    .train-landing  { padding: 28px 20px; }
    .train-landing__chips { gap: 8px; }
    .train-chip     { padding: 8px 12px; font-size: 12px; }
}

/* ================================================================
   7. ERROR PAGES
   ================================================================ */
.error-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}
.error-content {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    padding: 48px 56px;
    text-align: center;
    max-width: 420px;
}
.error-icon { font-size: 48px; margin-bottom: 12px; }
.error-content h1 { font-size: 64px; font-weight: 800; color: var(--navy); margin: 0; letter-spacing: -2px; }
.error-content h2 { font-size: 20px; font-weight: 700; color: var(--ink); margin: 6px 0 10px; }
.error-content p { color: var(--muted); font-size: 14px; margin: 0 0 24px; }

/* ================================================================
   8. TRAINING MODULE
   ================================================================ */
.app-sidebar--training { width: 272px; min-width: 272px; }

.train-checkgroup {
    max-height: 96px;
    overflow-y: auto;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    padding: 6px 8px;
    margin-top: 4px;
    background: #fafcff;
}
.train-checkgroup::-webkit-scrollbar { width: 4px; }
.train-checkgroup::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.train-check {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 0;
    cursor: pointer;
    border-radius: 4px;
}
.train-check input { display: none; }
.train-check__box {
    width: 15px; height: 15px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1.5px solid #cbd5e1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.train-check__box svg { display: none; }
.train-check input:checked + .train-check__box { border-color: var(--teal); background: var(--teal); }
.train-check input:checked + .train-check__box svg { display: block; }
.train-check__label { font-size: 11.5px; color: var(--text); }
.train-check input:checked ~ .train-check__label { color: var(--navy); font-weight: 600; }

.train-pri-btn {
    width: 100%;
    margin-top: 14px;
    padding: 11px;
    background: var(--grad-brand);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    box-shadow: 0 3px 12px rgba(0, 151, 167, 0.28);
}
.train-pri-btn:hover { filter: brightness(1.06); }
.train-ghost-btn {
    width: 100%;
    margin-top: 8px;
    padding: 9px;
    background: #fff;
    color: var(--navy);
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.train-ghost-btn:hover { background: var(--border-faint); }

/* Static history bar (training) */
.train-historybar {
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 10px 22px;
    display: flex;
    align-items: center;
    gap: 9px;
}
.train-historybar__title { font-size: 13px; font-weight: 700; color: var(--navy); }
.train-historybar__count { font-size: 12px; color: var(--faint); }

.train-view { flex: 1; overflow-y: auto; }
.train-view::-webkit-scrollbar { width: 6px; }
.train-view::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Landing */
.train-landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 48px;
    text-align: center;
    gap: 14px;
    min-height: 100%;
}
.train-landing__icon { font-size: 52px; line-height: 1; }
.train-landing h1 { font-size: 24px; font-weight: 800; color: var(--navy); margin: 0; letter-spacing: -0.3px; }
.train-landing p { font-size: 14px; color: var(--muted); line-height: 1.7; max-width: 470px; margin: 0; }
.train-landing__chips { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.train-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
    box-shadow: var(--shadow-sm);
}
.train-landing__meta { font-size: 12px; color: var(--faint); margin: 2px 0 0; }
.train-start-lg {
    margin-top: 12px;
    padding: 13px 32px;
    background: var(--grad-brand);
    color: #fff;
    border: none;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 151, 167, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 9px;
}
.train-start-lg:hover { filter: brightness(1.06); }

/* Quiz view */
.quiz-wrap { padding: 0 0 20px; }
.quiz-progress { padding: 14px 28px 6px; }
.quiz-progress__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.quiz-progress__label { font-size: 12px; font-weight: 700; color: var(--navy); }
.quiz-progress__count { font-size: 12px; font-weight: 700; color: var(--faint); }
.quiz-progress__track { height: 7px; background: var(--border); border-radius: 20px; overflow: hidden; }
.quiz-progress__bar { height: 100%; background: linear-gradient(90deg, var(--teal), var(--navy)); border-radius: 20px; transition: width 0.4s; }

.quiz-card { margin: 10px 28px 0; }
.quiz-badges { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.quiz-badge-q { background: var(--grad-brand); color: #fff; font-size: 12px; font-weight: 700; border-radius: 20px; padding: 5px 14px; }
.quiz-badge-type { background: var(--violet-bg); color: var(--violet); font-size: 12px; font-weight: 700; border-radius: 20px; padding: 5px 14px; }
.quiz-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.quiz-meta span { font-size: 11px; color: var(--muted); }
.quiz-meta b { color: var(--text); font-weight: 600; }
.quiz-meta i { color: var(--faint); font-style: normal; }
.quiz-question {
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    font-size: 15px;
    color: var(--navy);
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 16px;
}
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-opt {
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    width: 100%;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 13px 16px;
    cursor: pointer;
    transition: all 0.14s;
}
.quiz-opt:hover { border-color: var(--teal); background: #f7fdfe; }
.quiz-opt input { display: none; }
.quiz-opt__letter {
    width: 30px; height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    background: var(--border-faint);
    color: var(--muted);
    border: 1.5px solid var(--border);
}
.quiz-opt__text { font-size: 14px; color: var(--ink); font-weight: 500; line-height: 1.5; }
.quiz-opt.is-selected { background: #f0fbfc; border-color: var(--teal); box-shadow: 0 2px 10px rgba(0, 151, 167, 0.14); }
.quiz-opt.is-selected .quiz-opt__letter { background: var(--teal); color: #fff; border: none; }
.quiz-opt.is-selected .quiz-opt__text { font-weight: 600; }

.quiz-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 28px 0;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.quiz-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--teal);
    background: #f0fbfc;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 151, 167, 0.2);
}
.quiz-footer__right { display: flex; align-items: center; gap: 14px; }

/* Results */
.results-wrap { padding: 24px 28px 32px; }
.results-hero { text-align: center; margin-bottom: 22px; }
.results-hero__icon { font-size: 50px; }
.results-hero h1 { font-size: 24px; font-weight: 800; color: var(--navy); margin: 6px 0 0; }
.results-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 28px; }
.result-stat {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.result-stat__label {
    font-size: 10px;
    font-weight: 700;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    line-height: 1.3;
}
.result-stat__val { font-size: 19px; font-weight: 800; color: var(--navy); }
.result-stat__val--teal { color: var(--teal); }
.result-stat__val--green { color: var(--green); }
.result-stat__val--red { color: var(--red); }
.result-stars { font-size: 18px; letter-spacing: 1px; }
.result-stars .on { color: #f59e0b; }
.result-stars .off { color: #d1d5db; }

.results-wrap h2 { font-size: 17px; font-weight: 800; color: var(--navy); margin: 0 0 14px; }
.review-list { display: flex; flex-direction: column; gap: 14px; }
.review-card {
    background: #fff;
    border: 1px solid var(--border);
    border-left: 5px solid var(--faint);
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: 0 2px 8px rgba(13, 33, 102, 0.04);
}
.review-card--correct { border-left-color: var(--green); }
.review-card--wrong { border-left-color: var(--red); }
.review-card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.review-card__status {
    width: 22px; height: 22px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
    background: var(--faint);
}
.review-card--correct .review-card__status { background: var(--green); }
.review-card--wrong .review-card__status { background: var(--red); }
.review-card__qid { font-size: 14px; font-weight: 800; color: var(--navy); }
.review-card__meta { font-size: 11px; color: var(--faint); }
.review-card__question { font-size: 14px; color: var(--navy); font-weight: 600; line-height: 1.6; margin: 0 0 12px; }
.review-opts { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.review-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    padding: 9px 13px;
}
.review-opt--correct { background: var(--green-bg); border-color: var(--green-border); }
.review-opt--wrong { background: var(--red-bg); border-color: var(--red-border); }
.review-opt__letter {
    width: 24px; height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    background: var(--border-faint);
    color: var(--muted);
}
.review-opt--correct .review-opt__letter { background: var(--green); color: #fff; }
.review-opt--wrong .review-opt__letter { background: var(--red); color: #fff; }
.review-opt__text { font-size: 13px; color: var(--text); font-weight: 500; line-height: 1.5; }
.review-opt--correct .review-opt__text { color: var(--green); font-weight: 600; }
.review-opt--wrong .review-opt__text { color: var(--red); font-weight: 600; }
.review-opt__flag { margin-left: auto; font-size: 11px; font-weight: 800; color: var(--green); }
.review-answer {
    background: var(--field);
    border-radius: 8px;
    padding: 8px 13px;
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 10px;
}
.review-answer b { font-weight: 700; }
.review-expert-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    color: var(--teal);
    font-size: 13px;
    font-weight: 700;
}
.review-expert-toggle svg { transition: transform 0.2s; }
.review-expert-toggle.is-open svg { transform: rotate(90deg); }
.review-expert { display: none; margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--border); }
.review-expert.is-open { display: block; }
.review-expert p { font-size: 13px; margin: 0 0 10px; color: var(--text); line-height: 1.7; }
.review-expert b { color: var(--navy); font-weight: 700; }
.review-expert .correct-lbl { font-weight: 800; color: var(--green); }
.review-refs {
    font-size: 12px;
    color: var(--muted);
    background: var(--border-faint);
    border-radius: 7px;
    padding: 8px 12px;
    display: inline-block;
}

.train-recs {
    background: #f0fbfc;
    border: 1.5px solid rgba(0, 151, 167, 0.25);
    border-radius: 14px;
    padding: 18px 20px;
    margin-top: 24px;
}
.train-recs__head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.train-recs__head h3 { font-size: 16px; font-weight: 800; color: var(--teal); margin: 0; }
.train-recs__list { display: flex; flex-direction: column; gap: 10px; }
.train-rec { display: flex; gap: 10px; font-size: 13px; color: var(--text); line-height: 1.65; }
.train-rec__arrow { color: var(--teal); font-weight: 800; flex-shrink: 0; }
.results-actions { display: flex; justify-content: center; gap: 14px; margin-top: 26px; }

/* ================================================================
   9. CONTENT GENERATION MODULE (indigo / violet accent)
   ================================================================ */
.app-sidebar--content { width: 272px; min-width: 272px; }

.cm-progress-rail { position: relative; padding-left: 4px; }
.cm-step-dot {
    display: flex;
    align-items: center;
    gap: 11px;
    position: relative;
    padding-bottom: 16px;
}
.cm-step-dot:last-child { padding-bottom: 0; }
.cm-step-dot__line {
    position: absolute;
    left: 12px;
    top: 24px;
    width: 2px;
    height: calc(100% - 24px);
    background: var(--border);
}
.cm-step-dot__num {
    width: 25px; height: 25px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    background: #cbd5e1;
    z-index: 1;
}
.cm-step-dot__label { font-size: 13px; font-weight: 500; color: var(--faint); }
.cm-step-dot.is-active .cm-step-dot__num { background: var(--indigo); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.13); }
.cm-step-dot.is-active .cm-step-dot__label { font-weight: 700; color: var(--navy); }
.cm-step-dot.is-done .cm-step-dot__num { background: var(--green); }
.cm-step-dot.is-done .cm-step-dot__line { background: var(--green); }
.cm-step-dot.is-done .cm-step-dot__label { font-weight: 700; color: var(--green); }

.cm-canvas { flex: 1; overflow-y: auto; padding: 22px 30px 40px; }
.cm-canvas::-webkit-scrollbar { width: 7px; }
.cm-canvas::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.cm-inner { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

/* Step shells */
.cm-step {
    background: #fff;
    border: 1.5px solid #6366f1;
    border-radius: 14px;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08), 0 8px 24px rgba(13, 33, 102, 0.07);
    overflow: hidden;
}
.cm-step__head {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 15px 20px;
    background: #f5f6ff;
    border-bottom: 1px solid var(--border);
}
.cm-step__head h2 { font-size: 15.5px; font-weight: 800; color: var(--navy); margin: 0; }
.cm-step__body { padding: 18px 20px 20px; }
.cm-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    background: var(--indigo);
}
.cm-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: #f6fef9;
    border: 1.5px solid var(--green-border);
    border-radius: 12px;
    padding: 13px 18px;
    cursor: pointer;
}
.cm-row--locked { background: #fff; border-color: var(--border); opacity: 0.65; cursor: default; }
.cm-row__check {
    width: 26px; height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    background: var(--green);
}
.cm-row--locked .cm-row__check { background: #cbd5e1; }
.cm-row__title { font-size: 14px; font-weight: 700; color: var(--navy); }
.cm-row--locked .cm-row__title { color: var(--faint); }
.cm-row__summary {
    font-size: 12px;
    color: var(--muted);
    margin-left: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.cm-row__edit {
    font-size: 12px;
    font-weight: 700;
    color: var(--indigo);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 5px 13px;
    background: #fff;
    flex-shrink: 0;
}

.cm-lead { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.6; }
.cm-textarea {
    width: 100%;
    resize: vertical;
    padding: 13px 15px;
    border-radius: 11px;
    border: 1.5px solid var(--border);
    font-size: 13.5px;
    color: var(--ink);
    line-height: 1.65;
    outline: none;
    background: #fbfcfe;
    font-family: var(--font);
}
.cm-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.cm-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cm-field > label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    display: block;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.cm-select {
    width: 100%;
    padding: 9px 11px;
    border-radius: 9px;
    border: 1.5px solid var(--border);
    font-size: 12.5px;
    color: var(--ink);
    background: #fff;
    cursor: pointer;
    outline: none;
    font-weight: 600;
}
.cm-segmented { display: flex; background: var(--border-faint); border-radius: 9px; padding: 3px; gap: 3px; }
.cm-seg {
    flex: 1;
    padding: 7px 4px;
    border: none;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    color: var(--muted);
}
.cm-seg.is-active { background: #fff; color: var(--indigo); box-shadow: 0 1px 4px rgba(13, 33, 102, 0.1); }

.cm-pri-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    background: linear-gradient(135deg, #6366f1, var(--violet));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.2);
}
.cm-pri-btn:hover { filter: brightness(1.06); }
.cm-ghost-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #fff;
    color: var(--navy);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
}
.cm-ghost-btn:hover { background: var(--border-faint); }
.cm-actions-end { display: flex; justify-content: flex-end; }

/* Analysis panel */
.cm-panel { border: 1.5px solid var(--border); border-radius: 12px; overflow: hidden; background: #fbfcfe; }
.cm-panel__head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 16px;
    background: #eef2ff;
    border: none;
    cursor: pointer;
}
.cm-panel__head h3 { font-size: 13px; font-weight: 800; color: var(--indigo); margin: 0; }
.cm-panel__head .sub { font-size: 11px; color: var(--muted); font-weight: 600; }
.cm-panel__head svg { margin-left: auto; color: var(--indigo); transition: transform 0.2s; }
.cm-panel__head.is-open svg { transform: rotate(180deg); }
.cm-panel__body { padding: 14px 16px 16px; }
.cm-metarow { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cm-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 10px;
}
.cm-meta__label { color: var(--faint); font-weight: 600; }
.cm-meta__val { font-weight: 700; border-radius: 5px; padding: 1px 7px; }
.cm-group { display: grid; grid-template-columns: 118px 1fr; gap: 10px; align-items: start; margin-bottom: 11px; }
.cm-group__label { font-size: 11px; font-weight: 700; color: var(--muted); padding-top: 4px; }
.cm-group__items { display: flex; flex-wrap: wrap; gap: 6px; }
.cm-tag { font-size: 11.5px; font-weight: 600; border-radius: 7px; padding: 3px 10px; }

/* tone palette */
.tone-green  { background: #dcfce7; color: #15803d; }
.tone-blue   { background: #dbeafe; color: #1d4ed8; }
.tone-rose   { background: #ffe4e6; color: #be123c; }
.tone-amber  { background: #fef3c7; color: #b45309; }
.tone-indigo { background: #e0e7ff; color: #4338ca; }
.tone-teal   { background: #cffafe; color: #0e7490; }
.tone-violet { background: #f3e8ff; color: #7c3aed; }

/* Strategy panel */
.cm-strategy { border: 1.5px solid rgba(79, 70, 229, 0.19); border-radius: 12px; padding: 16px 18px; background: #fff; }
.cm-strategy__top { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.cm-strategy__eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: var(--indigo); text-transform: uppercase; }
.cm-match {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    color: var(--green);
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    border-radius: 20px;
    padding: 3px 11px;
}
.cm-strategy h3 { font-size: 17px; font-weight: 800; color: var(--navy); margin: 0; display: inline; }
.cm-strategy__tagline { font-size: 12px; color: var(--indigo); font-weight: 600; margin-left: 10px; }
.cm-strategy__why { font-size: 13px; color: var(--text); line-height: 1.7; margin: 8px 0 10px; }
.cm-strategy__why b { font-weight: 700; color: var(--navy); }
.cm-bestfor { font-size: 11.5px; color: var(--muted); }
.cm-bestfor b { font-weight: 700; color: var(--violet); }
.cm-alts { margin-top: 18px; }
.cm-alts__label { font-size: 11px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 8px; }
.cm-alt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cm-alt {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--indigo);
    background: #eef2ff;
    border: 1.5px solid transparent;
    border-radius: 20px;
    padding: 6px 15px;
    cursor: pointer;
}
.cm-alt.is-active { color: #fff; background: var(--indigo); border-color: var(--indigo); }
.cm-strategy__desc { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: #fbfcfe; }
.cm-strategy__desc h4 { font-size: 14px; font-weight: 800; color: var(--navy); margin: 0 0 6px; }
.cm-strategy__desc p { font-size: 12.5px; color: var(--text); line-height: 1.6; margin: 0 0 8px; }

/* Sources */
.cm-segment__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cm-segment__dot { width: 7px; height: 7px; border-radius: 50%; }
.cm-segment__title { font-size: 11px; font-weight: 800; letter-spacing: 0.6px; color: var(--muted); text-transform: uppercase; }
.cm-segment__list { display: flex; flex-direction: column; gap: 9px; }
.cm-source {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 13px 15px;
    background: #fff;
}
.cm-source:hover { border-color: #6366f1; }
.cm-source__top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.cm-source__idx { font-size: 11px; font-weight: 800; color: var(--muted); background: var(--border-faint); border-radius: 6px; padding: 2px 8px; }
.cm-source__tag { font-size: 10.5px; font-weight: 700; color: var(--indigo); background: #eef2ff; border-radius: 5px; padding: 2px 8px; }
.cm-source__doi { margin-left: auto; font-size: 11px; color: var(--teal); font-weight: 600; text-decoration: none; }
.cm-source__doi:hover { text-decoration: underline; }
.cm-source__title { font-size: 13.5px; font-weight: 700; color: var(--navy); margin: 0 0 3px; line-height: 1.5; }
.cm-source__meta { font-size: 11.5px; color: var(--faint); margin: 0 0 7px; }
.cm-source__abs { font-size: 12.5px; color: var(--text); line-height: 1.65; margin: 0; font-style: italic; }
.cm-sources-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

/* Narrative */
.cm-narratives { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cm-narrative {
    text-align: left;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 13px 15px;
    cursor: pointer;
}
.cm-narrative.is-active { background: #f5f6ff; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.09); }
.cm-narrative__top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.cm-narrative__radio {
    width: 16px; height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1.5px solid #cbd5e1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cm-narrative.is-active .cm-narrative__radio { border-color: var(--indigo); background: var(--indigo); }
.cm-narrative.is-active .cm-narrative__radio::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.cm-narrative__name { font-size: 13.5px; font-weight: 700; color: var(--navy); }
.cm-narrative__rec { margin-left: auto; font-size: 9.5px; font-weight: 800; color: var(--indigo); background: #eef2ff; border-radius: 5px; padding: 2px 7px; text-transform: uppercase; letter-spacing: 0.5px; }
.cm-narrative__desc { font-size: 12px; color: var(--muted); line-height: 1.55; margin: 0; padding-left: 24px; }

/* Result */
.cm-detected { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.cm-detected__label { font-size: 11px; font-weight: 700; color: var(--muted); }
.cm-pill { font-size: 11px; font-weight: 800; border-radius: 7px; padding: 4px 11px; }
.cm-metabar { display: flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 11px; overflow: hidden; background: #fbfcfe; }
.cm-metabar__cell { flex: 1 1 25%; min-width: 130px; padding: 11px 15px; border-right: 1px solid var(--border); }
.cm-metabar__cell:last-child { border-right: none; }
.cm-metabar__label { font-size: 10px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.cm-metabar__val { font-size: 12.5px; font-weight: 700; color: var(--navy); }
.cm-note {
    background: var(--amber-bg);
    border: 1px solid var(--amber-border);
    border-left: 4px solid #d97706;
    border-radius: 10px;
    padding: 13px 16px;
}
.cm-note__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cm-note__head span { font-size: 12.5px; font-weight: 800; color: #d97706; }
.cm-note p { font-size: 12px; color: var(--text); line-height: 1.65; margin: 0; }
.cm-editor { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cm-editor__bar { display: flex; align-items: center; gap: 8px; padding: 9px 15px; background: var(--field); border-bottom: 1px solid var(--border); }
.cm-editor__bar .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.cm-editor__bar span { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.cm-editor__body { padding: 18px 20px; background: #fff; }
.cm-editor__body h1 { font-size: 18px; font-weight: 800; color: var(--navy); line-height: 1.4; margin: 0 0 14px; }
.cm-editor__body p { font-size: 13.5px; color: var(--text); line-height: 1.75; margin: 0 0 12px; }

.cm-sources-panel { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cm-sources-panel__head { padding: 12px 18px; background: var(--field); border-bottom: 1px solid var(--border); }
.cm-sources-panel__head span { font-size: 14px; font-weight: 800; color: var(--navy); }
.cm-sources-panel__body { padding: 16px 18px; display: flex; flex-direction: column; gap: 18px; background: #fff; }
.cm-reflist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.cm-reflist li { display: flex; gap: 9px; align-items: start; font-size: 12.5px; line-height: 1.55; }
.cm-reflist__num { min-width: 18px; font-weight: 700; color: var(--muted); flex-shrink: 0; padding-top: 1px; }
.cm-reflist__title { flex: 1; font-weight: 600; color: var(--ink); }
.cm-reflist__tail { display: flex; align-items: center; gap: 6px; flex-shrink: 0; font-size: 11.5px; color: var(--muted); }
.cm-trial-badge { font-size: 9.5px; font-weight: 800; background: var(--amber-bg); color: #d97706; border: 1px solid var(--amber-border); border-radius: 4px; padding: 1px 7px; }
.cm-reflist__doi { color: var(--teal); font-weight: 600; text-decoration: none; white-space: nowrap; }
.cm-qa-row, .cm-smpc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 13px;
    background: #fff;
}
.cm-qa-row { border-left: 3px solid var(--green); }
.cm-smpc-row { border-left: 3px solid var(--indigo); }
.cm-qa-row__badge { font-size: 9.5px; font-weight: 800; color: var(--green); background: var(--green-bg); border-radius: 4px; padding: 2px 7px; flex-shrink: 0; }
.cm-smpc-row__badge { font-size: 9.5px; font-weight: 800; color: var(--indigo); background: #eef2ff; border-radius: 4px; padding: 2px 7px; flex-shrink: 0; }
.cm-qa-row__q, .cm-smpc-row__q { font-size: 12.5px; color: var(--ink); font-weight: 500; line-height: 1.5; flex: 1; }
.cm-qa-row__src { font-size: 11px; color: var(--muted); flex-shrink: 0; text-align: right; }
.cm-qa-row__src b { font-weight: 700; color: #d97706; background: var(--amber-bg); border-radius: 4px; padding: 1px 7px; }
.cm-qa-row__src span { display: block; margin-top: 2px; color: var(--faint); }
.cm-smpc-row__product { font-size: 11px; font-weight: 600; color: var(--muted); flex-shrink: 0; }

.cm-compliance { border-radius: 12px; padding: 14px 18px; background: var(--green-bg); border: 1.5px solid var(--green-border); }
.cm-compliance__head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.cm-compliance__icon {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
}
.cm-compliance__title { font-size: 14px; font-weight: 800; color: var(--green); }
.cm-compliance__summary { font-size: 12px; color: var(--muted); }
.cm-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cm-check { display: flex; gap: 9px; background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; }
.cm-check__icon { font-size: 12px; font-weight: 800; color: var(--green); flex-shrink: 0; }
.cm-check--revised .cm-check__icon { color: #d97706; }
.cm-check__label { font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 2px; }
.cm-check__fix { font-size: 9.5px; font-weight: 800; color: #d97706; background: var(--amber-bg); border-radius: 4px; padding: 1px 6px; margin-left: 6px; text-transform: uppercase; }
.cm-check__detail { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.cm-result-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cm-result-actions .cm-pri-btn { margin-left: auto; }

/* ================================================================
   CONTENT STEP STATE MANAGEMENT
   step-wrapper uses active / locked / completed classes from JS
   ================================================================ */
.step-wrapper { margin-bottom: 12px; }
.step-wrapper > .cm-row  { display: none; }
.step-wrapper > .cm-step { display: block; }

/* Locked — show locked row, hide section */
.step-wrapper.locked > .cm-row  { display: flex; }
.step-wrapper.locked > .cm-step { display: none; }

/* Completed (not active) — show unlocked row, hide section */
.step-wrapper.completed:not(.active) > .cm-row  { display: flex; }
.step-wrapper.completed:not(.active) > .cm-step { display: none; }
/* Unlock row appearance when completed */
.step-wrapper.completed > .cm-row.cm-row--locked { opacity: 1; cursor: pointer; }

/* Active always wins — show section, hide row */
.step-wrapper.active > .cm-step { display: block; }
.step-wrapper.active > .cm-row  { display: none; }

/* Progress nav state via nav-active / nav-complete / nav-locked */
.cm-step-dot.nav-active .cm-step-dot__num  { background: var(--indigo); box-shadow: 0 0 0 4px rgba(79,70,229,0.13); }
.cm-step-dot.nav-active .cm-step-dot__label { font-weight: 700; color: var(--navy); }
.cm-step-dot.nav-complete .cm-step-dot__num  { background: var(--green); }
.cm-step-dot.nav-complete .cm-step-dot__line { background: var(--green); }
.cm-step-dot.nav-complete .cm-step-dot__label { font-weight: 700; color: var(--green); }
.cm-step-dot.nav-locked .cm-step-dot__num  { background: #cbd5e1; }
.cm-step-dot.nav-locked .cm-step-dot__label { color: var(--faint); }

/* Spinner */
.cm-spinner {
    width: 20px; height: 20px;
    border: 2.5px solid var(--border);
    border-top-color: var(--indigo);
    border-radius: 50%;
    animation: cm-spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes cm-spin { to { transform: rotate(360deg); } }

/* Inline error */
.step-inline-error {
    font-size: 12.5px;
    color: var(--red);
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    border-radius: 8px;
    padding: 9px 13px;
}

/* Segment pills for step 2 */
.cm-segment-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cm-segment-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    padding: 4px 12px;
    background: #eef2ff;
    color: var(--indigo);
}

/* Flow description */
.flow-description-live {
    font-size: 12.5px;
    color: var(--text);
    line-height: 1.65;
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 10px 14px;
}
.flow-description-live strong { display: block; font-size: 13px; color: var(--navy); margin-bottom: 4px; }
.flow-description-live p { margin: 0; }

/* Content display area */
.content-display { font-size: 13.5px; color: var(--text); line-height: 1.75; }
.content-display h1,.content-display h2,.content-display h3 { color: var(--navy); font-weight: 800; margin: 16px 0 8px; }
.content-display p { margin: 0 0 12px; }
.content-display ul,.content-display ol { margin: 0 0 12px 20px; }
.content-display li { margin-bottom: 4px; }

/* Sources list generated by displaySources */
.cm-sources-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.cm-source-item { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.cm-source-item .cm-source__title { font-weight: 600; color: var(--ink); }
.cm-source-item .cm-source__meta { color: var(--faint); font-size: 11.5px; }
.cm-source-item a.source-doi { color: var(--teal); font-weight: 600; font-size: 11px; }
.cm-source-group-header { font-size: 10.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; padding: 10px 0 4px; border-top: 1px solid var(--border); margin-top: 6px; list-style: none; }

/* ----------------------------------------------------------------
   CONTENT — Strategy alternative chips (JS-rendered)
   ---------------------------------------------------------------- */
.strategy-alt-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--indigo);
    background: #eef2ff;
    border: 1.5px solid #c7d2fe;
    border-radius: 20px;
    padding: 5px 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.strategy-alt-chip:hover { background: #e0e7ff; border-color: var(--indigo); }
.strategy-alt-chip.selected { background: var(--indigo); color: #fff; border-color: var(--indigo); }

/* Retrieval plan preview inside strategy card */
.retrieval-plan-preview {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 11.5px;
}
.retrieval-plan-label { font-weight: 700; color: var(--muted); }
.retrieval-run-pill {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--teal);
    background: #e0f7fa;
    border: 1px solid #b2ebf2;
    border-radius: 12px;
    padding: 3px 10px;
}

/* ----------------------------------------------------------------
   CONTENT — Analysis Intelligence panel (AI-*) classes
   ---------------------------------------------------------------- */
.ai-pill-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-faint);
    font-size: 12px;
    flex-wrap: wrap;
}
.ai-pill-row:last-child { border-bottom: none; }
.ai-label {
    flex-shrink: 0;
    width: 120px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    padding-top: 3px;
}
.ai-pill {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
    color: var(--text);
    border-radius: 10px;
    padding: 3px 9px;
    margin: 1px 2px 1px 0;
}
.ai-pill.drug      { background: #dcfce7; color: #15803d; }
.ai-pill.alias     { background: #f0fdf4; color: #86efac; font-size: 10px; }
.ai-pill.intent    { background: #fce7f3; color: #be185d; }
.ai-pill.outcome   { background: #fff7ed; color: #c2410c; }
.ai-pill.population{ background: #fffbeb; color: #92400e; }
.ai-pill.evidence  { background: #dbeafe; color: #1d4ed8; }
.ai-pill.emotion   { background: #fdf4ff; color: #7e22ce; }
.ai-pill.trial     { background: #fef3c7; color: #b45309; }
.ai-badge {
    display: inline-flex;
    font-size: 11px;
    font-weight: 700;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 6px;
    padding: 2px 8px;
}
.ai-badge.type-theme    { background: #dbeafe; color: #1d4ed8; }
.ai-badge.type-keyword  { background: #dcfce7; color: #15803d; }
.ai-badge.type-question { background: #fce7f3; color: #be185d; }
.ai-badge.type-abstract { background: #fff7ed; color: #c2410c; }
.ai-filter-none { font-size: 11px; color: var(--faint); font-style: italic; }
.ai-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
/* Strategy score bars */
.ai-score-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 11.5px;
}
.ai-score-row.tier1-row { background: #fffbeb; border-radius: 6px; padding: 3px 6px; margin: 1px -6px; }
.ai-score-key { flex: 0 0 180px; font-weight: 600; color: var(--navy); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-score-bar-wrap { flex: 1; height: 7px; background: var(--border-faint); border-radius: 4px; overflow: hidden; }
.ai-score-bar      { height: 100%; background: var(--indigo); border-radius: 4px; transition: width 0.4s ease; }
.ai-score-bar.tier1-bar { background: #d97706; }
.ai-score-value    { flex-shrink: 0; width: 28px; text-align: right; font-size: 11px; color: var(--muted); font-weight: 600; }
.ai-tier1-badge    { font-size: 9px; font-weight: 800; background: #fef3c7; color: #b45309; border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: middle; text-transform: uppercase; }
.ai-tier1-banner   { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; padding: 8px 12px; font-size: 11.5px; color: #92400e; margin-bottom: 8px; line-height: 1.5; }
.ai-tier1-banner strong { font-weight: 700; }
.ai-tier1-code     { background: #fef9c3; color: #78350f; border-radius: 4px; padding: 1px 6px; font-family: monospace; font-size: 11px; }
.ai-tier1-code.final { background: #dcfce7; color: #15803d; }
.ai-tier1-reason   { margin-top: 4px; font-size: 11px; color: #a16207; }
/* Query rows */
.ai-query-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-faint);
    font-size: 11.5px;
}
.ai-query-row:last-child { border-bottom: none; }
.ai-query-run-label    { font-size: 11px; font-weight: 700; color: var(--navy); }
.ai-query-collection-badge { font-size: 10px; font-weight: 600; color: var(--muted); background: var(--border-faint); border-radius: 4px; padding: 1px 6px; margin-top: 2px; display: inline-block; }
.ai-query-text         { flex: 1; font-size: 11.5px; color: var(--text); line-height: 1.5; }
/* Filter expressions */
.ai-filter-row         { padding: 5px 0; border-bottom: 1px solid var(--border-faint); }
.ai-filter-row:last-child { border-bottom: none; }
.ai-filter-label-row   { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 3px; }
.ai-filter-code        { font-family: monospace; font-size: 11px; color: var(--navy); background: var(--field); border: 1px solid var(--border); border-radius: 6px; padding: 5px 9px; white-space: pre-wrap; word-break: break-all; }

/* ----------------------------------------------------------------
   CONTENT — Segment pills (Step 2, unprefixed JS-rendered)
   ---------------------------------------------------------------- */
.segment-summary-label { font-size: 11px; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.segment-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    background: #eef2ff;
    color: var(--indigo);
    border-radius: 20px;
    padding: 4px 12px;
}
.segment-pill-name  { font-weight: 700; }
.segment-pill-count { background: var(--indigo); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 10px; }

/* ----------------------------------------------------------------
   CONTENT — Doc cards (Step 2, JS-rendered)
   ---------------------------------------------------------------- */
.doc-segment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}
.doc-segment-header:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.doc-segment-label {
    font-size: 10.5px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.doc-card {
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    transition: border-color 0.15s;
}
.doc-card:hover { border-color: var(--indigo); }
.doc-card-index {
    display: inline-flex;
    font-size: 10.5px;
    font-weight: 800;
    color: var(--muted);
    background: var(--border-faint);
    border-radius: 5px;
    padding: 2px 8px;
    margin-bottom: 6px;
}
.doc-card-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.5;
    margin-bottom: 6px;
}
.doc-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--faint);
    margin-bottom: 6px;
}
.doc-card-meta a { color: var(--teal); font-weight: 600; text-decoration: none; }
.doc-card-meta a:hover { text-decoration: underline; }
.doc-tag {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--indigo);
    background: #eef2ff;
    border-radius: 5px;
    padding: 2px 8px;
}
.doc-tag-angle {
    color: var(--teal);
    background: #e0f7fa;
}
.doc-card-snippet {
    font-size: 12px;
    color: var(--text);
    line-height: 1.65;
    font-style: italic;
    border-top: 1px solid var(--border-faint);
    padding-top: 7px;
    margin-top: 4px;
}

/* ----------------------------------------------------------------
   CONTENT — Sources list (Step 4 result, JS-rendered)
   ---------------------------------------------------------------- */
.sources-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.source-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12.5px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-faint);
}
.source-item:last-child { border-bottom: none; }
.source-abstract { border-left: 3px solid var(--border); padding-left: 10px; }
.source-qa       { border-left: 3px solid var(--green); padding-left: 10px; }
.source-smpc     { border-left: 3px solid var(--indigo); padding-left: 10px; }
.source-title    { font-weight: 600; color: var(--ink); line-height: 1.5; }
.source-meta     { color: var(--faint); font-size: 11.5px; }
.source-doi      { color: var(--teal); font-weight: 600; font-size: 11px; text-decoration: none; }
.source-doi:hover { text-decoration: underline; }
.source-doi-wrap { display: inline; }
.source-study-badge {
    display: inline-flex;
    font-size: 9.5px;
    font-weight: 800;
    background: var(--amber-bg);
    color: #d97706;
    border: 1px solid var(--amber-border);
    border-radius: 4px;
    padding: 1px 7px;
    margin-left: 4px;
    vertical-align: middle;
}
.source-collection-badge {
    display: inline-flex;
    font-size: 9.5px;
    font-weight: 800;
    border-radius: 4px;
    padding: 2px 7px;
    flex-shrink: 0;
}
.badge-qa   { background: var(--green-bg);  color: var(--green); }
.badge-smpc { background: #eef2ff; color: var(--indigo); }
.source-group-header {
    font-size: 10.5px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 10px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
    list-style: none;
}
.no-sources { font-size: 12.5px; color: var(--faint); font-style: italic; }

/* ----------------------------------------------------------------
   CONTENT — Compliance badge (JS-rendered)
   ---------------------------------------------------------------- */
.compliance-badge { font-size: 14px; font-weight: 800; }
.compliance-pass    { color: var(--green); }
.compliance-revised { color: #d97706; }

/* Responsive — content module */
@media (max-width: 768px) {
    .cm-grid-3 { grid-template-columns: 1fr; }
    .cm-grid-2 { grid-template-columns: 1fr; }
    .cm-canvas { padding: 14px 14px 32px; }
    .cm-step__body { padding: 14px 14px 16px; }
    .cm-sources-footer { flex-direction: column; gap: 10px; }
    .cm-result-actions { flex-direction: column; }
    .cm-result-actions .cm-pri-btn { margin-left: 0; }
    .cm-narratives { grid-template-columns: 1fr; }
    .ai-label { width: 90px; }
    .ai-score-key { flex: 0 0 130px; }
}
