html {
    min-height: 100%;
    background-color: #625c86;
    /* از پرش افقی محتوا هنگام ظاهر/ناپدید شدن اسکرول‌بار عمودی
       (مثلاً موقع صفحه‌بندی جدول‌ها) جلوگیری می‌کند. */
    scrollbar-gutter: stable;
}

body {
    min-height: 100vh;
    margin: 0;
    background-color: #f4f6f8;
    color: #2a264b;
}

/* =========================================================
   Overlay بارگذاری جدول‌ها

   به‌جای حذف کامل جدول و جایگزینی آن با یک اسپینر (که باعث
   جمع‌وباز شدن ارتفاع کارت و لرزش صفحه هنگام صفحه‌بندی می‌شود)،
   جدول قبلی در DOM می‌ماند و فقط یک لایه‌ی نیمه‌شفاف با اسپینر
   روی آن قرار می‌گیرد؛ بنابراین ارتفاع صفحه ثابت می‌ماند.
   ========================================================= */

.app-table-loading-wrapper {
    position: relative;
}

.app-table-loading-wrapper > :not(.app-table-loading-overlay) {
    transition: opacity .15s ease;
}

.app-table-loading-wrapper.is-loading > :not(.app-table-loading-overlay) {
    opacity: .45;
    pointer-events: none;
}

.app-table-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, .35);
}

body[data-theme="dark"] .app-table-loading-overlay {
    background-color: rgba(17, 24, 39, .35);
}

.app-layout {
    min-height: 100vh;
    background-color: #f4f6f8;
    color: #2f3742;
}

/* =========================================================
   منوی اصلی فارسی سامانه
   ========================================================= */

:root {
    --app-sidebar-width: 224px;
    --app-sidebar-collapsed-width: 76px;
    --app-sidebar-bg: #172238;
    --app-sidebar-bg-deep: #111a2c;
    --app-sidebar-text: #dbe5f3;
    --app-sidebar-muted: #8fa2bd;
    --app-sidebar-active: #1B5E86;
    --app-topbar-height: 76px;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    background: #f4f6f8;
    color: #263238;
}

.app-sidebar-toggle {
    position: fixed;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.app-sidebar {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    width: var(--app-sidebar-width);
    overflow-y: auto;
    overflow-x: hidden;
    color: var(--app-sidebar-text);
    background:
        radial-gradient(circle at 90% 0%, rgba(65, 137, 207, .18), transparent 33%),
        linear-gradient(180deg, var(--app-sidebar-bg) 0%, var(--app-sidebar-bg-deep) 100%);
    box-shadow: -8px 0 28px rgba(20, 31, 49, .14);
    transition: width .25s ease;
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 92px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    direction:ltr;
}

.app-brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
}

.app-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    flex: 0 0 45px;
    color: #fff;
    background: linear-gradient(145deg, #4b9be1, #2e66ac);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(23, 94, 161, .35);
    font-size: 22px;
}

.app-brand-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    line-height: 1.2;
}

.app-brand-text strong {
    font-size: 15px;
    font-weight: 800;
}

.app-brand-text small {
    color: #9fb1c9;
    font-size: 10px;
}

.app-sidebar-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: #c7d4e5;
    border-radius: 8px;
    cursor: pointer;
}

.app-sidebar-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.app-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 10px 8px;
    padding: 10px;
    color: #dbe5f3;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
}

.app-sidebar-user > span:last-child {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.app-sidebar-user strong {
    overflow: hidden;
    color: #f2f6fb;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar-user small {
    color: var(--app-sidebar-muted);
    font-size: 10px;
}

.app-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    color: #b9ddff;
    background: rgba(60, 141, 213, .22);
    border-radius: 50%;
    font-size: 18px;
}

.app-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 7px 9px 12px;
}

.app-nav-caption {
    margin: 10px 9px 4px;
    color: #7890af;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .02em;
}

.app-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 7px 10px;
    color: var(--app-sidebar-text);
    border-radius: 10px;
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
    transition: color .18s ease, background-color .18s ease, transform .18s ease;
}

.app-nav-link i {
    width: 18px;
    color: #9cb2cd;
    font-size: 15px;
    text-align: center;
    transition: color .18s ease;
}

.app-nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
    transform: translateX(2px);
}

.app-nav-link:hover i,
.app-nav-link.active i {
    color: #a9dcff;
}

.app-nav-link.active {
    color: #fff;
    background: linear-gradient(270deg, rgba(58, 137, 211, .95), rgba(42, 102, 170, .82));
    box-shadow: 0 7px 18px rgba(8, 45, 84, .24);
}

.app-nav-link.active::before {
    position: absolute;
    top: 9px;
    right: -13px;
    bottom: 9px;
    width: 3px;
    content: "";
    background: #77c7ff;
    border-radius: 3px 0 0 3px;
}

.app-nav-link-child {
    min-height: 33px;
    margin-right: 22px;
    padding-top: 5px;
    padding-bottom: 5px;
    color: #b7c7da;
    font-size: 10.5px;
    font-weight: 500;
}

.app-nav-link-child i {
    font-size: 14px;
}

.app-sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 9px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.app-footer-link {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 35px;
    padding: 7px 10px;
    color: #b9c9dc;
    background: transparent;
    border: 0;
    border-radius: 9px;
    font-family: inherit;
    font-size: 10.5px;
    text-align: right;
    text-decoration: none;
    cursor: pointer;
}

.app-footer-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.app-footer-link i {
    width: 20px;
    color: #8faed0;
    font-size: 15px;
    text-align: center;
}

.app-logout-link {
    color: #f3a5a5;
}

    .app-logout-link:hover {
        color: #fff;
        background: rgba(220, 53, 69, .25);
    }

    .app-logout-link i {
        color: #f3a5a5;
    }

.app-logout-button {
    appearance: none;
}

.app-sidebar-footer form {
    margin: 0;
}

.app-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    margin-right: var(--app-sidebar-width);
    transition: margin-right .25s ease;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--app-topbar-height);
    padding: 12px 28px;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid #e5eaf0;
    box-shadow: 0 3px 16px rgba(33, 49, 69, .05);
    backdrop-filter: blur(10px);
}

.app-topbar-start,
.app-topbar-actions,
.app-account-link {
    display: flex;
    align-items: center;
}

.app-topbar-start {
    gap: 14px;
}

.app-topbar-title {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.app-topbar-title span {
    color: #263b55;
    font-size: 14px;
    font-weight: 800;
}

.app-topbar-title small {
    color: #8a9aaa;
    font-size: 10px;
}

.app-menu-button {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: #31506f;
    background: #edf4fa;
    border-radius: 9px;
    cursor: pointer;
    font-size: 21px;
}

/* دکمه‌ی جمع/باز کردن منو (فقط دسکتاپ؛ در موبایل منو به‌صورت کشویی روی صفحه است) */
.app-sidebar-collapse-button {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: #31506f;
    background: #edf4fa;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    font-size: 17px;
}

.app-sidebar-collapse-button:hover {
    color: #1f6ba9;
    background: #dcebf7;
}

.app-sidebar-collapse-button i {
    transition: transform .25s ease;
}

body.sidebar-collapsed .app-sidebar-collapse-button i {
    transform: rotate(180deg);
}

@media (min-width: 992px) {
    .app-sidebar-collapse-button {
        display: inline-flex;
    }
}

.app-account-link {
    gap: 8px;
    padding: 8px 12px;
    color: #46627d;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
}

.app-account-link:hover {
    color: #1f6ba9;
    background: #edf5fb;
}

.app-account-link i {
    color: #3987c0;
    font-size: 20px;
}

.app-main {
    flex: 1;
    min-width: 0;
    padding-top: 1px;
}

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

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(105%);
        transition: transform .25s ease;
    }

    .app-sidebar-toggle:checked ~ .app-sidebar {
        transform: translateX(0);
    }

    .app-sidebar-toggle:checked ~ .app-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1030;
        background: rgba(8, 17, 31, .46);
    }

    .app-sidebar-close,
    .app-menu-button {
        display: inline-flex;
    }

    .app-content {
        margin-right: 0;
    }

    .app-topbar {
        padding-right: 18px;
        padding-left: 18px;
    }
}

@media (max-width: 575.98px) {
    .app-sidebar {
        width: min(var(--app-sidebar-width), 88vw);
    }

    .app-topbar-title small,
    .app-account-link span {
        display: none;
    }

    .app-topbar-title span {
        font-size: 12px;
    }

    .app-topbar {
        min-height: 64px;
    }
}


/* =========================================================
   تنظیم صفحه چاپ
   ========================================================= */

@page A4 {
    size: A4 portrait;
    margin: 10mm;
}

@page A5 {
    size: A5 portrait;
    margin: 8mm;
}

@page Letter {
    size: Letter portrait;
    margin: 10mm;
}

@page Legal {
    size: Legal portrait;
    margin: 10mm;
}


/* =========================================================
   انتخاب صفحه
   ========================================================= */

body[data-print-page-size="A4"] .print-area {
    page: A4;
}

body[data-print-page-size="A5"] .print-area {
    page: A5;
}

body[data-print-page-size="Letter"] .print-area {
    page: Letter;
}

body[data-print-page-size="Legal"] .print-area {
    page: Legal;
}
/* =========================================================
   منوی کناری فشرده (Collapsed Sidebar)

   با کلیک روی دکمه‌ی .app-sidebar-collapse-button، کلاس
   sidebar-collapsed روی body اضافه/حذف می‌شود (js/theme.js).
   این حالت فقط در دسکتاپ (>=992px) فعال است؛ در موبایل منو
   همان رفتار کشویی همیشگی خودش را دارد.
   ========================================================= */

@media (min-width: 992px) {

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

    body.sidebar-collapsed .app-content {
        margin-right: var(--app-sidebar-collapsed-width);
    }

    /* عناصر متنی در حالت فشرده مخفی می‌شوند و فقط آیکن می‌ماند */
    body.sidebar-collapsed .app-brand-text,
    body.sidebar-collapsed .app-sidebar-user > span:last-child,
    body.sidebar-collapsed .app-nav-caption,
    body.sidebar-collapsed .app-nav-link span,
    body.sidebar-collapsed .app-nav-link-child,
    body.sidebar-collapsed .app-footer-link span {
        display: none;
    }

    body.sidebar-collapsed .app-sidebar-brand {
        min-height: 72px;
        padding: 12px 15px;
        justify-content: center;
    }

    body.sidebar-collapsed .app-brand-link {
        gap: 0;
    }

    body.sidebar-collapsed .app-brand-icon {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
        border-radius: 11px;
        font-size: 19px;
    }

    body.sidebar-collapsed .app-sidebar-user {
        gap: 0;
        margin: 10px 12px 6px;
        padding: 8px;
        justify-content: center;
    }

    body.sidebar-collapsed .app-user-avatar {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        font-size: 16px;
    }

    body.sidebar-collapsed .app-nav {
        gap: 3px;
        padding: 5px 8px 9px;
    }

    body.sidebar-collapsed .app-nav-link {
        gap: 0;
        min-height: 40px;
        padding: 6px;
        justify-content: center;
        border-radius: 8px;
    }

    body.sidebar-collapsed .app-nav-link i {
        width: auto;
        font-size: 17px;
    }

    body.sidebar-collapsed .app-nav-link.active::before {
        top: 7px;
        bottom: 7px;
    }

    body.sidebar-collapsed .app-sidebar-footer {
        gap: 4px;
        padding: 8px;
    }

    body.sidebar-collapsed .app-footer-link {
        justify-content: center;
        gap: 0;
        min-height: 36px;
        padding: 6px;
        border-radius: 8px;
    }

    body.sidebar-collapsed .app-footer-link i {
        width: auto;
        font-size: 16px;
    }
}


/* =========================================================
       نوار خطای بلیزر (blazor-error-ui)

       این عنصر توسط خود فریمورک بلیزر تزریق و در صورت بروز
       خطای مدیریت‌نشده در Circuit به‌صورت خودکار نمایش داده
       می‌شود؛ تا قبل از این، هیچ استایلی نداشت و به‌صورت خام و
       بدون Fixed-Position در وسط صفحه ظاهر می‌شد.
       ========================================================= */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1050;
    background: #fff3cd;
    color: #664d03;
    border-top: 1px solid #ffe69c;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
    padding: 12px 48px 12px 16px;
    font-size: 13px;
    text-align: center;
}

    #blazor-error-ui .reload {
        color: #664d03;
        font-weight: 700;
        text-decoration: underline;
        margin-right: 8px;
    }

    #blazor-error-ui .dismiss {
        position: absolute;
        top: 8px;
        left: 16px;
        cursor: pointer;
        color: #664d03;
        opacity: 0.7;
    }

        #blazor-error-ui .dismiss:hover {
            opacity: 1;
        }

