:root {
    --nex-primary: #4f46e5;
    --nex-primary-600: #4338ca;
    --nex-primary-soft: #eef2ff;
    --nex-secondary: #06b6d4;
    --nex-success: #10b981;
    --nex-warning: #f59e0b;
    --nex-danger: #ef4444;
    --nex-dark: #0f172a;
    --nex-muted: #64748b;
    --nex-border: #e2e8f0;
    --nex-bg: #f6f8fb;
    --nex-card: #ffffff;
    --nex-sidebar: #111827;
    --nex-sidebar-soft: #1f2937;
    --nex-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --nex-radius: 1.1rem;
}

* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

img,
video,
iframe,
table {
    max-width: 100%;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, 0.12), transparent 30rem),
        linear-gradient(135deg, #f8fafc 0%, var(--nex-bg) 100%);
    color: var(--nex-dark);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    text-decoration: none;
}

.fw-black {
    font-weight: 900;
}

.nex-info-tile {
    border: 1px solid rgba(226, 232, 240, 0.86);
    border-radius: 1rem;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    padding: 1rem;
}

.nex-public-nav {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.nex-public-nav .container,
.nex-topbar .container-fluid {
    min-width: 0;
}

.nex-index-main {
    width: min(100%, 1180px);
}

.nex-index-layout {
    min-width: 0;
}

.nex-application-card,
.nex-hero-card {
    width: 100%;
}

.nex-hero-stat {
    min-height: 100%;
}

.nex-public-actions {
    flex-shrink: 0;
}

.nex-public-toggler {
    border: 1px solid rgba(79, 70, 229, 0.22);
    border-radius: 0.85rem;
    padding: 0.55rem 0.7rem;
    box-shadow: none !important;
}

.nex-public-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.14) !important;
}

.nex-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    background: linear-gradient(135deg, var(--nex-primary), var(--nex-secondary));
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.28);
}

.nex-brand-logo,
.navbar-brand .nex-brand-logo,
.nex-sidebar-brand .nex-brand-logo {
    display: inline-block !important;
    width: auto !important;
    height: 34px !important;
    max-height: 34px !important;
    max-width: 120px !important;
    object-fit: contain !important;
}

.nex-login-logo {
    width: auto !important;
    height: 44px !important;
    max-width: 150px !important;
}

.nex-hero-card,
.card {
    border: 1px solid rgba(226, 232, 240, 0.72) !important;
    border-radius: var(--nex-radius);
    box-shadow: var(--nex-shadow);
}

.nex-hero-card {
    overflow: hidden;
    background:
        linear-gradient(145deg, rgba(79, 70, 229, 0.95), rgba(14, 165, 233, 0.9)),
        url("data:image/svg+xml,%3Csvg width='160' height='160' viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='white' fill-opacity='.12'%3E%3Ccircle cx='20' cy='20' r='2'/%3E%3Ccircle cx='80' cy='80' r='2'/%3E%3Ccircle cx='140' cy='140' r='2'/%3E%3C/g%3E%3C/svg%3E");
    color: #fff;
}

.nex-glass {
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(18px);
}

.navbar-brand {
    letter-spacing: 0.2px;
}

.btn {
    border-radius: 0.85rem;
    font-weight: 700;
    padding: 0.7rem 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--nex-primary), var(--nex-primary-600));
    border-color: var(--nex-primary);
    box-shadow: 0 12px 22px rgba(79, 70, 229, 0.24);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, var(--nex-primary-600), #3730a3);
    border-color: var(--nex-primary-600);
}

.btn-outline-primary {
    color: var(--nex-primary);
    border-color: rgba(79, 70, 229, 0.35);
}

.btn-outline-primary:hover {
    background: var(--nex-primary);
    border-color: var(--nex-primary);
}

.form-label {
    color: #334155;
    font-weight: 700;
}

.form-control,
.form-select {
    border-radius: 0.9rem;
    border-color: var(--nex-border);
    padding: 0.78rem 1rem;
    background-color: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(79, 70, 229, 0.55);
    box-shadow: 0 0 0 0.25rem rgba(79, 70, 229, 0.12);
}

.badge {
    border-radius: 999px;
    padding: 0.5rem 0.75rem;
    font-weight: 800;
}

.alert {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.success-icon {
    width: 82px;
    height: 82px;
    border-radius: 28px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--nex-success), #22c55e);
    font-size: 2.6rem;
    font-weight: 900;
    box-shadow: 0 18px 34px rgba(16, 185, 129, 0.3);
}

.nex-admin {
    background: var(--nex-bg);
}

.nex-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    background:
        radial-gradient(circle at 25% 10%, rgba(79, 70, 229, 0.32), transparent 16rem),
        linear-gradient(180deg, #111827 0%, #0f172a 100%);
    color: #fff;
    z-index: 1030;
    padding: 1.25rem;
    box-shadow: 18px 0 45px rgba(15, 23, 42, 0.16);
}

.nex-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: #fff;
    padding: 0.35rem 0.35rem 1.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.15rem;
}

.nex-sidebar-title {
    font-weight: 900;
    line-height: 1.1;
}

.nex-sidebar-subtitle {
    color: rgba(255, 255, 255, 0.56);
    font-size: 0.78rem;
}

.nex-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: rgba(255, 255, 255, 0.72);
    border-radius: 1rem;
    padding: 0.85rem 1rem;
    font-weight: 750;
    transition: all 0.18s ease;
}

.nex-sidebar-link:hover,
.nex-sidebar-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(3px);
}

.nex-sidebar-icon {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
}

.nex-topbar {
    position: sticky;
    top: 0;
    margin-left: 280px;
    height: 78px;
    z-index: 1020;
    background: rgba(246, 248, 251, 0.86);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.nex-admin-main {
    margin-left: 280px;
    padding: 1.6rem;
}

.nex-page-title {
    font-weight: 900;
    letter-spacing: -0.03em;
}

.nex-kpi-card {
    position: relative;
    overflow: hidden;
    border: 0 !important;
    border-radius: 1.35rem;
    background: #fff;
    box-shadow: var(--nex-shadow);
}

.nex-kpi-card::after {
    content: "";
    position: absolute;
    width: 110px;
    height: 110px;
    right: -42px;
    top: -42px;
    border-radius: 50%;
    background: rgba(79, 70, 229, 0.09);
}

.nex-kpi-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: var(--nex-primary);
    background: var(--nex-primary-soft);
    font-size: 1.25rem;
}

.stat-card {
    border: 0;
    border-radius: 1.25rem;
    box-shadow: var(--nex-shadow);
}

.table {
    --bs-table-bg: transparent;
    min-width: 760px;
}

.table thead th {
    color: #64748b;
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--nex-border);
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    border-color: rgba(226, 232, 240, 0.72);
    color: #334155;
}

.table-hover tbody tr:hover {
    background: rgba(79, 70, 229, 0.04);
}

.table img.preview-photo {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.nex-filter-group .btn {
    box-shadow: none;
    padding: 0.6rem 0.85rem;
}

.nex-login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at 15% 15%, rgba(79, 70, 229, 0.25), transparent 24rem),
        radial-gradient(circle at 90% 20%, rgba(6, 182, 212, 0.22), transparent 25rem),
        linear-gradient(135deg, #0f172a, #1e1b4b);
}

.nex-login-card {
    width: min(100%, 980px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    background: rgba(255, 255, 255, 0.94) !important;
}

.nex-login-panel {
    min-height: 100%;
    color: #fff;
    background:
        linear-gradient(145deg, rgba(79, 70, 229, 0.96), rgba(6, 182, 212, 0.86)),
        url("data:image/svg+xml,%3Csvg width='220' height='220' viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 30h80v80H20zM120 120h80v80h-80z' fill='white' fill-opacity='.08'/%3E%3C/svg%3E");
}

.nex-mobile-toggle {
    display: none;
}

@media (max-width: 1199.98px) {
    .display-5 {
        font-size: clamp(2rem, 5vw, 3rem);
    }

    .display-6 {
        font-size: clamp(1.75rem, 4.5vw, 2.5rem);
    }
}

@media (max-width: 991.98px) {
    .nex-sidebar {
        width: min(86vw, 320px);
        max-width: 100%;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
    }

    body.sidebar-open .nex-sidebar {
        transform: translateX(0);
    }

    .nex-topbar,
    .nex-admin-main {
        margin-left: 0;
    }

    .nex-mobile-toggle {
        display: inline-flex;
    }

    .nex-topbar {
        height: auto;
        min-height: 70px;
        padding-block: 0.65rem;
    }

    .nex-admin-main {
        padding: 1.25rem;
    }

    .nex-filter-group {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.15rem;
    }

    .nex-filter-group .btn {
        white-space: nowrap;
    }
}

@media (max-width: 767.98px) {
    .nex-index-main {
        max-width: 430px;
    }

    .nex-index-layout {
        align-items: stretch !important;
    }

    .nex-index-layout > [class*="col-"] {
        width: 100%;
    }

    .nex-index-layout > .col-lg-7 {
        order: 1;
    }

    .nex-index-layout > .col-lg-5 {
        order: 2;
    }

    .nex-hero-card .display-5,
    .nex-hero-card .display-6 {
        font-size: clamp(1.35rem, 6.5vw, 1.9rem);
        line-height: 1.12;
        margin-bottom: 0.65rem !important;
    }

    .nex-hero-card .lead {
        font-size: 0.92rem;
        line-height: 1.45;
        margin-bottom: 1rem !important;
    }

    .nex-public-nav .container,
    .nex-topbar .container-fluid,
    .card-header,
    .nex-card-stack {
        flex-wrap: wrap;
    }

    .nex-public-nav .navbar-brand span:last-child,
    .nex-topbar .small,
    .nex-topbar .btn-outline-primary {
        display: none !important;
    }

    .nex-public-nav .navbar-brand {
        margin-right: 0;
    }

    .nex-public-nav .navbar-collapse {
        width: 100%;
        flex-basis: 100%;
    }

    .nex-public-actions {
        padding-top: 0.75rem;
    }

    .nex-public-nav .btn,
    .nex-topbar .btn {
        padding: 0.55rem 0.75rem;
        font-size: 0.85rem;
    }

    .nex-application-card .row.g-3 {
        --bs-gutter-y: 0.85rem;
    }

    .nex-application-card .form-label {
        margin-bottom: 0.35rem;
    }

    .table-responsive[data-card-table] {
        overflow: visible;
    }

    .table-responsive[data-card-table] .table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0 0.85rem;
    }

    .table-responsive[data-card-table] thead {
        display: none;
    }

    .table-responsive[data-card-table] tbody,
    .table-responsive[data-card-table] tr,
    .table-responsive[data-card-table] td {
        display: block;
        width: 100%;
    }

    .table-responsive[data-card-table] tr {
        border: 1px solid var(--nex-border);
        border-radius: 1rem;
        background: #fff;
        box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
        overflow: hidden;
    }

    .table-responsive[data-card-table] td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.85rem 1rem;
        text-align: right !important;
        border-color: rgba(226, 232, 240, 0.65);
        word-break: break-word;
    }

    .table-responsive[data-card-table] td::before {
        content: attr(data-label);
        color: var(--nex-muted);
        font-size: 0.74rem;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-align: left;
        text-transform: uppercase;
        flex: 0 0 42%;
    }

    .table-responsive[data-card-table] td[data-label="Actions"] {
        justify-content: flex-end;
    }

    .table-responsive[data-card-table] td[data-label="Actions"]::before {
        display: none;
    }

    .table-responsive[data-card-table] td[colspan] {
        display: block;
        text-align: center !important;
    }

    .table-responsive[data-card-table] td[colspan]::before {
        display: none;
    }
}

@media (max-width: 575.98px) {
    body {
        font-size: 0.95rem;
    }

    .nex-admin-main {
        padding: 0.85rem;
    }

    main.container {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .container.py-5,
    main.py-5 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    .card,
    .nex-hero-card,
    .nex-info-tile {
        border-radius: 0.95rem;
    }

    .card-body,
    .card-header {
        padding: 1rem !important;
    }

    .nex-hero-card {
        padding: 1rem !important;
    }

    .nex-hero-card .badge,
    .nex-application-card .badge {
        font-size: 0.66rem;
        padding: 0.38rem 0.55rem;
    }

    .nex-public-nav-inner {
        gap: 0.75rem;
    }

    .nex-public-actions {
        width: 100%;
        flex-direction: column;
    }

    .nex-public-actions .btn {
        width: 100%;
    }

    .nex-brand-mark {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }

    .nex-brand-logo,
    .navbar-brand .nex-brand-logo,
    .nex-sidebar-brand .nex-brand-logo {
        width: auto !important;
        height: 30px !important;
        max-width: 105px !important;
    }

    .nex-hero-stats > [class*="col-"] {
        width: 100%;
    }

    .nex-hero-stat {
        padding: 0.9rem !important;
    }

    .nex-application-card .h3,
    .nex-application-card h2 {
        font-size: 1.22rem;
    }

    .nex-application-card p,
    .nex-application-card .form-text {
        font-size: 0.82rem;
    }

    .nex-application-card .mb-4 {
        margin-bottom: 1rem !important;
    }

    .nex-application-card .btn-lg {
        font-size: 1rem;
        padding-inline: 0.75rem;
        white-space: normal;
    }

    .btn,
    .form-control,
    .form-select,
    .input-group-text {
        min-height: 44px;
    }

    .btn-group.nex-filter-group {
        display: flex;
    }

    .nex-sidebar {
        width: 86vw;
    }
}
