/* ============================================================
   Student Portal — front-end design system (v1.5 clarity pass)
   ============================================================ */
.sp-page {
    --sp-primary: #185abd;
    --sp-primary-dark: #0b2f63;
    --sp-primary-bright: #3b82f6;
    --sp-accent: #16a34a;
    --sp-ink: #0f1722;
    --sp-muted: #52607a;
    --sp-line: #dde5ef;
    --sp-bg-soft: #f3f7fc;
    --sp-radius: 16px;
    --sp-shadow-sm: 0 1px 3px rgba(11, 47, 99, .08);
    --sp-shadow: 0 4px 18px rgba(11, 47, 99, .09), 0 16px 40px rgba(11, 47, 99, .07);
    color: var(--sp-ink);
    font-size: 16.5px;
    line-height: 1.65;
    max-width: 1160px;
    margin: 0 auto;
    padding: 26px 20px 72px;
    -webkit-font-smoothing: antialiased;
}
.sp-page ::selection { background: #bcd4f5; color: #0b2f63; }

/* ---------- Hero (v1.5: frosted panel, guaranteed-clean text) ---------- */
.sp-hero {
    position: relative;
    background: linear-gradient(128deg, #0b2f63 0%, #185abd 52%, #3b82f6 100%);
    border-radius: 20px;
    padding: 46px 44px;
    margin-bottom: 30px;
    box-shadow: var(--sp-shadow);
    overflow: hidden;
}
.sp-hero::before {
    content: '';
    position: absolute; inset: 0;
    background:
        radial-gradient(620px 260px at 88% -20%, rgba(255,255,255,.22), transparent 60%),
        radial-gradient(420px 220px at -8% 110%, rgba(255,255,255,.12), transparent 60%);
    pointer-events: none;
}
.sp-hero-inner {
    position: relative;
    max-width: 780px;
    background: rgba(8, 30, 66, .34);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 16px;
    padding: 26px 30px;
    backdrop-filter: blur(4px);
}
.sp-hero-kicker {
    display: flex; align-items: center; gap: 9px;
    text-transform: uppercase;
    letter-spacing: .13em;
    font-size: 12.5px;
    font-weight: 800;
    color: #dbeafe;
    margin: 0 0 12px;
    background: none;
}
.sp-hero-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 4px rgba(74, 222, 128, .25);
    flex: none;
}
.sp-hero-title,
.sp-hero h1 {
    margin: 0 0 14px;
    font-size: clamp(30px, 4.4vw, 44px);
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -.015em;
    color: #ffffff;
    background: none;
    border: none;
    box-shadow: none;
    text-shadow: 0 2px 14px rgba(4, 20, 46, .35);
}
.sp-hero-intro {
    margin: 0;
    font-size: 17.5px;
    line-height: 1.6;
    color: #eaf2ff;
    background: none;
    text-shadow: 0 1px 8px rgba(4, 20, 46, .3);
}

/* ---------- Phase stepper (v1.5: clearer states) ---------- */
.sp-stepper {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin: 0 0 30px; padding: 12px;
    background: #ffffff; border: 1px solid var(--sp-line); border-radius: 999px;
    box-shadow: var(--sp-shadow-sm);
}
.sp-step {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 16px 8px 9px; border-radius: 999px;
    text-decoration: none; color: var(--sp-muted); font-size: 14px; font-weight: 700;
    transition: background .15s ease, color .15s ease, transform .12s ease;
}
.sp-step-num {
    width: 26px; height: 26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12.5px; font-weight: 800;
    background: var(--sp-bg-soft); color: var(--sp-muted);
    border: 1.5px solid var(--sp-line);
}
.sp-step:hover { background: var(--sp-bg-soft); transform: translateY(-1px); }
.sp-step.current { background: var(--sp-primary); color: #fff; box-shadow: 0 4px 12px rgba(24, 90, 189, .4); }
.sp-step.current .sp-step-num { background: rgba(255,255,255,.25); color: #fff; border-color: transparent; }
.sp-step.done { color: #15803d; }
.sp-step.done .sp-step-num { background: #dcfce7; color: #15803d; border-color: #86efac; }

/* ---------- Cards ---------- */
.sp-card {
    background: #ffffff; border: 1px solid var(--sp-line); border-radius: var(--sp-radius);
    padding: 28px 30px; margin-bottom: 24px; box-shadow: var(--sp-shadow-sm);
}
.sp-card:hover { box-shadow: var(--sp-shadow-sm); }
.sp-card h2 { margin: 0 0 18px; font-size: 21px; font-weight: 800; letter-spacing: -.01em; color: var(--sp-ink); }
.sp-card h3 { margin: 22px 0 12px; font-size: 16.5px; font-weight: 700; }
.sp-subtitle { font-size: 23px; font-weight: 800; margin: 0 0 8px; letter-spacing: -.01em; }
.sp-status-line { color: var(--sp-muted); margin: 0 0 22px; font-weight: 600; }

/* ---------- Forms ---------- */
.sp-form-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px; margin-bottom: 10px;
}
.sp-form-grid label, .sp-form-row label, .sp-followup-form label {
    display: flex; flex-direction: column; gap: 7px;
    font-weight: 700; font-size: 14px; color: #33415c;
}
.sp-form-grid input, .sp-form-grid select,
.sp-form-row input, .sp-form-row select,
.sp-followup-form input[type="text"], .sp-followup-form textarea {
    padding: 12px 14px; border: 1.5px solid #cbd7e6; border-radius: 11px;
    font-size: 15.5px; background: #fbfdff; color: var(--sp-ink);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.sp-form-grid input:hover, .sp-form-grid select:hover { border-color: #9fb6d4; }
.sp-form-grid input:focus, .sp-form-grid select:focus,
.sp-followup-form input:focus, .sp-followup-form textarea:focus {
    outline: none; border-color: var(--sp-primary); background: #fff;
    box-shadow: 0 0 0 4px rgba(24, 90, 189, .14);
}
.sp-form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 15px; }
.sp-check-row { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin: 20px 0 0; }
.sp-check-row label { font-weight: 700; color: #33415c; font-size: 15px; }
.sp-hint { color: var(--sp-muted); font-size: 14px; margin: 13px 0 0; }
.sp-empty { color: var(--sp-muted); font-style: italic; font-size: 15.5px; }
.sp-status-ok { color: #15803d; font-weight: 800; }

/* ---------- Buttons ---------- */
.sp-page .button {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border-radius: 11px; padding: 12px 22px; font-size: 15px; font-weight: 800;
    border: 1.5px solid var(--sp-line); background: #ffffff; color: var(--sp-primary);
    cursor: pointer; text-decoration: none; line-height: 1.2;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.sp-page .button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(11, 47, 99, .16); }
.sp-page .button:active { transform: translateY(0); }
.sp-page .button-primary {
    background: var(--sp-primary); border-color: var(--sp-primary); color: #fff;
    box-shadow: 0 4px 14px rgba(24, 90, 189, .35);
}
.sp-page .button-primary:hover { background: var(--sp-primary-dark); border-color: var(--sp-primary-dark); }
.sp-page .button-hero { padding: 16px 32px; font-size: 16.5px; }
.sp-page .button-small { padding: 8px 15px; font-size: 13.5px; }
.sp-page .button[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.sp-action-row { display: flex; flex-wrap: wrap; gap: 11px; }
.sp-next-row { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 28px; }

/* ---------- Tables (v1.5: zebra + stronger header) ---------- */
.sp-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--sp-line); }
.sp-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.sp-table th {
    text-align: left; padding: 13px 16px; font-size: 12.5px; text-transform: uppercase;
    letter-spacing: .07em; color: #33415c;
    border-bottom: 2px solid var(--sp-line); background: #eaf1f9;
}
.sp-table td { padding: 13px 16px; border-bottom: 1px solid #e8eef6; vertical-align: middle; }
.sp-table tbody tr:nth-child(even) { background: #f8fbfe; }
.sp-table tbody tr:hover { background: #eef5fd; }

/* ---------- Badges & tags ---------- */
.sp-badge {
    display: inline-block; padding: 4px 13px; border-radius: 999px;
    font-size: 12.5px; font-weight: 800; letter-spacing: .02em; white-space: nowrap;
}
.sp-badge-funded { background: #d7f0e3; color: #1a7a34; }
.sp-badge-free { background: #d6ecff; color: #0b5cad; }
.sp-badge-paid { background: #eef1f4; color: #5f6b7a; }
.sp-tag {
    display: inline-block; padding: 4px 12px; margin: 3px;
    background: var(--sp-bg-soft); border: 1px solid var(--sp-line);
    border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--sp-muted);
}
.sp-tag-cloud { line-height: 2.2; }
.sp-count-pill {
    display: inline-block; min-width: 26px; text-align: center;
    background: var(--sp-primary); color: #fff; border-radius: 999px;
    font-size: 13px; font-weight: 800; padding: 2px 9px; vertical-align: middle;
}

/* ---------- Results grid ---------- */
.sp-results-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 20px; margin-bottom: 24px;
}
.sp-result-card {
    position: relative;
    background: #fff; border: 1px solid var(--sp-line); border-radius: var(--sp-radius);
    border-left: 5px solid var(--sp-primary);
    padding: 22px 24px; box-shadow: var(--sp-shadow-sm);
    display: flex; flex-direction: column; gap: 10px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.sp-result-card:hover { transform: translateY(-3px); box-shadow: var(--sp-shadow); }
.sp-result-card:has(.sp-badge-funded) { border-left-color: #16a34a; }
.sp-result-card:has(.sp-badge-free) { border-left-color: #0b5cad; }
.sp-result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sp-result-head h3 { margin: 0; font-size: 17px; line-height: 1.3; }
.sp-result-meta { margin: 0; color: var(--sp-muted); font-size: 14.5px; line-height: 1.55; }
.sp-result-facts { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.sp-result-facts span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--sp-muted); }
.sp-result-facts strong { font-size: 15px; }

/* ---------- Requirements page ---------- */
.sp-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 22px; }
.sp-fact span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: #52607a; margin-bottom: 4px; font-weight: 700; }
.sp-fact strong { font-size: 15.5px; }
.sp-fact-alert strong { color: #b32d2e; }
.sp-fact em { font-style: normal; color: var(--sp-muted); font-size: 13px; }
.sp-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 820px) { .sp-two-col { grid-template-columns: 1fr; } }
.sp-req-list { margin: 0; padding-left: 20px; }
.sp-req-list li { margin-bottom: 10px; }
.sp-approval-box {
    background: #fffbeb; border: 2px solid #f59e0b; border-radius: var(--sp-radius);
    padding: 26px 28px; margin-top: 26px;
    box-shadow: 0 4px 16px rgba(245, 158, 11, .12);
}
.sp-approval-box .sp-hint { color: #92610a; }
.sp-approve-label { display: flex; gap: 12px; align-items: flex-start; font-weight: 600; margin-bottom: 14px; }
.sp-approve-label input { margin-top: 5px; width: 18px; height: 18px; }

/* ---------- Eligibility result ---------- */
.sp-eligibility-eligible { color: #1a7a34; font-weight: 800; }
.sp-eligibility-conditionally-eligible { color: #996800; font-weight: 800; }
.sp-eligibility-not-eligible { color: #b32d2e; font-weight: 800; }
#sp-eligibility-result ul { margin: 8px 0 0; padding-left: 20px; }

/* ---------- Help card ---------- */
.sp-help-card {
    margin-top: 36px; padding: 22px 26px;
    background: linear-gradient(135deg, #f3f7fc, #eaf2fb);
    border: 1px solid #d5e2f2; border-radius: var(--sp-radius);
}
.sp-help-card h4 { margin: 0 0 8px; }
.sp-help-card p { margin: 0 0 10px; color: var(--sp-muted); font-size: 14px; }

/* ---------- Old shortcode styles (kept for backwards compatibility) ---------- */
.sp-search-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.sp-search-form input, .sp-search-form select { padding: 6px 8px; }
.sp-program .sp-requirements { background: var(--sp-bg-soft); padding: 12px; overflow-x: auto; }
.sp-notice.success { background: #edfaef; border-left: 4px solid #1a7a34; padding: 8px 12px; }
.sp-profile-form input { margin: 2px 4px 2px 0; }
.sp-notification-feed { list-style: none; padding: 0; }
.sp-notification-feed li { padding: 8px 0; border-bottom: 1px solid var(--sp-line); }
.sp-countdown { color: #b32d2e; font-weight: 700; }
.sp-repeater-row input { margin: 2px; }

/* ---------- Chatbot widget (v1.2) ---------- */
#sp-cb-toggle {
    position: fixed; right: 22px; bottom: 22px; z-index: 99990;
    width: 58px; height: 58px; border-radius: 50%; border: none;
    background: linear-gradient(135deg, #1a5fb4, #3584e4); color: #fff;
    font-size: 26px; cursor: pointer;
    box-shadow: 0 6px 22px rgba(13, 60, 120, .35);
    transition: transform .15s ease;
}
#sp-cb-toggle:hover { transform: scale(1.08); }
#sp-cb-panel {
    position: fixed; right: 22px; bottom: 92px; z-index: 99991;
    width: 360px; max-width: calc(100vw - 32px); height: 520px; max-height: 70vh;
    background: #fff; border-radius: 16px; border: 1px solid #e2e8f0;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 18px 50px rgba(13, 60, 120, .25);
}
.sp-cb-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; background: linear-gradient(135deg, #0d3c78, #1a5fb4); color: #fff;
}
.sp-cb-head button { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; }
.sp-cb-log { flex: 1; overflow-y: auto; padding: 14px; background: #f4f7fb; }
.sp-cb-msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; margin-bottom: 10px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.sp-cb-bot { background: #fff; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px; }
.sp-cb-user { background: #1a5fb4; color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.sp-cb-chips, .sp-cb-chips-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.sp-cb-chip {
    border: 1.5px solid #1a5fb4; color: #1a5fb4; background: #fff;
    border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; font-weight: 600;
}
.sp-cb-chip:hover { background: #eaf2fc; }
.sp-cb-msg .sp-cb-chip { margin-top: 6px; }
.sp-cb-feedback { margin-top: 8px; font-size: 12px; color: #5f6b7a; display: flex; align-items: center; gap: 6px; }
.sp-cb-vote { border: 1px solid #e2e8f0; background: #fff; border-radius: 8px; cursor: pointer; padding: 3px 8px; }
.sp-cb-vote:hover { background: #f4f7fb; }
.sp-cb-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #e2e8f0; }
.sp-cb-form input {
    flex: 1; padding: 10px 12px; border: 1.5px solid #e2e8f0; border-radius: 10px; font-size: 14px;
}
.sp-cb-form input:focus { outline: none; border-color: #1a5fb4; }
.sp-cb-form button {
    background: #1a5fb4; color: #fff; border: none; border-radius: 10px;
    padding: 0 18px; font-weight: 700; cursor: pointer;
}

/* ---------- AI agent (v1.3) ---------- */
.sp-ai-out { margin-top: 14px; }
.sp-ai-band { font-size: 24px; font-weight: 800; padding: 8px 16px; border-radius: 10px; display: inline-block; background: #eef1f4; }
.sp-ai-band-high { background: #d7f0e3; color: #1a7a34; }
.sp-ai-band-moderate { background: #fdf3d7; color: #8a6d1a; }
.sp-ai-band-low { background: #fdeaea; color: #b32d2e; }
.sp-ai-text { background: #f4f7fb; border: 1px solid #e2e8f0; border-radius: 10px; padding: 16px; white-space: pre-wrap; max-height: 420px; overflow-y: auto; font-size: 13.5px; line-height: 1.6; }

/* ---------- Auto-generated FAQ page (v1.3) ---------- */
.sp-faq-search { padding: 20px 24px; }
.sp-faq-filter {
    width: 100%; padding: 14px 18px; font-size: 16px;
    border: 1.5px solid #e2e8f0; border-radius: 12px;
}
.sp-faq-filter:focus { outline: none; border-color: #1a5fb4; box-shadow: 0 0 0 3px rgba(26,95,180,.15); }
.sp-faq-cat h2 { display: flex; align-items: center; gap: 10px; }
.sp-faq-item {
    border: 1px solid #e2e8f0; border-radius: 12px;
    margin-bottom: 10px; background: #fff; overflow: hidden;
}
.sp-faq-item summary {
    padding: 15px 18px; font-weight: 700; font-size: 15px;
    cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.sp-faq-item summary::before {
    content: '+'; color: #1a5fb4; font-size: 20px; font-weight: 800; width: 20px; flex: none;
}
.sp-faq-item[open] summary::before { content: '–'; }
.sp-faq-item summary:hover { background: #f0f6fd; }
.sp-faq-item[open] { border-color: #9fc0ea; box-shadow: 0 4px 14px rgba(11,47,99,.08); }
.sp-faq-item[open] summary { background: #eaf2fc; color: var(--sp-primary-dark); }
.sp-faq-answer { padding: 4px 18px 14px 48px; color: #3b4653; font-size: 14.5px; line-height: 1.65; }
.sp-faq-meta { padding: 0 18px 12px 48px; margin: 0; font-size: 12px; color: #8a94a1; }

/* v1.4 cascading search */
#sp-dept-manual-wrap input { border-color: #f0c930 !important; }

/* v1.4 cascade option hiding (class-based; :visible is unreliable on <option>) */
select option.sp-opt-hidden { display: none; }

/* v1.5: guarantee no inherited backgrounds inside hero */
.sp-hero * { background-image: none; }
.sp-hero-inner * { background-color: transparent; }

/* v1.9 AI writer + read/download actions */
.sp-ai-card { border: 1.5px solid #c7b9f2; background: linear-gradient(135deg, #fbfaff, #f4f0ff); }
.sp-ai-card h2 { color: #5b3db8; }
.sp-doc-actions { white-space: nowrap; }
.sp-doc-actions .button { margin-right: 6px; }

/* v1.14 cascade status badge */
.sp-cascade-status { font-size: 13px; font-weight: 700; margin: 4px 0 0; }
.sp-cascade-status.ok { color: #15803d; }

/* v1.20 guidance resources */
.sp-guidance-card { border: 1.5px solid #b9d2ee; background: linear-gradient(135deg, #f7fbff, #eef5fd); }
.sp-guidance-links { margin: 0 0 6px; padding-left: 20px; }
.sp-guidance-links li { margin-bottom: 5px; font-size: 14.5px; }

/* v1.22 funding panel */
.sp-funding-panel { background: #eef7f0; border: 1px solid #86efac; border-radius: 12px; padding: 14px 18px; margin: 12px 0; }
.sp-result-card .sp-funding-panel { margin: 4px 0 10px; padding: 12px 16px; }
.sp-funding-package { margin: 0 0 6px; font-size: 15px; }
.sp-funding-account { margin: 0 0 4px; font-size: 14.5px; color: #14532d; }

/* v1.26 aid panel */
.sp-aid-panel { background:#f0f7ff; border:1.5px solid #93c5fd; border-radius:12px; padding:16px 20px; margin-top:14px; }
.sp-aid-panel h3 { margin:0 0 8px; color:#1e40af; }

/* v1.33 PAL/TAL */
.sp-badge-pal { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.sp-pal-panel { background: #fffbeb; border: 1.5px solid #f59e0b; border-radius: 12px; padding: 16px 20px; margin-bottom: 20px; }
.sp-pal-steps { margin: 10px 0 6px; padding-left: 22px; }
.sp-pal-steps li { margin-bottom: 6px; }

/* v1.36 study resources */
.sp-resource-list { list-style: none; margin: 0 0 18px; padding: 0; }
.sp-resource-list li { padding: 12px 16px; border: 1px solid #e2e8f0; border-radius: 12px; margin-bottom: 10px; background: #fbfdff; }
.sp-resource-list li:hover { border-color: #9fc0ea; }
