
    /* PORTAL.PHP STYLING */
    :root, [data-theme="dark"] {
        --sp-bg:        #010206;
        --sp-surface:   #070a13;
        --sp-lift:      #0c1020;
        --sp-lift-2:    #10152a;
        --sp-glass-soft:   rgba(7,10,19,0.55);
        --sp-glass:        rgba(7,10,19,0.70);
        --sp-glass-strong: rgba(7,10,19,0.85);
        --sp-glass-solid:  rgba(7,10,19,0.96);
        --sp-border:    rgba(255,255,255,0.06);
        --sp-border-strong: rgba(255,255,255,0.1);
        --sp-text:      #ffffff;
        --sp-muted:     #c3ccdb;
        --sp-label:     #9aa6ba;

        --sp-blue:      #1b6bf5;
        --sp-blue-dark: #104eb0;
        --sp-blue-dim:  rgba(27,107,245,0.1);
        --sp-blue-glow: rgba(27,107,245,0.28);
        --sp-accent-soft: #7cb2fc;

        --sp-mint:      #10b981;
        --sp-mint-dim:  rgba(16,185,129,0.1);

        --sp-rose:      #ef4444;
        --sp-rose-dim:  rgba(239,68,68,0.12);

        --sp-amber:     #f59e0b;
        --sp-amber-dim: rgba(245,158,11,0.1);

        --sp-orange:    #f97316;
        --sp-orange-dim: rgba(249,115,22,0.1);

        --sp-radius-lg: 22px;
        --sp-radius-md: 14px;
        --sp-radius-sm: 10px;
        --sp-radius-pill: 999px;

        --sp-shadow:    0 20px 50px rgba(0,0,0,0.55);
        --sp-shadow-sm: 0 10px 26px rgba(0,0,0,0.35);
    }

    html, body {
        height: auto !important;
        min-height: 100dvh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        max-width: 100vw !important;
        margin: 0;
        padding: 0;
        background-color: var(--sp-bg);
    }

    body {
        background-color: var(--sp-bg) !important;
        color: var(--sp-text) !important;
        font-family: 'Inter', sans-serif !important;
        width: 100%;
    }

    body, .sp-page, .sp-tabs, .sp-panel, .sp-input, .sp-select, .sp-grade-card, .sp-mat-card, .sp-stat-card, .sp-tbl-shell, .sp-tbl, .sp-tbl thead th, .sp-tbl tbody td {
        transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
    }

    /* Everything that carries a themed surface, border or text tone eases
       into the new colour together, so switching themes reads as one motion
       instead of a flicker of unrelated repaints. */
    html, .sp-bg-elements, .sp-nebula-cloud, .sp-hero-pillbar, .sp-access-card,
    .sp-highlight-card, .sp-panel-head, .sp-res-tabs, .sp-res-tab, .sp-tab-btn,
    .sp-metric, .sp-score-chip, .sp-pill, .sp-input-container, .sp-continue-btn,
    .sp-dl-btn, .sp-back-btn, .sp-pub-btn, .sp-avatar, .sp-empty-icon,
    .sp-section-pill, .sp-code-chip, .sp-card-accordion-content, #toast {
        transition: background 0.3s ease, background-color 0.3s ease,
                    border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
    }

    @media (prefers-reduced-motion: reduce) {
        html, body, .sp-bg-elements, .sp-nebula-cloud { transition: none !important; }
    }

    .hidden { display: none !important; }

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

    /* Ambient nebula background */
    .sp-bg-elements {
        position: fixed !important;
        inset: 0 !important;
        pointer-events: none !important;
        z-index: 0 !important;
        overflow: hidden !important;
        background: var(--sp-bg) !important;
    }
    .sp-nebula { position: absolute !important; inset: 0 !important; mix-blend-mode: screen !important; opacity: 0.9 !important; }
    .sp-nebula-cloud { position: absolute !important; border-radius: 50% !important; filter: blur(90px) !important; }
    .sp-nb-blue   { top: -140px !important; left: -120px !important; width: 560px !important; height: 340px !important; background: radial-gradient(circle, var(--sp-blue-glow) 0%, rgba(29,78,216,0.04) 60%, transparent 100%) !important; }
    .sp-nb-purple { top: -80px !important; right: 5% !important; width: 520px !important; height: 360px !important; background: radial-gradient(circle, var(--sp-blue-glow) 0%, var(--sp-blue-dim) 60%, transparent 100%) !important; }
    .sp-nb-orange { bottom: -160px !important; right: -80px !important; width: 480px !important; height: 320px !important; background: radial-gradient(circle, rgba(249,115,22,0.18) 0%, rgba(190,74,10,0.03) 60%, transparent 100%) !important; }

    .sp-page {
        position: relative !important;
        z-index: 1 !important;
        width: min(1200px, 100%);
        margin: 0 auto;
        padding: 1.25rem clamp(0.65rem, 3vw, 1.25rem) 3rem;
        display: flex;
        flex-direction: column;
        gap: 1.75rem;
        overflow-x: hidden;
    }

    /* Hero Section with Logo */
    .sp-hero-section {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1rem 0.5rem 0.5rem;
    }

    .sp-hero-logo-row {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 14px;
        margin-bottom: 10px;
    }

    .sp-portal-logo {
        height: clamp(38px, 6vw, 52px);
        width: auto;
        object-fit: contain;
        filter: drop-shadow(0 4px 12px var(--sp-blue-glow));
    }

    .sp-hero-pillbar {
        display: inline-flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 14px;
        background: var(--sp-glass-soft);
        border: 1px solid var(--sp-border);
        padding: 10px clamp(14px, 4vw, 22px);
        border-radius: var(--sp-radius-pill);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        box-shadow: var(--sp-shadow-sm);
        margin-bottom: 20px;
        max-width: 100%;
    }

    .sp-status-badge {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: 10px;
        font-weight: 800;
        color: var(--sp-mint);
        background: rgba(16,185,129,0.06);
        border: 1px solid rgba(16,185,129,0.15);
        padding: 3px 10px;
        border-radius: var(--sp-radius-pill);
        text-transform: uppercase;
    }
    .sp-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sp-mint); box-shadow: 0 0 6px var(--sp-mint); }

    .sp-hero-main-title {
        font-size: clamp(1.7rem, 6vw, 3rem);
        font-weight: 900;
        letter-spacing: -0.02em;
        line-height: 1.15;
    }
    .sp-hero-main-title .accent-a { color: #38bdf8; background: linear-gradient(135deg,#38bdf8,#0ea5e9); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
    .sp-hero-main-title .accent-b { color: #f97316; background: linear-gradient(135deg,#f97316,#f59e0b); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

    .sp-hero-subtitle {
        font-size: clamp(0.78rem, 2.4vw, 0.95rem);
        color: var(--sp-muted);
        font-weight: 500;
        max-width: 560px;
        margin: 12px auto 18px;
        line-height: 1.6;
        padding: 0 0.5rem;
    }

    /* ══ COLOUR PICKER (the four accent dashes) ══════════════════════════ */
    .sp-theme-picker {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        gap: 7px;
        margin-bottom: 24px;
    }

    .sp-color-dashes {
        display: inline-flex;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        background: var(--sp-glass-soft);
        border: 1px solid var(--sp-border);
        border-radius: var(--sp-radius-pill);
        padding: 9px 13px;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .sp-dash {
        width: 26px;
        height: 6px;
        border-radius: 3px;
        border: none;
        padding: 0;
        cursor: pointer;
        opacity: 0.55;
        transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
        outline: none;
        -webkit-tap-highlight-color: transparent;
    }
    .sp-dash:hover { opacity: 0.9; transform: scaleY(1.35); }
    .sp-dash:focus-visible { box-shadow: 0 0 0 3px rgba(255,255,255,0.25); }
    .sp-dash.is-active {
        opacity: 1;
        transform: scaleY(1.9) scaleX(1.12);
        box-shadow: 0 0 10px 1px currentColor;
    }

    .sp-dash.blue   { background: #2563eb; color: #2563eb; }
    .sp-dash.teal   { background: #06b6d4; color: #06b6d4; }
    .sp-dash.green  { background: #10b981; color: #10b981; }
    .sp-dash.orange { background: #f59e0b; color: #f59e0b; }

    .sp-theme-caption {
        font-size: 9px;
        font-weight: 800;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: var(--sp-label);
        display: inline-flex;
        align-items: center;
        gap: 5px;
    }
    .sp-theme-caption i { color: var(--sp-accent-soft); }

    @media (prefers-reduced-motion: reduce) {
        .sp-dash { transition: none !important; }
    }

    /* Navigation Tabs */
    .sp-tabs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
        padding: 6px;
        background: var(--sp-glass-soft);
        border: 1px solid var(--sp-border);
        border-radius: var(--sp-radius-md);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        max-width: 520px;
        margin: 0 auto;
        width: 100%;
    }

    .sp-tab-btn {
        min-height: 46px;
        border: 1px solid transparent;
        border-radius: calc(var(--sp-radius-md) - 3px);
        background: transparent;
        color: var(--sp-muted);
        font-size: 0.7rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.55rem;
        cursor: pointer;
        transition: all 0.2s ease;
        text-align: center;
        padding: 0 0.4rem;
    }

    .sp-tab-btn:hover { color: var(--sp-text); background: rgba(255,255,255,0.03); }

    .sp-tab-btn.is-active {
        color: #ffffff;
        background: linear-gradient(135deg, var(--sp-blue) 0%, var(--sp-blue-dark) 100%);
        border-color: var(--sp-blue-glow);
        box-shadow: 0 6px 18px var(--sp-blue-glow);
    }

    .sp-panel { border: none; background: transparent; box-shadow: none; }

    .sp-panel-head {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 1.4rem 1.6rem;
        border-bottom: 1px solid var(--sp-border);
    }

    @media (max-width: 640px) { .sp-panel-head { padding: 1.1rem; } }

    .sp-panel-kicker {
        font-size: 0.6rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.12em;
        color: var(--sp-accent-soft);
        display: flex;
        align-items: center;
        gap: 0.4rem;
        margin-bottom: 0.35rem;
    }

    .sp-panel-title { font-size: clamp(0.95rem, 3.2vw, 1.05rem); font-weight: 900; color: var(--sp-text); letter-spacing: -0.01em; line-height: 1.2; }
    .sp-panel-sub { font-size: 0.78rem; line-height: 1.65; color: var(--sp-muted); margin-top: 0.4rem; max-width: 600px; }
    .sp-panel-body { padding: 1.4rem 1.6rem; }
    @media (max-width: 640px) { .sp-panel-body { padding: 1.1rem 0.9rem; } }

    .sp-access-wrap { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; width: 100%; }

    .sp-access-card {
        background: var(--sp-glass-strong);
        border: 1px solid var(--sp-border);
        border-radius: 24px;
        padding: clamp(1.4rem, 5vw, 2rem) clamp(1.2rem, 4vw, 1.9rem);
        box-shadow: var(--sp-shadow);
        width: 100%;
        max-width: 420px;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .sp-access-header { text-align: center; margin-bottom: 1.5rem; }

    .sp-access-kicker {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        font-size: 0.65rem;
        font-weight: 800;
        color: var(--sp-accent-soft);
        background: var(--sp-blue-dim);
        padding: 0.3rem 0.75rem;
        border-radius: var(--sp-radius-pill);
        margin-bottom: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }

    .sp-access-title { font-size: clamp(1.1rem, 4vw, 1.3rem); font-weight: 800; color: var(--sp-text); letter-spacing: -0.01em; margin-bottom: 0.4rem; }
    .sp-access-subtitle { font-size: 0.78rem; color: var(--sp-muted); line-height: 1.5; }

    .sp-field-label {
        display: block;
        font-size: 0.65rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.07em;
        color: var(--sp-label);
        margin-bottom: 6px;
    }

    .sp-input-container {
        position: relative;
        display: flex;
        align-items: center;
        border-radius: 12px;
        background: var(--sp-lift);
        box-shadow: inset 0px 2px 4px rgba(0,0,0,0.5);
        border: 1px solid var(--sp-border);
        transition: box-shadow 0.25s, border-color 0.25s;
        height: 46px;
        max-width: 100%;
    }

    .sp-input-container:focus-within {
        border-color: var(--sp-blue);
        box-shadow: inset 0px 2px 4px rgba(0,0,0,0.5), 0 0 0 3px var(--sp-blue-dim);
    }

    .sp-input-icon {
        width: 40px;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--sp-label);
        font-size: 0.85rem;
        flex-shrink: 0;
    }
    .sp-input-container:focus-within .sp-input-icon { color: var(--sp-blue); }

    .sp-input {
        flex: 1;
        min-width: 0;
        width: 100%;
        height: 100%;
        padding: 0 16px 0 0;
        border: none;
        outline: none;
        background: transparent;
        font-family: 'Inter', sans-serif;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--sp-text);
    }
    .sp-input::placeholder { color: var(--sp-label); font-weight: 500; }

    .sp-input-group { margin-bottom: 1.1rem; }

    .sp-continue-btn {
        width: 100%;
        min-height: 46px;
        border: none;
        border-radius: 12px;
        background: linear-gradient(135deg, var(--sp-blue) 0%, var(--sp-blue-dark) 100%);
        color: #ffffff;
        font-size: 0.82rem;
        font-weight: 800;
        letter-spacing: 0.03em;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.55rem;
        cursor: pointer;
        transition: all 0.2s ease;
        box-shadow: 0 8px 20px var(--sp-blue-glow);
    }
    .sp-continue-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px var(--sp-blue-glow); }
    .sp-continue-btn:active { transform: translateY(0); }

    .sp-highlights-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.9rem;
        width: 100%;
        max-width: 760px;
    }
    @media (max-width: 720px) { .sp-highlights-grid { grid-template-columns: 1fr; } }

    .sp-highlight-card {
        display: flex;
        align-items: center;
        gap: 0.8rem;
        background: var(--sp-glass-soft);
        border: 1px solid var(--sp-border);
        border-radius: var(--sp-radius-md);
        padding: 0.9rem 1.05rem;
        backdrop-filter: blur(10px);
    }

    .sp-hl-icon-box {
        width: 40px; height: 40px; border-radius: 12px;
        display: flex; align-items: center; justify-content: center;
        font-size: 1rem; flex-shrink: 0;
    }
    .sp-hl-blue   { background: var(--sp-blue-dim);   color: #7cb2fc; }
    .sp-hl-green  { background: var(--sp-mint-dim);   color: #4ee2ad; }
    .sp-hl-orange { background: var(--sp-orange-dim); color: #ffab73; }

    .sp-hl-title { font-size: 0.8rem; font-weight: 800; color: var(--sp-text); margin-bottom: 0.1rem; }
    .sp-hl-desc { font-size: 0.7rem; font-weight: 500; color: var(--sp-muted); line-height: 1.4; white-space: normal; overflow-wrap: break-word; }

    .sp-select {
        width: 100%;
        min-height: 46px;
        background: var(--sp-lift);
        border: 1px solid var(--sp-border);
        border-radius: var(--sp-radius-sm);
        color: var(--sp-text);
        font-size: 0.83rem;
        font-weight: 600;
        padding: 0 1rem;
        outline: none;
        transition: border-color 0.2s, box-shadow 0.2s;
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 1rem center;
        background-size: 0.9em;
        padding-right: 2.5rem;
        cursor: pointer;
    }
    .sp-select:focus { border-color: var(--sp-blue); box-shadow: 0 0 0 3px var(--sp-blue-dim); }

    /* Results Header */
    .sp-student-hd { display: flex; align-items: center; justify-content: space-between; gap: 1.1rem; flex-wrap: wrap; width: 100%; }

    .sp-avatar-row { display: flex; align-items: center; gap: 0.9rem; min-width: 0; flex: 1; }
    .sp-avatar {
        width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
        background: linear-gradient(135deg, var(--sp-blue) 0%, var(--sp-blue-dark) 100%);
        display: flex; align-items: center; justify-content: center;
        color: #fff; font-size: 1.1rem;
        box-shadow: 0 8px 18px var(--sp-blue-glow);
    }

    .sp-back-btn {
        min-height: 42px;
        padding: 0 1.1rem;
        border: none;
        border-radius: var(--sp-radius-md);
        background: rgba(255,255,255,0.04);
        border: 1px solid var(--sp-border);
        color: var(--sp-text) !important;
        font-size: 0.78rem;
        font-weight: 700;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        cursor: pointer;
        transition: all 0.2s ease;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .sp-back-btn:hover { background: rgba(255,255,255,0.08); border-color: var(--sp-border-strong); transform: translateY(-1px); }

    /* Results Sub-Tabs */
    .sp-res-tabs {
        display: flex !important;
        flex-wrap: wrap !important;
        width: 100% !important;
        background: var(--sp-lift) !important;
        padding: 6px !important;
        border-radius: var(--sp-radius-md) !important;
        border: 1px solid var(--sp-border) !important;
        margin-bottom: 1.5rem !important;
        gap: 8px !important;
        box-sizing: border-box !important;
    }

    .sp-res-tab {
        flex: 1 1 calc(50% - 8px) !important;
        min-width: 130px !important;
        min-height: 44px !important;
        border: 1px solid transparent !important;
        border-radius: calc(var(--sp-radius-md) - 4px) !important;
        background: transparent !important;
        color: var(--sp-muted) !important;
        font-size: 0.76rem !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.03em !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
        cursor: pointer !important;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
        white-space: nowrap !important;
        padding: 0 0.5rem !important;
    }
    .sp-res-tab i { font-size: 0.9rem !important; flex-shrink: 0 !important; }
    .sp-res-tab:hover { color: var(--sp-text) !important; background: rgba(255,255,255,0.04) !important; }
    .sp-res-tab.is-active {
        color: #ffffff !important;
        background: linear-gradient(135deg, var(--sp-blue) 0%, var(--sp-blue-dark) 100%) !important;
        border-color: var(--sp-blue-glow) !important;
        box-shadow: 0 6px 16px var(--sp-blue-glow) !important;
    }

    @media (max-width: 420px) {
        .sp-res-tab { font-size: 0.68rem !important; }
        .sp-res-tab i { font-size: 0.8rem !important; }
    }

    .sp-filter-row { display: grid; grid-template-columns: 1fr; gap: 0.8rem; margin-bottom: 1.25rem; }
    @media (min-width: 560px) { .sp-filter-row { grid-template-columns: repeat(2, 1fr); } }

    /* Cards Grid */
    .sp-cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 1rem; }

    .sp-grade-card {
        background: var(--sp-lift);
        border: 1px solid var(--sp-border);
        border-radius: var(--sp-radius-md);
        padding: clamp(0.85rem, 2vw, 1.1rem);
        padding-left: clamp(1rem, 2.5vw, 1.25rem);
        position: relative;
        transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
        overflow: hidden;
        min-width: 0;
    }
    .sp-grade-card::before {
        content: '';
        position: absolute; left: 0; top: 0; bottom: 0; width: 3.5px;
        background: var(--sp-card-accent, var(--sp-border));
        border-radius: 3px 0 0 3px;
        transition: background 0.2s;
    }
    .sp-grade-card:hover { border-color: var(--sp-blue-glow); transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0,0,0,0.4); }
    .sp-grade-card--passed  { --sp-card-accent: var(--sp-mint); }
    .sp-grade-card--failed  { --sp-card-accent: var(--sp-rose); }
    .sp-grade-card--dropped { --sp-card-accent: var(--sp-amber); }

    /* ══ COLOR-CODED ACCORDION TOGGLE ══════════════════════════════
       Collapsed state shows the title plus a status dot and status
       badge, so the card can be read at a glance without opening it.
       Every colour comes from --sp-card-accent, set per card in JS. */
    .sp-card-accordion-header {
        cursor: pointer;
        user-select: none;
        display: flex;
        align-items: center;
        gap: 0.6rem;
        padding: 0.15rem 0;
        border-radius: 10px;
        outline: none;
    }
    .sp-card-accordion-header:hover .sp-card-subj { color: var(--sp-card-accent, var(--sp-text)); }
    .sp-card-accordion-header:hover .sp-acc-arrow-btn { transform: translateY(1px); }
    .sp-card-accordion-header:focus-visible { box-shadow: 0 0 0 2px var(--sp-acc-soft, var(--sp-blue)); }

    .sp-acc-dot {
        width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
        background: var(--sp-card-accent, var(--sp-label));
        box-shadow: 0 0 0 3px var(--sp-acc-dim, transparent);
    }

    .sp-card-accordion-header .sp-card-subj {
        margin-bottom: 0 !important;
        font-size: clamp(0.95rem, 3.6vw, 1.1rem);
        font-weight: 800;
        color: var(--sp-text);
        flex: 1;
        min-width: 0;
        line-height: 1.3;
        transition: color 0.2s ease;
        overflow-wrap: break-word;
    }

    .sp-acc-badge {
        font-size: 0.58rem;
        font-weight: 900;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        padding: 0.28rem 0.6rem;
        border-radius: var(--sp-radius-pill);
        border: 1px solid var(--sp-acc-soft, var(--sp-border));
        background: var(--sp-acc-dim, rgba(255,255,255,0.03));
        color: var(--sp-card-accent, var(--sp-muted));
        white-space: nowrap;
        flex-shrink: 0;
    }
    @media (max-width: 400px) { .sp-acc-badge { font-size: 0.52rem; padding: 0.24rem 0.45rem; } }

    .sp-acc-arrow-btn {
        width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
        display: inline-flex; align-items: center; justify-content: center;
        background: var(--sp-acc-dim, rgba(255,255,255,0.04));
        border: 1px solid var(--sp-acc-soft, var(--sp-border));
        transition: transform 0.2s ease, background 0.2s ease;
    }
    .sp-acc-arrow {
        transition: transform 0.28s ease;
        font-size: 0.7rem;
        color: var(--sp-card-accent, var(--sp-label));
    }
    .sp-grade-card.is-expanded .sp-acc-arrow { transform: rotate(180deg); }

    /* Smooth open/close without a fixed max-height guess */
    .sp-card-accordion-content {
        display: grid;
        grid-template-rows: 0fr;
        opacity: 0;
        margin-top: 0;
        padding-top: 0;
        border-top: 1px solid transparent;
        transition: grid-template-rows 0.3s ease, opacity 0.25s ease, margin-top 0.3s ease, padding-top 0.3s ease;
    }
    .sp-acc-inner { overflow: hidden; min-height: 0; }

    .sp-grade-card.is-expanded .sp-card-accordion-content {
        grid-template-rows: 1fr;
        opacity: 1;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top-color: var(--sp-border);
    }

    .sp-grade-card.is-expanded {
        background: var(--sp-lift-2);
        border-color: var(--sp-acc-soft, var(--sp-blue-glow));
        box-shadow: 0 16px 38px rgba(0,0,0,0.45);
    }
    .sp-grade-card.is-expanded::before { width: 4.5px; }

    @media (prefers-reduced-motion: reduce) {
        .sp-card-accordion-content, .sp-acc-arrow, .sp-acc-arrow-btn { transition: none !important; }
    }

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

    .sp-card-subj { font-size: clamp(1.02rem, 4vw, 1.2rem); font-weight: 900; color: var(--sp-text); line-height: 1.25; margin-bottom: 0.65rem; overflow-wrap: break-word; }

    .sp-card-pills { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.65rem; }
    .sp-pill {
        display: inline-flex; align-items: center; gap: 0.3rem;
        padding: 0.25rem 0.55rem; border-radius: var(--sp-radius-pill);
        border: 1px solid var(--sp-border); background: rgba(255,255,255,0.02);
        font-size: 0.64rem; font-weight: 700; color: var(--sp-muted); white-space: nowrap;
        max-width: 100%; overflow: hidden; text-overflow: ellipsis;
    }

    .sp-metric { background: var(--sp-lift-2); border: 1px solid var(--sp-border); border-radius: var(--sp-radius-sm); padding: clamp(0.5rem, 1.8vw, 0.75rem) clamp(0.6rem, 2vw, 0.8rem); min-width: 0; }
    .sp-metric-lbl { font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sp-label); margin-bottom: 0.3rem; }
    .sp-metric-val { font-size: clamp(1rem, 3.5vw, 1.2rem); font-weight: 900; color: var(--sp-text); line-height: 1; font-variant-numeric: tabular-nums; }

    .sp-sub-section { margin-top: 0.85rem; border-top: 1px solid var(--sp-border); padding-top: 0.65rem; }
    .sp-sub-section-title { font-size: 0.64rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sp-accent-soft); margin-bottom: 0.45rem; display: flex; align-items: center; gap: 0.35rem; }

    .sp-score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.35rem; }
    @media (max-width: 380px) { .sp-score-grid { grid-template-columns: repeat(2, 1fr); } }

    .sp-score-chip {
        background: var(--sp-lift-2); border: 1px solid var(--sp-border); border-radius: var(--sp-radius-sm);
        padding: 0.35rem 0.25rem; display: flex; flex-direction: column; align-items: center; text-align: center;
        min-width: 0; box-sizing: border-box; transition: all 0.2s ease;
    }
    .sp-score-chip-label { font-size: 0.58rem; font-weight: 800; color: var(--sp-muted); text-transform: uppercase; margin-bottom: 0.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; padding: 0 0.1rem; }
    .sp-score-chip-val { font-size: clamp(0.72rem, 2.6vw, 0.82rem); font-weight: 900; color: var(--sp-text); line-height: 1.1; }

    .sp-score-chip--failed, .sp-score-chip--noscore {
        background: #dc2626 !important; border-color: #b91c1c !important;
        box-shadow: 0 4px 14px rgba(220,38,38,0.28); transition: all 0.25s ease;
    }
    .sp-score-chip--failed * { color: var(--tk-score-danger, #b91c1c) !important; }
    .sp-score-chip--noscore * { color: var(--sp-text) !important; }
    .sp-score-chip--failed .sp-score-chip-label, .sp-score-chip--noscore .sp-score-chip-label { font-weight: 700 !important; }
    .sp-score-chip--failed .sp-score-chip-val, .sp-score-chip--noscore .sp-score-chip-val { font-weight: 800 !important; }

    .sp-chip-status-lbl { font-size: 0.56rem; font-weight: 800; display: block; margin-top: 3px; letter-spacing: 0.05em; color: #ffffff !important; }

    .sp-mat-card {
        background: var(--sp-lift); border: 1px solid var(--sp-border); border-radius: var(--sp-radius-md);
        padding: clamp(0.95rem, 3vw, 1.2rem); transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
        display: flex; flex-direction: column; gap: 0.7rem; min-width: 0;
    }
    .sp-mat-card:hover { border-color: var(--sp-blue-glow); transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0,0,0,0.4); }
    .sp-mat-title { font-size: 0.88rem; font-weight: 900; color: var(--sp-text); line-height: 1.25; overflow-wrap: break-word; }
    .sp-mat-desc { font-size: 0.74rem; line-height: 1.6; color: var(--sp-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }

    .sp-dl-btn {
        min-height: 40px; border: none; border-radius: var(--sp-radius-sm);
        background: linear-gradient(135deg, var(--sp-blue), var(--sp-blue-dark));
        color: #fff; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.03em;
        display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
        cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
        box-shadow: 0 8px 20px var(--sp-blue-glow);
        text-align: center;
    }
    .sp-dl-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px var(--sp-blue-glow); }

    .sp-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-bottom: 1.5rem; }
    @media (max-width: 560px) { .sp-stats-row { grid-template-columns: 1fr 1fr; } }
    @media (max-width: 380px) { .sp-stats-row { grid-template-columns: 1fr; } }
    .sp-stat-card { background: var(--sp-lift); border: 1px solid var(--sp-border); border-radius: var(--sp-radius-md); padding: 1.1rem 1.2rem; min-width: 0; }
    .sp-stat-label { font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--sp-label); margin-bottom: 0.4rem; }
    .sp-stat-val { font-size: clamp(1.2rem, 5vw, 1.5rem); font-weight: 900; color: var(--sp-text); font-variant-numeric: tabular-nums; line-height: 1; }

    .sp-tbl-shell { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--sp-border); border-radius: var(--sp-radius-md); background: var(--sp-lift); }
    .sp-tbl { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 640px; }
    .sp-tbl thead th {
        background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--sp-border);
        padding: 0.85rem 1.1rem; font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em;
        color: var(--sp-label); text-align: left; white-space: nowrap;
    }
    .sp-tbl tbody td { padding: 1rem 1.1rem; border-bottom: 1px solid var(--sp-border); vertical-align: middle; color: var(--sp-text); transition: background-color 0.25s ease; }
    .sp-tbl tbody tr:last-child td { border-bottom: none; }
    .sp-tbl tbody tr { transition: background-color 0.25s ease; }
    .sp-tbl tbody tr:hover { background-color: rgba(255,255,255,0.025); }

    .sp-row-published { background-color: rgba(16,185,129,0.03) !important; }
    .sp-row-published:hover { background-color: rgba(16,185,129,0.06) !important; }
    .sp-td-published { background-color: rgba(16,185,129,0.08) !important; border-left: 3px solid var(--sp-mint) !important; }

    .sp-class-name { font-size: 0.85rem; font-weight: 800; color: var(--sp-text); line-height: 1.2; }
    .sp-class-sub { font-size: 0.7rem; font-weight: 600; color: var(--sp-muted); margin-top: 0.2rem; }

    .sp-section-pill {
        display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.7rem;
        border-radius: var(--sp-radius-pill); background: var(--sp-blue-dim); border: 1px solid var(--sp-blue-glow);
        color: var(--sp-accent-soft); font-size: 0.68rem; font-weight: 800; white-space: nowrap;
    }

    .sp-code-chip {
        display: inline-flex; align-items: center; padding: 0.25rem 0.7rem; border-radius: var(--sp-radius-pill);
        background: rgba(255,255,255,0.03); border: 1px solid var(--sp-border); color: var(--sp-text);
        font-size: 0.7rem; font-weight: 800; font-family: ui-monospace, 'Cascadia Code', 'Fira Code', monospace; white-space: nowrap;
    }

    .sp-term-text { font-size: 0.78rem; font-weight: 700; color: var(--sp-text); }
    .sp-term-sub { font-size: 0.68rem; font-weight: 600; color: var(--sp-muted); margin-top: 0.15rem; }

    .sp-pub-btn {
        min-height: 34px; padding: 0 0.9rem; border-radius: var(--sp-radius-pill);
        border: 1px solid var(--sp-border); background: rgba(255,255,255,0.03); color: var(--sp-muted);
        font-size: 0.68rem; font-weight: 800; display: inline-flex; align-items: center; gap: 0.45rem;
        cursor: pointer; transition: all 0.2s; white-space: nowrap;
    }
    .sp-pub-btn.is-on { color: var(--sp-mint); background: var(--sp-mint-dim); border-color: rgba(16,185,129,0.3); }
    .sp-pub-btn:hover { transform: translateY(-1px); border-color: var(--sp-blue); color: var(--sp-text); }

    .sp-empty { text-align: center; padding: 3rem 1rem; color: var(--sp-muted); grid-column: 1 / -1; }
    .sp-empty-icon {
        width: 48px; height: 48px; border-radius: 16px; background: var(--sp-blue-dim); color: #7cb2fc;
        display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; margin: 0 auto 0.85rem;
    }
    .sp-empty-text { font-size: 0.8rem; font-weight: 700; line-height: 1.5; color: var(--sp-muted); }

    #toast {
        background: var(--sp-glass-solid) !important;
        color: var(--sp-text) !important;
        border: 1px solid var(--sp-border) !important;
        backdrop-filter: blur(12px);
        font-size: 0.75rem !important;
        font-weight: 700 !important;
        letter-spacing: 0.02em;
        box-shadow: var(--sp-shadow) !important;
        max-width: calc(100vw - 2rem);
    }

    @media (max-width: 480px) {
        #toast { left: 1rem; right: 1rem; bottom: 1rem; }
    }

    .sp-mb4 { margin-bottom: 1rem; }
    .sp-mt4 { margin-top: 1rem; }
    .sp-tr  { text-align: right; }

    @media (prefers-reduced-motion: reduce) {
        .sp-grade-card, .sp-mat-card { animation: none !important; transition: none !important; }
    }

    /* Small-screen structural fixes */
    @media (max-width: 640px) {
        .sp-hero-section { padding: 0.5rem 0.25rem; }
        .sp-access-card { padding: 1.4rem 1.1rem; }
        .sp-student-hd { justify-content: flex-start; }
        .sp-avatar-row { width: 100%; }
        .sp-back-btn { width: 100%; }
        .sp-panel-body { overflow-x: hidden; }
    }

    @media (max-width: 380px) {
        .sp-page { padding-left: 0.5rem; padding-right: 0.5rem; }
        .sp-hero-pillbar { gap: 8px; padding: 8px 12px; }
    }
    
/* ══════════════════════════════════════════════════════════════════════════
   PORTAL HERO — v2.2, matched to the redesigned sign-in page.
   Same curved accent glow, same logo treatment, same type scale, so the two
   pages read as one product. Existing .sp-* classes below are untouched.
   ══════════════════════════════════════════════════════════════════════════ */
.sp-hero-section{
  position:relative; overflow:hidden;
  border-radius:22px; padding:32px 34px; margin-bottom:1.25rem;
  border:1px solid var(--sp-border);
  background:
    radial-gradient(110% 130% at 4% 0%, color-mix(in srgb, var(--sp-blue,#1b6bf5) 55%, #000 45%) 0%, transparent 60%),
    linear-gradient(150deg, color-mix(in srgb, var(--sp-blue,#1b6bf5) 34%, #0b1020) 0%, #0b1020 70%);
  text-align:left;
}
@supports not (color: color-mix(in srgb, red 50%, blue)){
  .sp-hero-section{ background:linear-gradient(150deg,#14306b 0%,#0b1020 70%); }
}
.sp-hero-section::after{
  content:""; position:absolute; top:-30%; right:-8%; width:46%; height:170%;
  border-left:1px solid rgba(255,255,255,.10);
  border-radius:50% 0 0 50%; pointer-events:none;
}
.sp-hero-section > *{ position:relative; z-index:1; }
.sp-hero-logo-row{ display:flex; align-items:center; gap:16px; flex-wrap:wrap; margin-bottom:14px; }
/* Logo carries the wordmark already, so it is shown on its own plate. */
.sp-portal-logo{
  height:64px; width:auto; object-fit:contain;
  background:rgba(255,255,255,.96); border-radius:14px; padding:7px 12px;
  box-shadow:0 8px 24px -8px rgba(0,0,0,.45);
}
.sp-hero-main-title{
  font-size:clamp(1.7rem,3.2vw,2.5rem); font-weight:900;
  letter-spacing:-.03em; line-height:1.06; color:#fff; margin:0;
}
/* "Student Portal" was hard-coded #38bdf8 + #f97316 (blue + orange) with a
   gradient text-fill, so the title stayed blue-and-orange no matter which
   accent was chosen. It now tracks the accent. */
.sp-hero-main-title .accent-a{
  color:#fff !important;
  background:none !important;
  -webkit-text-fill-color:#fff !important;
}
.sp-hero-main-title .accent-b{
  color:color-mix(in srgb, var(--sp-blue,#1b6bf5) 42%, #fff) !important;
  background:none !important;
  -webkit-text-fill-color:color-mix(in srgb, var(--sp-blue,#1b6bf5) 42%, #fff) !important;
}
@supports not (color: color-mix(in srgb, red 50%, blue)){
  .sp-hero-main-title .accent-b{
    color:var(--sp-blue,#1b6bf5) !important;
    -webkit-text-fill-color:var(--sp-blue,#1b6bf5) !important;
  }
}
.sp-hero-subtitle{
  font-size:.92rem; line-height:1.65; font-weight:500;
  color:rgba(255,255,255,.85); max-width:60ch;
  /* Centred to match the logo and title above it, which are centred. */
  margin:0 auto; text-align:center;
}
.sp-hero-logo-row{ justify-content:center; }
.sp-hero-section{ text-align:center; }
.sp-hero-pillbar{ margin-left:auto; margin-right:auto; }
.sp-hero-pillbar{
  display:inline-flex; align-items:center; gap:12px; flex-wrap:wrap;
  margin-bottom:18px; padding:7px 15px; border-radius:99px;
  background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.14);
}
.sp-hero-pillbar .header-desc-text{ color:rgba(255,255,255,.72) !important; }
/* The four colour dashes are superseded by the shared Appearance panel
   (bottom-right, on every page), so the duplicate control is hidden rather
   than deleted — the pickPortalTheme() handlers stay bound and working. */
.sp-theme-picker{ display:none !important; }

@media (max-width:640px){
  .sp-hero-section{ padding:24px 20px; border-radius:18px; }
  .sp-portal-logo{ height:52px; }
  .sp-hero-main-title{ font-size:1.55rem; }
}


/* ── INPUT FIXES (v2.2) ────────────────────────────────────────────────────
   1. Left padding: the field had `padding:0 16px 0 0`, so typed text started
      hard against the leading icon with no breathing room.
   2. The white box was Chrome's autofill styling, not our CSS. Chrome paints
      autofilled inputs with its own background and ignores `background`, so
      it has to be overridden with a large inset shadow plus an explicit
      text-fill colour. Without this, an autofilled email showed as dark text
      on a white block inside an otherwise dark field. */
.sp-input, .neu-input, .tk-hex {
    padding-left: 12px !important;
    text-indent: 2px;
}
.sp-input:-webkit-autofill,
.sp-input:-webkit-autofill:hover,
.sp-input:-webkit-autofill:focus,
.sp-input:-webkit-autofill:active,
.neu-input:-webkit-autofill,
.neu-input:-webkit-autofill:hover,
.neu-input:-webkit-autofill:focus,
.neu-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
    box-shadow: 0 0 0 1000px transparent inset !important;
    -webkit-text-fill-color: var(--sp-text, var(--text-main, #eef2fb)) !important;
    caret-color: var(--sp-text, var(--text-main, #eef2fb));
    transition: background-color 9999s ease-in-out 0s !important;
}


/* ═══════════════════════════════════════════════════════════════════════════
   PORTAL SIGN-IN REDESIGN (mockup v2)

   A pure styling layer over the existing markup. Nothing here changes the
   theming system: applyPortalTheme(), pickPortalTheme(), SP_THEMES, the
   tkRepaintPortal hook and the shared Appearance panel (tk_ui.php) are all
   untouched, and every colour below is derived from --sp-blue / --sp-text so
   it follows whatever accent and mode the user has chosen.

   The signed-in results markup is also left alone.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── HERO ────────────────────────────────────────────────────────────────── */
.sp-hero-section{
  border-radius: 24px;
  padding: clamp(1.5rem, 3vw, 1.9rem) clamp(1.2rem, 3vw, 2.1rem);
}
.sp-hero-pillbar{
  padding: 5px 13px;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.2);
  font-size: .62rem; letter-spacing: .09em; text-transform: uppercase; font-weight: 800;
}
@media (min-width: 860px){
  /* Logo sits beside the title rather than stacked above it, which reclaims
     roughly a third of the hero height. The row itself stays centred. */
  .sp-hero-logo-row{ gap: 1.35rem; }
  .sp-hero-subtitle{ margin-top: .55rem !important; }
}
.sp-portal-logo{ border-radius: 15px; }

/* ── TABS: segmented control ─────────────────────────────────────────────── */
.sp-tabs{
  display: inline-flex !important;
  gap: 4px; padding: 5px; border-radius: 14px;
  background: color-mix(in srgb, var(--sp-text) 7%, transparent);
  border: 1px solid var(--sp-border);
  width: auto !important;
}
.sp-tab-btn{
  border-radius: 10px !important;
  padding: 10px 18px !important;
  font-size: .78rem; font-weight: 800; letter-spacing: .02em;
  border: 0 !important; background: transparent !important;
  color: var(--sp-label) !important;
}
.sp-tab-btn:hover{ color: var(--sp-text) !important; }
.sp-tab-btn.is-active, .sp-tab-btn.active, .sp-tab-btn[aria-selected="true"]{
  background: var(--sp-blue) !important;
  color: #fff !important;
  box-shadow: 0 6px 16px -6px var(--sp-blue-glow);
}

/* ── SIGN-IN CARD ────────────────────────────────────────────────────────── */
.sp-access-card{
  border-radius: 18px;
  padding: clamp(1.35rem, 3vw, 1.7rem) !important;
  border: 1px solid var(--sp-border);
  text-align: left;
}
.sp-access-header{ text-align: left; }
.sp-access-kicker{
  /* Was --sp-accent-soft (a fixed pale amber) on a 10% accent tint: amber on
     green in light mode, amber on navy in dark. Both now come from the accent
     and clear AA on every colour in both modes. */
  color: color-mix(in srgb, var(--sp-blue, #1b6bf5) 70%, var(--sp-text)) !important;
  background: color-mix(in srgb, var(--sp-blue, #1b6bf5) 13%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--sp-blue, #1b6bf5) 32%, transparent);
  letter-spacing: .085em; text-transform: uppercase; font-weight: 800;
  padding: .35rem .8rem;
}
.sp-access-title{
  font-size: 1.3rem !important; font-weight: 900; letter-spacing: -.02em;
  margin: .8rem 0 .35rem !important;
}
.sp-access-subtitle{ font-size: .84rem; line-height: 1.6; font-weight: 500; }

.sp-field-label{
  font-size: .68rem !important; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; margin-bottom: .45rem !important;
}
.sp-input-container{
  border-radius: 13px !important;
  background: color-mix(in srgb, var(--sp-text) 5%, transparent) !important;
  min-height: 50px;
}
.sp-input-container:focus-within{
  border-color: var(--sp-blue, #1b6bf5) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-blue, #1b6bf5) 18%, transparent);
}
.sp-input{ font-size: .9rem !important; font-weight: 600; }

.sp-continue-btn{
  border-radius: 13px !important;
  min-height: 50px;
  font-size: .92rem !important;
  /* Single solid accent. The old gradient ran --sp-blue -> --sp-blue-dark,
     and --sp-blue-dark came from a PRESET rather than the chosen colour, so it
     rendered blue-to-brown / teal-to-brown for every accent. */
  background: var(--sp-blue) !important;
  box-shadow: 0 10px 24px -10px var(--sp-blue-glow) !important;
  transition: transform .15s ease, filter .15s ease;
}
.sp-continue-btn:hover{ transform: translateY(-2px); filter: brightness(1.07); }

/* ── FEATURE CARDS ───────────────────────────────────────────────────────── */
.sp-highlight-card{
  display: flex; align-items: flex-start; gap: .85rem;
  padding: .95rem 1rem !important;
  border-radius: 14px !important;
  border: 1px solid var(--sp-border);
  transition: border-color .15s ease, transform .15s ease;
  text-align: left;
}
.sp-highlight-card:hover{
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--sp-blue, #1b6bf5) 45%, var(--sp-border));
}
.sp-hl-icon-box{
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-size: .9rem;
}
.sp-hl-title{ font-size: .86rem !important; font-weight: 800; margin: 0 !important; }
.sp-hl-desc{ font-size: .75rem !important; line-height: 1.5; margin: .2rem 0 0 !important; font-weight: 500; }

/* ── TWO-COLUMN SIGN-IN ──────────────────────────────────────────────────── */
@media (min-width: 900px){
  /* Two columns, both flush to the SAME top edge.
     .sp-access-wrap is a centred flex column by default, so the form card and
     the feature cards were stacked and centre-aligned - the cards began below
     the form instead of beside it. align-items/align-self are both pinned to
     start, and every stray margin is zeroed, so the first feature card lines
     up exactly with the top of the form card. */
  .sp-access-wrap{
    display: grid !important;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    gap: 1.5rem;
    align-items: start !important;
    justify-items: stretch !important;
    max-width: 1010px;
    margin: 0 auto !important;
    width: 100%;
  }
  .sp-access-wrap > *{
    align-self: start !important;
    margin-top: 0 !important;
  }
  .sp-access-card{
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }
  .sp-highlights-grid{
    display: flex !important;
    flex-direction: column;
    gap: .75rem;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }
  .sp-highlight-card{ width: 100% !important; margin: 0 !important; }
}

/* ── SIGNED-IN POLISH (styling only; markup untouched) ───────────────────── */
.sp-stat-card, .sp-metric{ border-radius: 15px !important; }
.sp-grade-card, .sp-mat-card{
  border-radius: 15px !important;
  transition: border-color .15s ease, transform .15s ease;
}
.sp-grade-card:hover, .sp-mat-card:hover{
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--sp-blue, #1b6bf5) 40%, var(--sp-border));
}
.sp-res-tab{ border-radius: 11px !important; font-weight: 700; }
.sp-res-tab.is-active, .sp-res-tab.active{
  background: color-mix(in srgb, var(--sp-blue, #1b6bf5) 12%, transparent) !important;
  border-color: var(--sp-blue, #1b6bf5) !important;
  color: var(--sp-blue, #1b6bf5) !important;
}

@supports not (color: color-mix(in srgb, red 50%, blue)){
  .sp-access-kicker{ color: var(--sp-text) !important; background: rgba(128,128,128,.16) !important; }
  .sp-tabs{ background: rgba(128,128,128,.12); }
}

/* ═══ HERO ALIGNMENT FIX ════════════════════════════════════════════════════
   .sp-hero-section is a flex COLUMN with align-items:center, so each child
   was centred as its own block. Setting justify-content on the logo row only
   moved items inside that row - the row itself stayed centred, which is why
   the READY pill sat hard left while the logo, title and subtitle floated in
   the middle. The section's cross-axis alignment has to change too. */
/* Hero stays CENTRED. An earlier pass left-aligned it, which put the READY
   pill, the logo/title and the subtitle on three different edges. Centring
   every child on one axis is the consistent option. */
.sp-hero-section{
  align-items: center !important;
  text-align: center !important;
}
.sp-hero-logo-row{
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}
.sp-hero-main-title{ text-align: center !important; }
.sp-hero-subtitle{
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.sp-hero-pillbar{ margin-left: auto !important; margin-right: auto !important; }

/* ═══ INSTRUCTOR CONFIG — SUBJECT GROUPS ════════════════════════════════════
   Colour comes from --gh (a hue set inline per subject), so each subject is
   distinct while still following the light/dark surface tokens. */
.sp-group-head > td{ padding: 0 !important; border: 0 !important; }
.sp-group-btn{
  width: 100%; display: flex; align-items: center; gap: .7rem;
  padding: .8rem 1rem; cursor: pointer; font-family: inherit; text-align: left;
  background: hsla(var(--gh, 205), 65%, 50%, .10);
  border: 0; border-left: 3px solid hsl(var(--gh, 205), 65%, 52%);
  color: var(--sp-text); transition: background .15s ease;
}
.sp-group-btn:hover{ background: hsla(var(--gh, 205), 65%, 50%, .18); }
.sp-group-caret{
  width: 18px; flex-shrink: 0; font-size: .7rem;
  color: hsl(var(--gh, 205), 65%, 58%);
  transition: transform .18s ease;
}
.sp-group-btn[aria-expanded="true"] .sp-group-caret{ transform: rotate(90deg); }
.sp-group-dot{
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: hsl(var(--gh, 205), 65%, 52%);
  box-shadow: 0 0 0 3px hsla(var(--gh, 205), 65%, 52%, .22);
}
.sp-group-name{
  font-size: .84rem; font-weight: 800; letter-spacing: .01em;
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-group-meta{
  font-size: .68rem; font-weight: 700; color: var(--sp-label);
  white-space: nowrap; flex-shrink: 0;
}
/* Child rows carry a matching tint so it stays obvious which group they
   belong to once several are expanded at once. */
tr.sp-group-row > td:first-child{
  border-left: 3px solid hsla(var(--gh, 205), 65%, 52%, .5);
}
tr.sp-group-row:hover > td{ background: hsla(var(--gh, 205), 65%, 50%, .07); }

@media (max-width: 640px){
  .sp-group-meta{ display: none; }
  .sp-group-btn{ padding: .7rem .8rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PORTAL SIGN-IN — REFERENCE LAYOUT (v2.3)

   Top nav → wide gradient hero → two columns (sign-in card | three feature
   cards) → footer strip.

   Every colour still resolves through --sp-blue / --sp-text / --sp-border, so
   the Appearance picker, the four accent dashes and light/dark mode keep
   working exactly as before. Nothing here touches the signed-in results view.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── TOP NAV ─────────────────────────────────────────────────────────────── */
/* .sp-page is a flex column with its own gap, so these blocks carry no
   bottom margin of their own — doubling the two is what left a dead band
   between the banner and the sign-in card. */
.tk-pnav{
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  width: 100%; max-width: 1180px; margin: 0 auto;
  padding: .55rem .25rem;
}
.sp-page{ gap: 1.25rem !important; }
.tk-pnav-brand{
  display: flex; align-items: center; gap: .7rem;
  text-decoration: none; color: inherit; margin-right: auto; min-width: 0;
}
.tk-pnav-logo{
  width: 46px; height: 46px; border-radius: 12px; object-fit: contain; flex-shrink: 0;
}
.tk-pnav-word{ display: flex; flex-direction: column; min-width: 0; }
.tk-pnav-name{
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  font-weight: 900; letter-spacing: -.025em; line-height: 1;
  color: var(--sp-text);
}
.tk-pnav-tag{
  font-size: .56rem; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; color: var(--sp-label); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tk-pnav-links{ display: flex; align-items: center; gap: .35rem; }
.tk-pnav-links a,
.tk-pnav-links button{
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem .8rem; border-radius: 10px;
  font-family: inherit; font-size: .82rem; font-weight: 700;
  color: var(--sp-muted); background: transparent; border: 0;
  text-decoration: none; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tk-pnav-links a i,
.tk-pnav-links button i{ color: var(--sp-blue, #1b6bf5); font-size: .85rem; }
.tk-pnav-links a:hover,
.tk-pnav-links button:hover{
  color: var(--sp-text);
  background: color-mix(in srgb, var(--sp-blue, #1b6bf5) 12%, transparent);
}
.tk-pnav-right{ display: flex; align-items: center; gap: .75rem; }
.tk-pnav-cta{
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.25rem; border-radius: 999px; border: 0; cursor: pointer;
  font-family: inherit; font-size: .84rem; font-weight: 800; color: #fff;
  background: linear-gradient(100deg,
              color-mix(in srgb, var(--sp-blue, #1b6bf5) 45%, #7c4ddb),
              var(--sp-blue, #1b6bf5));
  box-shadow: 0 10px 24px -10px var(--sp-blue-glow, rgba(27,107,245,.6));
  transition: transform .15s ease, filter .15s ease;
  white-space: nowrap;
}
.tk-pnav-cta:hover{ transform: translateY(-1px); filter: brightness(1.08); }

/* The theme dashes now live in the nav bar. Handlers and IDs are unchanged. */
.tk-pnav-right .sp-theme-picker{ margin: 0 !important; }
@media (max-width: 1040px){ .tk-pnav-right .sp-theme-picker{ display: none; } }

/* ── HERO BANNER ─────────────────────────────────────────────────────────── */
.sp-hero-section{
  position: relative; overflow: hidden;
  width: 100%; max-width: 1180px; margin: 0 auto;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between;
  gap: 1.5rem;
  text-align: left !important;
  padding: clamp(1.4rem, 3.2vw, 2.2rem) clamp(1.3rem, 3.5vw, 2.6rem);
  border-radius: 20px;
  background:
    radial-gradient(120% 150% at 88% 30%,
      color-mix(in srgb, var(--sp-blue, #1b6bf5) 78%, #7c4ddb) 0%,
      transparent 58%),
    linear-gradient(105deg,
      color-mix(in srgb, var(--sp-blue, #1b6bf5) 62%, #0b1638) 0%,
      color-mix(in srgb, var(--sp-blue, #1b6bf5) 55%, #4c2bb8) 55%,
      color-mix(in srgb, var(--sp-blue, #1b6bf5) 70%, #6d3ce0) 100%);
  box-shadow: 0 22px 48px -26px rgba(12,20,60,.75);
}
/* Soft wave, drawn with a second layer so it reads on any accent. */
.sp-hero-section::before{
  content:""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(60% 120% at 12% 120%, rgba(255,255,255,.14), transparent 60%),
    radial-gradient(45% 90% at 60% -20%, rgba(255,255,255,.12), transparent 65%);
}
.tk-hero-copy{
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: clamp(.8rem, 2vw, 1.4rem);
  min-width: 0;
}
.tk-hero-rule{
  width: 2px; align-self: stretch; min-height: 96px; flex-shrink: 0;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.55), transparent);
  border-radius: 2px;
}
.tk-hero-text{ min-width: 0; }
.tk-hero-eyebrow{
  display: block; font-size: clamp(.82rem, 1.6vw, 1rem);
  font-weight: 600; color: rgba(255,255,255,.88); margin-bottom: .1rem;
}
/* The logo file has a white plate behind it, so it is given a rounded card
   treatment rather than being left as a hard white square on the gradient. */
.sp-hero-section .sp-portal-logo{
  width: clamp(62px, 8vw, 92px); height: auto; flex-shrink: 0;
  border-radius: 18px;
  box-shadow: 0 10px 26px -12px rgba(0,0,0,.55);
}
.sp-hero-section .sp-hero-main-title{
  text-align: left !important;
  font-size: clamp(1.75rem, 4.4vw, 3.1rem) !important;
  font-weight: 900; line-height: 1.04; letter-spacing: -.03em;
  margin: 0 0 .5rem !important;
}
.sp-hero-section .sp-hero-main-title .accent-a{
  color: #fff !important; background: none !important;
  -webkit-text-fill-color: #fff !important;
}
.sp-hero-section .sp-hero-main-title .accent-b{
  color: #c6b4ff !important; background: none !important;
  -webkit-text-fill-color: #c6b4ff !important;
}
.sp-hero-section .sp-hero-subtitle{
  text-align: left !important; margin: 0 !important;
  max-width: 46ch;
  font-size: clamp(.82rem, 1.5vw, .96rem); line-height: 1.55;
  font-weight: 500; color: rgba(255,255,255,.9) !important;
}
.tk-hero-art{
  position: relative; z-index: 1; flex-shrink: 0;
  width: clamp(230px, 32vw, 380px);
}
.tk-hero-art svg{ width: 100%; height: auto; display: block; }

@media (max-width: 860px){
  .sp-hero-section{ flex-direction: column !important; align-items: flex-start !important; }
  .tk-hero-art{ width: 100%; max-width: 340px; margin: .4rem auto 0; }
  .tk-hero-rule{ min-height: 72px; }
}
@media (max-width: 560px){
  .tk-hero-copy{ gap: .75rem; }
  .tk-hero-rule{ display: none; }
  .sp-hero-section .sp-hero-subtitle{ max-width: none; }
  .sp-hero-section .sp-hero-subtitle br,
  .sp-hero-section .sp-hero-main-title br{ display: none; }
  .tk-pnav{ gap: .6rem; }
  .tk-pnav-links{ order: 3; width: 100%; justify-content: center; }
  .tk-pnav-links a span, .tk-pnav-links button span{ font-size: .78rem; }
}

/* ── SIGN-IN CARD ────────────────────────────────────────────────────────── */
.tk-grad-word{
  background: linear-gradient(95deg,
              color-mix(in srgb, var(--sp-blue, #1b6bf5) 55%, #8b5cf6),
              var(--sp-blue, #1b6bf5));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.sp-access-card .sp-access-title{
  font-size: clamp(1.45rem, 3vw, 1.95rem) !important;
  letter-spacing: -.03em;
}
.sp-access-card .sp-access-kicker{
  border-radius: 999px;
  font-size: .66rem;
}

.tk-access-chips{
  display: flex; align-items: center; justify-content: center;
  gap: .55rem; flex-wrap: wrap;
  margin-top: 1.15rem; padding-top: 1.05rem;
  border-top: 1px solid var(--sp-border);
}
.tk-chip-item{
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .8rem; font-weight: 800; color: var(--sp-text);
  white-space: nowrap;
}
.tk-chip-ico{
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; font-size: .78rem; color: #fff;
}
.tk-ci-violet{ background: linear-gradient(140deg,#a855f7,#7c3aed); }
.tk-ci-green { background: linear-gradient(140deg,#34d399,#0f9f6e); }
.tk-ci-blue  { background: linear-gradient(140deg,#60a5fa,#2563eb); }
.tk-chip-sep{
  width: 1px; height: 22px; flex-shrink: 0;
  background: var(--sp-border);
}
.tk-access-note{
  display: flex; align-items: center; gap: .45rem;
  margin: .95rem 0 0; font-size: .72rem; font-weight: 600;
  color: var(--sp-label);
}
.tk-access-note i{ font-size: .78rem; }

@media (max-width: 420px){
  .tk-chip-sep{ display: none; }
  .tk-access-chips{ gap: .8rem 1.1rem; }
}

/* ── FEATURE CARDS (right column) ────────────────────────────────────────── */
.sp-highlights-grid .sp-highlight-card{
  display: flex !important;
  align-items: center !important;
  gap: 1rem;
  width: 100%;
  padding: 1.05rem 1.15rem !important;
  border-radius: 16px !important;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  background: var(--sp-glass);
  border: 1px solid var(--sp-border);
}
/* Solid gradient tiles, one colour per section, matching the sign-in chips.
   The previous *-dim tokens rendered as near-black plates in dark mode and
   the glyph inside them all but disappeared. */
.sp-highlights-grid .sp-hl-icon-box{
  width: 52px; height: 52px; border-radius: 15px; font-size: 1.2rem;
  color: #fff !important;
}
.sp-highlights-grid .sp-hl-blue  { background: linear-gradient(140deg,#a855f7,#7c3aed) !important; }
.sp-highlights-grid .sp-hl-green { background: linear-gradient(140deg,#34d399,#0f9f6e) !important; }
.sp-highlights-grid .sp-hl-orange{ background: linear-gradient(140deg,#60a5fa,#2563eb) !important; }
.sp-hl-body{ flex: 1; min-width: 0; }
.sp-highlights-grid .sp-hl-title{
  font-size: 1.02rem !important; font-weight: 900; letter-spacing: -.015em;
  color: var(--sp-text);
}
.sp-highlights-grid .sp-hl-desc{
  font-size: .8rem !important; color: var(--sp-muted); margin-top: .22rem !important;
}
.sp-hl-chev{
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  border: 1px solid color-mix(in srgb, var(--sp-text) 22%, transparent);
  background: color-mix(in srgb, var(--sp-text) 6%, transparent);
  color: var(--sp-muted); font-size: .68rem;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.sp-highlight-card:hover .sp-hl-chev{
  background: var(--sp-blue, #1b6bf5); border-color: var(--sp-blue, #1b6bf5); color: #fff;
}
@media (max-width: 520px){
  .sp-highlights-grid .sp-hl-desc br{ display: none; }
}

/* ── FOOTER STRIP ────────────────────────────────────────────────────────── */
.tk-pfoot{
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem 1.25rem;
  width: 100%; max-width: 1180px; margin: 2rem auto .5rem;
  padding: 1.05rem .3rem 0;
  border-top: 1px solid var(--sp-border);
}
.tk-pfoot-left{ display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; min-width: 0; }
.tk-pfoot-mark{
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-size: .72rem; color: #fff;
  background: linear-gradient(140deg,
              color-mix(in srgb, var(--sp-blue, #1b6bf5) 60%, #8b5cf6),
              var(--sp-blue, #1b6bf5));
}
.tk-pfoot-name{ font-size: .92rem; font-weight: 900; color: var(--sp-text); }
.tk-pfoot-bar{ width: 1px; height: 16px; background: var(--sp-border); }
.tk-pfoot-line{ font-size: .78rem; font-weight: 600; color: var(--sp-muted); }
.tk-pfoot-right{
  display: flex; align-items: center; gap: .45rem;
  font-size: .76rem; font-weight: 700; color: var(--sp-label);
}
.tk-pfoot-dots{ display: inline-flex; gap: 5px; margin-right: .4rem; }
.tk-pfoot-dots i{
  width: 5px; height: 5px; border-radius: 50%;
  background: color-mix(in srgb, var(--sp-blue, #1b6bf5) 45%, var(--sp-border));
}
.tk-pfoot-dot{ opacity: .55; }

/* Brief highlight when the nav button or a feature card sends the user here,
   so it is obvious which field they were taken to. */
.sp-access-card.tk-card-ping{
  animation: tkCardPing .9s ease;
}
@keyframes tkCardPing{
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--sp-blue, #1b6bf5) 55%, transparent); }
  60%  { box-shadow: 0 0 0 7px color-mix(in srgb, var(--sp-blue, #1b6bf5) 0%, transparent); }
  100% { box-shadow: var(--sp-shadow-sm, 0 8px 24px -12px rgba(0,0,0,.4)); }
}
@media (prefers-reduced-motion: reduce){
  .sp-access-card.tk-card-ping{ animation: none; }
  .tk-pnav-cta:hover, .sp-continue-btn:hover, .sp-highlight-card:hover{ transform: none; }
}

/* Older engines without color-mix still get a readable, on-brand page. */
@supports not (color: color-mix(in srgb, red 50%, blue)){
  .sp-hero-section{ background: linear-gradient(105deg, #1e3a8a, #4c2bb8 55%, #6d3ce0); }
  .tk-pnav-cta{ background: #4f46e5; }
  .tk-grad-word{ -webkit-text-fill-color: currentColor; color: var(--sp-blue, #1b6bf5); }
}
/* Submission feedback uses the full card width at every screen size. */
.sp-grade-card .sp-submission-result {
    display: grid;
    gap: 14px;
    min-width: 0;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--sp-border);
}
.sp-grade-card .sp-submission-score {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
    text-align: start;
}
.sp-grade-card .sp-submission-label {
    font-size: 12px;
    font-weight: 650;
    line-height: 1.4;
    color: var(--sp-label);
}
.sp-grade-card .sp-submission-score strong {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--sp-mint);
}
.sp-grade-card .sp-submission-score small {
    font-size: 14px;
    font-weight: 600;
    color: var(--sp-muted);
}
.sp-grade-card .sp-submission-feedback {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    background: var(--sp-surface);
    text-align: start;
}
.sp-grade-card .sp-submission-feedback h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
    color: var(--sp-text);
}
.sp-grade-card .sp-submission-feedback h4 svg {
    width: 18px;
    height: 18px;
    flex: none;
    color: var(--sp-muted);
}
.sp-grade-card .sp-feedback-text {
    margin: 0;
    font-size: 16px;
    font-weight: 400;
    font-style: normal;
    line-height: 1.65;
    color: var(--sp-text);
    text-align: start;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: normal;
}
