:root {
    --bg: #eef5f5;
    --bg-strong: #dcebee;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-solid: #ffffff;
    --surface-soft: #f5f8fa;
    --text: #0f172a;
    --muted: #667085;
    --line: #d9e5ea;
    --sidebar: #172432;
    --accent: #00a8b8;
    --accent-dark: #008b99;
    --danger: #e85045;
    --danger-soft: #fff1f0;
    --success: #14a86b;
    --success-soft: #effbf5;
    --warning: #f09032;
    --warning-soft: #fff7ed;
    --blue: #1199d5;
    --purple: #8d62ff;
    --radius: 8px;
    --shadow: 0 14px 36px rgba(16, 24, 40, 0.10);
    --small-shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    min-height: 100%;
}

body.app-body {
    background:
        linear-gradient(105deg, rgba(255, 255, 255, 0.74) 0%, rgba(224, 241, 241, 0.72) 42%, rgba(239, 246, 240, 0.78) 100%),
        linear-gradient(180deg, rgba(14, 165, 183, 0.12) 0, rgba(14, 165, 183, 0.04) 145px, transparent 146px),
        url("../img/levelx-background.jpg"),
        linear-gradient(180deg, var(--bg), var(--bg-strong));
    background-attachment: fixed;
    background-position: center top;
    background-repeat: no-repeat;
    background-size: cover;
}

body.auth-body {
    background:
        linear-gradient(135deg, rgba(23, 36, 50, 0.94), rgba(0, 139, 153, 0.76)),
        url("../img/levelx-background.jpg"),
        linear-gradient(180deg, #edf7f7, #ffffff);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.topbar {
    justify-content: flex-end;
    min-height: 66px;
}

.nav-icon {
    fill: none;
    height: 18px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 18px;
}

.nav-mark {
    background: color-mix(in srgb, var(--item-accent) 18%, transparent);
    border-radius: 6px;
}

.issue-step {
    padding: 18px;
}

.step-head {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.step-number {
    align-items: center;
    background: var(--accent);
    border-radius: 50%;
    color: #ffffff;
    display: inline-flex;
    flex: 0 0 34px;
    font-weight: 900;
    height: 34px;
    justify-content: center;
}

.choice-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
}

.choice-card {
    cursor: pointer;
    display: block;
}

.choice-card input {
    position: absolute;
    transform: scale(0);
}

.choice-content {
    background: rgba(255, 255, 255, 0.70);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: block;
    min-height: 92px;
    padding: 14px;
}

.choice-content strong,
.choice-content small {
    display: block;
}

.choice-content strong {
    color: var(--text);
    font-size: 15px;
    margin-bottom: 5px;
}

.choice-content small {
    color: var(--muted);
    font-weight: 750;
}

.choice-card input:checked + .choice-content {
    background: #ffffff;
    border-color: rgba(0, 154, 166, 0.54);
    box-shadow: 0 0 0 4px rgba(0, 154, 166, 0.10), var(--small-shadow);
}

.issue-target-panel {
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.student-check-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    margin-top: 12px;
    max-height: 430px;
    overflow: auto;
    padding-right: 4px;
}

.student-check {
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    gap: 10px;
    min-height: 66px;
    padding: 12px;
}

.student-check input {
    flex: 0 0 auto;
    margin-top: 3px;
    min-height: auto;
    width: auto;
}

.student-check strong,
.student-check small {
    display: block;
}

.student-check small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
    margin-top: 2px;
}

.student-check:has(input:checked) {
    background: #ffffff;
    border-color: rgba(0, 154, 166, 0.48);
}

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

.task-card {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--small-shadow);
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 154px;
    padding: 16px;
}

.task-card:hover {
    background: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
}

.task-card strong {
    font-size: 18px;
    line-height: 1.2;
}

.task-card small {
    color: var(--muted);
    display: block;
    font-weight: 760;
}

.task-card .pill {
    margin-top: auto;
    width: fit-content;
}

.office-card h2 {
    margin-bottom: 4px;
}

a {
    color: var(--accent-dark);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-layout {
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, rgba(23, 36, 50, 0.98), rgba(20, 31, 44, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    bottom: 10px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    left: 10px;
    padding: 14px;
    position: fixed;
    top: 10px;
    width: 230px;
    z-index: 20;
}

.sidebar::before {
    background: linear-gradient(90deg, var(--danger), var(--accent), var(--success));
    border-radius: 8px 8px 0 0;
    content: "";
    height: 3px;
    left: 14px;
    position: absolute;
    right: 14px;
    top: 0;
}

.content-shell {
    margin-left: 250px;
    min-height: 100vh;
    padding: 14px 18px 36px 0;
    position: relative;
}

.content-shell::before {
    background:
        linear-gradient(90deg, rgba(238, 245, 245, 0.35), rgba(255, 255, 255, 0.84)),
        linear-gradient(120deg, rgba(0, 168, 184, 0.12), rgba(255, 255, 255, 0.06) 45%, rgba(20, 168, 107, 0.10));
    border-radius: 0 0 8px 8px;
    content: "";
    height: 155px;
    left: 0;
    pointer-events: none;
    position: fixed;
    right: 0;
    top: 0;
    z-index: -1;
}

.sidebar-brand,
.auth-brand {
    align-items: center;
    color: #ffffff;
    display: flex;
    gap: 12px;
    min-height: 74px;
}

.sidebar-brand:hover,
.auth-brand:hover {
    text-decoration: none;
}

.brand-mark {
    align-items: center;
    background: #ffffff;
    border-radius: 8px;
    color: var(--sidebar);
    display: inline-flex;
    flex: 0 0 42px;
    font-size: 17px;
    font-weight: 900;
    height: 42px;
    justify-content: center;
}

.sidebar-brand strong,
.auth-brand span:last-child {
    display: block;
    font-size: 18px;
    line-height: 1.1;
}

.sidebar-brand small {
    color: #b8c5cf;
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-top: 4px;
}

.main-nav {
    display: grid;
    gap: 7px;
    margin-top: 18px;
}

.nav-link {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #e7eef4;
    display: flex;
    font-size: 14px;
    font-weight: 800;
    gap: 10px;
    min-height: 42px;
    padding: 9px 10px;
    position: relative;
}

.nav-link::before {
    background: var(--item-accent);
    border-radius: 999px;
    bottom: 10px;
    content: "";
    left: 0;
    opacity: 0.92;
    position: absolute;
    top: 10px;
    width: 3px;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.16);
    text-decoration: none;
}

.nav-link.active {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.nav-mark {
    align-items: center;
    color: var(--item-accent);
    display: inline-flex;
    flex: 0 0 22px;
    font-size: 13px;
    font-weight: 900;
    height: 22px;
    justify-content: center;
}

.sidebar-bottom {
    display: grid;
    gap: 10px;
    margin-top: auto;
}

.topbar {
    align-items: center;
    display: flex;
    justify-content: space-between;
    min-height: 72px;
    padding: 0 4px 12px 0;
}

.topbar strong {
    display: block;
    font-size: 18px;
}

.topbar-kicker {
    color: var(--accent-dark);
    display: block;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.user-pill {
    align-items: center;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: 999px;
    box-shadow: var(--small-shadow);
    display: flex;
    gap: 10px;
    padding: 8px 13px 8px 8px;
}

.user-pill small {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 700;
}

.avatar {
    align-items: center;
    background: #eff5f7;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--text);
    display: inline-flex;
    flex: 0 0 38px;
    font-size: 14px;
    font-weight: 900;
    height: 38px;
    justify-content: center;
}

.auth-topbar {
    left: 0;
    padding: 22px 28px;
    position: fixed;
    right: 0;
    top: 0;
}

.page {
    margin: 0 auto;
    max-width: 1680px;
    padding: 0 0 40px;
}

.auth-page {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 96px 20px 36px;
}

.page-header {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin: 4px 0 14px;
}

.hero-header {
    min-height: 118px;
}

.page-header h1,
.panel h2,
.auth-card h1 {
    line-height: 1.15;
    margin: 0;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 900;
}

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

.page-subtitle {
    font-weight: 700;
    margin: 4px 0 0;
}

.panel h2 {
    font-size: 20px;
}

.eyebrow {
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    margin: 0 0 4px;
    text-transform: uppercase;
}

.panel,
.auth-card,
.metric {
    background: var(--surface);
    border: 1px solid rgba(222, 232, 237, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--small-shadow);
}

.panel,
.metric,
.user-pill {
    backdrop-filter: blur(16px);
}

.panel {
    margin-bottom: 14px;
    padding: 18px;
}

.narrow-panel {
    max-width: 680px;
}

.auth-card {
    max-width: 540px;
    padding: 30px;
    width: 100%;
}

.auth-card h1 {
    font-size: 30px;
}

.auth-switch {
    margin: 18px 0 0;
}

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

.panel-header p {
    margin: 3px 0 0;
}

.metric-grid,
.detail-grid,
.dashboard-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
}

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

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

.office-card::before {
    background: var(--accent);
    bottom: 16px;
    content: "";
    left: 0;
    position: absolute;
    top: 16px;
    width: 4px;
}

.office-card.metric-info::before {
    background: var(--blue);
}

.office-card.metric-success::before {
    background: var(--success);
}

.office-card.metric-warning::before {
    background: var(--warning);
}

.office-links {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.office-link {
    align-items: center;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    display: flex;
    font-weight: 900;
    justify-content: space-between;
    min-height: 42px;
    padding: 10px 12px;
}

.office-link::after {
    color: var(--accent-dark);
    content: ">";
    font-weight: 900;
}

.office-link:hover {
    background: #ffffff;
    text-decoration: none;
}

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

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

.detail-grid {
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
}

.dashboard-grid {
    align-items: start;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
}

.metric {
    color: var(--text);
    display: block;
    min-height: 98px;
    overflow: hidden;
    padding: 18px;
    position: relative;
}

.metric::before {
    background: var(--accent);
    bottom: 10px;
    content: "";
    left: 0;
    position: absolute;
    top: 10px;
    width: 4px;
}

.metric:hover {
    border-color: rgba(0, 168, 184, 0.35);
    text-decoration: none;
}

.metric-info::before {
    background: var(--blue);
}

.metric-success::before {
    background: var(--success);
}

.metric-warning::before {
    background: var(--warning);
}

.metric-danger::before {
    background: var(--danger);
}

.metric-cyan::before {
    background: var(--accent);
}

.metric-value {
    display: block;
    font-size: 30px;
    font-weight: 900;
    line-height: 1.1;
}

.metric-label {
    color: var(--muted);
    display: block;
    font-size: 13px;
    font-weight: 800;
    margin-top: 6px;
}

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

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

.filter-bar {
    align-items: end;
    grid-template-columns: minmax(240px, 1.5fr) minmax(160px, 1fr) minmax(150px, 1fr) auto auto;
}

label span {
    color: #344054;
    display: block;
    font-size: 13px;
    font-weight: 900;
    margin-bottom: 6px;
}

input,
select,
textarea {
    background: #ffffff;
    border: 1px solid #ccd9df;
    border-radius: 7px;
    color: var(--text);
    font: inherit;
    min-height: 42px;
    padding: 9px 11px;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 168, 184, 0.16);
    outline: none;
}

.checkbox-line {
    align-items: center;
    display: flex;
    gap: 8px;
    min-height: 42px;
}

.checkbox-line input {
    min-height: 0;
    width: auto;
}

.checkbox-line span {
    margin: 0;
}

.button-row,
.actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.button {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 900;
    justify-content: center;
    min-height: 40px;
    padding: 8px 14px;
}

.button:hover {
    text-decoration: none;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.button-primary {
    background: var(--accent);
    color: #ffffff;
}

.button-primary:hover {
    background: var(--accent-dark);
}

.button-secondary {
    background: #ffffff;
    border-color: var(--line);
    color: #344054;
}

.button-secondary:hover {
    background: var(--surface-soft);
}

.button-danger,
.button-logout {
    background: var(--danger);
    color: #ffffff;
}

.button-logout {
    border-color: rgba(255, 255, 255, 0.16);
    min-height: 44px;
    width: 100%;
}

.button-small {
    font-size: 13px;
    min-height: 34px;
    padding: 6px 10px;
}

.button-large {
    font-size: 18px;
    min-height: 52px;
    padding: 12px 20px;
}

.flash {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 14px;
    padding: 12px 14px;
}

.flash-error {
    background: var(--danger-soft);
    border-color: #ffd1ce;
    color: #b42318;
}

.flash-success {
    background: var(--success-soft);
    border-color: #b7ebce;
    color: #067647;
}

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

table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

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

th {
    color: #475467;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

tbody tr:hover {
    background: rgba(0, 168, 184, 0.035);
}

.number {
    text-align: right;
    white-space: nowrap;
}

.empty-state,
.empty-box,
.success-box {
    border: 1px dashed #cdd8df;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 800;
    padding: 26px 10px;
    text-align: center;
}

.success-box {
    background: var(--success-soft);
    border-color: #b7ebce;
    color: #067647;
}

.status,
.tag,
.pill {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 900;
    padding: 3px 9px;
}

.status-active,
.status-approved,
.status-confirmed,
.status-in_stock {
    background: var(--success-soft);
    color: #067647;
}

.status-discontinued,
.status-pending,
.status-draft,
.status-low_stock,
.status-ordered {
    background: var(--warning-soft);
    color: #b54708;
}

.status-archived,
.status-cancelled,
.status-hidden {
    background: #f2f4f7;
    color: #475467;
}

.status-blocked,
.status-rejected,
.status-out_of_stock {
    background: var(--danger-soft);
    color: #b42318;
}

.tag,
.pill {
    background: #edf4f7;
    color: #344054;
    margin-right: 4px;
}

.detail-list {
    display: grid;
    gap: 10px 16px;
    grid-template-columns: minmax(130px, 0.45fr) minmax(0, 1fr);
    margin: 16px 0 0;
}

.detail-list.compact {
    grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1fr);
}

.detail-list dt {
    color: var(--muted);
    font-weight: 900;
}

.detail-list dd {
    margin: 0;
}

.segmented {
    background: #e9f0f3;
    border-radius: 8px;
    display: inline-flex;
    padding: 4px;
    width: fit-content;
}

.segmented label {
    cursor: pointer;
}

.segmented input {
    position: absolute;
    transform: scale(0);
}

.segmented span {
    border-radius: 6px;
    color: #344054;
    display: inline-flex;
    margin: 0;
    padding: 8px 12px;
}

.segmented input:checked + span {
    background: #ffffff;
    box-shadow: var(--small-shadow);
    color: var(--text);
}

.mode-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: grid;
    gap: 14px;
    padding: 16px;
}

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

.stack-item {
    align-items: center;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-left: 4px solid var(--warning);
    border-radius: 8px;
    color: var(--text);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 11px 12px;
}

.stack-item:hover {
    background: #ffffff;
    text-decoration: none;
}

.stack-item small {
    color: var(--muted);
    display: block;
    font-weight: 800;
}

.confirm-bar {
    align-items: center;
    background: #f4fbfc;
    border: 1px solid #c7edf1;
    border-radius: 8px;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-top: 16px;
    padding: 14px;
}

.confirm-bar p {
    color: #31545b;
    font-weight: 800;
    margin: 0;
}

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

.tab {
    background: #eef6f8;
    border: 1px solid #cfe1e7;
    border-radius: 999px;
    color: #36515b;
    font-weight: 900;
    padding: 8px 14px;
}

.tab.active,
.tab:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    text-decoration: none;
}

.issue-layout {
    display: grid;
    gap: 14px;
}

.allocation-summary {
    align-items: center;
    background: #f4fbfc;
    border: 1px solid #c7edf1;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 14px;
    padding: 12px 14px;
}

.allocation-summary span {
    color: #31545b;
    font-weight: 900;
}

.balance-ok {
    color: #067647 !important;
}

.balance-open {
    color: #b54708 !important;
}

.balance-error {
    color: #b42318 !important;
}

.student-allocation-list {
    display: grid;
    gap: 8px;
    max-height: 520px;
    overflow: auto;
    padding-right: 4px;
}

.allocation-search {
    display: block;
    margin-bottom: 12px;
}

.dashboard-heading {
    min-height: 108px;
}

.dashboard-toolbar {
    position: sticky;
    top: 10px;
    z-index: 8;
    background: rgba(255, 255, 255, 0.88);
}

.dashboard-filters {
    grid-template-columns: repeat(3, minmax(160px, 1fr)) auto auto;
}

.dashboard-metrics .metric {
    min-height: 112px;
}

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

.quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 10px 14px;
    color: var(--text);
    border: 1px solid rgba(15, 23, 42, .10);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .76);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .07);
    backdrop-filter: blur(14px);
}

.quick-action:hover {
    border-color: rgba(0, 154, 166, .30);
    background: rgba(255, 255, 255, .94);
    text-decoration: none;
    transform: translateY(-1px);
}

.quick-action strong {
    min-width: 42px;
    color: var(--accent-dark);
    font-size: 22px;
    line-height: 1;
}

.quick-action span {
    color: #344054;
    font-size: 12px;
    font-weight: 850;
}

.dashboard-main-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, .45fr);
}

.stock-quick-filter {
    grid-template-columns: minmax(260px, 1.5fr) minmax(180px, .7fr) auto auto;
    margin-bottom: 14px;
}

.list-filter-empty {
    margin-top: 10px;
}

.student-allocation-row {
    align-items: center;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) 120px;
    padding: 10px 12px;
}

.student-allocation-row span {
    margin: 0;
}

.student-allocation-row small {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 800;
}

.soft-divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 22px 0;
}

[hidden] {
    display: none !important;
}

@media (max-width: 1100px) {
    .metric-grid,
    .dashboard-grid,
    .detail-grid,
    .backoffice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .dashboard-filters,
    .stock-quick-filter {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .sidebar {
        border-radius: 0;
        left: 0;
        position: static;
        top: 0;
        width: 100%;
    }

    .content-shell {
        margin-left: 0;
        padding: 16px;
    }

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

    .sidebar-bottom {
        margin-top: 16px;
    }
}

@media (max-width: 720px) {
    .topbar,
    .page-header,
    .panel-header,
    .confirm-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .metric-grid,
    .compact-metrics,
    .dashboard-grid,
    .detail-grid,
    .backoffice-grid,
    .form-grid,
    .filter-bar {
        grid-template-columns: 1fr;
    }

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

    .segmented {
        width: 100%;
    }

    .segmented label,
    .segmented span {
        flex: 1;
        justify-content: center;
        text-align: center;
    }

    .auth-topbar {
        padding: 16px;
    }

    .student-allocation-row {
        grid-template-columns: 1fr;
    }

    .quick-action-grid,
    .dashboard-filters,
    .stock-quick-filter {
        grid-template-columns: 1fr;
    }

    .dashboard-toolbar {
        position: static;
    }
}

/* Level X visual language, aligned with the supplied reference application. */
:root {
    --bg: #eef5fb;
    --surface: rgba(255, 255, 255, 0.91);
    --surface-soft: rgba(248, 251, 253, 0.9);
    --text: #101828;
    --muted: #536071;
    --line: rgba(16, 24, 40, 0.12);
    --sidebar: #18232d;
    --accent: #009aa6;
    --accent-dark: #087783;
    --danger: #e95b4f;
    --success: #66a427;
    --warning: #f0883f;
    --blue: #009aa6;
    --purple: #a06198;
    --radius: 8px;
    --shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
    --small-shadow: 0 10px 24px rgba(15, 23, 42, 0.09);
    --spectrum: linear-gradient(90deg, #e95b4f 0 16%, #a06198 16% 32%, #009aa6 32% 48%, #f0883f 48% 64%, #66a427 64% 80%, #006e43 80% 100%);
}

body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

body.app-body {
    background:
        linear-gradient(90deg, rgba(238, 245, 251, 0.9), rgba(238, 245, 251, 0.30)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.18) 46%, rgba(255, 255, 255, 0.42)),
        url("../img/levelx-background.jpg") center / cover fixed no-repeat;
}

body.auth-body {
    background:
        linear-gradient(135deg, rgba(18, 30, 43, 0.92), rgba(0, 110, 105, 0.62)),
        url("../img/levelx-background.jpg") center / cover no-repeat;
}

.sidebar {
    background:
        linear-gradient(90deg, rgba(255,255,255,.14), rgba(255,255,255,0) 44%),
        linear-gradient(135deg, rgba(0,154,166,.16), rgba(0,154,166,0) 56%),
        linear-gradient(180deg, rgba(50,62,72,.97), rgba(25,38,52,.97) 42%, rgba(10,24,39,.97));
    backdrop-filter: blur(18px);
    width: 212px;
    padding: 18px 12px 14px;
}

.sidebar::before { background: var(--spectrum); left: 12px; right: 12px; }
.content-shell { margin-left: 230px; padding: 10px 16px 36px 0; }
.content-shell::before { display: none; }

.sidebar-brand {
    flex-direction: column;
    gap: 5px;
    justify-content: center;
    min-height: 96px;
    padding-bottom: 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,.10);
}

.brand-logo { display: block; width: 118px; height: auto; filter: drop-shadow(0 7px 14px rgba(0,0,0,.2)); }
.sidebar-brand > span { display: block; }
.sidebar-brand strong { font-size: 14px; }
.sidebar-brand small { color: rgba(255,255,255,.70); font-size: 10px; margin-top: 2px; }
.auth-brand { flex-direction: row; }
.auth-brand .brand-logo { width: 124px; }

.main-nav { gap: 4px; margin-top: 20px; }
.nav-link { min-height: 42px; border-radius: 5px; color: rgba(255,255,255,.84); font-size: 12px; }
.nav-link:hover, .nav-link.active { background: color-mix(in srgb, var(--item-accent) 19%, rgba(255,255,255,.05)); border-color: color-mix(in srgb, var(--item-accent) 38%, rgba(255,255,255,.20)); }
.button-logout { border-radius: 5px; background: linear-gradient(180deg, #d8584e, #bb453d); }

.topbar { justify-content: flex-end; min-height: 78px; }
.topbar strong { font-size: 16px; }
.user-pill { background: rgba(255,255,255,.62); border: 1px solid rgba(15,23,42,.10); backdrop-filter: blur(16px); }
.user-pill:hover { text-decoration: none; }
.sidebar-bottom form,
.sidebar-bottom .button { width: 100%; }

.panel, .auth-card, .metric {
    border-color: rgba(15,23,42,.10);
    box-shadow: 0 14px 34px rgba(15,23,42,.09);
    backdrop-filter: blur(14px);
}

.panel { padding: 16px; }
.page-header h1 { font-size: 34px; letter-spacing: 0; }
.panel h2 { font-size: 18px; letter-spacing: 0; }
.metric { min-height: 104px; }
.metric::before { top: 0; bottom: 0; width: 4px; }
.metric-value { font-size: 31px; }

input, select, textarea {
    min-height: 44px;
    border: 1px solid rgba(15,23,42,.13);
    border-radius: 14px;
    background: rgba(255,255,255,.84);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.72);
    font-weight: 700;
}

input:hover, select:hover, textarea:hover { border-color: rgba(0,154,166,.26); background: rgba(255,255,255,.94); }
input:focus, select:focus, textarea:focus { border-color: rgba(0,154,166,.42); box-shadow: 0 0 0 4px rgba(0,154,166,.14), 0 12px 28px rgba(15,23,42,.10); }

.button { border-radius: 999px; min-height: 40px; transition: transform .16s ease, box-shadow .16s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(15,23,42,.12); }
.button-primary { background: linear-gradient(135deg, #009aa6, #087783); box-shadow: 0 12px 26px rgba(0,154,166,.22); }
.button-secondary { background: rgba(255,255,255,.78); }
.button-danger { background: linear-gradient(135deg, #e95b4f, #c9483e); }

th { color: #253248; font-size: 11px; }
td { color: #1f2b3d; font-size: 12px; font-weight: 650; }
tbody tr:hover { background: rgba(0,154,166,.045); }

.compact-filter {
    align-items: end;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

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

.check-card {
    align-items: center;
    background: rgba(255,255,255,.65);
    border: 1px solid var(--line);
    border-radius: 14px;
    display: flex;
    gap: 12px;
    min-height: 76px;
    padding: 13px;
}

.check-indicator {
    align-items: center;
    border-radius: 50%;
    display: inline-flex;
    flex: 0 0 34px;
    font-size: 18px;
    font-weight: 900;
    height: 34px;
    justify-content: center;
}

.check-card strong,
.check-card small { display: block; }
.check-card small { color: var(--muted); margin-top: 2px; }
.check-ok .check-indicator { background: var(--success-soft); color: var(--success); }
.check-warning .check-indicator { background: var(--warning-soft); color: var(--warning); }

.workflow-list { display: grid; gap: 12px; margin: 18px 0; padding-left: 24px; }
.workflow-list li::marker { color: var(--accent); font-weight: 900; }
.audit-json { background: #101828; border-radius: 10px; color: #d8e5ef; font-size: 12px; max-width: 520px; overflow: auto; padding: 12px; white-space: pre-wrap; }
details summary { color: var(--accent-dark); cursor: pointer; font-weight: 800; }
.status-processed { background: var(--success-soft); color: var(--success); }
.status-draft { background: var(--warning-soft); color: #a85e17; }
.status-cancelled { background: var(--danger-soft); color: var(--danger); }

@media (max-width: 900px) {
    .sidebar { width: 100%; }
    .content-shell { margin-left: 0; padding: 16px; }
    .sidebar-brand { flex-direction: row; text-align: left; min-height: 72px; border-bottom: 0; }
}

@media (max-width: 1100px) {
    .backoffice-actions,
    .choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .backoffice-actions,
    .choice-grid,
    .student-check-grid {
        grid-template-columns: 1fr;
    }
}

/* Final polish pass for the current Level X screens. */
body.app-body {
    background:
        linear-gradient(90deg, rgba(239, 247, 249, 0.95) 0%, rgba(239, 247, 249, 0.66) 44%, rgba(239, 247, 249, 0.86) 100%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.10) 45%, rgba(255, 255, 255, 0.50) 100%),
        url("../img/levelx-background.jpg") center / cover fixed no-repeat;
}

.content-shell {
    padding: 8px 16px 30px 0;
}

.topbar {
    min-height: 62px;
    padding-bottom: 4px;
}

.user-pill {
    background: rgba(255, 255, 255, 0.86);
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.page {
    max-width: 1740px;
}

.page-header {
    margin: 0 0 12px;
}

.hero-header,
.dashboard-heading {
    min-height: 92px;
}

.page-header h1 {
    color: #071427;
    font-size: 34px;
    letter-spacing: 0;
}

.page-subtitle {
    color: #43536a;
}

.panel,
.metric,
.task-card,
.quick-action {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(15, 23, 42, 0.09);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.panel {
    margin-bottom: 12px;
    padding: 14px 16px;
}

.panel-header {
    margin-bottom: 10px;
}

.metric {
    min-height: 88px;
    padding: 16px 18px;
}

.metric-value {
    font-size: 28px;
}

.metric-label {
    color: #4d5d72;
    font-size: 12px;
}

.quick-action {
    min-height: 56px;
}

input,
select,
textarea {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(15, 23, 42, 0.14);
    border-radius: 10px;
    min-height: 42px;
}

.button {
    border-radius: 8px;
    min-height: 38px;
    padding: 8px 16px;
}

.button-large {
    border-radius: 999px;
    min-height: 50px;
}

.button-primary {
    background: #0097a5;
    box-shadow: 0 10px 22px rgba(0, 151, 165, 0.22);
}

.button-primary:hover {
    background: #087783;
}

.button-secondary {
    background: rgba(255, 255, 255, 0.90);
}

.button-small {
    min-height: 34px;
    padding: 6px 12px;
}

.actions .button-small {
    min-width: 96px;
}

.table-wrap {
    border-radius: 8px;
}

table {
    min-width: 760px;
}

th,
td {
    padding: 10px 12px;
}

th {
    color: #26344a;
    font-size: 11px;
}

td {
    color: #1b293b;
    font-size: 13px;
    font-weight: 650;
}

tbody tr:nth-child(even) {
    background: rgba(248, 251, 253, 0.58);
}

tbody tr:hover {
    background: rgba(0, 154, 166, 0.08);
}

.status,
.tag,
.pill {
    padding: 4px 10px;
}

.dashboard-toolbar {
    position: relative;
    top: auto;
    z-index: 1;
}

.dashboard-main-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.45fr);
}

.student-admin-grid {
    grid-template-columns: minmax(420px, 0.82fr) minmax(700px, 1.18fr);
}

.student-admin-grid .table-wrap table {
    min-width: 680px;
}

.stock-quick-filter,
.dashboard-filters,
.compact-filter {
    gap: 12px;
}

.sidebar {
    box-shadow: 0 18px 38px rgba(5, 18, 32, 0.24);
}

.nav-mark {
    background: color-mix(in srgb, var(--item-accent) 23%, transparent);
    border: 1px solid color-mix(in srgb, var(--item-accent) 42%, transparent);
}

.nav-link.active {
    background: color-mix(in srgb, var(--item-accent) 25%, rgba(255, 255, 255, 0.05));
}

@media (max-width: 1200px) {
    .student-admin-grid,
    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .content-shell {
        padding: 14px;
    }

    .topbar {
        min-height: auto;
    }

    .hero-header,
    .dashboard-heading {
        min-height: auto;
    }
}
