:root {
    --bg-dark: #0f1224;
    --bg-darker: #0a0c1a;
    --card-bg: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.12);
    --accent: #7c5cff;
    --accent-2: #22d3c9;
    --text-main: #eef0fb;
    --text-muted: #a3a8c3;
    --success: #2ecc71;
    --warning: #f5a623;
    --danger: #ff5d6c;
    --radius: 16px;
    --gold: #d9b25c;
    --gold2: #f0c869;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Vazirmatn', sans-serif;
    background: radial-gradient(circle at top right, #1c1f3f 0%, var(--bg-dark) 45%, var(--bg-darker) 100%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== نوار ناوبری ===== */
.navbar {
    background: rgba(15, 18, 36, 0.8);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}
.brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--accent-2);
    text-decoration: none;
}

/* ===== گروه ابتدای نوار (لوگو + آیکن کیف پول) ===== */
.nav-start {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== آیکن/دکمه شیک کیف پول در نوار بالا - همیشه در دسترس ===== */
.nav-wallet {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    color: #2b1e05;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 7px 12px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(217, 178, 92, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.nav-wallet:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(217, 178, 92, 0.5);
    color: #2b1e05;
}
.nav-wallet svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.nav-wallet-unit {
    opacity: 0.75;
    font-weight: 600;
}
@media (max-width: 420px) {
    .nav-wallet-unit { display: none; }
    .nav-wallet { padding: 7px 10px; }
}

/* دکمه‌ی همبرگری - فقط روی موبایل دیده می‌شود */
.nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--card-border);
    cursor: pointer;
    padding: 0;
}
.nav-toggle-bar {
    width: 18px;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav-toggle-active .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle-active .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle-active .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* منوی کشویی روی موبایل */
.nav-links {
    position: absolute;
    top: calc(100% + 10px);
    left: 16px;
    right: 16px;
    background: rgba(15,18,36,0.98);
    backdrop-filter: blur(14px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    box-shadow: 0 16px 32px rgba(0,0,0,0.4);
    z-index: 60;
}
.nav-links-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 4px;
    border-bottom: 1px solid var(--card-border);
}
.nav-links a:last-child { border-bottom: none; }
.nav-links a:hover { color: var(--accent-2); }
.nav-user {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 4px;
}
.btn-nav {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    padding: 10px 14px;
    border-radius: 999px;
    color: #fff !important;
    text-align: center;
    border-bottom: none !important;
}

/* روی صفحه‌های بزرگ‌تر: منو همیشه افقی و باز است، دکمه‌ی همبرگری مخفی می‌شود */
@media (min-width: 768px) {
    .nav-toggle { display: none; }
    .nav-links {
        position: static;
        flex-direction: row;
        align-items: center;
        background: transparent;
        border: none;
        padding: 0;
        gap: 16px;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        z-index: auto;
    }
    .nav-links a {
        padding: 0;
        border-bottom: none;
        white-space: nowrap;
    }
    .nav-user { padding: 0; }
    .btn-nav { padding: 6px 14px; }

    .nav-submenu { position: relative; }
    .nav-submenu-toggle {
        width: auto;
        border-bottom: none;
        padding: 0;
        font-size: 0.85rem;
        color: var(--text-main);
    }
    .nav-submenu-list {
        position: absolute;
        top: calc(100% + 12px);
        right: 0;
        min-width: 200px;
        max-height: 0;
        background: rgba(15,18,36,0.98);
        backdrop-filter: blur(14px);
        border: 1px solid var(--card-border);
        border-right: 1px solid var(--card-border);
        border-radius: 12px;
        padding: 0 8px;
        margin-right: 0;
        box-shadow: 0 16px 32px rgba(0,0,0,0.4);
        z-index: 70;
    }
    .nav-submenu-list.nav-submenu-open {
        max-height: 300px;
        overflow-y: auto;
        padding: 8px;
    }
}

/* زیرمنوی «صندوق‌های من» (آکاردئون داخل منوی همبرگری) */
.nav-submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 4px;
    cursor: pointer;
}
.nav-submenu-arrow {
    transition: transform 0.2s ease;
    color: var(--text-muted);
}
.nav-submenu-toggle-active .nav-submenu-arrow {
    transform: rotate(180deg);
}
.nav-submenu-list {
    max-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-right: 10px;
    border-right: 2px solid var(--card-border);
    margin-right: 6px;
    transition: max-height 0.25s ease;
}
.nav-submenu-list.nav-submenu-open {
    max-height: 260px;
    overflow-y: auto;
}
.nav-submenu-list a {
    border-bottom: none;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 7px 4px;
}
.nav-submenu-list a:hover { color: var(--accent-2); }
.nav-submenu-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 7px 4px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 14px 60px;
}

/* ===== کارت‌ها ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 18px 14px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    margin-bottom: 16px;
    overflow-x: auto;
}

.grid {
    display: grid;
    gap: 16px;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* فرم "ایجاد وام گردشی جدید" — چون لیبل‌ها فارسی و نسبتاً بلند هستند،
   هر فیلد در یک ردیف کامل و مستقل نمایش داده می‌شود تا هم‌راستا و
   خوانا باشد، به‌جای چیدمان دوستونه‌ی نامتقارن قبلی. */
#createRotatingForm .rf-form-field {
    width: 100%;
    margin-bottom: 16px;
}
#createRotatingForm .rf-form-field:last-of-type {
    margin-bottom: 20px;
}
#createRotatingForm .rf-form-field label {
    display: block;
    width: 100%;
    margin-bottom: 6px;
    font-size: 0.9rem;
}
#createRotatingForm .rf-form-field input {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
}
#createRotatingForm .rf-hint {
    color: var(--text-muted);
    font-size: 12px;
    margin: 6px 2px 0;
}
#createRotatingForm .rf-total-display {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px dashed var(--accent-2);
    background: rgba(34,211,201,0.08);
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 700;
}

h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }

/* ===== فرم‌ها ===== */
label {
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 0.85rem;
}
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: rgba(255,255,255,0.04);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    margin-bottom: 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(34,211,201,0.15);
}
select[multiple] {
    height: auto;
    min-height: 100px;
}

/* ===== دکمه‌ها ===== */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(124,92,255,0.25);
    transition: transform 0.15s ease, opacity 0.15s ease;
    text-align: center;
}
.btn:hover { transform: translateY(-1px); opacity: 0.9; }
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-main);
    box-shadow: none;
}
.btn-danger { background: linear-gradient(135deg, #e14a5a, #ff5d6c); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-add { background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 4px 14px rgba(34,197,94,0.3); }

/* دکمه‌ی قفل‌شده‌ی «پرداخت قسط» وقتی این قسط نوبتش نرسیده — قسط‌های
   زودتر همین وام هنوز پرداخت نشده‌اند و باید اول آن‌ها پرداخت شوند. */
.installment-locked-btn {
    background: rgba(255,255,255,0.06) !important;
    color: var(--text-muted) !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
    opacity: 0.7;
}
.installment-locked-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ===== دکمه‌های اصلی واریز و برداشت ===== */
.btn-deposit {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3) !important;
    transition: all 0.3s ease !important;
    color: #fff !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 16px 24px !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    min-width: 150px !important;
    position: relative !important;
    overflow: hidden !important;
}
.btn-deposit:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 35px rgba(34, 197, 94, 0.5) !important;
}
.btn-deposit:active {
    transform: translateY(0px) !important;
    box-shadow: 0 2px 10px rgba(34, 197, 94, 0.3) !important;
}
.btn-deposit::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.btn-deposit:hover::after {
    opacity: 1;
}

.btn-withdraw {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3) !important;
    transition: all 0.3s ease !important;
    color: #fff !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 16px 24px !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    min-width: 150px !important;
    position: relative !important;
    overflow: hidden !important;
}
.btn-withdraw:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 35px rgba(239, 68, 68, 0.5) !important;
}
.btn-withdraw:active {
    transform: translateY(0px) !important;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.3) !important;
}
.btn-withdraw::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.12), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.btn-withdraw:hover::after {
    opacity: 1;
}

/* ===== بج‌ها ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-trial { background: rgba(245,166,35,0.18); color: var(--warning); }
.badge-active { background: rgba(46,204,113,0.18); color: var(--success); }
.badge-inactive { background: rgba(255,93,108,0.18); color: var(--danger); }

/* برجسته‌سازی وضعیت «واریزی‌های کامل‌شده» یک دوره‌ی قرعه‌کشی در وام گردشی،
   تا کاربر به‌راحتی ببیند کدام دوره‌ها به‌طور کامل پرداخت شده‌اند:
   پس‌زمینه‌ی سبز بسیار کم‌رنگ + متن سبز پررنگ و بولد + حاشیه‌ی سبز پررنگ. */
.rotating-paid-complete {
    background: rgba(46,204,113,0.08);
    color: var(--success);
    font-weight: 700;
    border: 1.5px solid var(--success);
    border-radius: 8px;
    padding: 3px 10px;
}
.rotating-paid-complete strong { color: var(--success); }

/* همان تأکید سبز برای نشان «پرداخت‌شده» در جدول جزئیات یک دوره */
.rotating-paid-badge {
    font-weight: 700;
    border: 1.5px solid var(--success);
}

/* عنوان بازشوی «ثبت واریز برای این دوره» — سبز و بولد تا مدیر صندوق
   راحت‌تر دکمه‌ی ثبت واریز اعضا را در هر دوره پیدا کند. */
.rotating-record-payment-toggle {
    cursor: pointer;
    color: var(--success);
    font-weight: 700;
    font-size: 13px;
}

/* ردیف فیلتر «پرداخت نشده / پرداخت شده / همه» در صفحه اقساط. صفحه dir=rtl
   است، پس اولین آیتم در ترتیب سورس (پرداخت نشده) خودش در سمت راست فیزیکی
   قرار می‌گیرد. آمار سمت چپ با margin-left:auto رانده می‌شود تا فضای باقی‌مانده
   را جذب کند و دکمه‌ها را در سمت راست نگه دارد (نه margin-right، چون در فلکس‌باکس
   فیزیکی است و با dir عوض نمی‌شود). */
.installment-filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.installment-filter-stats {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* لیست چک‌باکس اعضا برای «ثبت واریز گروهی». قانون سراسری
   input,select,textarea { width:100% } باعث می‌شد چک‌باکس‌ها هم عریض
   بشن و فضای نام عضو رو بگیرن؛ اینجا اندازه‌شون رو ثابت و کوچک می‌کنیم
   تا هر ردیف دقیقاً هم‌تراز و صاف زیر هم بیفته. */
.rotating-bulk-pay-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 160px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    margin-bottom: 8px;
}
.rotating-bulk-pay-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    padding: 6px 4px;
    margin-bottom: 0;
    border-radius: 6px;
}
.rotating-bulk-pay-row:hover {
    background: rgba(255,255,255,0.04);
}
.rotating-bulk-pay-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    padding: 0;
    margin: 0;
    accent-color: var(--accent-2);
    cursor: pointer;
    flex-shrink: 0;
}
.rotating-bulk-pay-all {
    font-weight: bold;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

/* اعضایی که برای این دوره‌ی خاص هنوز نوبتشان نرسیده (دوره‌ی زودتری از
   همین وام گردشی را پرداخت نکرده‌اند) — قابل انتخاب نیستند، فقط برای
   شفافیت نمایش داده می‌شوند که چرا در لیست انتخاب حاضر نیستند. */
.rotating-blocked-members {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rotating-bulk-pay-row-blocked {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 13px;
    padding: 6px 4px;
    color: var(--text-muted);
    opacity: 0.75;
}
.badge-expired { background: rgba(163,168,195,0.18); color: var(--text-muted); }

/* ===== جدول ===== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 500px;
}
th, td {
    padding: 8px 10px;
    text-align: right;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}
th { color: var(--text-muted); font-weight: 600; }

/* ===== آلرت ===== */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 0.85rem;
    transition: opacity 0.5s ease;
}
.alert-error { background: rgba(255,93,108,0.15); border: 1px solid rgba(255,93,108,0.4); color: #ffb3ba; }
.alert-success { background: rgba(46,204,113,0.15); border: 1px solid rgba(46,204,113,0.4); color: #a9f2c5; }

.text-muted { color: var(--text-muted); }
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* ===== فوتر ===== */
.site-footer {
    text-align: center;
    padding: 20px 14px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ===== صفحه اصلی ===== */
.hero {
    text-align: center;
    padding: 40px 16px;
}
.hero h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}
.hero p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 600px;
    margin: 0 auto 20px;
}

.copy-box {
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border: 1px dashed var(--card-border);
    padding: 8px 12px;
    border-radius: 10px;
    font-family: monospace;
    direction: ltr;
    text-align: left;
    font-size: 0.8rem;
    overflow-x: auto;
    flex-wrap: wrap;
}

/* ===== تب‌های ناوبری ===== */
.tab-content {
    display: none;
}
.tab-content:first-of-type {
    display: block;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}
.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 6px 12px;
    border-radius: 18px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    white-space: normal;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.tab-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.06);
    transition: background 0.2s ease, box-shadow 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.tab-icon { font-size: 1.15rem; line-height: 1; }
.tab-label { max-width: 100%; }
.tab:hover {
    background: rgba(255,255,255,0.09);
    color: var(--text-main);
    transform: translateY(-2px);
}
.tab:hover .tab-icon-wrap {
    background: rgba(255,255,255,0.14);
}
.tab-active {
    background: linear-gradient(160deg, rgba(124,92,255,0.20), rgba(34,211,201,0.10));
    border-color: rgba(124,92,255,0.55);
    color: #fff !important;
    box-shadow: 0 10px 22px rgba(124,92,255,0.25);
    transform: translateY(-2px);
}
.tab-active .tab-icon-wrap {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 4px 14px rgba(124,92,255,0.55);
}

@media (min-width: 640px) {
    .tabs { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
    .tab { font-size: 0.78rem; padding: 16px 8px 14px; }
    .tab-icon-wrap { width: 46px; height: 46px; }
    .tab-icon { font-size: 1.3rem; }
}

/* دکمه‌های انتخاب روش افزودن عضو (عضو موجود / ثبت‌نام عضو جدید) - همان استایل تب، رنگ آبی روشن هنگام انتخاب */
.mode-tab-active {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: #fff !important;
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(59,130,246,0.35);
}

/* ===== داشبورد ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    backdrop-filter: blur(12px);
}
.stat-icon { font-size: 1.4rem; margin-bottom: 4px; }
.stat-value { font-size: 1.1rem; font-weight: 700; }
.stat-label { color: var(--text-muted); font-size: 0.75rem; margin-top: 4px; }

/* ===== کارت‌های عضو ===== */
.members-grid {
    display: grid;
    position: relative;
    overflow: visible;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 600px) {
    .members-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
    .members-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}

.member-card {
    background: var(--card-bg);
    border: 2px solid var(--gold);
    border-radius: 14px;
    padding: 16px 14px;
    backdrop-filter: blur(12px);
    box-shadow: 0 6px 22px rgba(0,0,0,0.25);
    position: relative;
    transition: box-shadow 0.2s ease;
    overflow: visible;
}
.member-card:hover {
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    color: #2a1e04;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(217,178,92,0.35);
}
.member-name {
    font-weight: 700;
    font-size: 0.95rem;
    word-break: break-word;
}
.member-mobile {
    color: var(--text-muted);
    font-size: 0.75rem;
    direction: ltr;
    text-align: right;
}

/* ===== منوی سه‌نقطه ===== */
.menu-wrapper {
    position: relative;
    display: inline-block;
    z-index: 10000;
}
.member-card:has(.dropdown.show) {
    z-index: 10001;
}
.dots-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: rgba(255,255,255,0.08);
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}
.dots-btn:hover {
    background: rgba(255,255,255,0.18);
}

.dropdown {
    display: none;
    position: absolute;
    top: 38px;
    right: 0;
    background: #1a1a3a;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    min-width: 160px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
    z-index: 10002;
    overflow: hidden;
    padding: 4px 0;
    max-width: min(220px, calc(100vw - 24px));
}
.dropdown.open,
.dropdown[style*="display:block"] {
    display: block !important;
}

.dropdown button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: transparent;
    color: var(--text-main);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    text-align: right;
    transition: background 0.15s;
}
.dropdown button:last-child { border-bottom: none; }
.dropdown button:hover { background: rgba(255,255,255,0.07); }
.dropdown button.deposit { color: #4ade80; }
.dropdown button.withdraw { color: #f87171; }
.dropdown button.edit { color: #60a5fa; }
.dropdown button.delete { color: #f87171; }

/* ===== ردیف‌های اطلاعات ===== */
.row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    flex-wrap: wrap;
    gap: 4px;
}
.row .label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: right;
}
.row .value {
    font-weight: 700;
    font-size: 0.95rem;
    text-align: left;
    word-break: break-word;
}

hr {
    border: none;
    border-top: 1px solid var(--card-border);
    margin: 6px 0;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 3px 0;
    flex-wrap: wrap;
    gap: 4px;
}
.meta-row span:first-child { text-align: right; }
.meta-row span:last-child { text-align: left; word-break: break-word; }

/* ===== لیست تراکنش‌ها (کارت) ===== */
.tx-list { display: flex; flex-direction: column; gap: 10px; }
.tx-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    flex-wrap: wrap;
    transition: border-color .15s ease, background .15s ease;
}
.tx-card:hover { border-color: rgba(255,255,255,0.22); background: rgba(255,255,255,0.05); }
.tx-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.tx-card-icon.income { background: rgba(46,204,113,0.15); color: var(--success); }
.tx-card-icon.expense { background: rgba(255,93,108,0.15); color: var(--danger); }
.tx-card-body { flex: 1; min-width: 160px; }
.tx-card-desc {
    font-size: 0.86rem;
    font-weight: 600;
    margin-bottom: 6px;
    word-break: break-word;
}
.tx-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tx-tag {
    font-size: 0.68rem;
    padding: 3px 9px;
    border-radius: 20px;
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    white-space: nowrap;
}
.tx-tag-member { background: rgba(124,92,255,0.15); color: #b9a6ff; }
.tx-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
    margin-right: auto;
}
.tx-card-amount { font-weight: 800; font-size: 0.95rem; white-space: nowrap; }
.tx-card-actions { display: flex; gap: 6px; }
.tx-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all .15s ease;
}
.tx-edit-btn:hover { background: rgba(96,165,250,0.15); color: #60a5fa; border-color: rgba(96,165,250,0.4); }
.tx-delete-btn:hover { background: rgba(255,93,108,0.15); color: var(--danger); border-color: rgba(255,93,108,0.4); }

/* دکمه‌های متنی ویرایش/حذف تراکنش (به‌جای دکمه‌ی فقط-آیکون) */
.tx-action-btn-text {
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s ease;
    background: rgba(255,255,255,0.03);
    font-family: inherit;
    white-space: nowrap;
}
.tx-edit-btn-text {
    color: #60a5fa;
    border-color: rgba(96,165,250,0.3);
}
.tx-edit-btn-text:hover {
    background: rgba(96,165,250,0.15);
    border-color: rgba(96,165,250,0.5);
}
.tx-delete-btn-text {
    color: var(--danger);
    border-color: rgba(255,93,108,0.3);
}
.tx-delete-btn-text:hover {
    background: rgba(255,93,108,0.15);
    border-color: rgba(255,93,108,0.5);
}

/* =====================================================
   رنگ‌بندی هوشمند کارت تراکنش بر اساس نوع/دسته‌بندی
   ===================================================== */
.tx-card.tx-cat-deposit       { border-inline-start: 3px solid #2ecc71; }
.tx-card.tx-cat-withdrawal    { border-inline-start: 3px solid #ff5d6c; }
.tx-card.tx-cat-loan          { border-inline-start: 3px solid #fb923c; }
.tx-card.tx-cat-fee           { border-inline-start: 3px solid #d9b25c; }
.tx-card.tx-cat-installment   { border-inline-start: 3px solid #38bdf8; }
.tx-card.tx-cat-rotating      { border-inline-start: 3px solid #a78bfa; }
.tx-card.tx-cat-rotating-win  { border-inline-start: 3px solid #facc15; }
.tx-card.tx-cat-lottery       { border-inline-start: 3px solid #c084fc; }
.tx-card.tx-cat-membership    { border-inline-start: 3px solid #22d3ee; }
.tx-card.tx-cat-transfer      { border-inline-start: 3px solid #94a3b8; }
.tx-card.tx-cat-income        { border-inline-start: 3px solid #2ecc71; }
.tx-card.tx-cat-expense       { border-inline-start: 3px solid #ff5d6c; }

.tx-card-icon.tx-cat-deposit       { background: rgba(46,204,113,0.15);  color: #2ecc71; }
.tx-card-icon.tx-cat-withdrawal    { background: rgba(255,93,108,0.15);  color: #ff5d6c; }
.tx-card-icon.tx-cat-loan          { background: rgba(251,146,60,0.15);  color: #fb923c; }
.tx-card-icon.tx-cat-fee           { background: rgba(217,178,92,0.18);  color: #d9b25c; }
.tx-card-icon.tx-cat-installment   { background: rgba(56,189,248,0.15);  color: #38bdf8; }
.tx-card-icon.tx-cat-rotating      { background: rgba(167,139,250,0.15); color: #a78bfa; }
.tx-card-icon.tx-cat-rotating-win  { background: rgba(250,204,21,0.18);  color: #facc15; }
.tx-card-icon.tx-cat-lottery       { background: rgba(192,132,252,0.15); color: #c084fc; }
.tx-card-icon.tx-cat-membership    { background: rgba(34,211,238,0.15);  color: #22d3ee; }
.tx-card-icon.tx-cat-transfer      { background: rgba(148,163,184,0.15); color: #94a3b8; }
.tx-card-icon.tx-cat-income        { background: rgba(46,204,113,0.15);  color: var(--success); }
.tx-card-icon.tx-cat-expense       { background: rgba(255,93,108,0.15);  color: var(--danger); }

.tx-tag.tx-cat-deposit       { background: rgba(46,204,113,0.15);  color: #2ecc71; }
.tx-tag.tx-cat-withdrawal    { background: rgba(255,93,108,0.15);  color: #ff5d6c; }
.tx-tag.tx-cat-loan          { background: rgba(251,146,60,0.15);  color: #fb923c; }
.tx-tag.tx-cat-fee           { background: rgba(217,178,92,0.2);   color: #d9b25c; }
.tx-tag.tx-cat-installment   { background: rgba(56,189,248,0.15);  color: #38bdf8; }
.tx-tag.tx-cat-rotating      { background: rgba(167,139,250,0.15); color: #a78bfa; }
.tx-tag.tx-cat-rotating-win  { background: rgba(250,204,21,0.2);   color: #facc15; }
.tx-tag.tx-cat-lottery       { background: rgba(192,132,252,0.15); color: #c084fc; }
.tx-tag.tx-cat-membership    { background: rgba(34,211,238,0.15);  color: #22d3ee; }
.tx-tag.tx-cat-transfer      { background: rgba(148,163,184,0.15); color: #94a3b8; }
@media (max-width: 480px) {
    .tx-card-right { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; margin-right: 0; }
}

/* ===== کارت وام و اقساط ===== */
.loan-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 16px 14px;
    margin-bottom: 16px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 26px rgba(0,0,0,0.22);
    border: 2px solid var(--card-border);
}
.loan-card-active { border-color: rgba(255,93,108,0.5); }
.loan-card-settled { border-color: rgba(46,204,113,0.5); }

.loan-progress {
    height: 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    margin-top: 12px;
    overflow: hidden;
}
.loan-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 999px;
    transition: width 0.3s ease;
}

.installments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.installment-card {
    border-radius: 12px;
    padding: 10px;
    border: 2px solid var(--danger);
    background: rgba(255,255,255,0.03);
    text-align: center;
}
.installment-paid { border-color: var(--success); }
.installment-unpaid { border-color: var(--danger); }
.installment-number {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 4px;
}
.installment-amount { font-size: 0.8rem; margin-bottom: 4px; }
.installment-date { color: var(--text-muted); font-size: 0.7rem; }

/* ===== نمایش مبلغ هر قسط ===== */
#installmentDisplay {
    background: rgba(46,204,113,0.08);
    border-radius: 8px;
    border: 1px solid rgba(46,204,113,0.2);
    padding: 10px;
    margin-top: 8px;
}
#installmentDisplay span {
    color: var(--success);
    font-weight: 700;
}

/* ===== مودال ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99998;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: linear-gradient(145deg, #1a1a3a, #14142e);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 30px 28px;
    width: 100%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: modalScaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.modal-box::-webkit-scrollbar {
    width: 4px;
}
.modal-box::-webkit-scrollbar-track {
    background: transparent;
}
.modal-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

@keyframes modalScaleIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}
.modal-header .modal-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.modal-header .modal-close-btn:hover {
    background: rgba(255, 93, 108, 0.15);
    color: #ff5d6c;
    transform: rotate(90deg);
}

.modal-box .field {
    margin-bottom: 16px;
}
.modal-box .field:last-of-type {
    margin-bottom: 20px;
}
.modal-box label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}
.modal-box input[type="text"],
.modal-box input[type="number"],
.modal-box input[type="month"],
.modal-box select {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
}
.modal-box input[type="text"]:hover,
.modal-box input[type="number"]:hover,
.modal-box select:hover {
    background: rgba(255, 255, 255, 0.06);
}
.modal-box input[type="text"]:focus,
.modal-box input[type="number"]:focus,
.modal-box select:focus {
    border-color: var(--accent-2);
    background: rgba(34, 211, 201, 0.05);
    box-shadow: 0 0 0 3px rgba(34, 211, 201, 0.1);
}
.modal-box select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a3a8c3' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
    cursor: pointer;
}
.modal-box select[multiple] {
    background-image: none;
    padding-left: 12px;
    height: auto;
    min-height: 140px;
}
.modal-box select[multiple] option {
    padding: 6px 10px;
    border-radius: 4px;
    transition: background 0.15s ease;
}
.modal-box select[multiple] option:hover {
    background: rgba(124, 92, 255, 0.15);
}
.modal-box select[multiple] option:checked {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
}

.modal-box .radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 6px 0;
}
.modal-box .radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
}
.modal-box .radio-group label:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
}
.modal-box .radio-group input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-2);
    cursor: pointer;
    flex-shrink: 0;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
/* چیدمان عمودی: دکمه‌ی ثبت (تایید) بالا، انصراف زیر آن */
.modal-actions.modal-actions-stacked {
    flex-direction: column;
}
.modal-actions.modal-actions-stacked .btn-cancel,
.modal-actions.modal-actions-stacked .btn-submit-deposit,
.modal-actions.modal-actions-stacked .btn-submit-withdraw {
    flex: none;
    width: 100%;
}
.modal-actions .btn-cancel {
    flex: 1;
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}
.modal-actions .btn-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}
.modal-actions .btn-submit-deposit {
    flex: 2;
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.25);
}
.modal-actions .btn-submit-deposit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(34, 197, 94, 0.4);
}
.modal-actions .btn-submit-deposit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}
.modal-actions .btn-submit-withdraw {
    flex: 2;
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.25);
}
.modal-actions .btn-submit-withdraw:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(239, 68, 68, 0.4);
}
.modal-actions .btn-submit-withdraw:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* مودال «پرداخت قسط»: دکمه‌ی تأیید (سبز، هماهنگ با بقیه دکمه‌های تأیید سایت)
   بالا و دکمه‌ی انصراف زیرش قرار می‌گیرد — به‌صورت عمودی، نه کنار هم. */
.installment-pay-actions {
    flex-direction: column;
}
.installment-pay-actions .btn-submit-deposit,
.installment-pay-actions .btn-cancel {
    flex: none;
    width: 100%;
}

/* ===== Toast سراسری سایت ===== */
.app-toast {
    display: none;
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 14px;
    padding: 16px 32px;
    color: #fff;
    font-size: 15px;
    z-index: 99999;
    box-shadow: 0 12px 50px rgba(0, 0, 0, 0.6);
    min-width: 280px;
    max-width: 90vw;
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-family: 'Vazirmatn', sans-serif;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    letter-spacing: 0.3px;
}
.app-toast.success {
    border: 1px solid rgba(74, 222, 128, 0.3);
    background: rgba(20, 50, 30, 0.95);
}
.app-toast.error {
    border: 1px solid rgba(248, 113, 113, 0.3);
    background: rgba(50, 20, 20, 0.95);
}
@media (max-width: 576px) {
    .app-toast {
        min-width: auto;
        width: 90vw;
        padding: 14px 20px;
        font-size: 13px;
        bottom: 20px;
    }
}
@media (max-width: 400px) {
    .app-toast { padding: 12px 16px; font-size: 12px; }
}

/* ===== Toast ===== */
#toastMessage {
    display: none;
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a3a;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 14px 28px;
    color: #fff;
    font-size: 14px;
    z-index: 9999;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

#transactionToast {
    display: none;
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 14px;
    padding: 16px 32px;
    color: #fff;
    font-size: 15px;
    z-index: 99999;
    box-shadow: 0 12px 50px rgba(0, 0, 0, 0.6);
    min-width: 280px;
    max-width: 90vw;
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-family: 'Vazirmatn', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    animation: toastSlideUp 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#transactionToast.success {
    border: 1px solid rgba(74, 222, 128, 0.3);
    background: rgba(20, 50, 30, 0.95);
}
#transactionToast.error {
    border: 1px solid rgba(248, 113, 113, 0.3);
    background: rgba(50, 20, 20, 0.95);
}
#transactionToast #toastIcon {
    font-size: 1.4rem;
    flex-shrink: 0;
}
#transactionToast #toastMessage {
    font-weight: 500;
    letter-spacing: 0.3px;
}

@keyframes toastSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}
@keyframes toastSlideDown {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(30px) scale(0.95);
    }
}

/* ===== واکنش‌گرا ===== */
@media (max-width: 576px) {
    .btn-deposit, .btn-withdraw {
        min-width: 100% !important;
        padding: 14px 20px !important;
        font-size: 0.95rem !important;
    }
    .modal-box {
        padding: 20px 16px;
        border-radius: 16px;
        max-width: 100%;
        margin: 10px;
    }
    .modal-header h3 { font-size: 1rem; }
    .modal-header .modal-close-btn { width: 32px; height: 32px; font-size: 1rem; }
    .modal-box input[type="text"], .modal-box input[type="number"], .modal-box select {
        padding: 9px 12px;
        font-size: 0.9rem;
    }
    .modal-box .radio-group { gap: 8px; }
    .modal-box .radio-group label { padding: 4px 10px; font-size: 0.82rem; }
    .modal-actions { flex-direction: column; gap: 8px; }
    .modal-actions .btn, .modal-actions .btn-cancel, .modal-actions .btn-submit-deposit, .modal-actions .btn-submit-withdraw {
        flex: 1;
        width: 100%;
        padding: 11px 16px;
        font-size: 0.9rem;
    }
    #transactionToast {
        min-width: auto;
        width: 90vw;
        padding: 14px 20px;
        font-size: 13px;
        bottom: 20px;
    }
    #transactionToast #toastIcon { font-size: 1.2rem; }
    .modal-box select[multiple] { min-height: 100px; }
}

@media (max-width: 400px) {
    .modal-box { padding: 16px 12px; }
    .modal-header { margin-bottom: 14px; padding-bottom: 12px; }
    .modal-box .field { margin-bottom: 12px; }
    .modal-box label { font-size: 0.75rem; }
    .modal-box input[type="text"], .modal-box input[type="number"], .modal-box select {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    .modal-box select[multiple] { min-height: 80px; }
    .modal-box select[multiple] option { padding: 4px 8px; font-size: 0.8rem; }
    .modal-actions .btn, .modal-actions .btn-cancel, .modal-actions .btn-submit-deposit, .modal-actions .btn-submit-withdraw {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
    #transactionToast { padding: 12px 16px; font-size: 12px; gap: 8px; }
}
/* =====================================================
   کارت‌های وام گردشی (چند وام گردشی مستقل در هر صندوق)
   ===================================================== */
.rotating-funds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 4px;
}

.rotating-fund-card {
    position: relative;
    background: linear-gradient(150deg, rgba(124,92,255,0.16), rgba(34,211,201,0.07) 55%, rgba(240,200,105,0.06));
    border: 1px solid rgba(124,92,255,0.35);
    border-radius: 14px;
    padding: 14px 16px 16px;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.rotating-fund-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 15% 0%, rgba(240,200,105,0.18), transparent 55%);
    pointer-events: none;
}
.rotating-fund-card:hover {
    transform: translateY(-3px);
    border-color: rgba(124,92,255,0.6);
    box-shadow: 0 10px 26px rgba(124,92,255,0.22);
}
.rotating-fund-card .rf-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.rotating-fund-card .rf-title {
    font-weight: 800;
    font-size: 1rem;
    background: linear-gradient(90deg, var(--gold2), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.rotating-fund-card .rf-desc {
    color: var(--text-muted);
    font-size: 0.76rem;
    margin: 4px 0 0;
    line-height: 1.5;
}
.rotating-fund-card .rf-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.76rem;
    margin-top: 10px;
    color: var(--text-main);
}
.rotating-fund-card .rf-progress-wrap {
    margin-top: 10px;
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
    height: 7px;
    overflow: hidden;
}
.rotating-fund-card .rf-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--accent-2), #34d399);
    border-radius: 999px;
}
.rotating-fund-card .rf-manage-btn {
    margin-top: 12px;
    width: 100%;
    text-align: center;
    background: linear-gradient(135deg, #8b5cf6, #22d3c9);
    box-shadow: 0 4px 14px rgba(139,92,246,0.3);
}

.rotating-manage-card {
    background: linear-gradient(135deg, rgba(124,92,255,0.08), rgba(34,211,201,0.04));
}
.rotating-manage-card .rf-stat h3 {
    background: linear-gradient(90deg, var(--gold2), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* کارت هر دوره‌ی قرعه‌کشی - قابل کلیک برای مشاهده‌ی جزئیات پرداخت‌ها */
.rotating-period-card {
    transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.rotating-period-card:hover {
    border-color: var(--accent) !important;
    background: rgba(124,92,255,0.06);
    transform: translateY(-1px);
}
.rotating-period-view-hint {
    /* صفحه راست‌به‌چپ (dir=rtl) است؛ در فلکس‌باکس، margin-right/left فیزیکی‌اند
       و با dir تغییر نمی‌کنند. برای اینکه این متن به سمت راست (ابتدای ردیف در rtl)
       رانده شود، باید فضای خالی سمت چپ با margin-left:auto جذب شود، نه راست. */
    margin-left: auto;
    color: var(--accent-2);
    font-size: 12px;
    font-weight: 600;
}

/* =====================================================
   جعبه‌ی آمار کوچک (استفاده در پنل مدیریت کاربران و جاهای دیگر)
   ===================================================== */
.rf-stat {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 10px 12px;
}
.rf-stat p { margin: 0 0 4px; font-size: 0.75rem; }
.rf-stat h3 { margin: 0; font-size: 1.05rem; }

/* ===== صفحه کیف پول من ===== */
.wallet-hero {
    position: relative;
    overflow: hidden;
    padding: 26px 22px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(217,178,92,0.18), rgba(124,92,255,0.14));
    border: 1px solid var(--card-border);
    box-shadow: 0 12px 34px rgba(0,0,0,0.28);
}
.wallet-hero::before {
    content: '';
    position: absolute;
    top: -60px;
    left: -60px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(240,200,105,0.35), transparent 70%);
    pointer-events: none;
}
.wallet-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
    position: relative;
    z-index: 1;
}
.wallet-hero-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(217,178,92,0.4);
    flex-shrink: 0;
}
.wallet-hero-icon svg { width: 24px; height: 24px; color: #2b1e05; }
.wallet-balance-label { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 4px; }
.wallet-balance-amount {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--gold), var(--gold2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 0;
    line-height: 1.3;
}
.wallet-code-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px dashed var(--card-border);
    padding: 8px 14px;
    border-radius: 999px;
    font-family: monospace;
    direction: ltr;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.wallet-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
    position: relative;
    z-index: 1;
}
.wallet-action-btn {
    flex: 1;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: not-allowed;
    opacity: 0.55;
}
.wallet-tx-list { display: flex; flex-direction: column; gap: 8px; }
.wallet-tx-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--card-border);
    flex-wrap: wrap;
}
.wallet-tx-left { display: flex; align-items: center; gap: 10px; }
.wallet-tx-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.wallet-tx-icon.credit { background: rgba(46,204,113,0.15); }
.wallet-tx-icon.debit { background: rgba(255,93,108,0.15); }
.wallet-tx-amount { font-weight: 700; white-space: nowrap; }
.wallet-tx-amount.credit { color: var(--success); }
.wallet-tx-amount.debit { color: var(--danger); }

/* =====================================================
   بخش «حساب‌ها» — کاروسل کارت‌های قابل اسلاید (چپ/راست) و
   فرم انتقال وجه بین حساب‌ها
   ===================================================== */
.accounts-carousel {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 14px 4px 10px;
    margin: 0 -4px;
    scrollbar-width: none;
}
.accounts-carousel::-webkit-scrollbar {
    display: none;
}
.account-card {
    flex: 0 0 78%;
    max-width: 300px;
    scroll-snap-align: center;
    background: linear-gradient(135deg, rgba(124,92,255,0.16), rgba(34,211,201,0.10));
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 18px 16px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.25);
}
.account-card-negative {
    background: linear-gradient(135deg, rgba(255,93,108,0.16), rgba(255,93,108,0.05));
    border-color: rgba(255,93,108,0.35);
}
.account-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.account-card-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
}
.account-card-balance {
    margin-top: 14px;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
}
.account-card-archive-btn {
    width: 100%;
    font-size: 0.75rem;
    color: var(--danger);
    border-color: rgba(255,93,108,0.3);
}
.account-card-add {
    flex: 0 0 78%;
    max-width: 300px;
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1.5px dashed var(--card-border);
    border-radius: 16px;
    padding: 18px 16px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 108px;
}
.account-card-add:hover {
    border-color: var(--accent-2);
    color: var(--accent-2);
    background: rgba(34,211,201,0.05);
}
.account-card-add-icon {
    font-size: 1.6rem;
}
.account-carousel-hint {
    text-align: center;
    font-size: 0.75rem;
    margin-top: 4px;
}
.account-add-form {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.account-add-form input[type="text"] {
    flex: 1;
    min-width: 180px;
    margin-bottom: 0;
}

/* =====================================================
   مودال پروفایل کامل عضو صندوق
   ===================================================== */
.profile-modal-box {
    background: linear-gradient(160deg, rgba(30,24,55,0.98), rgba(20,16,38,0.98));
}
.profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold2));
    color: #2a1e04;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    box-shadow: 0 4px 14px rgba(217,178,92,0.4);
    flex-shrink: 0;
}
.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}
.profile-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
.badge-manager { background: rgba(217,178,92,0.2); color: var(--gold2); border: 1px solid rgba(217,178,92,0.4); }
.badge-member { background: rgba(163,168,195,0.15); color: var(--text-muted); border: 1px solid rgba(163,168,195,0.3); }
.badge-winner { background: rgba(250,204,21,0.18); color: #facc15; border: 1px solid rgba(250,204,21,0.4); }
.badge-good { background: rgba(46,204,113,0.18); color: var(--success); border: 1px solid rgba(46,204,113,0.4); }

.profile-section {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.profile-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.profile-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.profile-stat {
    border-radius: 12px;
    padding: 12px 10px;
    text-align: center;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}
.profile-stat .pstat-icon {
    font-size: 1.3rem;
    margin-bottom: 4px;
}
.profile-stat .pstat-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    line-height: 1.4;
}
.profile-stat .pstat-value {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-main);
    direction: ltr;
}
.pstat-green  { background: rgba(46,204,113,0.10);  border-color: rgba(46,204,113,0.28); }
.pstat-red    { background: rgba(255,93,108,0.10);  border-color: rgba(255,93,108,0.28); }
.pstat-gold   { background: rgba(217,178,92,0.12);  border-color: rgba(217,178,92,0.32); }
.pstat-blue   { background: rgba(96,165,250,0.10);  border-color: rgba(96,165,250,0.28); }
.pstat-orange { background: rgba(251,146,60,0.10);  border-color: rgba(251,146,60,0.28); }
.pstat-purple { background: rgba(168,85,247,0.10);  border-color: rgba(168,85,247,0.28); }

.profile-tx-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    padding: 6px 0 2px;
}
.profile-tx-icon { flex-shrink: 0; }
.profile-tx-desc {
    flex: 1;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.profile-tx-amount {
    font-weight: 700;
    direction: ltr;
    flex-shrink: 0;
    font-size: 0.78rem;
}
.tx-in { color: var(--success); }
.tx-out { color: var(--danger); }
.profile-tx-date {
    font-size: 0.68rem;
    color: var(--text-muted);
    opacity: 0.7;
    margin-bottom: 8px;
    padding-right: 22px;
}

/* =====================================================
   صفحه‌ی شارژ کیف‌پول اعضا (ادمین)
   ===================================================== */
.wc-summary-card {
    position: relative;
    overflow: hidden;
    text-align: center;
}
.wc-summary-card .wc-summary-icon {
    font-size: 1.6rem;
    margin-bottom: 4px;
}
.wc-blue h2 { color: #60a5fa; }
.wc-gold h2 { color: var(--gold2); }
.wc-purple h2 { color: #a855f7; }

.wc-floating-bar {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(30,24,55,0.98), rgba(20,16,38,0.98));
    border: 1px solid rgba(217,178,92,0.4);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border-radius: 999px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 500;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}
@media (max-width: 480px) {
    .wc-floating-bar {
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
        justify-content: space-between;
        border-radius: 16px;
    }
}
