:root {
    --bg: #f4efe7;
    --bg-alt: #ebe1d3;
    --surface: rgba(255, 252, 246, 0.92);
    --surface-strong: #fffdf8;
    --border: rgba(31, 41, 55, 0.12);
    --text: #1f2937;
    --muted: #6b7280;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --accent-soft: rgba(15, 118, 110, 0.12);
    --danger: #b42318;
    --danger-soft: rgba(180, 35, 24, 0.14);
    --warning: #b45309;
    --warning-soft: rgba(180, 83, 9, 0.14);
    --info: #1d4ed8;
    --info-soft: rgba(29, 78, 216, 0.14);
    --success: #15803d;
    --success-soft: rgba(21, 128, 61, 0.14);
    --shadow: 0 18px 45px rgba(38, 35, 27, 0.12);
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --font-heading: Georgia, "Times New Roman", serif;
    --font-body: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.18), transparent 28%),
        radial-gradient(circle at bottom right, rgba(180, 83, 9, 0.14), transparent 24%),
        linear-gradient(145deg, #f8f3eb, #ede2d3 55%, #f7f0e6);
    min-height: 100vh;
    overflow-x: hidden;
}

body.sidebar-open {
    overflow: hidden;
}

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

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

button {
    cursor: pointer;
}

img,
svg,
iframe,
video {
    max-width: 100%;
    height: auto;
}

.shell {
    display: block;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    padding-left: 300px;
}

.sidebar {
    background: linear-gradient(180deg, rgba(23, 35, 45, 0.96), rgba(31, 41, 55, 0.94));
    color: #f8fafc;
    padding: 1rem;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    height: auto;
    min-height: 0;
    overflow: hidden;
    overflow-x: hidden;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 0.9rem;
    z-index: 30;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
}

.brand strong {
    display: block;
    font-size: 1rem;
}

.brand small {
    display: block;
    color: rgba(248, 250, 252, 0.7);
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #14b8a6, #b45309);
    font-family: var(--font-heading);
    font-size: 1.4rem;
}

.sidebar-user,
.panel,
.card,
.login-panel,
.metric-card,
.table-card,
.form-card,
.hero-card,
.empty-state {
    background: var(--surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.shell-main,
.page,
.topbar,
.brand,
.sidebar-user,
.nav,
.hero-card,
.metric-card,
.card,
.table-card,
.form-card,
.empty-state,
.login-shell,
.login-copy,
.login-panel,
.feature-item,
.modal-card,
.modal-head,
.modal-body,
.alert-list li,
.button-row,
.inline-list,
.field,
.table-wrap {
    min-width: 0;
}

.sidebar-user {
    color: #111827;
    padding: 0.95rem;
}

.sidebar-user h2 {
    margin: 0.2rem 0;
    font-size: 1rem;
    line-height: 1.25;
}

.nav {
    display: grid;
    align-content: start;
    gap: 0.35rem;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
}

.nav-link {
    padding: 0.68rem 0.85rem;
    border-radius: var(--radius-sm);
    color: rgba(248, 250, 252, 0.82);
    transition: 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: translateX(2px);
}

.logout-link {
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.shell-main {
    padding: 1.5rem 1.5rem 3.25rem;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.topbar h1,
.page-title,
.login-copy h1 {
    margin: 0;
    font-family: var(--font-heading);
    letter-spacing: 0;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.75rem;
    color: var(--muted);
}

.page {
    display: grid;
    gap: 1.2rem;
    width: 100%;
    max-width: 100%;
}

.grid,
.cards-grid,
.metrics-grid,
.two-column,
.three-column {
    display: grid;
    gap: 1rem;
}

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

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

.two-column {
    grid-template-columns: 1.15fr 0.85fr;
}

.three-column {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card,
.card,
.table-card,
.form-card,
.hero-card,
.empty-state {
    padding: 1.25rem;
}

.metric-card h3,
.card h3,
.table-card h3,
.form-card h3,
.hero-card h2 {
    margin: 0 0 0.55rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.4rem 0;
}

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

.hero-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(180, 83, 9, 0.08)),
        var(--surface-strong);
}

.hero-card > * {
    flex: 1 1 280px;
    min-width: 0;
}

.hero-card p,
.card p,
.metric-card p,
.form-card p {
    line-height: 1.5;
}

.btn,
.btn-secondary,
.btn-danger,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 0.85rem 1.15rem;
    font-weight: 600;
    text-align: center;
    white-space: normal;
    line-height: 1.25;
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.btn {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.btn-secondary {
    background: rgba(17, 24, 39, 0.08);
    color: var(--text);
}

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

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn:hover,
.btn-secondary:hover,
.btn-danger:hover,
.btn-ghost:hover {
    transform: translateY(-1px);
}

.btn:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.btn-ghost:focus-visible,
.nav-link:focus-visible,
.icon-button:focus-visible,
.flash-close:focus-visible,
.nav-toggle:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.32);
    outline-offset: 3px;
}

.btn-compact {
    padding: 0.58rem 0.85rem;
    font-size: 0.84rem;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

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

.field {
    display: grid;
    gap: 0.4rem;
}

.checkbox-group {
    display: grid;
    gap: 1rem;
}

.checkbox-group fieldset {
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: var(--radius-sm);
    padding: 1rem;
    background: rgba(255, 255, 255, 0.92);
}

.checkbox-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.checkbox-inline input {
    margin-left: auto;
}

.checkbox-inline.disabled {
    opacity: 0.45;
}

.student-checkbox-list {
    grid-template-columns: 1fr;
    gap: 0;
}

.student-search-input {
    margin-bottom: 0.35rem;
}

.student-empty-message {
    padding: 0.85rem 0;
}

.student-checkbox-list .checkbox-inline {
    align-items: center;
    justify-content: flex-start;
    gap: 0.65rem;
    margin-bottom: 0;
    padding: 0.65rem 0;
    border-bottom: 1px solid rgba(17, 24, 39, 0.08);
    background: transparent;
    line-height: 1.35;
}

.student-checkbox-list .checkbox-inline[hidden] {
    display: none;
}

.student-checkbox-list .checkbox-inline.is-selected {
    border-radius: var(--radius-sm);
    border-bottom-color: rgba(15, 118, 110, 0.18);
    background: rgba(15, 118, 110, 0.08);
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.student-checkbox-list .checkbox-inline input {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    margin: 0;
}

.student-checkbox-list .checkbox-inline span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.schedule-day-list {
    display: grid;
    gap: 0.7rem;
}

.schedule-day-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(110px, 0.75fr) minmax(110px, 0.75fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.72);
}

.schedule-day-row-room {
    grid-template-columns: minmax(130px, 0.95fr) minmax(95px, 0.65fr) minmax(95px, 0.65fr) minmax(120px, 0.8fr);
}

.schedule-day-row .checkbox-inline {
    margin-bottom: 0;
}

.schedule-block-list {
    display: grid;
    gap: 0.7rem;
}

.schedule-block-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(110px, 0.75fr) minmax(110px, 0.75fr) minmax(120px, 0.8fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.72);
}

.schedule-board-card {
    display: grid;
    gap: 1rem;
    overflow-x: auto;
}

.schedule-board-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.schedule-timetable {
    --schedule-row-height: 78px;
    display: grid;
    grid-template-columns: 64px repeat(7, minmax(150px, 1fr));
    grid-template-rows: 44px minmax(520px, calc(var(--schedule-hours) * var(--schedule-row-height)));
    min-width: 1180px;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.64);
}

.schedule-mobile-list {
    display: none;
}

.schedule-agenda-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(190px, 1fr));
    gap: 0.7rem;
    min-width: 1360px;
    padding: 0.75rem;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: var(--radius-sm);
    background:
        linear-gradient(180deg, rgba(15, 118, 110, 0.06), rgba(255, 255, 255, 0.18)),
        rgba(255, 255, 255, 0.64);
}

.schedule-agenda-day {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 0.55rem;
    padding: 0.55rem;
    border: 1px solid rgba(17, 24, 39, 0.07);
    border-radius: 12px;
    background: rgba(255, 253, 248, 0.72);
}

.schedule-agenda-day-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 36px;
    padding: 0.5rem 0.55rem;
    border-radius: 9px;
    background: #e8f3ef;
    border: 1px solid rgba(15, 118, 110, 0.12);
}

.schedule-agenda-day-head h4 {
    margin: 0;
    color: var(--text);
    font-size: 0.76rem;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.schedule-agenda-day-head span {
    display: inline-grid;
    place-items: center;
    min-width: 1.55rem;
    height: 1.55rem;
    border-radius: 999px;
    background: #0f766e;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
}

.schedule-agenda-events {
    display: grid;
    gap: 0.45rem;
}

.schedule-agenda-empty {
    margin: 0;
    padding: 0.75rem 0.55rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.schedule-agenda-event {
    width: 100%;
    min-width: 0;
    display: grid;
    gap: 0.22rem;
    padding: 0.6rem 0.65rem;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-left: 4px solid #0f766e;
    border-radius: 10px;
    background: rgba(240, 253, 250, 0.82);
    color: var(--text);
    text-align: left;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
    cursor: pointer;
}

.schedule-agenda-event:hover,
.schedule-agenda-event:focus-visible {
    border-color: rgba(15, 118, 110, 0.38);
    background: #f0fdfa;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
    outline: none;
    transform: translateY(-1px);
}

.schedule-agenda-event.is-readonly {
    border-color: rgba(100, 116, 139, 0.18);
    border-left-color: #94a3b8;
    background: rgba(248, 250, 252, 0.86);
    cursor: default;
}

.schedule-agenda-event.is-readonly:hover,
.schedule-agenda-event.is-readonly:focus-visible {
    border-color: rgba(100, 116, 139, 0.22);
    background: rgba(248, 250, 252, 0.86);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
    transform: none;
}

.schedule-agenda-time {
    width: fit-content;
    padding: 0.16rem 0.42rem;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.11);
    color: #0f766e;
    font-size: 0.71rem;
    font-weight: 900;
    white-space: nowrap;
}

.schedule-agenda-event strong {
    min-width: 0;
    color: var(--text);
    font-size: 0.78rem;
    line-height: 1.22;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.schedule-agenda-event small,
.schedule-agenda-event em {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.7rem;
    line-height: 1.2;
}

.schedule-agenda-event small {
    color: var(--muted);
}

.schedule-agenda-event em {
    color: #0f766e;
    font-style: normal;
    font-weight: 800;
}

.schedule-agenda-event.is-readonly .schedule-agenda-time,
.schedule-agenda-event.is-readonly em {
    color: #64748b;
}

.schedule-time-header,
.schedule-day-header {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    border-bottom: 1px solid rgba(17, 24, 39, 0.08);
    background: rgba(15, 118, 110, 0.08);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.schedule-time-header {
    border-right: 1px solid rgba(17, 24, 39, 0.08);
}

.schedule-time-axis,
.schedule-day-column {
    position: relative;
    min-height: 520px;
}

.schedule-time-axis {
    border-right: 1px solid rgba(17, 24, 39, 0.08);
    background: rgba(255, 255, 255, 0.55);
}

.schedule-time-axis span {
    position: absolute;
    right: 0.55rem;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
}

.schedule-day-column {
    border-right: 1px solid rgba(17, 24, 39, 0.06);
    background:
        linear-gradient(180deg, rgba(17, 24, 39, 0.025), rgba(255, 255, 255, 0) 120px),
        rgba(255, 255, 255, 0.32);
}

.schedule-day-column:last-child {
    border-right: none;
}

.schedule-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(17, 24, 39, 0.07);
}

.schedule-event {
    position: absolute;
    top: var(--event-top);
    left: 0.35rem;
    right: 0.35rem;
    min-height: 46px;
    height: max(46px, var(--event-height));
    display: grid;
    align-content: start;
    gap: 0.12rem;
    padding: 0.48rem 0.55rem;
    border: 1px solid rgba(15, 118, 110, 0.24);
    border-left: 4px solid #0f766e;
    border-radius: 8px;
    background: rgba(240, 253, 250, 0.94);
    color: var(--text);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    text-align: left;
    overflow: hidden;
    cursor: pointer;
}

.schedule-event:hover,
.schedule-event:focus-visible {
    border-color: rgba(15, 118, 110, 0.45);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
    outline: none;
    transform: translateY(-1px);
}

.schedule-event strong,
.schedule-event span,
.schedule-event small,
.schedule-event em {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-event strong {
    font-size: 0.78rem;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.schedule-event span {
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

.schedule-event small {
    color: var(--muted);
    font-size: 0.72rem;
    white-space: nowrap;
}

.schedule-event em {
    color: #0f766e;
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 800;
    white-space: nowrap;
}

.schedule-modal-card {
    width: min(760px, 100%);
}

.schedule-mobile-day {
    display: grid;
    gap: 0.6rem;
    padding: 0.85rem;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.68);
}

.schedule-mobile-day h4 {
    margin: 0;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.schedule-mobile-events {
    display: grid;
    gap: 0.55rem;
}

.schedule-mobile-event {
    display: grid;
    gap: 0.18rem;
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-left: 4px solid #0f766e;
    border-radius: 8px;
    background: rgba(240, 253, 250, 0.92);
    color: var(--text);
    text-align: left;
}

.schedule-mobile-event:hover,
.schedule-mobile-event:focus-visible {
    border-color: rgba(15, 118, 110, 0.42);
    outline: none;
}

.schedule-mobile-event.is-readonly {
    border-color: rgba(100, 116, 139, 0.18);
    border-left-color: #94a3b8;
    background: rgba(248, 250, 252, 0.9);
}

.schedule-mobile-event.is-readonly:hover,
.schedule-mobile-event.is-readonly:focus-visible {
    border-color: rgba(100, 116, 139, 0.22);
}

.schedule-mobile-event span {
    font-size: 0.78rem;
    font-weight: 800;
    color: #0f766e;
}

.schedule-mobile-event.is-readonly span {
    color: #64748b;
}

.schedule-mobile-event strong {
    line-height: 1.25;
}

.schedule-mobile-event small {
    color: var(--muted);
    line-height: 1.35;
}

.field-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.field-full {
    grid-column: 1 / -1;
}

.field label {
    font-size: 0.92rem;
    font-weight: 600;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    max-width: 100%;
    border: 1px solid rgba(17, 24, 39, 0.14);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
    padding: 0.9rem 1rem;
    color: var(--text);
}

.field textarea {
    min-height: 120px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: rgba(15, 118, 110, 0.55);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.table-card {
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

tbody tr {
    min-width: 0;
}

th,
td {
    text-align: left;
    padding: 0.95rem 0.75rem;
    border-bottom: 1px solid rgba(17, 24, 39, 0.08);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.assignment-tables {
    align-items: start;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.assignment-table-card {
    align-self: start;
    overflow: hidden;
    padding: 1rem;
}

.assignment-table-card .table-wrap {
    overflow: hidden;
}

.assignment-table-card .assignment-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: fixed;
}

.assignment-table-card th,
.assignment-table-card td {
    padding: 0.7rem 0.4rem;
    font-size: 0.87rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
    word-break: normal;
}

.assignment-table-card th:last-child,
.assignment-table-card td:last-child {
    width: auto;
}

.assignment-table-card td:nth-child(1),
.assignment-table-card td:nth-child(2) {
    overflow-wrap: anywhere;
}

.assignment-table-card th {
    letter-spacing: 0.06em;
}

.assignment-table-card .badge {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.assignment-table-card form {
    margin: 0;
    width: 100%;
}

.assignment-table-card .btn-ghost {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 0.56rem 0.45rem;
    font-size: 0.84rem;
    border-radius: 18px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    max-width: 100%;
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: rgba(17, 24, 39, 0.08); color: var(--text); }

.flash {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.15rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
}

.flash-success {
    background: var(--success-soft);
    border-color: rgba(21, 128, 61, 0.18);
}

.flash-error {
    background: var(--danger-soft);
    border-color: rgba(180, 35, 24, 0.18);
}

.flash-close,
.icon-button {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    color: inherit;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 50;
}

.modal-backdrop.is-visible {
    display: flex;
}

.modal-card {
    width: min(680px, 100%);
    background: #fffdf8;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(17, 24, 39, 0.08);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.alert-modal-card {
    width: min(860px, 100%);
    max-height: min(760px, calc(100dvh - 2rem));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.modal-head,
.modal-body {
    padding: 1.2rem 1.3rem;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid rgba(17, 24, 39, 0.08);
    background:
        linear-gradient(135deg, rgba(180, 35, 24, 0.08), rgba(15, 118, 110, 0.07)),
        #fffdf8;
}

.modal-head h2 {
    margin: 0.2rem 0 0;
    line-height: 1.15;
}

.modal-subtitle {
    max-width: 42rem;
    margin: 0.45rem 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.modal-body {
    overflow: auto;
}

.alert-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.alert-summary div {
    padding: 0.85rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(17, 24, 39, 0.08);
}

.alert-summary span,
.alert-summary small {
    display: block;
}

.alert-summary span {
    font-size: 1.25rem;
    font-weight: 800;
}

.alert-summary small {
    margin-top: 0.18rem;
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.alert-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: grid;
    gap: 0.8rem;
}

.alert-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    background: rgba(248, 246, 241, 0.86);
    border: 1px solid rgba(17, 24, 39, 0.05);
}

.alert-student,
.alert-actions {
    min-width: 0;
}

.alert-student {
    display: grid;
    gap: 0.25rem;
}

.alert-student strong {
    font-size: 0.96rem;
}

.alert-student span {
    color: var(--muted);
    line-height: 1.35;
}

.alert-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
}

.inline-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.login-shell {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    align-items: stretch;
    padding: 1.5rem 1.5rem 3.5rem;
    gap: 1.5rem;
    width: min(100%, 1440px);
    margin: 0 auto;
}

.login-copy,
.login-panel {
    padding: 2rem;
    width: 100%;
    max-width: 100%;
}

.login-copy {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1rem;
    border-radius: 32px;
    background:
        linear-gradient(140deg, rgba(17, 24, 39, 0.9), rgba(15, 118, 110, 0.86)),
        linear-gradient(160deg, rgba(180, 83, 9, 0.12), transparent);
    color: #f8fafc;
    box-shadow: var(--shadow);
}

.app-footer {
    position: fixed;
    left: 300px;
    right: 0;
    bottom: 0;
    z-index: 20;
    color: rgba(31, 41, 55, 0.58);
    background: rgba(248, 243, 235, 0.72);
    backdrop-filter: blur(10px);
    font-size: 0.75rem;
    line-height: 1.2;
    padding: 0.45rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    user-select: none;
    font-weight: 700;
}

/* slightly different color for dark login panel */
.login-footer.app-footer,
.login-shell .app-footer {
    left: 0;
    color: rgba(31, 41, 55, 0.62);
    background: rgba(248, 243, 235, 0.78);
}

.login-footer p,
.app-footer p {
    margin: 0;
}

.login-copy-branding {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.login-logo-wrapper {
    display: grid;
    place-items: center;
    min-height: auto;
    margin-bottom: 0;
}

.login-logo {
    width: 220px;
    max-width: 100%;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.16);
    padding: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.login-copy h1 {
    font-size: clamp(2rem, 4vw, 3.5rem);
}

.login-copy p {
    max-width: 42rem;
    line-height: 1.65;
    color: rgba(248, 250, 252, 0.82);
    overflow-wrap: break-word;
}

.feature-list {
    display: grid;
    gap: 1rem;
}

.feature-item {
    padding: 1rem 1.15rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.feature-item strong {
    display: block;
    margin-bottom: 0.3rem;
}

.nav-toggle {
    display: none;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.5);
    padding: 0.75rem 0.65rem;
}

.nav-toggle span {
    display: block;
    height: 2px;
    background: var(--text);
    margin: 0.2rem 0;
}

.attendance-select {
    min-width: 120px;
    width: 100%;
}

.empty-state {
    text-align: center;
    padding-block: 2rem;
}

.student-report-empty {
    margin-top: 1rem;
    border-style: dashed;
    background: rgba(255, 255, 255, 0.42);
    box-shadow: none;
}

.student-report-search-form .field-full {
    display: flex;
    justify-content: flex-end;
}

.student-report-search-form .field-full .btn {
    min-width: 180px;
}

.student-report-hero-status {
    display: grid;
    justify-items: end;
    gap: 0.55rem;
    text-align: right;
}

.student-report-hero-status p {
    margin: 0;
}

.student-report-dashboard {
    display: grid;
    grid-template-columns: minmax(300px, 0.9fr) minmax(340px, 1.1fr);
    gap: 2rem;
    align-items: center;
    min-width: 0;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.student-report-chart-column,
.student-report-control-column {
    display: grid;
    gap: 1.25rem;
    min-width: 0;
}

.student-report-chart-column h3 {
    margin: 0.35rem 0 0;
}

.student-report-chart-column > div:first-child {
    text-align: center;
}

.student-report-chart-column > div:first-child p:last-child {
    margin: 0.45rem 0 0;
}

.attendance-donut-wrap {
    display: grid;
    place-items: center;
    min-height: 280px;
}

.attendance-donut {
    position: relative;
    width: min(270px, 78vw);
    aspect-ratio: 1;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(#e2e8f0 0deg 360deg);
    box-shadow: 0 16px 32px rgba(31, 41, 55, 0.12);
}

.attendance-donut::after {
    content: "";
    position: absolute;
    inset: 22%;
    border-radius: 50%;
    background: var(--surface-strong);
    box-shadow: inset 0 0 0 1px rgba(31, 41, 55, 0.08);
}

.attendance-donut-center {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 0.2rem;
    width: 52%;
    text-align: center;
}

.attendance-donut-center strong {
    font-size: 2rem;
    line-height: 1;
    color: var(--text);
}

.attendance-donut-center span {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.25;
}

.attendance-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 1rem;
}

.attendance-legend > div {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(31, 41, 55, 0.08);
}

.legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-present { background: #15803d; }
.legend-justified { background: #1d4ed8; }
.legend-absent { background: #b42318; }
.legend-pending { background: #cbd5e1; }

.student-report-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    border-top: 1px solid rgba(31, 41, 55, 0.1);
}

.student-report-facts > div {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(31, 41, 55, 0.1);
}

.student-report-facts > div:nth-child(odd) {
    padding-right: 1rem;
}

.student-report-facts > div:nth-child(even) {
    padding-left: 1rem;
    border-left: 1px solid rgba(31, 41, 55, 0.1);
}

.student-report-facts dt {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.student-report-facts dd {
    margin: 0.35rem 0 0;
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.3;
}

.student-report-note {
    margin: 0;
    padding: 0.9rem 1rem;
    border-left: 4px solid var(--info);
    background: var(--info-soft);
    color: var(--text);
    line-height: 1.5;
}

.student-report-metrics .metric-value {
    font-size: 1.75rem;
}

tr[data-report-course-row] {
    transition: background 0.2s ease;
}

tr[data-report-course-row].is-selected {
    background: var(--accent-soft);
}

h1,
h2,
h3,
p,
td,
th {
    overflow-wrap: break-word;
    word-break: normal;
}

span,
strong,
a,
label,
button,
.badge,
.btn,
.btn-secondary,
.btn-danger,
.btn-ghost,
.nav-link,
.eyebrow {
    overflow-wrap: normal;
    word-break: normal;
}

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

    .two-column,
    .login-shell {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 1040px) {
    .student-report-dashboard {
        grid-template-columns: 1fr;
    }

    .student-report-control-column {
        max-width: 720px;
        width: 100%;
        margin-inline: auto;
    }
}

@media (max-width: 1360px) {
    .assignment-tables {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .shell {
        padding-left: 0;
    }

    .app-footer {
        left: 0;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(320px, 88vw);
        height: 100dvh;
        overflow: hidden;
        transform: translateX(-102%);
        transition: transform 0.25s ease;
        z-index: 40;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .nav-toggle {
        display: inline-block;
    }

    .metrics-grid,
    .cards-grid,
    .three-column,
    .form-grid,
    .assignment-tables {
        grid-template-columns: 1fr;
    }

    .schedule-board-head {
        display: grid;
    }

    .schedule-timetable,
    .schedule-agenda-grid {
        display: none;
    }

    .schedule-mobile-list {
        display: grid;
        gap: 0.85rem;
    }

    .schedule-day-row,
    .schedule-block-row {
        grid-template-columns: 1fr;
    }

    .shell-main,
    .login-shell {
        padding: 1rem 1rem 3.5rem;
    }

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

    .topbar h1 {
        font-size: clamp(1.55rem, 5.2vw, 2rem);
        line-height: 1.15;
    }

    .page-title {
        font-size: clamp(1.55rem, 5.8vw, 2.1rem);
        line-height: 1.15;
    }

    table {
        min-width: 620px;
    }
}

@media (max-width: 580px) {
    .hero-card,
    .button-row,
    .flash {
        flex-direction: column;
        align-items: stretch;
    }

    .alert-summary,
    .alert-list li {
        grid-template-columns: 1fr;
    }

    .alert-actions {
        justify-content: stretch;
    }

    .alert-actions .badge,
    .alert-actions .btn-secondary {
        flex: 1 1 0;
        width: auto;
    }

    .login-copy,
    .login-panel,
    .metric-card,
    .card,
    .table-card,
    .form-card,
    .hero-card {
        padding: 1.1rem;
    }

    .login-shell,
    .shell-main {
        padding: 0.75rem 0.75rem 3.5rem;
    }

    .login-logo {
        width: 180px;
    }

    table {
        min-width: 540px;
    }

    .brand {
        padding: 0.8rem;
    }

    .metric-value {
        font-size: clamp(1.5rem, 8vw, 1.9rem);
    }

    .eyebrow {
        letter-spacing: 0.1em;
        font-size: 0.67rem;
    }

    .btn,
    .btn-secondary,
    .btn-danger,
    .btn-ghost {
        width: 100%;
    }

    .button-row > * {
        width: 100%;
    }

    .inline-list {
        gap: 0.4rem;
    }

    .badge {
        width: 100%;
        border-radius: 14px;
        padding: 0.5rem 0.75rem;
    }

    .student-report-search-form .field-full {
        display: grid;
    }

    .student-report-hero-status {
        justify-items: stretch;
        text-align: left;
    }

    .student-report-dashboard {
        padding: 1.05rem;
        gap: 1.4rem;
    }

    .attendance-donut-wrap {
        min-height: 235px;
    }

    .attendance-donut {
        width: min(225px, 74vw);
    }

    .attendance-donut-center strong {
        font-size: 1.65rem;
    }

    .attendance-legend,
    .student-report-facts {
        grid-template-columns: 1fr;
    }

    .student-report-facts > div:nth-child(odd),
    .student-report-facts > div:nth-child(even) {
        padding: 0.85rem 0;
        border-left: none;
    }
}

@media (max-width: 760px) {
    .table-wrap {
        overflow: visible;
    }

    .assignment-table-card .table-wrap {
        overflow: visible;
    }

    .assignment-table-card table {
        table-layout: auto;
    }

    .table-wrap table.table-responsive {
        min-width: 0;
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
    }

    .table-wrap table.table-responsive thead {
        display: none;
    }

    .table-wrap table.table-responsive tbody {
        display: grid;
        gap: 0.9rem;
    }

    .table-wrap table.table-responsive tr {
        display: block;
        padding: 0.2rem 0.95rem;
        background: rgba(255, 255, 255, 0.68);
        border: 1px solid rgba(17, 24, 39, 0.08);
        border-radius: 18px;
        box-shadow: 0 10px 24px rgba(38, 35, 27, 0.08);
    }

    .table-wrap table.table-responsive td {
        display: grid;
        grid-template-columns: 1fr;
        justify-content: stretch;
        align-items: stretch;
        gap: 0.35rem;
        width: 100%;
        padding: 0.8rem 0;
        border-bottom: 1px solid rgba(17, 24, 39, 0.08);
    }

    .table-wrap table.table-responsive td:last-child {
        border-bottom: none;
    }

    .table-wrap table.table-responsive td::before {
        content: attr(data-label);
        display: block;
        max-width: 100%;
        font-size: 0.74rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--muted);
    }

    .table-wrap table.table-responsive td > * {
        min-width: 0;
    }

    .table-wrap table.table-responsive td[colspan],
    .table-wrap table.table-responsive td.cell-span {
        display: block;
        text-align: left;
    }

    .table-wrap table.table-responsive td[colspan]::before,
    .table-wrap table.table-responsive td.cell-span::before {
        display: none;
        content: none;
    }

    .table-wrap table.table-responsive td .button-row {
        width: 100%;
        justify-content: stretch;
    }

    .table-wrap table.table-responsive td .btn,
    .table-wrap table.table-responsive td .btn-secondary,
    .table-wrap table.table-responsive td .btn-danger,
    .table-wrap table.table-responsive td .btn-ghost,
    .table-wrap table.table-responsive td form,
    .table-wrap table.table-responsive td select {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 430px) {
    .sidebar {
        width: min(94vw, 320px);
        padding: 1rem;
    }

    .shell-main,
    .login-shell {
        padding: 0.65rem 0.65rem 3.5rem;
    }

    .topbar {
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .brand {
        gap: 0.75rem;
        align-items: flex-start;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        font-size: 1.15rem;
    }

    .sidebar-user,
    .login-copy,
    .login-panel,
    .metric-card,
    .card,
    .table-card,
    .form-card,
    .hero-card,
    .empty-state {
        padding: 0.95rem;
        border-radius: 18px;
    }

    .login-copy h1 {
        font-size: clamp(1.7rem, 8vw, 2.2rem);
        line-height: 1.05;
    }

    .sidebar-user h2,
    .hero-card h2,
    .card h3,
    .table-card h3,
    .form-card h3 {
        line-height: 1.15;
    }

    .nav-link {
        padding: 0.8rem 0.9rem;
    }

    .nav-toggle {
        width: 42px;
        height: 42px;
        padding: 0.65rem 0.6rem;
    }

    .table-wrap table.table-responsive tr {
        padding: 0.1rem 0.8rem;
    }

    .table-wrap table.table-responsive td {
        padding: 0.72rem 0;
    }

    .table-wrap table.table-responsive td::before {
        font-size: 0.68rem;
        letter-spacing: 0.06em;
    }

    .alert-list li {
        padding: 0.8rem;
    }

    .modal-card {
        max-height: calc(100dvh - 1rem);
        overflow: auto;
    }
}
