:root {
    --ctl-h: 44px;
    --ctl-radius: 10px;
    --ctl-border: rgba(0, 0, 0, 0.08);
    --ctl-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
    --ctl-sep: rgba(0, 0, 0, 0.08);

    --purple: #4f2d7f;
    --black: #000000;
    --white: #ffffff;
    --cyan: #00b1e1;
    --gray: #6d6e71;
    --lav: #8e7db3;
    --radius: 12px;
    --shadow: 0 6px 20px rgba(0, 0, 0, .08);

    --row-odd: #ffffff;
    --row-even: #faf7ff;
    --row-hover: #f2ecff;
    --row-focus: #e8defc;
    --focus-ring: 3px solid color-mix(in oklab, var(--cyan) 60%, white);
    --control-sep: color-mix(in oklab, var(--purple) 24%, white);
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    background: #fff;
    color: #000;
    border: 2px solid var(--purple);
    padding: 8px 12px;
    border-radius: 10px;
    z-index: 10000;
}

.skip-link:focus {
    left: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #fff;
    font: 16px/1.45 system-ui, Segoe UI, Roboto, Helvetica, Arial;
    color: var(--black);
}

.wrap {
    max-width: 100%;
    margin: 24px auto 0 auto;
    padding: 0 16px;
}

.titlebar {
    background: var(--purple);
    color: #fff;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.titlebar .brand {
    display: flex;
    max-width: 300px;
    width: 100%;
    align-items: center;
}

.titlebar .brand img.brand-mark {
    aspect-ratio: 1 / 1;
    height: auto;
    width: 100px;
    flex-shrink: 0;
}

.titlebar .brand h1 {
    margin: 0;
    font-size: 22px;
}

.meta {
    opacity: .9;
    font-size: 14px;
}

.tools {
    display: grid;
    grid-template-columns: 1fr auto minmax(260px, 340px) auto;
    gap: 12px;
    align-items: center;
}

.tools .search,
.tools .select,
.tools .btn {
    height: var(--ctl-h);
    border: 1px solid var(--ctl-border);
    background: var(--white);
    border-radius: var(--ctl-radius);
    box-shadow: var(--ctl-shadow);
}

.tools .search {
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tools .search input {
    border: 0;
    outline: 0;
    background: transparent;
    width: 100%;
    min-width: 0;
    font-size: 15px;
    padding: 6px 4px;
    color: #24143b;
}

.tools .search:focus-within {
    outline: 2px solid color-mix(in srgb, var(--purple) 60%, white);
    outline-offset: 2px;
}

.tools .select {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px 0 12px;
}

.tools .select.select--inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tools .select>span {
    display: inline-flex;
    align-items: center;
    color: var(--purple);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.tools .select>span::after {
    content: "";
    display: inline-block;
    width: 1px;
    height: 60%;
    margin-left: 12px;
    background: var(--ctl-sep);
}

.tools .select select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #24143b;
    font-size: 15px;
    line-height: normal;
    width: 100%;
    padding-right: 20px;
}

.tools .select::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(79, 45, 127, 0.9);
    border-bottom: 2px solid rgba(79, 45, 127, 0.9);
    pointer-events: none;
}

.tools .select:focus-within {
    outline: var(--focus-right);
    outline-offset: 2px;
}

.tools .btn {
    padding: 0 16px;
    font-weight: 700;
    cursor: pointer;
    background: var(--white);
    color: var(--purple);
    border-color: var(--white);
    display: none;
}

.tools .btn:hover {
    background: var(--purple);
    color: var(--white);
}

.pill {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
}

.btn {
    cursor: pointer;
    font-weight: 600;
}

.search input,
select#year-select {
    border: 0;
    outline: 0;
    background: transparent;
    min-width: min(60vw, 360px);
    padding: 6px 4px;
    font-size: 15px;
}

.card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, .06);
    box-shadow: var(--shadow);
    overflow: clip;
    margin-top: 12px;
}

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table.dataTable {
    width: 100% !important;
    box-sizing: border-box;
}

caption {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray);
    background: #faf8ff;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
}

thead th {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, #f5f1ff, #ede6ff);
    color: #24143b;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    border-bottom: 1px solid rgba(0, 0, 0, .1);
    white-space: nowrap;
}

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
    vertical-align: top;
    font-size: 15px;
}

tbody tr:nth-child(odd) td {
    background: var(--row-odd);
}

tbody tr:nth-child(even) td {
    background: var(--row-even);
}

tbody tr:hover td {
    background: var(--row-hover);
}

tbody tr:focus-within td {
    background: var(--row-focus);
}

tbody td a {
    color: var(--purple);
    text-decoration: none;
    border-bottom: 1px dashed rgba(79, 45, 127, .3);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
    border-radius: 8px;
}

tbody td a {
    color: var(--purple);
    text-decoration: none;
    border-bottom: 1px dashed rgba(79, 45, 127, 0.3);
}

tbody td a:hover,
tbody td a:focus-visible {
    text-decoration: underline;
}

.meeting-block {
    display: grid;
    gap: 4px;
}

.mt-time {
    font-weight: 600;
}

.mt-days {
    display: inline-grid;
    grid-auto-flow: column;
    gap: 4px;
}

.mt-days .d {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
    background: #fff;
    color: #4f2d7f;
    border: 1px solid rgba(79, 45, 127, .20);
}

.mt-days .d.on {
    background: #ece7ff;
    color: #22162f;
    border-color: rgba(79, 45, 127, .35);
}

.pill {
    font-size: 13px;
}

.server-pager {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 12px;
    border-top: 1px solid rgba(0, 0, 0, .06);
    background: #fafafa;
}

.server-pager a {
    padding: 6px 10px;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 8px;
    text-decoration: none;
    color: #222;
    background: #fff;
}

.server-pager .current {
    background: var(--purple);
    color: #fff;
    border-color: var(--purple)
}

/* Hide server pager when JS/DataTables loads (progressive) */
.js-on .server-pager {
    display: none;
}

/* DataTables small brand touch */
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--purple) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px;
}

.dt-bottom {
    background: #fafafa;
    padding: 10px;
}

.instr-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.instr-actions a,
.mini-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--purple);
    font-size: 13px;
    border-bottom: 1px dashed rgba(79, 45, 127, 0.3);
    padding-bottom: 1px;
}

.instr-actions a:hover,
.mini-links a:hover {
    text-decoration: underline;
}

.mini-links {
    margin-top: 6px;
    font-size: 13px;
}

.icon {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: none;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.loading-overlay.show {
    display: flex;
}

.loader {
    display: grid;
    gap: 12px;
    justify-items: center;
    color: var(--purple);
    font-weight: 600;
}

.spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 4px solid rgba(79, 45, 127, 0.25);
    border-top-color: var(--purple);
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation: none;
    }
}

.dataTables_length,
.dataTables_filter {
    display: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--purple) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px;
}

.hp-wrap {
    position: relative;
}

.hp-trap {
    position: absolute !important;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    opacity: 0;
    pointer-events: none;
}

.ss-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 9999;
}

.ss-modal.is-open {
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.55);
}

.ss-modal__loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.ss-modal.is-loading .ss-modal__loading {
    display: flex;
}

.ss-modal__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 999px;
    animation: ss-spin 0.8s linear infinite;
}
@keyframes ss-spin { to { transform: rotate(360deg); } }

.ss-modal__dialog {
    width: min(1200px, 94vw);
    height: min(900px, 86vh);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 45px rgba(0, 0, 0, .25);
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
}

.ss-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    background: #f7f7fb;
}

.ss-modal__title {
    font-weight: 700;
    font-size: 15px;
    color: #24143b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ss-modal__actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.ss-modal__btn {
    appearance: none;
    border: 1px solid rgba(0, 0, 0, .15);
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
}

.ss-modal__btn:hover {
    background: var(--purple);
    color: var(--white);
}

.ss-modal__btn--primary {
    background: var(--purple);
    color: var(--white);
    border-color: var(--purple);
}

.ss-modal__btn--primary:hover {
    background: var(--white);
    color: var(--purple);
}

.ss-modal__frame {
    width: 100%;
    height: 100%;
    border: 0;
}

#toast-box {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    font-family: system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    color: var(--white);
    background: var(--purple);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    min-width: 240px;
    max-width: 380px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.toast--warn {
    background: #b36a00;
}

.toast--error {
    background: #b32d2e;
}

.toast--success {
    background: #307a3e;
}

.toast--info {
    background: #4f2d7f;
}

.toast.is-in {
    opacity: 1;
    transform: translateY(0);
}

.toast.is-out {
    opacity: 0;
    transform: translateY(20px);
}

footer#course-footer {
    display: flex;
    justify-content: center;
    padding: 18px;
}

img.course-footer-img {
    max-width: 800px;
    width: 100%;
    height: auto;
}

@media (max-width: 980px) {
.tools {
    grid-template-columns: 1fr 1fr;
}

.tools .search {
    grid-column: 1 / -1;
}
}

@media (max-width: 640px) {
.titlebar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
}

.tools {
    grid-template-columns: 1fr;
}

.tools .select,
.tools .search {
    width: 100%;
}

.ss-modal__dialog {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
}

.ss-modal__header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
}

.ss-modal__title {
    font-size: 15px;
    line-height: 1.3;
    white-space: normal;
}

.ss-modal__actions {
    width: 100%;
    justify-content: flex-end;
    gap: 6px;
}

.ss-modal__btn {
    flex: 1 1 auto;
    text-align: center;
    min-width: 0;
}
}