/* iSTEMLabsAfrica — Components
   Reproduces the legacy styles.css runtime classes on top of the
   design-token system (tokens/variant-*.css). Class names preserved
   exactly so existing JS modules keep working; every layout/style maps
   to token variables for cross-variant compatibility. */

/* ------------------------------------------------------------------ */
/* Navbar                                                             */
/* ------------------------------------------------------------------ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--surface-elevated, var(--surface));
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.navbar__brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.navbar__logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

.navbar__title {
    font-family: var(--font-display);
    font-size: var(--fs-title-lg);
    font-weight: var(--fw-semi);
    color: var(--on-surface);
}

.navbar__actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.navbar__btn {
    background: none;
    border: none;
    color: var(--primary-strong, var(--primary));
    font-size: var(--fs-title-sm);
    font-weight: var(--fw-semi);
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    transition: var(--transition-base);
    -webkit-appearance: none;
}

.navbar__btn:hover {
    background: var(--surface-container, var(--outline-variant));
}

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

/* ------------------------------------------------------------------ */
/* Main content                                                       */
/* ------------------------------------------------------------------ */
.main-content {
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
    padding: var(--space-xl) var(--space-lg);
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* ------------------------------------------------------------------ */
/* Auth                                                               */
/* ------------------------------------------------------------------ */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--navbar-height) - 48px);
}

.auth-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    padding: var(--space-2xl) var(--space-xl);
    width: 100%;
    max-width: 420px;
}

.auth-card__title {
    font-size: var(--fs-headline-lg);
    font-weight: var(--fw-bold);
    text-align: center;
    margin-bottom: var(--space-xs);
    color: var(--on-surface);
}

.auth-card__subtitle {
    font-size: var(--fs-body-sm);
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

/* ------------------------------------------------------------------ */
/* Forms                                                              */
/* ------------------------------------------------------------------ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: var(--fs-body-sm);
    font-weight: var(--fw-medium);
    color: var(--on-surface);
    margin-bottom: var(--space-xs);
}

.form-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--fs-body-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--on-surface);
    transition: var(--transition-base);
    -webkit-appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

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

.form-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--fs-body-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--on-surface);
    transition: var(--transition-base);
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a92a3' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    padding-right: var(--space-2xl);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* ------------------------------------------------------------------ */
/* Buttons                                                            */
/* ------------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--fs-body-md);
    font-weight: var(--fw-semi);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-base);
    text-decoration: none;
    -webkit-appearance: none;
    line-height: 1.2;
}

.btn--primary {
    background: var(--primary);
    color: var(--on-primary);
    width: 100%;
}

.btn--primary:hover {
    background: var(--primary-hover);
}

.btn--primary:disabled {
    background: var(--outline-variant, var(--text-tertiary));
    color: var(--on-surface-muted);
    cursor: not-allowed;
}

.btn--secondary {
    background: var(--surface-container, var(--outline-variant));
    color: var(--primary);
}

.btn--secondary:hover {
    background: var(--surface-container-high, var(--border));
}

.btn--danger {
    background: var(--error);
    color: var(--on-accent, #fff);
}

.btn--danger:hover {
    background: var(--error-container);
    color: var(--on-error-container);
}

.btn--outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
    width: 100%;
}

.btn--outline:hover {
    background: var(--surface-container, var(--outline-variant));
}

.btn--sm {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--fs-body-sm);
    width: auto;
}

.btn--lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--fs-headline-sm);
    width: auto;
}

.btn--loading {
    position: relative;
    color: transparent !important;
}

.btn--loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--on-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ------------------------------------------------------------------ */
/* Role selector                                                      */
/* ------------------------------------------------------------------ */
.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.role-card {
    padding: var(--space-md);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: var(--transition-base);
}

.role-card:hover {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 4%, transparent);
}

.role-card.selected {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.role-card__icon {
    font-size: 28px;
    line-height: 1;
    margin-bottom: var(--space-xs);
}

.role-card__label {
    font-size: var(--fs-body-sm);
    font-weight: var(--fw-medium);
    color: var(--on-surface);
}

/* ------------------------------------------------------------------ */
/* Dashboard header                                                   */
/* ------------------------------------------------------------------ */
.dashboard-header {
    margin-bottom: var(--space-xl);
}

.dashboard-header__greeting {
    font-size: var(--fs-display-md);
    font-weight: var(--fw-bold);
    color: var(--on-surface);
    margin-bottom: var(--space-xs);
}

.dashboard-header__subtitle {
    font-size: var(--fs-body-md);
    color: var(--text-secondary);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    box-shadow: var(--shadow-1);
    border: 1px solid var(--border);
}

.stat-card__label {
    font-size: var(--fs-label-sm);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

.stat-card__value {
    font-size: var(--fs-display-lg);
    font-weight: var(--fw-bold);
    color: var(--on-surface);
}

.stat-card__unit {
    font-size: var(--fs-body-sm);
    font-weight: var(--fw-normal);
    color: var(--text-secondary);
    margin-left: var(--space-2xs);
}

/* ------------------------------------------------------------------ */
/* Lab cards                                                          */
/* ------------------------------------------------------------------ */
.lab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-lg);
}

.lab-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-1);
    transition: var(--transition-base);
    cursor: pointer;
}

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

.lab-card__header {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.lab-card__header--chemistry {
    background: linear-gradient(135deg, var(--success-container, #E8F5E9), color-mix(in srgb, var(--success) 25%, transparent));
}

.lab-card__body {
    padding: var(--space-md);
}

.lab-card__name {
    font-size: var(--fs-title-md);
    font-weight: var(--fw-semi);
    color: var(--on-surface);
    margin-bottom: var(--space-2xs);
}

.lab-card__desc {
    font-size: var(--fs-body-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    line-height: 1.5;
}

.lab-card__badge {
    display: inline-block;
    padding: var(--space-2xs) var(--space-sm);
    font-size: var(--fs-label-sm);
    font-weight: var(--fw-medium);
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--success) 12%, transparent);
    color: var(--success);
}

.lab-card__badge--locked {
    background: color-mix(in srgb, var(--warning) 12%, transparent);
    color: var(--warning);
}

/* ------------------------------------------------------------------ */
/* Plan cards                                                         */
/* ------------------------------------------------------------------ */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.plan-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-lg);
    box-shadow: var(--shadow-1);
    border: 2px solid transparent;
    transition: var(--transition-base);
    position: relative;
}

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

.plan-card--featured {
    border-color: var(--primary);
}

.plan-card__ribbon {
    position: absolute;
    top: -1px;
    right: var(--space-lg);
    background: var(--primary);
    color: var(--on-primary);
    padding: var(--space-2xs) var(--space-sm);
    font-size: var(--fs-label-sm);
    font-weight: var(--fw-semi);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.plan-card__name {
    font-size: var(--fs-headline-md);
    font-weight: var(--fw-bold);
    color: var(--on-surface);
    margin-bottom: var(--space-xs);
}

.plan-card__price {
    font-size: var(--fs-display-md);
    font-weight: var(--fw-bold);
    color: var(--primary);
    margin-bottom: var(--space-2xs);
    line-height: 1.1;
}

.plan-card__price span {
    font-size: var(--fs-title-md);
    font-weight: var(--fw-normal);
    color: var(--text-secondary);
}

.plan-card__desc {
    font-size: var(--fs-body-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}

.plan-card__features {
    list-style: none;
    margin-bottom: var(--space-xl);
}

.plan-card__features li {
    padding: var(--space-xs) 0;
    font-size: var(--fs-body-sm);
    color: var(--on-surface);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.plan-card__features li::before {
    content: '✓';
    color: var(--success);
    font-weight: var(--fw-bold);
}

/* ------------------------------------------------------------------ */
/* Price calculator                                                   */
/* ------------------------------------------------------------------ */
.calculator {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-1);
    max-width: 500px;
    margin: 0 auto var(--space-xl);
}

.calculator__title {
    font-size: var(--fs-headline-sm);
    font-weight: var(--fw-bold);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.calculator__result {
    background: var(--surface-container, var(--outline-variant));
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    text-align: center;
    margin-top: var(--space-lg);
}

.calculator__total {
    font-size: var(--fs-display-md);
    font-weight: var(--fw-bold);
    color: var(--primary);
}

.calculator__breakdown {
    font-size: var(--fs-label-md);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* ------------------------------------------------------------------ */
/* Subscription banner                                                */
/* ------------------------------------------------------------------ */
.subscription-banner {
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #5856D6));
    color: var(--on-primary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.subscription-banner__info h3 {
    font-size: var(--fs-title-md);
    font-weight: var(--fw-semi);
    margin-bottom: var(--space-2xs);
}

.subscription-banner__info p {
    font-size: var(--fs-body-sm);
    opacity: 0.85;
}

/* ------------------------------------------------------------------ */
/* Activity list                                                      */
/* ------------------------------------------------------------------ */
.activity-list {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

.activity-item {
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

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

.activity-item__info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.activity-item__icon {
    font-size: 24px;
    line-height: 1;
}

.activity-item__name {
    font-size: var(--fs-body-md);
    font-weight: var(--fw-medium);
}

.activity-item__time {
    font-size: var(--fs-label-md);
    color: var(--text-secondary);
}

.activity-item__score {
    font-size: var(--fs-body-md);
    font-weight: var(--fw-semi);
    color: var(--success);
}

/* ------------------------------------------------------------------ */
/* Loading                                                            */
/* ------------------------------------------------------------------ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ------------------------------------------------------------------ */
/* Toast                                                              */
/* ------------------------------------------------------------------ */
.toast {
    position: fixed;
    bottom: var(--space-lg);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--on-surface);
    color: var(--surface);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: var(--fs-body-sm);
    font-weight: var(--fw-medium);
    z-index: 10000;
    opacity: 0;
    transition: var(--transition-slow);
    max-width: 90%;
    text-align: center;
    pointer-events: none;
    box-shadow: var(--shadow-2);
}

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

.toast--error {
    background: var(--error);
    color: var(--on-error-container, #fff);
}

.toast--success {
    background: var(--success);
    color: var(--on-success-container, #fff);
}

/* ------------------------------------------------------------------ */
/* Empty state                                                        */
/* ------------------------------------------------------------------ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state__icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: var(--space-md);
}

.empty-state__title {
    font-size: var(--fs-headline-sm);
    font-weight: var(--fw-semi);
    margin-bottom: var(--space-xs);
    color: var(--on-surface);
}

.empty-state__desc {
    font-size: var(--fs-body-sm);
    color: var(--text-secondary);
}

/* ------------------------------------------------------------------ */
/* Link                                                               */
/* ------------------------------------------------------------------ */
.link {
    color: var(--primary);
    text-decoration: none;
    font-weight: var(--fw-medium);
    cursor: pointer;
}

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

/* ------------------------------------------------------------------ */
/* Section                                                            */
/* ------------------------------------------------------------------ */
.section-title {
    font-size: var(--fs-headline-sm);
    font-weight: var(--fw-bold);
    margin-bottom: var(--space-md);
    color: var(--on-surface);
}

/* ------------------------------------------------------------------ */
/* Offline indicator                                                  */
/* ------------------------------------------------------------------ */
.offline-banner {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    background: var(--warning);
    color: var(--on-primary);
    text-align: center;
    padding: var(--space-xs);
    font-size: var(--fs-label-md);
    font-weight: var(--fw-medium);
    z-index: 999;
    display: none;
}

.offline-banner.show {
    display: block;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {
    .main-content {
        padding: var(--space-md);
    }

    .auth-card {
        padding: var(--space-xl) var(--space-lg);
    }

    .dashboard-header__greeting {
        font-size: var(--fs-headline-lg);
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .role-selector {
        grid-template-columns: 1fr;
    }

    .subscription-banner {
        flex-direction: column;
        gap: var(--space-sm);
        text-align: center;
    }

    .subscription-banner .btn {
        width: auto;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0 var(--space-md);
    }

    .navbar__title {
        font-size: var(--fs-title-md);
    }

    .stat-card__value {
        font-size: var(--fs-headline-lg);
    }

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

    .calculator {
        padding: var(--space-lg);
    }
}

/* ------------------------------------------------------------------ */
/* Student Dashboard (sd-) — mobile phone frame UI                     */
/* Variant A warm tokens; max-width 430px phone frame + bottom tabbar  */
/* ------------------------------------------------------------------ */
.sd-phone {
    max-width: var(--max-width);
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    position: relative;
}

.sd-main {
    flex: 1;
    padding: var(--space-lg) var(--space-lg) 7rem;
    overflow-x: hidden;
}

/* Top bar: profile switcher + sync status ------------------------- */
.sd-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.sd-profile-switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 0;
}

.sd-profile-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: none;
    border: none;
    padding: var(--space-xs);
    margin: calc(var(--space-xs) * -1);
    border-radius: var(--radius-lg);
    cursor: pointer;
    color: var(--on-surface);
    transition: background var(--transition-fast);
}

.sd-profile-btn:hover {
    background: var(--surface-container);
}

.sd-profile-name {
    font-weight: var(--fw-bold);
    font-size: var(--fs-body-md);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 10rem;
}

.sd-profile-tooltip {
    position: absolute;
    top: calc(100% + var(--space-xs));
    left: 0;
    min-width: 12rem;
    background: var(--surface-elevated);
    border: 1px solid var(--outline);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: var(--space-xs);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
    z-index: 40;
}

.sd-profile-tooltip.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sd-sync {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 999px;
    background: var(--surface-container);
    color: var(--on-surface-muted);
    font-size: var(--fs-body-sm);
    font-weight: var(--fw-semi);
    flex-shrink: 0;
}

.sd-sync-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent);
}

/* Hero card ------------------------------------------------------- */
.sd-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    color: var(--on-primary);
    background: var(--primary);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-lg);
}

.sd-hero-glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--secondary) 70%, transparent), transparent 55%),
        radial-gradient(100% 100% at 0% 100%, color-mix(in srgb, var(--accent) 60%, transparent), transparent 60%);
    pointer-events: none;
}

.sd-hero-content {
    position: relative;
    z-index: 1;
}

.sd-hero-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.sd-hero-title {
    font-family: var(--font-display);
    font-size: var(--fs-headline-md);
    font-weight: var(--fw-bold);
    margin: 0;
}

.sd-hero-sub {
    margin: var(--space-xs) 0 0;
    font-size: var(--fs-body-md);
    color: color-mix(in srgb, var(--on-primary) 85%, transparent);
    max-width: 21rem;
}

.sd-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 999px;
    font-size: var(--fs-body-sm);
    font-weight: var(--fw-semi);
    white-space: nowrap;
}

.sd-chip--subject {
    background: color-mix(in srgb, var(--primary) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
}

.sd-chip--progress {
    background: color-mix(in srgb, var(--secondary) 22%, transparent);
    border: 1px solid color-mix(in srgb, var(--secondary) 45%, transparent);
}

.sd-hero .sd-chip {
    color: var(--on-primary);
}

.sd-progress {
    margin: var(--space-md) 0 var(--space-lg);
}

.sd-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
    font-size: var(--fs-body-sm);
    font-weight: var(--fw-semi);
}

.sd-progress-hint {
    color: color-mix(in srgb, var(--on-primary) 85%, transparent);
}

.sd-progress-pct {
    color: var(--on-primary);
}

.sd-progress-track {
    height: 0.625rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--on-primary) 24%, transparent);
    overflow: hidden;
}

.sd-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--secondary);
}

.sd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--fs-body-md);
    font-weight: var(--fw-bold);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast),
        background var(--transition-fast), color var(--transition-fast);
}

.sd-btn--primary {
    background: var(--secondary);
    color: var(--on-secondary);
    box-shadow: var(--shadow-sm);
}

.sd-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Practice / Assessment toggle ------------------------------------ */
.sd-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xs);
    padding: var(--space-xs);
    background: var(--surface-container);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.sd-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    border: none;
    border-radius: calc(var(--radius-md) - 2px);
    background: transparent;
    color: var(--on-surface-muted);
    font-family: var(--font-body);
    font-size: var(--fs-body-sm);
    font-weight: var(--fw-semi);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sd-toggle-btn--active {
    background: var(--surface-elevated);
    color: var(--on-surface);
    box-shadow: var(--shadow-sm);
}

.sd-toggle-exam {
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 0.625rem;
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Catalog --------------------------------------------------------- */
.sd-catalog {
    margin-bottom: var(--space-lg);
}

.sd-catalog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.sd-catalog-title {
    font-family: var(--font-display);
    font-size: var(--fs-title-md);
    font-weight: var(--fw-bold);
    margin: 0;
}

.sd-catalog-all {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    background: none;
    border: none;
    padding: var(--space-xs);
    color: var(--primary);
    font-family: var(--font-body);
    font-size: var(--fs-body-sm);
    font-weight: var(--fw-bold);
    cursor: pointer;
}

.sd-catalog-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.sd-lab-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
    text-align: left;
    padding: var(--space-md);
    background: var(--surface-elevated);
    border: 1px solid var(--outline);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.sd-lab-row:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--outline));
    box-shadow: var(--shadow-sm);
}

.sd-lab-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 14%, transparent);
}

.sd-ic--surface {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 14%, transparent);
}

.sd-ic--outline {
    color: var(--on-surface-muted);
    background: var(--surface-container);
}

.sd-ic--accent {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.sd-lab-info {
    flex: 1;
    min-width: 0;
}

.sd-lab-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sd-lab-name {
    font-size: var(--fs-body-md);
    font-weight: var(--fw-bold);
    color: var(--on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sd-lab-subject {
    font-size: var(--fs-body-sm);
    color: var(--on-surface-muted);
}

.sd-lab-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.sd-lab-time {
    font-size: var(--fs-body-sm);
    font-weight: var(--fw-semi);
    color: var(--on-surface);
    white-space: nowrap;
}

.sd-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: var(--fw-bold);
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

.sd-badge-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: currentColor;
}

.sd-badge--available {
    background: color-mix(in srgb, var(--success) 16%, transparent);
    color: var(--success);
}

.sd-badge--unlock {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
}

/* Virtual lab list ------------------------------------------------- */
.sd-lablist {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.sd-lablist-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.sd-lablist-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--outline);
    border-radius: var(--radius-sm);
    background: var(--surface-container);
    color: var(--primary);
    cursor: pointer;
    transition: background var(--transition-base), transform var(--transition-base);
}

.sd-lablist-back svg {
    transform: rotate(180deg);
}

.sd-lablist-back:hover {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.sd-lablist-title {
    font-family: var(--font-display);
    font-size: var(--fs-headline-sm);
    font-weight: var(--fw-bold);
    color: var(--on-surface);
    margin: 0;
}

.sd-lablist-count {
    margin: 0;
    font-size: var(--fs-body-sm);
    color: var(--text-secondary);
}

.sd-lab-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--surface-container);
    border: 1px solid var(--outline);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--transition-base), transform var(--transition-base), background var(--transition-base);
}

.sd-lab-row:hover {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 6%, var(--surface-container));
}

.sd-lab-row:active {
    transform: scale(0.99);
}

.sd-lab-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-width: 0;
}

.sd-lab-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
}

.sd-lab-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sd-lab-subject {
    font-size: var(--fs-label-sm);
    font-weight: var(--fw-semi);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.sd-lab-name {
    font-family: var(--font-display);
    font-size: var(--fs-title-lg);
    font-weight: var(--fw-semi);
    color: var(--on-surface);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sd-lab-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 0 0 auto;
}

.sd-lab-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--fs-body-sm);
    font-weight: var(--fw-semi);
    color: var(--primary);
    white-space: nowrap;
}

/* Stats row ------------------------------------------------------- */
.sd-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--outline);
}

.sd-stat {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: var(--surface-container);
    border-radius: var(--radius-md);
    min-width: 0;
}

.sd-stat-icon {
    color: var(--primary);
}

.sd-stat-num {
    font-family: var(--font-display);
    font-size: var(--fs-title-md);
    font-weight: var(--fw-bold);
    color: var(--on-surface);
    white-space: nowrap;
}

.sd-stat-num--sm {
    font-size: var(--fs-title-sm);
    line-height: 1.1;
}

.sd-stat-label {
    font-size: var(--fs-body-sm);
    color: var(--on-surface-muted);
    line-height: 1.25;
}

/* Bottom tab bar -------------------------------------------------- */
.sd-tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: var(--space-xs);
    background: var(--surface-elevated);
    border-top: 1px solid var(--outline);
    padding: var(--space-xs) var(--space-sm) max(var(--space-sm), env(safe-area-inset-bottom));
}

.sd-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    flex: 1 1 0;
    min-width: 3.5rem;
    max-width: 8.5rem;
    padding: var(--space-xs) 0;
    border: none;
    background: none;
    color: var(--on-surface-muted);
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: var(--fw-semi);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.sd-tab--active {
    color: var(--primary);
}

.sd-tab svg {
    display: block;
}

/* AI Tutor view ---------------------------------------------------- */
.sd-tutor {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    height: calc(100vh - var(--navbar-height, 64px) - 9.5rem);
    min-height: 20rem;
}
.sd-tutor-head {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--surface-container);
    border-radius: var(--radius-md);
}
.sd-tutor-bot {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--primary);
    color: var(--on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sd-tutor-title {
    font-family: var(--font-display);
    font-weight: var(--fw-bold);
    color: var(--on-surface);
    font-size: var(--fs-body-md);
    line-height: 1.2;
}
.sd-tutor-sub {
    font-size: var(--fs-body-sm);
    color: var(--on-surface-muted);
}
.sd-tutor-msgs {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    overflow-y: auto;
    padding: var(--space-sm) 0;
}
.sd-tutor-bubble {
    max-width: 86%;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--fs-body-sm);
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}
.sd-tutor-bubble--bot {
    align-self: flex-start;
    background: var(--surface-container);
    color: var(--on-surface);
    border-bottom-left-radius: var(--radius-sm);
}
.sd-tutor-bubble--user {
    align-self: flex-end;
    background: var(--primary);
    color: var(--on-primary);
    border-bottom-right-radius: var(--radius-sm);
}
.sd-tutor-suggest {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}
.sd-tutor-chip {
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--outline);
    border-radius: 999px;
    background: var(--surface-elevated);
    color: var(--primary-strong);
    font-family: var(--font-body);
    font-size: var(--fs-body-sm);
    cursor: pointer;
}
.sd-tutor-chip:hover { background: var(--surface-container); }
.sd-tutor-input {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}
.sd-tutor-field {
    flex: 1 1 auto;
    min-width: 0;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--outline);
    border-radius: 999px;
    background: var(--surface-elevated);
    font-family: var(--font-body);
    font-size: var(--fs-body-sm);
    color: var(--on-surface);
}
.sd-tutor-field:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.sd-tutor-send {
    flex: 0 0 auto;
    padding: var(--space-sm) var(--space-lg);
    border-radius: 999px;
}

/* Desktop enhancement: center frame, keep tabbar pinned ----------- */
@media (min-width: 431px) {
    .sd-phone {
        margin: 0 auto;
        max-width: var(--max-width);
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Teacher Dashboard (web/tablet sidebar layout) — tchd-* block
   ═══════════════════════════════════════════════════════════════════════ */
.tchd-shell {
    display: flex;
    min-height: calc(100vh - var(--navbar-height, 64px));
    background: #f9fafb;
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.tchd-sidebar {
    width: 250px;
    flex: 0 0 250px;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: var(--space-lg, 20px) var(--space-md, 16px);
    position: sticky;
    top: var(--navbar-height, 64px);
    height: calc(100vh - var(--navbar-height, 64px));
}
.tchd-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: var(--space-xl, 28px);
}
.tchd-brand__logo { width: 32px; height: 32px; object-fit: contain; }
.tchd-brand__name {
    font-family: var(--font-display, 'Baloo 2');
    font-size: var(--fs-title-md, 18px);
    font-weight: var(--fw-bold, 700);
    color: var(--primary, #2563eb);
}
.tchd-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}
.tchd-nav__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md, 10px);
    font-size: var(--fs-body-md, 15px);
    font-weight: var(--fw-semi, 600);
    color: var(--text-secondary, #4b5563);
    cursor: pointer;
    transition: background var(--transition-fast, .15s), color var(--transition-fast, .15s);
    text-align: left;
}
.tchd-nav__item:hover { background: var(--surface-container, #f3f4f6); color: var(--text-primary, #111827); }
.tchd-nav__item--active {
    background: #facc15;
    color: #000;
}
.tchd-new-exp {
    margin-top: var(--space-lg, 20px);
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-md, 10px);
    background: var(--primary, #2563eb);
    color: #fff;
    font-size: var(--fs-body-md, 15px);
    font-weight: var(--fw-semi, 600);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background var(--transition-fast, .15s);
}
.tchd-new-exp:hover { background: var(--primary-hover, #1d4ed8); }
.tchd-sidebar__foot {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid var(--border);
    padding-top: var(--space-md, 16px);
    margin-top: var(--space-lg, 20px);
}

/* ── Main content ────────────────────────────────────────────────────── */
.tchd-main {
    flex: 1;
    min-width: 0;
    padding: var(--space-xl, 28px);
    overflow-y: auto;
}
.tchd-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-xl, 28px);
}
.tchd-header__title {
    font-family: var(--font-display, 'Baloo 2');
    font-size: var(--fs-display-md, 30px);
    font-weight: var(--fw-bold, 700);
    color: var(--primary, #2563eb);
}
.tchd-header__subtitle { color: var(--text-secondary, #6b7280); margin-top: 2px; }
.tchd-header__actions { display: flex; gap: 10px; align-items: center; }
.tchd-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .15s;
}
.tchd-icon-btn:hover { background: var(--surface-container); }
.tchd-badge {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #dc2626;
    border-radius: 50%;
    display: none;
}

/* ── KPI cards ───────────────────────────────────────────────────────── */
.tchd-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: var(--space-xl, 28px);
}
.tchd-kpi {
    background: #fff;
    border-radius: var(--radius-lg, 14px);
    padding: 20px;
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));
    border: 1px solid var(--outline-variant, #e5e7eb);
}
.tchd-kpi__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.tchd-kpi__label { font-size: var(--fs-label-md, 14px); color: var(--text-secondary); font-weight: var(--fw-semi, 600); }
.tchd-kpi__value {
    font-size: var(--fs-display-md, 32px);
    font-weight: var(--fw-bold, 700);
    line-height: 1.1;
}
.tchd-kpi__value--sm { font-size: var(--fs-headline-md, 22px); }
.tchd-kpi__sub { font-size: var(--fs-label-sm, 13px); color: var(--text-tertiary, #9ca3af); margin-top: 4px; }
.tchd-kpi__arrow { display: inline-flex; }
.tchd-kpi__arrow--up { color: #16a34a; }
.tchd-kpi__arrow--down { color: #dc2626; }
.tchd-kpi--total .tchd-kpi__value { color: #2563eb; }
.tchd-kpi--completion .tchd-kpi__value { color: #d97706; }
.tchd-kpi--labs .tchd-kpi__value { color: #dc2626; }
.tchd-kpi--weak {
    background: #fdf2f8;
    border-color: #fbcfe8;
}
.tchd-kpi__warn { color: #db2777; }
.tchd-progress {
    height: 6px;
    background: #f3f4f6;
    border-radius: 99px;
    margin-top: 12px;
    overflow: hidden;
}
.tchd-progress i {
    display: block;
    height: 100%;
    background: #d97706;
    border-radius: 99px;
}

/* ── Middle row (70/30) ──────────────────────────────────────────────── */
.tchd-mid {
    display: grid;
    grid-template-columns: 70fr 30fr;
    gap: 18px;
    margin-bottom: var(--space-xl, 28px);
}
.tchd-card {
    background: #fff;
    border-radius: var(--radius-lg, 14px);
    border: 1px solid var(--outline-variant, #e5e7eb);
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));
    padding: 20px;
}
.tchd-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.tchd-card__title { font-size: var(--fs-title-md, 18px); font-weight: var(--fw-bold, 700); color: var(--text-primary); }
.tchd-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    color: var(--text-primary);
}
.tchd-chart-wrap { position: relative; height: 260px; }

/* ── Subjects ────────────────────────────────────────────────────────── */
.tchd-subjects { display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
.tchd-subject__head {
    display: flex;
    justify-content: space-between;
    font-size: var(--fs-label-md, 14px);
    margin-bottom: 8px;
    color: var(--text-secondary);
}
.tchd-subject__track {
    height: 12px;
    background: #f3f4f6;
    border-radius: 99px;
    overflow: hidden;
}
.tchd-subject__track i { display: block; height: 100%; border-radius: 99px; }

/* ── Activity table ──────────────────────────────────────────────────── */
.tchd-table { width: 100%; border-collapse: collapse; }
.tchd-table th {
    text-align: left;
    font-size: var(--fs-label-sm, 13px);
    color: var(--text-secondary);
    font-weight: var(--fw-semi, 600);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.tchd-table td { padding: 14px 12px; font-size: var(--fs-body-md, 15px); border-bottom: 1px solid #f3f4f6; color: var(--text-primary); }
.tchd-table tbody tr:hover { background: #f9fafb; }
.tchd-td-student { display: flex; align-items: center; gap: 10px; }
.tchd-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: var(--fw-bold, 700);
}
.tchd-score--pass { color: #16a34a; font-weight: var(--fw-semi, 600); }
.tchd-score--fail { color: #dc2626; font-weight: var(--fw-semi, 600); }
.tchd-badge-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: var(--fw-semi, 600);
    text-transform: uppercase;
}
.tchd-badge-pill--pass { background: #dcfce7; color: #15803d; }
.tchd-badge-pill--fail { background: #fee2e2; color: #b91c1c; }
.tchd-badge-pill--progress { background: #fef9c3; color: #a16207; }
.tchd-badge-pill--neutral { background: #f3f4f6; color: #4b5563; }
.tchd-details { color: var(--primary-strong, var(--primary)); font-weight: var(--fw-semi, 600); text-decoration: none; }
.tchd-details:hover { text-decoration: underline; }
.tchd-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    color: var(--text-tertiary);
}
.tchd-search input { border: none; outline: none; background: transparent; font-size: 14px; color: var(--text-primary); min-width: 200px; }
.tchd-empty { color: var(--text-secondary); text-align: center; padding: 20px; }

/* ── Responsive: tablet (768–1024px) ─────────────────────────────────── */
@media (max-width: 1024px) {
    .tchd-kpis { grid-template-columns: repeat(2, 1fr); }
    .tchd-mid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .tchd-sidebar { width: 64px; flex-basis: 64px; padding: var(--space-md, 16px) 8px; }
    .tchd-brand__name, .tchd-nav__item span, .tchd-new-exp span { display: none; }
    .tchd-nav__item { justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Parent Dashboard (mobile phone frame) — pd-* block
   ═══════════════════════════════════════════════════════════════════════ */
.pd-phone .pd-topbar {
    align-items: center;
}
.pd-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary, #0077cc);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: var(--fw-bold, 700);
}
.pd-avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.pd-add-child {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--primary, #0077cc);
    border-radius: var(--radius-full, 999px);
    background: transparent;
    color: var(--primary, #0077cc);
    font-size: 13px;
    font-weight: var(--fw-semi, 600);
    cursor: pointer;
}
.pd-add-child span { display: none; }
@media (min-width: 380px) { .pd-add-child span { display: inline; } }

/* Child switcher dropdown */
.pd-switcher {
    background: var(--surface-elevated, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 12px);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.08));
    padding: 10px;
    margin: 0 16px 12px;
}
.pd-switcher__title {
    font-size: var(--fs-label-sm, 12px);
    color: var(--text-secondary, #6b7280);
    padding: 4px 8px 8px;
}
.pd-switcher__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 8px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm, 8px);
    font-size: var(--fs-body-md, 15px);
    font-weight: var(--fw-medium, 500);
    color: var(--text-primary, #111827);
    cursor: pointer;
    text-align: left;
}
.pd-switcher__item:hover { background: var(--surface-container, #f3f4f6); }
.pd-switcher__item.is-active { background: var(--primary-container, #dbeafe); color: var(--on-primary-container, #1e3a8a); font-weight: var(--fw-semi, 600); }

/* Hero + stats */
.pd-hero .pd-progress-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 16px;
}
.pd-stat {
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(0,0,0,.04);
    border-radius: var(--radius-md, 12px);
    padding: 12px 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.pd-stat__num { font-size: var(--fs-title-lg, 20px); font-weight: var(--fw-bold, 700); color: var(--text-primary, #111827); }
.pd-stat__label { font-size: var(--fs-micro, 11px); color: var(--text-secondary, #6b7280); }
.pd-stat__icon { margin-bottom: 2px; }

/* Activity */
.pd-activity-list { display: flex; flex-direction: column; gap: 8px; }
.pd-activity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface-container-low, #fff);
    border: 1px solid var(--outline-variant, #e5e7eb);
    border-radius: var(--radius-md, 12px);
    padding: 12px;
}
.pd-lab-ic {
    width: 42px; height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
    background: var(--primary-container, #dbeafe);
    color: var(--primary, #0077cc);
    display: flex; align-items: center; justify-content: center;
}
.pd-lab-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pd-lab-subject { font-size: var(--fs-micro, 11px); color: var(--text-secondary, #6b7280); }
.pd-lab-name {
    font-size: var(--fs-body-md, 15px);
    font-weight: var(--fw-semi, 600);
    color: var(--text-primary, #111827);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pd-lab-time { font-size: var(--fs-micro, 11px); color: var(--text-tertiary, #9ca3af); }
.pd-lab-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pd-score { font-size: var(--fs-title-sm, 16px); font-weight: var(--fw-bold, 700); color: var(--text-primary, #111827); }
.pd-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: var(--fw-semi, 600);
    text-transform: uppercase;
}
.pd-badge--pass { background: var(--success-container, #dcfce7); color: var(--success, #15803d); }
.pd-badge--fail { background: var(--error-container, #fee2e2); color: var(--error, #b91c1c); }
.pd-badge--progress { background: var(--secondary-container, #fef9c3); color: var(--on-secondary-container, #854d0e); }
.pd-empty { padding: 48px 24px; }
.pd-empty .empty-state__icon { font-size: 48px; }

/* Add-child modal */
.pd-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(15,23,42,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.pd-modal {
    position: relative;
    width: 100%;
    max-width: 360px;
    background: var(--surface-elevated, #fff);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.16));
    padding: 28px 24px 24px;
}
.pd-modal__close {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    border: none; background: transparent;
    border-radius: 50%;
    color: var(--text-tertiary, #9ca3af);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.pd-modal__close:hover { background: var(--surface-container, #f3f4f6); }
.pd-modal__title { font-size: var(--fs-title-lg, 20px); font-weight: var(--fw-bold, 700); color: var(--text-primary, #111827); margin-bottom: 4px; }
.pd-modal__desc { font-size: var(--fs-body-sm, 14px); color: var(--text-secondary, #6b7280); margin-bottom: 16px; }
.pd-modal__input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border, #d1d5db);
    border-radius: var(--radius-sm, 10px);
    font-size: 15px;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.pd-modal__submit { width: 100%; margin-top: 14px; }
.pd-modal__hint { font-size: var(--fs-micro, 12px); color: var(--text-tertiary, #9ca3af); margin-top: 12px; text-align: center; }

/* ═══════════════════════════════════════════════════════════════════════
   Notification dropdown (teacher header bell) — tchd-notif-*
   ═══════════════════════════════════════════════════════════════════════ */
.tchd-notif {
    position: fixed;
    top: calc(var(--navbar-height, 64px) + 62px);
    right: 28px;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border: 1px solid var(--outline-variant, #e5e7eb);
    border-radius: var(--radius-lg, 14px);
    box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.12));
    z-index: 90;
    overflow: hidden;
}
.tchd-notif__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.tchd-notif__title { font-size: var(--fs-title-sm, 16px); font-weight: var(--fw-bold, 700); color: var(--text-primary); }
.tchd-notif__clear {
    border: none; background: transparent;
    color: var(--primary, #2563eb);
    font-size: 13px; font-weight: var(--fw-semi, 600);
    cursor: pointer;
}
.tchd-notif__list { max-height: 300px; overflow-y: auto; }
.tchd-notif__item {
    display: flex; gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
}
.tchd-notif__item.is-unread { background: #eff6ff; }
.tchd-notif__dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #9ca3af; margin-top: 6px; flex: 0 0 8px;
}
.tchd-notif__item.is-unread .tchd-notif__dot { background: #2563eb; }
.tchd-notif__txt { font-size: var(--fs-label-md, 14px); font-weight: var(--fw-semi, 600); color: var(--text-primary); }
.tchd-notif__body { font-size: var(--fs-body-sm, 13px); color: var(--text-secondary); margin-top: 2px; }
.tchd-notif__time { font-size: var(--fs-micro, 11px); color: var(--text-tertiary); margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════════════
   Shared-device account picker (login) — device-accounts-*
   ═══════════════════════════════════════════════════════════════════════ */
.device-accounts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}
.device-accounts__label {
    font-size: var(--fs-label-sm, 12px);
    color: var(--text-tertiary, #9ca3af);
    text-transform: uppercase;
    letter-spacing: .4px;
}
.device-account {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border, #d1d5db);
    border-radius: var(--radius-md, 12px);
    padding: 8px 10px;
    background: var(--surface-container-low, #fff);
}
.device-account__pick {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    border: none;
    background: transparent;
    padding: 4px;
    text-align: left;
    cursor: pointer;
    min-width: 0;
}
.device-account__avatar {
    width: 36px; height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    background: var(--primary, #0077cc);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: var(--fw-bold, 700);
}
.device-account__meta { display: flex; flex-direction: column; min-width: 0; }
.device-account__name { font-size: var(--fs-body-md, 15px); font-weight: var(--fw-semi, 600); color: var(--text-primary, #111827); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-account__email { font-size: var(--fs-label-sm, 12px); color: var(--text-secondary, #6b7280); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-account__forget {
    width: 30px; height: 30px;
    border: none; background: transparent;
    border-radius: 50%;
    color: var(--text-tertiary, #9ca3af);
    font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.device-account__forget:hover { background: var(--error-container, #fee2e2); color: var(--error, #b91c1c); }

/* Visually hidden but accessible to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   Student locked overlay (no active subscription) — sd-locked-*
   ═══════════════════════════════════════════════════════════════════════ */
.sd-locked {
    position: relative;
    margin: 16px 16px 0;
    padding: 44px 26px 36px;
    border-radius: var(--radius-xl, 20px);
    background: var(--surface-elevated, #fef8e7);
    border: 1px solid var(--outline-variant, #e5e7eb);
    text-align: center;
    overflow: hidden;
}
.sd-locked__glow {
    position: absolute;
    top: -60px; right: -60px;
    width: 180px; height: 180px;
    background: radial-gradient(circle, rgba(0,119,204,.12), transparent 70%);
    pointer-events: none;
}
.sd-locked__icon {
    width: 72px; height: 72px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--primary-container, #dbeafe);
    color: var(--primary, #0077cc);
    display: flex; align-items: center; justify-content: center;
}
.sd-locked__title {
    font-family: var(--font-display, 'Baloo 2');
    font-size: var(--fs-title-lg, 20px);
    font-weight: var(--fw-bold, 700);
    color: var(--text-primary, #111827);
    margin-bottom: 6px;
}
.sd-locked__desc {
    font-size: var(--fs-body-md, 15px);
    color: var(--text-secondary, #4b5563);
    margin-bottom: 18px;
}
.sd-locked-code {
    margin: 0 auto 18px;
    padding: 12px 16px;
    max-width: 260px;
    background: #fff;
    border: 1px dashed var(--outline, #d1d5db);
    border-radius: var(--radius-md, 12px);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sd-locked-code__label {
    font-size: var(--fs-micro, 11px);
    color: var(--text-tertiary, #6b7280);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.sd-locked-code strong {
    font-size: var(--fs-title-md, 18px);
    letter-spacing: 1px;
    color: var(--primary-strong, #0b4a75);
}
.sd-locked-code small { font-size: var(--fs-micro, 11px); color: var(--text-tertiary, #6b7280); }

/* ═══════════════════════════════════════════════════════════════════════
   Student catalog subject filter pills — sd-filter-*
   ═══════════════════════════════════════════════════════════════════════ */
.sd-filter {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}
.sd-filter-pill {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 16px;
    border: 1px solid var(--outline-variant, #e5e7eb);
    border-radius: var(--radius-full, 999px);
    background: var(--surface-elevated, #fff);
    color: var(--text-secondary, #4b5563);
    font-size: 13px;
    font-weight: var(--fw-semi, 600);
    cursor: pointer;
    transition: all var(--transition-fast, .15s);
    -webkit-appearance: none;
}
.sd-filter-pill--active {
    background: var(--primary-strong, #0b4a75);
    border-color: var(--primary-strong, #0b4a75);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════
   Teacher experiments library — tchd-exp-*
   ═══════════════════════════════════════════════════════════════════════ */
.tchd-main__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}
.tchd-exp-list { display: flex; flex-direction: column; gap: 12px; }
.tchd-exp-card {
    background: #fff;
    border: 1px solid var(--outline-variant, #e5e7eb);
    border-radius: var(--radius-md, 12px);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.04));
}
.tchd-exp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.tchd-exp-title { font-size: var(--fs-title-md, 18px); font-weight: var(--fw-bold, 700); color: var(--text-primary); }
.tchd-exp-desc { font-size: var(--fs-body-sm, 14px); color: var(--text-secondary); margin-bottom: 10px; }
.tchd-exp-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.tchd-exp-steps li { font-size: var(--fs-body-sm, 14px); color: var(--text-primary); }
.tchd-modal { max-width: 420px; }
.tchd-modal--wide { max-width: 560px; }

/* ═══════════════════════════════════════════════════════════════════════
   Teacher submissions — tchd-sub-*
   ═══════════════════════════════════════════════════════════════════════ */
.tchd-sub-list { display: flex; flex-direction: column; gap: 12px; }
.tchd-sub-card {
    background: #fff;
    border: 1px solid var(--outline-variant, #e5e7eb);
    border-radius: var(--radius-md, 12px);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.04));
}
.tchd-sub-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}
.tchd-sub-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.tchd-sub-name {
    font-size: var(--fs-title-md, 18px);
    font-weight: var(--fw-bold, 700);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tchd-sub-meta {
    font-size: var(--fs-body-sm, 14px);
    color: var(--text-secondary);
}
.tchd-sub-last {
    font-size: var(--fs-body-sm, 14px);
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding-left: 44px;
}
.tchd-sub-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--outline-variant, #f3f4f6);
}
.tchd-sub-date {
    font-size: var(--fs-label-md, 13px);
    color: var(--text-tertiary, #9ca3af);
}
.btn--sm {
    padding: 6px 14px;
    font-size: var(--fs-label-md, 13px);
}
.tchd-sub-detail-section {
    margin-bottom: 16px;
}
.tchd-sub-detail-title {
    font-size: var(--fs-label-md, 13px);
    font-weight: var(--fw-semi, 600);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.tchd-sub-steps {
    margin: 0;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tchd-sub-steps li {
    font-size: var(--fs-body-sm, 14px);
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.tchd-sub-step-num {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-container, #dbeafe);
    color: var(--primary-strong, #0b4a75);
    font-size: 11px;
    font-weight: var(--fw-bold, 700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tchd-sub-step-time {
    font-size: var(--fs-micro, 12px);
    color: var(--text-tertiary, #9ca3af);
}
.tchd-sub-observation {
    font-size: var(--fs-body-sm, 14px);
    color: var(--text-primary);
    background: var(--surface-container, #f9fafb);
    border: 1px solid var(--outline-variant, #e5e7eb);
    border-radius: var(--radius-sm, 8px);
    padding: 10px 12px;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* Offline-mode banner (server unreachable → shell still loads from SW cache) */
.offline-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 16px;
    background: var(--secondary-container, #fef9c3);
    border-bottom: 1px solid var(--outline-variant, #e5e7eb);
    color: var(--on-secondary-container, #854d0e);
    font-size: var(--fs-label-md, 14px);
    font-weight: var(--fw-semi, 600);
}
.offline-banner small { font-weight: var(--fw-medium, 500); color: var(--text-secondary, #6b7280); }
.offline-banner__retry {
    margin-left: auto;
    padding: 6px 14px;
    border: 1px solid currentColor;
    border-radius: var(--radius-sm, 8px);
    background: transparent;
    color: inherit;
    font-size: 13px;
    font-weight: var(--fw-semi, 600);
    cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════════
   Lab unlock modal (subscription gate) — lab-unlock-*
   ═══════════════════════════════════════════════════════════════════════ */
.lab-unlock-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.lab-unlock-modal {
    position: relative;
    width: 100%;
    max-width: 380px;
    background: var(--surface-elevated, #fff);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-md, 0 12px 32px rgba(0,0,0,.18));
    padding: 32px 26px 26px;
    text-align: center;
}
.lab-unlock-modal__close {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    border: none; background: transparent;
    border-radius: 50%;
    color: var(--text-tertiary, #9ca3af);
    cursor: pointer;
    font-size: 15px;
}
.lab-unlock-modal__close:hover { background: var(--surface-container, #f3f4f6); }
.lab-unlock-modal__icon {
    width: 60px; height: 60px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--primary-container, #dbeafe);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
}
.lab-unlock-modal__title {
    font-family: var(--font-display, 'Baloo 2');
    font-size: var(--fs-title-lg, 20px);
    font-weight: var(--fw-bold, 700);
    color: var(--text-primary, #111827);
    margin-bottom: 6px;
}
.lab-unlock-modal__desc {
    font-size: var(--fs-body-md, 15px);
    color: var(--text-secondary, #4b5563);
    margin-bottom: 20px;
}
.lab-unlock-modal__actions { display: flex; flex-direction: column; gap: 10px; }
.lab-unlock-modal__cta { width: 100%; }
.lab-unlock-modal__cancel { width: 100%; }

/* Demo-college banner (student dashboard) — sd-demo-* */
.sd-demo-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 16px 0;
    padding: 10px 14px;
    border-radius: var(--radius-md, 12px);
    background: linear-gradient(90deg, #eef2ff, #fdf4ff);
    border: 1px solid var(--outline-variant, #e5e7eb);
    font-size: var(--fs-body-sm, 14px);
    color: var(--text-primary, #111827);
}
.sd-demo-banner__badge {
    flex: 0 0 auto;
    padding: 3px 10px;
    border-radius: 99px;
    background: var(--primary-strong, #0b4a75);
    color: #fff;
    font-size: 11px;
    font-weight: var(--fw-bold, 700);
    letter-spacing: .5px;
}
.sd-demo-banner__text { flex: 1 1 auto; min-width: 150px; }
.sd-demo-banner__cta {
    flex: 0 0 auto;
    color: var(--primary-strong, #0b4a75);
    font-weight: var(--fw-semi, 600);
    text-decoration: underline;
}

/* Teacher header school name (kept below the welcome subtitle; the sidebar
   brand space is reserved for the product name). */
.tchd-header__school {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 5px 12px;
    border-radius: 99px;
    background: var(--primary-container, #dbeafe);
    color: var(--primary-strong, #0b4a75);
    font-size: var(--fs-label-md, 13px);
    font-weight: var(--fw-semi, 600);
}

/* Join-a-school button in the student topbar */
.sd-link-school {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border: 1px solid var(--outline-variant, #e5e7eb);
    border-radius: 99px;
    background: var(--surface-elevated, #fff);
    color: var(--primary-strong, #0b4a75);
    font-size: 12px;
    font-weight: var(--fw-semi, 600);
    cursor: pointer;
}
.sd-link-school span { display: none; }
@media (min-width: 380px) { .sd-link-school span { display: inline; } }
