:root {
    --paper: #f6f4ef;
    --surface: #ffffff;
    --surface-soft: #f0eee8;
    --ink: #202124;
    --muted: #6d716d;
    --line: #dedbd2;
    --brand: #1f7a68;
    --brand-dark: #155c4f;
    --accent: #d98b32;
    --danger: #be3b35;
    --info: #476c8a;
    --shadow: 0 14px 36px rgba(31, 41, 38, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    color-scheme: light;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(31, 122, 104, 0.05) 1px, transparent 1px),
        linear-gradient(180deg, rgba(31, 122, 104, 0.04) 1px, transparent 1px),
        var(--paper);
    background-size: 28px 28px;
    font-family: "Segoe UI", Tahoma, sans-serif;
    line-height: 1.5;
    -webkit-tap-highlight-color: rgba(31, 122, 104, 0.18);
}

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

a,
button {
    touch-action: manipulation;
}

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

.app-shell {
    min-height: 100vh;
    display: flex;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 20;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--ink);
    color: #ffffff;
    font-weight: 800;
    transform: translateY(-160%);
}

.skip-link:focus-visible {
    transform: translateY(0);
}

.sidebar {
    position: sticky;
    top: 0;
    width: 270px;
    height: 100vh;
    padding: 22px;
    background: #222824;
    color: #f8f4e8;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand span:last-child,
.sidebar-user-text {
    min-width: 0;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #1d1b18;
    font-weight: 800;
}

.brand strong,
.brand small,
.sidebar-user strong,
.sidebar-user span {
    display: block;
    overflow-wrap: anywhere;
}

.brand small,
.sidebar-user span {
    color: #c8c3b6;
    font-size: 0.84rem;
}

.nav-list {
    display: grid;
    gap: 8px;
}

.nav-list a {
    padding: 11px 12px;
    border-radius: 8px;
    color: #e7e2d7;
}

.nav-list a:hover,
.nav-list a.active {
    background: rgba(255, 255, 255, 0.11);
    color: #ffffff;
}

.sidebar-user {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-user summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
}

.sidebar-user summary::-webkit-details-marker {
    display: none;
}

.sidebar-user summary::after {
    content: "⌄";
    margin-left: auto;
    color: #c8c3b6;
    font-weight: 800;
    transition: transform 160ms ease;
}

.sidebar-user[open] summary::after {
    transform: rotate(180deg);
}

.sidebar-user summary:hover,
.sidebar-user summary:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.sidebar-user-text {
    min-width: 0;
}

.account-actions {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.account-actions a,
.account-actions button {
    display: block;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 0;
    background: rgba(255, 255, 255, 0.08);
    text-align: left;
    cursor: pointer;
    color: #f8f4e8;
    font-weight: 700;
}

.account-actions a:hover,
.account-actions a:focus-visible,
.account-actions button:hover,
.account-actions button:focus-visible {
    background: rgba(255, 255, 255, 0.15);
    outline: none;
}

.avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    color: #ffffff;
    text-align: center;
    overflow-wrap: normal;
    white-space: nowrap;
}

.sidebar-user .avatar-initials {
    display: block;
    color: inherit;
    font-family: Arial, "Segoe UI", Tahoma, sans-serif;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1;
    overflow-wrap: normal;
    transform: translateY(6px);
}

.avatar-student {
    background: #2f9e44;
    color: #ffffff;
}

.avatar-lecturer {
    background: #f2c94c;
    color: #2f2a12;
}

.avatar-admin {
    background: #d64545;
    color: #ffffff;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 28px;
}

.auth-content {
    width: 100%;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.topbar h1,
.login-copy h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.15;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.card,
.stat-card,
.login-form {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.card {
    padding: 20px;
    margin-bottom: 20px;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-heading h2,
.group-card h3 {
    margin: 0;
}

.card h2 {
    font-size: 1.35rem;
    line-height: 1.22;
}

.card h3 {
    font-size: 1.08rem;
    line-height: 1.25;
}

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

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 18px;
}

.stat-card span {
    display: block;
    color: var(--muted);
}

.stat-card strong {
    display: block;
    margin-top: 6px;
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
}

.grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
}

.period-context {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin: -2px 0 20px;
    padding: 14px 18px;
    background: rgba(255, 253, 248, 0.88);
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: 8px;
}

.period-context-main {
    min-width: 240px;
}

.period-context-main span {
    display: block;
    margin-bottom: 4px;
    color: var(--brand);
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1.25;
    text-transform: uppercase;
}

.period-context-main strong {
    display: block;
    font-size: 1.06rem;
    line-height: 1.28;
}

.period-context-meta {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.period-context-meta > span:not(.badge) {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    background: #fffdf8;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.2;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.form-stack {
    display: grid;
    gap: 14px;
}

.bulk-box {
    margin-top: 16px;
}

.form-span {
    grid-column: 1 / -1;
}

.form-wide {
    grid-column: span 2;
}

.form-actions {
    display: flex;
    align-items: flex-end;
}

label {
    display: grid;
    gap: 6px;
    color: #343832;
    font-weight: 700;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-row input[type="checkbox"] {
    width: 32px;
    min-width: 32px;
    height: 32px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbc7bd;
    border-radius: 8px;
    padding: 10px 11px;
    background: #fffdf8;
    color: var(--ink);
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(31, 122, 104, 0.18);
    border-color: var(--brand);
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(31, 122, 104, 0.32);
    outline-offset: 3px;
}

.btn {
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    background: var(--ink);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    font-weight: 800;
    transition: filter 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.btn:hover {
    filter: brightness(0.96);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    cursor: not-allowed;
    filter: grayscale(0.3);
    opacity: 0.58;
}

.btn-primary {
    background: var(--brand);
}

.btn-light {
    background: var(--surface-soft);
    color: var(--ink);
}

.btn-danger {
    background: var(--danger);
}

.btn-small {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.table-wrap.compact {
    margin-top: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    background: #fffefa;
}

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

th {
    background: #ede8dc;
    font-size: 0.84rem;
    text-transform: uppercase;
}

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

.table-wrap td input,
.table-wrap td select {
    min-width: 8.5rem;
}

.table-wrap td input[type="email"],
.table-wrap td input[name="full_name"],
.table-wrap td input[name="period_name"] {
    min-width: 18rem;
}

.table-wrap td input[name="phone"] {
    min-width: 9rem;
}

.table-wrap td input[type="number"] {
    min-width: 5rem;
}

.dialog-open {
    overflow: hidden;
}

.edit-dialog {
    width: min(760px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100dvh - 32px);
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--ink);
    box-shadow: 0 28px 80px rgba(17, 48, 78, 0.28);
}

.edit-dialog-wide {
    width: min(1040px, calc(100vw - 32px));
}

.edit-dialog::backdrop {
    background: rgba(21, 43, 63, 0.56);
    backdrop-filter: blur(4px);
}

.edit-dialog-shell {
    display: flex;
    max-height: calc(100dvh - 32px);
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
}

.edit-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px;
    border-bottom: 1px solid #d9e5ef;
    background: linear-gradient(135deg, #f7fbff 0%, #eaf3fb 100%);
}

.edit-dialog-header h2,
.edit-dialog-section-heading h3,
.edit-dialog-header p,
.edit-dialog-section-heading p {
    margin: 0;
}

.edit-dialog-eyebrow {
    margin-bottom: 4px !important;
    color: var(--hnue-blue);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.edit-dialog-close {
    display: inline-grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    padding: 0;
    border: 1px solid #cbddec;
    border-radius: 10px;
    background: #ffffff;
    color: var(--hnue-blue-deep);
    cursor: pointer;
}

.edit-dialog-body {
    padding: 22px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.edit-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 4px -22px -22px;
    padding: 16px 22px;
    border-top: 1px solid #d9e5ef;
    background: #f8fbfd;
}

.edit-dialog-section-heading {
    display: grid;
    gap: 4px;
    margin-top: 4px;
    padding-top: 16px;
    border-top: 1px solid #d9e5ef;
}

.topic-auto-approval-option {
    align-items: flex-start;
    padding: 14px;
    border: 1px solid #c9dbea;
    border-radius: 10px;
    background: #f3f8fc;
}

.topic-auto-approval-option > span {
    display: grid;
    gap: 4px;
}

.topic-auto-approval-option small {
    color: var(--muted);
    font-weight: 500;
    line-height: 1.45;
}

.topic-auto-approval-badge {
    gap: 5px;
    margin-top: 6px;
}

.topic-auto-approval-badge .ui-icon {
    width: 14px;
    height: 14px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
}

.badge-success {
    background: #dceee6;
    color: #155c4f;
}

.badge-warning {
    background: #fff0cf;
    color: #80520e;
}

.badge-info {
    background: #dfeaf0;
    color: #2d536f;
}

.badge-danger {
    background: #f8dedb;
    color: #8f2a25;
}

.badge-muted {
    background: #ececec;
    color: #555;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 12px;
    background: #fffdf8;
    color: var(--ink);
    font-weight: 800;
}

.filter-pill.active {
    border-color: #b8dfcf;
    background: #e1f3ea;
    color: #155c4f;
}

.list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    margin-bottom: 14px;
}

.list-search {
    flex: 1 1 280px;
}

.rows-select {
    width: 130px;
}

.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.pagination-summary {
    margin: 0;
    color: var(--muted);
}

.pagination-pages {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.page-link,
.page-gap {
    min-width: 38px;
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fffdf8;
    font-weight: 800;
}

.page-link.active {
    border-color: #b8dfcf;
    background: #e1f3ea;
    color: #155c4f;
}

.page-gap {
    color: var(--muted);
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid;
    transition: opacity 200ms ease, transform 200ms ease;
}

.alert-success {
    background: #e1f3ea;
    color: #155c4f;
    border-color: #b8dfcf;
}

.alert-error {
    background: #fde6e2;
    color: #8f2a25;
    border-color: #efc2bd;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-form.wide select,
.inline-form.wide input {
    max-width: 520px;
}

.student-search-form {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.student-search-field {
    position: relative;
    flex: 1 1 360px;
    min-width: 260px;
}

.student-search-field input {
    width: 100%;
}

.student-search-results {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: grid;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf8;
    box-shadow: 0 18px 36px rgba(27, 31, 28, 0.14);
}

.student-search-results:empty {
    display: none;
}

.student-search-option {
    display: grid;
    gap: 3px;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.student-search-option:last-child {
    border-bottom: 0;
}

.student-search-option:hover,
.student-search-option:focus-visible {
    background: #f3efe6;
}

.student-search-option.is-disabled {
    color: var(--muted);
    cursor: not-allowed;
}

.student-search-option.is-disabled .student-search-meta,
.student-search-status.is-error {
    color: #8f2a25;
}

.student-search-meta,
.student-search-status {
    font-size: 0.86rem;
}

.form-note {
    flex-basis: 100%;
    margin: 0;
    font-size: 0.9rem;
}

.form-note-warning {
    color: #8f2a25;
}

.student-search-status {
    flex-basis: 100%;
    margin: 0;
    min-height: 20px;
}

.action-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.notice-list,
.check-list {
    display: grid;
    gap: 10px;
}

.notice-list span,
.check-list li {
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--surface-soft);
}

.member-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 8px;
}

.member-list li,
.request-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.request-row span {
    display: block;
    color: var(--muted);
}

.group-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 14px;
    background: #fffefa;
}

.group-card-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.review-form {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.review-form textarea {
    min-height: 96px;
}

.course-period-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.course-period-card {
    min-height: 138px;
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffefa;
}

.course-period-card:hover,
.course-period-card:focus-visible,
.course-period-card.active {
    border-color: #9fcfbf;
    background: #eef8f3;
    outline: none;
}

.course-period-code {
    color: var(--brand-dark);
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
}

.course-period-card strong,
.course-period-card small {
    overflow-wrap: anywhere;
}

.course-period-card small {
    color: var(--muted);
}

.course-detail-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.course-workspace-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}

.course-student-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.course-column {
    min-width: 0;
}

.course-list,
.course-topic-groups {
    display: grid;
    gap: 12px;
}

.course-list-item,
.topic-group-block {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffefa;
}

.course-list-item p,
.topic-group-block p,
.course-detail-head p {
    margin: 0;
}

.course-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 0.92rem;
}

.topic-group-block h3 {
    margin: 0;
    color: var(--brand-dark);
}

.topic-group-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.topic-group-row span:first-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.cst-course-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 256px;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto 28px;
}

.cst-course-main {
    min-width: 0;
}

.cst-course-title {
    border-top: 1px solid #dedede;
    padding-top: 18px;
    margin-bottom: 20px;
    text-align: center;
}

.cst-course-title h2 {
    margin: 0;
    color: #111;
    font-size: 1.48rem;
    font-weight: 500;
}

.cst-course-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 22px;
}

.cst-course-card {
    display: grid;
    min-height: 312px;
    border: 1px solid #e3e3e3;
    border-radius: 5px;
    background: #ffffff;
    box-shadow: 0 2px 7px rgba(20, 28, 40, 0.05);
    overflow: hidden;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.cst-course-card:hover,
.cst-course-card:focus-visible,
.cst-course-card.active {
    border-color: var(--brand);
    box-shadow: 0 12px 26px rgba(31, 122, 104, 0.16);
    outline: none;
    transform: translateY(-1px);
}

.cst-course-media {
    position: relative;
    display: block;
    min-height: 160px;
    background: #f3a947;
    overflow: hidden;
}

.cst-course-media img {
    width: 100%;
    height: 160px;
    display: block;
    object-fit: cover;
}

.cst-course-chip {
    position: absolute;
    top: 20px;
    right: 14px;
    min-height: 32px;
    max-width: calc(100% - 28px);
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border-radius: 999px;
    background: #ffffff;
    color: var(--brand-dark);
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
}

.cst-course-body {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 18px 24px 24px;
}

.cst-course-body strong {
    min-height: 50px;
    color: var(--brand-dark);
    font-size: 1.02rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.cst-course-stats {
    min-height: 22px;
    color: #6d7177;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.cst-enter-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    background: var(--brand);
    color: #ffffff;
    font-weight: 800;
    box-shadow: 0 6px 12px rgba(31, 122, 104, 0.22);
}

.cst-course-rail {
    align-self: start;
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    padding: 20px 16px;
    border-radius: 5px;
    background: #f3f3f3;
}

.cst-course-rail h2 {
    margin: 0 0 16px;
    text-align: center;
    font-size: 1rem;
}

.cst-rail-list {
    display: grid;
    gap: 10px;
}

.cst-rail-list a {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    min-height: 66px;
    padding: 12px;
    border: 1px solid #e5e5e5;
    border-radius: 5px;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(20, 28, 40, 0.05);
}

.cst-rail-list a:hover,
.cst-rail-list a:focus-visible,
.cst-rail-list a.active {
    border-color: var(--brand);
    outline: none;
}

.cst-rail-list span {
    color: #28313d;
}

.cst-rail-list strong {
    min-width: 0;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.activity-log-table {
    min-width: 1180px;
    table-layout: fixed;
}

.activity-log-col-time {
    width: 8%;
}

.activity-log-col-actor {
    width: 11%;
}

.activity-log-col-action {
    width: 12%;
}

.activity-log-col-target {
    width: 7%;
}

.activity-log-col-data {
    width: 23%;
}

.activity-log-col-reason {
    width: 16%;
}

.json-cell {
    margin: 0;
    font-size: 0.82rem;
    white-space: pre-wrap;
}

.activity-log-table .json-cell,
.activity-log-reason {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.empty-state {
    max-width: 720px;
    margin: 60px auto;
    text-align: center;
    background: var(--surface);
    padding: 28px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-panel {
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 24px;
    align-items: stretch;
}

.login-copy {
    padding: 32px;
    border-radius: 8px;
    background: #222824;
    color: #fff9eb;
    display: grid;
    align-content: center;
    gap: 16px;
}

.login-copy,
.login-form {
    min-width: 0;
}

.login-copy p {
    color: #ded6c4;
    max-width: 680px;
}

.login-form {
    padding: 28px;
    align-content: center;
}

code {
    background: var(--surface-soft);
    border-radius: 6px;
    padding: 2px 6px;
}

@media (max-width: 1180px) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cst-course-layout {
        grid-template-columns: minmax(0, 1fr) 240px;
        gap: 24px;
    }

    .cst-course-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .course-workspace-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
    }

    .nav-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-grid,
    .grid-2,
    .period-context,
    .course-period-grid,
    .course-workspace-3,
    .course-student-grid,
    .cst-course-layout,
    .cst-course-grid,
    .login-panel {
        grid-template-columns: 1fr;
    }

    .cst-course-rail {
        position: static;
        max-height: none;
        order: -1;
    }

    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .main-content,
    .login-screen {
        padding: 14px;
    }

    .sidebar {
        padding: 12px 14px;
        gap: 10px;
    }

    .brand {
        gap: 10px;
    }

    .brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 7px;
        font-size: 0.88rem;
    }

    .brand strong {
        font-size: 0.98rem;
    }

    .brand small,
    .sidebar-user span {
        font-size: 0.76rem;
    }

    .nav-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .nav-list a {
        min-height: 40px;
        padding: 7px 8px;
        border-radius: 8px;
        font-size: 0.9rem;
        line-height: 1.2;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-user {
        margin-top: 0;
        padding-top: 8px;
        gap: 8px;
    }

    .sidebar-user strong {
        font-size: 0.94rem;
        line-height: 1.25;
    }

    .avatar {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    .sidebar-user .avatar-initials {
        font-size: 0.76rem;
        transform: translateY(4px);
    }

    .topbar,
    .section-heading,
    .period-context,
    .course-detail-head,
    .group-card-head {
        display: grid;
    }

    .topbar {
        margin-bottom: 16px;
    }

    .eyebrow {
        font-size: 0.72rem;
        line-height: 1.25;
        text-wrap: balance;
    }

    .topbar .btn,
    .section-heading .btn {
        justify-self: start;
        width: auto;
    }

    .card {
        padding: 14px;
        margin-bottom: 14px;
    }

    .card h2 {
        font-size: 1.1rem;
    }

    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card span {
        line-height: 1.25;
    }

    .stat-card strong {
        font-size: 1.62rem;
    }

    .section-heading {
        gap: 10px;
        margin-bottom: 12px;
    }

    .period-context {
        gap: 12px;
        margin-bottom: 14px;
        padding: 12px 14px;
    }

    .period-context-main {
        min-width: 0;
    }

    .period-context-meta {
        justify-content: flex-start;
    }

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

    .inline-form {
        align-items: stretch;
    }

    .inline-form.wide select,
    .inline-form.wide input,
    .inline-form.wide .btn {
        max-width: none;
        width: 100%;
    }

    .list-toolbar,
    .list-toolbar .btn,
    .list-search,
    .rows-select,
    .pagination-bar {
        width: 100%;
    }

    .pagination-bar {
        display: grid;
    }

    .pagination-pages {
        justify-content: flex-start;
    }

    .student-search-form,
    .student-search-form .btn,
    .student-search-field {
        width: 100%;
    }

    .student-search-field {
        min-width: 0;
    }

    .form-actions,
    .form-actions .btn {
        width: 100%;
    }

    .action-cell {
        display: grid;
        align-items: stretch;
    }

    .topbar h1,
    .login-copy h1 {
        font-size: 1.42rem;
        text-wrap: balance;
    }

    .cst-course-layout {
        gap: 16px;
        margin-bottom: 18px;
    }

    .cst-course-title {
        padding-top: 14px;
        margin-bottom: 14px;
    }

    .cst-course-title h2 {
        font-size: 1.26rem;
    }

    .cst-course-card {
        min-height: 0;
    }

    .cst-course-media,
    .cst-course-media img {
        height: 136px;
        min-height: 136px;
    }

    .cst-course-body {
        padding: 14px;
    }

    .cst-course-body strong {
        min-height: 0;
    }

    .login-copy,
    .login-form {
        padding: 22px;
    }
}

/* Shared inline icon system. */
.ui-icon {
    width: 1.1em;
    height: 1.1em;
    flex: 0 0 auto;
    display: inline-block;
    overflow: visible;
    vertical-align: -0.16em;
}

.nav-list a,
.account-actions a,
.account-actions button {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-list .ui-icon {
    width: 19px;
    height: 19px;
    color: #a8cfe7;
}

.nav-list a.active .ui-icon,
.nav-list a:hover .ui-icon {
    color: #ffffff;
}

.account-actions .ui-icon {
    width: 17px;
    height: 17px;
    color: #c5ddec;
}

.btn {
    gap: 8px;
}

.btn .ui-icon {
    width: 17px;
    height: 17px;
    stroke-width: 2.25;
}

.btn-small .ui-icon {
    width: 15px;
    height: 15px;
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid !important;
    place-items: center;
    background: rgba(11, 79, 156, 0.1);
    color: var(--brand);
}

.stat-card-icon .ui-icon {
    width: 20px;
    height: 20px;
}

.stat-card > span:not(.stat-card-icon) {
    padding-right: 48px;
}

@media (max-width: 360px) {
    .main-content,
    .login-screen {
        padding: 12px;
    }

    .sidebar {
        padding: 11px 12px;
    }

    .brand-mark {
        width: 32px;
        height: 32px;
        font-size: 0.82rem;
    }

    .brand strong {
        font-size: 0.94rem;
    }

    .brand small,
    .sidebar-user span {
        font-size: 0.72rem;
    }

    .nav-list a {
        min-height: 38px;
        padding: 7px 6px;
        font-size: 0.84rem;
    }

    .topbar h1,
    .login-copy h1 {
        font-size: 1.32rem;
    }

    .card,
    .stat-card,
    .login-copy,
    .login-form {
        padding: 12px;
    }

    .stat-card strong {
        font-size: 1.48rem;
    }
}

/* Login experience */
.page-auth {
    background:
        radial-gradient(circle at 12% 14%, rgba(26, 119, 186, 0.16), transparent 28rem),
        radial-gradient(circle at 88% 88%, rgba(5, 57, 104, 0.12), transparent 30rem),
        linear-gradient(135deg, #edf5fa 0%, #f8fbfd 52%, #e7f1f7 100%);
    background-attachment: fixed;
}

.auth-content {
    min-height: 100dvh;
}

.login-screen {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: clamp(24px, 4vw, 56px);
}

.login-panel {
    position: relative;
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.04fr) minmax(430px, 0.96fr);
    gap: 0;
    overflow: hidden;
    border: 1px solid rgba(157, 187, 211, 0.62);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 32px 90px rgba(19, 66, 105, 0.18);
}

.login-copy {
    position: relative;
    isolation: isolate;
    min-height: 720px;
    display: flex;
    flex-direction: column;
    padding: clamp(40px, 5vw, 72px);
    overflow: hidden;
    background:
        radial-gradient(circle at 78% 24%, rgba(93, 193, 244, 0.2), transparent 15rem),
        radial-gradient(circle at 20% 82%, rgba(32, 137, 205, 0.2), transparent 18rem),
        linear-gradient(145deg, #0b5f9d 0%, #064777 45%, #032f55 100%);
    color: #ffffff;
}

.login-copy::before,
.login-copy::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
}

.login-copy::before {
    top: -150px;
    right: -115px;
    width: 390px;
    height: 390px;
    border: 78px solid rgba(255, 255, 255, 0.055);
}

.login-copy::after {
    right: -120px;
    bottom: -165px;
    width: 430px;
    height: 430px;
    border: 70px solid rgba(78, 176, 237, 0.09);
}

.login-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
}

.login-brand .brand-symbol {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.96);
    color: #07508a;
    box-shadow: 0 10px 24px rgba(1, 31, 59, 0.18);
    font-weight: 900;
    letter-spacing: -0.04em;
}

.login-brand strong {
    color: #ffffff;
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.login-visual {
    position: relative;
    z-index: 1;
    flex: 1;
    min-height: 520px;
    display: grid;
    place-items: center;
    margin-top: 28px;
}

.login-visual::before {
    content: "";
    position: absolute;
    inset: 9% 1% 4%;
    border: 1px solid rgba(175, 222, 250, 0.11);
    border-radius: 44% 56% 57% 43% / 41% 42% 58% 59%;
    background:
        linear-gradient(rgba(181, 226, 250, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(181, 226, 250, 0.055) 1px, transparent 1px),
        rgba(190, 229, 250, 0.025);
    background-size: 32px 32px;
    transform: rotate(-5deg);
}

.login-visual::after {
    content: "";
    position: absolute;
    width: 245px;
    height: 245px;
    border-radius: 50%;
    background: rgba(80, 181, 235, 0.13);
    filter: blur(18px);
}

.login-visual-core {
    position: relative;
    z-index: 4;
    width: 136px;
    height: 136px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(221, 244, 255, 0.42);
    border-radius: 34px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(196, 232, 251, 0.08));
    color: #effaff;
    box-shadow:
        0 28px 65px rgba(0, 26, 48, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.24);
    backdrop-filter: blur(12px);
    transform: rotate(-5deg);
}

.login-visual-core .ui-icon {
    width: 62px;
    height: 62px;
    stroke-width: 1.45;
    transform: rotate(5deg);
}

.login-visual-orbit {
    position: absolute;
    z-index: 2;
    border: 1px solid rgba(174, 224, 250, 0.22);
    border-radius: 50%;
}

.login-visual-orbit-large {
    width: min(430px, 87%);
    aspect-ratio: 1;
    transform: rotate(-18deg) scaleY(0.62);
}

.login-visual-orbit-small {
    width: min(315px, 66%);
    aspect-ratio: 1;
    border-style: dashed;
    transform: rotate(24deg) scaleY(0.68);
}

.login-visual-dot {
    position: absolute;
    z-index: 3;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(228, 247, 255, 0.7);
    border-radius: 50%;
    background: #319bd4;
    box-shadow: 0 0 0 8px rgba(49, 155, 212, 0.11);
}

.login-visual-dot-one {
    top: 26%;
    right: 14%;
}

.login-visual-dot-two {
    bottom: 21%;
    left: 17%;
}

.login-visual-dot-three {
    right: 25%;
    bottom: 13%;
    width: 7px;
    height: 7px;
}

.login-visual-card {
    position: absolute;
    z-index: 5;
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(210, 239, 254, 0.26);
    border-radius: 17px;
    background: rgba(213, 240, 254, 0.11);
    color: #cbeeff;
    box-shadow: 0 16px 36px rgba(1, 33, 57, 0.2);
    backdrop-filter: blur(9px);
}

.login-visual-card .ui-icon {
    width: 27px;
    height: 27px;
}

.login-visual-card-users {
    top: 22%;
    left: 13%;
    transform: rotate(-8deg);
}

.login-visual-card-shield {
    right: 11%;
    bottom: 19%;
    transform: rotate(9deg);
}

.login-copy-main {
    position: relative;
    z-index: 1;
    max-width: 570px;
}

.login-copy .eyebrow {
    margin: 0 0 12px;
    color: #acd9fa;
}

.login-copy h1 {
    max-width: 12ch;
    margin: 0;
    color: #ffffff;
    font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: clamp(2.2rem, 4.2vw, 4.25rem);
    font-weight: 780;
    line-height: 0.99;
    letter-spacing: -0.055em;
    text-wrap: balance;
}

.login-copy .login-lead {
    max-width: 49ch;
    margin: 24px 0 0;
    color: rgba(235, 246, 255, 0.84);
    font-size: 1.02rem;
    line-height: 1.65;
}

.login-highlights {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 34px;
}

.login-highlight {
    min-width: 0;
    padding: 14px;
    border: 1px solid rgba(198, 230, 251, 0.16);
    border-radius: 12px;
    background: rgba(218, 240, 255, 0.075);
    backdrop-filter: blur(7px);
}

.login-highlight > span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    margin-bottom: 12px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.12);
    color: #ccecff;
}

.login-highlight p,
.login-highlight strong,
.login-highlight small {
    display: block;
    margin: 0;
}

.login-highlight strong {
    color: #ffffff;
    font-size: 0.88rem;
    line-height: 1.3;
}

.login-highlight small {
    margin-top: 5px;
    color: rgba(226, 242, 253, 0.68);
    font-size: 0.72rem;
    line-height: 1.45;
}

.login-copy-foot {
    position: relative;
    z-index: 1;
    margin: auto 0 0;
    padding-top: 36px;
    color: rgba(227, 243, 255, 0.6) !important;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-form {
    min-width: 0;
    align-content: center;
    padding: clamp(36px, 4.5vw, 62px);
    border: 0;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
}

.login-form-heading {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    margin-bottom: 26px;
}

.login-form-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: #e6f2fb;
    color: #0c65a6;
}

.login-form-icon .ui-icon {
    width: 23px;
    height: 23px;
}

.login-form-heading .eyebrow {
    margin: 0 0 3px;
    color: #56809f;
}

.login-form h2 {
    margin: 0;
    color: #123d5d;
    font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: clamp(1.65rem, 2.4vw, 2rem);
    letter-spacing: -0.035em;
}

.login-form-heading p:last-child {
    margin: 5px 0 0;
    color: #718292;
    font-size: 0.92rem;
}

.login-form > label {
    gap: 7px;
    margin-top: 15px;
}

.login-form input {
    min-height: 48px;
    border-color: #c9d9e6;
    border-radius: 10px;
    background: #f7fafc;
}

.login-form input:hover {
    border-color: #9dbbd2;
}

.login-form input:focus {
    border-color: #1976b9;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(25, 118, 185, 0.12);
}

.login-form .btn-primary {
    min-height: 48px;
    margin-top: 9px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0b65ad, #084b86);
    box-shadow: 0 10px 22px rgba(8, 78, 134, 0.2);
}

.login-form .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 13px 27px rgba(8, 78, 134, 0.25);
}

.demo-accounts {
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid #dce7ef;
}

.demo-accounts-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}

.demo-accounts-heading .eyebrow {
    margin: 0 0 2px;
    color: #68859b;
}

.demo-accounts h3 {
    margin: 0;
    color: #173f5d;
    font-size: 1.02rem;
    letter-spacing: -0.015em;
}

.demo-password {
    flex: 0 0 auto;
    padding: 5px 8px;
    border-radius: 7px;
    background: #eef5fa;
    color: #547087;
    font-size: 0.72rem;
}

.demo-password strong {
    color: #214c6d;
    font-family: Consolas, "Courier New", monospace;
}

.demo-account-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    padding: 5px;
    border-radius: 11px;
    background: #edf4f9;
}

.demo-account-tabs [role="tab"] {
    min-width: 0;
    min-height: 39px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #5e778a;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 750;
}

.demo-account-tabs [role="tab"] .ui-icon {
    width: 16px;
    height: 16px;
}

.demo-account-tabs [role="tab"]:hover {
    color: #155f95;
}

.demo-account-tabs [role="tab"]:focus-visible {
    outline: 3px solid rgba(25, 118, 185, 0.26);
    outline-offset: 1px;
}

.demo-account-tabs [aria-selected="true"] {
    background: #ffffff;
    color: #0a619f;
    box-shadow: 0 3px 10px rgba(30, 75, 107, 0.12);
}

.demo-account-list {
    display: grid;
    gap: 8px;
    margin-top: 11px;
}

.demo-account {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid #d7e4ed;
    border-radius: 10px;
    background: #ffffff;
    color: #2a4b63;
    cursor: pointer;
    text-align: left;
    transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.demo-account:hover {
    z-index: 1;
    border-color: #8cb9d9;
    background: #f6fbff;
    box-shadow: 0 7px 18px rgba(31, 85, 124, 0.1);
    transform: translateY(-1px);
}

.demo-account:focus-visible {
    outline: 3px solid rgba(25, 118, 185, 0.25);
    outline-offset: 1px;
}

.demo-account-avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #e5f1f9;
    color: #0a639f;
    font-size: 0.72rem;
    font-weight: 900;
}

.demo-account-identity {
    min-width: 0;
}

.demo-account-identity strong,
.demo-account-identity small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.demo-account-identity strong {
    color: #23465f;
    font-size: 0.82rem;
}

.demo-account-identity small {
    margin-top: 1px;
    color: #718695;
    font-size: 0.72rem;
}

.demo-account-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #156a9f;
    font-size: 0.7rem;
    font-weight: 800;
    white-space: nowrap;
}

.demo-account-action .ui-icon {
    width: 14px;
    height: 14px;
    transform: rotate(180deg);
}

@media (min-width: 901px) {
    .login-panel {
        animation: login-panel-enter 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .login-form > * {
        animation: login-content-enter 380ms ease both;
    }

    .login-form > :nth-child(2) { animation-delay: 50ms; }
    .login-form > :nth-child(3) { animation-delay: 90ms; }
    .login-form > :nth-child(4) { animation-delay: 130ms; }
    .login-form > :nth-child(5) { animation-delay: 170ms; }
    .login-form > :nth-child(6) { animation-delay: 210ms; }
    .login-form > :nth-child(7) { animation-delay: 250ms; }
}

@keyframes login-panel-enter {
    from { transform: translateY(16px) scale(0.992); }
    to { transform: none; }
}

@keyframes login-content-enter {
    from { transform: translateY(8px); }
    to { transform: none; }
}

@media (max-width: 900px) {
    .login-panel {
        grid-template-columns: 1fr;
        width: min(680px, 100%);
    }

    .login-copy {
        min-height: 0;
        padding: 38px;
    }

    .login-brand {
        margin-bottom: 0;
    }

    .login-visual {
        min-height: 300px;
        margin-top: 16px;
    }

    .login-copy h1 {
        max-width: 17ch;
        font-size: clamp(2rem, 7vw, 3.25rem);
    }

    .login-highlights {
        margin-top: 26px;
    }

    .login-copy-foot {
        display: none;
    }

    .login-form {
        padding: 38px;
    }
}

@media (max-width: 640px) {
    .login-screen {
        display: block;
        padding: 14px;
    }

    .login-panel {
        border-radius: 17px;
    }

    .login-copy {
        gap: 0;
        padding: 25px 22px 27px;
    }

    .login-brand {
        margin-bottom: 0;
    }

    .login-visual {
        min-height: 225px;
        margin-top: 12px;
    }

    .login-visual::before {
        inset: 4% 3% 0;
        background-size: 24px 24px;
    }

    .login-visual-core {
        width: 94px;
        height: 94px;
        border-radius: 25px;
    }

    .login-visual-core .ui-icon {
        width: 43px;
        height: 43px;
    }

    .login-visual-card {
        width: 47px;
        height: 47px;
        border-radius: 13px;
    }

    .login-visual-card .ui-icon {
        width: 21px;
        height: 21px;
    }

    .login-visual-card-users {
        top: 18%;
        left: 12%;
    }

    .login-visual-card-shield {
        right: 10%;
        bottom: 15%;
    }

    .login-brand .brand-symbol {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
        border-radius: 11px;
    }

    .login-copy h1 {
        max-width: 15ch;
        font-size: clamp(1.9rem, 9vw, 2.5rem);
        line-height: 1.02;
    }

    .login-copy .login-lead {
        margin-top: 16px;
        font-size: 0.9rem;
        line-height: 1.55;
    }

    .login-highlights {
        grid-template-columns: 1fr;
        gap: 7px;
        margin-top: 20px;
    }

    .login-highlight {
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        padding: 9px 10px;
    }

    .login-highlight > span {
        margin: 0;
    }

    .login-highlight small {
        display: none;
    }

    .login-form {
        padding: 28px 22px 30px;
    }

    .login-form-heading {
        grid-template-columns: 42px minmax(0, 1fr);
        margin-bottom: 21px;
    }

    .login-form-icon {
        width: 42px;
        height: 42px;
        border-radius: 11px;
    }

    .login-form h2 {
        font-size: 1.55rem;
    }

    .demo-accounts-heading {
        align-items: start;
    }

    .demo-password {
        max-width: 135px;
        text-align: right;
    }

    .demo-account {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .demo-account-avatar {
        width: 34px;
        height: 34px;
    }

    .demo-account-action {
        display: none;
    }
}

@media (max-width: 380px) {
    .login-screen {
        padding: 8px;
    }

    .login-copy,
    .login-form {
        padding-right: 18px;
        padding-left: 18px;
    }

    .demo-account-tabs [role="tab"] {
        gap: 4px;
        padding-inline: 5px;
        font-size: 0.76rem;
    }

    .demo-account-tabs [role="tab"] .ui-icon {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-panel,
    .login-form > *,
    .demo-account,
    .login-form .btn-primary {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}

.login-copy-title {
    position: relative;
    z-index: 2;
    margin-top: clamp(42px, 6vh, 70px);
}

.login-copy-title .eyebrow {
    margin-bottom: 10px;
}

.login-copy-title h1 {
    max-width: 11ch;
    font-size: clamp(2.25rem, 3.6vw, 3.65rem);
    line-height: 1.01;
}

.login-copy-title + .login-visual {
    min-height: 285px;
    margin-top: 12px;
}

@media (max-width: 900px) {
    .login-copy-title {
        margin-top: 30px;
    }

    .login-copy-title h1 {
        max-width: 15ch;
        font-size: clamp(2rem, 6vw, 3rem);
    }

    .login-copy-title + .login-visual {
        min-height: 245px;
    }
}

@media (max-width: 640px) {
    .login-copy-title {
        margin-top: 25px;
    }

    .login-copy-title h1 {
        max-width: 14ch;
        font-size: clamp(1.85rem, 8vw, 2.3rem);
    }

    .login-copy-title + .login-visual {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* HNUE institutional interface */
:root {
    --hnue-blue: #0b4f9c;
    --hnue-blue-deep: #07376f;
    --hnue-blue-bright: #1976d2;
    --hnue-blue-soft: #eaf3fc;
    --paper: #f3f7fb;
    --surface: #ffffff;
    --surface-soft: #edf4fa;
    --surface-strong: #dceaf7;
    --ink: #102a43;
    --muted: #62778d;
    --line: #d7e3ee;
    --brand: var(--hnue-blue);
    --brand-dark: var(--hnue-blue-deep);
    --accent: var(--hnue-blue-bright);
    --danger: #b4232e;
    --info: #2468a7;
    --shadow: 0 18px 44px rgba(27, 78, 128, 0.09);
    --shadow-soft: 0 8px 24px rgba(27, 78, 128, 0.07);
}

html {
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at 90% 4%, rgba(54, 137, 214, 0.1), transparent 24rem),
        radial-gradient(circle at 28% 100%, rgba(14, 87, 159, 0.06), transparent 32rem),
        var(--paper);
    background-attachment: fixed;
    color: var(--ink);
    font-family: Aptos, "Segoe UI Variable", "Segoe UI", Tahoma, sans-serif;
    -webkit-tap-highlight-color: rgba(25, 118, 210, 0.18);
}

.app-shell {
    min-height: 100dvh;
}

.skip-link {
    z-index: 70;
    border-radius: 10px;
    background: #ffffff;
    color: var(--hnue-blue-deep);
    box-shadow: var(--shadow);
}

.sidebar {
    z-index: 50;
    width: 280px;
    height: 100dvh;
    padding: 24px 20px 20px;
    gap: 28px;
    overflow-y: auto;
    background:
        radial-gradient(circle at 10% 0%, rgba(101, 177, 242, 0.24), transparent 20rem),
        linear-gradient(180deg, #0b57a5 0%, #083f7e 58%, #062f60 100%);
    color: #f8fbff;
    box-shadow: 18px 0 48px rgba(5, 51, 98, 0.12);
    transition: opacity 160ms ease, transform 180ms ease-out;
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 2px 4px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.brand-symbol {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--hnue-blue-deep);
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    box-shadow: 0 9px 22px rgba(3, 36, 70, 0.18);
}

.brand-product {
    display: grid;
    gap: 3px;
}

.brand-product strong {
    color: #ffffff;
    font-size: 1.08rem;
    font-weight: 750;
    letter-spacing: -0.02em;
}

.brand-product small,
.sidebar-user span {
    color: rgba(238, 247, 255, 0.72);
}

.nav-list {
    gap: 6px;
}

.nav-list a {
    position: relative;
    min-height: 46px;
    display: flex;
    align-items: center;
    padding: 11px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: rgba(244, 249, 255, 0.82);
    font-weight: 650;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-list a::before {
    content: "";
    width: 3px;
    height: 18px;
    margin-right: 10px;
    border-radius: 3px;
    background: transparent;
}

.nav-list a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(2px);
}

.nav-list a.active {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-list a.active::before {
    background: #ffffff;
}

.sidebar-user {
    padding-top: 18px;
    border-top-color: rgba(255, 255, 255, 0.16);
}

.sidebar-user summary {
    min-height: 54px;
    padding: 7px;
    border-radius: 12px;
}

.sidebar-user summary:hover,
.sidebar-user summary:focus-visible {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-user summary::after {
    color: rgba(255, 255, 255, 0.68);
}

.account-actions a,
.account-actions button {
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.avatar {
    border-radius: 12px;
    background: #ffffff;
    color: var(--hnue-blue-deep);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.avatar-student,
.avatar-lecturer,
.avatar-admin {
    color: #ffffff;
}

.avatar-student {
    background: #20845f;
}

.avatar-lecturer {
    background: #e2a323;
    color: #302100;
}

.avatar-admin {
    background: #c74855;
}

.sidebar-user .avatar-initials {
    font-family: Aptos, "Segoe UI Variable", "Segoe UI", sans-serif;
    transform: none;
}

.main-content {
    padding: 32px clamp(20px, 3vw, 52px) 52px;
}

.main-content > * {
    width: min(1480px, 100%);
    margin-left: auto;
    margin-right: auto;
}

.topbar {
    min-height: 88px;
    margin-bottom: 26px;
    padding: 4px 2px 22px;
    border-bottom: 1px solid rgba(165, 190, 214, 0.52);
}

.topbar h1,
.login-copy h1 {
    color: var(--hnue-blue-deep);
    font-size: clamp(1.85rem, 2.8vw, 2.6rem);
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1.08;
    text-wrap: balance;
}

.eyebrow {
    margin-bottom: 7px;
    color: var(--hnue-blue);
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.035em;
    text-transform: none;
}

.mobile-nav-toggle,
.sidebar-scrim {
    display: none;
}

.sidebar-collapse-toggle {
    display: inline-grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    padding: 0;
    border: 1px solid #c4d8ea;
    border-radius: 10px;
    background: #ffffff;
    color: var(--hnue-blue-deep);
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.sidebar-collapse-toggle .ui-icon {
    transition: transform 180ms ease;
}

@media (min-width: 901px) {
    body.sidebar-collapsed .sidebar {
        width: 0;
        padding-right: 0;
        padding-left: 0;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
    }

    body.sidebar-collapsed .sidebar-collapse-toggle .ui-icon {
        transform: rotate(180deg);
    }
}

.card,
.stat-card,
.login-form,
.group-card,
.course-column,
.topic-group-block,
.empty-state {
    border-color: rgba(185, 207, 227, 0.72);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-soft);
}

.card {
    padding: clamp(18px, 2vw, 26px);
    margin-bottom: 22px;
}

.card h2 {
    color: var(--hnue-blue-deep);
    font-size: 1.32rem;
    letter-spacing: -0.02em;
}

.card h3,
.group-card h3 {
    color: #173f67;
}

.section-heading {
    align-items: center;
    margin-bottom: 20px;
}

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

.stat-grid {
    grid-template-columns: 1.25fr repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    position: relative;
    min-height: 132px;
    padding: 22px;
    overflow: hidden;
    transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.stat-card:hover {
    border-color: #abcbea;
    box-shadow: 0 18px 38px rgba(27, 78, 128, 0.12);
    transform: translateY(-2px);
}

.stat-card:first-child {
    border-color: #c9dbea;
    background: #ffffff;
    color: var(--ink);
}

.stat-card span {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 650;
}

.stat-card:first-child span {
    color: var(--muted);
}

.stat-card strong {
    margin-top: 18px;
    color: var(--hnue-blue-deep);
    font-size: 2.2rem;
    font-weight: 760;
    letter-spacing: -0.04em;
}

.stat-card:first-child strong {
    color: var(--hnue-blue-deep);
}

.period-context {
    padding: 16px 20px;
    border-color: #c9ddf0;
    border-left-color: var(--hnue-blue-bright);
    border-radius: 12px;
    background: rgba(240, 247, 253, 0.92);
}

.period-context-main span {
    color: var(--hnue-blue);
    text-transform: none;
}

.period-context-meta > span:not(.badge) {
    border-color: #d1e1ef;
    border-radius: 9px;
    background: #ffffff;
}

label {
    gap: 7px;
    color: #294b6d;
    font-size: 0.93rem;
    font-weight: 650;
}

input,
select,
textarea {
    min-height: 44px;
    border-color: #bdcfe0;
    border-radius: 10px;
    padding: 10px 12px;
    background: #ffffff;
    color: var(--ink);
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

textarea {
    min-height: 94px;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #91b5d8;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--hnue-blue-bright);
    outline: none;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.16);
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(25, 118, 210, 0.36);
    outline-offset: 3px;
}

.btn {
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #173f67;
    font-weight: 700;
    box-shadow: 0 7px 16px rgba(20, 71, 119, 0.12);
    transition: background-color 170ms ease, border-color 170ms ease, color 170ms ease, transform 170ms ease, box-shadow 170ms ease;
}

.btn:hover {
    filter: none;
    box-shadow: 0 10px 20px rgba(20, 71, 119, 0.17);
    transform: translateY(-1px);
}

.btn:active {
    box-shadow: 0 4px 10px rgba(20, 71, 119, 0.12);
    transform: translateY(1px) scale(0.99);
}

.btn-primary {
    background: var(--hnue-blue);
    color: #ffffff;
}

.btn-primary:hover {
    background: #0a5caf;
}

.btn-light {
    border-color: #c9dbea;
    background: #f5f9fd;
    color: var(--hnue-blue-deep);
    box-shadow: none;
}

.btn-light:hover {
    border-color: #91b5d8;
    background: #eaf3fc;
}

.btn-danger {
    background: var(--danger);
}

.table-wrap {
    border-color: #d4e1ed;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

table {
    background: #ffffff;
}

th,
td {
    padding: 14px 15px;
    border-bottom-color: #e2ebf3;
}

th {
    background: #eaf3fb;
    color: #315778;
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.025em;
    text-transform: none;
}

tbody tr {
    transition: background-color 150ms ease;
}

tbody tr:hover {
    background: #f6fafe;
}

.badge {
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 750;
}

.filter-tabs {
    padding: 5px;
    border-radius: 12px;
    background: #eaf2f9;
}

.filter-pill {
    border-radius: 9px;
    color: #496984;
}

.filter-pill:hover,
.filter-pill.active {
    background: #ffffff;
    color: var(--hnue-blue-deep);
    box-shadow: 0 5px 14px rgba(27, 78, 128, 0.09);
}

.page-link,
.page-gap {
    border-radius: 8px;
}

.page-link.active {
    background: var(--hnue-blue);
    color: #ffffff;
}

.alert {
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    transition: opacity 250ms ease, transform 250ms ease;
}

.alert-success {
    border-color: #9dceb8;
    background: #edf8f3;
    color: #1d6648;
}

.alert-error {
    border-color: #e3b0b6;
    background: #fff2f3;
    color: #8d1f2a;
}

.student-search-results {
    border-color: #cbddea;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.student-search-option:hover,
.student-search-option:focus-visible {
    background: #edf6fd;
}

.course-period-card,
.cst-course-card,
.cst-course-rail,
.cst-rail-list a {
    border-color: #d4e3ef;
    border-radius: 12px;
}

.course-period-card.active,
.cst-course-card.active,
.cst-rail-list a.active {
    border-color: #75a9d8;
    background: #edf6fd;
    box-shadow: 0 10px 24px rgba(27, 78, 128, 0.1);
}

.cst-course-chip {
    border-radius: 8px;
    background: rgba(8, 79, 156, 0.9);
}

.cst-enter-button {
    border-radius: 10px;
    background: var(--hnue-blue);
}

.json-cell,
code {
    border-radius: 7px;
    background: #edf4fa;
    color: #234f77;
}

.empty-state {
    padding: 36px;
}

.login-screen {
    min-height: 100dvh;
    padding: clamp(18px, 4vw, 48px);
}

.login-panel {
    width: min(1120px, 100%);
    grid-template-columns: 1.08fr 0.92fr;
    gap: 0;
    overflow: hidden;
    border: 1px solid rgba(176, 201, 224, 0.65);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 30px 80px rgba(14, 65, 113, 0.16);
}

.login-copy {
    position: relative;
    isolation: isolate;
    min-height: 610px;
    padding: clamp(34px, 5vw, 68px);
    border-radius: 0;
    overflow: hidden;
    background:
        linear-gradient(145deg, rgba(8, 74, 143, 0.94), rgba(5, 45, 91, 0.98)),
        url("../img/course-banner.png") center / cover;
    color: #ffffff;
}

.login-copy::after {
    content: "";
    position: absolute;
    right: -90px;
    bottom: -100px;
    z-index: -1;
    width: 310px;
    height: 310px;
    border: 52px solid rgba(255, 255, 255, 0.07);
    border-radius: 50%;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 38px;
    color: #ffffff;
}

.login-brand .brand-symbol {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
}

.login-brand strong {
    font-size: 1.05rem;
    letter-spacing: -0.015em;
}

.login-copy h1 {
    max-width: 13ch;
    color: #ffffff;
}

.login-copy p {
    max-width: 55ch;
    color: rgba(240, 247, 255, 0.82);
}

.login-copy .eyebrow {
    color: #b9ddff;
}

.login-form {
    padding: clamp(32px, 5vw, 62px);
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.login-form h2 {
    margin: 0 0 8px;
    color: var(--hnue-blue-deep);
    font-size: 1.6rem;
}

.login-form .btn {
    width: 100%;
    margin-top: 4px;
}

.login-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    font-size: 0.94rem;
}

.login-form-actions a {
    color: var(--hnue-blue);
    font-weight: 700;
    text-decoration: none;
}

.login-form-actions a:hover,
.login-form-actions a:focus-visible {
    text-decoration: underline;
}

@media (max-width: 1180px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    body.mobile-nav-open {
        overflow: hidden;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(310px, 86vw);
        height: 100dvh;
        padding: 22px 18px;
        transform: translateX(-104%);
        transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
    }

    body.mobile-nav-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-scrim {
        position: fixed;
        inset: 0;
        z-index: 40;
        border: 0;
        background: rgba(5, 37, 70, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 200ms ease;
    }

    body.mobile-nav-open .sidebar-scrim {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        padding: 18px 18px 38px;
    }

    .topbar {
        display: flex;
        align-items: center;
        min-height: 74px;
        margin-bottom: 20px;
        padding-bottom: 16px;
    }

    .mobile-nav-toggle {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 9px;
        min-height: 42px;
        padding: 9px 12px;
        border: 1px solid #c4d8ea;
        border-radius: 10px;
        background: #ffffff;
        color: var(--hnue-blue-deep);
        font-weight: 700;
        box-shadow: var(--shadow-soft);
    }

    .sidebar-collapse-toggle {
        display: none;
    }

    .mobile-nav-icon {
        display: grid;
        gap: 3px;
        width: 18px;
    }

    .mobile-nav-icon span {
        display: block;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
    }

    .stat-grid,
    .grid-2,
    .form-grid,
    .course-period-grid,
    .course-workspace-3,
    .course-student-grid,
    .cst-course-layout,
    .cst-course-grid,
    .login-panel {
        grid-template-columns: 1fr;
    }

    .form-grid > *,
    .form-grid .form-wide,
    .form-grid .form-span {
        min-width: 0;
        grid-column: 1;
    }

    .form-grid label,
    .form-grid input,
    .form-grid select,
    .form-grid textarea,
    .form-grid .form-note {
        min-width: 0;
        max-width: 100%;
    }

    .login-copy {
        min-height: 0;
        padding: 36px;
    }

    .login-brand {
        margin-bottom: 24px;
    }
}

@media (max-width: 640px) {
    .main-content,
    .login-screen {
        padding: 14px;
    }

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

    .topbar h1 {
        font-size: 1.55rem;
    }

    .topbar .eyebrow {
        display: none;
    }

    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        min-height: 112px;
        padding: 16px;
    }

    .stat-card strong {
        margin-top: 12px;
        font-size: 1.8rem;
    }

    .card {
        min-width: 0;
        padding: 16px;
    }

    .form-grid {
        width: 100%;
        gap: 14px;
    }

    .form-grid input,
    .form-grid select,
    .form-grid textarea {
        width: 100%;
    }

    .form-grid .btn.form-span {
        width: 100%;
    }

    .section-heading,
    .period-context,
    .course-detail-head,
    .group-card-head {
        display: grid;
    }

    .login-panel {
        border-radius: 14px;
    }

    .login-copy,
    .login-form {
        padding: 26px 22px;
    }

    .login-copy h1 {
        font-size: 1.75rem;
    }
}

@media (max-width: 390px) {
    .mobile-nav-toggle > span:last-child {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .sidebar-scrim,
    .nav-list a,
    .stat-card,
    .btn {
        transition: none !important;
    }
}

.nav-section-label {
    margin: -4px 12px -14px;
    color: rgba(231, 243, 255, 0.58);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.055em;
}

.topbar-context {
    display: grid;
    justify-items: end;
    gap: 2px;
    padding-left: 22px;
    border-left: 1px solid #cfdfec;
    color: var(--muted);
    font-size: 0.82rem;
}

.topbar-context strong {
    max-width: 280px;
    color: #274c70;
    font-size: 0.92rem;
    overflow-wrap: anywhere;
    text-align: right;
}

@media (max-width: 900px) {
    .topbar-context {
        display: none;
    }
}

.page-users .grid-2,
.page-groups .grid-2,
.page-registrations .grid-2 {
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
    align-items: start;
}

.page-users .grid-2 > .card:last-child,
.page-registrations .grid-2 > .card:last-child {
    border-color: transparent;
    background: #eaf3fb;
    box-shadow: none;
}

.period-subtabs {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 4px;
    margin-bottom: 20px;
    padding: 4px;
    border: 1px solid #cbddec;
    border-radius: 12px;
    background: #e7f0f8;
}

.period-subtabs a {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: 9px;
    color: #496b88;
    font-weight: 750;
    white-space: nowrap;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.period-subtabs a:hover {
    color: var(--hnue-blue-deep);
    background: rgba(255, 255, 255, 0.62);
}

.period-subtabs a.active {
    background: #ffffff;
    color: var(--hnue-blue-deep);
    box-shadow: 0 3px 10px rgba(27, 78, 128, 0.1);
}

.form-grid {
    gap: 16px;
}

.form-stack {
    gap: 16px;
}

.form-note {
    padding: 11px 13px;
    border-left: 3px solid #75a9d8;
    border-radius: 0 8px 8px 0;
    background: #edf6fd;
    color: #486a86;
    line-height: 1.55;
}

.form-note-warning {
    border-left-color: #c75d67;
    background: #fff1f2;
    color: #8d2832;
}

.inline-form,
.student-search-form,
.action-cell {
    gap: 10px;
}

.notice-list,
.check-list {
    gap: 0;
}

.notice-list span,
.check-list li {
    padding: 12px 2px 12px 16px;
    border-left: 3px solid #8bb6dc;
    border-radius: 0;
    background: transparent;
}

.notice-list span + span,
.check-list li + li {
    margin-top: 8px;
}

.member-list li,
.request-row {
    padding: 13px 0;
    border-bottom-color: #dce8f2;
}

.group-card {
    position: relative;
    padding: 22px 22px 22px 26px;
    border: 1px solid #d4e3ef;
    border-left: 4px solid #6fa5d5;
    background: #ffffff;
    box-shadow: none;
}

.group-card:hover {
    border-color: #a9c8e3;
    border-left-color: var(--hnue-blue);
    box-shadow: var(--shadow-soft);
}

.group-card-head {
    align-items: center;
}

.course-period-grid {
    grid-template-columns: 1.25fr repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.course-period-card {
    min-height: 150px;
    padding: 18px;
    border-color: #d4e3ef;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: none;
    transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.course-period-card:hover,
.course-period-card:focus-visible {
    border-color: #8ab5dc;
    background: #ffffff;
    box-shadow: var(--shadow-soft);
    transform: translateY(-2px);
}

.course-period-card.active {
    border-color: var(--hnue-blue);
    background: linear-gradient(145deg, #edf6fd, #ffffff);
    box-shadow: inset 4px 0 0 var(--hnue-blue), var(--shadow-soft);
}

.course-period-code {
    color: var(--hnue-blue);
    font-weight: 750;
    letter-spacing: 0.035em;
    text-transform: none;
}

.course-workspace-3 {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(280px, 0.82fr);
    gap: 18px;
}

.course-student-grid {
    grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 0.9fr));
    gap: 18px;
}

.course-column {
    box-shadow: none;
}

.course-column:nth-child(1) {
    border-top: 4px solid #1768b4;
}

.course-column:nth-child(2) {
    border-top: 4px solid #5b91c2;
}

.course-column:nth-child(3) {
    border-top: 4px solid #9abbd8;
}

.course-list,
.course-topic-groups {
    gap: 10px;
}

.course-list-item,
.topic-group-block {
    padding: 14px;
    border-color: #d8e5f0;
    border-radius: 10px;
    background: #f8fbfe;
}

.course-list-item:hover,
.topic-group-block:hover {
    border-color: #aecbe4;
    background: #ffffff;
}

.topic-group-row {
    border-top-color: #dbe7f1;
}

.cst-course-grid {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    grid-auto-flow: dense;
    gap: 18px;
}

.cst-course-card {
    overflow: hidden;
    box-shadow: none;
    transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.cst-course-card:hover {
    border-color: #93b9da;
    box-shadow: var(--shadow-soft);
    transform: translateY(-3px);
}

.cst-course-card.active {
    grid-column: span 2;
}

.cst-course-media img {
    transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

.cst-course-card:hover .cst-course-media img {
    transform: scale(1.035);
}

.cst-course-media {
    background: #dcebf7;
}

.cst-course-chip {
    border: 1px solid rgba(255, 255, 255, 0.34);
    background: rgba(8, 70, 132, 0.88);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(8, 62, 116, 0.16);
}

.cst-enter-button {
    box-shadow: none;
}

.cst-course-rail {
    border-color: #d4e3ef;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-soft);
}

.cst-rail-list a {
    background: transparent;
    box-shadow: none;
}

.empty-state {
    max-width: 680px;
    padding: 42px;
    border-style: dashed;
    box-shadow: none;
}

.empty-state::before {
    content: "QL";
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    margin: 0 auto 18px;
    border-radius: 18px;
    background: var(--hnue-blue);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    box-shadow: 0 12px 28px rgba(11, 79, 156, 0.2);
}

.login-screen > .login-form {
    width: min(540px, 100%);
    border: 1px solid #d1e1ee;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
    .page-users .grid-2,
    .page-groups .grid-2,
    .page-registrations .grid-2,
    .course-workspace-3,
    .course-student-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .course-workspace-3 > :last-child,
    .course-student-grid > :last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .page-users .grid-2,
    .page-groups .grid-2,
    .page-registrations .grid-2,
    .course-period-grid,
    .course-workspace-3,
    .course-student-grid,
    .cst-course-grid {
        grid-template-columns: 1fr;
    }

    .course-workspace-3 > :last-child,
    .course-student-grid > :last-child,
    .cst-course-card.active {
        grid-column: auto;
    }
}

@media (max-width: 640px) {
    .topbar {
        position: sticky;
        top: 0;
        z-index: 30;
        width: auto;
        min-height: 70px;
        margin: -14px -14px 18px;
        padding: 12px 14px;
        border-bottom-color: rgba(174, 198, 220, 0.72);
        background: rgba(243, 247, 251, 0.92);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .table-wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .table-wrap table,
    .table-wrap tbody {
        display: block;
        min-width: 0;
        background: transparent;
    }

    .table-wrap thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .table-wrap tbody {
        display: grid;
        gap: 12px;
    }

    .table-wrap tbody tr {
        display: block;
        overflow: hidden;
        border: 1px solid #d3e2ee;
        border-left: 4px solid #7aa8d1;
        border-radius: 12px;
        background: #ffffff;
        box-shadow: 0 8px 20px rgba(27, 78, 128, 0.07);
    }

    .table-wrap tbody tr:hover {
        background: #ffffff;
    }

    .table-wrap tbody td {
        display: grid;
        grid-template-columns: minmax(96px, 0.38fr) minmax(0, 1fr);
        gap: 12px;
        min-width: 0;
        padding: 11px 13px;
        border-bottom: 1px solid #e4ecf3;
        overflow-wrap: anywhere;
    }

    .table-wrap tbody td::before {
        content: attr(data-label);
        color: #54708a;
        font-size: 0.76rem;
        font-weight: 750;
        line-height: 1.35;
    }

    .table-wrap tbody td:last-child {
        border-bottom: 0;
    }

    .table-wrap tbody td[colspan] {
        display: block;
    }

    .table-wrap tbody td[colspan]::before {
        content: none;
    }

    .table-wrap td input,
    .table-wrap td select,
    .table-wrap td input[type="email"],
    .table-wrap td input[name="full_name"],
    .table-wrap td input[name="period_name"],
    .table-wrap td input[name="phone"],
    .table-wrap td input[type="number"] {
        min-width: 0;
        width: 100%;
    }

    .table-wrap .action-cell,
    .table-wrap .inline-form {
        align-items: stretch;
    }

    .table-wrap .action-cell > *,
    .table-wrap .inline-form > * {
        flex: 1 1 100%;
    }

}

@media (max-width: 900px) {
    .sidebar .nav-list {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .sidebar .nav-list a {
        justify-content: flex-start;
        min-height: 46px;
        padding: 11px 13px;
        text-align: left;
    }

    .sidebar-user .avatar-initials {
        color: inherit;
    }
}

/* Phone layouts use a strict single content column to prevent native date
   controls and long Vietnamese labels from forcing horizontal overflow. */
@media (max-width: 700px) {
    .edit-dialog,
    .edit-dialog-wide {
        width: 100vw;
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
    }

    .edit-dialog-shell {
        min-height: 100dvh;
        max-height: 100dvh;
    }

    .edit-dialog-header,
    .edit-dialog-body {
        padding: 16px;
    }

    .edit-dialog-footer {
        margin: 4px -16px -16px;
        padding: 14px 16px;
    }

    .edit-dialog-footer .btn {
        flex: 1 1 0;
    }

    html,
    body,
    .app-shell,
    .main-content,
    .main-content > * {
        max-width: 100%;
        overflow-x: clip;
    }

    .form-grid {
        width: 100%;
        grid-template-columns: minmax(0, 1fr);
    }

    .form-grid > *,
    .form-grid .form-wide,
    .form-grid .form-span {
        min-width: 0;
        max-width: 100%;
        grid-column: 1 / -1;
    }

    .form-grid label,
    .form-grid input,
    .form-grid select,
    .form-grid textarea,
    .form-grid .form-note {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: normal;
        word-break: normal;
    }

    .form-grid .check-row {
        display: flex;
        align-items: center;
        width: 100%;
    }

    .form-grid .check-row input[type="checkbox"] {
        flex: 0 0 28px;
        width: 28px;
        min-width: 28px;
        height: 28px;
    }

    .form-grid .btn.form-span {
        width: 100%;
    }

    .period-subtabs {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-bottom: 16px;
    }

    .period-subtabs a {
        min-width: 0;
        padding-inline: 10px;
        white-space: normal;
        text-align: center;
    }

    .sidebar-user {
        margin-top: auto;
    }
}

.sidebar-user .avatar-student .avatar-initials,
.sidebar-user .avatar-admin .avatar-initials {
    color: #ffffff;
}

.sidebar-user .avatar-lecturer .avatar-initials {
    color: #302100;
}

.sidebar-user .avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-user .avatar-initials {
    width: auto;
    line-height: 1;
    text-align: center;
    transform: none;
}

@media (min-width: 901px) and (max-width: 1240px) {
    .cst-course-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .cst-course-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .cst-course-rail {
        position: static;
        max-height: none;
        order: -1;
    }

    .cst-course-picker .cst-course-rail {
        display: none;
    }
}

@media (max-width: 900px) {
    .cst-course-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Final interface rhythm: compact administration chrome with predictable
   alignment across dense forms and data-heavy pages. */
.main-content {
    padding-top: 24px;
}

.topbar {
    min-height: 74px;
    margin-bottom: 22px;
    padding: 0 2px 18px;
}

.topbar h1 {
    font-size: clamp(1.9rem, 2.6vw, 2.15rem);
    line-height: 1.08;
}

.topbar .eyebrow {
    display: none;
}

.main-content > .period-subtabs {
    width: fit-content;
    min-width: 340px;
    margin-left: 0;
    margin-right: auto;
}

.card {
    padding: clamp(20px, 2vw, 26px);
}

.section-heading {
    margin-bottom: 18px;
}

.section-heading h2 {
    line-height: 1.25;
}

.page-periods .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px 16px;
}

.page-periods .form-grid label,
.page-users .form-stack label,
.page-users .form-grid label {
    gap: 7px;
}

.page-periods .form-note {
    align-self: stretch;
}

.table-wrap {
    scrollbar-width: thin;
    scrollbar-color: #91b3d1 #edf4fa;
}

.table-wrap::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

.table-wrap::-webkit-scrollbar-track {
    background: #edf4fa;
}

.table-wrap::-webkit-scrollbar-thumb {
    border: 2px solid #edf4fa;
    border-radius: 999px;
    background: #91b3d1;
}

.page-periods .table-wrap table {
    min-width: 1080px;
}

.page-logs .table-wrap table {
    min-width: 1180px;
}

.page-periods th,
.page-periods td,
.page-logs th,
.page-logs td {
    padding-inline: 13px;
    vertical-align: top;
}

.page-periods .action-cell {
    min-width: 142px;
}

.page-periods .action-cell .btn {
    flex: 1 1 auto;
    white-space: nowrap;
}

.page-users .grid-2 > .card:last-child {
    border-color: #cddfec;
    background: #f1f7fc;
}

.page-users .notice-list span {
    color: #355977;
    line-height: 1.5;
}

@media (max-width: 900px) {
    .main-content {
        padding-top: 18px;
    }

    .page-periods .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 700px) {
    .main-content > .period-subtabs {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 640px) {
    .topbar {
        min-height: 70px;
        margin: -14px -14px 18px;
        padding: 12px 14px;
    }

    .topbar h1 {
        font-size: 1.48rem;
    }

    .card {
        padding: 18px 16px;
    }

    .page-periods .table-wrap table,
    .page-logs .table-wrap table {
        min-width: 0;
    }
}

.stat-card .stat-card-icon {
    color: var(--brand);
    font-size: inherit;
    font-weight: inherit;
}

.nav-list a::before {
    margin-right: 0;
}

.icon-text,
.page-title-label,
.heading-label,
.tab-label,
.field-label {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.page-title-label,
.heading-label {
    gap: 10px;
}

.page-title-label .ui-icon {
    width: 0.9em;
    height: 0.9em;
    color: var(--hnue-blue);
}

.heading-label .ui-icon {
    width: 1em;
    height: 1em;
    color: var(--hnue-blue);
}

.tab-label {
    gap: 7px;
}

.tab-label .ui-icon {
    width: 16px;
    height: 16px;
}

.field-label {
    gap: 6px;
}

.link-label,
.course-title-label,
.cst-enter-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.link-label .ui-icon,
.course-title-label .ui-icon,
.cst-enter-button .ui-icon {
    width: 15px;
    height: 15px;
}

.field-label .ui-icon {
    width: 15px;
    height: 15px;
    color: #4f7da5;
}

.form-note {
    position: relative;
    padding-left: 40px;
}

.form-note::before,
.notice-list span::before {
    content: "";
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

.page-users .grid-2 > .card:last-child > .muted {
    color: #526d87;
}

.form-note::before {
    position: absolute;
    top: 13px;
    left: 14px;
}

.form-note-warning::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 2.9 1.8 17a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 2.9a2 2 0 0 0-3.4 0Z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 2.9 1.8 17a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 2.9a2 2 0 0 0-3.4 0Z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E");
}

.notice-list span {
    display: flex;
    align-items: flex-start;
    gap: 9px;
}

.notice-list span::before {
    margin-top: 2px;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
}

.notification-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border: 1px solid #c7d9e7;
    border-radius: 999px;
    background: #fff;
    color: #0b4f8a;
    text-decoration: none;
}
.notification-link strong {
    display: grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #c74855;
    color: #fff;
    font-size: 0.72rem;
}
.notifications-page { display: grid; gap: 20px; }
.notification-list { display: grid; gap: 12px; }
.notification-card {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    border: 1px solid #cfdfeb;
    border-radius: 20px;
    background: linear-gradient(145deg, #fff 0%, #f4f9fd 100%);
    box-shadow: 0 16px 42px rgba(24, 76, 116, 0.08);
}
.notification-card.is-unread { border-left: 5px solid #0b69b7; }
.notification-card h3 { margin: 6px 0; }
.notification-card time { color: #66839a; font-size: 0.86rem; }
.notification-type {
    color: #4d718d;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.notification-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notification-actions form { margin: 0; }
.group-chat {
    display: grid;
    gap: 20px;
    padding: 18px;
    border: 1px solid #cfdfeb;
    border-radius: 20px;
    background: linear-gradient(145deg, #fff 0%, #f4f9fd 100%);
    box-shadow: 0 16px 42px rgba(24, 76, 116, 0.08);
}
.group-chat-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.group-chat-messages {
    min-height: 360px;
    max-height: 58vh;
    overflow-y: auto;
    padding: 16px;
    border: 1px solid #d5e3ed;
    border-radius: 16px;
    background: #edf5fa;
}
.chat-message {
    width: min(78%, 680px);
    margin: 0 0 12px;
    padding: 11px 14px;
    border-radius: 4px 16px 16px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(26, 76, 112, 0.08);
}
.chat-message.is-mine { margin-left: auto; border-radius: 16px 4px 16px 16px; background: #dceeff; }
.chat-message.is-pending { opacity: 0.68; }
.chat-message.is-failed { border-color: #c94b45; background: #fff1ef; }
.chat-message-meta { display: flex; justify-content: space-between; gap: 14px; color: #54748c; font-size: 0.82rem; }
.chat-message p { margin: 7px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message-retry { margin-top: 8px; border: 0; padding: 0; color: #a52d28; background: transparent; font: inherit; font-weight: 700; cursor: pointer; }
.group-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.group-chat-widget > [data-group-chat] { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; min-height: 0; }
.group-chat-widget .group-chat-messages { min-height: 0; max-height: none; border: 0; border-radius: 0; }
.floating-launcher-group { background: linear-gradient(145deg, #23a879, #16785a); }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
@media (max-width: 700px) {
    .notification-link span { display: none; }
    .notification-card { flex-direction: column; }
    .group-chat-form { grid-template-columns: minmax(0, 1fr); }
    .group-chat-header { align-items: stretch; flex-direction: column; }
    .chat-message { width: 90%; }
}

.floating-tools {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1200;
    display: grid;
    justify-items: end;
    gap: 12px;
}
.floating-panels { width: min(440px, calc(100vw - 32px)); }
.floating-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    width: 100%;
    height: min(620px, calc(100vh - 130px));
    overflow: hidden;
    border: 1px solid #bed2e4;
    border-radius: 20px;
    background: #f8fbfe;
    box-shadow: 0 24px 70px rgba(9, 43, 75, 0.28);
}
.floating-panel[hidden] { display: none; }
.floating-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 17px;
    background: linear-gradient(120deg, #0b559f, #2475db);
    color: #fff;
}
.floating-panel-header div { display: grid; gap: 2px; }
.floating-panel-header span { font-size: 0.78rem; opacity: 0.85; }
.floating-panel-header button {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}
.floating-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
    align-items: end;
    padding: 12px;
    border-top: 1px solid #d5e2ec;
    background: #fff;
}
.floating-composer textarea { min-height: 46px; max-height: 130px; margin: 0; resize: none; }
.floating-status { min-height: 0; margin: 0; padding: 0 13px 8px; background: #fff; color: #a23f49; font-size: 0.82rem; }
.floating-launchers { display: flex; align-items: center; gap: 10px; }
.floating-launcher {
    position: relative;
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(10, 63, 124, 0.32);
    transition: transform 160ms ease, box-shadow 160ms ease;
}
.floating-launcher:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(10, 63, 124, 0.4); }
.floating-chat-icon { position: relative; width: 24px; height: 17px; border-radius: 50%; background: #fff; }
.floating-chat-icon::after {
    content: '';
    position: absolute;
    right: 2px;
    bottom: -3px;
    border-width: 4px 0 0 6px;
    border-style: solid;
    border-color: transparent transparent transparent #fff;
    transform: rotate(18deg);
}
.floating-launcher-label {
    position: absolute;
    right: calc(100% + 9px);
    padding: 6px 9px;
    border-radius: 8px;
    background: #173650;
    color: #fff;
    font-size: 0.78rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(4px);
    transition: opacity 150ms ease, transform 150ms ease;
}
.floating-launcher:hover .floating-launcher-label,
.floating-launcher:focus-visible .floating-launcher-label { opacity: 1; transform: translateX(0); }

.group-card.group-card-compact {
    padding: 0;
    overflow: visible;
}

.group-card-summary {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 18px;
    list-style: none;
    cursor: pointer;
}

.group-card-summary::-webkit-details-marker,
.member-action-menu > summary::-webkit-details-marker,
.member-transfer-panel > summary::-webkit-details-marker {
    display: none;
}

.group-card-summary-main {
    min-width: 0;
}

.group-card-summary-main h3,
.group-card-summary-main p {
    margin: 0;
}

.group-card-summary-main p {
    margin-top: 5px;
    overflow-wrap: anywhere;
}

.group-card-summary-action {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    color: var(--hnue-blue);
    font-size: 0.84rem;
    font-weight: 750;
}

.group-card-summary-action .ui-icon {
    transition: transform 180ms ease;
}

.group-card-compact[open] .group-card-summary-action .ui-icon {
    transform: rotate(180deg);
}

.group-card-body {
    padding: 16px 18px 18px;
    border-top: 1px solid #dce8f2;
    background: #fbfdff;
}

.group-card-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.group-card-body .table-wrap.compact td,
.group-card-body .table-wrap.compact th {
    padding-top: 10px;
    padding-bottom: 10px;
}

.member-action-menu {
    width: min(100%, 290px);
}

.member-action-menu > summary {
    justify-content: center;
    list-style: none;
}

.member-action-popover {
    display: grid;
    gap: 8px;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid #ccddea;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: var(--shadow-soft);
}

.member-action-popover form,
.member-action-popover .btn {
    width: 100%;
    margin: 0;
}

.member-transfer-panel {
    padding-top: 8px;
    border-top: 1px solid #dce8f2;
}

.member-transfer-panel > summary {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 2px;
    list-style: none;
    color: var(--hnue-blue);
    font-weight: 750;
    cursor: pointer;
}

.member-transfer-panel .inline-form {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.member-transfer-panel select {
    width: 100%;
    min-width: 0;
}

.group-management-dialog-body,
.dialog-form-section {
    display: grid;
    gap: 12px;
}

.dialog-form-section + .dialog-form-section {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #dce8f2;
}

.dialog-form-section h3,
.dialog-form-section form,
.dialog-form-section p {
    margin: 0;
}

.dialog-danger-section {
    padding: 14px;
    border: 1px solid #eed2d5;
    border-radius: 10px;
    background: #fff8f8;
}

@media (max-width: 600px) {
    .floating-tools { right: 12px; bottom: 12px; }
    .floating-panels { width: calc(100vw - 24px); }
    .floating-panel { height: min(72vh, 620px); }
    .floating-composer { grid-template-columns: minmax(0, 1fr); }
    .floating-composer .btn { width: 100%; }
}

@media (max-width: 700px) {
    .group-card-summary {
        min-height: 0;
        align-items: flex-start;
        gap: 10px;
        padding: 13px 14px;
    }

    .group-card-summary-main h3 .heading-label {
        align-items: flex-start;
    }

    .group-card-summary-main p {
        font-size: 0.82rem;
        line-height: 1.45;
    }

    .group-card-summary-action span {
        display: none;
    }

    .group-card-body {
        padding: 13px;
    }

    .group-card-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .group-card-toolbar .btn,
    .member-action-menu,
    .member-action-menu > summary,
    .group-management-dialog-body .inline-form,
    .group-management-dialog-body .inline-form > *,
    .dialog-form-section .btn,
    .dialog-form-section select {
        width: 100%;
        min-width: 0;
    }

    .member-action-popover {
        box-shadow: none;
    }
}

/* UI audit: consistent type rhythm and compact responsive chrome. */
h1,
h2,
h3 {
    text-wrap: balance;
}

p,
li {
    text-wrap: pretty;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: 0.78;
}

table {
    font-variant-numeric: tabular-nums;
}

.topbar > div:not(.topbar-context) {
    min-width: 0;
    flex: 1 1 auto;
}

.page-title-label > span,
.heading-label > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.floating-tools {
    right: calc(22px + env(safe-area-inset-right));
    bottom: calc(22px + env(safe-area-inset-bottom));
}

.floating-panel {
    height: min(620px, calc(100dvh - 130px));
    overscroll-behavior: contain;
}

@media (max-width: 900px) {
    body.mobile-nav-open .floating-tools {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }

    .topbar {
        gap: 10px;
    }

    .topbar-context {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        margin-left: auto;
        padding-left: 0;
        border-left: 0;
    }

    .topbar-context > span,
    .topbar-context > strong {
        display: none;
    }

    .notification-link {
        width: 42px;
        min-width: 42px;
        height: 42px;
        justify-content: center;
        padding: 0;
        border-radius: 10px;
    }

    .notification-link span {
        display: none;
    }

    .notification-link strong {
        position: absolute;
        top: -6px;
        right: -6px;
    }
}

@media (max-width: 640px) {
    .topbar h1 {
        font-size: 1.38rem;
    }

    .page-title-label,
    .heading-label {
        gap: 7px;
    }

    .login-copy {
        gap: 10px;
        padding: 22px;
    }

    .login-copy > * {
        margin-top: 0;
        margin-bottom: 0;
    }

    .login-copy .muted {
        display: none;
    }

    .login-brand {
        margin-bottom: 6px;
    }

    .floating-tools {
        right: calc(12px + env(safe-area-inset-right));
        bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .floating-panel {
        height: min(72dvh, 620px);
    }
}

@media (max-width: 360px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        min-height: 72px;
        display: grid;
        grid-template-columns: 38px minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        padding: 12px;
    }

    .stat-card-icon {
        position: static;
        grid-column: 1;
        grid-row: 1;
        width: 36px;
        height: 36px;
    }

    .stat-card > span:not(.stat-card-icon) {
        grid-column: 2;
        grid-row: 1;
        padding-right: 0;
    }

    .stat-card strong {
        grid-column: 3;
        grid-row: 1;
        margin-top: 0;
    }
}
