:root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
    /* Primary: corporate blue */
    --primary-color: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-light: #eff6ff;
    /* Secondary: professional green */
    --secondary-color: #15803d;
    --secondary-hover: #166534;
    --secondary-light: #f0fdf4;
    /* Navigation: dark blue */
    --sidebar-bg: #0f2742;
    --sidebar-hover: #173b5f;
    --sidebar-active: #1d4ed8;
    --success-color: #15803d;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --info-color: #0284c7;
    --dark-color: #0f2742;
    --light-color: #f8fafc;
    --surface-color: #ffffff;
    --surface-muted: #f1f5f9;
    --text-color: #1e293b;
    --text-muted: #64748b;
    /* Orange is accent/line only */
    --accent-color: #ea8a00;
    --accent-hover: #c96f00;
    --accent-light: #fff7e8;
    --border-color: #d7dee8;
    --border-light: #e7edf3;
    --shadow-sm: 0 1px 2px 0 rgb(15 39 66 / 0.06);
    --shadow-md: 0 4px 10px -2px rgb(15 39 66 / 0.10);
    --shadow-lg: 0 10px 24px -6px rgb(15 39 66 / 0.14);
}

body {
    font-family: Vazirmatn,'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 16px;
    color: var(--text-color);
    background-color: var(--surface-muted);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

#blazor-waiting-ui {
    background-color: #8c1d0c;
}

    #blazor-waiting-ui .spinner-border {
        border-width: 0px;
        width: auto;
        height: auto;
        animation: 2s linear infinite spinner-border;
    }

.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: var(--surface-color);
}

    .form-control:focus, .form-select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 0.2rem rgb(29 78 216 / 0.12);
    }

    .form-control.is-valid,
    .form-select.is-valid {
        border-color: var(--success-color);
        background-color: rgba(5, 150, 105, 0.05);
    }

    .form-control.is-invalid,
    .form-select.is-invalid {
        border-color: var(--danger-color);
        background-color: rgba(220, 38, 38, 0.05);
    }

    .form-control:focus,
    .form-select:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }

    .form-control.required-empty,
    .form-select.required-empty {
        border-color: var(--warning-color);
        background-color: rgba(217, 119, 6, 0.05);
    }

.form-floating label {
    left: auto;
    right: 0;
}

legend {
    float: none;
}

.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    height: calc(100vh - 70px);
    width: calc(100vw - var(--sidebar-width));
    overflow-x: auto;
    overflow-y: auto;
    top: 70px;
    right: var(--sidebar-width);
    position: fixed;
    scrollbar-width: none;
}

.main-content-background {
    transition: margin-right 0.3s ease;
    background-image: none;
}

.main-content.expanded {
    margin-right: var(--sidebar-collapsed-width);
}

[dir="ltr"] .main-content {
    margin-left: var(--sidebar-width);
    margin-right: 0;
    padding-top: 70px;
}

    [dir="ltr"] .main-content.expanded {
        margin-left: var(--sidebar-collapsed-width);
        margin-right: 0;
    }

.content-area {
    padding: 2rem;
    background-image: none;
    overflow-x: hidden;
    overflow-y: auto;
    height: 100%;
    min-height: 100vh;
}


.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 999;
    height: 70px;
    border-bottom: 2px solid #f59e0b;
}

.navbar-start {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-end {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle-btn {
    background: none;
    border: none;
    color: #374151;
    font-size: 1.3rem;
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

    .toggle-btn:hover {
        background: #f3f4f6;
        color: #374151;
    }

.logo {
    width: 45px;
    height: 45px;
    /*background: var(--primary-color);*/
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.3rem;
}

.company-name {
    color: #374151;
    font-weight: 600;
    font-size: 1.2rem;
    white-space: nowrap;
}

.desktop-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d4ed8 0%, #15803d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d4ed8 0%, #15803d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-name {
    font-weight: 600;
    color: #374151;
}

.user-role {
    font-size: 0.875rem;
    color: #6b7280;
}

.sidebar {
    position: fixed;
    top: 70px;
    right: 0;
    height: calc(100vh - 70px);
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow-x: hidden;
    overflow-y: auto;
}

    .sidebar.collapsed {
        width: var(--sidebar-collapsed-width);
    }

        .sidebar.collapsed .nav-item:hover .tooltip-custom {
            opacity: 1;
            visibility: visible;
        }

.sidebar-content {
    padding: 1rem 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: #cbd5e1;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    background: none;
    width: 100%;
    font-size: 0.95rem;
    cursor: pointer;
}

    .nav-link:hover {
        background: var(--sidebar-hover);
        color: white;
        text-decoration: none;
    }

    .nav-link.active {
        background: var(--primary-color);
        color: white;
        border-right: 4px solid #f59e0b;
    }

.nav-text {
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
}

.tooltip-custom {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #102d4a;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-right: 15px;
    z-index: 1001;
}

    .tooltip-custom::after {
        content: '';
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        border: 6px solid transparent;
        border-right-color: #1f2937;
    }

.sidebar.collapsed .nav-item:hover .tooltip-custom {
    opacity: 1;
    visibility: visible;
}

.submenu {
    background: #0b2036;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0;
}

    .submenu.show {
        max-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .submenu .nav-link {
        padding-right: 3rem;
        font-size: 0.875rem;
    }

.sidebar.collapsed .nav-item:hover .tooltip-custom {
    opacity: 1;
    visibility: visible;
}

.btn:focus-visible,
.nav-link:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.ellipsis {
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: default;
}

    .ellipsis:hover {
        background: transparent;
        color: #6c757d;
        transform: none;
        box-shadow: none;
        padding: 0;
    }

.login {
    max-width: 100%;
    margin: 0 30%;
}

.form-check-label {
    padding: 0px 35px !important;
}

/* Orange accent lines */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--accent-color);
}

hr {
    border: 0;
    border-top: 2px solid #f59e0b;
    opacity: 1;
}

@media (max-width: 768px) {
    .login {
        margin: 0;
    }

    .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
        width: 100%;
    }

        .main-content.expanded {
            margin-right: 0 !important;
            margin-left: 0 !important;
            width: 100%;
        }

    [dir="ltr"] .main-content,
    [dir="rtl"] .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
        width: 100%;
    }

    .top-navbar {
        padding: 1rem;
    }

    .desktop-controls {
        display: none;
    }

    .sidebar {
        width: 100%;
        transform: translateX(100%);
        top: 70px;
        height: calc(100vh - 70px);
    }

        .sidebar.show {
            transform: translateX(0);
        }

        .sidebar.collapsed {
            width: 100%;
            transform: translateX(100%);
        }

            .sidebar.collapsed.show {
                transform: translateX(0);
            }
}

.table-responsive {
    overflow-x: overlay !important;
}


/* =========================================================
   Enterprise UI refinements - Bootstrap 5.3.8
   Blue/Green primary palette with restrained orange accents
   ========================================================= */

.btn-primary {
    --bs-btn-bg: var(--primary-color);
    --bs-btn-border-color: var(--primary-color);
    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: var(--primary-hover);
    --bs-btn-active-border-color: var(--primary-hover);
}

.btn-success {
    --bs-btn-bg: var(--secondary-color);
    --bs-btn-border-color: var(--secondary-color);
    --bs-btn-hover-bg: var(--secondary-hover);
    --bs-btn-hover-border-color: var(--secondary-hover);
    --bs-btn-active-bg: var(--secondary-hover);
    --bs-btn-active-border-color: var(--secondary-hover);
}

.btn-warning {
    --bs-btn-bg: var(--accent-color);
    --bs-btn-border-color: var(--accent-color);
    --bs-btn-hover-bg: var(--accent-hover);
    --bs-btn-hover-border-color: var(--accent-hover);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgb(29 78 216 / 0.12);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.card {
    border: 1px solid var(--border-light);
    border-radius: 0.625rem;
    box-shadow: var(--shadow-sm);
    background-color: var(--surface-color);
}

.card-header {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-light);
    color: var(--dark-color);
    font-weight: 600;
}

.table {
    --bs-table-border-color: var(--border-light);
    color: var(--text-color);
}

    .table thead th {
        background-color: var(--surface-muted);
        color: var(--dark-color);
        font-weight: 600;
        border-bottom: 2px solid var(--accent-color);
    }

.table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: var(--primary-light);
}

.badge.bg-primary {
    background-color: var(--primary-color) !important;
}

.badge.bg-success {
    background-color: var(--secondary-color) !important;
}

a {
    color: var(--primary-color);
}

    a:hover {
        color: var(--primary-hover);
    }

hr {
    border: 0;
    border-top: 1px solid var(--accent-color);
    opacity: 0.75;
}

.btn {
    border-radius: 0.5rem;
}

.alert {
    border-radius: 0.5rem;
}

.modal-content,
.dropdown-menu {
    border: 1px solid var(--border-light);
    border-radius: 0.625rem;
    box-shadow: var(--shadow-lg);
}

::selection {
    background: var(--primary-color);
    color: #ffffff;
}


/* =========================================================
   FINAL ENTERPRISE / MINIMAL UI LAYER
   Intended for Bootstrap 5.3.8
   Blue = primary | Green = positive | Orange = fine accent
   ========================================================= */

/* ---------- Application surfaces ---------- */

html,
body {
    background: #f5f8fb;
}

.page {
    background: #f5f8fb;
}

.main-content,
.content-area {
    background: #f5f8fb;
    background-image: none;
}

.content-area {
    padding: 1.25rem 1.5rem;
}

/* ---------- Top bar ---------- */

.top-navbar {
    height: 64px;
    padding: 0 1.25rem;
    background: #ffffff;
    border-bottom: 1px solid #dbe4ee;
    box-shadow: 0 1px 5px rgb(15 39 66 / 0.06);
}

.company-name {
    color: #26384d;
    font-size: 1.05rem;
    font-weight: 600;
}

.toggle-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 0.375rem;
    color: #506176;
}

    .toggle-btn:hover {
        background: #eef4f9;
        color: var(--primary-color);
    }

.logo {
    width: 40px;
    height: 40px;
    border-radius: 0.375rem;
}

/* ---------- Sidebar ---------- */

.sidebar {
    background: #102b46;
    border-left: 1px solid #214663;
    box-shadow: -2px 0 8px rgb(15 39 66 / 0.04);
}

.sidebar-content {
    padding: 0.75rem 0;
}

.nav-link {
    min-height: 42px;
    padding: 0.625rem 1rem;
    margin: 2px 0.5rem;
    width: calc(100% - 1rem);
    border-radius: 0.375rem;
    color: #c9d7e5;
    font-size: 0.9rem;
    gap: 0.75rem;
}

    .nav-link:hover {
        background: #173d5e;
        color: #ffffff;
    }

    .nav-link.active {
        background: #2459d8;
        color: #ffffff;
        border-right: 3px solid var(--accent-color);
        box-shadow: none;
    }

.submenu {
    background: #0c2339;
}

    .submenu .nav-link {
        margin-right: 0.75rem;
        margin-left: 0.75rem;
        width: calc(100% - 1.5rem);
        padding-right: 2.25rem;
        min-height: 38px;
        font-size: 0.85rem;
    }

/* ---------- Page heading / fieldset ---------- */

legend {
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 700;
    padding: 0 0.5rem;
}

fieldset {
    border: 1px solid #dbe4ee;
    border-radius: 0.625rem;
    background: #ffffff;
    padding: 1rem 1.25rem;
}

/* ---------- Tables ---------- */

.table-responsive {
    overflow-x: auto !important;
    border: 1px solid #e2e9f0;
    border-radius: 0.375rem;
    background: #ffffff;
}

.table {
    margin-bottom: 0;
    --bs-table-bg: #ffffff;
    --bs-table-striped-bg: #f8fafc;
    --bs-table-hover-bg: #f3f7fc;
    --bs-table-border-color: #e6edf3;
    font-size: 0.9rem;
}

    .table > :not(caption) > * > * {
        padding: 0.625rem 0.75rem;
        vertical-align: middle;
    }

    .table thead th {
        background: #edf4f9;
        color: #173b5b;
        font-weight: 600;
        white-space: nowrap;
        border-top: 0;
        border-bottom: 2px solid var(--accent-color);
    }

    .table tbody tr {
        height: 48px;
    }

        .table tbody tr:hover {
            background: #f3f7fc;
        }

    .table tbody td {
        color: #27384a;
    }

    /* Keep the orange line only where it communicates structure. */
    .table thead th::after {
        content: none;
    }

    /* ---------- Buttons in data grids ---------- */

    .table .btn {
        min-width: 58px;
        min-height: 34px;
        padding: 0.25rem 0.65rem;
        border-width: 1px;
        border-radius: 0.375rem;
        font-size: 0.82rem;
        font-weight: 500;
        line-height: 1.4;
        box-shadow: none;
        white-space: nowrap;
    }

    .table .btn-outline-primary {
        --bs-btn-color: var(--primary-color);
        --bs-btn-border-color: #8fb2ed;
        --bs-btn-hover-color: #ffffff;
        --bs-btn-hover-bg: var(--primary-color);
        --bs-btn-hover-border-color: var(--primary-color);
    }

    .table .btn-outline-success {
        --bs-btn-color: var(--secondary-color);
        --bs-btn-border-color: #82b99a;
        --bs-btn-hover-color: #ffffff;
        --bs-btn-hover-bg: var(--secondary-color);
        --bs-btn-hover-border-color: var(--secondary-color);
    }

    .table .btn-outline-danger {
        --bs-btn-color: #c62828;
        --bs-btn-border-color: #e5a0a0;
        --bs-btn-hover-color: #ffffff;
        --bs-btn-hover-bg: #dc2626;
        --bs-btn-hover-border-color: #dc2626;
    }

/* ---------- General Bootstrap buttons ---------- */

.btn {
    border-radius: 0.4rem;
    font-weight: 500;
    box-shadow: none;
}

    .btn:active,
    .btn:focus {
        box-shadow: none;
    }

/* ---------- Form controls ---------- */

.form-control,
.form-select {
    min-height: 38px;
    padding: 0.45rem 0.75rem;
    border: 1px solid #cfd9e4;
    border-radius: 0.4rem;
    color: #243447;
    background: #ffffff;
}

    .form-control:hover,
    .form-select:hover {
        border-color: #aebdcd;
    }

    .form-control:focus,
    .form-select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 0.15rem rgb(29 78 216 / 0.10);
    }

/* ---------- Pagination ---------- */

.pagination {
    gap: 0.25rem;
}

    .pagination .page-link {
        min-width: 34px;
        height: 34px;
        padding: 0.35rem 0.6rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #d4dee8;
        border-radius: 0.375rem !important;
        color: var(--primary-color);
        background: #ffffff;
    }

        .pagination .page-link:hover {
            background: #eff6ff;
            border-color: #9db9e8;
        }

    .pagination .active .page-link {
        color: #ffffff;
        background: var(--primary-color);
        border-color: var(--primary-color);
    }

/* ---------- Cards / dropdowns / modal ---------- */

.card,
.modal-content,
.dropdown-menu {
    border-color: #dbe4ee;
}

.card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #dbe4ee;
}

.dropdown-item {
    border-radius: 0.3rem;
}

    .dropdown-item:hover,
    .dropdown-item:focus {
        background: #eff6ff;
        color: var(--primary-color);
    }

/* ---------- Status colors ---------- */

.text-success {
    color: var(--secondary-color) !important;
}

.bg-success {
    background-color: var(--secondary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

/* ---------- Mobile ---------- */

@media (max-width: 768px) {
    .content-area {
        padding: 1rem;
    }

    .top-navbar {
        height: 64px;
        padding: 0 0.75rem;
    }

    fieldset {
        padding: 0.75rem;
    }

    .table > :not(caption) > * > * {
        padding: 0.5rem 0.625rem;
    }
}


/* =========================================================
   SPRADIN - PRECISE ENTERPRISE UI
   Bootstrap 5.3.8
   Target: actual rendered RTL management page
   ========================================================= */

/* ---------- Design tokens ---------- */

:root {
    --sp-primary: #2457c6;
    --sp-primary-hover: #1d47a8;
    --sp-primary-soft: #edf3ff;
    --sp-green: #198754;
    --sp-green-hover: #157347;
    --sp-green-soft: #eef9f3;
    --sp-orange: #e58a00;
    --sp-orange-soft: #fff6e6;
    --sp-navy: #102b46;
    --sp-navy-2: #153957;
    --sp-navy-3: #0d243b;
    --sp-text: #26384b;
    --sp-muted: #6b7a8c;
    --sp-page: #f5f7fa;
    --sp-surface: #ffffff;
    --sp-border: #dfe6ee;
    --sp-border-strong: #cbd6e2;
    --sp-radius: 7px;
}

/* ---------- Base ---------- */

html,
body {
    background: var(--sp-page) !important;
    color: var(--sp-text);
}

body {
    font-family: "Vazirmatn", "Tahoma", Arial, sans-serif;
    font-size: 14px;
}

.page {
    min-height: 100vh;
    background: var(--sp-page);
}

    /* =========================================================
   TOP NAVBAR
   Actual markup has Bootstrap border-bottom border-4 and
   inline border-color:#dc3545. Override both.
   ========================================================= */

    .page > .top-navbar,
    header.top-navbar {
        position: fixed;
        z-index: 1100;
        top: 0;
        left: 0;
        right: 0;
        height: 64px;
        min-height: 64px;
        padding: 0 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #ffffff !important;
        /* Override inline red + Bootstrap border-bottom-4 */
        border-top: 0 !important;
        border-right: 0 !important;
        border-left: 0 !important;
        border-bottom: 2px solid var(--sp-orange) !important;
        box-shadow: 0 1px 5px rgb(16 43 70 / 0.08);
    }

/* Left / right navbar groups */
.top-navbar .navbar-start,
.top-navbar .navbar-end {
    height: 100%;
    display: flex;
    align-items: center;
}

.top-navbar .navbar-start {
    min-width: 0;
}

.top-navbar .navbar-end {
    gap: 12px;
}

/* Toggle */
.top-navbar .toggle-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4d6074;
    background: transparent;
    border: 0;
    border-radius: 6px;
    font-size: 20px;
}

    .top-navbar .toggle-btn:hover {
        color: var(--sp-primary);
        background: #f1f5f9;
    }

/* Organization logo */
.top-navbar .logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 4px;
    background: transparent;
}

/* Company name */
.top-navbar .company-name {
    color: #344256;
    font-size: 16px;
    font-weight: 650;
    line-height: 1.2;
}

/* User */
.top-navbar .user-profile {
    display: flex;
    align-items: center;
    min-height: 44px;
}

.top-navbar .user-name {
    color: #334155;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}

.top-navbar .user-role {
    color: #7b8796 !important;
    font-size: 12px;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.page > .sidebar,
nav.sidebar {
    position: fixed;
    z-index: 1050;
    top: 64px;
    right: 0;
    bottom: 0;
    width: var(--sidebar-width);
    height: calc(100vh - 64px);
    background: var(--sp-navy) !important;
    border-left: 1px solid #254865 !important;
    box-shadow: -2px 0 8px rgb(16 43 70 / 0.08);
}

.sidebar-content {
    padding: 12px 8px !important;
    overflow-x: hidden;
}

.sidebar .nav {
    gap: 2px;
}

/* Main menu items */
.sidebar .nav-link {
    position: relative;
    width: 100%;
    min-height: 42px;
    margin: 0 !important;
    padding: 9px 12px !important;
    display: flex;
    align-items: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #c8d5e2;
    font-size: 13px;
    font-weight: 500;
    transition: background-color .15s ease, color .15s ease;
}

    .sidebar .nav-link:hover {
        background: var(--sp-navy-2);
        color: #ffffff;
    }

    .sidebar .nav-link.active {
        background: var(--sp-primary) !important;
        color: #ffffff !important;
        border-right: 3px solid var(--sp-orange);
        box-shadow: none;
    }

    .sidebar .nav-link .nav-text {
        white-space: nowrap;
    }

    /* Bootstrap icons / generated icon area */
    .sidebar .nav-link > i:first-child,
    .sidebar .nav-link .icon-bg {
        width: 22px;
        min-width: 22px;
        height: 22px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

/* Menu arrow */
.sidebar .submenu-arrow {
    margin-right: auto !important;
    color: #91a5b9;
    font-size: 12px;
}

.sidebar .nav-link:hover .submenu-arrow,
.sidebar .nav-link.active .submenu-arrow {
    color: #ffffff;
}

/* Submenu */
.sidebar .submenu {
    margin: 2px 0 4px;
    padding: 2px 0 2px 0;
    background: var(--sp-navy-3);
    border-radius: 5px;
}

    .sidebar .submenu .nav-link {
        min-height: 36px;
        padding: 7px 12px 7px 10px !important;
        color: #b7c7d7;
        font-size: 12.5px;
    }

        .sidebar .submenu .nav-link:hover {
            background: #173b5a;
            color: #ffffff;
        }

        .sidebar .submenu .nav-link.active {
            background: #1e4fb6 !important;
            border-right: 2px solid var(--sp-orange);
        }

/* =========================================================
   MAIN CONTENT
   ========================================================= */

.page > .main-content,
main.main-content {
    position: fixed;
    top: 64px;
    right: var(--sidebar-width);
    left: 0;
    bottom: 0;
    width: auto;
    height: calc(100vh - 64px);
    overflow-x: auto !important;
    overflow-y: auto !important;
    padding: 18px 22px !important;
    background: var(--sp-page) !important;
}

/* =========================================================
   PAGE / FORM CONTAINER
   ========================================================= */

.main-content > * {
    max-width: 100%;
}

.main-content fieldset {
    min-width: 0;
    margin: 0;
    padding: 14px 16px !important;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgb(16 43 70 / 0.04);
}

    /* Nested fieldsets should not look like additional floating cards */
    .main-content fieldset fieldset {
        padding: 10px 12px !important;
        border-color: #e6ebf1;
        box-shadow: none;
    }

/* Page title */
.main-content legend {
    width: auto;
    float: none;
    margin: 0 0 8px !important;
    padding: 0 7px;
    color: var(--sp-primary);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.5;
}

/* =========================================================
   TABLE - MATCH THE SCREENSHOT MORE CLOSELY
   ========================================================= */

.main-content .table-responsive {
    width: 100%;
    margin-top: 6px;
    overflow-x: auto !important;
    background: #ffffff;
    border: 1px solid var(--sp-border);
    border-radius: 5px;
    box-shadow: none;
}

.main-content .table {
    width: 100%;
    margin: 0;
    color: #26384b;
    background: #ffffff;
    --bs-table-bg: #ffffff;
    --bs-table-striped-bg: #fbfcfd;
    --bs-table-hover-bg: #f5f8fc;
    --bs-table-border-color: #e5ebf1;
    font-size: 13px;
}

    .main-content .table thead {
        background: #eef3f8;
    }

        .main-content .table thead th {
            height: 48px;
            padding: 7px 9px !important;
            background: #eef3f8 !important;
            color: #183b5b !important;
            border-top: 0 !important;
            border-bottom: 2px solid var(--sp-orange) !important;
            font-size: 12.5px;
            font-weight: 650;
            line-height: 1.35;
            white-space: nowrap;
            vertical-align: middle;
        }

    .main-content .table tbody td {
        height: 49px;
        padding: 7px 9px !important;
        color: #293b4d;
        border-bottom: 1px solid #e7edf3;
        vertical-align: middle;
        white-space: nowrap;
    }

    .main-content .table tbody tr:last-child td {
        border-bottom: 0;
    }

    .main-content .table tbody tr:hover > * {
        background: #f5f8fc !important;
    }

/* Don't let Bootstrap's striped table become visually heavy */
.main-content .table-striped > tbody > tr:nth-of-type(odd) > * {
    background: #ffffff;
}

/* =========================================================
   ACTION BUTTONS
   ========================================================= */

.main-content .table .btn {
    min-width: 54px;
    min-height: 34px;
    margin: 0 2px;
    padding: 5px 9px !important;
    border-width: 1px !important;
    border-radius: 6px !important;
    background: #ffffff;
    font-size: 12px;
    font-weight: 500;
    box-shadow: none !important;
    white-space: nowrap;
}

.main-content .table .btn-outline-primary {
    color: var(--sp-primary);
    border-color: #8eafe8;
}

    .main-content .table .btn-outline-primary:hover {
        color: #ffffff;
        background: var(--sp-primary);
        border-color: var(--sp-primary);
    }

.main-content .table .btn-outline-success {
    color: var(--sp-green);
    border-color: #8ac6a6;
}

    .main-content .table .btn-outline-success:hover {
        color: #ffffff;
        background: var(--sp-green);
        border-color: var(--sp-green);
    }

.main-content .table .btn-outline-danger {
    color: #c73c3c;
    border-color: #e5a3a3;
}

    .main-content .table .btn-outline-danger:hover {
        color: #ffffff;
        background: #dc3545;
        border-color: #dc3545;
    }

/* =========================================================
   FORM CONTROLS
   ========================================================= */

.main-content .form-control,
.main-content .form-select {
    min-height: 38px;
    padding: 6px 10px;
    color: #26384b;
    background: #ffffff;
    border: 1px solid #cfd9e4;
    border-radius: 6px;
    font-size: 13px;
    box-shadow: none;
}

    .main-content .form-control:hover,
    .main-content .form-select:hover {
        border-color: #b7c5d4;
    }

    .main-content .form-control:focus,
    .main-content .form-select:focus {
        border-color: var(--sp-primary);
        box-shadow: 0 0 0 3px rgb(36 87 198 / 0.09);
    }

.main-content .form-floating > label {
    color: #667789;
    font-size: 13px;
}

/* =========================================================
   PAGINATION / FOOTER
   ========================================================= */

.main-content .pagination {
    margin: 12px 0 0;
    gap: 3px;
}

    .main-content .pagination .page-link,
    .main-content .pagination > li.btn {
        min-width: 34px;
        height: 34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 4px 8px;
        border: 1px solid #d2dce7 !important;
        border-radius: 6px !important;
        color: var(--sp-primary);
        background: #ffffff;
        font-size: 12px;
        box-shadow: none !important;
    }

    .main-content .pagination > li.active,
    .main-content .pagination > li.active .page-link {
        color: #ffffff !important;
        background: var(--sp-primary) !important;
        border-color: var(--sp-primary) !important;
    }

    .main-content .pagination > li:hover:not(.disabled) {
        background: var(--sp-primary-soft);
        border-color: #9fb9e7 !important;
    }

/* Record information */
.main-content #pageInfo,
.main-content #totalRecords {
    color: var(--sp-muted) !important;
    font-size: 12px;
}

.main-content #limit {
    width: 82px;
    min-height: 34px;
    padding-top: 4px;
    padding-bottom: 4px;
}

/* =========================================================
   STATUS / SMALL DETAILS
   ========================================================= */

.text-muted {
    color: var(--sp-muted) !important;
}

.text-primary {
    color: var(--sp-primary) !important;
}

.text-success {
    color: var(--sp-green) !important;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {
    .page > .top-navbar,
    header.top-navbar {
        height: 60px;
        min-height: 60px;
        padding: 0 10px;
    }

    .page > .sidebar,
    nav.sidebar {
        top: 60px;
        height: calc(100vh - 60px);
        width: 100%;
    }

    .page > .main-content,
    main.main-content {
        top: 60px;
        right: 0;
        height: calc(100vh - 60px);
        padding: 12px !important;
    }

    .main-content fieldset {
        padding: 10px !important;
    }

    .main-content .table {
        font-size: 12px;
    }

        .main-content .table thead th,
        .main-content .table tbody td {
            padding: 6px 7px !important;
        }
}


/* =========================================================
   SPRADIN SIGNATURE UI — MODERN / MINIMAL / ENTERPRISE
   Bootstrap 5.3.8 | RTL-aware
   ========================================================= */

:root {
    --sp-ink: #142b45;
    --sp-blue: #2859c5;
    --sp-blue-hover: #1f49a8;
    --sp-blue-wash: #edf3ff;
    --sp-green: #21845a;
    --sp-green-hover: #176b47;
    --sp-amber: #e99a22;
    --sp-canvas: #f4f7fb;
    --sp-paper: #fff;
    --sp-line: #e4eaf1;
    --sp-line-strong: #d3dde8;
    --sp-text: #25384d;
    --sp-muted: #718096;
    --sp-radius: 7px;
    --sp-shadow: 0 2px 8px rgb(20 43 69 / 0.04);
}

/* Canvas and typography */
html, body, .page {
    background: var(--sp-canvas) !important;
    color: var(--sp-text);
}

body {
    font-family: "Vazirmatn", "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 13.5px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    color: var(--sp-ink);
    background: #dce8ff;
}

/* Header — white surface with a short signature orange line */
.page > .top-navbar,
header.top-navbar {
    height: 62px;
    min-height: 62px;
    padding-inline: 22px;
    background: #fff !important;
    border: 0 !important;
    border-bottom: 1px solid var(--sp-line) !important;
    box-shadow: 0 2px 8px rgb(20 43 69 / 0.045);
}

    .page > .top-navbar::after,
    header.top-navbar::after {
        content: "";
        position: absolute;
        inset-inline-start: 0;
        bottom: -1px;
        width: 76px;
        height: 2px;
        background: var(--sp-amber);
    }

.top-navbar .company-name {
    color: var(--sp-ink);
    font-size: 15px;
    font-weight: 700;
}

.top-navbar .user-name {
    color: #34465b;
    font-size: 14px;
    font-weight: 650;
}

.top-navbar .user-role {
    color: var(--sp-muted) !important;
    font-size: 11.5px;
}

.top-navbar .logo {
    width: 38px;
    height: 38px;
    border-radius: 5px;
}

.top-navbar .toggle-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 5px;
    color: #607187;
}

    .top-navbar .toggle-btn:hover {
        color: var(--sp-blue);
        background: var(--sp-blue-wash);
    }

/* Sidebar — deep ink blue, subdued states */
.page > .sidebar,
nav.sidebar {
    top: 62px;
    height: calc(100vh - 62px);
    background: var(--sp-ink) !important;
    border-left: 1px solid #24425f !important;
    box-shadow: -3px 0 12px rgb(20 43 69 / 0.055);
}

.sidebar-content {
    padding: 14px 9px !important;
}

.sidebar .nav {
    gap: 3px;
}

.sidebar .nav-link {
    min-height: 40px;
    margin: 0 !important;
    padding: 8px 12px !important;
    border: 0;
    border-radius: 6px;
    color: #bdccdc;
    font-size: 12.5px;
    font-weight: 500;
    transition: background-color .15s ease, color .15s ease;
}

    .sidebar .nav-link:hover {
        color: #fff;
        background: #1b3b5a;
    }

    .sidebar .nav-link.active {
        color: #fff !important;
        background: var(--sp-blue) !important;
        border-right: 3px solid var(--sp-amber);
        box-shadow: none;
    }

.sidebar .submenu {
    margin-block: 4px 6px;
    padding-block: 4px;
    background: #10243a;
    border-radius: 6px;
}

    .sidebar .submenu .nav-link {
        min-height: 35px;
        color: #aebfd1;
        font-size: 12px;
    }

        .sidebar .submenu .nav-link:hover {
            color: #fff;
            background: #1a3a57;
        }

        .sidebar .submenu .nav-link.active {
            background: #1d4b9f !important;
            border-right: 2px solid var(--sp-amber);
        }

/* Main workspace and page container */
.page > .main-content,
main.main-content {
    top: 62px;
    right: var(--sidebar-width);
    height: calc(100vh - 62px);
    padding: 20px 24px !important;
    background: var(--sp-canvas) !important;
}

.main-content fieldset {
    margin: 0;
    padding: 15px 17px !important;
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
    background: var(--sp-paper);
    box-shadow: var(--sp-shadow);
}

    .main-content fieldset fieldset {
        border-color: #e9eef4;
        border-radius: 5px;
        box-shadow: none;
    }

.main-content legend {
    width: auto;
    float: none;
    margin-bottom: 9px !important;
    padding-inline: 7px;
    color: var(--sp-blue);
    font-size: 16px;
    font-weight: 750;
    letter-spacing: -.2px;
}

/* Table — clear hierarchy, fine dividers, compact density */
.main-content .table-responsive {
    border: 1px solid var(--sp-line);
    border-radius: 7px;
    background: #fff;
    box-shadow: none;
}

.main-content .table {
    margin: 0;
    color: var(--sp-text);
    font-size: 12.5px;
    --bs-table-bg: #fff;
    --bs-table-color: var(--sp-text);
    --bs-table-border-color: #e9eef4;
    --bs-table-hover-bg: #f5f8fd;
}

    .main-content .table thead th {
        height: 44px;
        padding: 8px 10px !important;
        color: #3a526b !important;
        background: #f2f6fa !important;
        border-bottom: 2px solid var(--sp-amber) !important;
        font-size: 12px;
        font-weight: 700;
        white-space: nowrap;
    }

    .main-content .table tbody td {
        height: 45px;
        padding: 6px 10px !important;
        color: #304256;
        border-bottom: 1px solid #edf1f5;
        transition: background-color .12s ease;
    }

    .main-content .table tbody tr:last-child td {
        border-bottom: 0;
    }

    .main-content .table tbody tr:hover > * {
        background: #f5f8fd !important;
    }

.main-content .table-striped > tbody > tr:nth-of-type(odd) > * {
    background: #fff;
}

/* Action buttons — restrained outlines, consistent size */
.main-content .table .btn {
    min-width: 0;
    min-height: 30px;
    margin-inline: 2px;
    padding: 4px 9px !important;
    border-width: 1px !important;
    border-radius: 5px !important;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.35;
    box-shadow: none !important;
    white-space: nowrap;
}

.main-content .table .btn-outline-primary {
    color: var(--sp-blue);
    border-color: #b6c9ed;
    background: #fff;
}

    .main-content .table .btn-outline-primary:hover {
        color: #fff;
        background: var(--sp-blue);
        border-color: var(--sp-blue);
    }

.main-content .table .btn-outline-success {
    color: var(--sp-green);
    border-color: #b3d8c4;
    background: #fff;
}

    .main-content .table .btn-outline-success:hover {
        color: #fff;
        background: var(--sp-green);
        border-color: var(--sp-green);
    }

.main-content .table .btn-outline-danger {
    color: #c34848;
    border-color: #e8c0c0;
    background: #fff;
}

    .main-content .table .btn-outline-danger:hover {
        color: #fff;
        background: #c83e3e;
        border-color: #c83e3e;
    }

/* Inputs and selects */
.main-content .form-control,
.main-content .form-select {
    min-height: 37px;
    border: 1px solid var(--sp-line-strong);
    border-radius: 6px;
    color: var(--sp-text);
    background: #fff;
    font-size: 13px;
    box-shadow: none;
}

    .main-content .form-control:focus,
    .main-content .form-select:focus {
        border-color: #83a5e7;
        box-shadow: 0 0 0 3px rgb(40 89 197 / .085);
    }

.main-content .form-floating > label {
    color: #748398;
    font-size: 12.5px;
}

/* Pagination */
.main-content .pagination {
    gap: 4px;
    margin-top: 13px;
}

    .main-content .pagination .page-link,
    .main-content .pagination > li.btn {
        min-width: 32px;
        height: 32px;
        padding: 3px 8px;
        border: 1px solid #dce4ed !important;
        border-radius: 5px !important;
        color: #49617c;
        background: #fff;
        font-size: 11.5px;
        box-shadow: none !important;
    }

        .main-content .pagination .page-link:hover,
        .main-content .pagination > li:hover:not(.disabled) {
            color: var(--sp-blue);
            background: var(--sp-blue-wash);
            border-color: #c4d4f1 !important;
        }

    .main-content .pagination .active .page-link,
    .main-content .pagination > li.active {
        color: #fff !important;
        background: var(--sp-blue) !important;
        border-color: var(--sp-blue) !important;
    }

.main-content #pageInfo,
.main-content #totalRecords {
    color: var(--sp-muted) !important;
    font-size: 11.5px;
}

/* Bootstrap 5.3.8 theme alignment */
.btn-primary {
    --bs-btn-bg: var(--sp-blue);
    --bs-btn-border-color: var(--sp-blue);
    --bs-btn-hover-bg: var(--sp-blue-hover);
    --bs-btn-hover-border-color: var(--sp-blue-hover);
}

.btn-success {
    --bs-btn-bg: var(--sp-green);
    --bs-btn-border-color: var(--sp-green);
    --bs-btn-hover-bg: var(--sp-green-hover);
    --bs-btn-hover-border-color: var(--sp-green-hover);
}

.btn-warning {
    --bs-btn-bg: var(--sp-amber);
    --bs-btn-border-color: var(--sp-amber);
    --bs-btn-hover-bg: #d78612;
    --bs-btn-hover-border-color: #d78612;
}

.card, .modal-content, .dropdown-menu {
    border-color: var(--sp-line);
    border-radius: var(--sp-radius);
}

.card-header {
    color: var(--sp-ink);
    background: #fff;
    border-bottom: 1px solid var(--sp-line);
    font-weight: 700;
}

.dropdown-item:hover, .dropdown-item:focus {
    color: var(--sp-blue);
    background: var(--sp-blue-wash);
}

.form-check-input:checked {
    background-color: var(--sp-green);
    border-color: var(--sp-green);
}

/* Mobile */
@media (max-width: 768px) {
    .page > .top-navbar, header.top-navbar {
        height: 58px;
        min-height: 58px;
        padding-inline: 10px;
    }

    .page > .sidebar, nav.sidebar {
        top: 58px;
        height: calc(100vh - 58px);
    }

    .page > .main-content, main.main-content {
        top: 58px;
        right: 0;
        height: calc(100vh - 58px);
        padding: 11px !important;
    }

    .main-content fieldset {
        padding: 10px !important;
    }

    .main-content .table thead th,
    .main-content .table tbody td {
        padding: 6px 8px !important;
    }
}

/* Accessibility: avoid motion for users who request reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}


/* =========================================================
   SPRADIN UI V2
   - #blazor-waiting-ui: white
   - browser/page scrollbars: disabled
   - only table DATA body scrolls vertically
   - table header stays fixed
   - sort indicator and header text stay on one line
   ========================================================= */

/* Blazor waiting UI */
#blazor-waiting-ui {
    background: #fff !important;
    background-color: #fff !important;
}

    #blazor-waiting-ui,
    #blazor-waiting-ui * {
        box-sizing: border-box;
    }

/* No document / main browser scrolling */
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden !important;
}

.page {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden !important;
}

    .page > .main-content,
    main.main-content {
        overflow: hidden !important;
    }

    /* Sidebar is an independent scroll surface if its menu is long */
    .page > .sidebar,
    nav.sidebar {
        overflow: hidden;
    }

.sidebar-content {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

/* Table wrapper itself must not create a second scrollbar */
.main-content .table-responsive {
    overflow: hidden !important;
    max-width: 100%;
    max-height: none;
    scrollbar-width: none;
}

    .main-content .table-responsive::-webkit-scrollbar {
        display: none;
    }

    /* Keep header/data columns aligned */
    .main-content .table-responsive > .table {
        width: 100%;
        min-width: 100%;
        margin-bottom: 0;
        table-layout: fixed;
        border-collapse: separate;
        border-spacing: 0;
    }

        /* Header is outside the scrolling region */
        .main-content .table-responsive > .table > thead {
            display: table;
            width: 100%;
            table-layout: fixed;
        }

        /* ONLY tbody scrolls */
        .main-content .table-responsive > .table > tbody {
            display: block;
            width: 100%;
            max-height: calc(100vh - 245px);
            overflow-y: auto;
            overflow-x: hidden;
            scrollbar-width: thin;
            scrollbar-color: #c6d1de transparent;
        }

            .main-content .table-responsive > .table > tbody::-webkit-scrollbar {
                width: 7px;
            }

            .main-content .table-responsive > .table > tbody::-webkit-scrollbar-track {
                background: transparent;
            }

            .main-content .table-responsive > .table > tbody::-webkit-scrollbar-thumb {
                background: #c6d1de;
                border-radius: 8px;
            }

                .main-content .table-responsive > .table > tbody::-webkit-scrollbar-thumb:hover {
                    background: #aebdcd;
                }

            /* Rows retain table geometry */
            .main-content .table-responsive > .table > tbody > tr {
                display: table;
                width: 100%;
                table-layout: fixed;
            }

        /* Header text + sorting indicator: always one line */
        .main-content .table-responsive > .table > thead > tr > th {
            height: 46px;
            white-space: nowrap !important;
            word-break: keep-all !important;
            overflow: hidden;
            vertical-align: middle !important;
            line-height: 1.25 !important;
        }

        /* Common sort controls/icons */
        .main-content .table-responsive > .table > thead th .sort-icon,
        .main-content .table-responsive > .table > thead th .sort,
        .main-content .table-responsive > .table > thead th .sorting,
        .main-content .table-responsive > .table > thead th i,
        .main-content .table-responsive > .table > thead th svg,
        .main-content .table-responsive > .table > thead th button,
        .main-content .table-responsive > .table > thead th span {
            display: inline-flex !important;
            align-items: center;
            justify-content: center;
            vertical-align: middle;
            white-space: nowrap;
        }

        /* Sorting icon */
        .main-content .table-responsive > .table > thead th .sort-icon,
        .main-content .table-responsive > .table > thead th .sort,
        .main-content .table-responsive > .table > thead th .sorting,
        .main-content .table-responsive > .table > thead th i,
        .main-content .table-responsive > .table > thead th svg {
            width: 14px;
            min-width: 14px;
            height: 14px;
            margin-inline-start: 5px;
            margin-inline-end: 0;
            color: #65788d;
            font-size: 11px;
            line-height: 1;
        }

        /* Sort button remains compact and inline */
        .main-content .table-responsive > .table > thead th button {
            width: auto;
            min-width: 14px;
            height: 22px;
            margin-inline-start: 4px;
            padding: 0;
            color: #65788d;
            background: transparent;
            border: 0;
            box-shadow: none;
            font: inherit;
            line-height: 1;
        }

            .main-content .table-responsive > .table > thead th button:hover {
                color: var(--sp-blue);
                background: transparent;
            }

            .main-content .table-responsive > .table > thead th button:focus-visible {
                outline: 2px solid rgb(40 89 197 / .25);
                outline-offset: 1px;
                border-radius: 3px;
            }

        .main-content .table-responsive > .table > thead th .bi {
            display: inline-block;
            vertical-align: middle;
            margin-inline-start: 5px;
            font-size: 11px;
            line-height: 1;
        }

        /* Never let a header child force a second line */
        .main-content .table-responsive > .table > thead th > * {
            vertical-align: middle;
        }

        /* Data cells */
        .main-content .table-responsive > .table > tbody > tr > td {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            vertical-align: middle;
        }

            /* Action column */
            .main-content .table-responsive > .table > tbody > tr > td:last-child {
                white-space: nowrap;
            }

/* Pagination stays outside tbody scrolling */
.main-content .pagination {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .main-content .table-responsive > .table > tbody {
        max-height: calc(100vh - 220px);
    }

    .main-content .table-responsive > .table > thead th {
        height: 42px;
    }

    .main-content .table-responsive > .table > tbody > tr > td {
        height: 43px;
    }
}


/* =========================================================
   SPRADIN UI V3 — FIXED ACTION BUTTONS + OUTER CONTENT SCROLL
   - Scrollbar belongs to main workspace (yellow-marked edge)
   - No vertical/horizontal scrolling inside the table
   - Header and data stay in one normal table flow
   ========================================================= */

/* 1. Browser itself never scrolls */
html,
body {
    overflow: hidden !important;
    height: 100%;
}

/* 2. Main workspace is the ONE vertical scroll container.
      In RTL, its scrollbar sits at the left edge of the workspace. */
.page > .main-content,
main.main-content {
    position: fixed;
    top: 62px;
    right: var(--sidebar-width);
    bottom: 0;
    left: 0;
    height: auto !important;
    max-height: calc(100vh - 62px);
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: thin;
    scrollbar-color: #aebdcd transparent;
    /* Preserve RTL scrollbar placement without changing table text */
    direction: rtl;
}

/* Keep page content readable if the workspace has inherited RTL. */
.main-content > * {
    direction: rtl;
}

/* Subtle scrollbar only at the workspace edge */
.page > .main-content::-webkit-scrollbar,
main.main-content::-webkit-scrollbar {
    width: 8px;
}

.page > .main-content::-webkit-scrollbar-track,
main.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.page > .main-content::-webkit-scrollbar-thumb,
main.main-content::-webkit-scrollbar-thumb {
    background: #aebdcd;
    border: 2px solid var(--sp-canvas);
    border-radius: 10px;
}

    .page > .main-content::-webkit-scrollbar-thumb:hover,
    main.main-content::-webkit-scrollbar-thumb:hover {
        background: #8498ad;
    }

/* 3. Remove ALL table-level scrolling.
      Table, wrapper, thead and tbody remain in normal flow. */
.main-content .table-responsive {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    scrollbar-width: none !important;
}

    .main-content .table-responsive::-webkit-scrollbar,
    .main-content .table-responsive *::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    .main-content .table-responsive > .table {
        display: table !important;
        width: 100%;
        min-width: 0;
        height: auto !important;
        table-layout: auto !important;
    }

        /* Undo the previous split-header / scrolling-tbody layout */
        .main-content .table-responsive > .table > thead {
            display: table-header-group !important;
            width: auto !important;
        }

        .main-content .table-responsive > .table > tbody {
            display: table-row-group !important;
            width: auto !important;
            max-height: none !important;
            height: auto !important;
            overflow: visible !important;
            scrollbar-width: none !important;
        }

            .main-content .table-responsive > .table > tbody > tr {
                display: table-row !important;
                width: auto !important;
                table-layout: auto !important;
            }

        /* Ensure cells are not clipped by old fixed-layout rules */
        .main-content .table-responsive > .table th,
        .main-content .table-responsive > .table td {
            overflow: visible;
        }

            /* 4. Fix action buttons that were squeezed/clipped in the first column.
      Reserve enough room for the row actions and prevent button text wrap. */
            .main-content .table-responsive > .table td:has(.btn) {
                min-width: 350px;
                white-space: nowrap !important;
                overflow: visible !important;
                vertical-align: middle;
            }

                .main-content .table-responsive > .table td:has(.btn) .btn {
                    display: inline-flex !important;
                    flex: 0 0 auto;
                    align-items: center;
                    justify-content: center;
                    min-width: max-content !important;
                    width: auto !important;
                    max-width: none !important;
                    min-height: 30px;
                    margin: 2px 2px !important;
                    padding: 4px 8px !important;
                    white-space: nowrap !important;
                    word-break: keep-all !important;
                    line-height: 1.25;
                    border-radius: 5px !important;
                    font-size: 11px;
                    box-shadow: none !important;
                }

/* Slightly stronger border contrast for compact action controls */
.main-content .table td:has(.btn).btn-cell .btn,
.main-content .table td:has(.btn) .btn-outline-primary {
    border-color: #b5c9eb;
}

.main-content .table td:has(.btn) .btn-outline-success {
    border-color: #b3d8c4;
}

.main-content .table td:has(.btn) .btn-outline-danger {
    border-color: #e7bcbc;
}

/* 5. Header label and sort indicator remain inline and centered */
.main-content .table thead th {
    white-space: nowrap !important;
    vertical-align: middle !important;
}

    .main-content .table thead th > * {
        display: inline-flex;
        align-items: center;
        vertical-align: middle;
        white-space: nowrap;
    }

/* 6. Small screens: retain the outer workspace scroll, never tbody scroll */
@media (max-width: 768px) {
    .page > .main-content,
    main.main-content {
        right: 0;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .main-content .table-responsive {
        overflow: visible !important;
    }

        .main-content .table-responsive > .table td:has(.btn) {
            min-width: 320px;
        }
}


/* =========================================================
   SPRADIN V4 — SINGLE WORKSPACE SCROLLBAR
   Requirement:
   - Scrollbar at the yellow-marked LEFT edge of main workspace
   - No scrollbar anywhere inside/around the table
   - Table header, rows and pagination move together with workspace
   ========================================================= */

/* The document itself must never scroll. */
html,
body {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
}

/* Exactly one vertical scrolling area: the main workspace.
   RTL places its vertical scrollbar on the LEFT edge,
   immediately beside the content area (yellow-marked location). */
.page > .main-content,
main.main-content {
    position: fixed !important;
    top: 62px !important;
    right: var(--sidebar-width) !important;
    bottom: 0 !important;
    left: 0 !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    direction: rtl !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: thin !important;
    scrollbar-color: #aebdcd transparent !important;
}

    /* Preserve RTL layout while allowing children to retain their own text direction. */
    .page > .main-content > *,
    main.main-content > * {
        direction: rtl;
    }

    /* Workspace scrollbar styling — the ONLY visible scrollbar. */
    .page > .main-content::-webkit-scrollbar,
    main.main-content::-webkit-scrollbar {
        width: 8px;
    }

    .page > .main-content::-webkit-scrollbar-track,
    main.main-content::-webkit-scrollbar-track {
        background: transparent;
    }

    .page > .main-content::-webkit-scrollbar-thumb,
    main.main-content::-webkit-scrollbar-thumb {
        background: #aebdcd;
        border: 2px solid var(--sp-canvas);
        border-radius: 10px;
    }

        .page > .main-content::-webkit-scrollbar-thumb:hover,
        main.main-content::-webkit-scrollbar-thumb:hover {
            background: #8498ad;
        }

/* Remove scroll behavior from every table wrapper/section.
   No overflow:auto/scroll is allowed inside the table region. */
.main-content .table-responsive,
.main-content .table,
.main-content .table thead,
.main-content .table tbody,
.main-content .table tfoot,
.main-content .table tr,
.main-content .table th,
.main-content .table td {
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    max-height: none !important;
}

    /* Undo split/fixed tbody behavior from earlier CSS revisions.
   Header + all rows are one regular table and scroll with workspace. */
    .main-content .table-responsive > .table {
        display: table !important;
        width: 100% !important;
        height: auto !important;
        table-layout: auto !important;
        border-collapse: separate;
    }

        .main-content .table-responsive > .table > thead {
            display: table-header-group !important;
            width: auto !important;
        }

        .main-content .table-responsive > .table > tbody {
            display: table-row-group !important;
            width: auto !important;
            height: auto !important;
            max-height: none !important;
        }

            .main-content .table-responsive > .table > tbody > tr {
                display: table-row !important;
                width: auto !important;
                table-layout: auto !important;
            }

    /* Never show a scrollbar on table wrappers or their descendants. */
    .main-content .table-responsive,
    .main-content .table-responsive * {
        scrollbar-width: none !important;
    }

        .main-content .table-responsive::-webkit-scrollbar,
        .main-content .table-responsive *::-webkit-scrollbar {
            display: none !important;
            width: 0 !important;
            height: 0 !important;
        }

    /* Keep row action buttons intact without creating a table scroll area. */
    .main-content .table td:has(.btn) {
        white-space: nowrap !important;
    }

        .main-content .table td:has(.btn) .btn {
            display: inline-flex !important;
            align-items: center;
            justify-content: center;
            width: auto !important;
            min-width: max-content !important;
            max-width: none !important;
            white-space: nowrap !important;
            vertical-align: middle;
        }

/* The sidebar is fixed; it must not add a second page scrollbar. */
.page > .sidebar,
nav.sidebar {
    overflow: hidden !important;
}

/* Narrow screens: workspace remains the sole scrolling container. */
@media (max-width: 768px) {
    .page > .main-content,
    main.main-content {
        right: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .main-content .table-responsive,
    .main-content .table-responsive * {
        overflow: visible !important;
    }
}


/* =========================================================
   SPRADIN V5 — ORANGE FOCUS / SELECTION
   ========================================================= */

.form-control:focus,
.form-control:focus-visible,
.form-select:focus,
.form-select:focus-visible,
textarea:focus,
textarea:focus-visible,
input:focus,
input:focus-visible,
select:focus,
select:focus-visible {
    border-color: var(--sp-amber) !important;
    outline: none !important;
    box-shadow: none !important;
}

.form-floating > .form-control:focus,
.form-floating > .form-control:focus-visible,
.form-floating > .form-select:focus,
.form-floating > .form-select:focus-visible {
    border-color: var(--sp-amber) !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Remove Bootstrap's blue focus ring */
.btn:focus,
.btn:focus-visible,
button:focus,
button:focus-visible,
a:focus,
a:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* Focused button: thin orange border */
.btn:focus-visible {
    border-color: var(--sp-amber) !important;
    outline: 1px solid var(--sp-amber) !important;
    outline-offset: -1px;
}

/* Selected sidebar item: orange line instead of blue outline */
.sidebar .nav-link.active {
    outline: none !important;
    box-shadow: none !important;
    border-right: 1px solid var(--sp-amber) !important;
}

.sidebar .nav-link:focus,
.sidebar .nav-link:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* Focused table row/cell */
.main-content .table tbody tr:focus,
.main-content .table tbody tr:focus-visible,
.main-content .table tbody td:focus,
.main-content .table tbody td:focus-visible {
    outline: 1px solid var(--sp-amber) !important;
    outline-offset: -1px;
    box-shadow: none !important;
}

/* Checkbox / radio */
.form-check-input:focus,
.form-check-input:focus-visible {
    border-color: var(--sp-amber) !important;
    outline: none !important;
    box-shadow: none !important;
}

.form-check-input:checked:focus,
.form-check-input:checked:focus-visible {
    border-color: var(--sp-amber) !important;
    outline: 1px solid var(--sp-amber) !important;
    outline-offset: -1px;
    box-shadow: none !important;
}

/* Links: orange focus outline, no Bootstrap blue halo */
a:focus-visible {
    outline: 1px solid var(--sp-amber) !important;
    outline-offset: 1px;
}


/* =========================================================
   SPRADIN V6 — MODERN ENTERPRISE SIDEBAR
   ========================================================= */

:root {
    --sp-menu-bg: #102943;
    --sp-menu-bg-deep: #0c2137;
    --sp-menu-hover: #173754;
    --sp-menu-active: #1c4770;
    --sp-menu-text: #b8c7d6;
    --sp-menu-text-strong: #eef4f9;
    --sp-menu-muted: #8194a8;
    --sp-menu-line: rgb(255 255 255 / 0.065);
    --sp-menu-icon: #91a7bc;
}

.page > .sidebar,
nav.sidebar {
    width: var(--sidebar-width) !important;
    background: linear-gradient(180deg, var(--sp-menu-bg) 0%, var(--sp-menu-bg-deep) 100%) !important;
    border-left: 1px solid rgb(255 255 255 / 0.04) !important;
    box-shadow: -4px 0 18px rgb(9 28 47 / 0.08);
}

.sidebar-content {
    padding: 13px 8px !important;
    background: transparent !important;
}

.sidebar .nav {
    gap: 2px !important;
    margin: 0;
    padding: 0;
}

.sidebar .nav-link {
    position: relative;
    display: flex !important;
    align-items: center;
    min-height: 39px !important;
    margin: 1px 0 !important;
    padding: 8px 12px !important;
    color: var(--sp-menu-text) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 6px !important;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.4;
    transition: color .14s ease, background-color .14s ease;
}

    .sidebar .nav-link > i,
    .sidebar .nav-link > svg,
    .sidebar .nav-link .bi,
    .sidebar .nav-link .menu-icon {
        flex: 0 0 20px;
        width: 20px;
        min-width: 20px;
        margin-inline-end: 9px;
        color: var(--sp-menu-icon);
        font-size: 15px;
        text-align: center;
        transition: color .14s ease;
    }

    .sidebar .nav-link:hover {
        color: #fff !important;
        background: var(--sp-menu-hover) !important;
    }

        .sidebar .nav-link:hover > i,
        .sidebar .nav-link:hover > svg,
        .sidebar .nav-link:hover .bi,
        .sidebar .nav-link:hover .menu-icon {
            color: #c7d8e8;
        }

    .sidebar .nav-link.active {
        color: var(--sp-menu-text-strong) !important;
        background: var(--sp-menu-active) !important;
        border: 0 !important;
        border-right: 2px solid var(--sp-amber) !important;
        box-shadow: none !important;
        outline: none !important;
        font-weight: 650;
    }

        .sidebar .nav-link.active > i,
        .sidebar .nav-link.active > svg,
        .sidebar .nav-link.active .bi,
        .sidebar .nav-link.active .menu-icon {
            color: #fff;
        }

    .sidebar .nav-link:focus,
    .sidebar .nav-link:focus-visible {
        outline: none !important;
        box-shadow: none !important;
    }

    .sidebar .nav-link:focus-visible {
        border-right: 1px solid var(--sp-amber) !important;
    }

    .sidebar .nav-link.parent,
    .sidebar .nav-link[data-bs-toggle="collapse"] {
        color: #d1dce6 !important;
        font-weight: 600;
    }

        .sidebar .nav-link.parent:hover,
        .sidebar .nav-link[data-bs-toggle="collapse"]:hover {
            color: #fff !important;
            background: var(--sp-menu-hover) !important;
        }

    .sidebar .nav-link .collapse-icon,
    .sidebar .nav-link .chevron,
    .sidebar .nav-link .arrow,
    .sidebar .nav-link .bi-chevron-down,
    .sidebar .nav-link .bi-chevron-left,
    .sidebar .nav-link .bi-chevron-right {
        margin-inline-start: auto;
        margin-inline-end: 0;
        width: 14px;
        min-width: 14px;
        color: var(--sp-menu-muted);
        font-size: 10px;
        transition: transform .16s ease, color .14s ease;
    }

    .sidebar .nav-link:hover .collapse-icon,
    .sidebar .nav-link:hover .chevron,
    .sidebar .nav-link:hover .arrow,
    .sidebar .nav-link:hover .bi-chevron-down,
    .sidebar .nav-link:hover .bi-chevron-left,
    .sidebar .nav-link:hover .bi-chevron-right {
        color: #d9e5ef;
    }

.sidebar .submenu,
.sidebar .nav .submenu,
.sidebar .collapse .nav {
    margin: 3px 5px 5px 5px !important;
    padding: 3px 0 !important;
    background: rgb(7 24 40 / 0.32) !important;
    border: 0 !important;
    border-radius: 5px !important;
}

    .sidebar .submenu .nav-link,
    .sidebar .collapse .nav .nav-link {
        min-height: 34px !important;
        padding-top: 6px !important;
        padding-bottom: 6px !important;
        padding-inline-start: 30px !important;
        color: #9fb1c3 !important;
        font-size: 11.8px;
        font-weight: 450;
    }

        .sidebar .submenu .nav-link:hover,
        .sidebar .collapse .nav .nav-link:hover {
            color: #eaf1f7 !important;
            background: rgb(32 72 108 / 0.55) !important;
        }

        .sidebar .submenu .nav-link.active,
        .sidebar .collapse .nav .nav-link.active {
            color: #fff !important;
            background: rgb(40 89 197 / 0.48) !important;
            border-right: 2px solid var(--sp-amber) !important;
        }

.sidebar .menu-section,
.sidebar .nav-section {
    margin: 14px 8px 5px;
    padding: 8px 7px 4px;
    color: var(--sp-menu-muted);
    border-bottom: 1px solid var(--sp-menu-line);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .25px;
}

.sidebar hr {
    margin: 8px 9px;
    border: 0;
    border-top: 1px solid var(--sp-menu-line);
    opacity: 1;
}

.sidebar-content::-webkit-scrollbar {
    width: 5px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgb(255 255 255 / 0.16);
    border-radius: 8px;
}

    .sidebar-content::-webkit-scrollbar-thumb:hover {
        background: rgb(255 255 255 / 0.28);
    }

.sidebar-content {
    scrollbar-width: thin;
    scrollbar-color: rgb(255 255 255 / 0.16) transparent;
}

@media (max-width: 768px) {
    .sidebar .nav-link {
        min-height: 42px !important;
        font-size: 13px;
    }

    .sidebar .submenu .nav-link,
    .sidebar .collapse .nav .nav-link {
        min-height: 37px !important;
        font-size: 12.2px;
    }
}


/* =========================================================
   SPRADIN V7 — DISTINCT SUBMENU OPEN / CLOSED INDICATOR
   Closed: ‹    Open: ⌄
   Bootstrap Collapse: aria-expanded
   ========================================================= */

.sidebar .nav-link[data-bs-toggle="collapse"] {
    position: relative;
    padding-inline-end: 34px !important;
}

    /* Remove existing arrow so only one state indicator is shown */
    .sidebar .nav-link[data-bs-toggle="collapse"] > .collapse-icon,
    .sidebar .nav-link[data-bs-toggle="collapse"] > .chevron,
    .sidebar .nav-link[data-bs-toggle="collapse"] > .arrow,
    .sidebar .nav-link[data-bs-toggle="collapse"] > .bi-chevron-down,
    .sidebar .nav-link[data-bs-toggle="collapse"] > .bi-chevron-left,
    .sidebar .nav-link[data-bs-toggle="collapse"] > .bi-chevron-right,
    .sidebar .nav-link[data-bs-toggle="collapse"] .collapse-icon,
    .sidebar .nav-link[data-bs-toggle="collapse"] .chevron,
    .sidebar .nav-link[data-bs-toggle="collapse"] .arrow,
    .sidebar .nav-link[data-bs-toggle="collapse"] .bi-chevron-down,
    .sidebar .nav-link[data-bs-toggle="collapse"] .bi-chevron-left,
    .sidebar .nav-link[data-bs-toggle="collapse"] .bi-chevron-right {
        display: none !important;
    }

    /* CLOSED — right-to-left friendly left chevron */
    .sidebar .nav-link[data-bs-toggle="collapse"]::after {
        content: "‹";
        position: absolute;
        inset-inline-end: 11px;
        top: 50%;
        transform: translateY(-52%);
        width: 15px;
        height: 18px;
        color: var(--sp-menu-muted);
        font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
        font-size: 19px;
        font-weight: 400;
        line-height: 16px;
        text-align: center;
        transition: color .15s ease, transform .18s ease;
    }

    /* CLOSED hover */
    .sidebar .nav-link[data-bs-toggle="collapse"]:hover::after {
        color: #dce8f2;
    }

    /* OPEN — clearly different downward symbol */
    .sidebar .nav-link[data-bs-toggle="collapse"][aria-expanded="true"]::after {
        content: "⌄";
        color: #ffffff;
        transform: translateY(-42%);
        font-size: 18px;
        font-weight: 600;
    }

    /* Open parent gets a subtle distinction */
    .sidebar .nav-link[data-bs-toggle="collapse"][aria-expanded="true"] {
        color: #eef4f9 !important;
        background: rgb(23 55 84 / 0.72) !important;
    }

    /* Active + open retains the orange marker */
    .sidebar .nav-link[data-bs-toggle="collapse"].active[aria-expanded="true"] {
        background: var(--sp-menu-active) !important;
        border-right: 2px solid var(--sp-amber) !important;
    }

    /* Keyboard focus remains orange, never Bootstrap blue */
    .sidebar .nav-link[data-bs-toggle="collapse"]:focus-visible {
        outline: 1px solid var(--sp-amber) !important;
        outline-offset: -1px;
        box-shadow: none !important;
    }

    /* Explicit closed state */
    .sidebar .nav-link[data-bs-toggle="collapse"][aria-expanded="false"]::after {
        content: "‹";
    }

    /* Explicit open state */
    .sidebar .nav-link[data-bs-toggle="collapse"][aria-expanded="true"]::after {
        content: "⌄";
    }

@media (max-width: 768px) {
    .sidebar .nav-link[data-bs-toggle="collapse"] {
        padding-inline-end: 36px !important;
    }

        .sidebar .nav-link[data-bs-toggle="collapse"]::after {
            inset-inline-end: 12px;
        }
}
