:root {
    --brand-primary: #0f8f9f;
    --brand-primary-dark: #0b6670;
    --brand-accent: #ff6f47;
    --bg-page: #f3f6f9;
    --bg-panel: #ffffff;
    --bg-subtle: #f7fafc;
    --text-main: #1e2d38;
    --text-muted: #5f7485;
    --line: #d9e3eb;
    --line-strong: #c4d2de;
    --success: #0c7a57;
    --danger: #b22f1f;
    --warning-bg: #fff6e8;
    --warning-line: #f2d49b;
    --radius: 10px;
    --shadow-soft: 0 2px 8px rgba(17, 49, 74, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Public Sans', 'Manrope', sans-serif;
    color: var(--text-main);
    background: radial-gradient(circle at 0% 0%, #edf8fa 0%, #f3f6f9 35%, #f3f6f9 100%);
    min-height: 100vh;
}

h1,
h2,
h3,
h4 {
    font-family: 'Sora', 'Public Sans', sans-serif;
    margin: 0;
    color: #12344a;
}

a {
    color: inherit;
    text-decoration: none;
}

p {
    margin-top: 0;
}

code {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.86em;
    background: #eef3f7;
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 0.08rem 0.32rem;
}

.small {
    font-size: 0.84rem;
}

.muted {
    color: var(--text-muted);
}

.bg-orb {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(2px);
    z-index: 0;
}

.bg-orb--one {
    width: 24rem;
    height: 24rem;
    left: -8rem;
    top: -7rem;
    background: radial-gradient(circle at 35% 35%, rgba(15, 143, 159, 0.2) 0%, rgba(15, 143, 159, 0) 74%);
}

.bg-orb--two {
    width: 20rem;
    height: 20rem;
    right: -8rem;
    top: 28%;
    background: radial-gradient(circle at 40% 40%, rgba(255, 111, 71, 0.18) 0%, rgba(255, 111, 71, 0) 72%);
}

.bg-orb--three {
    width: 18rem;
    height: 18rem;
    left: 42%;
    bottom: -8rem;
    background: radial-gradient(circle at 40% 40%, rgba(11, 102, 112, 0.14) 0%, rgba(11, 102, 112, 0) 70%);
}

.install-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.install-card {
    width: min(760px, 100%);
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 1.35rem;
}

.login-body {
    background: #edf1f6;
}

.login-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 2fr 1fr;
    overflow: hidden;
}

.login-visual {
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

.login-visual--fallback {
    background-image: linear-gradient(135deg, #335d92 0%, #4f7aca 48%, #0f8f9f 100%);
}

.login-visual__blur {
    position: absolute;
    inset: -24px;
    background: inherit;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(12px);
    transform: scale(1.08);
}

.login-visual__shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(16, 35, 58, 0.42) 0%, rgba(15, 143, 159, 0.2) 100%);
    z-index: 1;
}

.login-visual__content {
    position: relative;
    z-index: 3;
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: 2rem;
}

.login-visual__logo {
    width: min(420px, 75%);
    max-height: 180px;
    object-fit: contain;
    filter: drop-shadow(0 10px 24px rgba(8, 22, 38, 0.35));
}

.login-visual__title {
    color: #ffffff;
    text-align: center;
    font-size: clamp(1.4rem, 3.2vw, 2.5rem);
}

.login-panel {
    position: relative;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    border-left: 1px solid #d7dfe9;
}

.login-panel__inner {
    width: min(430px, 100%);
}

.login-panel__inner h1 {
    margin-bottom: 0.35rem;
}

.login-panel__inner .muted {
    margin-bottom: 1rem;
}

.login-bg-preview {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    background: #f6f9fc;
}

.login-bg-preview img {
    display: block;
    width: 100%;
    max-height: 190px;
    object-fit: cover;
}

.stack-form {
    display: grid;
    gap: 0.75rem;
}

.stack-form label {
    display: grid;
    gap: 0.25rem;
    font-size: 0.9rem;
    font-weight: 600;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--text-main);
    padding: 0.56rem 0.64rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(15, 143, 159, 0.22);
    border-color: var(--brand-primary);
}

textarea {
    resize: vertical;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    border: 1px solid var(--brand-primary);
    background: var(--brand-primary);
    color: #ffffff;
    border-radius: 6px;
    min-height: 35px;
    padding: 0.42rem 0.78rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.btn:hover {
    background: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
}

.btn--ghost {
    background: #fff;
    color: #174760;
    border-color: var(--line-strong);
}

.btn--ghost:hover {
    background: #f5f8fb;
    border-color: #a9bbca;
}

.btn--audit {
    background: #d2552f;
    border-color: #d2552f;
    color: #fff;
}

.btn--audit:hover {
    background: #b94523;
    border-color: #b94523;
}

.btn--small {
    min-height: 30px;
    padding: 0.3rem 0.62rem;
    font-size: 0.8rem;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.alert {
    border-radius: 8px;
    padding: 0.62rem 0.75rem;
    margin-bottom: 0.85rem;
    border: 1px solid transparent;
    background: #fff;
}

.alert p {
    margin: 0.2rem 0;
}

.alert--error {
    border-color: #efcdc8;
    background: #fff4f2;
    color: var(--danger);
}

.alert--success {
    border-color: #bfe5d7;
    background: #f1fcf8;
    color: var(--success);
}

.portal-shell {
    position: relative;
    z-index: 1;
    width: min(100%, 1860px);
    margin: 0 auto;
    padding: 0.8rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0.85rem;
}

.sidebar {
    position: sticky;
    top: 0.8rem;
    align-self: start;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    display: grid;
    gap: 0.85rem;
    padding: 0.9rem;
    max-height: calc(100vh - 1.6rem);
    overflow: auto;
}

.brand {
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.7rem;
}

.brand__kicker {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.7rem;
    color: var(--brand-primary);
    margin-bottom: 0.2rem;
}

.brand h1 {
    font-size: 1.03rem;
    line-height: 1.32;
}

.user-card {
    border-radius: 8px;
    background: var(--bg-subtle);
    border: 1px solid var(--line);
    padding: 0.7rem;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.16rem;
}

.role-pill {
    display: inline-block;
    margin-top: 0.45rem;
    border-radius: 4px;
    padding: 0.18rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.role-pill--admin {
    color: #064b55;
    background: #ddf4f7;
    border-color: #a9d7df;
}

.role-pill--student {
    color: #88402e;
    background: #fff0ea;
    border-color: #f1c6ba;
}

.role-pill--instructor {
    color: #204860;
    background: #eaf4fc;
    border-color: #c6deef;
}

.sidebar-form {
    background: var(--bg-subtle);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.65rem;
}

.side-nav {
    display: grid;
    gap: 0.28rem;
}

.side-nav a {
    font-size: 0.9rem;
    font-weight: 600;
    color: #174760;
    border-radius: 5px;
    padding: 0.44rem 0.56rem;
    border: 1px solid transparent;
}

.side-nav a:hover {
    background: #f2f8fb;
    border-color: #d3e2ed;
}

.main-content {
    display: grid;
    gap: 0.75rem;
}

.topbar,
.card,
.modal-card,
.command-bar {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-top: 3px solid var(--brand-primary);
}

.topbar h2 {
    margin-top: 0.18rem;
    font-size: 1.32rem;
}

.topbar-breadcrumbs {
    margin: 0;
}

.active-student {
    display: grid;
    text-align: right;
}

.active-student-address {
    max-width: 34ch;
    justify-self: end;
}

.command-bar {
    padding: 0.62rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.command-bar__group {
    display: flex;
    align-items: center;
    gap: 0.44rem;
    flex-wrap: wrap;
}

.command-chip {
    border: 1px solid #d4e1eb;
    background: #f7fbfe;
    color: #1a4c67;
    border-radius: 5px;
    padding: 0.32rem 0.56rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.command-chip:hover {
    background: #ecf5fb;
    border-color: #bdd4e5;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 0.62rem;
}

.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.72rem;
}

.stat-card p {
    margin-bottom: 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.stat-card strong {
    display: block;
    margin-top: 0.3rem;
    font-size: 1.04rem;
}

.stat-card--highlight {
    border-color: #f0cabd;
    background: #fff6f3;
}

.stat-card--warn {
    border-color: var(--warning-line);
    background: var(--warning-bg);
}

.section-card {
    padding: 0.9rem 1rem;
}

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.7rem;
}

.section-head h3 {
    font-size: 1rem;
}

.section-head p {
    margin-top: 0.24rem;
    margin-bottom: 0;
}

.section-head__actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.page-context-card {
    padding-top: 0.72rem;
    padding-bottom: 0.72rem;
}

.page-context-card p {
    margin: 0;
}

.page-context-pill {
    display: inline-block;
    margin-bottom: 0.38rem;
    border-radius: 4px;
    border: 1px solid transparent;
    padding: 0.16rem 0.45rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.page-context-pill--dashboard {
    background: #edf4fb;
    border-color: #c9dbec;
    color: #2b5066;
}

.page-context-pill--student {
    background: #edf8f2;
    border-color: #c9e7d6;
    color: #256646;
}

.checkbox-fieldset {
    border: 1px solid var(--line);
    border-radius: 6px;
    margin: 0;
    padding: 0.6rem;
}

.checkbox-fieldset legend {
    padding: 0 0.25rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #29485d;
}

.checkbox-grid {
    display: grid;
    gap: 0.35rem;
    max-height: 220px;
    overflow-y: auto;
}

.checkbox-item {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 0.45rem;
    font-size: 0.86rem;
    font-weight: 500;
}

.checkbox-item input[type='checkbox'] {
    width: 16px;
    height: 16px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    background: #fff;
    margin-top: 0.2rem;
}

.student-profile-grid {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.student-profile-grid article {
    border: 1px solid #dbe5ee;
    background: #f8fbfe;
    border-radius: 6px;
    padding: 0.55rem 0.62rem;
}

.student-profile-grid p {
    margin: 0.16rem 0 0;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border: 1px solid var(--line);
}

th,
td {
    padding: 0.62rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5c7283;
    background: #f8fbfd;
}

tr:last-child td {
    border-bottom: 0;
}

.list-grid {
    display: grid;
    gap: 0.5rem;
}

.list-item {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-left: 3px solid #d4e6f2;
    border-radius: 7px;
    padding: 0.62rem;
    display: flex;
    justify-content: space-between;
    gap: 0.72rem;
}

.list-item--completed {
    border-left-color: #2f9859;
    background: #f1faf4;
}

.lesson-complete-label {
    color: #1d7b44;
    font-weight: 700;
    margin-top: 0.28rem;
}

.item-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.search-grid {
    display: grid;
    gap: 0.7rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.search-column h4 {
    margin-bottom: 0.4rem;
}

.agenda-grid,
.admin-grid {
    display: grid;
    gap: 0.72rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-grid .stack-form {
    background: #fafcfe;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.7rem;
}

.admin-grid h4 {
    font-size: 0.94rem;
    margin-bottom: 0.12rem;
}

.admin-actions-grid {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.modal {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: none;
    width: min(760px, 94vw);
}

.modal--wide {
    width: min(1380px, 98vw);
}

.modal[open] {
    display: grid;
    place-items: center;
}

.modal::backdrop {
    background: rgba(8, 25, 37, 0.45);
}

.modal-card {
    width: 100%;
    margin: 0;
    padding: 0.95rem;
    background: var(--bg-panel);
    max-height: min(88dvh, 900px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.55rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid #e5ebf1;
    background: var(--bg-panel);
}

.modal-body,
.modal-card form {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

.modal-card form {
    padding-right: 0.1rem;
}

.modal-secondary-form {
    margin-top: 0.6rem;
}

.modal-body h4 {
    margin: 0.72rem 0 0.2rem;
    font-size: 0.95rem;
}

.modal-card--audit {
    gap: 0.7rem;
}

.modal-card--audit > header {
    margin-bottom: 0;
}

.audit-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.audit-live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #33a564;
    box-shadow: 0 0 0 5px rgba(51, 165, 100, 0.16);
}

.audit-countdown {
    position: relative;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.audit-countdown svg {
    width: 34px;
    height: 34px;
    transform: rotate(-90deg);
}

.audit-countdown-track,
.audit-countdown-bar {
    fill: none;
    stroke-width: 3.5;
}

.audit-countdown-track {
    stroke: #e2e9f0;
}

.audit-countdown-bar {
    stroke: #3a7fc2;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.15s linear;
}

#audit-countdown-label {
    position: absolute;
    font-size: 0.72rem;
    font-weight: 700;
    color: #25445a;
}

.audit-log-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.55rem;
}

.audit-log-table-wrap {
    flex: 1 1 auto;
    min-height: 220px;
}

#audit-log-tbody tr {
    cursor: pointer;
}

#audit-log-tbody tr:hover {
    background: #eef5fb;
}

#audit-log-tbody tr.is-active {
    background: #e5f0fb;
}

.audit-detail-panel {
    border-top: 1px solid #e1e8ef;
    padding-top: 0.6rem;
}

.audit-detail-head h4 {
    margin: 0;
    font-size: 0.95rem;
}

.audit-detail-head p {
    margin: 0.28rem 0 0;
}

.audit-detail-grid {
    margin-top: 0.5rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.audit-detail-card {
    border: 1px solid #dbe5ee;
    background: #f8fbfe;
    border-radius: 6px;
    padding: 0.55rem;
}

.audit-detail-card h5 {
    margin: 0 0 0.35rem;
    font-size: 0.82rem;
    color: #2a4b61;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.audit-detail-card p {
    margin: 0;
}

.audit-detail-card pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.78rem;
    line-height: 1.35;
    color: #1f3342;
    background: #ffffff;
    border: 1px solid #dce6ef;
    border-radius: 4px;
    padding: 0.45rem;
    max-height: 220px;
    overflow: auto;
}

@media (max-width: 1180px) {
    .portal-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        max-height: none;
    }

    .agenda-grid,
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .install-wrap {
        padding: 0.75rem;
    }

    .portal-shell {
        padding: 0.48rem;
        gap: 0.55rem;
    }

    .topbar,
    .section-card,
    .sidebar,
    .command-bar,
    .modal-card,
    .install-card {
        border-radius: 8px;
    }

    .topbar {
        flex-direction: column;
        align-items: start;
    }

    .active-student {
        text-align: left;
    }

    .active-student-address {
        justify-self: start;
    }

    .section-head {
        flex-direction: column;
        align-items: start;
    }

    .section-head__actions {
        justify-content: flex-start;
        width: 100%;
    }

    .list-item {
        flex-direction: column;
    }

    .item-actions {
        width: 100%;
    }

    .audit-log-filter-grid {
        grid-template-columns: 1fr;
    }

    .audit-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-visual {
        min-height: 38vh;
    }

    .login-panel {
        padding: 1.2rem;
        border-left: 0;
    }
}

@media (max-width: 640px) {
    .login-visual {
        min-height: 30vh;
    }

    .login-panel {
        padding: 0.95rem 0.8rem;
    }

    .login-visual__logo {
        width: min(280px, 72%);
        max-height: 120px;
    }
}

/* SharePoint-like skin overrides */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

body.portal-body {
    margin: 0;
    padding: 0;
    background: #f4f4f6;
}

body.portal-body.login-body {
    background: #edf1f6;
}

body.portal-body.modal-open {
    overflow: hidden;
}

.sp-global-wrap {
    width: 100%;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 2;
}

.sp-global {
    min-height: 56px;
    border-radius: 0;
    background: linear-gradient(90deg, #4b6fbe 0%, #4f7aca 60%, #0f8f9f 100%);
    color: #fff;
    display: grid;
    grid-template-columns: 220px 1fr 220px;
    align-items: center;
    gap: 0.8rem;
    padding: 0.45rem 0.9rem;
}

.sp-global__left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.sp-grid-icon {
    font-size: 1rem;
    opacity: 0.95;
}

.sp-wordmark {
    font-size: 1.02rem;
    letter-spacing: 0.01em;
}

.sp-logo-link {
    display: inline-flex;
    align-items: center;
}

.sp-logo {
    display: block;
    width: auto;
    height: 34px;
    max-width: 180px;
    object-fit: contain;
}

.sp-global__search input {
    height: 38px;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: #ffffff;
    padding: 0.5rem 0.75rem;
    color: #1a2b3a;
}

.sp-search-form {
    margin: 0;
    position: relative;
}

.sp-search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 35;
    background: #fff;
    border: 1px solid #cdd9e4;
    border-radius: 2px;
    box-shadow: 0 8px 20px rgba(16, 42, 64, 0.2);
    max-height: min(360px, 62vh);
    overflow-y: auto;
}

.sp-search-suggestion {
    display: grid;
    gap: 0.1rem;
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid #e5ebf1;
    color: #1a2f3f;
}

.sp-search-suggestion:last-child {
    border-bottom: 0;
}

.sp-search-suggestion:hover,
.sp-search-suggestion.is-active {
    background: #eef4fa;
}

.sp-search-suggestion__type {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5f7285;
}

.sp-search-suggestion__label {
    font-size: 0.92rem;
    font-weight: 600;
}

.sp-search-suggestion__meta {
    font-size: 0.8rem;
    color: #5f7285;
}

.sp-search-suggestion--empty {
    padding: 0.55rem 0.65rem;
    color: #5f7285;
    font-size: 0.85rem;
}

.sp-global__search input::placeholder {
    color: #6b7c8c;
}

.sp-global__right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.85rem;
}

.sp-icon {
    font-size: 1rem;
    opacity: 0.92;
}

.sp-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.55);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sp-action-row {
    min-height: 46px;
    background: #f3f3f1;
    border-left: 0;
    border-right: 0;
    border-bottom: 1px solid #dfe3e8;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
}

.sp-action-link {
    color: #174760;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 3px;
    padding: 0.34rem 0.52rem;
}

.sp-action-btn {
    border: 0;
    background: transparent;
    cursor: pointer;
}

.sp-action-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.sp-action-btn--audit {
    background: #ffe9e2;
    border: 1px solid #f0b9a8;
    color: #7d2c18;
}

.sp-action-link:hover {
    background: #e8edf3;
}

.sp-action-link.sp-action-btn--audit:hover {
    background: #ffd9cd;
}

.portal-shell {
    width: 100%;
    margin: 0;
    grid-template-columns: 300px 1fr;
    padding: 0;
    gap: 0.75rem;
}

.sidebar {
    position: sticky;
    top: 0.75rem;
    background: #ffffff;
    border: 1px solid #d8dde5;
    border-radius: 0;
    box-shadow: none;
    padding: 0.9rem;
    max-height: calc(100vh - 1rem);
}

.user-card {
    border-radius: 0;
    background: #f6f8fb;
    border: 1px solid #dce4ed;
}

.sp-nav-block {
    border-top: 1px solid #e5eaf0;
    padding-top: 0.7rem;
}

.sp-nav-block h3 {
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 600;
    margin-bottom: 0.45rem;
    color: #1e2d38;
}

.sp-site-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.24rem;
}

.sp-site-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.5rem;
    border-radius: 3px;
    padding: 0.22rem 0.3rem;
}

.sp-site-list li:hover {
    background: #f3f7fb;
}

.sp-site-list a {
    font-size: 1.03rem;
    color: #243847;
}

.sp-star {
    color: #2f7a83;
    font-size: 1.1rem;
    line-height: 1;
}

.topbar {
    border-radius: 0;
    border-top: 0;
    box-shadow: none;
    padding: 0.95rem 1rem 0.8rem;
    background: #ffffff;
}

.topbar h2 {
    font-size: 2rem;
    font-weight: 600;
}

.command-bar {
    border-radius: 0;
    box-shadow: none;
    background: #ffffff;
    border-top: 0;
}

.command-chip {
    border-radius: 2px;
    background: #f7fafc;
    border-color: #d5e0ea;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: 0;
    border: 1px solid #d4deea;
    padding-top: 2.1rem;
}

.stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 1.35rem;
    background: linear-gradient(90deg, #4c72c3 0%, #4f7aca 72%, #0f8f9f 100%);
}

.section-card {
    border-radius: 0;
    box-shadow: none;
    border: 1px solid #d7dee8;
    background: #ffffff;
}

.section-head {
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #e5ebf1;
}

table {
    border-radius: 0;
}

.list-item {
    border-radius: 0;
    border-left: 3px solid #4c72c3;
}

.list-item.list-item--completed {
    border-left-color: #2f9859;
    background: #f1faf4;
}

@media (max-width: 1180px) {
    .sp-global {
        grid-template-columns: 1fr;
        gap: 0.4rem;
        padding: 0.55rem 0.7rem;
    }

    .sp-global__right {
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .sp-action-row {
        flex-wrap: wrap;
        gap: 0.2rem;
        min-height: auto;
    }

    .sp-nav-block h3 {
        font-size: 1.55rem;
    }

    .topbar h2 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive hardening */
html,
body {
    max-width: 100%;
}

.portal-shell > *,
.main-content,
.search-column,
.section-card,
.topbar,
.command-bar {
    min-width: 0;
}

@media (max-width: 1100px) {
    .portal-shell {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .sidebar {
        position: static;
        top: auto;
        max-height: none;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
    }

    .main-content {
        gap: 0.6rem;
    }

    .agenda-grid,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-actions-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 760px) {
    body.portal-body {
        overflow-x: hidden;
    }

    .sp-global {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 0.45rem;
        padding: 0.55rem 0.65rem;
    }

    .sp-global__left,
    .sp-global__right {
        min-height: 34px;
    }

    .sp-global__right {
        justify-content: flex-start;
    }

    .sp-global__search input {
        height: 36px;
    }

    .sp-action-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.3rem 0.55rem;
        gap: 0.15rem;
    }

    .sp-action-link {
        white-space: nowrap;
    }

    .portal-shell {
        gap: 0;
    }

    .topbar,
    .section-card,
    .command-bar {
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.45rem;
        padding: 0.8rem 0.75rem 0.7rem;
    }

    .topbar h2 {
        font-size: 1.45rem;
    }

    .active-student {
        text-align: left;
    }

    .command-bar {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.6rem 0.75rem;
        gap: 0.45rem;
    }

    .section-card {
        padding: 0.75rem;
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.45rem;
    }

    .section-head__actions {
        width: 100%;
        justify-content: flex-start;
    }

    .list-item {
        flex-direction: column;
        gap: 0.45rem;
    }

    .item-actions {
        width: 100%;
    }

    .search-grid,
    .stats-grid,
    .admin-actions-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        margin: 0;
    }

    .modal[open] {
        place-items: stretch;
    }

    .modal-card {
        width: 100vw;
        min-height: 100vh;
        min-height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        padding: 0.8rem 0.75rem 0.65rem;
    }

    .modal-card header {
        position: sticky;
        top: 0;
        z-index: 3;
        padding-top: calc(0.15rem + env(safe-area-inset-top));
    }

    .modal-body,
    .modal-card form {
        flex: 1;
        max-height: none;
        padding-bottom: calc(0.8rem + env(safe-area-inset-bottom));
    }
}

@media (max-width: 560px) {
    .sp-wordmark {
        font-size: 0.95rem;
    }

    .sp-logo {
        height: 30px;
        max-width: 150px;
    }

    .sp-nav-block h3 {
        font-size: 1.45rem;
    }

    .table-wrap {
        margin-left: -0.1rem;
        margin-right: -0.1rem;
    }

    .modal-card header {
        align-items: flex-start;
    }

    .modal-card header .btn {
        flex: 0 0 auto;
    }
}
