:root {
    --bg: #f3f5f8;
    --surface: #ffffff;
    --sidebar-bg: #ffffff;
    --text: #1a1d2e;
    --text-2: #3b3f54;
    --muted: #8a8fa3;
    --muted-2: #b3b7c5;
    --line: #eef0f5;
    --line-2: #e3e6ee;
    --accent: #2d8cf0;
    --accent-soft: rgba(45, 140, 240, 0.10);
    --accent-soft-2: rgba(45, 140, 240, 0.18);
    --green: #10b981;
    --green-soft: rgba(16, 185, 129, 0.10);
    --red: #ef4444;
    --red-soft: rgba(239, 68, 68, 0.10);
    --amber: #f59e0b;
    --amber-soft: rgba(245, 158, 11, 0.10);
    --purple: #8b5cf6;
    --purple-soft: rgba(139, 92, 246, 0.10);
    --dark: #1a1d2e;
    --radius: 18px;
    --radius-lg: 22px;
    --sidebar-w: 248px;
    --topbar-h: 72px;
    --shadow-xs: 0 1px 2px rgba(20, 30, 60, 0.04);
    --shadow: 0 1px 2px rgba(20, 30, 60, 0.05), 0 4px 14px -8px rgba(20, 30, 60, 0.10);
    --shadow-lg: 0 20px 60px -28px rgba(20, 30, 60, 0.22);
}

[data-bs-theme="dark"] {
    --bg: #10131f;
    --surface: #171b2a;
    --sidebar-bg: #151928;
    --text: #f5f7fb;
    --text-2: #d7dcec;
    --muted: #9aa3b8;
    --muted-2: #707a91;
    --line: #252b3c;
    --line-2: #31384b;
    --accent-soft: rgba(45, 140, 240, 0.16);
    --accent-soft-2: rgba(45, 140, 240, 0.24);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.18);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 14px 36px -28px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 60px -28px rgba(0, 0, 0, 0.72);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: "DM Sans", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    letter-spacing: 0;
}

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

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

i[data-lucide] {
    width: 1em;
    height: 1em;
    stroke-width: 2.1;
    vertical-align: -0.125em;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: #dadde6;
    border-radius: 99px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: #c0c4d0;
    background-clip: content-box;
}

::-webkit-scrollbar-track {
    background: transparent;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    height: 100vh;
    overflow-y: auto;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--line);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    z-index: 60;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 14px;
    color: var(--text);
}

.brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: linear-gradient(135deg, var(--accent), #7bbcff);
    color: #ffffff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-logo.xl {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    font-size: 28px;
}

.brand-preview {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fafbfd;
    display: flex;
    align-items: center;
    gap: 14px;
}

[data-bs-theme="dark"] .brand-preview {
    background: #1c2232;
}

.brand-preview strong,
.brand-preview small {
    display: block;
}

.brand-preview strong {
    color: var(--text);
    font-size: 18px;
}

.brand-preview small {
    color: var(--muted);
}

.brand .nm,
.brand .sub {
    display: block;
}

.brand .nm {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

.brand .sub {
    font-size: 11px;
    color: var(--muted);
}

.side-nav {
    padding-bottom: 12px;
}

.nav-section {
    margin: 18px 10px 6px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.18em;
}

.side-link,
.side-toggle {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    padding: 10px 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.side-link:hover,
.side-toggle:hover,
.side-action:hover {
    background: #f3f5f8;
    color: var(--text);
}

[data-bs-theme="dark"] .side-link:hover,
[data-bs-theme="dark"] .side-toggle:hover,
[data-bs-theme="dark"] .side-action:hover {
    background: #202638;
}

.side-link.active,
.side-toggle.active-parent {
    background: var(--accent-soft);
    color: var(--accent);
}

.side-link.active:before {
    content: "";
    width: 4px;
    height: 22px;
    border-radius: 99px;
    background: var(--accent);
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
}

.ico {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    flex: 0 0 auto;
    opacity: 0.9;
}

.chev {
    margin-left: auto;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.side-toggle.open .chev {
    transform: rotate(180deg);
}

.side-children {
    display: none;
    padding: 3px 0 4px 34px;
}

.side-children.show {
    display: grid;
    gap: 2px;
}

.side-sublink {
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 13px;
    transition: background 0.15s ease, color 0.15s ease;
}

.side-sublink:before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.38;
}

.side-sublink:hover,
.side-sublink.active {
    background: #f3f5f8;
    color: var(--accent);
}

[data-bs-theme="dark"] .side-sublink:hover,
[data-bs-theme="dark"] .side-sublink.active {
    background: #202638;
}

.foot {
    margin-top: auto;
    padding: 14px 8px 4px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 8px;
}

.side-action {
    justify-content: flex-start;
}

.side-action form {
    margin: 0;
}

.version-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-size: 11px;
    padding: 4px 2px 0;
}

.sidebar-backdrop {
    display: none;
}

.app-main {
    min-width: 0;
    height: 100vh;
    display: grid;
    grid-template-rows: var(--topbar-h) minmax(0, 1fr);
    overflow: hidden;
}

.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 0 26px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 40;
}

.menu-toggle,
.btn-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 99px;
    border: 0;
    background: #f3f5f8;
    color: var(--text-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.menu-toggle {
    display: none;
    border-radius: 12px;
}

.btn-icon:hover,
.menu-toggle:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.btn-icon .dot {
    width: 8px;
    height: 8px;
    position: absolute;
    top: 9px;
    right: 9px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 2px var(--surface);
}

.search {
    max-width: 440px;
    width: 100%;
    height: 44px;
    border: 1px solid transparent;
    border-radius: 99px;
    background: #f3f5f8;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    transition: background 0.15s ease, border 0.15s ease, box-shadow 0.15s ease;
}

.search:focus-within {
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 13.5px;
}

.search input::placeholder {
    color: var(--muted-2);
}

.topbar-title {
    min-width: 180px;
    margin-left: auto;
}

.topbar h1 {
    margin: 0;
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0;
}

.topbar .sub,
.page-head .sub {
    color: var(--muted);
    font-size: 13.5px;
}

.actions,
.topbar .actions,
.page-head .actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-chip {
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 2px 4px 4px;
    border-radius: 99px;
}

.user-chip:hover {
    background: #f3f5f8;
}

.av {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #7bbcff);
    color: #ffffff;
    font-weight: 700;
}

.nm-wrap,
.nm-wrap .nm,
.nm-wrap .st {
    display: block;
    text-align: left;
}

.nm-wrap .nm {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
}

.nm-wrap .st {
    color: var(--green);
    font-size: 11px;
}

.nm-wrap .st span {
    width: 6px;
    height: 6px;
    display: inline-block;
    border-radius: 50%;
    background: currentColor;
    margin-right: 5px;
}

.dropdown-panel {
    display: none;
    min-width: 220px;
    position: absolute;
    right: 26px;
    top: 62px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    padding: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 90;
}

.dropdown-panel.show {
    display: grid;
}

.dropdown-panel a,
.dropdown-panel button {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13.5px;
    text-align: left;
}

.dropdown-panel a:hover,
.dropdown-panel button:hover {
    background: #f3f5f8;
    color: var(--text);
}

.dropdown-panel hr {
    margin: 4px 0;
    border-top: 1px solid var(--line);
}

.content-wrap {
    overflow-y: auto;
    padding: 24px 26px 80px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.page-head h1 {
    margin: 0;
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0;
}

.card,
.panel,
.auth-card,
.metric-card,
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}

.card {
    overflow: hidden;
}

.card-head,
.panel-head {
    min-height: 58px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-head {
    margin: -20px -20px 18px;
}

.card-head h3,
.panel-head h2 {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
}

.card-body {
    padding: 22px;
}

.card-foot {
    padding: 14px 22px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.inner-head {
    margin: 8px -22px 2px;
    border-top: 1px solid var(--line);
}

.panel {
    padding: 20px;
}

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

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

.stat,
.metric-card {
    min-height: 148px;
    padding: 20px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat:hover,
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat .ico,
.metric-card > span {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.ico.blue,
.metric-card > span {
    background: var(--accent-soft);
    color: var(--accent);
}

.ico.green,
.accent-green > span {
    background: var(--green-soft);
    color: var(--green);
}

.ico.amber,
.accent-amber > span {
    background: var(--amber-soft);
    color: var(--amber);
}

.ico.purple {
    background: var(--purple-soft);
    color: var(--purple);
}

.ico.red {
    background: var(--red-soft);
    color: var(--red);
}

.stat .lbl,
.metric-card p {
    margin: 14px 0 4px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.stat .val,
.metric-card strong {
    color: var(--text);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0;
}

.stat .delta {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
}

.delta.up {
    color: var(--green);
}

.delta.down {
    color: var(--red);
}

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

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

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

.span-2-panel {
    grid-column: 1 / -1;
}

.btn {
    min-height: 44px;
    border-radius: 99px;
    border: 1px solid transparent;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-2);
    background: transparent;
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border 0.15s ease, box-shadow 0.15s ease;
}

.btn-sm {
    min-height: 34px;
    padding: 7px 12px;
    font-size: 12.5px;
}

.btn-lg {
    min-height: 50px;
    padding: 13px 22px;
    font-size: 14.5px;
}

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

.btn-primary:hover {
    background: #1f79d5;
    border-color: #1f79d5;
    color: #ffffff;
    box-shadow: 0 10px 24px -16px var(--accent);
}

.btn-dark {
    background: var(--text);
    color: #ffffff;
}

.btn-outline,
.btn-outline-primary {
    background: transparent;
    border-color: var(--line-2);
    color: var(--text-2);
}

.btn-outline:hover,
.btn-outline-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.btn-soft {
    background: #f3f5f8;
    color: var(--text-2);
}

.btn-soft:hover {
    background: #e9edf5;
    color: var(--text);
}

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

.btn-success {
    background: var(--green);
    color: #ffffff;
}

.btn-ghost {
    background: transparent;
    color: var(--text-2);
}

.btn-ghost:hover {
    background: #f3f5f8;
    color: var(--text);
}

.icon-btn {
    width: 40px;
    min-width: 40px;
    padding: 0;
}

.tbl-wrap,
.table-responsive {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.tbl,
.table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    color: var(--text);
    margin: 0;
}

.tbl thead th,
.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fafbfd;
    color: var(--muted);
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
}

[data-bs-theme="dark"] .tbl thead th,
[data-bs-theme="dark"] .table thead th {
    background: #1c2232;
}

.tbl td,
.table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    color: var(--text-2);
    font-size: 13.5px;
    vertical-align: middle;
}

.tbl tbody tr:hover,
.table tbody tr:hover {
    background: #f9fafd;
}

[data-bs-theme="dark"] .tbl tbody tr:hover,
[data-bs-theme="dark"] .table tbody tr:hover {
    background: #1d2332;
}

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

.pill,
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 99px;
    border: 0;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
}

.pill .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.pill.green {
    background: var(--green-soft);
    color: #047857;
}

.pill.red {
    background: var(--red-soft);
    color: #b91c1c;
}

.pill.amber {
    background: var(--amber-soft);
    color: #b45309;
}

.pill.blue {
    background: var(--accent-soft);
    color: var(--accent);
}

.pill.purple {
    background: var(--purple-soft);
    color: #6d28d9;
}

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

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

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

.form-row {
    display: grid;
    gap: 6px;
}

.form-label,
.form-row label {
    margin: 0 0 6px;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
}

.input,
.form-control,
.form-select,
textarea.form-control {
    width: 100%;
    min-height: 44px;
    padding: 11px 14px;
    border: 1px solid var(--line-2);
    border-radius: 12px;
    outline: 0;
    background-color: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.3;
    transition: border 0.15s ease, box-shadow 0.15s ease;
}

.form-select {
    appearance: none;
    padding-right: 38px;
}

textarea.form-control {
    min-height: 110px;
    resize: vertical;
}

.input:focus,
.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.form-control::placeholder {
    color: var(--muted-2);
}

.compact-input {
    max-width: 120px;
}

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

.collection-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.toolbar-form {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
    gap: 12px;
    align-items: flex-end;
}

.toolbar-action {
    display: flex;
    align-items: flex-end;
}

.collection-table {
    min-width: 1180px;
}

.table-input,
.table-select {
    min-width: 118px;
}

.remarks-input {
    min-width: 180px;
}

.student-summary,
.rate-grid {
    display: grid;
    gap: 14px;
}

.student-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 16px;
}

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

.student-summary > div,
.rate-grid > div,
.advance-estimate {
    border: 1px solid var(--line);
    background: #fafbfd;
    border-radius: 14px;
    padding: 14px;
}

[data-bs-theme="dark"] .student-summary > div,
[data-bs-theme="dark"] .rate-grid > div,
[data-bs-theme="dark"] .advance-estimate {
    background: #1c2232;
}

.student-summary span,
.rate-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.student-summary strong,
.student-summary small,
.rate-grid strong {
    display: block;
}

.student-summary small {
    color: var(--muted);
}

.rate-grid strong {
    margin-top: 6px;
    color: var(--text);
    font-size: 18px;
}

.advance-estimate {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-weight: 600;
}

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

.inline-filter {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px) auto;
    gap: 10px;
    align-items: center;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.toggle-row {
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fafbfd;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
}

[data-bs-theme="dark"] .toggle-row {
    background: #1c2232;
}

.toggle-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

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

.mt-4 {
    margin-top: 18px;
}

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

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

.policy-row {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.policy-row strong,
.policy-row small {
    display: block;
}

.policy-row small {
    margin-top: 3px;
    color: var(--muted);
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    padding: 16px 0 0;
    display: flex;
    justify-content: flex-end;
}

.alert,
.app-alert {
    padding: 12px 16px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    border: 1px solid;
    font-size: 13.5px;
}

.alert.success,
.alert-success {
    background: var(--green-soft);
    border-color: #a7f3d0;
    color: #065f46;
}

.alert.error,
.alert-danger {
    background: var(--red-soft);
    border-color: #fecaca;
    color: #7f1d1d;
}

.alert.info,
.alert-info {
    background: var(--accent-soft);
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.alert.warn,
.alert-warning {
    background: var(--amber-soft);
    border-color: #fde68a;
    color: #92400e;
}

.workflow-list {
    display: grid;
    gap: 12px;
}

.workflow-item {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 12px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.workflow-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
}

.workflow-item strong,
.workflow-item small {
    display: block;
}

.workflow-item small,
.muted-note {
    color: var(--muted);
    font-size: 12.5px;
}

.table-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.table-chip-list span {
    padding: 7px 10px;
    border-radius: 99px;
    background: #f3f5f8;
    color: var(--text-2);
    font-family: Inter, system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
}

.timeline-list {
    display: grid;
    gap: 14px;
}

.timeline-list article {
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 12px;
    align-items: start;
}

.timeline-dot {
    width: 10px;
    height: 10px;
    margin-top: 6px;
    border-radius: 99px;
    background: var(--accent);
}

.timeline-list p {
    margin: 3px 0 0;
    color: var(--muted);
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.empty-state {
    min-height: 320px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    text-align: center;
    color: var(--muted);
}

.empty-state.compact {
    min-height: 260px;
}

.empty-state i,
.empty-state svg {
    color: var(--accent);
    font-size: 38px;
}

.empty-state h2 {
    margin: 0;
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
}

.auth-body {
    min-height: 100vh;
    overflow: auto;
    background:
        radial-gradient(circle at top left, rgba(45, 140, 240, 0.18), transparent 30%),
        radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.12), transparent 28%),
        var(--bg);
}

.auth-panel {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(100%, 420px);
    border-radius: 24px;
    padding: 36px;
    box-shadow: var(--shadow-lg);
}

.auth-brand {
    padding: 0 0 18px;
}

.auth-copy {
    margin: 0 0 20px;
}

.auth-copy h1 {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
}

.auth-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.auth-foot {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12.5px;
    text-align: center;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes modalIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

    .sidebar {
        width: 260px;
        position: fixed;
        top: 0;
        left: -280px;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-lg);
    }

    body.sidebar-open .sidebar {
        left: 0;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(20, 30, 60, 0.32);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
        z-index: 50;
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .content-wrap {
        padding: 16px 14px 80px;
    }

    .stat-grid,
    .metric-grid,
    .compact-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .row-2,
    .content-grid {
        grid-template-columns: 1fr;
    }

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

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

    .topbar-title {
        display: none;
    }
}

@media (max-width: 880px) {
    .topbar {
        padding: 0 14px;
        gap: 8px;
    }

    .search {
        max-width: none;
    }

    .user-chip .nm-wrap {
        display: none;
    }

    .form-grid,
    .form-grid.three,
    .form-grid.four,
    .inline-filter,
    .toolbar-form,
    .check-grid,
    .student-summary,
    .rate-grid {
        grid-template-columns: 1fr;
    }

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

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

    .collection-toolbar,
    .advance-estimate {
        align-items: stretch;
        flex-direction: column;
    }

    .card-head,
    .panel-head,
    .card-body,
    .panel,
    .metric-card,
    .stat {
        padding: 14px;
    }

    .card-head,
    .panel-head {
        align-items: stretch;
        flex-direction: column;
    }

    .panel-head {
        margin: -14px -14px 14px;
    }
}

@media (max-width: 520px) {
    :root {
        --topbar-h: 60px;
    }

    .search {
        display: none;
    }

    .stat-grid,
    .metric-grid,
    .compact-metrics,
    .row-4 {
        grid-template-columns: 1fr;
    }

    .page-head {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .page-head .actions {
        align-items: stretch;
        flex-direction: column;
    }

    .page-head .actions .btn {
        width: 100%;
    }

    .tbl td,
    .table td {
        padding: 11px 12px;
        font-size: 12.5px;
    }

    .tbl thead th,
    .table thead th {
        padding: 11px 12px;
    }
}
