/* Student Portal — its own clean UI, a teal/green accent to distinguish it from
   the admin (navy) and teacher (dark blue) portals. */

:root { --sp-dark: #0e3b2e; --sp-main: #15795b; --sp-deep: #0d5a43; }

.sp-body { margin: 0; background: #eef5f2; font-family: "Segoe UI", system-ui, sans-serif; color: #1a2d4a; }

/* ── Login ── */
.sp-login-body {
    margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0e3b2e, #15795b); padding: 20px;
    font-family: "Segoe UI", system-ui, sans-serif;
}
.sp-login-card {
    width: 100%; max-width: 400px; background: #fff; border-radius: 16px;
    padding: 32px 30px; box-shadow: 0 18px 48px rgba(0,0,0,.3);
}
.sp-login-head { text-align: center; margin-bottom: 22px; }
.sp-login-logo { width: 60px; height: 60px; object-fit: contain; border-radius: 10px; margin-bottom: 10px; }
.sp-login-head h1 { margin: 0; font-size: 20px; color: var(--sp-deep); }
.sp-login-head p { margin: 4px 0 0; color: #6c7a8a; font-size: 13px; font-weight: 600; letter-spacing: .5px; }
.sp-login-form { display: flex; flex-direction: column; gap: 14px; }
.sp-field { display: flex; flex-direction: column; gap: 6px; }
.sp-field label { font-size: 12px; font-weight: 700; color: #1a2d4a; text-transform: uppercase; letter-spacing: .4px; }
.sp-field input {
    padding: 11px 13px; border: 1.5px solid #cdddd6; border-radius: 9px; font-size: 14px; color: #1a2d4a;
}
.sp-field input:focus { outline: none; border-color: var(--sp-main); box-shadow: 0 0 0 3px rgba(21,121,91,.12); }
.sp-login-btn {
    margin-top: 6px; padding: 12px; border: 0; border-radius: 9px;
    background: var(--sp-deep); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}
.sp-login-btn:hover { background: var(--sp-main); }
.sp-login-note { margin: 14px 0 0; text-align: center; color: #8a9aab; font-size: 12px; }
.sp-login-note a { color: var(--sp-main); font-weight: 600; }

/* ── Top bar ── */
.sp-topbar {
    display: flex; align-items: center; gap: 20px;
    padding: 10px 22px; background: linear-gradient(135deg, #0e3b2e, #15795b);
    color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.15); flex-wrap: wrap;
}
.sp-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; }
.sp-brand-logo { width: 32px; height: 32px; border-radius: 6px; object-fit: contain; background: #fff; padding: 2px; }
.sp-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.sp-nav a { padding: 8px 14px; border-radius: 7px; color: #cdece2; text-decoration: none; font-size: 14px; font-weight: 600; }
.sp-nav a:hover, .sp-nav a.active { color: #fff; background: rgba(255,255,255,.14); }
.sp-user { display: flex; align-items: center; gap: 12px; }
.sp-user-name { font-size: 13px; font-weight: 600; color: #cdece2; }
.sp-logout {
    padding: 7px 14px; border: 1px solid rgba(255,255,255,.3); border-radius: 7px;
    background: transparent; color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.sp-logout:hover { background: rgba(255,255,255,.14); }

.sp-nav-toggle {
    display: none; width: 42px; height: 38px; padding: 0; margin-left: auto;
    border: 1px solid rgba(255,255,255,.25); border-radius: 8px;
    background: rgba(255,255,255,.08); cursor: pointer;
    flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.sp-nav-toggle span { display: block; width: 20px; height: 2px; background: #cdece2; border-radius: 2px; }

/* ── Main ── */
.sp-main { width: min(1100px, 100%); margin: 24px auto 48px; padding: 0 18px; }
.sp-page-title { color: var(--sp-deep); font-size: 24px; margin: 0 0 8px; }
.sp-sub { color: #6c7a8a; margin: 0 0 18px; font-size: 14px; }

.sp-welcome {
    padding: 24px 28px; border-radius: 14px; margin-bottom: 22px;
    background: linear-gradient(120deg, #0d5a43, #15795b); color: #fff;
}
.sp-welcome h1 { margin: 0 0 6px; font-size: 24px; }
.sp-welcome p { margin: 0; color: #cdece2; font-size: 14px; }

.sp-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 16px; margin-bottom: 26px; }
.sp-stat { padding: 18px 20px; border-radius: 13px; background: #fff; border: 1px solid #dcebe5; box-shadow: 0 2px 10px rgba(14,59,46,.05); }
.sp-stat span { display: block; color: #6c7a8a; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.sp-stat strong { display: block; margin-top: 6px; font-size: 28px; color: var(--sp-deep); }
.sp-stat-fee.warn strong { color: #a13e47; }

.sp-section-title { color: var(--sp-deep); font-size: 17px; margin: 0 0 14px; }
.sp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: 16px; margin-bottom: 26px; }
.sp-tile {
    display: flex; flex-direction: column; gap: 4px; padding: 20px;
    border-radius: 13px; background: #fff; border: 1px solid #dcebe5;
    text-decoration: none; color: #1a2d4a; transition: transform .12s, box-shadow .12s;
}
.sp-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(14,59,46,.12); border-color: #bcdccf; }
.sp-tile span { font-size: 28px; }
.sp-tile strong { color: var(--sp-deep); font-size: 15px; }
.sp-tile small { color: #6c7a8a; font-size: 12px; }

/* ── Cards & tables ── */
.sp-card { background: #fff; border: 1px solid #dcebe5; border-radius: 13px; padding: 20px 22px; margin-bottom: 18px; }
.sp-card h3 { margin: 0 0 14px; color: var(--sp-deep); font-size: 16px; }
.sp-muted { color: #8a9aab; font-size: 13px; }

.sp-profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.sp-photo { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; border: 2px solid #dcebe5; }
.sp-profile-head h2 { margin: 0 0 4px; color: var(--sp-deep); }
.sp-profile-head p { margin: 0; color: #6c7a8a; font-size: 13px; }

.sp-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 14px; }
.sp-detail-grid div span { display: block; font-size: 11px; color: #8a9aab; text-transform: uppercase; letter-spacing: .4px; }
.sp-detail-grid div strong { display: block; margin-top: 2px; color: #1a3b55; font-size: 14px; }

.sp-table-wrap { overflow-x: auto; border: 1px solid #dcebe5; border-radius: 10px; }
.sp-table, .sp-routine-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sp-table th, .sp-routine-table th { background: var(--sp-deep); color: #fff; padding: 9px 12px; text-align: left; font-size: 12px; white-space: nowrap; }
.sp-table td, .sp-routine-table td { padding: 9px 12px; border-bottom: 1px solid #eef3f1; }
.sp-table tr:hover td { background: #f4faf7; }
.sp-day { font-weight: 700; color: var(--sp-deep); background: #f3f9f6; }
.sp-cell strong { display: block; color: var(--sp-deep); font-size: 13px; }
.sp-cell small { color: #6c7a8a; font-size: 11px; }
.sp-free { color: #c3d3cc; }
.sp-row-void td { opacity: .55; text-decoration: line-through; }

.sp-badge { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.sp-badge-paid { background: #d1fae5; color: #065f46; }
.sp-badge-pending { background: #fef3c7; color: #92400e; }
.sp-badge-partial { background: #fef3c7; color: #92400e; }
.sp-badge-overdue { background: #fff0f1; color: #a13e47; }
.sp-badge-cancelled { background: #f3f4f6; color: #9ca3af; }
.sp-absent { color: #a13e47; font-weight: 600; }

/* ── Progress report ── */
.pr-head { margin-bottom: 14px; }
.pr-head .sp-sub { margin: 0; }
.pr-head .sp-sub b { color: #1a3b55; }
.pr-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; padding: 5px; border-radius: 12px; background: #e7f2ed; width: fit-content; max-width: 100%; }
.pr-tab {
    padding: 8px 16px; border: 0; border-radius: 8px; background: transparent;
    color: #3c566d; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.pr-tab:hover { color: var(--sp-deep); background: rgba(255,255,255,.6); }
.pr-tab[aria-selected="true"] { background: #fff; color: var(--sp-deep); box-shadow: 0 1px 4px rgba(14,59,46,.14); }
.pr-exam { margin-bottom: 26px; }

.pr-summary {
    display: grid; grid-template-columns: 1.5fr repeat(4, 1fr); gap: 1px;
    border-radius: 14px; overflow: hidden; margin-bottom: 14px;
    background: rgba(255,255,255,.18); color: #fff;
    box-shadow: 0 6px 18px rgba(14,59,46,.14);
}
.pr-summary > div { padding: 16px 18px; background: linear-gradient(135deg, #0d5a43, #15795b); }
.pr-summary.pr-fail > div { background: linear-gradient(135deg, #7c2d36, #a13e47); }
.pr-summary.pr-puc > div { background: linear-gradient(135deg, #7a4b0c, #a8660f); }
.pr-summary.pr-absent > div { background: linear-gradient(135deg, #3f4a56, #5f6b78); }
.pr-summary span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; opacity: .8; }
.pr-summary strong { display: block; margin-top: 4px; font-size: 24px; line-height: 1.2; }
.pr-summary strong small { font-size: 14px; font-weight: 600; opacity: .8; }
.pr-exam-name strong { font-size: 20px; }

.pr-table-card { background: #fff; border: 1px solid #dcebe5; border-radius: 13px; overflow: hidden; }
.pr-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pr-table th {
    padding: 11px 14px; background: #f3f9f6; color: #4b6b5f; text-align: left;
    font-size: 11px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid #dcebe5;
}
.pr-table td { padding: 11px 14px; border-bottom: 1px solid #eef3f1; color: #1a3b55; vertical-align: middle; }
.pr-table tbody tr:last-child td { border-bottom: 0; }
.pr-table .num { text-align: center; white-space: nowrap; }
.pr-table td small { color: #8a9aab; font-size: 12px; }
.pr-subject { font-weight: 700; color: var(--sp-deep); }
.pr-total b { font-size: 15px; }
.pr-row-fail td { background: #fff8f8; }
.pr-ab { color: #a13e47; font-weight: 700; }
.pr-grace { display: block; font-style: normal; font-size: 11px; color: #92400e; }
.pr-bar-col { width: 22%; min-width: 110px; }
.pr-bar { position: relative; display: block; height: 8px; border-radius: 6px; background: #e8efec; }
.pr-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: linear-gradient(90deg, #15795b, #34a37f); }
.pr-row-fail .pr-bar i { background: #d9737d; }
.pr-bar u { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: #1a3b55; opacity: .45; }
.pr-chip { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.pr-chip-pass { background: #d1fae5; color: #065f46; }
.pr-chip-fail { background: #ffe4e6; color: #a13e47; }
.pr-chip-ab { background: #f3f4f6; color: #6b7280; }
.pr-chip-wait { background: #fef3c7; color: #92400e; }
.pr-foot { margin: 0; padding: 10px 14px; border-top: 1px solid #eef3f1; background: #fafcfb; color: #6c7a8a; font-size: 12px; }

@media (max-width: 760px) {
    .pr-tabs { flex-wrap: nowrap; overflow-x: auto; width: auto; }
    .pr-summary { grid-template-columns: repeat(2, 1fr); }
    .pr-summary .pr-exam-name { grid-column: 1 / -1; }
    .pr-summary strong { font-size: 20px; }
    .pr-table thead { display: none; }
    .pr-table, .pr-table tbody, .pr-table tr, .pr-table td { display: block; width: auto; }
    .pr-table tr {
        display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 8px;
        padding: 12px 14px; border-bottom: 1px solid #eef3f1;
    }
    .pr-table tbody tr:last-child { border-bottom: 0; }
    .pr-table td { padding: 0; border: 0; background: none !important; }
    .pr-table td.pr-subject { grid-column: 1 / -1; font-size: 15px; }
    .pr-table td.pr-bar-col { grid-column: 1 / -1; min-width: 0; order: 2; padding: 2px 0 4px; }
    .pr-table td.num { order: 3; text-align: left; }
    .pr-table td[data-label]::before {
        content: attr(data-label); display: block; font-size: 10px; color: #8a9aab;
        text-transform: uppercase; letter-spacing: .4px;
    }
    .pr-row-fail { background: #fff8f8; }
}

.sp-holiday-list { display: flex; flex-direction: column; gap: 2px; }
.sp-holiday-row { display: flex; gap: 14px; padding: 10px 12px; border-radius: 8px; background: #f6fbf9; }
.sp-holiday-row:nth-child(even) { background: #eef5f2; }
.sp-holiday-date { font-weight: 700; color: var(--sp-deep); min-width: 150px; font-size: 13px; }
.sp-holiday-name { color: #3c566d; font-size: 13px; }
.sp-holiday-past { opacity: .7; }

.sp-empty {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 48px 20px; text-align: center; color: #6c7a8a;
    border: 1px dashed #cdddd6; border-radius: 12px; background: #fff;
}
.sp-empty span { font-size: 36px; }
.sp-empty p { margin: 0; }

@media (max-width: 820px) {
    .sp-nav-toggle { display: flex; }
    .sp-topbar { gap: 10px; flex-wrap: wrap; }
    .sp-nav { display: none; order: 4; width: 100%; flex-direction: column; gap: 2px; }
    .sp-user { display: none; order: 5; width: 100%; justify-content: space-between; }
    .sp-topbar.sp-nav-open .sp-nav, .sp-topbar.sp-nav-open .sp-user { display: flex; }
    .sp-nav a { padding: 10px 14px; }
}

/* ── Class routine (builds on routine.css's week table and day cards) ── */
.rs-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.rs-head .sp-sub { margin: 0; }
.rs-head .sp-sub b { color: #1a3b55; }
.rs-pdf {
    padding: 9px 16px; border-radius: 9px; background: var(--sp-deep); color: #fff;
    text-decoration: none; font-weight: 700; font-size: 13px;
}
.rs-pdf:hover { background: var(--sp-main); }
.rs-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.rs-facts div { padding: 14px 16px; border-radius: 12px; background: #fff; border: 1px solid #dcebe5; }
.rs-facts span { display: block; font-size: 11px; color: #6c7a8a; text-transform: uppercase; letter-spacing: .5px; }
.rs-facts strong { display: block; margin-top: 4px; font-size: 17px; color: var(--sp-deep); }
.sp-main h2 { color: var(--sp-deep); font-size: 16px; margin: 0 0 10px; }

.rs-today {
    padding: 16px 18px; border-radius: 14px; margin-bottom: 20px;
    background: linear-gradient(120deg, #0d5a43, #15795b); color: #fff;
}
.rs-today h2 { color: #fff; }
.rs-today ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.rs-today li { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.12); }
.rs-today li.rs-combined { background: rgba(255,255,255,.2); }
.rs-today li.rs-break { justify-content: center; background: transparent; border: 1px dashed rgba(255,255,255,.35); color: #cdece2; font-size: 12px; }
.rs-today .rs-when { font-size: 12px; font-weight: 700; color: #cdece2; }
.rs-today .rs-when small { margin-left: 6px; font-weight: 400; }
.rs-today .rs-what b { display: block; font-size: 15px; }
.rs-today .rs-what span { display: block; font-size: 12px; color: #e3f4ee; }
.rs-today .rs-what small { display: block; font-size: 11px; color: #fef3c7; font-weight: 700; }
.rs-today .rs-what .rt-sep { display: block; height: 0; border-top: 1px dashed rgba(255,255,255,.45); margin: 5px 0; }
.rs-none, .rs-holiday-note { margin: 0 0 16px; }
.rs-today .rs-none { color: #cdece2; margin: 0; }

.rs-week { margin-bottom: 20px; }
.sp-body .rt-week thead th, .sp-body .rt-week thead .rt-day-head, .sp-body .rt-day-card h4 { background: var(--sp-deep); }
.sp-body .rt-week .rt-day-head { color: var(--sp-deep); background: #f3f9f6; }
.sp-body .rt-week th, .sp-body .rt-week td { border-color: #dcebe5; }
.sp-body .rt-week td b, .sp-body .rt-day-card .rt-what b { color: #14382c; }
.sp-body .rt-week td { height: 56px; }
.sp-body .rt-week th.rt-break, .sp-body .rt-week td.rt-break { background: #f6f3e8; color: #7a5b16; width: 64px; }
.sp-body .rt-day-card .rt-when { color: var(--sp-deep); }

.rs-teachers ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.rs-teachers li { padding: 10px 14px; border-radius: 10px; background: #fff; border: 1px solid #dcebe5; }
.rs-teachers b { display: block; color: var(--sp-deep); font-size: 14px; }
.rs-teachers span { display: block; color: #3c566d; font-size: 13px; margin-top: 2px; }

/* routine sheet: the week as the office prints it */
.rs-sheet { margin-bottom: 20px; }
.rs-sheet img {
    display: block; width: 100%; height: auto; border-radius: 10px;
    border: 1px solid #dcebe5; background: #fff; box-shadow: 0 4px 14px rgba(14, 59, 46, .08);
}
