@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --erp-sidebar-width: 252px;
    --erp-sidebar-collapsed: 82px;
    --erp-header-height: 64px;
    --erp-navy: #0a1f4f;
    --erp-navy-soft: #143578;
    --erp-gold: #e0af2f;
    --erp-text: #16233f;
    --erp-muted: #66748f;
    --erp-bg: #eef4ff;
    --erp-card: #ffffff;
    --erp-border: rgba(10, 31, 79, 0.08);
    --erp-shadow: 0 18px 40px rgba(10, 31, 79, 0.08);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body.erp-admin,
body.erp-student {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: var(--erp-text);
    background: linear-gradient(180deg, #f4f7fe 0%, #edf3ff 100%);
}

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

img {
    max-width: 100%;
    display: block;
}

.erp-layout {
    height: 100vh;
    min-height: 100vh;
    padding-left: var(--erp-sidebar-width);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: padding-left 0.25s ease;
}

@supports (height: 100dvh) {
    .erp-layout {
        height: 100dvh;
        min-height: 100dvh;
    }
}

.sidebar-collapsed .erp-layout {
    padding-left: var(--erp-sidebar-collapsed);
}

.erp-topbar {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1050;
    height: var(--erp-header-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--erp-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
}

.erp-topbar__left,
.erp-topbar__right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.erp-icon-button {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 0;
    background: rgba(10, 31, 79, 0.06);
    color: var(--erp-navy);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.erp-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(10, 31, 79, 0.06);
    font-size: 12px;
    font-weight: 700;
}

.erp-user-chip--button {
    border: 0;
    color: var(--erp-text);
    cursor: pointer;
}

.erp-user-chip--button::after {
    margin-left: 4px;
}

.erp-user-chip--button:hover,
.erp-user-chip--button:focus-visible {
    background: rgba(10, 31, 79, 0.1);
}

.erp-user-dropdown__menu {
    min-width: 220px;
    padding: 8px;
    border: 1px solid rgba(10, 31, 79, 0.08);
    border-radius: 16px;
    box-shadow: 0 18px 34px rgba(9, 25, 61, 0.14);
}

.erp-user-dropdown__menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.erp-user-dropdown__menu .dropdown-item i {
    width: 16px;
    text-align: center;
}

.erp-user-dropdown__menu .dropdown-item:hover,
.erp-user-dropdown__menu .dropdown-item:focus {
    background: rgba(10, 31, 79, 0.05);
}

.erp-user-dropdown__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px 6px;
}

.erp-user-dropdown__meta strong {
    font-size: 12px;
    color: var(--erp-navy);
}

.erp-user-dropdown__meta span {
    font-size: 11px;
    color: var(--erp-muted);
}

.erp-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1100;
    width: var(--erp-sidebar-width);
    background: linear-gradient(180deg, #071b43 0%, #0e2d68 100%);
    color: #fff;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
    transition: width 0.25s ease;
    overflow: hidden;
}

.sidebar-collapsed .erp-sidebar {
    width: var(--erp-sidebar-collapsed);
}

.erp-brand {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.erp-brand img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid rgba(224, 175, 47, 0.5);
}

.erp-brand__text {
    flex: 1 1 auto;
    min-width: 0;
}

.erp-brand__text strong,
.erp-brand__text span {
    display: block;
}

.erp-brand__text strong {
    font-size: 12px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 2px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.erp-brand__text span {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.72);
    white-space: nowrap;
}

.sidebar-collapsed .erp-brand__text,
.sidebar-collapsed .erp-nav__item span,
.sidebar-collapsed .erp-sidebar__section,
.sidebar-collapsed .erp-nav__group-title {
    display: none;
}

.erp-sidebar__section {
    padding: 14px 16px 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

.erp-nav {
    padding: 8px 10px 24px;
    overflow-y: auto;
    height: calc(100vh - 84px);
}

.erp-nav__group + .erp-nav__group {
    margin-top: 10px;
}

.erp-nav__group-title {
    padding: 8px 12px 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.46);
}

.erp-nav__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.84);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.erp-nav__item i {
    width: 18px;
    text-align: center;
    font-size: 13px;
}

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

.erp-content {
    padding: 22px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

.erp-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.erp-page-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--erp-navy);
}

.erp-page-header p {
    margin: 4px 0 0;
    color: var(--erp-muted);
    font-size: 12px;
}

.erp-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.erp-card {
    background: var(--erp-card);
    border: 1px solid var(--erp-border);
    border-radius: 18px;
    box-shadow: var(--erp-shadow);
}

.erp-card__header,
.erp-card__body {
    padding: 16px 18px;
}

.erp-card__header {
    border-bottom: 1px solid rgba(10, 31, 79, 0.06);
}

.erp-card__header h2,
.erp-card__header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
}

.erp-card__header p {
    margin: 4px 0 0;
    color: var(--erp-muted);
    font-size: 11px;
}

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

.erp-card--stat::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--accent, var(--erp-gold));
}

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

.erp-stat-card {
    padding: 14px 18px 12px;
    min-height: 78px;
}

.erp-stat-card__label {
    display: block;
    color: var(--erp-muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 8px;
}

.erp-stat-card__value {
    display: block;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.05;
    color: var(--erp-navy);
}

.erp-grid {
    display: grid;
    gap: 16px;
}

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

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

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

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

.erp-field {
    display: grid;
    gap: 6px;
}

.erp-field label,
.erp-field .erp-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--erp-navy);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.erp-field input,
.erp-field select,
.erp-field textarea {
    width: 100%;
    border: 1px solid rgba(10, 31, 79, 0.12);
    border-radius: 12px;
    background: #fff;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--erp-text);
}

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

.erp-hint,
.erp-error {
    font-size: 11px;
}

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

.erp-error {
    color: #ba2d3e;
}

.erp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-erp-primary,
.btn-erp-secondary,
.btn-erp-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 12px;
    border: 0;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 800;
}

.btn-erp-primary {
    background: linear-gradient(135deg, var(--erp-gold), #f2c65c);
    color: var(--erp-navy);
}

.btn-erp-secondary {
    background: rgba(10, 31, 79, 0.08);
    color: var(--erp-navy);
}

.btn-erp-danger {
    background: rgba(186, 45, 62, 0.12);
    color: #9d1831;
}

.erp-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.erp-table {
    width: 100%;
    border-collapse: collapse;
}

.erp-table thead th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--erp-muted);
    padding: 12px;
    background: rgba(10, 31, 79, 0.03);
    border-bottom: 1px solid rgba(10, 31, 79, 0.08);
}

.erp-table tbody td {
    padding: 12px;
    border-bottom: 1px solid rgba(10, 31, 79, 0.06);
    font-size: 12px;
    vertical-align: top;
}

.erp-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.erp-badge--success { background: rgba(47, 161, 96, 0.12); color: #0e7a42; }
.erp-badge--warning { background: rgba(224, 175, 47, 0.18); color: #976700; }
.erp-badge--danger { background: rgba(186, 45, 62, 0.12); color: #9d1831; }
.erp-badge--info { background: rgba(20, 53, 120, 0.12); color: #143578; }

.erp-footer {
    flex-shrink: 0;
    margin: 0 22px 22px;
    padding: 14px 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, #051634, #0e2b63);
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.erp-footer a {
    color: #fff;
}

.dataTables_wrapper .dt-buttons .btn,
.dataTables_wrapper .dt-buttons .dt-button,
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    font-size: 12px;
}

.dataTables_wrapper .dt-buttons .btn,
.dataTables_wrapper .dt-buttons .dt-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0;
    padding: 5px 10px;
    margin-right: 0;
    border-radius: 999px;
    border: 1px solid rgba(10, 31, 79, 0.08);
    background: #fff !important;
    color: var(--erp-navy) !important;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 5px 12px rgba(10, 31, 79, 0.06);
}

.dataTables_wrapper .dt-buttons .btn span,
.dataTables_wrapper .dt-buttons .dt-button span {
    color: var(--erp-navy) !important;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.dataTables_wrapper .dt-buttons .btn i,
.dataTables_wrapper .dt-buttons .dt-button i {
    font-size: 11px;
}

.dataTables_wrapper .dt-buttons .btn:hover,
.dataTables_wrapper .dt-buttons .btn:focus,
.dataTables_wrapper .dt-buttons .dt-button:hover,
.dataTables_wrapper .dt-buttons .dt-button:focus {
    background: #eef4ff !important;
    border-color: rgba(10, 31, 79, 0.16);
    color: var(--erp-navy) !important;
    box-shadow: 0 8px 18px rgba(10, 31, 79, 0.08);
    transform: translateY(-1px);
}

.dataTables_wrapper .dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}

.dataTables_wrapper .dt-buttons.btn-group > .btn,
.dataTables_wrapper .dt-buttons.btn-group > .dt-button {
    flex: 0 0 auto !important;
}

.dataTables_wrapper .dt-buttons .btn:last-child,
.dataTables_wrapper .dt-buttons .dt-button:last-child {
    margin-right: 0;
}

.dataTables_wrapper .dt-buttons .erp-export-btn,
.dataTables_wrapper .dt-buttons .erp-export-btn span,
.dataTables_wrapper .dt-buttons .erp-export-btn i {
    color: inherit !important;
}

.dataTables_wrapper .dt-buttons .erp-export-btn--copy {
    background: #eef4ff !important;
    border-color: #c8ddff;
    color: #124ea8 !important;
}

.dataTables_wrapper .dt-buttons .erp-export-btn--csv {
    background: #ecfff2 !important;
    border-color: #bee9cb;
    color: #0f7a41 !important;
}

.dataTables_wrapper .dt-buttons .erp-export-btn--excel {
    background: #fff6dc !important;
    border-color: #f3d98c;
    color: #9a6a00 !important;
}

.dataTables_wrapper .dt-buttons .erp-export-btn--print {
    background: #f4efff !important;
    border-color: #d7caf9;
    color: #6541bf !important;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 12px;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--erp-muted);
    white-space: nowrap;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    min-height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(10, 31, 79, 0.1);
    background: #fff;
    color: var(--erp-navy);
    box-shadow: 0 5px 12px rgba(10, 31, 79, 0.05);
}

.dataTables_wrapper .dataTables_length select {
    min-width: 76px;
    padding: 4px 30px 4px 10px;
    font-size: 11px;
    font-weight: 700;
}

.dataTables_wrapper .dataTables_filter input {
    min-width: 190px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: rgba(19, 78, 168, 0.35);
    box-shadow: 0 0 0 0.18rem rgba(19, 78, 168, 0.1);
    outline: 0;
}

.dataTables_wrapper .dataTables_paginate {
    margin-top: 10px;
}

.dataTables_wrapper .dataTables_paginate .pagination {
    gap: 6px;
    margin: 0;
}

.dataTables_wrapper .dataTables_paginate .page-item .page-link {
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--erp-navy);
    border-radius: 10px !important;
    border: 1px solid rgba(10, 31, 79, 0.1);
    background: #fff;
    box-shadow: 0 4px 10px rgba(10, 31, 79, 0.05);
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    color: var(--erp-navy);
    background: #f3bf2d;
    border-color: #f3bf2d;
    box-shadow: 0 8px 18px rgba(243, 191, 45, 0.26);
}

.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
    opacity: 0.55;
    box-shadow: none;
}

@media (max-width: 767.98px) {
    .dataTables_wrapper .dataTables_length label,
    .dataTables_wrapper .dataTables_filter label {
        width: 100%;
        justify-content: space-between;
    }

    .dataTables_wrapper .dataTables_filter input {
        min-width: 0;
        width: 100% !important;
    }
}

.erp-preview-image {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(10, 31, 79, 0.12);
}

.erp-document-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 10px;
    margin-bottom: 10px;
}

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

@media (max-width: 992px) {
    .erp-layout {
        padding-left: 0;
    }

    .erp-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        width: var(--erp-sidebar-width);
    }

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

    .erp-form-grid,
    .erp-grid--two,
    .erp-grid--three {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .erp-content {
        padding: 16px;
    }

    .erp-topbar {
        padding: 0 14px;
    }

    .erp-card__header,
    .erp-card__body,
    .erp-stat-card {
        min-height: 72px;
        padding: 12px 14px 10px;
    }

    .erp-footer {
        margin: 10px 16px 16px;
    }

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