/* Student Portal — mobile-first responsive */
*, *::before, *::after { box-sizing: border-box; }
.sp-body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #2d3748;
    background: #f0f4f8;
    padding-bottom: 72px;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

.sp-header {
    background: linear-gradient(135deg, #1a5276 0%, #2471a3 55%, #1a5276 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
    position: sticky;
    top: 0;
    z-index: 100;
}
.sp-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    gap: 10px;
}
.sp-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    flex: 1;
}
.sp-logo-wrap {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: #fff;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.85);
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.sp-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    border: none;
    border-radius: 0;
    background: transparent;
}
.sp-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.sp-school-name {
    font-weight: 700;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-portal-tag {
    font-size: 11px;
    opacity: .85;
}
.sp-logout {
    color: #fff;
    font-size: 20px;
    padding: 8px;
    text-decoration: none;
    opacity: .9;
}
.sp-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.sp-header-icon {
    color: #fff;
    font-size: 18px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 10px;
    opacity: .92;
}
.sp-header-icon:active { background: rgba(255,255,255,.12); }
.sp-header-home {
    box-shadow: none;
    border-bottom: none;
}
.sp-body-home {
    background: #eef2f7;
}
.sp-main-home {
    padding: 0 0 14px;
    max-width: 520px;
}
.sp-user-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px 12px;
}
.sp-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.7);
    background: #fff;
}
.sp-user-meta {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    min-width: 0;
}
.sp-user-meta strong {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-user-meta span { opacity: .9; font-size: 12px; }
.sp-page-title {
    background: rgba(0,0,0,.12);
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
}

.sp-main {
    padding: 14px;
    max-width: 900px;
    margin: 0 auto;
}

/* Login */
.sp-login-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, #1a5276 0%, #2980b9 50%, #1a5276 100%);
    padding: 20px 16px 32px;
}
.sp-login-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px 20px;
    margin-top: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.sp-login-hero {
    text-align: center;
    color: #fff;
    padding: 24px 0 32px;
}
.sp-login-logo-wrap {
    display: inline-block;
    background: #fff;
    border-radius: 18px;
    padding: 12px 16px;
    margin: 0 auto 16px;
    box-shadow: 0 6px 24px rgba(0,0,0,.22);
    max-width: min(220px, 78vw);
    line-height: 0;
}
.sp-login-logo-wrap img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 130px;
    object-fit: contain;
    object-position: center;
    border: none;
    border-radius: 0;
    background: transparent;
}
.sp-login-hero h1 {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 700;
}
.sp-login-hero p { margin: 0; opacity: .9; font-size: 14px; }
.sp-field { margin-bottom: 16px; }
.sp-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 6px;
}
.sp-field input, .sp-field select, .sp-field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd5e0;
    border-radius: 10px;
    font-size: 16px;
    background: #fff;
    -webkit-appearance: none;
}
.sp-field textarea { min-height: 100px; resize: vertical; }
.sp-btn {
    display: inline-block;
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}
.sp-btn-primary {
    background: linear-gradient(135deg, #1a5276, #2471a3);
    color: #fff;
}
.sp-btn-secondary {
    background: #e2e8f0;
    color: #2d3748;
    margin-top: 8px;
}
.sp-alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 14px;
}
.sp-alert-error { background: #fed7d7; color: #c53030; }
.sp-alert-success { background: #c6f6d5; color: #276749; }

/* Dashboard — home redesign */
.sp-dash-hero {
    position: relative;
    margin: 0 0 0;
    padding: 20px 16px 72px;
    color: #fff;
    overflow: hidden;
}
.sp-dash-hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #154360 0%, #1a5276 40%, #2e86c1 100%);
    border-radius: 0 0 28px 28px;
    z-index: 0;
}
.sp-dash-hero-bg::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    top: -60px;
    right: -40px;
}
.sp-dash-hero-inner {
    position: relative;
    z-index: 1;
    padding-right: 96px;
    min-height: 100px;
}
.sp-dash-greet {
    margin: 0 0 2px;
    font-size: 13px;
    opacity: .88;
    font-weight: 500;
}
.sp-dash-name {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.02em;
}
.sp-dash-sub {
    margin: 0 0 12px;
    font-size: 13px;
    opacity: .9;
}
.sp-dash-id-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}
.sp-dash-photo-wrap {
    position: absolute;
    right: 16px;
    top: 18px;
    z-index: 2;
}
.sp-dash-photo {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
    background: #fff;
}

.sp-dash-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: -48px 12px 12px;
    position: relative;
    z-index: 3;
}
.sp-dash-stat {
    background: #fff;
    border-radius: 14px;
    padding: 12px 6px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 16px rgba(26,82,118,.12);
    transition: transform .15s;
}
.sp-dash-stat:active { transform: scale(.97); }
.sp-dash-stat-val {
    display: block;
    font-size: 17px;
    font-weight: 700;
    color: #1a5276;
    line-height: 1.2;
}
.sp-dash-stat-badge {
    font-size: 12px;
    text-transform: uppercase;
}
.sp-dash-stat-lbl {
    display: block;
    font-size: 10px;
    color: #718096;
    margin-top: 2px;
    font-weight: 600;
}

.sp-dash-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin: 0 12px 14px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 12px;
    font-size: 12px;
    color: #4a5568;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.sp-dash-info-bar span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sp-dash-info-bar i { color: #1a5276; opacity: .8; }

.sp-dash-section {
    margin: 0 12px 16px;
}
.sp-dash-section-title {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 700;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sp-dash-section-title i {
    color: #1a5276;
    font-size: 15px;
    width: 22px;
    text-align: center;
}
.sp-dash-section-title-inline { margin-bottom: 0; }

.sp-dash-menu {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.sp-dash-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 14px;
    text-decoration: none;
    color: #2d3748;
    border-bottom: 1px solid #f1f5f9;
    transition: background .12s;
}
.sp-dash-item:last-child { border-bottom: none; }
.sp-dash-item:active { background: #f8fafc; }
.sp-dash-item-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
    color: #fff;
    background: var(--tile-color, #1a5276);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.sp-dash-item-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sp-dash-item-text strong {
    font-size: 14px;
    font-weight: 600;
}
.sp-dash-item-text small {
    font-size: 11px;
    color: #a0aec0;
}
.sp-dash-item-arrow {
    color: #cbd5e0;
    font-size: 12px;
    flex-shrink: 0;
}

.sp-dash-notice-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 10px;
}
.sp-dash-link {
    font-size: 12px;
    font-weight: 600;
    color: #1a5276;
    text-decoration: none;
    white-space: nowrap;
}
.sp-dash-notice-card {
    display: block;
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
    border-left: 4px solid #f6c23e;
}
.sp-dash-notice-card:active { background: #fafafa; }
.sp-dash-notice-card h3 {
    margin: 0 0 4px;
    font-size: 15px;
    color: #2d3748;
}
.sp-dash-notice-card time {
    font-size: 11px;
    color: #a0aec0;
}
.sp-dash-notice-card p {
    margin: 8px 0 0;
    font-size: 13px;
    color: #718096;
    line-height: 1.45;
}

/* Payment charts */
.sp-dash-chart-card {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.sp-dash-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 10px;
}
.sp-dash-chart-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #f0f7fc 0%, #e8f4ea 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}
.sp-dash-chart-total-lbl {
    font-size: 12px;
    color: #718096;
    font-weight: 600;
}
.sp-dash-chart-total-val {
    font-size: 18px;
    color: #1a5276;
    font-weight: 700;
}
.sp-dash-chart-box { margin-top: 4px; }
.sp-dash-chart-box-split {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #edf2f7;
}
.sp-dash-chart-sub {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 600;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.sp-dash-chart-canvas-wrap {
    position: relative;
    height: 200px;
    width: 100%;
}
.sp-dash-chart-canvas-donut { height: 220px; }
.sp-dash-chart-empty { padding: 20px 12px; }

@media (min-width: 600px) {
    .sp-main-home { max-width: 560px; }
    .sp-dash-stats { margin-left: 16px; margin-right: 16px; }
    .sp-dash-section { margin-left: 16px; margin-right: 16px; }
    .sp-dash-info-bar { margin-left: 16px; margin-right: 16px; }
}

/* Legacy dashboard tiles (other pages) */
.sp-welcome {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.sp-welcome h2 { margin: 0 0 4px; font-size: 18px; color: #1a5276; }
.sp-welcome p { margin: 0; color: #718096; font-size: 13px; }

.sp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
@media (max-width: 380px) {
    .sp-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 600px) {
    .sp-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}

.sp-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #2d3748;
    background: #fff;
    border-radius: 14px;
    padding: 16px 8px;
    min-height: 108px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: transform .15s, box-shadow .15s;
    -webkit-user-select: none;
    user-select: none;
}
.sp-tile:active { transform: scale(.96); }
.sp-tile-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    margin-bottom: 8px;
}
.sp-tile span {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    line-height: 1.25;
}

/* Cards & tables */
.sp-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.sp-card h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #1a5276;
    border-bottom: 1px solid #edf2f7;
    padding-bottom: 8px;
}
.sp-info-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f7fafc;
    font-size: 14px;
}
.sp-info-row:last-child { border-bottom: none; }
.sp-info-row .lbl { color: #718096; flex-shrink: 0; }
.sp-info-row .val { text-align: right; font-weight: 500; word-break: break-word; }

.sp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 280px;
}
.sp-table th, .sp-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #edf2f7;
    text-align: left;
}
.sp-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
    white-space: nowrap;
}
.sp-table tr:last-child td { border-bottom: none; }

.sp-notice-item {
    padding: 12px 0;
    border-bottom: 1px solid #edf2f7;
}
.sp-notice-item:last-child { border-bottom: none; }
.sp-notice-item h4 { margin: 0 0 4px; font-size: 15px; color: #2d3748; }
.sp-notice-date { font-size: 12px; color: #a0aec0; margin-bottom: 6px; }
.sp-notice-body { font-size: 14px; color: #4a5568; }

.sp-profile-photo {
    text-align: center;
    margin-bottom: 16px;
}
.sp-profile-photo img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #1a5276;
}

/* Bottom nav */
.sp-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -2px 12px rgba(0,0,0,.08);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.sp-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px 10px;
    text-decoration: none;
    color: #718096;
    font-size: 10px;
    gap: 3px;
    min-height: 56px;
}
.sp-nav-item i { font-size: 20px; }
.sp-nav-item.active { color: #1a5276; font-weight: 600; }

.sp-footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: #a0aec0;
}
.sp-footer p { margin: 0; }

.sp-empty {
    text-align: center;
    padding: 24px;
    color: #a0aec0;
    font-size: 14px;
}

.sp-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #1a5276;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 12px;
}
