/* ===================================================================
   BoxFX — شیوه‌نامه‌ی اصلی
   توکن‌ها دقیقاً مطابق «دستورالعمل UI» و فایل طراحی zip.
   تم تیره، رنگ تأکید آبی، سبز/قرمز معنایی.
   =================================================================== */

/* ---------- توکن‌ها (از dc.html) ---------- */
:root {
    /* سطوح تیره */
    --bg:        #0a0d12;   /* پایه‌ی صفحه */
    --sidebar:   #0c1018;   /* نوار کناری */
    --field:     #0f141c;   /* زمینه‌ی فیلد */
    --card:      #12161f;   /* کارت */
    --card-2:    #161b26;
    --tab-active:#222c3d;

    /* مرزها */
    --border:      rgba(255,255,255,0.06);
    --border-soft: rgba(255,255,255,0.05);
    --border-input:rgba(255,255,255,0.07);
    --border-hover:rgba(255,255,255,0.12);

    /* متن */
    --text:      #f1f4f9;   /* اصلی */
    --text-2:    #c3cbd9;   /* روشن ثانویه */
    --text-dim:  #8a93a3;   /* کم‌رنگ (برچسب) */
    --text-faint:#6b7488;   /* محوتر */
    --text-mute: #5a6376;   /* محوترین */

    /* برند و معنایی */
    --accent:     #4c8dff;  /* آبی تأکید */
    --accent-2:   #2f6fe0;  /* انتهای گرادیان */
    --accent-soft:rgba(76,141,255,0.12);
    --profit:     #2bd576;  /* سبز سود */
    --profit-soft:rgba(43,213,118,0.13);
    --loss:       #ff5c6c;  /* قرمز زیان */
    --loss-soft:  rgba(255,92,108,0.12);
    --amber:      #ffb84c;  /* هشدار */
    --amber-soft: rgba(255,184,76,0.13);
    --violet:     #a78bfa;  /* ادمین */
    --violet-soft:rgba(167,139,250,0.13);

    /* شعاع */
    --r-xs: 8px;
    --r-sm: 11px;
    --r:    12px;
    --r-card: 16px;
    --r-modal: 22px;

    /* سایه */
    --shadow-card: 0 8px 24px -16px rgba(0,0,0,0.6);
    --shadow-btn:  0 10px 24px -10px rgba(76,141,255,0.7);
    --shadow-modal:0 30px 70px -28px rgba(0,0,0,0.75);

    /* گرادیان دکمه */
    --grad-accent: linear-gradient(150deg, #4c8dff, #2f6fe0);

    --maxw: 1180px;
    --sidebar-w: 240px;
}

/* ---------- ریست ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    font-family: 'Vazirmatn', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 15px;
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
code, .mono { font-family: 'Space Grotesk', monospace; }

/* اسکرول‌بار */
::-webkit-scrollbar { width: 10px; height: 9px; }
::-webkit-scrollbar-thumb { background: #232a36; border-radius: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }

/* ---------- تایپوگرافی ---------- */
h1, h2, h3 { line-height: 1.35; font-weight: 800; letter-spacing: -0.5px; }
h1 { font-size: 23px; }
h2 { font-size: 24px; }
h3 { font-size: 15px; font-weight: 700; }

.text-dim   { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
.text-profit{ color: var(--profit); }
.text-loss  { color: var(--loss); }
.num { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.ltr { direction: ltr; }
.wordmark { font-family: 'Space Grotesk', sans-serif; font-weight: 700; letter-spacing: -0.5px; }

/* عدد قهرمان */
.stat-num { font-size: 27px; font-weight: 800; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }

/* ---------- برند / لوگو ---------- */
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand .mark { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; }
.brand .mark svg { width: 100%; height: 100%; display: block; }
.brand .name { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }
.brand .name b { color: var(--accent); font-weight: 700; }

/* ---------- دکمه ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: 13px 24px;
    border-radius: var(--r);
    border: 1px solid transparent;
    font-weight: 700; font-size: 14.5px;
    transition: filter .15s, transform .1s, background .15s, border-color .15s;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad-accent); color: #fff; box-shadow: var(--shadow-btn); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-secondary { background: var(--field); color: var(--text-2); border-color: var(--border-hover); font-weight: 600; }
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.04); color: var(--text); }
.btn-ghost { background: var(--accent-soft); color: var(--accent); border-color: rgba(76,141,255,0.3); }
.btn-ghost:hover:not(:disabled) { background: rgba(76,141,255,0.2); }
.btn-profit { background: var(--profit-soft); color: var(--profit); border-color: rgba(43,213,118,0.3); }
.btn-danger { background: var(--loss-soft); color: var(--loss); border-color: rgba(255,92,108,0.3); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px; font-size: 15px; }
.btn-sm { padding: 9px 16px; font-size: 13px; }

/* ---------- کارت ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 20px;
    box-shadow: var(--shadow-card);
}
.card-pad-lg { padding: 28px; }

/* کارت آماری */
.stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 20px;
    box-shadow: var(--shadow-card);
}
.stat .label { color: var(--text-dim); font-size: 13px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.stat .label .ic { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); display: grid; place-items: center; }
.stat .value { font-size: 27px; font-weight: 800; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12.5px; margin-top: 8px; font-weight: 600; }

/* ---------- فرم ---------- */
.field { margin-bottom: 16px; }
.field label, label.lbl {
    display: block; margin-bottom: 8px;
    font-size: 13px; color: var(--text-dim); font-weight: 500;
}
.field label .opt {
    font-size: 11px; color: var(--text-mute);
    background: rgba(255,255,255,0.05); padding: 2px 7px; border-radius: 6px;
    margin-right: 6px;
}
.input {
    width: 100%;
    padding: 14px 16px;
    background: var(--field);
    border: 1px solid var(--border-input);
    border-radius: var(--r);
    color: #e7ebf0;
    font-size: 15px;
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #4f596b; }
.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(76,141,255,0.15);
}
.input.ltr { direction: ltr; text-align: left; }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.8; }
.hint { font-size: 12px; color: var(--text-mute); margin-top: 6px; line-height: 1.6; }

/* ---------- بَج ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; font-weight: 600;
    padding: 5px 12px; border-radius: var(--r-xs);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.badge-green  { color: var(--profit); background: rgba(43,213,118,0.12); }
.badge-blue   { color: var(--accent); background: rgba(76,141,255,0.12); }
.badge-amber  { color: var(--amber);  background: rgba(255,184,76,0.12); }
.badge-red    { color: var(--loss);   background: rgba(255,92,108,0.12); }
.badge-gray   { color: #7c8696;       background: rgba(124,134,150,0.12); }
.badge-violet { color: var(--violet); background: rgba(167,139,250,0.12); }
.badge-green .dot  { background: var(--profit); }
.badge-blue .dot   { background: var(--accent); }
.badge-amber .dot  { background: var(--amber); }
.badge-red .dot    { background: var(--loss); }
.badge-gray .dot   { background: #7c8696; }
.badge-violet .dot { background: var(--violet); }

/* ---------- alert ---------- */
.alert {
    padding: 13px 16px; border-radius: var(--r);
    font-size: 13.5px; margin-bottom: 16px;
    border: 1px solid transparent;
    display: flex; gap: 9px; align-items: flex-start;
}
.alert-error   { background: var(--loss-soft);   border-color: rgba(255,92,108,0.3); color: #ffc4ca; }
.alert-success { background: var(--profit-soft); border-color: rgba(43,213,118,0.3); color: #b7f0cf; }
.alert-info    { background: var(--accent-soft); border-color: rgba(76,141,255,0.3); color: #bcd5ff; }

/* ---------- divider ---------- */
.or { display: flex; align-items: center; gap: 14px; color: var(--text-mute); font-size: 12px; margin: 22px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--text-dim); }
.empty .ic { font-size: 2.4rem; margin-bottom: .6rem; opacity: .5; }
.empty h3 { margin-bottom: .4rem; color: var(--text-2); }
.empty p { margin-bottom: 1.2rem; font-size: 13.5px; }

/* ===================================================================
   صفحه‌ی احراز هویت — کارت مرکزی با glow (مطابق zip)
   =================================================================== */
.auth-screen {
    min-height: 100vh; width: 100%;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    position: relative; overflow: hidden;
}
.auth-glow {
    position: absolute; top: -10%; right: 50%; transform: translateX(50%);
    width: 720px; height: 720px;
    background: radial-gradient(circle, rgba(76,141,255,0.16) 0%, rgba(76,141,255,0.04) 38%, rgba(10,13,18,0) 68%);
    animation: glowPulse 7s ease-in-out infinite;
    pointer-events: none;
}
.auth-card {
    position: relative; width: min(440px, 100%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-modal);
    box-shadow: var(--shadow-modal), 0 1px 0 rgba(255,255,255,0.03) inset;
    padding: 38px 34px 34px;
    animation: cardIn .5s cubic-bezier(.2,.7,.3,1) both;
}
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 30px; }
.auth-logo .row { display: flex; align-items: center; gap: 11px; }
.auth-logo .name { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.auth-logo .name b { color: var(--accent); }
.auth-logo .tag { font-size: 13px; color: var(--text-faint); font-weight: 500; }

/* تب‌ها */
.auth-tabs {
    display: flex; gap: 5px;
    background: var(--sidebar);
    border: 1px solid var(--border-soft);
    border-radius: 13px; padding: 5px; margin-bottom: 26px;
}
.auth-tab {
    flex: 1; padding: 11px; border-radius: 9px; border: none;
    font-size: 14px; font-weight: 700; transition: all .18s;
    background: transparent; color: var(--text-faint);
}
.auth-tab.active { background: var(--tab-active); color: var(--text); box-shadow: 0 2px 8px -3px rgba(0,0,0,0.5); }

.auth-back {
    background: none; border: none; color: #7c8696;
    font-size: 13px; cursor: pointer; padding: 0; margin-bottom: 18px;
    display: flex; align-items: center; gap: 6px;
}
.auth-back:hover { color: var(--text-2); }
.auth-terms { text-align: center; font-size: 12px; color: var(--text-mute); margin-top: 16px; line-height: 1.7; }

/* ورودی OTP */
.otp-input {
    text-align: center; letter-spacing: 12px;
    font-size: 22px; font-weight: 700;
}
.otp-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; min-height: 22px; font-size: 13px; color: var(--text-faint); }
.otp-meta .resend { background: none; border: none; color: var(--accent); font-size: 13px; font-weight: 700; cursor: pointer; padding: 0; }
.otp-meta .resend:hover { text-decoration: underline; }

/* ===================================================================
   پوسته‌ی پلتفرم — سایدبار + محتوا
   =================================================================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: var(--sidebar);
    border-left: 1px solid var(--border);
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
}
.sidebar-head { display: flex; align-items: center; gap: 11px; padding: 24px 22px 22px; }
.sidebar-head .sub { font-size: 10.5px; color: var(--text-faint); margin-top: 1px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 12px; overflow-y: auto; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 13px; border-radius: 10px;
    color: #99a2b2; font-size: 13.5px; font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.nav-link .ic { width: 18px; height: 18px; flex-shrink: 0; display: grid; place-items: center; }
.sidebar-foot { margin-top: auto; padding: 16px; border-top: 1px solid var(--border); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    border-bottom: 1px solid var(--border);
    background: rgba(12,16,24,0.8); backdrop-filter: blur(8px);
    position: sticky; top: 0; z-index: 20;
    padding: 14px 28px;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.user-chip { display: flex; align-items: center; gap: .5rem; padding: .4rem .4rem .4rem .8rem; border: 1px solid var(--border); border-radius: 999px; font-size: .88rem; }
.user-chip .av { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }

.page { max-width: var(--maxw); margin: 0 auto; padding: 32px 28px 60px; width: 100%; }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin-bottom: 6px; }
.page-head p { color: var(--text-dim); font-size: 14px; }

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

/* ---------- toast ---------- */
.toast-wrap { position: fixed; bottom: 24px; left: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--r); padding: 13px 18px;
    box-shadow: var(--shadow-modal); font-size: 13.5px; font-weight: 500;
    display: flex; align-items: center; gap: 10px; min-width: 240px;
    animation: slideUp .25s ease;
}
.toast.ok  { border-color: rgba(43,213,118,0.4); }
.toast.err { border-color: rgba(255,92,108,0.4); }
.toast .bar { width: 4px; align-self: stretch; border-radius: 4px; }
.toast.ok .bar  { background: var(--profit); }
.toast.err .bar { background: var(--loss); }

/* ---------- modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(5,7,11,0.7);
    backdrop-filter: blur(4px); z-index: 9000;
    display: flex; align-items: center; justify-content: center; padding: 24px;
    animation: fadeIn .18s ease;
}
.modal-box {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--r-modal); box-shadow: var(--shadow-modal);
    width: min(460px, 100%); padding: 28px;
    animation: slideUp .25s ease;
}
.modal-box h3 { margin-bottom: 10px; font-size: 18px; }
.modal-box p { color: var(--text-dim); font-size: 14px; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-start; }

/* ---------- انیمیشن ---------- */
@keyframes cardIn  { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes glowPulse { 0%,100% { opacity: .55; } 50% { opacity: .85; } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- موبایل ---------- */
@media (max-width: 880px) {
    .sidebar { position: fixed; right: 0; z-index: 50; transform: translateX(100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .main { width: 100%; }
}
@media (max-width: 560px) {
    .page { padding: 20px 16px 48px; }
    .auth-card { padding: 30px 22px 26px; }
}

/* دسترسی */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
