/* ============================================
   Clinically Ready — Style System (v2)
   ============================================ */

:root {
    --navy: #1a1f3d;
    --navy-light: #252b52;
    --navy-lighter: #2f3668;
    --teal: #2dd4a8;
    --teal-dark: #25b892;
    --teal-glow: rgba(45, 212, 168, 0.15);
    --white: #fafaf9;
    --white-pure: #ffffff;
    --coral: #ff6b6b;
    --coral-light: #ff8a8a;
    --green: #22c55e;
    --green-light: #4ade80;
    --text-primary: #1a1f3d;
    --text-secondary: #5a6178;
    --text-muted: #8b92a8;
    --border: #e5e7eb;
    --border-light: #f0f1f3;
    --bg-main: #f5f5f4;
    --bg-card: #ffffff;
    --sidebar-width: 260px;
    --header-height: 56px;
    --mobile-nav-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 3px rgba(26, 31, 61, 0.06);
    --shadow-md: 0 4px 12px rgba(26, 31, 61, 0.08);
    --shadow-lg: 0 8px 30px rgba(26, 31, 61, 0.12);
    --shadow-glow: 0 0 20px rgba(45, 212, 168, 0.2);
    --transition: 0.2s ease;
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Grain texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ---- Typography ---- */

.display-heading {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 1.85rem;
    line-height: 1.25;
    color: var(--navy);
    letter-spacing: -0.02em;
}

h2 {
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: 1.35rem;
    color: var(--navy);
}

h3 {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--navy);
}

/* ---- Scrollbar ---- */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   AUTH SCREEN
   ============================================ */

.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-lighter) 100%);
    padding: 24px 20px;
}

.auth-wrap {
    width: 100%;
    max-width: 440px;
    text-align: center;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.auth-pulse {
    width: 48px;
    height: 24px;
}

.auth-logo-text {
    font-family: 'Fraunces', serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: white;
    letter-spacing: -0.02em;
}

.auth-tagline {
    font-family: 'Fraunces', serif;
    font-size: 1.1rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 6px;
}

.auth-sub {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 28px;
    line-height: 1.5;
}

.auth-card {
    background: var(--white-pure);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 24px;
}

.auth-tab {
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: calc(var(--radius-sm) - 2px);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.auth-tab.active {
    background: var(--white-pure);
    color: var(--navy);
    box-shadow: var(--shadow-sm);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-hint {
    font-weight: 400;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-main);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-glow);
    background: white;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.auth-error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--coral);
    text-align: left;
    margin-bottom: 12px;
    display: none;
}

.auth-error.visible {
    display: block;
}

/* Verification Form Styles */
.verify-header {
    text-align: center;
    margin-bottom: 20px;
}

.verify-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
}

.verify-title {
    font-family: 'Fraunces', serif;
    font-size: 1.3rem;
    color: var(--navy);
    margin: 0 0 6px;
}

.verify-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.verify-subtitle strong {
    color: var(--text-primary);
}

.verify-resend {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 12px 0 0;
}

.resend-link {
    background: none;
    border: none;
    color: var(--teal);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: 'DM Sans', sans-serif;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.resend-link:hover {
    color: #25b892;
}

.resend-link:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    text-decoration: none;
}

.verify-back {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    padding: 10px 0 0;
    text-align: center;
}

.verify-back:hover {
    color: var(--navy);
}

.auth-submit {
    width: 100%;
    padding: 13px;
    background: var(--navy);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.auth-submit:hover {
    background: var(--navy-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.auth-submit:disabled {
    opacity: 0.65;
    pointer-events: none;
}

.btn-spinner .loading-spinner {
    border-color: rgba(255,255,255,0.3);
    border-top-color: white;
}

.auth-divider {
    position: relative;
    text-align: center;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 42%;
    height: 1px;
    background: var(--border);
}

.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.auth-guest {
    width: 100%;
    padding: 11px;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.auth-guest:hover {
    border-color: var(--teal);
    color: var(--teal);
    background: var(--teal-glow);
}

.guest-note {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--navy);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 100;
    transition: transform var(--transition-slow);
    overflow-y: auto;
}

.sidebar-top {
    padding: 24px 16px 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 8px;
}

.pulse-icon {
    width: 32px;
    height: 16px;
    flex-shrink: 0;
}

.logo-text {
    font-family: 'Fraunces', serif;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--white);
    letter-spacing: -0.02em;
}

/* Sidebar user greeting */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 8px;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--teal-dark));
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.sidebar-user-greeting {
    font-size: 0.88rem;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
}

.nav-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 4px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.55);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-width: 1.8;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.85);
}

.nav-btn.active {
    background: rgba(45, 212, 168, 0.12);
    color: var(--teal);
}

.nav-btn.active svg {
    stroke: var(--teal);
}

/* Sidebar bottom */
.sidebar-bottom {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.usage-meter {
    margin-bottom: 2px;
}

.usage-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
}

.usage-label svg {
    opacity: 0.6;
}

.usage-bar {
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--teal-dark));
    border-radius: 3px;
    transition: width var(--transition-slow);
}

.usage-fill.warning {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.usage-fill.full {
    background: linear-gradient(90deg, var(--coral), #ef4444);
}

.upgrade-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--coral), var(--teal));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.upgrade-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(45, 212, 168, 0.3);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px 16px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.45);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.logout-btn:hover {
    border-color: var(--coral);
    color: var(--coral);
    background: rgba(255, 107, 107, 0.08);
}

/* ============================================
   MOBILE HEADER & NAV
   ============================================ */

.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--navy);
    z-index: 101;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
}

.hamburger {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 6px;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: rgba(255,255,255,0.7);
    border-radius: 1px;
    transition: all var(--transition);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Fraunces', serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: white;
}

.mobile-logo .pulse-icon {
    width: 28px;
    height: 14px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-slow);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: var(--navy);
    z-index: 101;
    align-items: center;
    justify-content: space-around;
    padding: 0 2px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    border-top: 1px solid rgba(255,255,255,0.06);
}

.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 0.6rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    padding: 6px 6px;
    min-width: 44px;
    transition: color var(--transition);
}

.mobile-nav-btn svg {
    width: 20px;
    height: 20px;
}

.mobile-nav-btn.active {
    color: var(--teal);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 32px 40px 60px;
    transition: margin var(--transition-slow);
}

.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

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

.view-header {
    margin-bottom: 28px;
}

.view-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 6px;
}

/* ============================================
   DASHBOARD
   ============================================ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon--questions { background: rgba(45, 212, 168, 0.1); color: var(--teal); }
.stat-icon--streak { background: rgba(251, 191, 36, 0.1); color: #f59e0b; }
.stat-icon--accuracy { background: rgba(34, 197, 94, 0.1); color: var(--green); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-family: 'Fraunces', serif;
    font-size: 1.55rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--navy);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Study Recommendation Card (dashboard) */
.recommendation-card {
    background: linear-gradient(135deg, rgba(45,212,168,0.08), rgba(45,212,168,0.03));
    border: 1px solid rgba(45,212,168,0.25);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    transition: all var(--transition);
}

.recommendation-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: rgba(45,212,168,0.4);
}

.recommendation-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--teal-glow);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.recommendation-body {
    flex: 1;
    min-width: 0;
}

.recommendation-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--teal-dark);
    margin-bottom: 2px;
}

.recommendation-body p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recommendation-cta {
    padding: 8px 14px;
    background: var(--teal);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    flex-shrink: 0;
}

.recommendation-cta:hover {
    background: var(--teal-dark);
}

/* Quickstart cards */
.quickstart-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.quickstart-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    font-family: 'DM Sans', sans-serif;
    overflow: hidden;
}

.quickstart-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.quickstart-card--tutor::before { background: var(--teal); }
.quickstart-card--nclex::before { background: #818cf8; }
.quickstart-card--drugs::before { background: #f59e0b; }

.quickstart-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    border-color: transparent;
}

.quickstart-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.quickstart-card--tutor .quickstart-icon { background: var(--teal-glow); color: var(--teal); }
.quickstart-card--nclex .quickstart-icon { background: rgba(129,140,248,0.12); color: #818cf8; }
.quickstart-card--drugs .quickstart-icon { background: rgba(245,158,11,0.12); color: #f59e0b; }

.quickstart-icon svg { width: 22px; height: 22px; }

.quickstart-card h3 { font-size: 1rem; margin-bottom: 4px; }

.quickstart-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.quickstart-arrow {
    position: absolute;
    top: 24px;
    right: 20px;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

.quickstart-card:hover .quickstart-arrow {
    transform: translateX(4px);
    color: var(--teal);
}

/* Topic of the day */
.topic-of-day {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.topic-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--teal);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.topic-of-day h3 {
    font-family: 'Fraunces', serif;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.topic-of-day p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

/* ============================================
   AI TUTOR CHAT
   ============================================ */

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 64px);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--white-pure);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--teal);
}

.chat-avatar svg { width: 20px; height: 20px; }

.chat-header h2 {
    font-size: 1rem;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
}

.chat-status {
    font-size: 0.75rem;
    color: var(--green);
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-main);
}

.message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: messageIn 0.3s ease;
}

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

.message--ai { align-self: flex-start; }
.message--user { align-self: flex-end; flex-direction: row-reverse; }

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.message--ai .message-avatar { background: var(--navy); padding: 6px; }
.message--user .message-avatar { background: var(--teal); color: white; font-size: 0.75rem; font-weight: 600; }

.message-content {
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.message--ai .message-content {
    background: var(--white-pure);
    color: var(--navy);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.message--user .message-content {
    background: var(--teal);
    color: white;
}

/* AI structured sections */
.ai-section {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border-left: 3px solid;
}

.ai-section--concept { background: rgba(45,212,168,0.06); border-color: var(--teal); }
.ai-section--clinical { background: rgba(129,140,248,0.06); border-color: #818cf8; }
.ai-section--remember { background: rgba(245,158,11,0.06); border-color: #f59e0b; }

.ai-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}

.ai-section--concept .ai-section-label { color: var(--teal-dark); }
.ai-section--clinical .ai-section-label { color: #6366f1; }
.ai-section--remember .ai-section-label { color: #d97706; }

.ai-section p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Related topic chips */
.related-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.related-topics-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    width: 100%;
    margin-bottom: 2px;
}

.topic-chip {
    padding: 5px 11px;
    background: var(--teal-glow);
    border: 1px solid rgba(45,212,168,0.3);
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--teal-dark);
    cursor: pointer;
    transition: all var(--transition);
    font-family: 'DM Sans', sans-serif;
}

.topic-chip:hover {
    background: var(--teal);
    color: white;
    border-color: var(--teal);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat input */
.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--white-pure);
}

.chat-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 6px 6px 6px 18px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.chat-input-wrap:focus-within {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-glow);
}

#chatInput {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
}

#chatInput::placeholder { color: var(--text-muted); }

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--teal);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.send-btn:hover { background: var(--teal-dark); transform: scale(1.05); }
.send-btn:active { transform: scale(0.95); }
.send-btn svg { width: 18px; height: 18px; }

/* ============================================
   NCLEX PRACTICE
   ============================================ */

.nclex-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(45,212,168,0.15);
    color: var(--teal);
    border: 1px solid rgba(45,212,168,0.3);
    border-radius: 4px;
    padding: 2px 8px;
    margin-left: 4px;
    vertical-align: middle;
}

.nclex-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.nclex-score {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 8px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.nclex-score-label { color: var(--text-muted); margin-right: 4px; font-weight: 500; }
.nclex-score-value { color: var(--green); }
.nclex-score-sep { color: var(--text-muted); margin: 0 2px; }
.nclex-score-total { color: var(--navy); }

/* Adaptive difficulty indicator */
.nclex-difficulty {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 8px 16px;
    box-shadow: var(--shadow-sm);
    font-size: 0.85rem;
}

.difficulty-label {
    color: var(--text-muted);
    font-weight: 500;
}

.difficulty-stars {
    color: #f59e0b;
    font-size: 1rem;
    letter-spacing: 1px;
}

.difficulty-text {
    font-weight: 600;
    color: var(--navy);
}

.difficulty-change {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 100px;
    transition: all 0.4s ease;
}

.difficulty-change.up {
    color: var(--coral);
    background: rgba(255,107,107,0.1);
    animation: diffPulse 0.6s ease;
}

.difficulty-change.down {
    color: var(--green);
    background: rgba(34,197,94,0.1);
    animation: diffPulse 0.6s ease;
}

@keyframes diffPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.category-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.category-pill {
    padding: 8px 18px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.category-pill:hover { border-color: var(--teal); color: var(--teal); }
.category-pill.active { background: var(--navy); color: white; border-color: var(--navy); }

.nclex-content { margin-bottom: 20px; }

.nclex-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.nclex-empty svg { margin-bottom: 16px; opacity: 0.4; }
.nclex-empty p { font-size: 0.9rem; max-width: 360px; }

.question-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

/* Question meta (SATA badge, etc.) */
.question-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.question-meta:empty { display: none; }

.q-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.q-badge--sata {
    background: rgba(129,140,248,0.12);
    color: #6366f1;
    border: 1px solid rgba(129,140,248,0.25);
}

.q-badge--diff {
    background: rgba(45,212,168,0.1);
    color: var(--teal-dark);
    border: 1px solid rgba(45,212,168,0.2);
}

.question-text {
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--text-primary);
    font-weight: 500;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

/* MCQ option card */
.option-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.9rem;
    line-height: 1.55;
    min-height: 44px;
    width: 100%;
    text-align: left;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
}

.option-card:hover:not(.disabled) {
    border-color: var(--teal);
    background: var(--teal-glow);
}

.option-letter {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-main);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all var(--transition);
}

.option-card:hover:not(.disabled) .option-letter {
    background: var(--teal);
    color: white;
    border-color: var(--teal);
}

/* SATA option: checkbox style */
.option-card.sata-option {
    cursor: pointer;
}

.option-card.sata-option.selected {
    border-color: #818cf8;
    background: rgba(129,140,248,0.06);
}

.option-card.sata-option.selected .option-letter {
    background: #818cf8;
    color: white;
    border-color: #818cf8;
}

.option-card.correct {
    border-color: var(--green);
    background: rgba(34,197,94,0.06);
}

.option-card.correct .option-letter {
    background: var(--green);
    color: white;
    border-color: var(--green);
}

.option-card.incorrect {
    border-color: var(--coral);
    background: rgba(255,107,107,0.06);
}

.option-card.incorrect .option-letter {
    background: var(--coral);
    color: white;
    border-color: var(--coral);
}

.option-card.disabled { cursor: default; }
.option-card.disabled:not(.correct):not(.incorrect) { opacity: 0.5; }

/* SATA submit button */
.sata-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 280px;
    padding: 12px 24px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 16px;
}

.sata-submit-btn:hover {
    background: #5254cc;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Rationale */
.rationale-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease;
}

.rationale-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--navy);
    transition: background var(--transition);
}

.rationale-header:hover { background: var(--bg-main); }

.rationale-chevron {
    margin-left: auto;
    transition: transform var(--transition);
}

.rationale-header.open .rationale-chevron {
    transform: rotate(180deg);
}

.rationale-body {
    padding: 0 18px 18px;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
    display: none;
}

.rationale-body.open { display: block; }

.generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    padding: 14px 28px;
    background: var(--navy);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.generate-btn:hover {
    background: var(--navy-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.generate-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* ============================================
   DRUG REFERENCE
   ============================================ */

.drug-search-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px 8px 8px 18px;
    margin-bottom: 12px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.drug-search-wrap:focus-within {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-glow);
}

.drug-search-wrap svg { color: var(--text-muted); flex-shrink: 0; }

#drugSearchInput {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
}

#drugSearchInput::placeholder { color: var(--text-muted); }

.drug-search-btn {
    padding: 10px 22px;
    background: var(--navy);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.drug-search-btn:hover { background: var(--navy-light); }

.drug-suggestions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.drug-tag {
    padding: 5px 12px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.drug-tag:hover {
    border-color: var(--teal);
    color: var(--teal);
    background: var(--teal-glow);
}

.drug-result { animation: fadeIn 0.3s ease; }

.drug-header { margin-bottom: 10px; }

.drug-header h2 {
    font-family: 'Fraunces', serif;
    font-size: 1.4rem;
}

.drug-brand {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-style: italic;
}

.drug-class-badge {
    display: inline-block;
    padding: 5px 14px;
    background: var(--navy);
    color: var(--teal);
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 20px;
}

/* NCLEX Tip box in drug result */
.nclex-tip-box {
    background: rgba(45,212,168,0.07);
    border: 1px solid rgba(45,212,168,0.25);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
}

.nclex-tip-badge {
    background: var(--teal);
    color: white;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    align-self: flex-start;
    margin-top: 2px;
}

.nclex-tip-content {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Accordion */
.accordion { display: flex; flex-direction: column; gap: 6px; }

.accordion-item {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--navy);
    transition: background var(--transition);
}

.accordion-header:hover { background: var(--bg-main); }

.accordion-chevron {
    transition: transform var(--transition);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.accordion-item.open .accordion-chevron { transform: rotate(180deg); }

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
}

.accordion-item.open .accordion-body {
    max-height: 600px;
    padding: 0 18px 16px;
}

.accordion-body p {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.drug-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.drug-empty svg { margin-bottom: 16px; opacity: 0.4; }
.drug-empty p { font-size: 0.9rem; }

/* ============================================
   MY PROGRESS
   ============================================ */

.progress-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.progress-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 22px;
    text-align: center;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.progress-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.progress-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.progress-card-value {
    display: block;
    font-family: 'Fraunces', serif;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.2;
    margin-bottom: 4px;
}

.progress-card-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Study recommendation (progress page) */
.study-rec-card {
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    margin-bottom: 24px;
    color: white;
}

.study-rec-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--teal);
    margin-bottom: 8px;
}

.study-rec-card p {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.75);
    line-height: 1.5;
    margin-bottom: 14px;
}

.study-rec-btn {
    padding: 9px 18px;
    background: var(--teal);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.study-rec-btn:hover { background: var(--teal-dark); }

/* Weak / Strong areas grid */
.areas-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.areas-panel {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.areas-panel h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.areas-panel--weak h3 { color: var(--coral); }
.areas-panel--strong h3 { color: var(--green); }

.area-badge {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 6px;
    width: 100%;
    cursor: pointer;
    border: none;
    font-family: 'DM Sans', sans-serif;
    transition: all var(--transition);
}

.area-badge--weak {
    background: rgba(255,107,107,0.08);
    color: var(--text-secondary);
    border: 1px solid rgba(255,107,107,0.2);
}

.area-badge--weak:hover {
    background: rgba(255,107,107,0.12);
}

.area-badge--strong {
    background: rgba(34,197,94,0.08);
    color: var(--text-secondary);
    border: 1px solid rgba(34,197,94,0.2);
}

.area-badge-cta {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--coral);
    white-space: nowrap;
}

.area-badge--strong .area-badge-cta { color: var(--green); }

/* Category breakdown */
.category-breakdown {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.category-breakdown h3 {
    font-family: 'Fraunces', serif;
    font-size: 1.05rem;
    margin-bottom: 16px;
}

.breakdown-list { display: flex; flex-direction: column; gap: 10px; }

.breakdown-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 16px 0;
}

.breakdown-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.breakdown-category {
    font-size: 0.85rem;
    font-weight: 500;
    width: 130px;
    flex-shrink: 0;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breakdown-bar-wrap {
    flex: 1;
    height: 8px;
    background: var(--bg-main);
    border-radius: 4px;
    overflow: hidden;
}

.breakdown-bar {
    height: 100%;
    border-radius: 4px;
    transition: width var(--transition-slow);
}

.breakdown-pct {
    font-size: 0.82rem;
    font-weight: 600;
    width: 45px;
    text-align: right;
    color: var(--navy);
}

.breakdown-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 44px;
    text-align: right;
}

/* Recent activity */
.recent-activity {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.recent-activity h3 {
    font-family: 'Fraunces', serif;
    font-size: 1.05rem;
    margin-bottom: 14px;
}

.recent-list { display: flex; flex-direction: column; gap: 8px; }

.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    font-size: 0.85rem;
}

.recent-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.recent-item-icon.correct {
    background: rgba(34,197,94,0.12);
    color: var(--green);
}

.recent-item-icon.incorrect {
    background: rgba(255,107,107,0.12);
    color: var(--coral);
}

.recent-item-cat {
    flex: 1;
    color: var(--text-secondary);
    font-weight: 500;
}

.recent-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Motivation card */
.motivation-card {
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
    color: white;
}

.motivation-card svg { color: var(--coral); margin-bottom: 12px; }

.motivation-card blockquote {
    font-family: 'Fraunces', serif;
    font-size: 1.05rem;
    font-style: italic;
    line-height: 1.6;
    opacity: 0.9;
    margin-bottom: 10px;
}

.motivation-card cite {
    font-size: 0.82rem;
    opacity: 0.6;
    font-style: normal;
}

/* ============================================
   STUDY PLAN
   ============================================ */

.plan-duration-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    text-align: center;
}

.plan-duration-card h3 {
    font-family: 'Fraunces', serif;
    font-size: 1.1rem;
    margin-bottom: 18px;
}

.duration-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 22px;
}

.duration-btn {
    padding: 11px 28px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: var(--bg-main);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.duration-btn:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.duration-btn.active {
    background: var(--navy);
    color: white;
    border-color: var(--navy);
}

.generate-plan-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 32px;
    background: linear-gradient(135deg, var(--navy), var(--navy-lighter));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.generate-plan-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.generate-plan-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.plan-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

.plan-title {
    font-family: 'Fraunces', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--navy);
}

.plan-progress-summary {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.plan-days {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plan-day {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    padding: 18px 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.plan-day:hover { box-shadow: var(--shadow-md); }

.plan-day--rest {
    background: var(--bg-main);
    border-color: var(--border);
    opacity: 0.7;
}

.plan-day-num {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--navy);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fraunces', serif;
    font-size: 0.9rem;
    font-weight: 600;
    flex-shrink: 0;
}

.plan-day--rest .plan-day-num {
    background: var(--border);
    color: var(--text-muted);
}

.plan-day-body { flex: 1; min-width: 0; }

.plan-day-category {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--navy);
    margin-bottom: 4px;
}

.plan-day--rest .plan-day-category {
    color: var(--text-muted);
}

.plan-day-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.plan-day-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.plan-day-meta-item svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.plan-day-concept {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-style: italic;
}

.plan-day-tip {
    font-size: 0.8rem;
    color: var(--teal-dark);
    display: flex;
    align-items: flex-start;
    gap: 5px;
}

.plan-day-tip-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.plan-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.plan-empty svg { margin-bottom: 16px; opacity: 0.4; }
.plan-empty p { font-size: 0.9rem; max-width: 320px; }

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--white-pure);
    border-radius: var(--radius-xl);
    padding: 36px;
    max-width: 520px;
    width: 100%;
    position: relative;
    animation: modalIn 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition);
}

.modal-close:hover { background: var(--bg-main); color: var(--text-primary); }

.modal-header { text-align: center; margin-bottom: 24px; }

.modal-pulse {
    width: 48px;
    height: 24px;
    margin-bottom: 12px;
}

.modal-header h2 {
    font-family: 'Fraunces', serif;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.pro-gradient {
    background: linear-gradient(135deg, var(--teal), var(--coral));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-header p { color: var(--text-secondary); font-size: 0.9rem; }

.limit-icon { margin-bottom: 12px; }

.modal-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.modal-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.pricing-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.pricing-card {
    position: relative;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px 18px;
    text-align: center;
    transition: all var(--transition);
}

.pricing-card--popular {
    border-color: var(--teal);
    background: var(--teal-glow);
}

.pricing-badge {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--teal);
    color: white;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.pricing-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.pricing-amount {
    display: block;
    font-family: 'Fraunces', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 14px;
}

.pricing-amount small {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

.pricing-btn {
    display: block;
    padding: 10px 16px;
    border: 2px solid var(--navy);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--navy);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
    cursor: pointer;
}

.pricing-btn:hover { background: var(--navy); color: white; }
.pricing-btn--primary { background: var(--navy); color: white; border-color: var(--navy); }
.pricing-btn--primary:hover { background: var(--navy-light); border-color: var(--navy-light); }

/* ============================================
   TOAST
   ============================================ */

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--navy);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s ease;
}

.toast.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, #e8eaed 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

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

/* ============================================
   RESPONSIVE — Tablet
   ============================================ */

@media (max-width: 1024px) {
    .quickstart-grid { grid-template-columns: repeat(2, 1fr); }
    .quickstart-card--drugs { grid-column: span 2; }
    .progress-grid { grid-template-columns: repeat(2, 1fr); }
    .areas-grid { grid-template-columns: 1fr; }
    .main-content { padding: 28px 24px 60px; }
}

/* ============================================
   RESPONSIVE — Mobile
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.open { transform: translateX(0); }

    .mobile-header { display: flex; }
    .mobile-nav { display: flex; }

    .main-content {
        margin-left: 0;
        padding: calc(var(--header-height) + 16px) 16px calc(var(--mobile-nav-height) + 20px);
    }

    .display-heading { font-size: 1.45rem; }

    .stats-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card { padding: 16px; }

    .quickstart-grid { grid-template-columns: 1fr; }
    .quickstart-card--drugs { grid-column: span 1; }

    .progress-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .progress-card { padding: 16px; }
    .progress-card-value { font-size: 1.3rem; }

    .areas-grid { grid-template-columns: 1fr; }

    .chat-container {
        border-radius: 0;
        border: none;
        height: calc(100vh - var(--header-height) - var(--mobile-nav-height));
        margin: calc(-1 * (var(--header-height) + 16px)) -16px calc(-1 * (var(--mobile-nav-height) + 20px));
    }

    .category-selector { gap: 6px; }

    .category-pill {
        padding: 7px 14px;
        font-size: 0.78rem;
    }

    .nclex-top-bar { justify-content: flex-start; }

    .pricing-cards { grid-template-columns: 1fr; }

    .modal { padding: 28px 20px; margin: 16px; }

    .breakdown-category {
        width: 90px;
        font-size: 0.78rem;
    }

    .toast {
        bottom: calc(var(--mobile-nav-height) + 20px);
        width: calc(100% - 40px);
        text-align: center;
    }

    .recommendation-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .recommendation-body p {
        white-space: normal;
    }

    .duration-btns { gap: 8px; }
    .duration-btn { padding: 10px 18px; }

    .plan-day { flex-direction: row; gap: 12px; }
}

@media (max-width: 420px) {
    .progress-grid { grid-template-columns: 1fr 1fr; }

    .stat-icon { width: 40px; height: 40px; }
    .stat-icon svg { width: 20px; height: 20px; }
    .stat-value { font-size: 1.3rem; }

    .auth-card { padding: 24px 20px; }
}

/* ============================================
   CLINICAL CASES
   ============================================ */

.cases-specialty-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.cases-specialty-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.cases-specialty-btn:hover {
    border-color: var(--teal);
    color: var(--teal);
    background: var(--teal-glow);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.cases-specialty-btn.active {
    border-color: var(--teal);
    background: rgba(45,212,168,0.1);
    color: var(--navy);
    font-weight: 600;
}

.cases-specialty-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.cases-difficulty-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.cases-difficulty-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 4px;
}

.cases-diff-btn {
    padding: 9px 22px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: var(--bg-card);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.cases-diff-btn:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.cases-diff-btn.active {
    background: var(--navy);
    color: white;
    border-color: var(--navy);
}

.cases-start-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    background: var(--teal);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 15px rgba(45,212,168,0.3);
}

.cases-start-btn:hover {
    background: var(--teal-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45,212,168,0.4);
}

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

.cases-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Patient banner */
.case-patient-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(135deg, var(--navy), var(--navy-lighter));
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.case-patient-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.case-patient-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(45,212,168,0.2);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.case-patient-name {
    font-family: 'Fraunces', serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
}

.case-patient-meta {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6);
}

.case-patient-dx {
    display: inline-flex;
    padding: 6px 14px;
    background: rgba(45,212,168,0.18);
    border: 1px solid rgba(45,212,168,0.35);
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--teal);
    white-space: nowrap;
}

/* Step progress bar */
.case-steps-bar {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.case-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 70px;
    position: relative;
    gap: 6px;
}

.case-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 11px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.case-step.completed:not(:last-child)::after {
    background: var(--teal);
}

.case-step-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-card);
    z-index: 1;
    transition: all var(--transition);
    flex-shrink: 0;
}

.case-step.active .case-step-dot {
    border-color: var(--teal);
    background: var(--teal);
    box-shadow: 0 0 0 4px rgba(45,212,168,0.2);
}

.case-step.completed .case-step-dot {
    border-color: var(--teal);
    background: var(--teal);
}

.case-step span {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
}

.case-step.active span {
    color: var(--teal-dark);
    font-weight: 700;
}

.case-step.completed span {
    color: var(--text-secondary);
}

/* Narrative + question cards */
.case-narrative-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.case-question-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
}

/* Vitals row */
.case-vitals-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.vital-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--navy);
    box-shadow: var(--shadow-sm);
}

.vital-badge-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.vital-badge.abnormal {
    border-color: rgba(255,107,107,0.3);
    background: rgba(255,107,107,0.06);
    color: var(--coral);
}

/* Result area */
.case-result-area {
    margin-top: 16px;
    animation: fadeIn 0.3s ease;
}

.case-result-feedback {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.case-result-feedback.correct {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.25);
    color: #166534;
}

.case-result-feedback.incorrect {
    background: rgba(255,107,107,0.1);
    border: 1px solid rgba(255,107,107,0.25);
    color: #7f1d1d;
}

.case-rationale {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    border: 1px solid var(--border-light);
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 16px;
    border-left: 3px solid var(--teal);
}

.case-result-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.case-wrong-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    background: transparent;
    border: 2px solid var(--coral);
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--coral);
    cursor: pointer;
    transition: all var(--transition);
}

.case-wrong-btn:hover {
    background: rgba(255,107,107,0.08);
    transform: translateY(-1px);
}

.cases-next-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: var(--navy);
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all var(--transition);
    margin-left: auto;
}

.cases-next-btn:hover {
    background: var(--navy-light);
    transform: translateY(-1px);
}

/* Case summary */
.case-summary-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 40px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    text-align: center;
    max-width: 480px;
    margin: 0 auto;
}

.case-summary-score {
    font-family: 'Fraunces', serif;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--teal);
    line-height: 1;
    margin-bottom: 8px;
}

.case-summary-title {
    font-family: 'Fraunces', serif;
    font-size: 1.3rem;
    color: var(--navy);
    margin-bottom: 24px;
}

.case-summary-errors {
    text-align: left;
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.case-summary-error-item {
    background: rgba(255,107,107,0.07);
    border: 1px solid rgba(255,107,107,0.2);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.case-summary-error-item strong {
    color: var(--coral);
}

/* ============================================
   SPRINTS
   ============================================ */

.sprint-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.sprint-mode-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    border: 2px solid var(--border-light);
    cursor: pointer;
    text-align: left;
    font-family: 'DM Sans', sans-serif;
    transition: all var(--transition);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.sprint-mode-card:hover {
    border-color: var(--teal);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.sprint-mode-card.active {
    border-color: var(--teal);
    background: rgba(45,212,168,0.06);
}

.sprint-mode-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: rgba(45,212,168,0.1);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.sprint-mode-card h3 {
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sprint-mode-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.sprint-recommended-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(45,212,168,0.15);
    color: var(--teal-dark);
    border: 1px solid rgba(45,212,168,0.3);
    border-radius: 100px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: 'DM Sans', sans-serif;
}

.sprint-category-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.sprint-category-row label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.sprint-category-select {
    padding: 9px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
}

.sprint-category-select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-glow);
}

/* Sprint timer */
.sprint-timer-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 18px 24px;
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.sprint-timer-display {
    font-family: 'Fraunces', serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--teal);
    min-width: 80px;
    transition: color 0.5s ease;
    line-height: 1;
}

.sprint-timer-display.warning {
    color: #f59e0b;
}

.sprint-timer-display.danger {
    color: var(--coral);
    animation: timerPulse 0.5s ease-in-out infinite alternate;
}

@keyframes timerPulse {
    from { opacity: 1; }
    to { opacity: 0.7; }
}

.sprint-timer-bar-wrap {
    flex: 1;
    height: 10px;
    background: rgba(45,212,168,0.15);
    border-radius: 5px;
    overflow: hidden;
    min-width: 100px;
}

.sprint-timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--teal), var(--teal-dark));
    border-radius: 5px;
    transition: width 1s linear, background 0.5s ease;
}

.sprint-timer-bar.warning {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.sprint-timer-bar.danger {
    background: linear-gradient(90deg, var(--coral), #ef4444);
}

.sprint-question-counter {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Sprint option flash feedback */
.option-card.flash-correct {
    border-color: var(--green);
    background: rgba(34,197,94,0.15);
    transition: all 0.1s ease;
}

.option-card.flash-incorrect {
    border-color: var(--coral);
    background: rgba(255,107,107,0.15);
    transition: all 0.1s ease;
}

/* Sprint results */
.sprint-results-header {
    background: linear-gradient(135deg, var(--navy), var(--navy-lighter));
    border-radius: var(--radius-xl);
    padding: 32px 40px;
    text-align: center;
    color: white;
    margin-bottom: 20px;
}

.sprint-results-score {
    font-family: 'Fraunces', serif;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--teal);
    line-height: 1;
    margin-bottom: 4px;
}

.sprint-results-label {
    font-size: 1rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 12px;
}

.sprint-results-time {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.5);
}

.sprint-ai-summary {
    background: rgba(45,212,168,0.07);
    border: 1px solid rgba(45,212,168,0.25);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin-bottom: 20px;
}

.sprint-ai-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--teal-dark);
    margin-bottom: 10px;
}

.sprint-ai-summary p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.sprint-category-chart {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.sprint-category-chart h3 {
    font-family: 'Fraunces', serif;
    font-size: 1rem;
    margin-bottom: 16px;
}

.sprint-breakdown {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.sprint-breakdown h3 {
    font-family: 'Fraunces', serif;
    font-size: 1rem;
    margin-bottom: 14px;
}

.sprint-breakdown-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.sprint-breakdown-item:last-child { border-bottom: none; }

.sprint-breakdown-status {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.sprint-breakdown-status.correct {
    background: rgba(34,197,94,0.12);
    color: var(--green);
}

.sprint-breakdown-status.incorrect {
    background: rgba(255,107,107,0.12);
    color: var(--coral);
}

.sprint-breakdown-body {
    flex: 1;
    min-width: 0;
}

.sprint-breakdown-question {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.sprint-breakdown-answers {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.sprint-breakdown-rationale {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-top: 6px;
    padding: 8px 10px;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    display: none;
}

.sprint-breakdown-rationale.open { display: block; }

.sprint-breakdown-toggle {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--teal-dark);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-top: 4px;
    font-family: 'DM Sans', sans-serif;
}

.sprint-wrong-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--coral);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-top: 4px;
    font-family: 'DM Sans', sans-serif;
    transition: opacity var(--transition);
}

.sprint-wrong-btn:hover { opacity: 0.75; }

.sprint-results-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.sprint-dashboard-btn {
    padding: 13px 24px;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.sprint-dashboard-btn:hover {
    border-color: var(--navy);
    color: var(--navy);
}

/* ============================================
   ERROR ANALYSIS PANEL (Why I Got It Wrong)
   ============================================ */

.error-analysis-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 250;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(3px);
    padding: 0;
}

.error-analysis-overlay.active {
    display: flex;
}

.error-analysis-panel {
    background: var(--white-pure);
    width: 100%;
    max-width: 640px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 32px;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -8px 40px rgba(26,31,61,0.15);
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.error-analysis-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition);
}

.error-analysis-close:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

.error-analysis-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 14px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.error-analysis-title {
    font-family: 'Fraunces', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 14px;
}

.error-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 20px;
}

.error-type-badge.knowledge-gap {
    background: rgba(239,68,68,0.1);
    color: #b91c1c;
    border: 1px solid rgba(239,68,68,0.25);
}

.error-type-badge.prioritization-error {
    background: rgba(245,158,11,0.1);
    color: #b45309;
    border: 1px solid rgba(245,158,11,0.25);
}

.error-type-badge.scope-confusion {
    background: rgba(234,179,8,0.1);
    color: #854d0e;
    border: 1px solid rgba(234,179,8,0.25);
}

.error-type-badge.distractor-fixation {
    background: rgba(59,130,246,0.1);
    color: #1d4ed8;
    border: 1px solid rgba(59,130,246,0.25);
}

.error-type-badge.incomplete-assessment {
    background: rgba(139,92,246,0.1);
    color: #6d28d9;
    border: 1px solid rgba(139,92,246,0.25);
}

.error-type-badge.default {
    background: rgba(45,212,168,0.1);
    color: var(--teal-dark);
    border: 1px solid rgba(45,212,168,0.25);
}

.error-section {
    background: var(--bg-main);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 10px;
}

.error-section--tip {
    background: rgba(245,158,11,0.07);
    border: 1px solid rgba(245,158,11,0.2);
}

.error-section--concept {
    background: rgba(45,212,168,0.07);
    border: 1px solid rgba(45,212,168,0.2);
}

.error-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.error-section p {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

/* NCLEX Why I Got It Wrong button */
.nclex-wrong-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: transparent;
    border: 2px solid rgba(255,107,107,0.5);
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--coral);
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 12px;
}

.nclex-wrong-btn:hover {
    border-color: var(--coral);
    background: rgba(255,107,107,0.07);
    transform: translateY(-1px);
}

/* Responsive for new features */
@media (max-width: 768px) {
    .cases-specialty-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .sprint-mode-grid {
        grid-template-columns: 1fr;
    }
    .case-patient-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .sprint-timer-wrap {
        gap: 10px;
    }
    .sprint-timer-display {
        font-size: 1.7rem;
    }
    .case-steps-bar {
        gap: 0;
    }
    .case-step span {
        font-size: 0.6rem;
    }
    .case-summary-card {
        padding: 28px 20px;
    }
    .error-analysis-panel {
        padding: 24px 20px;
    }
    .sprint-results-header {
        padding: 24px 20px;
    }
    .sprint-results-score {
        font-size: 2.8rem;
    }
}

@media (max-width: 480px) {
    .cases-specialty-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .cases-specialty-btn {
        padding: 14px 8px;
        font-size: 0.75rem;
    }
    .cases-specialty-icon {
        font-size: 1.4rem;
    }
}
