/* ==========================================================================
   NTA Television College — Student Portal design system
   Sits on top of Bootstrap 4.1 CSS (+ Bootstrap 3 JS compatibility fixes)
   ========================================================================== */

:root {
    --brand: #0f6b45;          /* college green */
    --brand-600: #0c5a3a;
    --brand-700: #0a4a30;
    --brand-50: #eaf6f0;
    --brand-100: #d2ecdf;
    --accent: #d98a00;         /* NTA amber */
    --accent-50: #fff5e0;

    --ink: #1b2430;
    --ink-2: #4a5566;
    --ink-3: #7a8596;
    --line: #e4e8ee;
    --line-2: #eef1f5;
    --surface: #ffffff;
    --canvas: #f4f6f9;

    --danger: #d64545;
    --danger-50: #fdeeee;
    --warning: #c77700;
    --warning-50: #fff6e5;
    --success: #13865a;
    --success-50: #e8f6ef;
    --info: #2563c9;
    --info-50: #ebf2fd;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 6px 16px rgba(16, 24, 40, .06);
    --shadow-lg: 0 12px 40px rgba(16, 24, 40, .14);
    --sidebar-w: 264px;
    --topbar-h: 64px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body.portal {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
.portal h1, .portal h2, .portal h3, .portal h4, .portal h5, .portal h6 {
    font-family: var(--font);
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.3;
}
.portal h1 { font-size: 1.75rem; }
.portal h2 { font-size: 1.45rem; }
.portal h3 { font-size: 1.2rem; }
.portal h4 { font-size: 1.05rem; }
.portal h5 { font-size: .95rem; }
.portal a { color: var(--brand); }
.portal a:hover { color: var(--brand-700); }
.portal img { max-width: 100%; height: auto; }
.portal ::selection { background: var(--brand-100); }
.portal :focus-visible { outline: 3px solid rgba(15, 107, 69, .35); outline-offset: 2px; }
.portal legend {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    padding-bottom: .5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--line);
    width: 100%;
}
.portal hr { border-top-color: var(--line); margin: 1.5rem 0; }
.clear { clear: both; }

/* ---------- App shell ---------- */
.app {
    min-height: 100vh;
    display: flex;
}
.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #0c5a3a 0%, #0a3f2a 100%);
    color: #d7ebe1;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
}
.app-main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.app.guest .app-main { margin-left: 0; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    text-decoration: none !important;
}
.sidebar-brand img {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: #fff;
    padding: 4px;
    object-fit: contain;
    flex-shrink: 0;
}
.sidebar-brand .name { color: #fff; font-weight: 700; font-size: .95rem; line-height: 1.2; }
.sidebar-brand .sub { color: #9cc9b3; font-size: .72rem; line-height: 1.3; margin-top: 2px; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    margin: 0;
    list-style: none;
}
.sidebar-nav .nav-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #7fb59a;
    padding: 14px 12px 6px;
    font-weight: 600;
}
.sidebar-nav li { list-style: none; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    margin: 2px 0;
    border-radius: 10px;
    color: #d7ebe1 !important;
    font-size: .92rem;
    font-weight: 500;
    text-decoration: none !important;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.sidebar-link i.ico { width: 20px; text-align: center; font-size: 1rem; opacity: .9; }
.sidebar-link:hover { background: rgba(255, 255, 255, .08); color: #fff !important; }
.sidebar-link.active {
    background: #fff;
    color: var(--brand-700) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}
.sidebar-link.active i.ico { color: var(--brand); }
.sidebar-link .chev { margin-left: auto; font-size: .75rem; transition: transform .2s; }
.sidebar-group.open > .sidebar-link .chev { transform: rotate(180deg); }
.sidebar-sub {
    display: none;
    padding: 2px 0 6px 32px;
    margin: 0;
}
.sidebar-group.open > .sidebar-sub { display: block; }
.sidebar-sub a {
    display: block;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: .87rem;
    color: #b7d8c7 !important;
    text-decoration: none !important;
    position: relative;
}
.sidebar-sub a::before {
    content: "";
    position: absolute;
    left: -10px; top: 50%;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .25);
    transform: translateY(-50%);
}
.sidebar-sub a:hover { color: #fff !important; background: rgba(255, 255, 255, .06); }
.sidebar-sub a.active { color: #fff !important; font-weight: 600; background: rgba(255, 255, 255, .1); }
.sidebar-sub a.active::before { background: var(--accent); }

.sidebar-foot {
    padding: 14px 12px 18px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-foot .sidebar-link { color: #ffd6d6 !important; }
.sidebar-foot .sidebar-link:hover { background: rgba(214, 69, 69, .2); }

.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 20, 15, .5);
    z-index: 1035;
    opacity: 0;
    transition: opacity .25s;
}

/* Top bar */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 28px;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar-toggle {
    display: none;
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-size: 1.1rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.topbar-title { min-width: 0; }
.topbar-title h1 {
    font-size: 1.1rem !important;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-title .crumb { font-size: .75rem; color: var(--ink-3); line-height: 1.2; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-pill.ok { background: var(--success-50); color: var(--success); }
.status-pill.grad { background: var(--info-50); color: var(--info); }
.status-pill.warn { background: var(--warning-50); color: var(--warning); }
.status-pill.bad { background: var(--danger-50); color: var(--danger); }

.user-menu { position: relative; }
.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    color: var(--ink);
    max-width: 260px;
}
.user-btn:hover { border-color: #cfd6df; box-shadow: var(--shadow-sm); }
.avatar {
    position: relative;
    width: 36px; height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--brand-50);
    color: var(--brand);
    font-size: .78rem;
    font-weight: 700;
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
}
/* Initials show underneath; the photo covers them once it loads */
.avatar::before, .hero-avatar::before { content: attr(data-initials); }
.avatar > img, .hero-avatar > img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}
.user-btn .uname {
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: capitalize;
}
.user-btn .fa-chevron-down { font-size: .7rem; color: var(--ink-3); }
.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 250px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    z-index: 1050;
}
.user-menu.open .user-dropdown { display: block; animation: pop .15s ease-out; }
.user-dropdown .head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.user-dropdown .head strong { display: block; font-size: .9rem; text-transform: capitalize; }
.user-dropdown .head span { font-size: .78rem; color: var(--ink-3); }
.user-dropdown a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--ink-2) !important;
    font-size: .88rem;
    text-decoration: none !important;
}
.user-dropdown a i { width: 16px; text-align: center; color: var(--ink-3); }
.user-dropdown a:hover { background: var(--canvas); color: var(--ink) !important; }
.user-dropdown a.danger { color: var(--danger) !important; }
.user-dropdown a.danger i { color: var(--danger); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Guest header */
.guest-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.guest-header .inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.guest-header img { width: 52px; height: 52px; object-fit: contain; }
.guest-header .name { font-weight: 800; color: var(--brand-700); font-size: 1.05rem; line-height: 1.2; }
.guest-header .sub { color: var(--ink-3); font-size: .8rem; }
.guest-header .help { margin-left: auto; font-size: .85rem; color: var(--ink-2) !important; white-space: nowrap; }

/* Content */
.app-content {
    flex: 1;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 28px 40px;
}
.app.guest .app-content { max-width: 1200px; }

/* Neutralise legacy theme wrappers used inside pages */
.portal .main-section,
.portal .page-section,
.portal .content { margin: 0 !important; padding: 0; border: 0 !important; background: none; }
.portal .app-content .container,
.portal .app-content .container-fluid { max-width: 100%; padding-left: 0; padding-right: 0; }
.portal .app-content .container .container { padding: 0; }
.portal .app-content .row { margin-left: -12px; margin-right: -12px; }
.portal .app-content .row > [class*="col-"] { padding-left: 12px; padding-right: 12px; }

/* Footer */
.app-footer {
    padding: 18px 28px;
    border-top: 1px solid var(--line);
    color: var(--ink-3);
    font-size: .8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    justify-content: space-between;
    background: #fff;
}
.app-footer a { color: var(--ink-2) !important; }

/* ---------- Cards / boxes ---------- */
.portal .card,
.portal .cs-tabs.box,
.portal .box,
.portal .login-pane,
.portal .panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.portal .cs-tabs.box,
.portal .box { padding: 24px; float: none; }
.portal .cs-tabs.box[class*="col-md-"]:not(.col-md-12) { margin-left: auto; margin-right: auto; }
.portal .card { overflow: hidden; }
.portal .card-header,
.portal .panel-heading {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 16px 22px;
    font-weight: 700;
    font-size: 1rem;
    color: var(--ink);
}
.portal .card-body, .portal .panel-body { padding: 22px; }
.portal .card-footer { background: var(--canvas); border-top: 1px solid var(--line); padding: 14px 22px; }
.portal .sectionheading {
    font-weight: 700;
    font-size: 1rem;
    color: var(--brand-700);
    padding: 10px 0;
    margin-bottom: 10px;
    border-bottom: 2px solid var(--brand-50);
}
.portal .sectiondiv { margin-bottom: 20px; }

/* Tabs (BS3 markup + BS4 CSS) */
.portal .nav-tabs {
    border-bottom: 1px solid var(--line);
    margin: -4px 0 20px;
    padding: 0;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
.portal .nav-tabs::-webkit-scrollbar { display: none; }
.portal .nav-tabs > li { list-style: none; margin-bottom: -1px; }
.portal .nav-tabs > li > a,
.portal .nav-tabs .nav-link {
    display: block;
    padding: 10px 16px;
    border: 0 !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0;
    color: var(--ink-3) !important;
    font-weight: 600;
    font-size: .92rem;
    white-space: nowrap;
    text-decoration: none !important;
    background: none !important;
}
.portal .nav-tabs > li > a:hover,
.portal .nav-tabs .nav-link:hover { color: var(--ink) !important; }
.portal .nav-tabs > li.active > a,
.portal .nav-tabs .nav-link.active {
    color: var(--brand) !important;
    border-bottom-color: var(--brand) !important;
}
.portal .tab-content { border: 0; padding: 0; background: none; }
.portal .tab-content > .tab-pane { display: none; }
.portal .tab-content > .active { display: block; }

/* ---------- Forms ---------- */
.portal label,
.portal .col-form-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 6px;
}
.portal .form-control,
.portal .custom-select,
.portal select,
.portal textarea,
.portal input[type="text"],
.portal input[type="password"],
.portal input[type="email"],
.portal input[type="number"],
.portal input[type="date"],
.portal input[type="tel"] {
    font-family: var(--font);
    font-size: .93rem;
    color: var(--ink);
    border: 1px solid #d5dbe3;
    border-radius: var(--radius-sm);
    background-color: #fff;
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}
.portal .form-control,
.portal .custom-select { height: auto; min-height: 44px; padding: 10px 14px; }
.portal textarea.form-control { min-height: 96px; }
.portal select.form-control { padding-right: 34px; }
.portal .form-control:focus,
.portal .custom-select:focus,
.portal select:focus,
.portal textarea:focus,
.portal input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(15, 107, 69, .12);
    outline: none;
}
.portal .form-control[readonly],
.portal .form-control:disabled {
    background-color: #f6f8fa;
    color: var(--ink-2);
    border-color: var(--line);
}
.portal .form-control::placeholder { color: #a3acb9; }
/* Keep valid fields calm — only flag real errors */
.portal .form-control.is-valid,
.portal .custom-select.is-valid { border-color: #d5dbe3; background-image: none; padding-right: 14px; }
.portal .form-control.is-valid:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(15, 107, 69, .12); }
.portal .form-control.is-invalid { border-color: var(--danger); background-image: none; }
.portal .form-control.is-invalid:focus { box-shadow: 0 0 0 4px rgba(214, 69, 69, .12); }
.portal .invalid-feedback { font-size: .8rem; font-weight: 500; }
.portal .is-invalid ~ .invalid-feedback,
.portal .invalid-feedback strong { display: block; }
.portal .form-text, .portal small.text-muted { font-size: .78rem; color: var(--ink-3) !important; }
.portal .input-group-text { background: var(--canvas); border-color: #d5dbe3; border-radius: var(--radius-sm); }
.portal .form-check-input { margin-top: .35rem; }
.portal input[type="checkbox"], .portal input[type="radio"] { accent-color: var(--brand); }
.portal input[type="file"] { font-size: .88rem; max-width: 100%; }

/* ---------- Buttons ---------- */
.portal .btn {
    font-family: var(--font);
    font-weight: 600;
    font-size: .9rem;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    line-height: 1.3;
    border-width: 1px;
    box-shadow: none;
    text-shadow: none;
    background-image: none;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
    white-space: normal;
}
.portal .btn:active { transform: translateY(1px); }
.portal .btn-sm { padding: 6px 12px; font-size: .8rem; border-radius: 8px; }
.portal .btn-lg { padding: 13px 24px; font-size: 1rem; }
.portal .btn-success,
.portal .btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.portal .btn-success:hover, .portal .btn-success:focus,
.portal .btn-primary:hover, .portal .btn-primary:focus {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
    box-shadow: 0 6px 16px rgba(15, 107, 69, .25);
}
.portal .btn-info { background: var(--info); border-color: var(--info); color: #fff; }
.portal .btn-info:hover { background: #1d4fa3; border-color: #1d4fa3; color: #fff; }
.portal .btn-warning { background: var(--accent); border-color: var(--accent); color: #fff; }
.portal .btn-warning:hover { background: #b87500; border-color: #b87500; color: #fff; }
.portal .btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.portal .btn-danger:hover { background: #b93636; border-color: #b93636; color: #fff; }
.portal .btn-default,
.portal .btn-secondary,
.portal .btn-light {
    background: #fff;
    border-color: #d5dbe3;
    color: var(--ink);
}
.portal .btn-default:hover,
.portal .btn-secondary:hover,
.portal .btn-light:hover { background: var(--canvas); border-color: #c3cbd6; color: var(--ink); }
.portal .btn-outline-success, .portal .btn-outline-primary { color: var(--brand); border-color: var(--brand); background: #fff; }
.portal .btn-outline-success:hover, .portal .btn-outline-primary:hover { background: var(--brand); color: #fff; }
.portal .btn-link { color: var(--brand); }

/* ---------- Tables ---------- */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}
.table-wrap > .table { margin-bottom: 0; }
.portal .table {
    color: var(--ink);
    font-size: .9rem;
    background: #fff;
    border-collapse: separate;
    border-spacing: 0;
}
.portal .table th,
.portal .table td {
    padding: 12px 14px;
    vertical-align: middle;
    border-top: 1px solid var(--line-2);
}
.portal .table thead th,
.portal .table > tbody > tr:first-child > th {
    background: #f7f9fb;
    color: var(--ink-2);
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.portal .table-bordered { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.portal .table-bordered th,
.portal .table-bordered td { border-color: var(--line-2); }
.portal .table-striped tbody tr:nth-of-type(odd) { background: #fafbfc; }
.portal .table-hover tbody tr:hover,
.portal .table tbody tr:hover { background: #f5faf7; }
.portal .table-condensed th, .portal .table-condensed td,
.portal .table-sm th, .portal .table-sm td { padding: 8px 10px; }

/* ---------- Alerts / badges ---------- */
.portal .alert {
    border: 1px solid transparent;
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: .9rem;
    margin-bottom: 18px;
}
.portal .alert p:last-child, .portal .alert ul:last-child { margin-bottom: 0; }
.portal .alert-danger { background: var(--danger-50); border-color: #f5c9c9; border-left-color: var(--danger); color: #8f2a2a; }
.portal .alert-success { background: var(--success-50); border-color: #bfe5d2; border-left-color: var(--success); color: #0c5a3a; }
.portal .alert-warning { background: var(--warning-50); border-color: #f6dca8; border-left-color: var(--warning); color: #7a4a00; }
.portal .alert-info { background: var(--info-50); border-color: #c8dafa; border-left-color: var(--info); color: #1d4589; }
.portal .alert .close { opacity: .5; text-shadow: none; }
.portal .badge {
    font-weight: 600;
    font-size: .74rem;
    padding: .4em .75em;
    border-radius: 999px;
}
.portal .badge-success { background: var(--success-50); color: var(--success); }
.portal .badge-danger { background: var(--danger-50); color: var(--danger); }
.portal .badge-warning { background: var(--warning-50); color: var(--warning); }
.portal .badge-info, .portal .badge-primary { background: var(--info-50); color: var(--info); }

.portal .img-thumbnail {
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    padding: 4px;
    box-shadow: var(--shadow-sm);
}

/* ---------- Bootstrap 3 JS ↔ Bootstrap 4 CSS compatibility ---------- */
.fade.in { opacity: 1; }
.modal.in .modal-dialog { transform: none; }
.modal-backdrop.in { opacity: .5; }
.collapse.in { display: block; }
.open > .dropdown-menu { display: block; }
.tooltip.in { opacity: .95; }
.popover.in { display: block; }
.portal .modal-content { border: 0; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.portal .modal-header { border-bottom: 1px solid var(--line); padding: 18px 22px; }
.portal .modal-body { padding: 22px; }
.portal .modal-footer { border-top: 1px solid var(--line); padding: 14px 22px; }
.portal .dropdown-menu { border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 6px; }
.portal .dropdown-item { border-radius: 6px; padding: 8px 12px; font-size: .9rem; }

/* jQuery UI datepicker polish */
.ui-datepicker { border-radius: var(--radius-sm) !important; box-shadow: var(--shadow-lg); border: 1px solid var(--line) !important; font-family: var(--font) !important; padding: 8px !important; z-index: 1060 !important; }
.ui-datepicker .ui-datepicker-header { background: var(--brand) !important; border: 0 !important; color: #fff !important; border-radius: 8px !important; }
.ui-datepicker .ui-state-active { background: var(--brand) !important; border-color: var(--brand) !important; color: #fff !important; }

/* ---------- Reusable page components ---------- */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}
.page-head h2 { margin: 0; font-size: 1.5rem; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }

.hero-card {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    padding: 28px;
    color: #fff;
    background:
        radial-gradient(600px 240px at 100% 0%, rgba(217, 138, 0, .35), transparent 60%),
        linear-gradient(135deg, #0f6b45 0%, #0a4a30 100%);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.hero-card h2 { color: #fff !important; margin: 0 0 6px; font-size: 1.6rem; }
.hero-card p { color: #cfe8db; margin: 0; }
.hero-card .hero-row { display: flex; align-items: center; gap: 20px; position: relative; z-index: 1; }
.hero-card .hero-avatar {
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    width: 84px; height: 84px;
    border-radius: 18px;
    border: 3px solid rgba(255, 255, 255, .35);
    background: rgba(255, 255, 255, .15);
    flex-shrink: 0;
}
.hero-card .hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hero-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: .8rem;
    font-weight: 500;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.tile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    text-decoration: none !important;
    color: var(--ink) !important;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-100); }
.tile .tile-ico {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: grid; place-items: center;
    font-size: 1.15rem;
    background: var(--brand-50);
    color: var(--brand);
}
.tile.amber .tile-ico { background: var(--accent-50); color: var(--accent); }
.tile.blue .tile-ico { background: var(--info-50); color: var(--info); }
.tile.rose .tile-ico { background: var(--danger-50); color: var(--danger); }
.tile.violet .tile-ico { background: #f1edfd; color: #6b4fd8; }
.tile.slate .tile-ico { background: #eef1f5; color: #46536a; }
.tile strong { font-size: 1rem; }
.tile span { font-size: .84rem; color: var(--ink-3); line-height: 1.45; }
.tile .go { margin-top: auto; font-size: .82rem; font-weight: 600; color: var(--brand); }

.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps > li {
    position: relative;
    padding: 0 0 22px 52px;
    counter-increment: step;
}
.steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0; top: 0;
    width: 34px; height: 34px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--brand-50);
    color: var(--brand);
    font-weight: 700;
    font-size: .88rem;
}
.steps > li::after {
    content: "";
    position: absolute;
    left: 16px; top: 38px; bottom: 4px;
    width: 2px;
    background: var(--line-2);
}
.steps > li:last-child { padding-bottom: 0; }
.steps > li:last-child::after { display: none; }
.steps h4 { margin: 5px 0 4px; font-size: .98rem; }
.steps p { margin: 0 0 6px; color: var(--ink-2); font-size: .9rem; }

.callout {
    display: flex;
    gap: 14px;
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    margin: 10px 0;
}
.callout > i { font-size: 1.1rem; margin-top: 2px; }
.callout ul { margin: 6px 0 0; padding-left: 18px; }
.callout ul li { margin-bottom: 4px; }
.callout.danger { background: var(--danger-50); color: #8f2a2a; }
.callout.warn { background: var(--warning-50); color: #7a4a00; }
.callout.info { background: var(--info-50); color: #1d4589; }
.callout strong { color: inherit; }

/* Fees: session list */
.session-list { display: grid; gap: 12px; }
.session-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none !important;
    color: var(--ink) !important;
    transition: box-shadow .15s, border-color .15s, transform .15s;
}
.session-item:hover { box-shadow: var(--shadow); border-color: var(--brand-100); transform: translateY(-1px); }
.session-item .s-ico {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: grid; place-items: center;
    background: var(--warning-50);
    color: var(--warning);
    flex-shrink: 0;
}
.session-item.paid .s-ico { background: var(--success-50); color: var(--success); }
.session-item .s-body { flex: 1; min-width: 0; }
.session-item .s-title { font-weight: 700; font-size: 1rem; }
.session-item .s-sub { font-size: .8rem; color: var(--ink-3); }
.progress-bar-track { height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; margin-top: 8px; }
.progress-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #f0a92b); }
.session-item.paid .progress-bar-fill { background: linear-gradient(90deg, var(--brand), #22a06b); }
.session-item .s-pct { font-weight: 700; font-size: 1.05rem; min-width: 56px; text-align: right; }
.session-item .fa-chevron-right { color: var(--ink-3); font-size: .8rem; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty-state i { font-size: 2.2rem; color: #c3cbd6; margin-bottom: 10px; display: block; }

/* Notice card (status / error / success pages) */
.notice-card {
    max-width: 580px;
    margin: 24px auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 40px 32px 34px;
    text-align: center;
}
.notice-card .notice-ico {
    width: 72px; height: 72px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 1.7rem;
}
.notice-card h2 { font-size: 1.35rem; margin: 0 0 10px; }
.notice-card .notice-body { color: var(--ink-2); font-size: .95rem; }
.notice-card .notice-body p { margin-bottom: 8px; }
.notice-card .notice-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.notice-card.tone-success .notice-ico { background: var(--success-50); color: var(--success); box-shadow: 0 0 0 8px rgba(19, 134, 90, .06); }
.notice-card.tone-danger .notice-ico { background: var(--danger-50); color: var(--danger); box-shadow: 0 0 0 8px rgba(214, 69, 69, .06); }
.notice-card.tone-warning .notice-ico { background: var(--warning-50); color: var(--warning); box-shadow: 0 0 0 8px rgba(199, 119, 0, .06); }
.notice-card.tone-info .notice-ico { background: var(--info-50); color: var(--info); box-shadow: 0 0 0 8px rgba(37, 99, 201, .06); }

.milestone { position: relative; margin: 22px 0 34px; text-align: left; }
.milestone-marker { position: absolute; top: -4px; width: 2px; height: 20px; background: var(--ink); transform: translateX(-1px); }
.milestone-marker span { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .72rem; font-weight: 700; color: var(--ink-2); }

/* Stat cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat .stat-ico {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: grid; place-items: center;
    background: var(--brand-50);
    color: var(--brand);
    flex-shrink: 0;
}
.stat.amber .stat-ico { background: var(--accent-50); color: var(--accent); }
.stat.blue .stat-ico { background: var(--info-50); color: var(--info); }
.stat.rose .stat-ico { background: var(--danger-50); color: var(--danger); }
.stat .stat-label { font-size: .78rem; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .stat-value { font-size: 1.3rem; font-weight: 800; color: var(--ink); line-height: 1.25; font-variant-numeric: tabular-nums; }

/* Progress ring */
.ring {
    --p: 0;
    --c: var(--brand);
    width: 120px; height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line-2) 0);
    display: grid; place-items: center;
    flex-shrink: 0;
}
.ring::before {
    content: "";
    grid-area: 1 / 1;
    width: 92px; height: 92px;
    border-radius: 50%;
    background: #fff;
}
.ring span { grid-area: 1 / 1; font-weight: 800; font-size: 1.35rem; color: var(--ink); z-index: 1; }
.ring small { display: block; font-size: .68rem; color: var(--ink-3); font-weight: 600; text-align: center; }

.summary-card { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.summary-card .stat-grid { flex: 1; margin: 0; min-width: 260px; }

/* Key / value grid */
.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 20px;
}
.kv-grid > div {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-2);
    border-right: 1px solid var(--line-2);
    background: #fff;
    min-width: 0;
}
.kv-grid dt, .kv-grid .k { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: 0; }
.kv-grid dd, .kv-grid .v { margin: 2px 0 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }

/* Option cards (payment plans, choices) */
.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.option-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 22px;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    text-decoration: none !important;
    color: var(--ink) !important;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.option-card:hover { border-color: var(--brand); box-shadow: 0 8px 24px rgba(15, 107, 69, .12); transform: translateY(-2px); }
.option-card .opt-pct { font-size: 2rem; font-weight: 800; color: var(--brand); line-height: 1; }
.option-card .opt-title { font-weight: 700; font-size: 1.02rem; }
.option-card .opt-sub { font-size: .85rem; color: var(--ink-3); }
.option-card .opt-go { margin-top: 8px; font-weight: 600; font-size: .88rem; color: var(--brand); }

/* Money table helpers */
.portal .table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.portal .table tfoot th, .portal .table tfoot td, .portal .table tr.total th, .portal .table tr.total td {
    background: #f7f9fb;
    font-weight: 800;
    font-size: .95rem;
    border-top: 2px solid var(--line);
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink);
}
.pay-box {
    text-align: center;
    padding: 26px 20px;
    border-radius: var(--radius);
    background: var(--brand-50);
    border: 1px dashed var(--brand-100);
}
.pay-box .pay-label { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--brand-700); }
.pay-box .pay-amount { font-size: 2.4rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; margin: 4px 0 16px; overflow-wrap: anywhere; }
.pay-box .remita { max-width: 260px; width: 100%; height: auto; display: block; margin: 14px auto 0; opacity: .9; }
.pay-box input.amount-input {
    max-width: 320px;
    margin: 6px auto 16px;
    font-size: 1.8rem !important;
    font-weight: 700;
    text-align: center;
    min-height: 64px !important;
}

/* Forms: required marker + sticky action bar */
.req { color: var(--danger); font-weight: 700; }
.form-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 18px;
    margin: 0 0 24px;
    background: rgba(255, 255, 255, .95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 -4px 20px rgba(16, 24, 40, .06);
}

/* Profile header */
.profile-head { display: flex; gap: 24px; align-items: flex-start; }
.profile-photo {
    position: relative;
    width: 132px; height: 156px;
    border-radius: var(--radius);
    background: var(--brand-50);
    color: var(--brand);
    font-size: 2rem;
    font-weight: 800;
    display: grid; place-items: center;
    flex-shrink: 0;
    border: 1px solid var(--line);
}
.profile-photo::before { content: attr(data-initials); }
.profile-photo > img {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
}
.profile-photo .photo-edit {
    position: absolute;
    right: -8px; bottom: -8px;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--brand);
    color: #fff !important;
    border: 3px solid #fff;
    font-size: .8rem;
    box-shadow: var(--shadow);
}
@media (max-width: 767.98px) {
    .profile-head { flex-direction: column; align-items: center; }
    .profile-head .kv-grid { width: 100%; }
    .form-actions { justify-content: stretch; }
    .form-actions .btn { flex: 1; white-space: nowrap; padding-left: 10px; padding-right: 10px; }
    .kv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kv-grid > div { padding: 10px 12px; }
}
@media (max-width: 359.98px) { .kv-grid { grid-template-columns: 1fr; } }
.portal .table code { white-space: nowrap; }

/* Course registration */
.session-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.history-list { display: grid; gap: 10px; }
.history-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.history-item .h-title { font-weight: 700; }
.history-item .h-links { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head .crumbs { font-size: .85rem; }
.page-head .crumbs i { font-size: .6rem; margin: 0 6px; opacity: .6; }
.seg-form { margin-bottom: 20px; }
.seg {
    display: inline-flex;
    padding: 4px;
    background: #e9edf2;
    border-radius: 12px;
    gap: 4px;
    max-width: 100%;
}
.seg input[type="submit"], .seg .seg-off {
    border: 0;
    background: transparent;
    padding: 9px 18px;
    border-radius: 9px;
    font-family: var(--font);
    font-weight: 600;
    font-size: .9rem;
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
}
.seg .seg-off { color: #a3acb9; cursor: default; }
.seg input[type="submit"]:hover { color: var(--ink); }
.seg input[type="submit"].on { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }
.portal .course-info i { color: var(--info) !important; line-height: 1 !important; font-size: 1.15rem; }

/* Course selection: each <tr> is laid out as a card with CSS grid.
   DOM order/content is untouched because the registration scripts read cells by position. */
.how-to { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 0; margin: 0 0 16px; font-size: .85rem; color: var(--ink-2); }
.how-to li { display: flex; align-items: center; gap: 8px; }
.how-to span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); font-weight: 700; font-size: .75rem; }
.course-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.course-search { flex: 1; min-width: 220px; }
.chip-group { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 999px; padding: 7px 14px; font-size: .82rem; font-weight: 600; cursor: pointer; font-family: var(--font); }
.chip:hover { border-color: #c3cbd6; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.portal table.course-cards { display: block; width: 100%; border: 0; background: none; }
.portal table.course-cards > tbody {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 14px;
}
.portal table.course-cards tr:first-child { display: none; }            /* header row */
.portal table.course-cards tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    grid-template-areas:
        "code   status unit"
        "title  title  info"
        "lec    lab    chk";
    gap: 6px 10px;
    align-items: center;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.portal table.course-cards tr:hover { border-color: #c9d3de; box-shadow: var(--shadow-sm); }
.portal table.course-cards tr[style*="display: none"] { display: none !important; }
.portal table.course-cards td { display: block; padding: 0; border: 0; min-width: 0; background: none; }
.portal table.course-cards td:nth-child(1) { display: none; }          /* serial no. (still in DOM for scripts) */
.portal table.course-cards td:nth-child(2) { grid-area: code; font-weight: 800; font-size: 1rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal table.course-cards td:nth-child(3) { grid-area: title; font-size: .9rem; color: var(--ink-2); line-height: 1.35; min-height: 2.7em; }
.portal table.course-cards td:nth-child(4) {
    grid-area: unit; justify-self: end;
    font-weight: 700; font-size: .78rem; color: var(--brand-700);
    background: var(--brand-50); border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.portal table.course-cards td:nth-child(4)::after { content: " CU"; font-weight: 600; }
.portal table.course-cards td:nth-child(5) {
    grid-area: status; justify-self: start;
    font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--ink-3); background: #f1f4f7; border-radius: 6px; padding: 3px 8px; white-space: nowrap;
}
.portal table.course-cards td:nth-child(6) { grid-area: info; justify-self: end; align-self: start; }
.portal table.course-cards td:nth-child(7) { grid-area: lec; }
.portal table.course-cards td:nth-child(8) { grid-area: lab; }
.portal table.course-cards td:nth-child(7)::before,
.portal table.course-cards td:nth-child(8)::before {
    display: block; margin: 6px 0 3px;
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3);
}
.portal table.course-cards td:nth-child(7)::before { content: "Lecture"; }
.portal table.course-cards td:nth-child(8)::before { content: "Lab"; }
/* No lab groups (only a "None" option): hide the lab picker, let lecture take the space */
.portal table.course-cards tr:has(td:nth-child(8) option:only-child[value=""]) {
    grid-template-areas: "code status unit" "title title info" "lec lec chk";
}
.portal table.course-cards td:nth-child(8):has(option:only-child[value=""]) { display: none; }
.portal table.course-cards select {
    width: 100%; min-height: 40px; padding: 6px 10px; font-size: .88rem;
    border: 1px solid #d5dbe3; border-radius: var(--radius-sm); background-color: #fff;
}
/* Register toggle: the whole cell is clickable (see page script); the checkbox stays the real control. */
.portal table.course-cards td:nth-child(9) {
    grid-area: chk; align-self: end;
    display: flex; align-items: center; gap: 8px;
    min-height: 40px; padding: 0 14px 0 12px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--brand);
    color: var(--brand); font-weight: 700; font-size: .85rem;
    cursor: pointer; user-select: none; white-space: nowrap;
    transition: background .15s, color .15s;
}
.portal table.course-cards td:nth-child(9)::after { content: "Register"; pointer-events: none; }
.portal table.course-cards td:nth-child(9):hover { background: var(--brand-50); }
.portal table.course-cards input.register-course-chkbox { width: 20px; height: 20px; margin: 0; cursor: pointer; accent-color: var(--brand); }

/* Registered state */
.portal table.course-cards tr:has(.register-course-chkbox:checked) { border-color: var(--brand); background: linear-gradient(0deg, #fff, #fff), var(--brand-50); box-shadow: 0 0 0 3px rgba(15, 107, 69, .08); }
.portal table.course-cards tr:has(.register-course-chkbox:checked) td:nth-child(9) { background: var(--brand); color: #fff; }
.portal table.course-cards tr:has(.register-course-chkbox:checked) td:nth-child(9)::after { content: "Registered"; }
.portal table.course-cards tr:has(.register-course-chkbox:checked) input.register-course-chkbox { accent-color: #fff; }

@media (max-width: 575.98px) {
    .portal table.course-cards > tbody { grid-template-columns: 1fr; }
    .portal table.course-cards tr {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
        grid-template-areas:
            "code  status unit"
            "title title  info"
            "lec   lab    lab"
            "chk   chk    chk";
    }
    .portal table.course-cards tr:has(td:nth-child(8) option:only-child[value=""]) {
        grid-template-areas: "code status unit" "title title info" "lec lec lec" "chk chk chk";
    }
    .portal table.course-cards td:nth-child(9) { justify-content: center; min-height: 46px; margin-top: 4px; }
    .how-to { flex-direction: column; gap: 6px; }
}
.unit-meter { padding: 14px 16px; background: var(--brand-50); border-radius: var(--radius-sm); margin-bottom: 14px; }
.unit-meter small { font-size: .85rem; color: var(--ink-3); font-weight: 600; }
@media (min-width: 1200px) { .reg-summary { position: sticky; top: 84px; } }

/* Timetable */
.tt-legend { display: flex; gap: 16px; font-size: .85rem; color: var(--ink-2); flex-wrap: wrap; }
.tt-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }
.tt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tt-grid { min-width: 1120px; }
.tt-grid .row { margin: 0 !important; flex-wrap: nowrap; }
.tt-grid .col-timetable-1 {
    flex: 0 0 7.142857%;
    max-width: 7.142857%;
    min-height: 88px;
    padding: 4px !important;
    border-right: 1px solid var(--line-2);
    border-bottom: 1px solid var(--line-2);
    position: relative;
    overflow: visible;
}
.tt-grid .row.time .col-timetable-1 { min-height: 0; padding: 10px 6px !important; background: #f7f9fb; font-size: .74rem; color: var(--ink-3); text-align: center; }
.tt-grid .row > .col-timetable-1:first-child {
    position: sticky; left: 0; z-index: 2;
    background: #f7f9fb;
    font-size: .8rem;
    display: flex; align-items: center; padding: 8px !important;
}
.tt-grid .period {
    position: relative;
    z-index: 1;
    margin-top: 4px;
    min-height: 76px;
    padding: 8px;
    border-radius: 8px;
    color: #fff;
    font-size: .74rem;
    font-weight: 600;
    line-height: 1.35;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}
.tt-grid .period .viewinfo { color: #fff !important; margin-left: 4px; font-size: .95rem; }

/* Accommodation */
.terms-box {
    max-height: 320px;
    overflow-y: auto;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fafbfc;
    font-size: .9rem;
    color: var(--ink-2);
    text-align: justify;
    margin-bottom: 16px;
}
.reason-list { list-style: none; padding: 0; margin: 14px 0 0; text-align: left; display: grid; gap: 8px; }
.reason-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; background: #f7f9fb; border-radius: 10px; font-size: .9rem; }
.reason-list i { color: var(--warning); width: 18px; text-align: center; margin-top: 3px; }
.bed-legend { display: flex; gap: 16px; font-size: .85rem; color: var(--ink-2); }
.bed-legend .free { color: var(--brand); }
.bed-legend .taken { color: #b8c1cc; }
.portal .blocksection { font-size: .95rem; margin: 6px 0 12px; color: var(--ink-2); }
.portal .blocksection ~ .blocksection { margin-top: 24px; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.room { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.room.full { opacity: .65; }
.roomtitle { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; background: #f7f9fb; border-bottom: 1px solid var(--line-2); }
.roomtitle .blkname { display: block; font-size: .7rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.roomtitle .rmno { font-weight: 700; }
.bedspacewrapper { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; }
.bedspace {
    width: 46px; height: 40px;
    border-radius: 8px;
    display: grid; place-items: center;
    font-size: 1.05rem;
    border: 1px solid transparent;
}
.bedspaceoccupied { background: #eef1f5; color: #b8c1cc; cursor: not-allowed; }
button.bedspacefree { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); cursor: pointer; transition: background .15s, transform .1s; }
button.bedspacefree:hover, button.bedspacefree:focus { background: var(--brand); color: #fff; transform: translateY(-1px); }
.occupant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.occupant { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.occupant.me { border-color: var(--brand-100); background: var(--brand-50); }
.occ-meta { font-size: .8rem; color: var(--ink-3); overflow-wrap: anywhere; }
.d-grid-actions .btn + .btn { margin-top: 8px; }
.txn-card { border: 1px solid var(--line); border-left: 4px solid var(--warning); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; }
.txn-card.paid { border-left-color: var(--success); }
.txn-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.txn-head code { font-size: .95rem; color: var(--ink); font-weight: 700; }
.txn-actions { margin-top: 12px; text-align: right; }

/* Printable documents */
.print-doc {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 24px;
}
.doc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 18px;
    margin-bottom: 22px;
    border-bottom: 2px solid var(--brand);
}
.doc-logo { max-height: 64px; width: auto; }
.doc-title { text-align: right; }
.doc-title strong { display: block; font-size: 1.15rem; }
.doc-title span { font-size: .8rem; color: var(--ink-3); }
.portal .doc-section {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--brand-700);
    margin: 24px 0 10px;
}

/* ID card */
.id-card {
    max-width: 560px;
    margin: 0 auto 24px;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--line);
}
.id-top {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #0f6b45, #0a4a30);
    color: #fff;
}
.id-top img { max-height: 40px; background: #fff; border-radius: 8px; padding: 4px 8px; }
.id-top span { font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.id-body { display: flex; gap: 20px; padding: 20px; }
.id-body .profile-photo { width: 120px; height: 144px; }
.id-info { flex: 1; min-width: 0; }
.id-name { font-size: 1.15rem; font-weight: 800; text-transform: capitalize; }
.id-prog { font-size: .85rem; color: var(--brand); font-weight: 600; margin-bottom: 10px; }
.id-info dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: .85rem; }
.id-info dt { color: var(--ink-3); font-weight: 500; }
.id-info dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.id-foot { padding: 12px 20px; background: #f7f9fb; border-top: 1px solid var(--line); font-size: .8rem; display: grid; gap: 4px; }
.id-foot span { color: var(--ink-3); margin-right: 8px; font-weight: 600; text-transform: uppercase; font-size: .7rem; letter-spacing: .05em; }
@media (max-width: 480px) { .id-body { flex-direction: column; align-items: center; text-align: center; } .id-info dl { text-align: left; } }
@media print {
    .print-doc, .id-card { box-shadow: none !important; border-color: #ccc; padding: 0; }
    .kv-grid { break-inside: avoid; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* O-Level sittings */
.sitting-toggle { display: flex !important; align-items: center; gap: 10px; font-size: 1rem !important; color: var(--ink) !important; font-weight: 700 !important; cursor: pointer; }
.sitting-toggle input { width: 18px; height: 18px; }
.subject-head { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: 6px 0 8px; }
.portal .subject-table { margin: 0; }
.portal .subject-table th, .portal .subject-table td { padding: 6px 8px; }
.portal .subject-table td:first-child { color: var(--ink-3); font-weight: 600; }
.portal .subject-table select,
.portal .sitting-card select {
    width: 100%;
    min-height: 40px;
    padding: 6px 10px;
    background-color: #fff;
}
.portal .subject-table select:disabled, .portal .sitting-card .form-control:disabled { background: #f3f5f8; color: var(--ink-3); cursor: not-allowed; }

/* Photo upload */
.upload-layout { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; }
.upload-form { flex: 1; min-width: 240px; max-width: 460px; }
.dropzone {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 28px 20px;
    border: 2px dashed #c9d3de;
    border-radius: var(--radius);
    background: #fafbfc;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: .9rem !important;
    color: var(--ink) !important;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--brand); background: var(--brand-50); }
.dropzone i { font-size: 1.8rem; color: var(--brand); }
.dropzone span { font-weight: 400; color: var(--ink-3); font-size: .82rem; overflow-wrap: anywhere; }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.tips { list-style: none; padding: 0; margin: 18px 0; font-size: .86rem; color: var(--ink-2); }
.tips li { margin-bottom: 6px; }
.tips i { color: var(--success); margin-right: 8px; }
@media (max-width: 767.98px) { .upload-layout { flex-direction: column; align-items: center; } .upload-form { max-width: none; width: 100%; } }

/* ---------- Toast notifications ---------- */
.toast-stack {
    position: fixed;
    top: 76px; right: 20px;
    z-index: 2000;
    display: flex; flex-direction: column; gap: 10px;
    width: 380px; max-width: calc(100vw - 32px);
    pointer-events: none;
}
.toast-item {
    position: relative;
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 40px 16px 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--info);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(24px);
    transition: opacity .22s ease, transform .22s ease;
}
.toast-item.show { opacity: 1; transform: none; }
.toast-item .t-ico { font-size: 1.15rem; margin-top: 1px; color: var(--info); }
.toast-item .t-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.toast-item .t-body strong { font-size: .9rem; color: var(--ink); }
.toast-item .t-body span { font-size: .86rem; color: var(--ink-2); overflow-wrap: anywhere; }
.toast-item .t-close {
    position: absolute; top: 8px; right: 8px;
    width: 26px; height: 26px; border: 0; border-radius: 6px;
    background: none; color: var(--ink-3); font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.toast-item .t-close:hover { background: var(--canvas); color: var(--ink); }
.toast-item .t-bar {
    position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
    background: currentColor; opacity: .25; transform-origin: left;
    animation: toast-bar linear forwards;
}
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.toast-item.t-success { border-left-color: var(--success); color: var(--success); }
.toast-item.t-success .t-ico { color: var(--success); }
.toast-item.t-error { border-left-color: var(--danger); color: var(--danger); }
.toast-item.t-error .t-ico { color: var(--danger); }
.toast-item.t-warning { border-left-color: var(--warning); color: var(--warning); }
.toast-item.t-warning .t-ico { color: var(--warning); }
.toast-item.t-info { color: var(--info); }
@media (max-width: 575.98px) {
    .toast-stack { top: auto; bottom: 16px; right: 16px; left: 16px; width: auto; }
    .toast-item { transform: translateY(16px); }
}
@media print { .toast-stack { display: none !important; } }

/* ---------- Login ---------- */
.auth-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    gap: 28px;
    align-items: start;
}
.auth-intro {
    border-radius: 22px;
    padding: 36px;
    color: #fff;
    background:
        radial-gradient(500px 260px at 0% 100%, rgba(217, 138, 0, .3), transparent 60%),
        linear-gradient(140deg, #0f6b45 0%, #0a3f2a 100%);
    box-shadow: var(--shadow);
}
.auth-intro .eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #ffd27a; }
.auth-intro h2 { color: #fff !important; font-size: 1.9rem; margin: 10px 0 12px; }
.auth-intro > p { color: #cfe8db; font-size: .98rem; max-width: 560px; }
.auth-intro .steps > li::before { background: rgba(255, 255, 255, .14); color: #fff; }
.auth-intro .steps > li::after { background: rgba(255, 255, 255, .12); }
.auth-intro .steps h4 { color: #fff !important; }
.auth-intro .steps p { color: #cfe8db; }
.auth-intro .btn-ghost {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .25);
    color: #fff !important;
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none !important;
    margin: 8px 0 26px;
}
.auth-intro .btn-ghost:hover { background: rgba(255, 255, 255, .2); }
.auth-intro .callout.danger { background: rgba(214, 69, 69, .18); color: #ffe1e1; }
.auth-intro .callout.warn { background: rgba(217, 138, 0, .2); color: #ffe8c2; }

.login-card {
    position: sticky;
    top: 24px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    padding: 34px 30px;
}
.login-card .lc-logo { width: 64px; height: 64px; object-fit: contain; margin-bottom: 14px; }
.login-card h3 { font-size: 1.4rem; margin: 0 0 4px; }
.login-card .lc-sub { color: var(--ink-3); font-size: .9rem; margin-bottom: 24px; }
.login-card .field { margin-bottom: 18px; }
.input-icon { position: relative; }
.input-icon > i.lead-ico {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--ink-3);
    pointer-events: none;
}
.input-icon .form-control { padding-left: 42px !important; }
.input-icon .toggle-pass {
    position: absolute;
    right: 6px; top: 50%;
    transform: translateY(-50%);
    border: 0; background: none;
    color: var(--ink-3);
    width: 36px; height: 36px;
    border-radius: 8px;
    cursor: pointer;
}
.input-icon .toggle-pass:hover { background: var(--canvas); color: var(--ink); }
.login-card .btn-block { padding: 13px; font-size: 1rem; margin-top: 6px; }
.login-card .lc-foot { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-2); font-size: .82rem; color: var(--ink-3); text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1199.98px) {
    .app-content { padding: 24px 22px 36px; }
}
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: none; }
    .app-main { margin-left: 0; }
    .topbar-toggle { display: inline-flex; }
    body.nav-open { overflow: hidden; }
    body.nav-open .app-sidebar { transform: none; box-shadow: var(--shadow-lg); }
    body.nav-open .sidebar-backdrop { display: block; opacity: 1; }
    .app-topbar { padding: 0 16px; }
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-wrap .login-col { order: -1; }
    .login-card { position: static; }
}
@media (max-width: 767.98px) {
    body.portal { font-size: 14.5px; }
    .app-content { padding: 18px 16px 30px; }
    .portal .cs-tabs.box, .portal .box { padding: 18px 16px; }
    .portal .card-body { padding: 18px 16px; }
    .portal .card-header { padding: 14px 16px; }
    .user-btn .uname, .user-btn .fa-chevron-down { display: none; }
    .user-btn { padding: 3px; }
    .status-pill .txt { display: none; }
    .status-pill { padding: 7px; }
    .hero-card { padding: 22px 18px; border-radius: 16px; }
    .hero-card h2 { font-size: 1.3rem; }
    .hero-card .hero-avatar { width: 64px; height: 64px; border-radius: 14px; }
    .auth-intro { padding: 26px 20px; border-radius: 18px; }
    .auth-intro h2 { font-size: 1.45rem; }
    .login-card { padding: 26px 20px; border-radius: 18px; }
    .tiles { grid-template-columns: 1fr 1fr; gap: 12px; }
    .tile { padding: 16px; }
    .tile span { display: none; }
    .guest-header .help { display: none; }
    .guest-header .inner { padding: 12px 16px; }
    .app-footer { padding: 16px; justify-content: center; text-align: center; }
    .portal .btn:not(.btn-sm) { min-height: 44px; }
    .portal .table th, .portal .table td { padding: 10px; }
    .portal .text-md-right { text-align: left !important; }
}
@media (max-width: 380px) {
    .tiles { grid-template-columns: 1fr; }
    .topbar-title .crumb { display: none; }
}

/* ---------- Print: show only page content ---------- */
@media print {
    .app-sidebar, .app-topbar, .app-footer, .sidebar-backdrop, .guest-header, .no-print { display: none !important; }
    .app-main { margin: 0 !important; }
    .app-content { padding: 0 !important; max-width: none; }
    body.portal { background: #fff; }
    .portal .card, .portal .box, .portal .cs-tabs.box { box-shadow: none; border-color: #ccc; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
