:root {
    --gb-blue-950: #061b4f;
    --gb-blue-900: #08276f;
    --gb-blue-700: #0057ff;
    --gb-blue-100: #e8f0ff;
    --gb-bg: #f5f7fb;
    --gb-panel: #ffffff;
    --gb-text: #111827;
    --gb-muted: #667085;
    --gb-border: #e5e7eb;
    --gb-success: #16a34a;
    --gb-warning: #f59e0b;
    --gb-danger: #dc2626;
}

* {
    box-sizing: border-box;
}

body.gb-shell {
    min-height: 100vh;
    margin: 0;
    color: var(--gb-text);
    background: var(--gb-bg);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    letter-spacing: 0;
}

body.gb-auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 24px;
    color: var(--gb-text);
    background: var(--gb-bg);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

.gb-auth-card {
    width: min(100%, 440px);
    padding: 28px;
    border: 1px solid var(--gb-border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.1);
}

.gb-auth-card h1 {
    margin: 0 0 10px;
    font-size: 26px;
    font-weight: 800;
}

.gb-auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.gb-auth-brand strong,
.gb-auth-brand small {
    display: block;
    line-height: 1.15;
}

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

.gb-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: 272px;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    color: #fff;
    background: linear-gradient(180deg, var(--gb-blue-950), var(--gb-blue-900));
}

.gb-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    color: #fff;
    text-decoration: none;
}

.gb-brand:hover {
    color: #fff;
}

.gb-brand-mark {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: #fff;
    color: var(--gb-blue-900);
    font-weight: 800;
}

.gb-brand strong,
.gb-brand small {
    display: block;
    line-height: 1.15;
}

.gb-brand small {
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
}

.gb-brand span:last-child,
.gb-nav-link span,
.gb-sidebar-footer span:last-child {
    white-space: nowrap;
}

.gb-nav {
    display: grid;
    gap: 6px;
    margin-top: 28px;
}

.gb-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 9px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    transition: background 160ms ease, color 160ms ease;
}

.gb-nav-link:hover,
.gb-nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.gb-nav-link i {
    width: 20px;
    text-align: center;
}
.gb-nav-parent {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
}

.gb-nav-parent .gb-nav-chevron {
    width: auto;
    margin-left: auto;
    font-size: 12px;
    transition: transform 160ms ease;
}

.gb-nav-parent[aria-expanded="true"] .gb-nav-chevron {
    transform: rotate(180deg);
}

.gb-nav-submenu {
    display: grid;
    gap: 3px;
    margin: 3px 0 6px 32px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.gb-nav-sublink {
    padding: 7px 9px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 13px;
    line-height: 1.25;
    text-decoration: none;
}

.gb-nav-sublink:hover,
.gb-nav-sublink.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.gb-sidebar-footer {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: auto;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
}

.gb-main {
    min-height: 100vh;
    width: calc(100% - 272px);
    min-width: 0;
    margin-left: 272px;
    transition: margin-left 180ms ease;
}

.gb-topbar {
    min-height: 84px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--gb-border);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.gb-topbar h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 760;
}

.gb-kicker {
    color: var(--gb-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gb-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.gb-menu-btn {
    display: none;
}

.gb-collapse-btn {
    display: inline-flex;
}

.gb-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gb-text);
    text-decoration: none;
    font-weight: 650;
}

.gb-user-button {
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    padding: 7px 10px;
    outline: 0;
}

.gb-user-button:hover,
.gb-user-button:focus-visible,
.gb-user-button.show {
    color: var(--gb-blue-900);
    background: var(--gb-blue-50);
    border-color: var(--gb-blue-100);
    box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
}

.gb-content {
    padding: 28px;
    min-width: 0;
    overflow-x: hidden;
}

.gb-page-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.gb-page-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 760;
}

.gb-page-header p {
    margin: 6px 0 0;
    color: var(--gb-muted);
}

.gb-panel {
    border: 1px solid var(--gb-border);
    max-width: 100%;
    min-width: 0;
    border-radius: 8px;
    background: var(--gb-panel);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

.gb-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--gb-border);
}

.gb-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 760;
}

.gb-panel-body {
    padding: 20px;
}

.metric-card {
    height: 100%;
    padding: 20px;
}

.metric-icon {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    color: var(--gb-blue-700);
    background: var(--gb-blue-100);
}

.metric-label {
    color: var(--gb-muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.metric-value {
    margin: 10px 0 2px;
    font-size: 30px;
    font-weight: 800;
}

.metric-delta {
    color: var(--gb-success);
    font-size: 13px;
    font-weight: 700;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    color: #475467;
    background: #f8fafc;
    border-bottom: 1px solid var(--gb-border);
    font-size: 12px;
    text-transform: uppercase;
}

.badge-soft {
    border-radius: 999px;
    padding: 5px 9px;
    font-weight: 700;
}

.badge-soft.success {
    color: #166534;
    background: #dcfce7;
}

.badge-soft.warning {
    color: #92400e;
    background: #fef3c7;
}

.badge-soft.danger {
    color: #991b1b;
    background: #fee2e2;
}

.badge-soft.info {
    color: #075985;
    background: #e0f2fe;
}

.editable-cell {
    min-width: 120px;
}

.editable-input {
    min-width: 110px;
}

.timeline {
    display: grid;
    gap: 16px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.timeline li {
    display: grid;
    grid-template-columns: 12px 1fr;
    gap: 12px;
}

.timeline span {
    width: 10px;
    height: 10px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--gb-blue-700);
}

.timeline p {
    margin: 0;
    color: var(--gb-muted);
}

.chart-box {
    min-height: 300px;
}

.form-hint {
    color: var(--gb-muted);
    font-size: 13px;
}

.gb-sidebar-backdrop {
    display: none;
}

@media (min-width: 992px) {
    .gb-sidebar {
        transition: width 180ms ease, padding 180ms ease;
    }

    html.sidebar-collapsed .gb-sidebar,
    .gb-shell.sidebar-collapsed .gb-sidebar {
        width: 84px;
        padding-inline: 14px;
    }

    html.sidebar-collapsed .gb-main,
    .gb-shell.sidebar-collapsed .gb-main {
        margin-left: 84px;
        width: calc(100% - 84px);
    }

    html.sidebar-collapsed .gb-brand,
    .gb-shell.sidebar-collapsed .gb-brand {
        justify-content: center;
    }

    html.sidebar-collapsed .gb-brand span:last-child,
    html.sidebar-collapsed .gb-nav-link span,
    html.sidebar-collapsed .gb-sidebar-footer span:last-child,
    .gb-shell.sidebar-collapsed .gb-brand span:last-child,
    .gb-shell.sidebar-collapsed .gb-nav-link span,
    .gb-shell.sidebar-collapsed .gb-sidebar-footer span:last-child {
        display: none;
    }
    html.sidebar-collapsed .gb-nav-submenu,
    html.sidebar-collapsed .gb-nav-chevron,
    .gb-shell.sidebar-collapsed .gb-nav-submenu,
    .gb-shell.sidebar-collapsed .gb-nav-chevron {
        display: none;
    }


    html.sidebar-collapsed .gb-nav-link,
    .gb-shell.sidebar-collapsed .gb-nav-link {
        justify-content: center;
        padding-inline: 0;
    }

    html.sidebar-collapsed .gb-sidebar-footer,
    .gb-shell.sidebar-collapsed .gb-sidebar-footer {
        justify-content: center;
        padding-inline: 0;
    }

    html.sidebar-collapsed .gb-collapse-btn i,
    .gb-shell.sidebar-collapsed .gb-collapse-btn i {
        transform: scaleX(-1);
    }
}

@media (max-width: 991.98px) {
    .gb-sidebar {
        transform: translateX(-100%);
        transition: transform 180ms ease;
    }

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

    .gb-main {
        margin-left: 0;
        width: 100%;
    }

    .gb-menu-btn {
        display: inline-flex;
    }

    .gb-collapse-btn {
        display: none;
    }

    .gb-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1030;
        background: rgba(15, 23, 42, 0.48);
    }

    .gb-shell.sidebar-open .gb-sidebar-backdrop {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .gb-topbar {
        padding: 14px 16px;
    }

    .gb-content {
        padding: 18px 14px;
    }

    .gb-page-header {
        display: block;
    }

    .gb-topbar h1 {
        font-size: 19px;
    }
}

.gb-inline-approval-form {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 320px;
}

.gb-inline-approval-form .form-select {
    min-width: 190px;
}

.gb-user-group-form {
    min-width: 260px;
}

.gb-user-group-form .form-select {
    min-width: 160px;
}

.gb-users-table {
    table-layout: fixed;
    min-width: 1180px;
}

.gb-users-col-name {
    width: 17%;
}

.gb-users-col-email {
    width: 32%;
}

.gb-users-col-group {
    width: 23%;
}

.gb-users-col-status {
    width: 9%;
}

.gb-users-col-last-login {
    width: 12%;
}

.gb-users-col-actions {
    width: 7%;
}

.gb-users-table th,
.gb-users-table td {
    white-space: nowrap;
}

.gb-users-table td:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
}

.gb-users-table .gb-user-group-form {
    justify-content: flex-start;
}

.gb-pending-users-table {
    table-layout: fixed;
    min-width: 980px;
}

.gb-pending-users-table th,
.gb-pending-users-table td {
    white-space: nowrap;
}

.gb-pending-users-table th:nth-child(1),
.gb-pending-users-table td:nth-child(1) {
    width: 18%;
}

.gb-pending-users-table th:nth-child(2),
.gb-pending-users-table td:nth-child(2) {
    width: 34%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gb-pending-users-table th:nth-child(3),
.gb-pending-users-table td:nth-child(3) {
    width: 34%;
}

.gb-pending-users-table th:nth-child(4),
.gb-pending-users-table td:nth-child(4) {
    width: 14%;
}

.gb-pending-access {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gb-pending-current-groups {
    flex: 0 0 auto;
}

.gb-pending-access .gb-user-group-form {
    justify-content: flex-start;
    min-width: 230px;
}
.gb-panel-header-tools {
    align-items: center;
    justify-content: flex-start;
}

.gb-table-search {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-left: 0;
}

.gb-table-search .input {
    margin: 0;
}

.gb-table-search .form-control {
    width: 260px;
}

@media (max-width: 767.98px) {
    .gb-panel-header-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .gb-table-search {
        justify-content: flex-start;
        margin-left: 0;
    }

    .gb-table-search .form-control {
        width: min(100%, 280px);
    }
}


/* MNA import */
.gb-mna-upload .gb-panel-header h2,
.gb-panel-header h2 { margin: 0 0 4px; font-size: 18px; }
.gb-mna-upload .gb-panel-header p,
.gb-panel-header p { margin: 0; color: var(--gb-muted); }
.gb-dropzone { margin: 20px; padding: 34px; border: 2px dashed #b8c5d6; border-radius: 14px; background: #f8fafc; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; transition: 160ms ease; }
.gb-dropzone.is-dragging { border-color: var(--bs-primary); background: #eef5ff; }
.gb-dropzone > i { color: #198754; font-size: 42px; }
.gb-dropzone input[type=file] { width: min(100%, 430px); margin: 8px 0; }
.gb-dropzone small, .gb-mna-history td small { display: block; color: var(--gb-muted); }
.gb-mna-history { min-width: 1050px; }
.gb-sheet-wrap { max-height: calc(100vh - 260px); overflow: auto; }
.gb-sheet { width: max-content; min-width: 100%; margin: 0; font-size: 12px; }
.gb-sheet th, .gb-sheet td { min-width: 110px; max-width: 300px; height: 28px; padding: 4px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-sheet thead th { position: sticky; top: 0; z-index: 2; background: #edf1f5; text-align: center; }
.gb-sheet .gb-row-number { position: sticky; left: 0; z-index: 1; min-width: 48px; width: 48px; background: #edf1f5; text-align: center; }
.gb-sheet thead .gb-row-number { z-index: 3; }


/* Refined Adminto-style MNA upload */
.gb-mna-upload-card {
    overflow: hidden;
}

.gb-upload-form {
    padding: 22px;
}

.gb-mna-dropzone {
    position: relative;
    min-height: 235px;
    margin: 0;
    padding: 38px 24px;
    border: 2px dashed #ccd5e2;
    border-radius: 10px;
    background: #fbfcfe;
    color: #667085;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.gb-mna-dropzone:hover,
.gb-mna-dropzone.is-dragging {
    border-color: #3f7cf6;
    background: #f4f7ff;
}

.gb-mna-dropzone.is-dragging {
    transform: scale(1.002);
}

.gb-mna-dropzone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.gb-upload-icon {
    width: 70px;
    height: 70px;
    margin-bottom: 8px;
    border-radius: 50%;
    background: #edf3ff;
    color: #3f7cf6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gb-upload-icon i {
    font-size: 34px;
}

.gb-mna-dropzone strong {
    color: #25324b;
    font-size: 16px;
    font-weight: 600;
}

.gb-mna-dropzone > span:last-child {
    font-size: 13px;
}

.gb-selected-file {
    width: min(100%, 560px);
    min-height: 64px;
    margin: 16px auto 0;
    padding: 10px 12px;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.gb-selected-file-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #e9f8ef;
    color: #159455;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.gb-selected-file small {
    display: block;
    color: var(--gb-muted);
}

.gb-upload-actions {
    padding-top: 18px;
    text-align: center;
}

.gb-upload-actions .btn:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.gb-mna-history {
    min-width: 1020px;
    margin: 0;
}

.gb-mna-history thead th {
    padding: 11px 14px;
    color: #667085;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .035em;
    text-transform: uppercase;
    background: #f8fafc;
    border-bottom-color: #e8edf3;
}

.gb-mna-history tbody td {
    padding: 13px 14px;
    vertical-align: middle;
}

.gb-file-link {
    color: #25324b;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.gb-file-link > i {
    color: #159455;
    font-size: 24px;
}

.gb-file-link strong,
.gb-file-link small {
    display: block;
}

.gb-file-link small {
    margin-top: 2px;
    color: var(--gb-muted);
    font-size: 12px;
    font-weight: 400;
}

.gb-file-link:hover strong {
    color: #3f7cf6;
    text-decoration: underline;
}

.gb-result-link {
    width: 100%;
    max-width: 370px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #475467;
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gb-result-link span {
    margin-left: 5px;
    color: #3f7cf6;
    font-weight: 600;
}

.gb-result-link:hover span {
    text-decoration: underline;
}

.gb-result-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 20px;
}

.gb-result-details div {
    padding: 12px;
    border-radius: 8px;
    background: #f7f9fc;
}

.gb-result-details dt {
    color: var(--gb-muted);
    font-size: 12px;
    font-weight: 500;
}

.gb-result-details dd {
    margin: 3px 0 0;
    color: #25324b;
    font-size: 18px;
    font-weight: 700;
}

.gb-result-message {
    padding-top: 16px;
    border-top: 1px solid #e8edf3;
}

.gb-result-message p {
    margin: 6px 0 0;
    color: #475467;
}

@media (max-width: 575.98px) {
    .gb-upload-form {
        padding: 14px;
    }

    .gb-mna-dropzone {
        min-height: 205px;
        padding: 28px 16px;
    }
}

.gb-nav-divider {
    height: 1px;
    margin: 9px 8px;
    background: rgba(255, 255, 255, 0.14);
}

.gb-permissions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 18px; }
.gb-permission-card { overflow: hidden; }
.gb-permission-list { padding: 8px 18px 16px; }
.gb-permission-item { display: flex; gap: 12px; padding: 14px 4px; border-bottom: 1px solid #edf0f4; cursor: pointer; }
.gb-permission-item:last-child { border-bottom: 0; }
.gb-permission-item input { width: 18px; height: 18px; margin-top: 3px; accent-color: #3f7cf6; }
.gb-permission-item span, .gb-permission-item strong, .gb-permission-item small { display: block; }
.gb-permission-item strong { color: #25324b; }
.gb-permission-item small { margin: 3px 0 6px; color: var(--gb-muted); font-weight: 400; }
.gb-permission-item code { font-size: 11px; color: #667085; }


/* Application flash messages */
.gb-flash-alert {
    min-height: 54px;
    margin: 0 0 18px;
    padding: 14px 46px 14px 16px;
    border-width: 1px;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(31, 42, 68, 0.06);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.gb-flash-alert .gb-flash-icon {
    flex: 0 0 auto;
    font-size: 19px;
    line-height: 1;
}

.gb-flash-alert .btn-close {
    top: 50%;
    right: 14px;
    padding: 10px;
    transform: translateY(-50%);
}


.gb-nav-link .gb-nav-count {
    min-width: 22px;
    height: 22px;
    margin-left: auto;
    padding: 0 6px;
    border-radius: 999px;
    background: #ff5b5b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
}
