﻿@import url('fonts/iransansx/fontiran.css');

/* ═══════════════════════════════════════════════════════
   VIEWPORT STABILITY — رزرو scrollbar-gutter
   جلوگیری از شیفت NavMenu/Layout هنگام ناوبری بین صفحات.
   ═══════════════════════════════════════════════════════ */
html {
    overflow-y: scroll; /* fallback برای Safari/iOS */
}

@supports (scrollbar-gutter: stable) {
    html {
        overflow-y: auto;
        scrollbar-gutter: stable;
    }
}

/* ═══════════════════════════════════════════════════════
   NEO ACCOUNTING — Modern Design System v2.0
   ═══════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────
   PRIMITIVE COLORS (palette atoms — same in light & dark)
   Used to derive semantic tokens below.
   ───────────────────────────────────────────────────────── */
:root {
    /* Indigo (brand) */
    --color-indigo-300: #A5B4FC;
    --color-indigo-400: #818CF8;
    --color-indigo-500: #6366F1;
    --color-indigo-600: #4F46E5;
    --color-indigo-700: #4338CA;
    --color-indigo-900: #312E81;
    --color-indigo-950: #1E1B4B;

    /* Slate (neutral) */
    --color-slate-50: #F8FAFC;
    --color-slate-100: #F1F5F9;
    --color-slate-200: #E2E8F0;
    --color-slate-300: #CBD5E1;
    --color-slate-400: #94A3B8;
    --color-slate-500: #64748B;
    --color-slate-600: #475569;
    --color-slate-700: #334155;
    --color-slate-800: #1E293B;
    --color-slate-900: #0F172A;

    /* Semantic primitives */
    --color-success-500: #059669;
    --color-success-400: #34D399;
    --color-warning-500: #D97706;
    --color-warning-400: #FBBF24;
    --color-danger-500: #DC2626;
    --color-danger-400: #F87171;
    --color-info-500: #2563EB;
    --color-info-400: #60A5FA;
}

:root {
    --kendo-font-family: 'IRANSansX', 'Segoe UI', Tahoma, sans-serif;

    /* ── Brand Colors ── */
    --neo-primary: #4F46E5;
    --neo-primary-light: #6366F1;
    --neo-primary-lighter: #818CF8;
    --neo-primary-dark: #4338CA;
    --neo-primary-bg: rgba(79, 70, 229, 0.08);

    /* ── Sidebar ── */
    --neo-sidebar-bg: linear-gradient(180deg, #1E1B4B 0%, #312E81 50%, #1E1B4B 100%);
    --neo-sidebar-bg-solid: #1E1B4B;
    --neo-sidebar-active: rgba(129, 140, 248, 0.2);
    --neo-sidebar-hover: rgba(255, 255, 255, 0.08);
    --neo-sidebar-text: #C7D2FE;
    --neo-sidebar-group: #A5B4FC;

    /* ── Backgrounds ── */
    --neo-bg-page: #F8FAFC;
    --neo-bg-card: #FFFFFF;
    --neo-bg-elevated: #FFFFFF;
    --neo-bg-subtle: #F1F5F9;

    /* ── Borders ── */
    --neo-border: #E2E8F0;
    --neo-border-light: #F1F5F9;
    --neo-border-focus: #818CF8;

    /* ── Text ── */
    --neo-text-primary: #0F172A;
    --neo-text-secondary: #475569;
    --neo-text-muted: #64748B; /* WCAG AA 4.55:1 — body text. Use --neo-text-muted-soft for icons/disabled-only. */
    --neo-text-muted-soft: #94A3B8; /* Slate-400 — only for non-informational decorative use (icons, disabled placeholder). */
    --neo-text-inverse: #FFFFFF;

    /* ── Semantic Colors ── */
    --neo-success: #059669;
    --neo-success-bg: #ECFDF5;
    --neo-success-border: #A7F3D0;
    --neo-warning: #D97706;
    --neo-warning-bg: #FFFBEB;
    --neo-warning-border: #FDE68A;
    --neo-danger: #DC2626;
    --neo-danger-bg: #FEF2F2;
    --neo-danger-border: #FECACA;
    --neo-info: #2563EB;
    --neo-info-bg: #EFF6FF;
    --neo-info-border: #BFDBFE;
    /* متنِ بدنه روی پس‌زمینهٔ همان خانواده — سطحِ ۵۰۰ برای متنِ بلند AA را رد می‌کند
       (سنجش ۲۰۲۶-۰۹-۰۲: ‏۳٫۰۷ تا ۴٫۴۱)؛ این چهار مقدار AA-pass اند. مقدارِ warning عمداً
       #B45309 است، نه تیره‌تر: دو مصرف‌کنندهٔ از-قبل-موجود (SubscriptionWarningBanner.razor.css
       و BusinessManagement.razor) همین را fallback گرفته بودند — تعریفِ متفاوت ظاهرشان را
       عوض می‌کرد. ‏۴٫۸۴:۱ روی ‎-bg و ۵٫۰۲:۱ روی کارتِ سفید، سنجیده. */
    --neo-success-text: #047857;
    --neo-warning-text: #B45309;
    --neo-danger-text: #B91C1C;
    --neo-info-text: #1D4ED8;

    /* ── Radius ── */
    --neo-radius-xs: 4px;
    --neo-radius-sm: 8px;
    --neo-radius-md: 12px;
    --neo-radius-lg: 16px;
    --neo-radius-xl: 20px;
    --neo-radius-full: 9999px;

    /* ── Shadows ── */
    --neo-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --neo-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --neo-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --neo-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --neo-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --neo-shadow-glow: 0 0 20px rgba(79, 70, 229, 0.15);
    --neo-shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);

    /* ── Spacing ── */
    --neo-space-1: 0.25rem;
    --neo-space-2: 0.5rem;
    --neo-space-3: 0.75rem;
    --neo-space-4: 1rem;
    --neo-space-5: 1.25rem;
    --neo-space-6: 1.5rem;
    --neo-space-8: 2rem;

    /* ── Typography Scale ── */
    --neo-font-xs: 0.75rem;
    --neo-font-sm: 0.8125rem;
    --neo-font-base: 0.875rem;
    --neo-font-md: 0.9375rem;
    --neo-font-lg: 1.0625rem;
    --neo-font-xl: 1.25rem;
    --neo-font-2xl: 1.5rem;
    --neo-font-3xl: 1.875rem;
    --neo-leading-tight: 1.25;
    --neo-leading-normal: 1.5;
    --neo-leading-relaxed: 1.75;

    /* ── Semantic Aliases (used by PublicLayout, shared components) ── */
    --neo-bg: var(--neo-bg-page);
    --neo-surface: var(--neo-bg-card);
    --neo-text: var(--neo-text-primary);

    /* ── Layout ── */
    --neo-topbar-height: 56px;
    --neo-sidebar-width: 300px;
    --neo-sidebar-collapsed-width: 0px;

    /* ── Transitions ── */
    --neo-transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --neo-transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --neo-transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* ── Typography Weights ── */
    --neo-weight-regular: 400;
    --neo-weight-medium: 500;
    --neo-weight-semibold: 600;
    --neo-weight-bold: 700;

    /* ── Breakpoints (for JS read-only; @media uses literal px) ── */
    --neo-bp-mobile: 768px;
    --neo-bp-tablet: 992px;
    --neo-bp-desktop: 1280px;

    /* ── Z-index Scale ── */
    --neo-z-base: 1;
    --neo-z-sticky: 100;
    --neo-z-sidebar: 200;
    --neo-z-dropdown: 500;
    /* دستیارِ شناور: بالای محتوا و نوارِ پایینی، اما زیرِ overlay/modal/toast —
       تا روی پیام‌های خطا و دیالوگ‌ها ننشیند. */
    --neo-z-assistant: 800;
    --neo-z-overlay: 900;
    --neo-z-modal: 1000;
    --neo-z-toast: 1100;

    /* ── Focus Ring ── */
    --neo-focus-outline: 2px solid var(--neo-border-focus);
    --neo-focus-offset: 2px;

    color-scheme: light;
}

/* ═══════════════════════════════════════════════════════
   GLOBAL RESET & BASE
   ═══════════════════════════════════════════════════════ */

html,
body,
input,
button,
textarea,
select {
    font-family: 'IRANSansX', 'Segoe UI', Tahoma, sans-serif;
}

body {
    direction: rtl;
    margin: 0;
    background: var(--neo-bg-page);
    color: var(--neo-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ── Telerik Font Override ── */
.k-widget,
.k-input,
.k-button,
.k-grid,
.k-dialog,
.k-notification {
    font-family: 'IRANSansX', 'Segoe UI', Tahoma, sans-serif !important;
}

/* ── Telerik RTL Baselines ── */
.k-input-inner,
.k-textbox .k-input-inner,
.k-textarea .k-input-inner,
.k-input > input,
.k-input > textarea {
    direction: rtl;
    text-align: right;
}

/* Telerik TextBox داخلِ input-group بوت‌استرپ (مثلِ شبا با پیشوندِ IR):
   بوت‌استرپ فقط .form-control را flex می‌کند؛ ریشهٔ Telerik یک span.k-input است،
   پس بدونِ این قاعده عرضِ پیش‌فرض می‌گیرد و پیشوند به خطِ بعد wrap می‌شود. */
.input-group {
    flex-wrap: nowrap;
}
.input-group > .k-input {
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

/* اتصالِ یکپارچهٔ پیشوند (IR) و ورودیِ Telerik — چون input-group اینجا dir="ltr"
   است ولی bootstrapِ RTL لود شده، گوشه‌های گِرد اشتباه اعمال می‌شوند و مثلِ دو
   «زبانهٔ» جدا دیده می‌شوند. گوشه‌های محلِ اتصال را صریحاً صاف می‌کنیم. */
.input-group[dir="ltr"] > .input-group-text:first-child {
    border-top-left-radius: var(--neo-radius-sm, .375rem) !important;
    border-bottom-left-radius: var(--neo-radius-sm, .375rem) !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}
.input-group[dir="ltr"] > .k-input:last-child {
    border-top-right-radius: var(--neo-radius-sm, .375rem) !important;
    border-bottom-right-radius: var(--neo-radius-sm, .375rem) !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

/* ── Placeholder / NullText — lighter than actual input text ── */
.k-input-inner::placeholder,
.k-textbox .k-input-inner::placeholder,
.k-textarea .k-input-inner::placeholder,
.k-input > input::placeholder,
.k-input > textarea::placeholder {
    color: var(--neo-text-muted) !important;
    opacity: 0.6;
}

.k-chart,
.k-chart > div,
.k-chart-surface {
    direction: ltr;
}

.k-grid,
.k-grid .k-grid-header,
.k-grid .k-grid-content,
.k-grid .k-table,
.k-grid .k-grid-table-wrap {
    direction: rtl;
}

.k-grid .k-table-th,
.k-grid .k-table-td,
.k-grid .k-cell-inner {
    text-align: right;
}

.k-form,
.k-form .k-form-field,
.k-form .k-form-label,
.k-form .k-form-field-wrap,
.k-dialog,
.k-dialog-wrapper,
.k-window,
.k-window-content,
.k-dropdownlist,
.k-dropdownlist .k-input-inner,
.k-combobox,
.k-combobox .k-input-inner,
.k-picker,
.k-picker .k-input-inner,
.k-popup,
.k-list,
.k-list-content,
.k-list-ul,
.k-list-item,
.k-animation-container {
    direction: rtl;
}

/* dropdown/picker هم‌رنگِ ورودی‌های متن (سفید) — به‌جای پُرشدنِ طوسیِ پیش‌فرضِ تمِ kendo */
.k-picker-solid,
.k-dropdownlist.k-picker-solid {
    background-color: var(--neo-bg-card, #fff) !important;
    background-image: none !important;
}

.k-form .k-form-label,
.k-form .k-label,
.k-dialog-title,
.k-dialog-content,
.k-dialog-actions,
.k-dropdownlist .k-input-inner,
.k-combobox .k-input-inner,
.k-list-item,
.k-list-optionlabel {
    text-align: right;
}

/* Backward compatibility */
.neo-rtl-grid,
.neo-rtl-grid .k-grid,
.neo-rtl-grid .k-grid-header,
.neo-rtl-grid .k-grid-content,
.neo-rtl-grid .k-table,
.neo-rtl-grid .k-grid-table-wrap {
    direction: rtl;
}

.neo-rtl-grid .k-table-th,
.neo-rtl-grid .k-table-td,
.neo-rtl-grid .k-cell-inner {
    text-align: right;
}

/* ── Compact rows (برای Grid هایی که ستون عملیات با چند دکمه دارند) ── */
/* specificity بالاتر از Telerik default با !important برای اطمینان */
.neo-grid-compact .k-table-row .k-table-td {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    vertical-align: middle !important;
    line-height: 1.25 !important;
}

/* ارتفاعِ واقعیِ ردیف از padding‌ِ داخلیِ .k-cell-inner می‌آید — این را هم فشرده کن */
.neo-grid-compact .k-table-row .k-table-td .k-cell-inner {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    min-height: 0 !important;
}

/* Override Telerik .k-button padding/height داخل cell ها (دلیل اصلی ارتفاع زیاد) */
.neo-grid-compact .k-table-row .k-table-td .k-button,
.neo-grid-compact .k-table-row .k-table-td .k-button.k-button-sm,
.neo-grid-compact .k-table-row .k-table-td .neo-btn {
    min-height: 26px !important;
    height: 26px !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    line-height: 1.2 !important;
    margin: 0 2px !important;
}

/* جلوگیری از wrap چند دکمه در ستون عملیات */
.neo-grid-compact .k-table-row .k-table-td {
    white-space: nowrap;
}

/* ── Account hierarchy row styles ── */
.account-row-group {
    background-color: #EFF6FF !important;
    border-bottom: 1px solid #BFDBFE;
}

.account-row-kol {
    background-color: #F8FAFC !important;
}

/* جستجو: ردیف‌های match‌شده در نتیجه‌ی فیلتر — ancestors / descendants عادی می‌مانند */
.account-row-match {
    background-color: #FEF3C7 !important;
    box-shadow: inset 2px 0 0 #F59E0B;
}

/* ── نشانه‌گذاری وضعیت فاکتور (گزارش خرید + صفحاتِ پرداخت) ── */
/* پرداخت‌شدهٔ کامل — سبز */
.purchase-row-settled {
    background-color: #DCFCE7 !important;
    box-shadow: inset 3px 0 0 #16A34A;
}
/* تخصیصِ ناقص — آبی */
.purchase-row-partial {
    background-color: #DBEAFE !important;
    box-shadow: inset 3px 0 0 #3B82F6;
}
/* برگشت از خرید — نارنجی */
.purchase-row-return {
    background-color: #FEF3C7 !important;
    box-shadow: inset 3px 0 0 #F59E0B;
}
/* منع پرداخت — قرمز + حالت غیرفعال (در صفحاتِ پرداخت، غیرقابلِ انتخاب) */
.purchase-row-blocked {
    background-color: #FEE2E2 !important;
    box-shadow: inset 3px 0 0 #DC2626;
    opacity: .7;
}
/* منع پرداخت در گزارشِ خرید — همان قرمز، ولی بدونِ کم‌رنگیِ غیرفعال (ردیف قابلِ انتخاب می‌ماند) */
.purchase-row-blocked-report {
    background-color: #FEE2E2 !important;
    box-shadow: inset 3px 0 0 #DC2626;
}

/* ═══════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* ═══════════════════════════════════════════════════════
   LINKS & VALIDATION
   ═══════════════════════════════════════════════════════ */

a,
.btn-link {
    color: var(--neo-primary);
    text-decoration: none;
    transition: color var(--neo-transition-fast);
}

a:hover,
.btn-link:hover {
    color: var(--neo-primary-dark);
}

h1:focus:not(:focus-visible) {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 2px solid var(--neo-success);
    outline-offset: -1px;
}

.invalid {
    outline: 2px solid var(--neo-danger);
    outline-offset: -1px;
}

/* ═══════════════════════════════════════════════════════
   ACCESSIBILITY — Focus Ring, Skip Link, Reduced Motion
   ═══════════════════════════════════════════════════════ */

:focus {
    outline: none;
}

:focus-visible {
    outline: var(--neo-focus-outline);
    outline-offset: var(--neo-focus-offset, 2px);
    border-radius: var(--neo-radius-xs);
}

/* Suppress mouse-only focus on Telerik components but preserve keyboard focus
   ring (WCAG 2.4.7). Replaces the previous blanket :focus-visible removal that
   broke keyboard navigation visibility. */
.k-input:focus:not(:focus-visible),
.k-button:focus:not(:focus-visible),
.k-picker:focus:not(:focus-visible) {
    outline: none;
}

.neo-skip-link {
    position: absolute;
    top: -100px;
    inset-inline-start: var(--neo-space-2);
    z-index: var(--neo-z-toast, 1100);
    background: var(--neo-primary);
    color: var(--neo-text-inverse);
    padding: var(--neo-space-2) var(--neo-space-4);
    border-radius: var(--neo-radius-sm);
    font-weight: var(--neo-weight-semibold, 600);
    font-size: var(--neo-font-sm, 0.875rem);
    text-decoration: none;
    box-shadow: var(--neo-shadow-lg);
    transition: top var(--neo-transition-base);
}

.neo-skip-link:focus,
.neo-skip-link:focus-visible {
    top: var(--neo-space-2);
    color: var(--neo-text-inverse);
    outline: var(--neo-focus-outline);
    outline-offset: 2px;
}

#neo-main-content:focus {
    outline: none;
}

#neo-main-content:focus-visible {
    outline: 2px dashed var(--neo-primary, #4F46E5);
    outline-offset: -6px;
    border-radius: var(--neo-radius-sm);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.neo-num-ltr {
    direction: ltr;
    unicode-bidi: embed;
    display: inline-block;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ═══════════════════════════════════════════════════════
   NEO FORM FIELD — Standardized label/hint/error wrapper
   ═══════════════════════════════════════════════════════ */

.neo-form-field {
    display: flex;
    flex-direction: column;
    gap: var(--neo-space-1);
    margin-bottom: var(--neo-space-2);
}

.neo-form-field-label {
    font-size: var(--neo-font-sm);
    font-weight: var(--neo-weight-medium, 500);
    color: var(--neo-text-primary);
    margin-bottom: 0;
}

.neo-form-field-required {
    color: var(--neo-danger);
    margin-inline-start: 0.15rem;
    font-weight: var(--neo-weight-bold, 700);
}

.neo-form-field-hint {
    color: var(--neo-text-muted);
    font-size: var(--neo-font-xs);
    line-height: var(--neo-leading-normal, 1.5);
}

.neo-form-field-error {
    color: var(--neo-danger);
    font-size: var(--neo-font-xs);
    line-height: var(--neo-leading-normal, 1.5);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* هشدارِ غیرمسدودکننده زیرِ یک فیلد — «مشکوک است ولی ذخیره را نمی‌بندد».
   جایگاهش بینِ hint (خاکستریِ خنثی) و error (قرمزِ مسدودکننده) است، پس رنگِ
   کهربایی می‌گیرد و مثل error هم نیست تا کاربر فکر نکند ثبت رد می‌شود.
   نخستین مصرف‌کننده: رقمِ کنترلیِ کد ملی در فرمِ «ویرایش شخص» (ردیفِ G06). */
.neo-form-field-warning {
    display: block;
    color: var(--neo-warning-text, var(--neo-warning));
    font-size: var(--neo-font-xs);
    line-height: var(--neo-leading-normal, 1.5);
    margin-top: 2px;
}

/* ── هم‌ترازیِ دکمه با کنترلِ کناری ───────────────────────────────────────────
   مسئله: یک ستونِ فقط-دکمه که با align-items:flex-end به کفِ ردیف می‌چسبد،
   وقتی فیلدِ کناری Hint دارد یک خط پایین‌تر می‌افتد — چون کفِ ستون خطِ متنِ
   راهنماست، نه خطِ کنترل. پیش از ۲۰۲۶-۰۸-۲۸ این کار پنج‌جور مختلف انجام شده بود
   (u-items-end · d-flex align-items-end · align-items:end · margin-top جادویی ·
   هیچ‌چیز) و سه‌تایشان غلط بود.

   راه‌حل: دکمه داخلِ خودِ فیلد و کنارِ کنترل بنشیند. آن‌وقت هم‌ترازی به ارتفاعِ
   برچسب یا راهنما وابسته نیست و با برچسبِ دوخطی هم نمی‌شکند. */
.neo-field-inline-action {
    display: flex;
    align-items: center;
    gap: var(--neo-space-2);
}

    /* کنترل فضای باقی‌مانده را می‌گیرد، دکمه به اندازهٔ خودش می‌ماند. */
    .neo-field-inline-action > :first-child {
        flex: 1 1 auto;
        min-width: 0;
    }

    .neo-field-inline-action > :last-child {
        flex: 0 0 auto;
    }

/* برای ستونِ فقط-دکمه‌ای که کنارِ یک NeoFormFieldِ بدونِ Hint می‌نشیند:
   جبرانِ margin-bottom خودِ فیلد، وگرنه دکمه به همان اندازه پایین‌تر می‌افتد. */
.neo-field-action-end {
    display: flex;
    align-items: flex-end;
    padding-bottom: var(--neo-space-2);
}

.neo-form-field.has-error .k-input,
.neo-form-field.has-error .k-picker,
.neo-form-field.has-error .k-dropdownlist {
    border-color: var(--neo-danger) !important;
}

/* ═══════════════════════════════════════════════════════
   NEO BOTTOM NAVIGATION (mobile only — < 768px)
   ═══════════════════════════════════════════════════════ */

.neo-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    background: var(--neo-bg-card);
    border-top: 1px solid var(--neo-border);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    z-index: var(--neo-z-sticky, 100);
    padding: 4px 0 max(4px, env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: stretch;
    min-height: 56px;
}

@media (max-width: 767.98px) {
    .neo-bottom-nav {
        display: flex;
    }

    /* leave room above bottom-nav so content isn't hidden */
    .main-content,
    .content,
    main.content {
        padding-bottom: calc(56px + env(safe-area-inset-bottom)) !important;
    }
}

.neo-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;
    color: var(--neo-text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: var(--neo-weight-medium, 500);
    transition: color var(--neo-transition-fast), background var(--neo-transition-fast);
    border-radius: var(--neo-radius-sm);
    min-height: 44px;
}

.neo-bottom-nav-item .k-svg-icon,
.neo-bottom-nav-item svg {
    width: 22px;
    height: 22px;
}

.neo-bottom-nav-item:hover,
.neo-bottom-nav-item:focus-visible {
    color: var(--neo-primary);
    background: var(--neo-primary-bg);
}

.neo-bottom-nav-item.active {
    color: var(--neo-primary);
    background: var(--neo-primary-bg);
}

.neo-bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 25%;
    inset-inline-end: 25%;
    height: 3px;
    background: var(--neo-primary);
    border-radius: 0 0 var(--neo-radius-sm) var(--neo-radius-sm);
}

.neo-bottom-nav-item {
    position: relative;
}

/* ═══════════════════════════════════════════════════════
   NEO COMMAND PALETTE (Ctrl+K)
   ═══════════════════════════════════════════════════════ */

.neo-command-palette-dialog .k-dialog {
    border-radius: var(--neo-radius-lg);
    overflow: hidden;
}

.neo-command-palette-dialog .k-dialog-titlebar { display: none; }
.neo-command-palette-dialog .k-dialog-content { padding: 0 !important; }

.neo-cp-header {
    display: flex;
    align-items: center;
    gap: var(--neo-space-2);
    padding: var(--neo-space-3) var(--neo-space-4);
    border-bottom: 1px solid var(--neo-border);
    background: var(--neo-bg-card);
}

.neo-cp-header .k-svg-icon { color: var(--neo-text-muted); flex-shrink: 0; }

.neo-cp-search {
    flex: 1;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--neo-text-primary);
    font-size: var(--neo-font-base);
    font-family: inherit;
}

.neo-cp-search::placeholder { color: var(--neo-text-muted); }

.neo-cp-kbd,
.neo-cp-footer kbd {
    background: var(--neo-bg-subtle);
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-xs);
    padding: 2px 6px;
    font-size: var(--neo-font-xs);
    color: var(--neo-text-muted);
    font-family: 'IRANSansX', monospace;
}

.neo-cp-results {
    max-height: 60vh;
    overflow-y: auto;
    padding: var(--neo-space-2);
}

.neo-cp-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--neo-space-2);
    color: var(--neo-text-muted);
    padding: var(--neo-space-6);
    font-size: var(--neo-font-sm);
}

.neo-cp-item {
    display: flex;
    align-items: center;
    gap: var(--neo-space-3);
    width: 100%;
    padding: var(--neo-space-2) var(--neo-space-3);
    border: 0;
    background: transparent;
    text-align: start;
    border-radius: var(--neo-radius-sm);
    color: var(--neo-text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: var(--neo-font-sm);
    transition: background var(--neo-transition-fast);
}

.neo-cp-item.selected,
.neo-cp-item:hover,
.neo-cp-item:focus-visible {
    background: var(--neo-primary-bg);
    color: var(--neo-primary);
}

.neo-cp-item .k-svg-icon {
    width: 18px;
    height: 18px;
    color: var(--neo-text-muted);
    flex-shrink: 0;
}

.neo-cp-item.selected .k-svg-icon,
.neo-cp-item:hover .k-svg-icon {
    color: var(--neo-primary);
}

.neo-cp-item-title {
    font-weight: var(--neo-weight-medium, 500);
    flex-shrink: 0;
}

.neo-cp-item-subtitle {
    color: var(--neo-text-muted);
    font-size: var(--neo-font-xs);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.neo-cp-item-group {
    background: var(--neo-bg-subtle);
    color: var(--neo-text-secondary);
    font-size: var(--neo-font-xs);
    padding: 2px 8px;
    border-radius: var(--neo-radius-full);
    flex-shrink: 0;
}

.neo-cp-footer {
    display: flex;
    gap: var(--neo-space-4);
    padding: var(--neo-space-2) var(--neo-space-4);
    border-top: 1px solid var(--neo-border);
    background: var(--neo-bg-subtle);
    color: var(--neo-text-muted);
    font-size: var(--neo-font-xs);
}

.neo-cp-footer span {
    display: inline-flex;
    align-items: center;
    gap: var(--neo-space-1);
}

/* Topbar trigger button */
.neo-cp-trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--neo-space-2);
    background: var(--neo-bg-subtle);
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-md);
    padding: 6px 12px;
    color: var(--neo-text-muted);
    font-size: var(--neo-font-sm);
    cursor: pointer;
    transition: all var(--neo-transition-fast);
}

.neo-cp-trigger:hover {
    background: var(--neo-primary-bg);
    border-color: var(--neo-primary-border);
    color: var(--neo-primary);
}

.neo-cp-trigger kbd {
    background: var(--neo-bg-card);
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-xs);
    padding: 1px 6px;
    font-size: 0.7rem;
    font-family: monospace;
}

@media (max-width: 767.98px) {
    .neo-cp-trigger-text { display: none; }
}

/* ═══════════════════════════════════════════════════════
   MOBILE GRID — Compact mode + horizontal scroll polish
   ═══════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
    /* Reduce inner padding to fit more content */
    .neo-rtl-grid .k-grid .k-table-th,
    .neo-rtl-grid .k-grid .k-table-td {
        padding: 6px 8px !important;
        font-size: var(--neo-font-xs);
    }

    /* Toolbar stacks vertically with tight spacing */
    .neo-rtl-grid .k-grid-toolbar {
        flex-wrap: wrap;
        gap: 4px;
        padding: 6px;
    }

    .neo-rtl-grid .k-grid-toolbar .k-textbox,
    .neo-rtl-grid .k-grid-toolbar .neo-grid-title {
        flex: 1 1 100%;
        min-width: 0;
    }

    /* Hide toolbar spacer on mobile (let buttons wrap naturally) */
    .neo-rtl-grid .k-grid-toolbar .k-toolbar-spacer {
        display: none;
    }

    /* Visual hint: grid content scrolls horizontally */
    .neo-rtl-grid .k-grid-content {
        scrollbar-width: thin;
    }

    /* StatCard grids stack tighter */
    .neo-stat-grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--neo-space-2) !important;
    }
}

@media (max-width: 480px) {
    .neo-stat-grid-4 {
        grid-template-columns: 1fr !important;
    }

    /* Page header: title + buttons stack */
    .neo-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--neo-space-2);
    }

    .neo-page-header-toolbar {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    /* Compact buttons */
    .neo-page-header-toolbar .neo-btn {
        font-size: var(--neo-font-xs);
        padding: 6px 10px;
    }
}

/* ═══════════════════════════════════════════════════════
   NEO SIDE SHEET (drawer for edit-without-navigation)
   ═══════════════════════════════════════════════════════ */

.neo-side-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: var(--neo-z-overlay, 900);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--neo-transition-base);
}

.neo-side-sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.neo-side-sheet {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    width: min(560px, 92vw);
    background: var(--neo-bg-card);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: var(--neo-z-modal, 1000);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

[dir="rtl"] .neo-side-sheet {
    transform: translateX(100%);
}

.neo-side-sheet.open {
    transform: translateX(0);
}

.neo-side-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--neo-space-4);
    border-bottom: 1px solid var(--neo-border);
    background: var(--neo-bg-elevated);
}

.neo-side-sheet-title {
    margin: 0;
    font-size: var(--neo-font-lg);
    font-weight: var(--neo-weight-semibold, 600);
    color: var(--neo-text-primary);
    display: flex;
    align-items: center;
    gap: var(--neo-space-2);
}

.neo-side-sheet-close {
    background: transparent;
    border: 0;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--neo-radius-sm);
    color: var(--neo-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--neo-transition-fast);
}

.neo-side-sheet-close:hover,
.neo-side-sheet-close:focus-visible {
    background: var(--neo-bg-subtle);
    color: var(--neo-text-primary);
}

.neo-side-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--neo-space-4);
}

.neo-side-sheet-footer {
    display: flex;
    gap: var(--neo-space-2);
    justify-content: flex-end;
    padding: var(--neo-space-3) var(--neo-space-4);
    border-top: 1px solid var(--neo-border);
    background: var(--neo-bg-elevated);
}

@media (max-width: 480px) {
    .neo-side-sheet {
        width: 100vw;
    }
}

.neo-menu-divider {
    border: 0;
    border-top: 1px solid var(--neo-border);
    margin: 4px 0;
}

/* ═══════════════════════════════════════════════════════
   MOBILE CARD VIEW — alternative grid layout for very small screens
   Use class .neo-cards-on-mobile on a Telerik grid container.
   The grid renders as horizontally-stacked rows; on mobile,
   each row stacks vertically into a card-like layout.
   ═══════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .neo-cards-on-mobile .k-grid-header,
    .neo-cards-on-mobile .k-filter-row {
        display: none !important;
    }

    .neo-cards-on-mobile .k-grid-content,
    .neo-cards-on-mobile .k-grid-table {
        overflow: visible !important;
    }

    .neo-cards-on-mobile .k-grid-table-wrap {
        overflow: visible !important;
    }

    /* ⚠ اندازه‌گیری‌شده روی DOMِ واقعی: بدونِ این سه قاعده عرضِ کارت از <colgroup>ِ جدول
       می‌آمد، یعنی برابرِ عرضِ ستونِ اولِ همان گرید (۱۶۰px در تراز و دفتر کل، ۱۹۰px در
       چک‌ها، ۲۸۰px در اشخاص) و مستقل از عرضِ صفحه — کارت روی هر سه عرضِ ۳۶۰/۳۹۰/۴۸۰
       یک اندازه می‌شد. جدول با table-layout: fixed عرضش را از colgroup می‌گیرد نه از ظرف،
       پس هر سه سطح باید از چیدمانِ table بیرون بیایند و colgroup بی‌اثر شود.
       همان الگوی neo-tree-on-mobile پایین‌ترِ همین فایل. */
    .neo-cards-on-mobile colgroup {
        display: none !important;
    }

    .neo-cards-on-mobile .k-grid-table {
        display: block !important;
        width: 100% !important;
        table-layout: auto !important;
    }

    .neo-cards-on-mobile .k-table-tbody {
        display: block !important;
        width: 100% !important;
    }

    .neo-cards-on-mobile tr.k-table-row {
        display: block !important;
        width: 100% !important;
        margin-bottom: var(--neo-space-3);
        border: 1px solid var(--neo-border) !important;
        border-radius: var(--neo-radius-md) !important;
        background: var(--neo-bg-card) !important;
        box-shadow: var(--neo-shadow-sm);
        overflow: hidden;
    }

    .neo-cards-on-mobile tr.k-table-row.k-selected,
    .neo-cards-on-mobile tr.k-table-row:hover {
        background: var(--neo-primary-bg) !important;
        border-color: var(--neo-primary-border) !important;
    }

    .neo-cards-on-mobile td.k-table-td {
        display: block !important;
        /* box-sizing لازم است: بدونش پدینگِ ۲۴px به width: 100% اضافه می‌شد و سلول ۲۳px از
           کارتِ خودش عریض‌تر می‌شد؛ کارت overflow: hidden دارد، پس لبهٔ سلولِ «کد» و
           دکمه‌های ستونِ «عملیات» بریده می‌شدند (اندازه‌گیری‌شده). */
        box-sizing: border-box !important;
        width: 100% !important;
        text-align: start !important;
        padding: 8px 12px !important;
        border: 0 !important;
        border-bottom: 1px solid var(--neo-border-light) !important;
    }

    .neo-cards-on-mobile td.k-table-td:last-child {
        border-bottom: 0 !important;
    }

    /* Each cell prefixed with column header via data-title */
    .neo-cards-on-mobile td.k-table-td::before {
        content: attr(data-title);
        display: inline-block;
        min-width: 80px;
        font-weight: var(--neo-weight-semibold, 600);
        color: var(--neo-text-muted);
        font-size: var(--neo-font-xs);
        margin-inline-end: var(--neo-space-2);
    }
}

/* Quick View inside SideSheet */
.neo-quickview-header {
    display: flex;
    align-items: center;
    gap: var(--neo-space-3);
    padding-bottom: var(--neo-space-4);
    border-bottom: 1px solid var(--neo-border);
    margin-bottom: var(--neo-space-4);
}

.neo-quickview-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--neo-radius-full);
    background: var(--neo-primary-bg);
    color: var(--neo-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.neo-quickview-list {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: var(--neo-space-2) var(--neo-space-4);
    margin: 0;
    font-size: var(--neo-font-sm);
}

.neo-quickview-list dt {
    color: var(--neo-text-muted);
    font-weight: var(--neo-weight-medium, 500);
}

.neo-quickview-list dd {
    color: var(--neo-text-primary);
    margin: 0;
    word-break: break-word;
}

.validation-message {
    color: var(--neo-danger);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.blazor-error-boundary {
    background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
    padding: 1rem 1.5rem;
    color: white;
    border-radius: var(--neo-radius-md);
    margin: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ═══════════════════════════════════════════════════════
   PAGE SHELL & LAYOUT
   ═══════════════════════════════════════════════════════ */

.neo-page-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--neo-bg-page);
    min-height: calc(100vh - var(--neo-topbar-height));
    animation: neo-fadeIn 0.3s ease-out;
}

@keyframes neo-fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Page Header ── */
.neo-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.neo-page-header-top {
    width: 100%;
}

.neo-page-header-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
    width: 100%;
}

.neo-page-header-info {
    flex: 1;
    min-width: 0;
}

.neo-page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.neo-page-header-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.neo-page-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--neo-text-primary);
    letter-spacing: -0.01em;
}

.neo-page-subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: var(--neo-text-muted);
}

/* ═══════════════════════════════════════════════════════
   SURFACE / CARD
   ═══════════════════════════════════════════════════════ */

.neo-surface {
    padding:10px 30px;
    background: var(--neo-bg-card);
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-md);
    box-shadow: var(--neo-shadow-card);
    overflow: hidden;
    transition: box-shadow var(--neo-transition-base);
}

.neo-surface:hover {
    box-shadow: var(--neo-shadow-sm);
}

.neo-form-surface {
    padding: 1.25rem;
}

/* ── Glass Surface ── */
.neo-glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ── Stat Card ── */
.neo-stat-card {
    background: var(--neo-bg-card);
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all var(--neo-transition-base);
    box-shadow: var(--neo-shadow-card);
}

.neo-stat-card:hover {
    box-shadow: var(--neo-shadow-md);
    transform: translateY(-2px);
}

.neo-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--neo-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.neo-stat-icon svg {
    width: 24px;
    height: 24px;
}

.neo-stat-icon-primary {
    background: var(--neo-primary-bg);
    color: var(--neo-primary);
}

.neo-stat-icon-success {
    background: var(--neo-success-bg);
    color: var(--neo-success);
}

.neo-stat-icon-warning {
    background: var(--neo-warning-bg);
    color: var(--neo-warning);
}

.neo-stat-icon-info {
    background: var(--neo-info-bg);
    color: var(--neo-info);
}

.neo-stat-icon-danger {
    background: var(--neo-danger-bg);
    color: var(--neo-danger);
}

.neo-stat-content {
    flex: 1;
    min-width: 0;
}

.neo-stat-label {
    font-size: 0.8rem;
    color: var(--neo-text-muted);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.neo-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--neo-text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.neo-stat-change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--neo-radius-full);
}

.neo-stat-change-up {
    background: var(--neo-success-bg);
    color: var(--neo-success);
}

.neo-stat-change-down {
    background: var(--neo-danger-bg);
    color: var(--neo-danger);
}

/* ── Loan Progress Bar (داشبوردِ تسهیلات) ──
   ⚠ از neo-pages.css:1032-1046 آمده — فایلی که App.razor هرگز لود نمی‌کند. تا پیش از
   این، markup در LoanDashboard.razor:151 هر دو کلاس را می‌زد ولی هیچ تعریفی وجود نداشت
   ⇒ نوار یک فضای ۸ پیکسلیِ کاملاً نامرئی بود و «چند درصد از وام پرداخت شده» فقط به‌صورت
   عددِ متنی کنارش دیده می‌شد.
   ⚠ خطِ `margin-inline-start: auto` تعریفِ اصلی عمداً برداشته شد: در RTL معنایش
   margin-right:auto است، یعنی نوار به لبهٔ چپ می‌چسبید و از چپ رشد می‌کرد — برعکسِ
   انتظار در صفحهٔ راست‌به‌چپ. حالا از سمتِ راست (شروعِ خط) پر می‌شود.
   ⚠ رنگِ track از --neo-border-light به --neo-border تغییر کرد: اولی #F1F5F9 است و روی
   پس‌زمینهٔ سفیدِ گرید عملاً دیده نمی‌شد. مقدارِ fallbackِ خودِ تعریفِ اصلی (#e2e8f0)
   دقیقاً همان --neo-border است، پس این همان رنگی است که نویسنده در نظر داشته. */
.neo-loan-progress-track {
    width: 100%;
    height: 8px;
    background: var(--neo-border);
    border-radius: var(--neo-radius-full);
    overflow: hidden;
}

.neo-loan-progress-fill {
    height: 100%;
    border-radius: var(--neo-radius-full);
    background: linear-gradient(90deg, var(--neo-primary), var(--neo-primary-lighter));
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════════════════
   ACCOUNT TREE (گریدِ سلسله‌مراتبیِ سرفصل حساب‌ها)

   گرید همان TelerikGrid است، نه TreeList: کلِ CSSِ گریدِ این پروژه به .k-grid* می‌چسبد و
   با TreeList باید یک مجموعهٔ موازی ساخته می‌شد. ساختار از Depth (تورفتگی) و دکمهٔ +/−
   می‌آید که صفحه در ستونِ اول رندر می‌کند.
   ═══════════════════════════════════════════════════════ */

.neo-tree-cell {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.neo-tree-toggle {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    line-height: 1;
    padding: 0;
    box-sizing: border-box;
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-xs);
    background: var(--neo-bg-card);
    color: var(--neo-text-secondary);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.neo-tree-toggle:hover {
    border-color: var(--neo-primary);
    color: var(--neo-primary);
}

/* برگ‌ها دکمه ندارند ولی باید هم‌تراز با گره‌های بازشو بمانند. */
.neo-tree-toggle-spacer {
    flex-shrink: 0;
    width: 18px;
}

.neo-tree-code {
    flex-shrink: 0;
    direction: ltr;
    font-variant-numeric: tabular-nums;
}

.neo-tree-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* وزن و رنگِ سطوح — همان قصدِ کلاس‌های neo-account-* که تعریفشان در شیتِ لودنشده مانده بود.
   تورفتگی دیگر از کلاس نمی‌آید (از Depth می‌آید)، پس فقط وزن و رنگ ماند.
   ⚠ سطحِ ۲ با --neo-primary-dark نوشته شده نه --neo-primary-hover: دومی فقط در
   neo-design-tokens.css تعریف شده که App.razor لودش نمی‌کند. مقدارِ هر دو #4338CA است. */
.neo-tree-l1 { font-weight: 700; color: var(--neo-primary); }
.neo-tree-l2 { font-weight: 600; color: var(--neo-primary-dark); }
.neo-tree-sub { color: var(--neo-text-secondary); }

.neo-account-tree .account-row-subsidiary { background: rgba(5, 150, 105, 0.03); }

/* نشانِ تفصیلیِ مشترک — رابطهٔ تفصیلی-معین چندبه‌چند است. */
.neo-tree-shared {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.05rem 0.4rem;
    border-radius: var(--neo-radius-full);
    background: var(--neo-warning-bg);
    color: var(--neo-warning);
    border: 1px solid var(--neo-warning-border);
    cursor: help;
}

/* ── موبایل: فقط ستونِ درخت ──
   نمای کارتیِ neo-cards-on-mobile برای این گرید مناسب نیست (ردیف‌ها را عمودی می‌چیند و
   ساختارِ درخت را نابود می‌کند). به‌جایش بقیهٔ ستون‌ها پنهان می‌شوند و جزئیاتشان با ضربه
   روی ردیف در کشوی پایین باز می‌شود. همان breakpointِ ۴۸۰px که نمای کارتی استفاده می‌کند. */
@media (max-width: 480px) {
    /* ⚠ نسخهٔ اولِ این بلوک صفحه را روی موبایل خالی می‌کرد: فقط سلول‌ها display:none
       شدند ولی چیدمانِ table دست‌نخورده ماند. عرضِ ستون در Telerik از <colgroup> می‌آید
       نه از td، پس جدول همان ~۹۵۰px عریض باقی ماند و ظرفِ برنده پنجرهٔ ۳۹۰px را روی
       ناحیهٔ خالی نگه داشت. راه‌حل همان الگوی جاافتادهٔ neo-cards-on-mobile است:
       ردیف باید از چیدمانِ table بیرون بیاید تا colgroup بی‌اثر شود. */

    /* کلِ سرستون پنهان می‌شود، نه هر th جدا — همان کاری که نمای کارتی می‌کند. */
    .neo-tree-on-mobile .k-grid-header,
    .neo-tree-on-mobile .k-filter-row {
        display: none !important;
    }

    /* ظرف‌های Telerik محتوا را می‌بُرند؛ بدونِ این سه، ردیفِ بلوکی دیده نمی‌شود. */
    .neo-tree-on-mobile .k-grid-content,
    .neo-tree-on-mobile .k-grid-table,
    .neo-tree-on-mobile .k-grid-table-wrap {
        overflow: visible !important;
    }

    /* ⚠ اندازه‌گیری روی DOMِ واقعی نشان داد block کردنِ تنهای tr کافی نیست: ردیف عرضِ
       صفر می‌گیرد چون tbody هنوز table-row-group است، و جدول با table-layout: fixed
       عرضش را از <colgroup> (جمعاً ۹۵۰px) می‌گیرد نه از ظرفِ ۳۰۴ پیکسلی. پس هر سه سطح
       باید از چیدمانِ table بیرون بیایند و colgroup بی‌اثر شود. */
    .neo-tree-on-mobile colgroup {
        display: none !important;
    }

    .neo-tree-on-mobile .k-grid-table {
        display: block !important;
        width: 100% !important;
        table-layout: auto !important;
    }

    .neo-tree-on-mobile .k-table-tbody {
        display: block !important;
        width: 100% !important;
    }

    .neo-tree-on-mobile tr.k-table-row {
        display: block !important;
        width: 100% !important;
        border-bottom: 1px solid var(--neo-border-light) !important;
    }

    /* از هر ردیف فقط ستونِ درخت می‌ماند؛ بقیه در کشوی جزئیات دیده می‌شوند. */
    .neo-tree-on-mobile td.k-table-td {
        display: none !important;
    }

    .neo-tree-on-mobile td.k-table-td:first-child {
        display: block !important;
        /* box-sizing لازم است: بدونش padding به width: 100% اضافه می‌شد و سلول ۲۰px از
           ردیفِ خودش عریض‌تر می‌شد (اندازه‌گیری‌شده). */
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: none !important;
        border: 0 !important;
        padding: 8px 10px !important;
        white-space: normal !important;
    }

    /* نامِ بلندِ حساب روی صفحهٔ باریک باید بشکند، نه با ellipsis ناخوانا شود. */
    .neo-tree-on-mobile .neo-tree-name {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}

/* دکمهٔ «جزئیات» فقط روی موبایل معنا دارد — روی دسکتاپ همان اطلاعات در ستون‌هاست. */
.neo-tree-details {
    display: none;
}

@media (max-width: 480px) {
    .neo-tree-details {
        display: inline-flex;
        align-items: center;
        flex-shrink: 0;
        margin-inline-start: auto;
        border: 1px solid var(--neo-border);
        border-radius: var(--neo-radius-full);
        background: var(--neo-bg-card);
        color: var(--neo-primary);
        font: inherit;
        font-size: 0.7rem;
        font-weight: 600;
        padding: 0.1rem 0.55rem;
        cursor: pointer;
    }
}

/* ── کشوی جزئیاتِ ردیف ──
   markup همیشه رندر می‌شود؛ «فقط موبایل»بودن کارِ همین media query است. عمداً بدونِ JS
   interop تا سرور لازم نباشد عرضِ صفحه را بداند و کشو در prerender غلط رفتار نکند. */
.neo-row-drawer,
.neo-row-drawer-backdrop {
    display: none;
}

@media (max-width: 480px) {
    .neo-row-drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 1200;
    }

    .neo-row-drawer {
        display: block;
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: 1201;
        max-height: 82vh;
        overflow-y: auto;
        background: var(--neo-bg-card);
        border-top-left-radius: var(--neo-radius-lg);
        border-top-right-radius: var(--neo-radius-lg);
        box-shadow: var(--neo-shadow-xl);
        padding: 0.85rem 1rem 1.25rem;
    }

    .neo-row-drawer-head {
        display: flex;
        align-items: flex-start;
        gap: 0.75rem;
        padding-bottom: 0.6rem;
        border-bottom: 1px solid var(--neo-border);
    }

    .neo-row-drawer-head > div {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
    }

    .neo-row-drawer-close {
        flex-shrink: 0;
        width: 30px;
        height: 30px;
        border: 1px solid var(--neo-border);
        border-radius: var(--neo-radius-sm);
        background: var(--neo-bg-card);
        color: var(--neo-text-secondary);
        font: inherit;
        cursor: pointer;
    }

    .neo-row-drawer-list {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 0.35rem 0.85rem;
        margin: 0.75rem 0 0;
        font-size: 0.86rem;
    }

    .neo-row-drawer-list dt {
        color: var(--neo-text-muted);
        font-weight: 600;
    }

    .neo-row-drawer-list dd {
        margin: 0;
    }

    .neo-row-drawer-shared {
        margin-top: 0.9rem;
        padding-top: 0.7rem;
        border-top: 1px solid var(--neo-border);
    }

    .neo-row-drawer-shared-title {
        font-size: 0.8rem;
        font-weight: 700;
        color: var(--neo-text-secondary);
        margin-bottom: 0.45rem;
    }

    .neo-row-drawer-warn {
        font-size: 0.78rem;
        background: var(--neo-warning-bg);
        color: var(--neo-warning);
        border: 1px solid var(--neo-warning-border);
        border-radius: var(--neo-radius-sm);
        padding: 0.4rem 0.6rem;
        margin-bottom: 0.5rem;
    }

    .neo-row-drawer-shared-row {
        display: flex;
        gap: 0.6rem;
        align-items: center;
        font-size: 0.84rem;
        padding: 0.22rem 0;
    }

    .neo-row-drawer-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 1rem;
        padding-top: 0.8rem;
        border-top: 1px solid var(--neo-border);
    }
}

/* ═══════════════════════════════════════════════════════
   CONTEXT BAR
   ═══════════════════════════════════════════════════════ */

.neo-context-bar {
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    border: 1px solid #C7D2FE;
    border-radius: var(--neo-radius-sm);
    color: #312E81;
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ═══════════════════════════════════════════════════════
   REPORT DATE-RANGE GROUP
   ═══════════════════════════════════════════════════════ */

.rpt-date-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rpt-date-range:not(:last-child) {
    padding-left: 1rem;
    border-left: 1px solid var(--neo-border-light);
}

/* ═══════════════════════════════════════════════════════
   GRID TOOLBAR & STATUS
   ═══════════════════════════════════════════════════════ */

.neo-grid-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--neo-border-light);
    background: var(--neo-bg-subtle);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.neo-grid-toolbar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Action Group (grouped buttons with separators) ── */
.neo-action-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.neo-action-section {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.neo-action-section + .neo-action-section {
    padding-inline-start: 0.4rem;
    border-inline-start: 1px solid var(--neo-border-light, #E2E8F0);
}

.neo-grid-toolbar-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.neo-grid-statusbar {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--neo-text-muted);
    border-top: 1px solid var(--neo-border-light);
    background: var(--neo-bg-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.neo-grid-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--neo-text-secondary);
}

.neo-badge-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ── Delete Dialog ── */
.neo-delete-dialog-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.neo-delete-dialog-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--neo-danger-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.neo-delete-dialog-title {
    margin: 0;
    font-weight: 600;
}

.neo-delete-dialog-detail {
    margin: 0.25rem 0 0;
    color: var(--neo-text-muted);
    font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════
   TOOLBAR
   ═══════════════════════════════════════════════════════ */

.neo-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════
   STATE MESSAGES
   ═══════════════════════════════════════════════════════ */

.neo-loading-state,
.neo-empty-state,
.neo-info-state,
.neo-error-state {
    margin: 1rem;
    border-radius: var(--neo-radius-sm);
    padding: 1rem 1.25rem;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* ⚠ neo-info-state در ۹ جا (۶ فایل) استفاده می‌شد ولی در هیچ stylesheetی تعریف
   نشده بود، پس آن کادرها به‌صورتِ متنِ خام و بی‌استایل رندر می‌شدند.
   تعریف عیناً از روی خواهرِ اطلاع‌رسانش (neo-loading-state) ساخته شده، بدونِ اسپینر. */
.neo-info-state {
    background: var(--neo-info-bg);
    border: 1px solid var(--neo-info-border);
    color: var(--neo-info);
}

.neo-loading-state {
    background: var(--neo-info-bg);
    border: 1px solid var(--neo-info-border);
    color: var(--neo-info);
}

.neo-loading-state::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid var(--neo-info-border);
    border-top-color: var(--neo-info);
    border-radius: 50%;
    animation: neo-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes neo-spin {
    to { transform: rotate(360deg); }
}

.neo-empty-state {
    background: var(--neo-bg-subtle);
    border: 1px dashed #CBD5E1;
    color: var(--neo-text-muted);
    justify-content: center;
    padding: 2rem;
}

.neo-error-state {
    background: var(--neo-danger-bg);
    border: 1px solid var(--neo-danger-border);
    color: var(--neo-danger);
}

/* ═══════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════ */

.neo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1.15rem;
    border-radius: var(--neo-radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--neo-transition-fast);
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.neo-btn:active {
    transform: scale(0.97);
}

.neo-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.neo-btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.82rem;
    border-radius: var(--neo-radius-xs);
}

.neo-btn-lg {
    padding: 0.65rem 1.5rem;
    font-size: 0.95rem;
}

.neo-btn-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Primary */
.neo-btn-primary {
    background: linear-gradient(135deg, var(--neo-primary) 0%, var(--neo-primary-light) 100%);
    color: var(--neo-text-inverse);
    border-color: var(--neo-primary);
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

.neo-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--neo-primary-light) 0%, var(--neo-primary-lighter) 100%);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

/* Outline */
.neo-btn-outline {
    background: var(--neo-bg-card);
    color: var(--neo-text-secondary);
    border-color: var(--neo-border);
}

.neo-btn-outline:hover:not(:disabled) {
    background: var(--neo-bg-subtle);
    border-color: #CBD5E1;
    color: var(--neo-text-primary);
}

/* Danger Outline */
.neo-btn-danger-outline {
    background: var(--neo-bg-card);
    color: var(--neo-danger);
    border-color: var(--neo-danger-border);
}

.neo-btn-danger-outline:hover:not(:disabled) {
    background: var(--neo-danger-bg);
    border-color: var(--neo-danger);
}

/* Ghost */
.neo-btn-ghost {
    background: transparent;
    color: var(--neo-text-muted);
    border-color: transparent;
}

.neo-btn-ghost:hover:not(:disabled) {
    background: var(--neo-bg-subtle);
    color: var(--neo-text-secondary);
}

/* Success */
.neo-btn-success {
    background: linear-gradient(135deg, var(--neo-success) 0%, #10B981 100%);
    color: var(--neo-text-inverse);
    border-color: var(--neo-success);
    box-shadow: 0 1px 3px rgba(5, 150, 105, 0.3);
}

.neo-btn-success:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
    transform: translateY(-1px);
}

/* Danger (solid) */
.neo-btn-danger {
    background: linear-gradient(135deg, var(--neo-danger) 0%, #EF4444 100%);
    color: var(--neo-text-inverse);
    border-color: var(--neo-danger);
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3);
}

.neo-btn-danger:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
    transform: translateY(-1px);
}

/* Warning (solid) */
.neo-btn-warning {
    background: linear-gradient(135deg, var(--neo-warning) 0%, #F59E0B 100%);
    color: var(--neo-text-inverse);
    border-color: var(--neo-warning);
    box-shadow: 0 1px 3px rgba(217, 119, 6, 0.3);
}

.neo-btn-warning:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
    transform: translateY(-1px);
}

/* Link */
.neo-btn-link {
    display: inline;
    background: none;
    border: none;
    padding: 0;
    color: var(--neo-primary);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

.neo-btn-link:hover {
    text-decoration: underline;
    color: var(--neo-primary-light);
}

/* Primary Outline — main constructive actions (Save, Create, Submit, Load) */
.neo-btn-primary-outline {
    background: var(--neo-bg-card);
    color: var(--neo-primary);
    border-color: var(--neo-primary-border);
}

.neo-btn-primary-outline:hover:not(:disabled) {
    background: var(--neo-primary-bg);
    border-color: var(--neo-primary);
    color: var(--neo-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

/* Info Outline — informational / view / print actions */
.neo-btn-info-outline {
    background: var(--neo-bg-card);
    color: var(--neo-info);
    border-color: var(--neo-info-border);
}

.neo-btn-info-outline:hover:not(:disabled) {
    background: var(--neo-info-bg);
    border-color: var(--neo-info);
    color: var(--neo-info);
}

/* Success Outline — export / positive data actions */
.neo-btn-success-outline {
    background: var(--neo-bg-card);
    color: var(--neo-success);
    border-color: var(--neo-success-border);
}

.neo-btn-success-outline:hover:not(:disabled) {
    background: var(--neo-success-bg);
    border-color: var(--neo-success);
    color: var(--neo-success);
}

/* Warning Outline — edit / suspend / close actions */
.neo-btn-warning-outline {
    background: var(--neo-bg-card);
    color: var(--neo-warning);
    border-color: var(--neo-warning-border);
}

.neo-btn-warning-outline:hover:not(:disabled) {
    background: var(--neo-warning-bg);
    border-color: var(--neo-warning);
    color: var(--neo-warning);
}

/* ───────────────── Unified refinements ───────────────── */

.neo-btn:focus-visible {
    outline: 2px solid var(--neo-primary);
    outline-offset: 2px;
}

.neo-btn:active:not(:disabled) {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.neo-btn-sm {
    min-height: 32px;
}

.neo-btn-outline:hover:not(:disabled) {
    background: var(--neo-bg-subtle);
    border-color: var(--neo-primary);
    color: var(--neo-text-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.neo-btn-ghost:hover:not(:disabled) {
    background: var(--neo-bg-subtle);
    color: var(--neo-primary);
}

.neo-btn[aria-busy="true"] {
    pointer-events: none;
    color: transparent !important;
    position: relative;
}

.neo-btn[aria-busy="true"]::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-top-color: transparent;
    color: var(--neo-primary);
    animation: neo-btn-spin 0.7s linear infinite;
}

@keyframes neo-btn-spin {
    to { transform: rotate(360deg); }
}

.neo-btn-group {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    border-radius: var(--neo-radius-sm);
    overflow: hidden;
    border: 1px solid var(--neo-border);
    background: var(--neo-bg-card);
}

.neo-btn-group > .neo-btn {
    border-radius: 0;
    border-color: transparent;
    border-inline-end: 1px solid var(--neo-border);
    box-shadow: none;
}

.neo-btn-group > .neo-btn:last-child {
    border-inline-end: 0;
}

.neo-btn-group > .neo-btn:hover:not(:disabled) {
    box-shadow: none;
}

/* ═══════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════ */

.neo-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.65rem;
    border-radius: var(--neo-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.neo-badge-success {
    background: var(--neo-success-bg);
    color: var(--neo-success);
    border: 1px solid var(--neo-success-border);
}

.neo-badge-danger {
    background: var(--neo-danger-bg);
    color: var(--neo-danger);
    border: 1px solid var(--neo-danger-border);
}

.neo-badge-warning {
    background: var(--neo-warning-bg);
    color: var(--neo-warning);
    border: 1px solid var(--neo-warning-border);
}

.neo-badge-info {
    background: var(--neo-info-bg);
    color: var(--neo-info);
    border: 1px solid var(--neo-info-border);
}

.neo-badge-muted {
    background: var(--neo-bg-subtle);
    color: var(--neo-text-muted);
    border: 1px solid var(--neo-border);
}

.neo-badge-primary {
    background: rgba(79, 70, 229, 0.08);
    color: var(--neo-primary, #4F46E5);
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.neo-badge-secondary {
    background: var(--neo-bg-subtle);
    color: var(--neo-text-secondary);
    border: 1px solid var(--neo-border);
}

/* Pill badges (compact, rounded) */
.neo-badge-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--neo-radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
}

.neo-badge-pill-success {
    background: var(--neo-success-bg);
    color: var(--neo-success);
    border: 1px solid var(--neo-success-border);
}

.neo-badge-pill-danger {
    background: var(--neo-danger-bg);
    color: var(--neo-danger);
    border: 1px solid var(--neo-danger-border);
}

.neo-badge-pill-muted {
    background: var(--neo-bg-subtle);
    color: var(--neo-text-muted);
    border: 1px solid var(--neo-border);
}

/* ═══════════════════════════════════════════════════════
   BREADCRUMB
   ═══════════════════════════════════════════════════════ */

.neo-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
    color: var(--neo-text-muted);
}

.neo-breadcrumb-link {
    color: var(--neo-primary);
    text-decoration: none;
    transition: color var(--neo-transition-fast);
}

.neo-breadcrumb-link:hover {
    color: var(--neo-primary-dark);
    text-decoration: underline;
}

.neo-breadcrumb-sep {
    color: #CBD5E1;
}

/* ═══════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════ */

.neo-topbar {
    height: var(--neo-topbar-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--neo-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.neo-topbar-breadcrumb {
    color: var(--neo-text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.neo-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.85rem;
}

.neo-topbar-tenant {
    color: var(--neo-text-muted);
    font-size: 0.8rem;
    padding: 0.25rem 0.65rem;
    background: var(--neo-bg-subtle);
    border-radius: var(--neo-radius-full);
}

.neo-topbar-user {
    color: var(--neo-text-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.neo-topbar-btn {
    background: none;
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-sm);
    padding: 0.3rem 0.85rem;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--neo-text-secondary);
    font-family: inherit;
    font-weight: 500;
    transition: all var(--neo-transition-fast);
}

.neo-topbar-btn:hover {
    background: var(--neo-danger-bg);
    border-color: var(--neo-danger-border);
    color: var(--neo-danger);
}

.neo-topbar-select {
    min-width: 170px;
    max-width: 260px;
    height: 34px;
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-sm);
    background: var(--neo-bg-card);
    color: var(--neo-text-secondary);
    font-size: 0.82rem;
    font-family: inherit;
    padding: 0 0.6rem;
    transition: all var(--neo-transition-fast);
    cursor: pointer;
}

.neo-topbar-select:focus-visible {
    outline: none;
    border-color: var(--neo-border-focus);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* ═══════════════════════════════════════════════════════
   COLLAPSIBLE SECTIONS
   ═══════════════════════════════════════════════════════ */

.neo-collapsible {
    border: 1px solid var(--neo-border-light);
    border-radius: var(--neo-radius-sm);
    background: var(--neo-bg-card);
    padding: 0.5rem 0.75rem 0.85rem;
    margin-bottom: 0.75rem;
    transition: box-shadow var(--neo-transition-base);
}

.neo-collapsible:hover {
    box-shadow: var(--neo-shadow-xs);
}

.neo-collapsible > summary {
    cursor: pointer;
    list-style: none;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--neo-text-secondary);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    user-select: none;
    padding: 0.25rem 0;
    border-radius: var(--neo-radius-xs);
    transition: color var(--neo-transition-fast);
}

.neo-collapsible > summary::-webkit-details-marker {
    display: none;
}

.neo-collapsible > summary::before {
    content: "▸";
    color: var(--neo-text-muted);
    font-size: 0.9rem;
    transform: rotate(0deg);
    transition: transform var(--neo-transition-fast);
}

.neo-collapsible[open] > summary::before {
    transform: rotate(90deg);
}

.neo-collapsible > summary:hover {
    color: var(--neo-text-primary);
    background: var(--neo-bg-subtle);
    border-radius: var(--neo-radius-xs);
    padding-right: 0.5rem;
}

.neo-collapsible > summary:focus-visible {
    outline: 2px solid var(--neo-border-focus);
    outline-offset: 2px;
    border-radius: var(--neo-radius-xs);
}

.neo-collapsible > .row {
    margin-top: 0.4rem !important;
}

.neo-collapsible .neo-context-bar {
    margin-top: 0.4rem;
}

/* ═══════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════ */

.form-control {
    border-radius: var(--neo-radius-sm);
    border: 1px solid var(--neo-border);
    padding: 0.5rem 0.75rem;
    font-size: 0.88rem;
    transition: all var(--neo-transition-fast);
    background: var(--neo-bg-card);
    color: var(--neo-text-primary);
}

.form-control:focus {
    border-color: var(--neo-border-focus);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--neo-text-secondary);
    margin-bottom: 0.35rem;
}

/* ═══════════════════════════════════════════════════════
   PROGRESS TRACKER (for roadmap display)
   ═══════════════════════════════════════════════════════ */

.neo-progress-track {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.neo-progress-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--neo-bg-card);
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-sm);
    transition: all var(--neo-transition-base);
}

.neo-progress-item:hover {
    box-shadow: var(--neo-shadow-sm);
    border-color: #C7D2FE;
}

.neo-progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.neo-progress-dot-done {
    background: var(--neo-success);
    box-shadow: 0 0 0 3px var(--neo-success-bg);
}

.neo-progress-dot-active {
    background: var(--neo-primary);
    box-shadow: 0 0 0 3px var(--neo-primary-bg);
    animation: neo-pulse 2s infinite;
}

@keyframes neo-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); }
    50% { box-shadow: 0 0 0 6px rgba(79, 70, 229, 0.08); }
}

.neo-progress-dot-pending {
    background: #CBD5E1;
    box-shadow: 0 0 0 3px var(--neo-bg-subtle);
}

.neo-progress-text {
    flex: 1;
    font-size: 0.88rem;
    color: var(--neo-text-primary);
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════ */

.neo-login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 40%, #4338CA 100%);
    padding: 2rem;
    position: relative;
    /* ⚠ اینجا را برای رفعِ اسکرولِ /workspace عوض نکن — یک بار امتحان شد و جواب
       نداد (۲۰۲۶-۰۸-۳۱). این wrapper اصلاً محدود نیست: با min-height و بدونِ
       max-height آزادانه تا ارتفاعِ محتوا (سنجیده: 6517px برای ۷۵ کسب‌وکار) رشد
       می‌کند، پس چیزی برای اسکرول ندارد. عنصرِ خفه‌کننده `main.neo-public-content`
       در PublicLayout.razor است.
       تغییرِ اینجا به `auto` فقط ۸۰px اسکرولِ کاذب می‌سازد — دقیقاً همان
       `bottom:-80px` حبابِ تزئینیِ ::after. */
    overflow: hidden;
}

.neo-login-wrapper::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    pointer-events: none;
}

.neo-login-wrapper::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    bottom: -80px;
    left: -80px;
    pointer-events: none;
}

.neo-login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--neo-radius-xl);
    padding: 2.0rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 9999;
    animation: neo-slideUp 0.8s ease-out;
}

@keyframes neo-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.neo-login-brand {
    text-align: center;
    margin-bottom: 1rem;
}

.neo-login-logo {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--neo-primary) 0%, var(--neo-primary-lighter) 100%);
    border-radius: var(--neo-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.neo-login-logo svg {
    width: 28px;
    height: 28px;
    color: white;
}

.neo-login-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--neo-text-primary);
    margin: 0;
}

.neo-login-subtitle {
    font-size: 0.85rem;
    color: var(--neo-text-muted);
    margin: 0.3rem 0 0;
}

.neo-login-field {
    margin-bottom: 1.25rem;
}

.neo-login-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--neo-text-secondary);
    margin-bottom: 0.4rem;
}

.neo-login-field .form-control,
.neo-login-field .k-input,
.neo-login-field .k-textbox,
.neo-login-field .k-picker {
    width: 100%;
    height: 44px;
    border-radius: var(--neo-radius-sm);
    border: 1.5px solid var(--neo-border);
    background-color: #fff;
    padding: 0 0.85rem;
    font-size: 0.9rem;
    color: var(--neo-text-primary);
    transition: all var(--neo-transition-fast);
}

.neo-login-field .form-control:focus,
.neo-login-field .k-input:focus-within,
.neo-login-field .k-textbox:focus-within,
.neo-login-field .k-picker:focus-within {
    border-color: var(--neo-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* Telerik input inner element — reset browser/Telerik default borders so
   only the wrapper .k-input shows a single clean border (no inner lines). */
.neo-login-field .k-input-inner,
.neo-login-field input.k-input {
    background-color: transparent;
    color: var(--neo-text-primary);
    padding: 0;
    height: 100%;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Telerik sometimes wraps password/icon toggles that introduce extra borders */
.neo-login-field .k-input-button,
.neo-login-field .k-input-suffix,
.neo-login-field .k-input-prefix {
    border: none;
    background: transparent;
}

/* Chrome/Edge autofill — prevent ugly yellow/gray background leak */
.neo-login-field input:-webkit-autofill,
.neo-login-field input:-webkit-autofill:hover,
.neo-login-field input:-webkit-autofill:focus,
.neo-login-field input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
    -webkit-text-fill-color: var(--neo-text-primary) !important;
    transition: background-color 9999s ease-in-out 0s;
    caret-color: var(--neo-text-primary);
}

.neo-login-submit {
    width: 100%;
    height: 46px;
    border-radius: var(--neo-radius-sm);
    background: linear-gradient(135deg, var(--neo-primary) 0%, var(--neo-primary-light) 100%);
    color: white;
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--neo-transition-base);
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

.neo-login-submit:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.neo-login-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Login Messages */
.neo-login-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--neo-radius-sm);
    font-size: 0.84rem;
    margin-bottom: 1rem;
    animation: neo-fadeIn 0.3s ease-out;
}

.neo-login-message-success {
    background: var(--neo-success-bg);
    border: 1px solid var(--neo-success-border);
    color: var(--neo-success);
}

.neo-login-message-error {
    background: var(--neo-danger-bg);
    border: 1px solid var(--neo-danger-border);
    color: var(--neo-danger);
}

/* Login Spinner */
.neo-login-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: neo-spin 0.7s linear infinite;
    flex-shrink: 0;
}

/* Login Link Button */
.neo-login-link-btn {
    display: block;
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: none;
    border: none;
    color: var(--neo-primary);
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: color 0.15s ease;
}

.neo-login-link-btn:hover {
    color: var(--neo-primary-dark);
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════
   DASHBOARD WIDGETS
   ═══════════════════════════════════════════════════════ */

.neo-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.neo-stat-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.neo-stat-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.neo-widget {
    background: var(--neo-bg-card);
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-md);
    box-shadow: var(--neo-shadow-card);
    overflow: hidden;
}

.neo-widget-header {
    padding: 1rem 1.25rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.neo-widget-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--neo-text-primary);
}

.neo-widget-body {
    padding: 0.5rem 1.25rem 1.25rem;
}

/* ═══════════════════════════════════════════════════════
   QUICK ACTION GRID
   ═══════════════════════════════════════════════════════ */

.neo-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.neo-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    background: var(--neo-bg-card);
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-md);
    cursor: pointer;
    transition: all var(--neo-transition-base);
    text-decoration: none;
    color: var(--neo-text-secondary);
    text-align: center;
}

.neo-quick-action:hover {
    border-color: var(--neo-primary-lighter);
    box-shadow: var(--neo-shadow-md);
    transform: translateY(-3px);
    color: var(--neo-primary);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.02), rgba(129, 140, 248, 0.06));
}

.neo-quick-action-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--neo-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--neo-bg-subtle);
    transition: all var(--neo-transition-base);
}

.neo-quick-action:hover .neo-quick-action-icon {
    background: var(--neo-primary-bg);
}

.neo-quick-action-icon svg {
    width: 22px;
    height: 22px;
}

.neo-quick-action-label {
    font-size: 0.82rem;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════
   UTILITY HELPERS
   ═══════════════════════════════════════════════════════ */

.neo-divider {
    height: 1px;
    background: var(--neo-border);
    margin: 1rem 0;
}

.neo-text-center { text-align: center; }
.neo-text-muted { color: var(--neo-text-muted); }
.neo-text-primary { color: var(--neo-primary); }
.neo-text-success { color: var(--neo-success); }
.neo-text-danger { color: var(--neo-danger); }
.neo-text-sm { font-size: 0.82rem; }
.neo-text-xs { font-size: 0.75rem; }
.neo-font-bold { font-weight: 700; }
.neo-font-medium { font-weight: 500; }

.neo-mt-1 { margin-top: 0.5rem; }
.neo-mt-2 { margin-top: 1rem; }
.neo-mt-3 { margin-top: 1.5rem; }
.neo-mb-1 { margin-bottom: 0.5rem; }
.neo-mb-2 { margin-bottom: 1rem; }
.neo-gap-1 { gap: 0.5rem; }
.neo-gap-2 { gap: 1rem; }

/* ⚠ این پنج تا از neo-components.css:855-872 آمده‌اند — فایلی که App.razor هرگز
   لود نمی‌کند. مهاجرتِ قبلی همسایه‌هایشان (neo-gap-1، neo-mt-1) را آورد ولی
   بلوکِ display/flex و padding را جا انداخت ⇒ در BusinessManagement
   کلاس‌ها در markup بودند و هیچ اثری نداشتند؛ حتی neo-gap-1 هم بی‌اثر بود چون
   عنصرِ والد flex نمی‌شد. فقط همین پنجِ دارای مصرف آورده شد، نه کلِ بلوک. */
.neo-d-flex { display: flex; }
.neo-flex-column { flex-direction: column; }
.neo-align-center { align-items: center; }
.neo-p-1 { padding: 0.5rem; }
.neo-p-3 { padding: 1.5rem; }

/* ═══════════════════════════════════════════════════════
   FORM EDIT COMPONENTS
   ═══════════════════════════════════════════════════════ */

/* ── Section Title (icon + text header for form sections) ── */
.neo-form-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    margin-top:1rem;
    font-size:16px;
}

.neo-form-section-title span {
    font-weight: 700;
    font-size: 0.95rem;
    /* پیش‌تر color:gold هاردکد بود (از ۲۰۲۶-۰۵-۱۳). حالا از توکن تم می‌آید تا در تم
       تیره هم درست بنشیند و با بقیهٔ عناصر اصلی یکدست باشد. */
    color: var(--neo-primary);
}

    /* ── Badge Group (inline badges row) ── */
    .neo-badge-group {
        display: flex;
        gap: 0.4rem;
        margin-top: 0.35rem;
        flex-wrap: wrap;
    }

/* ── Code Input Row (LTR direction) ── */
.neo-code-input-row {
    display: flex;
    gap: 0.4rem;
    direction: ltr;
}

.neo-code-input-row > :last-child {
    flex: 1;
}

/* Code generate button (icon-only square) */
.neo-btn-icon-only {
    min-width: 38px;
    padding: 0;
}

/* Link-style button (for clickable values in grids) */
.neo-link-btn {
    border: 0;
    background: transparent;
    color: var(--neo-primary, #4F46E5);
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.neo-link-btn:hover {
    text-decoration: underline;
}

/* ── Inline Spinner (small spinner for buttons) ── */
.neo-spinner-inline {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: neo-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.neo-spinner-inline-primary {
    border-color: var(--neo-border);
    border-top-color: var(--neo-primary);
}

/* ── Required Mark ── */
.neo-required-mark {
    color: var(--neo-danger);
    margin-inline-start: 0.15rem;
}

/* ── Field Hint ── */
.neo-field-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.78rem;
    color: var(--neo-text-muted);
}

/* ── Alert Banner (neo-alert) ──
   بنرِ پیامِ درون‌صفحه‌ای. ‏۱۰ فایلِ razor این کلاس‌ها را مصرف می‌کردند بی‌آنکه جایی
   تعریف شده باشند (ردیفِ E11-b — بنرها بی‌استایل رندر می‌شدند). پایه عمداً block است
   نه flex: محتوای مصرف‌ها یکدست نیست (متنِ ساده، strong، فهرستِ ul، آیکنِ Telerik) و
   flex فهرستِ داخلِ بنرِ ChequeList را کنارِ متن می‌نشاند. margin به عهدهٔ مصرف‌کننده
   است (همه inline ست می‌کنند). رنگِ متن از توکن‌های ‎-text (AA-pass) می‌آید، نه سطحِ ۵۰۰. */
.neo-alert {
    display: block;
    padding: 0.65rem 0.9rem;
    border: 1px solid transparent;
    border-radius: var(--neo-radius-sm);
    font-size: 0.875rem;
    line-height: 1.8;
}

.neo-alert .k-svg-icon {
    vertical-align: text-bottom;
    margin-inline-end: 0.35rem;
}

.neo-alert-warning {
    background: var(--neo-warning-bg);
    border-color: var(--neo-warning-border);
    color: var(--neo-warning-text);
}

/* نامِ مصرف‌شده در صفحات error است؛ توکن‌های خانواده danger اند. */
.neo-alert-error {
    background: var(--neo-danger-bg);
    border-color: var(--neo-danger-border);
    color: var(--neo-danger-text);
}

.neo-alert-success {
    background: var(--neo-success-bg);
    border-color: var(--neo-success-border);
    color: var(--neo-success-text);
}

.neo-alert-info {
    background: var(--neo-info-bg);
    border-color: var(--neo-info-border);
    color: var(--neo-info-text);
}

/* ── Switch Row (toggle + label) ── */
.neo-switch-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 1.25rem;
    padding: 0.65rem 0.85rem;
    background: var(--neo-bg-subtle);
    border-radius: var(--neo-radius-sm);
    border: 1px solid var(--neo-border);
}

.neo-switch-label {
    font-weight: 600;
    font-size: 0.88rem;
    margin: 0;
    cursor: pointer;
    user-select: none;
}

/* ── Custom Toggle (RTL-safe replacement for TelerikSwitch) ── */
.neo-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.neo-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.neo-toggle-track {
    position: relative;
    width: 48px;
    height: 26px;
    background: #d1d5db;
    border-radius: 9999px;
    transition: background 0.25s ease;
}

.neo-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s ease;
}

.neo-toggle input:checked ~ .neo-toggle-track {
    background: var(--neo-primary);
}

.neo-toggle input:checked ~ .neo-toggle-track .neo-toggle-thumb {
    transform: translateX(22px);
}

.neo-toggle input:focus-visible ~ .neo-toggle-track {
    outline: 2px solid var(--neo-primary);
    outline-offset: 2px;
}

/* ── Role Chips ── */
.neo-role-section {
    margin-top: 1.25rem;
}

.neo-role-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.neo-role-section-header span:first-child {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--neo-text-secondary);
}

.neo-role-chips-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.neo-role-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border: 1.5px solid var(--neo-border);
    border-radius: var(--neo-radius-full);
    background: var(--neo-bg-card);
    color: var(--neo-text-secondary);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
}

.neo-role-chip:hover {
    border-color: var(--neo-primary-lighter);
    color: var(--neo-primary);
    background: rgba(79, 70, 229, 0.03);
}

/* نقشِ انتخاب‌شده — پُرشدنِ کاملِ رنگی. تخصیصِ دوتاکلاسه (0,2,0) تا از .neo-role-chip:hover
   بالاتر باشد + رنگِ hardcoded تا حتی اگر متغیر resolve نشد هم کار کند. */
.neo-role-chip.neo-role-chip-active {
    border-color: #4f46e5 !important;
    background-color: #4f46e5 !important;
    background-image: none !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.35) !important;
    font-weight: 700 !important;
}

.neo-role-chip.neo-role-chip-active svg,
.neo-role-chip.neo-role-chip-active svg path {
    color: #ffffff !important;
    fill: #ffffff !important;
}

/* علامتِ تیک قبل از نقشِ فعال */
.neo-role-chip.neo-role-chip-active::before {
    content: "✓ ";
    font-weight: 900;
    margin-inline-end: 0.2rem;
}

/* مودالِ افزودن سریعِ تفصیلی (QuickAddSubsidiaryDialog) — جایگزینِ TelerikDialog */
.neo-qad-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.neo-qad-card {
    background: var(--neo-bg-card, #fff);
    color: var(--neo-text, #111);
    border-radius: var(--neo-radius-lg, 12px);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    direction: rtl;
}
.neo-qad-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--neo-border-light, #eee);
    font-weight: 700;
    font-size: 1.05rem;
}
.neo-qad-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    color: var(--neo-text-muted, #888);
}
.neo-qad-body {
    padding: 1.25rem;
    overflow-y: auto;
}
.neo-qad-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--neo-border-light, #eee);
}

/* ═══════════════════════════════════════════════════════
   CLOSING-ENTRY DIALOG — همان الگوی neo-qad، فقط پهن‌تر

   چرا TelerikDialog نیست: محتوای RenderFragmentِ خودش را روی StateHasChangedِ میزبان
   بازرندر نمی‌کند (همان دلیلی که QuickAddSubsidiaryDialog را از آن کند). در این دیالوگ سه
   بار به همین باگ خوردیم: محتوا روی فریمِ اسپینر یخ می‌زد، وضعیتِ فعال/غیرفعالِ دکمهٔ صدور
   به‌روز نمی‌شد، و ارتفاع در زوم ۱۰۰٪ از پنجره بیرون می‌زد.

   ⚠ این قواعد عمداً در app.css است نه neo-telerik-overrides.css — آن فایل هیچ <link> و
   هیچ @import ندارد و اصلاً بارگذاری نمی‌شود (راستی‌آزماییِ ۲۰۲۶-۰۸-۱۵: صفر ارجاع در HTMLِ
   سرو‌شده). هر قاعده‌ای که آنجا نوشته شود بی‌اثر است.
   ═══════════════════════════════════════════════════════ */

.neo-closing-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.neo-closing-card {
    background: var(--neo-bg-card, #fff);
    color: var(--neo-text, #111);
    border-radius: var(--neo-radius-lg, 12px);
    width: 100%;
    max-width: 1180px;
    /* سقفِ ارتفاع روی خودِ کارت است تا سربرگ و دکمه‌ها هیچ‌وقت بیرونِ کادرِ دید نیفتند؛
       فقط بدنه جمع و اسکرول می‌شود. */
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    direction: rtl;
}

.neo-closing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--neo-border-light, #eee);
    font-weight: 700;
    font-size: 1.05rem;
    flex: 0 0 auto;
}

.neo-closing-body {
    padding: 1.25rem;
    overflow-y: auto;
    /* بدونِ min-height:0 آیتمِ flex زیرِ محتوای بلند جمع نمی‌شود و اسکرول بی‌اثر می‌ماند. */
    flex: 1 1 auto;
    min-height: 0;
}

.neo-closing-footer {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--neo-border-light, #eee);
    flex: 0 0 auto;
}

/* ═══════════════════════════════════════════════════════
   MOBILE SIDEBAR OVERLAY
   ═══════════════════════════════════════════════════════ */

.neo-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-sm);
    background: var(--neo-bg-card);
    color: var(--neo-text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--neo-transition-fast);
}

.neo-sidebar-toggle:hover {
    background: var(--neo-bg-subtle);
    color: var(--neo-text-primary);
}

.neo-sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

.neo-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 299;
    opacity: 0;
    transition: opacity var(--neo-transition-base);
    cursor: pointer;
}

.neo-sidebar-backdrop.open {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */

/* ── Tablet & Small Desktop (≤991px) ── */
@media (max-width: 991.98px) {
    .neo-sidebar-toggle {
        display: flex;
    }

    .neo-sidebar-backdrop {
        display: block;
        pointer-events: none;
    }

    .neo-sidebar-backdrop.open {
        pointer-events: auto;
    }

    .neo-topbar-actions {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .neo-topbar-tenant {
        display: none;
    }

    .neo-topbar-select {
        min-width: 130px;
        max-width: 180px;
    }

    .neo-topbar-breadcrumb {
        font-size: 0.78rem;
    }
}

/* ── Mobile (≤768px) ── */
@media (max-width: 768px) {
    .neo-page-shell {
        padding: 0.75rem;
    }

    .neo-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .neo-page-title {
        font-size: 1.15rem;
    }

    .neo-toolbar {
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .neo-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .neo-stat-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .neo-stat-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .neo-quick-actions {
        grid-template-columns: repeat(2, 1fr) !important;
    }


    /* Grid horizontal scroll on small screens */
    .neo-surface {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .neo-surface .k-grid,
    .neo-surface .k-grid-content {
        min-width: 600px;
    }

    .neo-grid-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
    }

    .neo-grid-toolbar-actions {
        justify-content: flex-start;
    }

    .neo-grid-toolbar-search {
        width: 100%;
    }

    .neo-grid-toolbar-search .k-textbox,
    .neo-grid-toolbar-search input {
        width: 100% !important;
    }

    .neo-grid-statusbar {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
    }

    .neo-grid-footer {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
    }

    /* Stat cards compact on mobile */
    .neo-stat-card {
        padding: 0.85rem;
    }

    .neo-stat-value {
        font-size: 1.25rem;
    }

    .neo-stat-icon {
        width: 40px;
        height: 40px;
    }

    /* Form fields full width on mobile */
    .neo-form-surface .row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Role chips compact on mobile */
    .neo-role-chip {
        font-size: 0.8rem;
        padding: 0.35rem 0.7rem;
    }

    /* Collapsible sections compact */
    .neo-collapsible {
        padding: 0.4rem 0.6rem 0.65rem;
    }

    /* Context bar compact */
    .neo-context-bar {
        font-size: 0.82rem;
        padding: 0.5rem 0.65rem;
    }

    /* Topbar compact */
    .neo-topbar-user-group .neo-topbar-user {
        display: none;
    }
}

/* ── Small Phone (≤480px) ── */
@media (max-width: 480px) {
    .neo-page-shell {
        padding: 0.5rem;
    }

    .neo-page-title {
        font-size: 1.05rem;
    }

    .neo-page-subtitle {
        font-size: 0.78rem;
    }

    .neo-quick-actions {
        grid-template-columns: 1fr !important;
    }

    .neo-quick-action {
        flex-direction: row;
        padding: 0.85rem;
        text-align: start;
    }

    .neo-quick-action-icon {
        width: 36px;
        height: 36px;
    }

    .neo-btn {
        font-size: 0.8rem;
        padding: 0.35rem 0.65rem;
    }

    .neo-login-card {
        border-radius: var(--neo-radius-md);
    }

    .neo-login-title {
        font-size: 1.15rem;
    }

    /* Hide less-important topbar elements */
    .neo-topbar-select {
        min-width: 110px;
        max-width: 140px;
        font-size: 0.75rem;
    }

    .neo-topbar-btn {
        padding: 0.25rem 0.55rem;
        font-size: 0.75rem;
    }

    .neo-topbar-avatar {
        width: 28px;
        height: 28px;
    }

    /* Widget compact */
    .neo-widget-header {
        padding: 0.75rem 0.85rem 0.35rem;
    }

    .neo-widget-body {
        padding: 0.35rem 0.85rem 0.85rem;
    }

    .neo-stat-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .neo-stat-grid-3 {
        grid-template-columns: 1fr;
    }

    .neo-stat-grid-4 {
        grid-template-columns: 1fr;
    }

    /* ─────────────────────────────────────────────────────
       Mobile UX fixes (Phase 1) — 2026-04-24
       فقط موبایل گوشی (≤480px)؛ Desktop/Tablet دست‌نخورده
       ───────────────────────────────────────────────────── */

    /* P1: اجازه فشردگی Grid روی گوشی (override قانون 768px) */
    .neo-surface .k-grid,
    .neo-surface .k-grid-content {
        min-width: 0 !important;
    }

    /* P2: همه TelerikDialog و TelerikWindow تمام‌صفحه */
    .k-dialog,
    .k-window {
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        max-height: 100vh !important;
    }

    .k-dialog-content,
    .k-window-content {
        padding: var(--neo-space-3) !important;
    }

    /* P4: همه input/textbox/picker داخل toolbar تمام‌عرض */
    .neo-toolbar .k-input,
    .neo-toolbar .k-textbox,
    .neo-toolbar .k-picker,
    .neo-toolbar .k-dropdownlist,
    .neo-toolbar .k-combobox,
    .neo-toolbar .k-input-solid {
        max-width: 100% !important;
        width: 100% !important;
    }

    /* P3: فشرده‌سازی Grid typography روی گوشی */
    .k-grid .k-column-title,
    .k-grid td,
    .k-grid th {
        font-size: var(--neo-font-xs);
        padding: var(--neo-space-2) var(--neo-space-1);
    }

    /* ─────────────────────────────────────────────────────
       Phase 3 — heavy-page polish (2026-04-24)
       ───────────────────────────────────────────────────── */

    /* Phase 3 — force dashboard stat grids to single column even when
       inline style hard-codes repeat(3, 1fr) / repeat(4, 1fr) */
    .neo-dashboard-grid,
    .neo-stat-grid-3,
    .neo-stat-grid-4 {
        grid-template-columns: 1fr !important;
    }

    /* Phase 3 — stack Bootstrap cols inside Telerik dialogs/windows
       (these aren't wrapped in .neo-form-surface so the 768px rule
       doesn't catch them) */
    .k-dialog .row > [class*="col-"],
    .k-window .row > [class*="col-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* ═══════════════════════════════════════════════════════
   TICKET MESSAGES
   ═══════════════════════════════════════════════════════ */

.neo-ticket-messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.neo-ticket-msg {
    border-radius: var(--neo-radius-md);
    padding: 0.85rem 1rem;
    max-width: 85%;
    border: 1px solid var(--neo-border);
}

.neo-ticket-msg-customer {
    align-self: flex-end;
    background: var(--neo-primary-bg, #eef4ff);
    border-color: var(--neo-primary-border, #c3d9f7);
}

.neo-ticket-msg-support {
    align-self: flex-start;
    background: var(--neo-surface-alt, #f8f9fa);
    border-color: var(--neo-border);
}

.neo-ticket-msg-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.neo-ticket-msg-body {
    font-size: 0.92rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.neo-ticket-msg-attachments {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════
   BLAZOR ERROR UI
   ═══════════════════════════════════════════════════════ */

#blazor-error-ui {
    color-scheme: light only;
    background: var(--neo-warning-bg);
    border-top: 2px solid var(--neo-warning);
    bottom: 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.7rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-family: 'IRANSansX', sans-serif;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ═══════════════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════════════ */

[data-theme="dark"] {
    --kendo-font-family: 'IRANSansX', 'Segoe UI', Tahoma, sans-serif;

    /* ── Brand Colors ── */
    --neo-primary: #818CF8;
    --neo-primary-light: #A5B4FC;
    --neo-primary-lighter: #C7D2FE;
    --neo-primary-dark: #6366F1;
    --neo-primary-bg: rgba(129, 140, 248, 0.12);

    /* ── Sidebar ── */
    --neo-sidebar-bg: linear-gradient(180deg, #0F0D2E 0%, #1A1744 50%, #0F0D2E 100%);
    --neo-sidebar-bg-solid: #0F0D2E;
    --neo-sidebar-active: rgba(129, 140, 248, 0.25);
    --neo-sidebar-hover: rgba(255, 255, 255, 0.06);
    --neo-sidebar-text: #C7D2FE;
    --neo-sidebar-group: #A5B4FC;

    /* ── Backgrounds ── */
    --neo-bg-page: #0F172A;
    --neo-bg-card: #1E293B;
    --neo-bg-elevated: #1E293B;
    --neo-bg-subtle: #334155;

    /* ── Borders ── */
    --neo-border: #334155;
    --neo-border-light: #1E293B;
    --neo-border-focus: #818CF8;

    /* ── Text ── */
    --neo-text-primary: #F1F5F9;
    --neo-text-secondary: #94A3B8;
    --neo-text-muted: #64748B;
    --neo-text-inverse: #0F172A;

    /* ── Semantic Colors ── */
    --neo-success: #34D399;
    --neo-success-bg: rgba(52, 211, 153, 0.12);
    --neo-success-border: #065F46;
    --neo-warning: #FBBF24;
    --neo-warning-bg: rgba(251, 191, 36, 0.12);
    --neo-warning-border: #92400E;
    --neo-danger: #F87171;
    --neo-danger-bg: rgba(248, 113, 113, 0.12);
    --neo-danger-border: #991B1B;
    --neo-info: #60A5FA;
    --neo-info-bg: rgba(96, 165, 250, 0.12);
    --neo-info-border: #1E40AF;
    /* متنِ بدنهٔ بنرها در تم تیره — روی bgِ ‏۰٫۱۲ مرکب با کارت #1E293B سنجیده شد
       (۲۰۲۶-۰۹-۰۲): ‏warning/success/info همان سطحِ ۴۰۰ (۴٫۷ تا ۶٫۸)؛ ‏danger با
       #F87171 مرزی بود (۴٫۴۷) ⇒ ‏#FCA5A5 (۶٫۵:۱). */
    --neo-success-text: #34D399;
    --neo-warning-text: #FBBF24;
    --neo-danger-text: #FCA5A5;
    --neo-info-text: #60A5FA;

    /* ── Shadows ── */
    --neo-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --neo-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --neo-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --neo-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
    --neo-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    --neo-shadow-glow: 0 0 20px rgba(129, 140, 248, 0.2);
    --neo-shadow-card: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.15);

    color-scheme: dark;
}

/* ── Dark mode Telerik overrides ── */
[data-theme="dark"] .k-widget,
[data-theme="dark"] .k-input,
[data-theme="dark"] .k-button,
[data-theme="dark"] .k-grid,
[data-theme="dark"] .k-dialog,
[data-theme="dark"] .k-notification {
    color: var(--neo-text-primary);
}

[data-theme="dark"] .k-grid .k-grid-header,
[data-theme="dark"] .k-grid .k-grid-header th {
    background-color: var(--neo-bg-subtle);
    color: var(--neo-text-primary);
    border-color: var(--neo-border);
}

[data-theme="dark"] .k-grid td {
    border-color: var(--neo-border);
}

[data-theme="dark"] .k-grid .k-alt {
    background-color: rgba(255, 255, 255, 0.02);
}

/* ── Theme Toggle Button ── */
.neo-theme-toggle {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--neo-radius-sm);
    color: var(--neo-sidebar-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-family: 'IRANSansX', sans-serif;
    transition: background var(--neo-transition-fast), border-color var(--neo-transition-fast);
}

.neo-theme-toggle:hover {
    background: var(--neo-sidebar-hover);
    border-color: rgba(255, 255, 255, 0.25);
}

/* ═══════════════════════════════════════════════════════
   AI PANEL — Modern AI Suggestion Section
   ═══════════════════════════════════════════════════════ */

.neo-ai-panel {
    position: relative;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.03) 0%, rgba(99, 102, 241, 0.06) 100%);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--neo-radius-lg);
    padding: 1.25rem;
    margin-top: 1rem;
    overflow: hidden;
}

.neo-ai-panel::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--neo-primary), var(--neo-primary-lighter), #a78bfa);
}

.neo-ai-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.neo-ai-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--neo-radius-sm);
    background: linear-gradient(135deg, var(--neo-primary) 0%, var(--neo-primary-lighter) 100%);
    color: #fff;
    flex-shrink: 0;
}

.neo-ai-icon svg {
    width: 16px;
    height: 16px;
}

.neo-ai-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--neo-text-primary);
}

.neo-ai-hint {
    font-size: 0.8rem;
    color: var(--neo-text-muted);
    margin-top: 0.15rem;
}

.neo-ai-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem;
    background: var(--neo-bg-card);
    border: 1px solid var(--neo-border-light);
    border-radius: var(--neo-radius-sm);
    margin-bottom: 0.75rem;
}

.neo-ai-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: var(--neo-radius-full);
    background: rgba(79, 70, 229, 0.06);
    border: 1px solid rgba(79, 70, 229, 0.12);
    transition: all 0.2s;
    color: var(--neo-text-secondary);
}

.neo-ai-toggle-label:hover {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.25);
}

.neo-ai-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.neo-ai-method-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.7rem;
    border-radius: var(--neo-radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--neo-info-bg);
    color: var(--neo-info);
    border: 1px solid var(--neo-info-border);
}

.neo-ai-confidence-overall {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.7rem;
    border-radius: var(--neo-radius-full);
    font-size: 0.78rem;
    font-weight: 600;
}

.neo-ai-results-card {
    background: var(--neo-bg-card);
    border: 1px solid var(--neo-border-light);
    border-radius: var(--neo-radius-sm);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.neo-ai-result-row {
    display: grid;
    grid-template-columns: 36px 1fr 120px 80px;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--neo-border-light);
    transition: background 0.15s;
    font-size: 0.85rem;
}

.neo-ai-result-row:last-child {
    border-bottom: none;
}

.neo-ai-result-row:hover {
    background: rgba(79, 70, 229, 0.03);
}

.neo-ai-result-header {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--neo-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: var(--neo-bg-subtle);
    border-bottom: 1px solid var(--neo-border);
}

.neo-ai-result-header:hover {
    background: var(--neo-bg-subtle);
}

.neo-ai-row-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--neo-radius-full);
    background: var(--neo-primary-bg);
    color: var(--neo-primary);
    font-size: 0.75rem;
    font-weight: 700;
}

.neo-ai-date {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--neo-text-primary);
}

.neo-ai-amount {
    font-variant-numeric: tabular-nums;
    color: var(--neo-text-secondary);
    text-align: left;
    direction: ltr;
}

.neo-ai-reason {
    color: var(--neo-text-secondary);
    font-size: 0.82rem;
}

.neo-confidence-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.55rem;
    border-radius: var(--neo-radius-full);
    font-size: 0.73rem;
    font-weight: 700;
    min-width: 48px;
    justify-content: center;
}

.neo-confidence-high {
    background: var(--neo-success-bg);
    color: var(--neo-success);
    border: 1px solid var(--neo-success-border);
}

.neo-confidence-medium {
    background: var(--neo-warning-bg);
    color: var(--neo-warning);
    border: 1px solid var(--neo-warning-border);
}

.neo-confidence-low {
    background: var(--neo-bg-subtle);
    color: var(--neo-text-muted);
    border: 1px solid var(--neo-border);
}

.neo-ai-apply-bar {
    display: flex;
    justify-content: flex-end;
}

/* ── AI Explanation Panel ── */

.neo-ai-explanation {
    position: relative;
    margin-top: 0.75rem;
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: var(--neo-radius-sm);
    overflow: hidden;
    background: var(--neo-bg-card);
}

.neo-ai-explanation-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: none;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.04) 0%, rgba(99, 102, 241, 0.08) 100%);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--neo-primary);
    transition: background 0.2s;
    text-align: right;
}

.neo-ai-explanation-toggle:hover {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.07) 0%, rgba(99, 102, 241, 0.12) 100%);
}

.neo-ai-explanation-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--neo-radius-full);
    background: var(--neo-primary-bg);
    color: var(--neo-primary);
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.neo-ai-explanation-icon.expanded {
    transform: rotate(90deg);
}

.neo-ai-explanation-body {
    padding: 0.85rem;
    border-top: 1px solid rgba(99, 102, 241, 0.1);
    font-size: 0.83rem;
    line-height: 1.85;
    color: var(--neo-text-secondary);
    background: rgba(99, 102, 241, 0.02);
    animation: neo-ai-fade-in 0.25s ease;
}

.neo-ai-explanation-body p {
    margin: 0 0 0.3rem;
    padding-right: 0.25rem;
}

.neo-ai-explanation-body p::before {
    content: '›';
    display: inline-block;
    margin-left: 0.35rem;
    color: var(--neo-primary-lighter);
    font-weight: 700;
}

@keyframes neo-ai-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── AI Billing Card (AiCostNotice v2) ── */

.neo-ai-billing-card {
    position: relative;
    padding: 0.55rem 0.75rem;
    border-radius: var(--neo-radius-md);
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(240,245,255,0.9));
    backdrop-filter: blur(12px);
    border: 1px solid rgba(99,102,241,0.15);
    box-shadow: var(--neo-shadow-sm), 0 0 10px rgba(99,102,241,0.04);
    margin-bottom: 0.6rem;
    transition: all var(--neo-transition-slow);
    overflow: hidden;
}

.neo-ai-billing-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--neo-primary), var(--neo-primary-lighter), #a78bfa);
}

.neo-ai-billing-card--danger {
    border-color: rgba(220,38,38,0.2);
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(254,242,242,0.9));
    box-shadow: var(--neo-shadow-md), 0 0 20px rgba(220,38,38,0.06);
}

.neo-ai-billing-card--danger::before {
    background: linear-gradient(90deg, var(--neo-danger), #f87171, #fca5a5);
}

/* ── Grid Layout ── */
.neo-ai-billing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

@media (max-width: 600px) {
    .neo-ai-billing-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

/* ── Section Card ── */
.neo-ai-billing-section {
    padding: 0.5rem 0.7rem;
    border-radius: var(--neo-radius-sm);
    background: rgba(255,255,255,0.7);
    border: 1px solid var(--neo-border-light);
}

.neo-ai-billing-section-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.2rem;
}

.neo-ai-billing-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: var(--neo-radius-sm);
    flex-shrink: 0;
}

.neo-ai-billing-section-icon--credit {
    background: linear-gradient(135deg, var(--neo-success), #34d399);
    color: #fff;
}

.neo-ai-billing-section-icon--cost {
    background: linear-gradient(135deg, var(--neo-primary), var(--neo-primary-lighter));
    color: #fff;
}

.neo-ai-billing-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--neo-text-muted);
}

/* ── Amount Display ── */
.neo-ai-billing-amount {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--neo-text-primary);
    font-variant-numeric: tabular-nums;
    margin-bottom: 0.2rem;
    direction: ltr;
    text-align: right;
}

.neo-ai-billing-amount--cost {
    color: var(--neo-primary);
}

.neo-ai-billing-unit {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--neo-text-muted);
}

.neo-ai-billing-sub {
    font-size: 0.7rem;
    color: var(--neo-text-muted);
    margin-top: 0.1rem;
}

/* ── Credit Progress Bar ── */
.neo-ai-credit-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--neo-border-light);
    margin-bottom: 0.2rem;
    overflow: hidden;
}

.neo-ai-credit-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.neo-ai-credit-bar-fill--high {
    background: linear-gradient(90deg, #059669, #34d399);
}

.neo-ai-credit-bar-fill--mid {
    background: linear-gradient(90deg, #d97706, #fbbf24);
}

.neo-ai-credit-bar-fill--low {
    background: linear-gradient(90deg, #dc2626, #f87171);
}

/* ── Alert Bar ── */
.neo-ai-billing-alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--neo-radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--neo-danger);
    background: var(--neo-danger-bg);
    border: 1px solid var(--neo-danger-border);
}

.neo-ai-billing-alert--insufficient {
    margin-top: 1rem;
}

.neo-ai-billing-alert-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    color: var(--neo-danger);
}

/* ── Mode Selector ── */
.neo-ai-mode-selector {
    display: flex;
    gap: 0;
    margin-top: 0.5rem;
    border-radius: var(--neo-radius-sm);
    overflow: hidden;
    border: 1px solid rgba(99,102,241,0.2);
    background: rgba(255,255,255,0.5);
}

.neo-ai-mode-option {
    flex: 1;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.3rem 0.6rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--neo-text-secondary);
    transition: all var(--neo-transition-base);
    position: relative;
    white-space: nowrap;
}

.neo-ai-mode-option + .neo-ai-mode-option {
    border-right: 1px solid rgba(99,102,241,0.15);
}

.neo-ai-mode-option:hover:not(:disabled) {
    background: rgba(99,102,241,0.04);
}

.neo-ai-mode-option--active {
    background: linear-gradient(135deg, var(--neo-primary), var(--neo-primary-lighter)) !important;
    color: #fff !important;
}

.neo-ai-mode-option:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.neo-ai-mode-icon {
    display: inline-flex;
    align-items: center;
}

.neo-ai-mode-label {
    font-weight: 600;
    font-size: 0.8rem;
}

.neo-ai-mode-cost {
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    opacity: 0.8;
    padding: 0.05rem 0.35rem;
    border-radius: 10px;
    background: rgba(0,0,0,0.04);
}

.neo-ai-mode-option--active .neo-ai-mode-cost {
    opacity: 1;
    background: rgba(255,255,255,0.18);
}

.neo-ai-mode-disabled-hint {
    font-size: 0.68rem;
    padding: 0.05rem 0.35rem;
    border-radius: var(--neo-radius-full);
    background: rgba(0,0,0,0.1);
}

/* ── Shimmer Loading ── */
.neo-ai-billing-shimmer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
    min-height: 80px;
}

.neo-ai-billing-shimmer-block {
    border-radius: var(--neo-radius-xs);
    background: linear-gradient(90deg, var(--neo-border-light) 25%, rgba(255,255,255,0.6) 50%, var(--neo-border-light) 75%);
    background-size: 200% 100%;
    animation: neo-ai-shimmer 1.5s ease-in-out infinite;
}

@keyframes neo-ai-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Print Styles — @media print
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media print {
    .sidebar,
    .neo-topbar,
    .neo-toolbar,
    .neo-grid-toolbar,
    .neo-theme-toggle,
    .neo-btn,
    .k-pager-wrap,
    .k-grid-toolbar,
    .neo-dashboard-grid,
    #blazor-error-ui,
    .blazor-reconnect-modal,
    .neo-menubar,
    .neo-bottom-nav,
    .neo-ai-launcher {
        display: none !important;
    }

    .page {
        display: block !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .neo-page-shell {
        padding: 0 !important;
    }

    .neo-page-header {
        border-bottom: 2px solid #000 !important;
        margin-bottom: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    .neo-page-title {
        font-size: 16pt !important;
        color: #000 !important;
    }

    .neo-page-subtitle {
        font-size: 10pt !important;
        color: #333 !important;
    }

    .neo-surface {
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }

    .k-grid {
        height: auto !important;
        overflow: visible !important;
        border: 1px solid #ccc !important;
    }

    .k-grid-content {
        height: auto !important;
        overflow: visible !important;
    }

    .k-grid th,
    .k-grid td {
        font-size: 9pt !important;
        padding: 4px 8px !important;
        border: 1px solid #ddd !important;
        color: #000 !important;
    }

    .k-grid th {
        background-color: #f0f0f0 !important;
        font-weight: bold !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .neo-grid-footer {
        border-top: 2px solid #000 !important;
        font-weight: bold !important;
        font-size: 10pt !important;
        padding: 8px !important;
        color: #000 !important;
    }

    table { page-break-inside: auto; }
    tr { page-break-inside: avoid; page-break-after: auto; }

    body {
        direction: rtl !important;
    }
}

/* ── AI Dashboard Styles ── */

.neo-ai-dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.neo-ai-dash-card {
    padding: 1rem 1.25rem;
    border-radius: var(--neo-radius-md);
    background: var(--neo-surface);
    border: 1px solid var(--neo-border);
    text-align: center;
    transition: box-shadow var(--neo-transition);
}

.neo-ai-dash-card:hover {
    box-shadow: var(--neo-shadow-md);
}

.neo-ai-dash-card-label {
    font-size: 0.8rem;
    color: var(--neo-text-muted);
    margin-bottom: 0.35rem;
}

.neo-ai-dash-card-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--neo-text);
}

.neo-ai-dash-card--success { border-right: 4px solid var(--neo-success); }
.neo-ai-dash-card--danger { border-right: 4px solid var(--neo-danger); }
.neo-ai-dash-card--warning { border-right: 4px solid var(--neo-warning); }

.neo-ai-dash-forecast-card {
    flex: 1;
    min-width: 200px;
    padding: 1rem;
    border-radius: var(--neo-radius-md);
    background: linear-gradient(135deg, rgba(240,245,255,0.9), rgba(255,255,255,0.95));
    border: 1px solid rgba(99,102,241,0.15);
}

.neo-ai-dash-forecast-title {
    font-size: 0.85rem;
    color: var(--neo-text-muted);
    margin-bottom: 0.3rem;
}

.neo-ai-dash-forecast-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--neo-primary);
    margin-bottom: 0.25rem;
}

.neo-ai-dash-forecast-meta {
    font-size: 0.75rem;
    color: var(--neo-text-muted);
}

.neo-ai-dash-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--neo-radius-sm);
    flex: 1;
    min-width: 200px;
}

.neo-ai-dash-alert--danger {
    background: var(--neo-danger-bg, #fff0f0);
    border-right: 4px solid var(--neo-danger);
}

.neo-ai-dash-alert--warning {
    background: var(--neo-warning-bg, #fffbe6);
    border-right: 4px solid var(--neo-warning);
}

.neo-ai-dash-insights {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.neo-ai-dash-insight-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--neo-radius-sm);
    background: var(--neo-surface-alt, #f9fafb);
    border: 1px solid var(--neo-border);
}

.k-list-item .k-list-item-text::before,
.k-input-value-text::before {
    display: none !important;
}

.k-list-item, .k-input-inner {
    unicode-bidi: plaintext;
}

/* ── دستیارِ هوشمندِ شناور (NeoAiLauncher) ─────────────────────────────────
   جای‌گیری روی inset-inline-end است چون sidebar سمتِ inline-start می‌نشیند
   (در RTL راست) و دکمهٔ تمِ داخلِ آن دقیقاً همان گوشه را اشغال کرده است. */
.neo-ai-launcher {
    position: fixed;
    inset-inline-end: 1.5rem;
    bottom: 1.5rem;
    z-index: var(--neo-z-assistant, 800);
    direction: rtl;
    font-family: 'IRANSansX', 'Segoe UI', Tahoma, sans-serif;
}

.neo-ai-launcher.neo-ai-hidden {
    display: none;
}

/* زیرِ 768px نوارِ ناوبریِ پایینی (۵۶px) ظاهر می‌شود و دکمه دقیقاً رویش می‌افتد. */
@media (max-width: 767.98px) {
    .neo-ai-launcher {
        bottom: calc(1.5rem + 56px + env(safe-area-inset-bottom));
    }
}

/* ⚠ ابعاد از نسبتِ خودِ کاراکتر می‌آید (۲۴۰×۳۴۰). دکمه پیش‌تر ۹۶×۹۶ بود در حالی که
   کاراکترِ ۸۶ پیکسلی حدودِ ۱۲۲ پیکسل بلند می‌شود — یعنی از کادرِ دکمه بیرون می‌زد و
   حلقهٔ فوکوس (که کادرِ دکمه را دنبال می‌کند) دورِ ربات نمی‌افتاد. */
.neo-ai-fab {
    width: 86px;
    height: 122px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    position: relative;
    display: grid;
    place-items: center;
    filter: drop-shadow(0 10px 18px rgba(29, 28, 70, 0.3));
    transition: transform 0.18s ease, filter 0.18s ease;
}

.neo-ai-fab:hover {
    transform: translateY(-3px) scale(1.05);
    filter: drop-shadow(0 14px 24px rgba(29, 28, 70, 0.4));
}

.neo-ai-fab:active {
    transform: scale(0.97);
}

/* گوشهٔ گرد به‌جای بیضی و ۲ پیکسل به‌جای ۳ — طبقِ مشخصاتِ بستهٔ CoolAi.
   خودِ حلقه عمداً حذف نشد: کاربری که فقط با کیبورد کار می‌کند بعد از بستن با Escape
   باید بفهمد فوکوس کجا برگشته. */
.neo-ai-fab:focus-visible {
    outline: 2px solid var(--coolai-c, var(--neo-primary));
    outline-offset: 3px;
    border-radius: 18px;
}

/* ── رنگِ حالتِ کول‌ای ──
   طبقِ مشخصاتِ بستهٔ CoolAi، رنگِ حالت کلِ پنل را می‌گیرد نه فقط کاراکتر را:
   ریلِ بالای پنل، هالهٔ دورش، و حلقهٔ فوکوسِ کادرِ نوشتن. مقدار روی خودِ پنل
   تعریف می‌شود تا در یک جا بماند و در چند قاعده تکرار نشود. */
.neo-ai-panel[data-state="ready"]     { --coolai-c: #22C55E; }
.neo-ai-panel[data-state="searching"] { --coolai-c: #3B82F6; }
.neo-ai-panel[data-state="answer"]    { --coolai-c: #8B5CF6; }
.neo-ai-panel[data-state="offline"]   { --coolai-c: #EF4444; }

.neo-ai-panel {
    position: absolute;
    bottom: calc(100% + 0.75rem);
    inset-inline-end: 0;
    /* ابعاد از مشخصاتِ بسته: پنلِ قبلی حدودِ ۷۰٪ ارتفاعِ صفحه را می‌گرفت. */
    width: 318px;
    max-width: calc(100vw - 3rem);
    max-height: 66vh;
    background: var(--neo-bg-card);
    color: var(--neo-text-primary);
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-lg, 16px);
    /* هالهٔ رنگیِ حالت روی سایهٔ معمول می‌نشیند */
    box-shadow: var(--neo-shadow-lg, 0 24px 60px rgba(29, 28, 70, 0.28)),
                0 0 0 3px color-mix(in srgb, var(--coolai-c, #22C55E) 18%, transparent);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: neo-ai-rise 0.22s ease-out;
    transition: box-shadow 0.25s ease;
}

/* ریلِ باریکِ رنگیِ بالای پنل — نشانگرِ حالت بدونِ اشغالِ فضا */
.neo-ai-panel::after {
    content: "";
    position: absolute;
    top: 0;
    inset-inline: 0;
    height: 3px;
    background: var(--coolai-c, #22C55E);
    transition: background 0.25s ease;
    z-index: 1;
}

@keyframes neo-ai-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

/* هدرِ نوارِ باریک با رنگِ برند — همان رنگِ نوارِ منو و سایدبار.
   عنوان و آواتار حذف نشدند ولی padding کم شد تا نوار باریک بماند. */
.neo-ai-panel-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.85rem;
    background: var(--neo-sidebar-bg-solid, #1E1B4B);
    color: #fff;
}

.neo-ai-panel-title b {
    font-size: var(--neo-font-sm, 0.9rem);
    font-weight: var(--neo-weight-semibold, 600);
}

.neo-ai-panel-title span {
    display: block;
    margin-top: 2px;
    font-size: 0.7rem;
    opacity: 0.75;
}

.neo-ai-panel-close {
    margin-inline-start: auto;
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 1.35rem;
    line-height: 1;
    padding: 0.25rem;
    cursor: pointer;
}

.neo-ai-panel-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.neo-ai-log {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.85rem;
    /* پنل خودش سقفِ ۶۶vh دارد؛ اینجا flex باعث می‌شود فقط همین ناحیه جمع/اسکرول شود
       و هدر و کادرِ نوشتن همیشه دیده شوند. */
    flex: 1 1 auto;
    min-height: 0;
    max-height: 424px;
    overflow-y: auto;
    background: var(--neo-bg-subtle);
}

.neo-ai-msg {
    font-size: 0.85rem;
    line-height: 1.7;
    padding: 0.6rem 0.8rem;
    border-radius: var(--neo-radius-md, 12px);
    max-width: 85%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ⚠ صفحه RTL است: کاربر راست و دستیار چپ، یعنی برعکسِ چیزی که در LTR انتظار می‌رود.
   پس دستیار flex-end می‌گیرد و کاربر flex-start. */
.neo-ai-msg-assistant {
    background: var(--neo-bg-card);
    border: 1px solid var(--neo-border);
    align-self: flex-end;
    /* ته‌رنگِ حالت روی حبابِ دستیار — بسیار کم‌رنگ تا خوانایی حفظ شود */
    border-inline-start: 3px solid color-mix(in srgb, var(--coolai-c, #22C55E) 55%, transparent);
}

/* برچسبِ منبعِ پاسخ — «راهنما» یا «تحلیل مالی».
   بدونِ رنگِ جدید: از currentColor و متغیرهای موجود استفاده می‌کند. */
.neo-ai-src-tag {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1.6;
    padding: 0 0.4rem;
    margin-bottom: 0.3rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    opacity: 0.65;
}

/* عنوانِ مقالاتی که پاسخ از رویشان ساخته شد */
.neo-ai-src-list {
    margin-top: 0.35rem;
    padding-top: 0.3rem;
    border-top: 1px dashed var(--neo-border);
    font-size: 0.72rem;
    opacity: 0.75;
}

/* آبی-نیلیِ ملایم طبقِ مشخصات. رنگِ اشباعِ قبلی با هدرِ سرمه‌ای نمی‌خواند، و این
   طیف از بنفشِ حالتِ answer هم به‌قدرِ کافی دور است که با هم اشتباه نشوند. */
.neo-ai-msg-user {
    background: linear-gradient(135deg, #8098dc 0%, #5566b4 100%);
    color: #fff;
    align-self: flex-start;
}

.neo-ai-note {
    font-size: 0.8rem;
    line-height: 1.8;
    color: var(--neo-text-muted);
}

.neo-ai-note-error {
    color: var(--neo-danger);
}

/* ═══ گزینه‌های پرسشِ دستیارِ فرمان‌پذیر ═══
   ابهام با انتخاب بسته می‌شود نه با حدس، پس گزینه‌ها باید دمِ دست و قابلِ کلیک باشند. */
.neo-ai-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.neo-ai-option {
    border: 1px solid var(--coolai-c, var(--neo-primary));
    background: transparent;
    color: var(--neo-text);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.neo-ai-option:hover:not(:disabled) {
    background: color-mix(in srgb, var(--coolai-c, var(--neo-primary)) 14%, transparent);
}

.neo-ai-option:disabled {
    opacity: 0.5;
    cursor: default;
}

.neo-ai-form {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--neo-border);
    background: var(--neo-bg-card);
}

.neo-ai-input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-sm, 10px);
    padding: 0.6rem 0.75rem;
    font: inherit;
    font-size: 0.85rem;
    background: var(--neo-bg-card);
    color: var(--neo-text-primary);
}

/* حلقهٔ فوکوسِ کادرِ نوشتن هم رنگِ حالت را می‌گیرد */
.neo-ai-input:focus-visible {
    outline: 2px solid var(--coolai-c, var(--neo-primary));
    outline-offset: 2px;
}

.neo-ai-send {
    background: var(--neo-primary);
    color: var(--neo-text-inverse, #fff);
    border: 0;
    border-radius: var(--neo-radius-sm, 10px);
    padding: 0 1rem;
    font: inherit;
    font-size: 0.85rem;
    font-weight: var(--neo-weight-semibold, 600);
    cursor: pointer;
}

.neo-ai-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* README ادعای پشتیبانی داشت ولی این دو مورد در ویجتِ اصلی پوشش نداشتند. */
@media (prefers-reduced-motion: reduce) {
    .neo-ai-panel {
        animation: none;
    }

    .neo-ai-fab,
    .neo-ai-fab:hover,
    .neo-ai-fab:active {
        transition: none;
        transform: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   منوی افقیِ آبشاری (حالتِ دومِ ناوبری) — NavMenuBar.razor
   ───────────────────────────────────────────────────────────────────────────
   • صفر رنگِ جدید: همه از --neo-sidebar-* که حالتِ تاریک خودش بازتعریفشان می‌کند.
   • پنل‌ها position:fixed با var(--neo-z-dropdown)=500 — عمداً نه popover بومی،
     چون top-layer از دیالوگ‌های Telerik (k-overlay:10000، k-popup:12000) بالاتر
     می‌نشیند و منو روی دیالوگِ باز می‌افتاد.
   • زیرِ ۹۹۲px کلاً خاموش است: آنجا سایدبارِ off-canvas و BottomNav کار می‌کنند.
   ═══════════════════════════════════════════════════════════════════════════ */

.neo-menubar {
    display: none;
}

@media (min-width: 992px) {
    html[data-nav-mode="menubar"] .sidebar {
        display: none;
    }

    html[data-nav-mode="menubar"] .neo-menubar {
        display: flex;
        align-items: stretch;
        gap: 2px;
        height: var(--neo-menubar-height, 42px);
        padding: 0 0.75rem;
        background: var(--neo-sidebar-bg-solid);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: var(--neo-shadow-lg);
        position: sticky;
        top: var(--neo-topbar-height);
        /* ⚠ عمداً یک واحد کمتر از .neo-topbar (۱۰۰): نوار بعد از topbar در DOM می‌آید و
           با z-index مساوی، بعدی برنده می‌شد و منوی کاربر را زیرِ خود می‌برد. */
        z-index: 99;
        overflow: hidden; /* هیچ آیتمی از نوار بیرون نزند */
    }
}

/* <details> فرزندِ مستقیمِ نوار است و کشیده می‌شود، ولی <summary> داخلش کشیده نمی‌شد
   و متنش نسبت به لینکِ داشبورد ۶٫۵px بالاتر می‌نشست. flex کردنِ خودِ گروه این را حل
   می‌کند (پنلِ بازشو position:fixed است و از این جریان خارج می‌ماند). */
.neo-mb-group {
    display: flex;
    align-items: stretch;
}

.neo-mb-group > .neo-mb-item {
    flex: 1 1 auto;
}

/* ── آیتمِ سطحِ یک ── */
.neo-mb-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.8rem;
    color: var(--neo-sidebar-text);
    text-decoration: none;
    font-size: 0.845rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    list-style: none;
    user-select: none;
    flex-shrink: 0;
    position: relative;
    transition: background 0.15s ease, color 0.15s ease;
}

.neo-mb-item::-webkit-details-marker {
    display: none;
}

.neo-mb-item:hover {
    background: var(--neo-sidebar-hover);
    color: #fff;
}

.neo-menubar .neo-mb-item.active {
    color: #fff;
}

.neo-menubar .neo-mb-item.active::after,
.neo-mb-group[open] > .neo-mb-item::after {
    content: '';
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 2px;
    background: var(--neo-primary-lighter);
}

.neo-mb-group[open] > .neo-mb-item {
    background: var(--neo-sidebar-hover);
    color: #fff;
}

.neo-mb-caret {
    font-size: 0.6rem;
    opacity: 0.6;
}

/* ── پنلِ بازشو ──
   position:fixed تا با overflow:hidden نوار بریده نشود. مختصات را JS ست می‌کند؛
   بدونِ JS هم پنل زیرِ نوار ظاهر می‌شود (تنزلِ قابل‌قبول). */
.neo-mb-panel {
    position: fixed;
    z-index: var(--neo-z-dropdown, 500);
    min-width: 240px;
    max-width: min(92vw, 420px);
    width: max-content;
    padding: 0.4rem 0;
    background: var(--neo-sidebar-bg-solid);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0 0 var(--neo-radius-md) var(--neo-radius-md);
    box-shadow: var(--neo-shadow-xl);
    max-height: calc(100vh - var(--neo-topbar-height) - var(--neo-menubar-height, 42px) - 16px);
    overflow-y: auto;
    animation: neo-mb-in 0.12s ease-out;
}

.neo-mb-panel-nested {
    border-radius: var(--neo-radius-md);
}

@keyframes neo-mb-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── لینکِ داخلِ پنل ── */
.neo-mb-link {
    display: block;
    padding: 0.42rem 1rem;
    margin: 1px 6px;
    color: rgba(199, 210, 254, 0.82);
    text-decoration: none;
    font-size: 0.84rem;
    border-radius: 8px;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.neo-mb-link:hover {
    background: var(--neo-sidebar-hover);
    color: #fff;
}

.neo-mb-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.28), rgba(129, 140, 248, 0.18));
    color: #fff;
    font-weight: 600;
}

/* ── زیرگروهِ داخلِ پنل ── */
.neo-mb-subitem {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 1rem;
    margin: 1px 6px;
    color: #fff;
    font-size: 0.845rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.15s ease;
}

.neo-mb-subitem::-webkit-details-marker {
    display: none;
}

.neo-mb-subitem:hover,
.neo-mb-subgroup[open] > .neo-mb-subitem {
    background: var(--neo-sidebar-hover);
}

.neo-mb-subitem .neo-mb-caret {
    margin-inline-start: auto;
    font-size: 0.65rem;
}

.neo-mb-subgroup[open] > .neo-mb-subitem .neo-mb-caret {
    transform: rotate(-90deg);
}

/* آیتمِ سرریز — گروه‌هایی که در عرضِ پنجره جا نشدند */
.neo-mb-overflow {
    margin-inline-start: auto;
}

@media (prefers-reduced-motion: reduce) {
    .neo-mb-panel {
        animation: none;
    }
}

/* دکمهٔ جابه‌جاییِ حالتِ ناوبری در topbar — هم‌سبک با neo-topbar-user-trigger */
.neo-nav-mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    background: none;
    border: 1px solid var(--neo-border);
    border-radius: var(--neo-radius-sm);
    color: var(--neo-text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--neo-transition-fast);
}

.neo-nav-mode-toggle:hover {
    background: var(--neo-bg-subtle);
    border-color: var(--neo-primary-lighter);
    color: var(--neo-primary);
}

.neo-nav-mode-toggle svg {
    width: 16px;
    height: 16px;
}

/* زیرِ ۹۹۲px نوارِ افقی در دسترس نیست، پس دکمه هم بی‌معناست */
@media (max-width: 991.98px) {
    .neo-nav-mode-toggle {
        display: none;
    }
}

/* برندِ داخلِ نوارِ افقی — همتای neo-sidebar-brand که با سایدبار مخفی می‌شود */
.neo-mb-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 0.7rem 0 0.9rem;
    margin-inline-end: 0.3rem;
    border-inline-end: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.86rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
}

/* ⚠ از ۲۰۲۶-۰۸-۱۹ اینجا فایلِ کاملِ لوگو می‌نشیند نه نشانِ مربع، پس ابعاد نمی‌تواند مربع
   بماند: نسبتِ فایل ۶۶۶×۱۸۹ (۳٫۵۲:۱) است و ۲۲×۲۲ آن را افقی له می‌کرد.
   ارتفاع مبنا است و عرض خودش می‌آید. */
.neo-mb-brand img {
    height: 26px;
    width: auto;
    display: block;
}

/* در عرضِ کم لوگو کوچک می‌شود تا جای منو باز شود.
   ⚠ پیش‌تر اینجا `span` پنهان می‌شد؛ آن span حذف شده و اگر این قاعده دست‌نخورده می‌ماند
   یک قاعدهٔ مرده بود. */
@media (max-width: 1300px) {
    .neo-mb-brand img {
        height: 20px;
    }

    .neo-mb-brand {
        padding: 0 0.45rem 0 0.6rem;
    }
}

/* ═══ کلیدهای کشوییِ نوارِ بالا (تم و حالتِ منو) ═══
   دستهٔ سفید عمداً *زیرِ* آیکن‌هاست تا آیکنِ فعال رویش بنشیند و دیگری کم‌رنگ
   روی مسیر بماند. یک پایهٔ مشترک تا هر دو کلید دقیقاً هم‌شکل باشند. */
.neo-pill-switch {
    position: relative;
    width: 62px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    flex-shrink: 0;
    direction: ltr; /* جهتِ حرکتِ دسته نباید با RTL برعکس شود */
    background: #E2E8F0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.14);
    transition: background 0.25s ease;
}

.neo-pill-switch:focus-visible {
    outline: 2px solid var(--neo-primary);
    outline-offset: 2px;
}

.nts-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    z-index: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    /* در هر دو کلید آیکنِ حالتِ is-on (تاریک · افقی) سمتِ چپِ track است، پس دسته در حالتِ
       خاموش راست می‌ایستد و با روشن‌شدن به چپ می‌آید. */
    transform: translateX(32px);
}

/* ⚠ اگر ترتیبِ آیکن‌ها را در markup عوض کردی، این قاعده هم باید برعکس شود: کم‌رنگ‌شدنِ
   آیکن بر اساسِ کلاس است ولی حرکتِ دسته بر اساسِ موقعیت، و ناهماهنگی‌شان دسته را زیرِ
   آیکنِ غیرفعال می‌برد. */
.neo-pill-switch.is-on .nts-thumb {
    transform: translateX(0);
}

.nts-track {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 7px;
    pointer-events: none;
}

.nts-i {
    width: 16px;
    height: 16px;
    transition: color 0.25s ease, opacity 0.25s ease;
}

/* ── کلیدِ تم ── */
.neo-theme-switch.is-on {
    background: #4A5468;
}

.nts-sun { color: #F59E0B; }
.nts-moon { color: #6366F1; }

/* آیکنِ غیرفعال کم‌رنگ می‌شود — تشخیصِ حالت بدونِ خواندنِ متن */
.neo-theme-switch:not(.is-on) .nts-moon {
    color: #94A3B8;
    opacity: 0.55;
}

.neo-theme-switch.is-on .nts-sun {
    color: #C3CAD6;
    opacity: 0.5;
}

/* ── کلیدِ حالتِ منو ── */
.neo-nav-switch.is-on {
    background: #C7CFDD;
}

.nts-rail,
.nts-bar {
    color: var(--neo-primary);
}

.neo-nav-switch:not(.is-on) .nts-bar,
.neo-nav-switch.is-on .nts-rail {
    color: #94A3B8;
    opacity: 0.55;
}

@media (prefers-reduced-motion: reduce) {
    .nts-thumb {
        transition: none;
    }
}

/* ── گزینهٔ انتخاب‌شده (Selectable Option) — CS1 / E08، ۲۰۲۶-۰۸-۲۸ ──────────────
   مادیفایرِ مشترکِ «تب/فیلترِ فعال» برای چهار صفحه: VoucherList، VoucherOperations،
   Reports/BankReconciliation و Reports/FinancialDashboard. تا پیش از این، هر چهار صفحه
   در هر دو شاخهٔ ternary کلاسِ یکسانِ neo-btn-outline می‌دادند، یعنی گزینهٔ فعال از
   غیرفعال قابلِ تشخیص نبود.
   الگو عیناً از .neo-ai-mode-option--active گرفته شده (همین فایل، بالاتر).
   ⚠ این قاعده فقط **افزوده** شده؛ هیچ selectorِ موجودی بازنویسی نشده است. */
.neo-btn--selected { background: linear-gradient(135deg, var(--neo-primary), var(--neo-primary-lighter)) !important; color: #fff !important; border-color: transparent !important; }
