/* ════════════════════════════════════════════════════════════════════
   لایه‌ی رنگی PooyaCRM — روی design-system.css و app.css سوار می‌شود (آخرین stylesheet).
   - پالت ۸ رنگی (tone) برای آواتار، آیکون ماژول‌ها، وضعیت‌ها و سربرگ پنل‌ها
   - گرادیان برند از --primary/--accent ساخته می‌شود، پس برند اختصاصی مستاجر هم رنگی می‌ماند
   - اکشن‌ها: بالا آمدن در hover، فشردگی در کلیک و موج نور از نقطه‌ی کلیک (--rx/--ry از App.razor)
   - placeholder اسکلتی (Skeleton.razor) و وضعیت خالی با تصویرک (EmptyState.razor)
   ════════════════════════════════════════════════════════════════════ */

:root {
    /* پالت tone — رنگ پررنگ برای متن/آیکون روی پس‌زمینه‌ی روشن، و نسخه‌ی کم‌رنگ */
    --t-blue: #2f6fed;    --t-blue-soft: #e8f0fe;
    --t-violet: #7c4dff;  --t-violet-soft: #f0ebff;
    --t-pink: #e0457b;    --t-pink-soft: #fde9f0;
    --t-orange: #f0702e;  --t-orange-soft: #fff0e6;
    --t-amber: #d99206;   --t-amber-soft: #fff6dc;
    --t-emerald: #12a06a; --t-emerald-soft: #e3f7ee;
    --t-teal: #0f9a8e;    --t-teal-soft: #e0f5f2;
    --t-sky: #0b93c9;     --t-sky-soft: #e1f4fb;

    --violet: var(--t-violet);
    /* رنگ دوم و سوم برند: پیش‌فرض بنفش و صورتی پوسته؛ برند اختصاصی مستاجر هر دو را «رنگ دوم» خودش می‌کند
       (BrandingRules.CssVariables). ترکیب‌ها در oklch است تا دو رنگ دور از هم (مثلاً آبی و نارنجی) گل‌آلود نشوند. */
    --brand-2: var(--violet);
    --brand-3: var(--t-pink);
    --grad-brand: linear-gradient(135deg, var(--primary) 0%, color-mix(in oklch, var(--primary) var(--brand-mix, 55%), var(--brand-2)) 100%);
    --grad-brand-deep: linear-gradient(160deg,
        color-mix(in srgb, var(--primary-dark) 78%, #0b1033) 0%,
        color-mix(in srgb, var(--primary-dark) 55%, color-mix(in srgb, var(--brand-2) 32%, #0b1033)) 100%);
    --grad-call: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, #22c55e) 100%);
    --grad-hero: linear-gradient(125deg,
        var(--primary) 0%,
        color-mix(in oklch, var(--primary) 50%, var(--brand-2)) 55%,
        color-mix(in oklch, var(--brand-2) 60%, var(--brand-3)) 100%);

    /* خنثی‌های سردتر تا رنگ‌ها زنده‌تر دیده شوند */
    --canvas: #f3f5fb;
    --surface-sunken: #eef1f8;
    --line: #e2e6f0;
    --line-strong: #cdd3e1;
    --hover: color-mix(in srgb, var(--primary) 5%, transparent);

    --r-panel: 14px;
    --r-control: 8px;

    --shadow-card: 0 1px 2px rgba(20, 30, 70, 0.04), 0 6px 20px -8px rgba(20, 30, 70, 0.10);
    --shadow-lift: 0 2px 4px rgba(20, 30, 70, 0.05), 0 14px 32px -10px rgba(20, 30, 70, 0.20);
    --shadow-pop: 0 2px 6px rgba(20, 30, 70, 0.08), 0 20px 44px -12px rgba(20, 30, 70, 0.28);
    --glow-primary: 0 6px 18px -6px color-mix(in srgb, var(--primary) 70%, transparent);
    --glow-call: 0 6px 18px -6px color-mix(in srgb, var(--accent) 75%, transparent);

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    --sk-base: color-mix(in srgb, var(--primary) 7%, #e9edf5);
    --sk-hi: color-mix(in srgb, var(--primary) 2%, #ffffff);
}

/* ── پس‌زمینه: دو هاله‌ی رنگی بسیار کم‌رنگ پشت محتوا ───────────────── */

body {
    background:
        radial-gradient(900px 520px at 100% -8%, color-mix(in srgb, var(--primary) 11%, transparent), transparent 62%),
        radial-gradient(760px 480px at 8% 0%, color-mix(in srgb, var(--brand-2) 8%, transparent), transparent 60%),
        var(--canvas);
    background-attachment: fixed;
}

/* ── ورود محتوای صفحه ─────────────────────────────────────────────── */

@keyframes vv-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes vv-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes vv-pop { 0% { transform: scale(0.6); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes vv-pulse { 0%, 100% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 2px color-mix(in srgb, var(--danger) 0%, transparent); }
                      50% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 6px color-mix(in srgb, var(--danger) 22%, transparent); } }
@keyframes vv-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes vv-shimmer { from { background-position: -50% 0; } to { background-position: 150% 0; } }
@keyframes vv-progress { from { transform: translateX(110%); } to { transform: translateX(-260%); } }

.page-body > * { animation: vv-rise 0.38s var(--ease-out) backwards; }
.page-body > *:nth-child(2) { animation-delay: 40ms; }
.page-body > *:nth-child(3) { animation-delay: 80ms; }
.page-body > *:nth-child(4) { animation-delay: 120ms; }
.page-body > *:nth-child(n+5) { animation-delay: 160ms; }

/* عناصر absolute داخل جدول (مثل برچسب visually-hidden ستون اقدام‌ها) بدون این، containing block بیرون از
   کانتینر اسکرول دارند و در جدول پهن RTL بیرون از صفحه می‌نشینند → روی گوشی layout viewport پهن می‌شد */
.table-responsive { position: relative; }

/* ── سایدبار: گرادیان عمیق برند با آیکون‌های رنگی ماژول‌ها ───────────── */

.sidebar {
    background: var(--grad-brand-deep);
    border-inline-end: 0;
    color: #fff;
}
.sidebar::after {
    /* هاله‌ی نور در پایین سایدبار */
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 220px;
    background: radial-gradient(260px 180px at 50% 120%, color-mix(in srgb, var(--accent) 45%, transparent), transparent 70%);
    pointer-events: none;
}
.sidebar-brand { border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.sidebar-brand strong { color: #fff; }
.sidebar-brand small { color: rgba(255, 255, 255, 0.6); }
.brand-mark,
.sidebar-brand > i {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #fde68a));
    box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 80%, transparent);
    font-weight: 800;
}
.sidebar-brand img.brand-logo { width: 32px; height: 32px; border: 0; border-radius: 10px; }

/* .nav بوت‌استرپ flex-wrap: wrap دارد؛ در صفحه‌ی کوتاه گروه‌های منو به ستون دوم می‌شکستند و روی هم می‌افتادند.
   بدون شکستن، منو اسکرول عمودی می‌خورد (overflow-y از design-system). */
.sidebar-nav { position: relative; z-index: 1; flex-wrap: nowrap; padding-top: var(--s-3); }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); }

/* جست‌وجوی منو: بیرون از ناحیه‌ی اسکرول، تا با پیمایش منو از دید نرود */
.nav-search { position: relative; z-index: 1; flex-shrink: 0; padding: var(--s-3) var(--s-3) 0; }
.nav-search > i { position: absolute; inset-inline-start: calc(var(--s-3) + 10px); top: calc(var(--s-3) + 8px); color: rgba(255, 255, 255, 0.55); font-size: 0.85rem; pointer-events: none; }
.nav-search input {
    width: 100%;
    height: 34px;
    padding-inline: 32px var(--s-2);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--r-control);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font: inherit;
    font-size: var(--text-sm);
}
.nav-search input::placeholder { color: rgba(255, 255, 255, 0.55); }
.nav-search input:focus { outline: none; border-color: rgba(255, 255, 255, 0.45); background: rgba(255, 255, 255, 0.12); }
.nav-search input::-webkit-search-cancel-button { filter: invert(1) brightness(2); }
.nav-search-empty { padding: var(--s-3) var(--s-2); color: rgba(255, 255, 255, 0.6); font-size: var(--text-sm); text-align: center; }
.nav-module-title { color: rgba(255, 255, 255, 0.45); letter-spacing: 0; }

.sidebar-nav .nav-link {
    min-height: 36px;
    color: rgba(255, 255, 255, 0.78);
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s var(--ease-out);
}
.sidebar-nav .nav-link i {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--nav-tone, #a5b4fc);
    font-size: 0.9rem;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.25s var(--ease-spring);
}
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, 0.07); color: #fff; transform: translateX(-2px); }
.sidebar-nav .nav-link:hover i { transform: scale(1.08) rotate(-4deg); }
.sidebar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.13);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
    color: #fff;
}
.sidebar-nav .nav-link.active i { background: var(--nav-tone, #a5b4fc); color: #fff; box-shadow: 0 4px 12px -4px var(--nav-tone, #a5b4fc); }
.sidebar-nav .nav-link.active::before {
    width: 3px;
    background: linear-gradient(180deg, var(--nav-tone, #a5b4fc), color-mix(in srgb, var(--nav-tone, #a5b4fc) 30%, #fff));
    box-shadow: 0 0 10px var(--nav-tone, #a5b4fc);
}

/* هر گروه منو یک رنگ — ترتیب ماژول‌ها ثابت است، پس رنگ هر ماژول هم ثابت می‌ماند */
.nav-module:nth-child(8n+1) { --nav-tone: #7ea6ff; }
.nav-module:nth-child(8n+2) { --nav-tone: #3ddbb4; }
.nav-module:nth-child(8n+3) { --nav-tone: #c4a1ff; }
.nav-module:nth-child(8n+4) { --nav-tone: #ffb547; }
.nav-module:nth-child(8n+5) { --nav-tone: #ff86ad; }
.nav-module:nth-child(8n+6) { --nav-tone: #5ccfff; }
.nav-module:nth-child(8n+7) { --nav-tone: #ff9a62; }
.nav-module:nth-child(8n+8) { --nav-tone: #8be08b; }
/* برند اختصاصی: آیکون‌های منو به‌جای ۸ رنگ ثابت، روشن‌شده‌ی رنگ اصلی و رنگ دوم سازمان (یکی در میان) */
:root[data-brand="custom"] .nav-module:nth-child(odd) { --nav-tone: color-mix(in oklch, var(--primary) 55%, #fff); }
:root[data-brand="custom"] .nav-module:nth-child(even) { --nav-tone: color-mix(in oklch, var(--brand-2) 55%, #fff); }

/* ── نوار بالا ───────────────────────────────────────────────────── */

.app-header {
    background: color-mix(in srgb, #fff 72%, transparent);
    border-bottom-color: color-mix(in srgb, var(--line) 70%, transparent);
    backdrop-filter: blur(14px) saturate(1.4);
}
.header-search input {
    height: 38px;
    border-radius: var(--r-pill);
    background: color-mix(in srgb, #fff 80%, var(--surface-sunken));
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}
.header-search input:focus { background: #fff; border-color: var(--primary-line); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent), var(--shadow-card); }
.header-search kbd { border-radius: 6px; background: #fff; }
.header-search > i { inset-inline-start: 14px; }
.search-results { border-radius: var(--r-panel); animation: vv-rise 0.2s var(--ease-out); }
.search-result { transition: background-color 0.15s ease, transform 0.15s ease; }
.search-result:hover { transform: translateX(-2px); }
.search-result-icon { border-radius: 9px; background: var(--grad-brand); color: #fff; }

.header-icon-button { border-radius: 10px; transition: background-color 0.15s ease, color 0.15s ease, transform 0.2s var(--ease-spring); }
.header-icon-button:hover { background: var(--primary-soft); color: var(--primary); transform: translateY(-1px); }
.notification-badge { background: linear-gradient(135deg, #ff5a5f, #e0457b); animation: vv-pulse 2.2s ease-in-out infinite; }

.header-avatar {
    border: 0;
    background: var(--grad-brand);
    color: #fff;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px color-mix(in srgb, var(--primary) 25%, transparent);
    transition: transform 0.2s var(--ease-spring);
}
.profile-menu:hover > .header-avatar { transform: scale(1.06); }
.profile-popover { border-radius: var(--r-panel); }
.profile-popover-user .header-avatar { box-shadow: none; }
.profile-link i { color: var(--primary); }

/* ── سربرگ صفحه ─────────────────────────────────────────────────── */

.page-header h1 { display: flex; align-items: center; gap: 12px; font-size: var(--text-2xl); font-weight: 800; }
/* آیکون عنوان صفحه: کاشی گرادیانی (در design-system پنهان بود) */
.page-header h1 > i {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--grad-brand);
    color: #fff;
    font-size: 1.15rem;
    box-shadow: var(--glow-primary);
}
.page-header h1 > i::before { line-height: 1; }
/* توضیحی که مستقیم بعد از عنوان آمده (بدون div دور آن) زیر عنوان بنشیند، نه کنارش */
.page-header > h1 + p { flex-basis: 100%; margin: -6px 0 0; }
.page-header h1 > i + * { min-width: 0; }

/* آیکون سربرگ کارت‌ها: کاشی کم‌رنگ رنگی */
.card-panel h5 > i,
.form-section h5 > i,
.card-panel > h5:first-child > i,
.form-section > h5:first-child > i {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-inline-end: 6px;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.9rem;
    vertical-align: middle;
}
.card-panel h5 > i.text-success { background: var(--t-emerald-soft); }
.card-panel h5 > i.text-danger { background: var(--danger-soft); }
.card-panel h5 > i.text-muted { background: var(--surface-sunken); }

/* ── شمارنده‌های رنگی (KPI) ─────────────────────────────────────── */

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-4); }
.kpi {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: 14px var(--s-4);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
    border-radius: var(--r-panel);
    box-shadow: var(--shadow-card);
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s ease;
}
.kpi::after {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-end: -30px;
    width: 90px;
    background: radial-gradient(circle at 70% 50%, var(--tone-soft, var(--primary-soft)), transparent 70%);
    pointer-events: none;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.kpi > i {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--tone, var(--primary)), color-mix(in srgb, var(--tone, var(--primary)) 60%, #fff));
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 6px 14px -6px var(--tone, var(--primary));
}
.kpi strong { display: block; color: var(--ink); font-size: var(--text-xl); font-weight: 800; line-height: 1.2; font-variant-numeric: normal; }
.kpi span { display: block; color: var(--muted); font-size: var(--text-xs); }

/* ── بنر هفته (تسک‌ها) ──────────────────────────────────────────── */

.week-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    flex-wrap: wrap;
    margin-bottom: var(--s-4);
    padding: var(--s-4) var(--s-5);
    border-radius: var(--r-panel);
    background: var(--grad-hero);
    color: #fff;
    box-shadow: 0 14px 30px -16px color-mix(in srgb, var(--primary) 85%, transparent);
}
.week-banner .week-range { display: flex; align-items: center; gap: var(--s-3); font-size: var(--text-md); }
.week-banner .week-range > i {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 1.1rem;
}
.week-banner .week-range small { display: block; color: rgba(255, 255, 255, 0.72); font-size: var(--text-xs); }
.week-banner .week-note {
    padding: 4px 12px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: var(--text-xs);
}

.empty-inline { display: flex; align-items: center; gap: var(--s-2); margin: 0; padding: var(--s-3); border-radius: var(--r-control); background: var(--surface-sunken); color: var(--muted); font-size: var(--text-sm); }
.empty-inline i { color: var(--tone, var(--primary)); }

/* ── پنل‌ها ─────────────────────────────────────────────────────── */

.card-panel,
.form-section {
    border-color: color-mix(in srgb, var(--line) 80%, transparent);
    box-shadow: var(--shadow-card);
}
.panel-head { padding: 14px var(--s-4); }
.panel-head h2 { display: flex; align-items: center; gap: 10px; font-size: var(--text-lg); font-weight: 700; }
.head-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--tone-soft, var(--primary-soft));
    color: var(--tone, var(--primary));
    font-size: 0.95rem;
}

/* کلاس‌های tone عمومی — برای آیکون سربرگ، حالت خالی و هر جای دیگر */
.tone-blue    { --tone: var(--t-blue);    --tone-soft: var(--t-blue-soft); }
.tone-violet  { --tone: var(--t-violet);  --tone-soft: var(--t-violet-soft); }
.tone-pink    { --tone: var(--t-pink);    --tone-soft: var(--t-pink-soft); }
.tone-orange  { --tone: var(--t-orange);  --tone-soft: var(--t-orange-soft); }
.tone-amber   { --tone: var(--t-amber);   --tone-soft: var(--t-amber-soft); }
.tone-emerald { --tone: var(--t-emerald); --tone-soft: var(--t-emerald-soft); }
.tone-teal    { --tone: var(--t-teal);    --tone-soft: var(--t-teal-soft); }
.tone-sky     { --tone: var(--t-sky);     --tone-soft: var(--t-sky-soft); }

/* ── دکمه‌ها: گرادیان، بالا آمدن در hover، فشردگی و موج نور در کلیک ─── */

.btn {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
                box-shadow 0.2s ease, transform 0.2s var(--ease-out);
}
.btn:not(.dropdown-toggle)::after {
    content: "";
    position: absolute;
    left: var(--rx, 50%);
    top: var(--ry, 50%);
    z-index: -1;
    width: 260%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: currentColor;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    transition: transform 0.55s var(--ease-out), opacity 0.6s ease;
}
.btn:not(.dropdown-toggle):active::after { opacity: 0.16; transform: translate(-50%, -50%) scale(1); transition: transform 0.4s var(--ease-out), opacity 0s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.97); }
.btn:disabled { transform: none; }
.btn > i { transition: transform 0.25s var(--ease-spring); }
.btn:hover:not(:disabled) > i { transform: scale(1.12); }

.btn-primary {
    --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent;
    --bs-btn-disabled-border-color: transparent;
    background-image: var(--grad-brand);
    box-shadow: var(--glow-primary);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--primary) 80%, transparent); }
.btn-success, .btn-call {
    --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent;
    --bs-btn-disabled-border-color: transparent;
    background-image: var(--grad-call);
    box-shadow: var(--glow-call);
}
.btn-success:hover:not(:disabled), .btn-call:hover:not(:disabled) { box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--accent) 85%, transparent); }
.btn-outline-primary:hover:not(:disabled) { --bs-btn-hover-bg: var(--primary-soft); --bs-btn-hover-border-color: var(--primary-line); }
.btn-outline-danger:hover:not(:disabled), .btn-danger:hover:not(:disabled) { box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--danger) 70%, transparent); }

/* دکمه‌ی آیکونی گرد با رنگ tone — برای اقدام‌های ردیف */
.btn-soft {
    --bs-btn-bg: var(--tone-soft, var(--primary-soft));
    --bs-btn-border-color: transparent;
    --bs-btn-color: var(--tone, var(--primary));
    --bs-btn-hover-bg: var(--tone, var(--primary));
    --bs-btn-hover-border-color: transparent;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--tone, var(--primary));
    --bs-btn-active-border-color: transparent;
    --bs-btn-active-color: #fff;
}
.btn-soft:hover:not(:disabled) { box-shadow: 0 6px 14px -6px var(--tone, var(--primary)); }
.btn-soft.tone-call { --tone: var(--accent); --tone-soft: var(--accent-soft); }
.btn-round { width: 34px; min-height: 34px; padding: 0; border-radius: 50%; }
.btn-round.btn-sm { width: 30px; min-height: 30px; }

/* ── فرم ──────────────────────────────────────────────────────── */

.form-control, .form-select { transition: border-color 0.18s ease, box-shadow 0.18s ease; }
.form-control:hover, .form-select:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--line-strong)); }
.form-control:focus, .form-select:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent); }
.form-check-input:checked { background-color: var(--primary); background-image: var(--bs-form-check-bg-image), var(--grad-brand); }

/* ── جدول ─────────────────────────────────────────────────────── */

.table > thead > tr > th {
    background: color-mix(in srgb, var(--primary) 3.5%, #fff);
    color: color-mix(in srgb, var(--ink) 60%, var(--primary));
    font-weight: 600;
}
.table-hover > tbody > tr { transition: background-color 0.15s ease; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: color-mix(in srgb, var(--primary) 4.5%, transparent); }
.table-hover > tbody > tr:hover > td:first-child { box-shadow: inset -3px 0 0 var(--primary); }

/* ── آواتار حرف اول ─────────────────────────────────────────────── */

.avatar {
    --av: var(--t-blue);
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--av), color-mix(in srgb, var(--av) 55%, #fff));
    color: #fff;
    font-size: var(--text-md);
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 4px 10px -4px var(--av);
}
.avatar-sm { width: 28px; height: 28px; border-radius: 9px; font-size: var(--text-xs); }
.avatar-lg { width: 52px; height: 52px; border-radius: 15px; font-size: var(--text-xl); }
.av-0 { --av: var(--t-blue); }
.av-1 { --av: var(--t-violet); }
.av-2 { --av: var(--t-pink); }
.av-3 { --av: var(--t-orange); }
.av-4 { --av: var(--t-amber); }
.av-5 { --av: var(--t-emerald); }
.av-6 { --av: var(--t-teal); }
.av-7 { --av: var(--t-sky); }

/* ── وضعیت لید: قرص رنگی ───────────────────────────────────────── */

.status-new,       [data-tone="status-new"]       { --st: var(--t-blue);    --st-soft: var(--t-blue-soft); }
.status-contacted, [data-tone="status-contacted"] { --st: var(--t-sky);     --st-soft: var(--t-sky-soft); }
.status-followup,  [data-tone="status-followup"]  { --st: var(--t-amber);   --st-soft: var(--t-amber-soft); }
.status-qualified, [data-tone="status-qualified"] { --st: var(--t-violet);  --st-soft: var(--t-violet-soft); }
.status-converted, [data-tone="status-converted"] { --st: var(--t-emerald); --st-soft: var(--t-emerald-soft); }
.status-lost,      [data-tone="status-lost"]      { --st: #8b93a7;          --st-soft: #eef0f4; }

.status {
    padding: 2px 10px 2px 9px;
    border-radius: var(--r-pill);
    background: var(--st-soft, var(--surface-sunken));
    color: color-mix(in srgb, var(--st, var(--ink-2)) 82%, #000);
    font-size: var(--text-xs);
    font-weight: 700;
}
.status::before { width: 7px; height: 7px; background: var(--st, var(--faint)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st, var(--faint)) 22%, transparent); }
.status-lost { color: #5f677a; }

/* ── برچسب‌ها ──────────────────────────────────────────────────── */

.badge { padding: 3px 9px; }
.badge-hot, .badge.prio-hot {
    background: linear-gradient(135deg, #ff5a5f, #f0702e) !important;
    color: #fff !important;
    box-shadow: 0 4px 10px -4px #ff5a5f;
}
.badge.prio-high { background: var(--t-amber-soft) !important; color: #9a6200 !important; }

/* ── تراشه‌های فیلتر ─────────────────────────────────────────────── */

.chip {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    height: 32px;
    padding: 0 12px;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
                box-shadow 0.2s ease, transform 0.2s var(--ease-out);
}
.chip:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--st, var(--primary)) 45%, var(--line)); box-shadow: var(--shadow-card); }
.chip:active { transform: scale(0.96); }
.chip .status { padding: 0; background: none; box-shadow: none; }
.chip .count {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: var(--r-pill);
    background: var(--surface-sunken);
    color: var(--muted);
    font-size: var(--text-xs);
    line-height: 1.5;
    text-align: center;
}
.chip[aria-pressed="true"] {
    background: var(--primary);
    background-image: var(--grad-brand);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 16px -6px var(--st, var(--primary));
}
/* تراشه‌ی وضعیت: گرادیان در همان رنگ وضعیت (کمی تیره‌تر تا متن سفید خوانا بماند) */
.chip[data-tone][aria-pressed="true"] {
    background: var(--st);
    background-image: linear-gradient(135deg, color-mix(in srgb, var(--st) 92%, #000), color-mix(in srgb, var(--st) 72%, #000));
}
.chip[aria-pressed="true"] .count { background: rgba(255, 255, 255, 0.24); color: #fff; }
.chip[aria-pressed="true"] .status::before { background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3); }

/* ── هشدار ────────────────────────────────────────────────────── */

.alert { border-inline-start-width: 4px; animation: vv-rise 0.3s var(--ease-out); }
.alert-success { border-inline-start-color: var(--success); }
.alert-danger { border-inline-start-color: var(--danger); }
.alert-warning { border-inline-start-color: #e5a10f; }
.alert-info { border-inline-start-color: var(--info); }

/* ── وضعیت خالی با تصویرک ──────────────────────────────────────── */

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--s-6) var(--s-4) var(--s-6); }
.empty-state strong { margin-top: var(--s-2); font-size: var(--text-lg); font-weight: 700; }
.empty-body { max-width: 360px; color: var(--muted); }
.empty-body .btn { margin-top: var(--s-3); }
/* هر tone یک رنگ همراه دارد تا گرادیان تمیز بماند (کهربایی + بنفش رنگ گل‌آلود می‌ساخت) */
.empty-primary { --tone: var(--primary);  --tone-2: var(--t-violet); }
.empty-accent  { --tone: var(--accent);   --tone-2: var(--t-emerald); }
.empty-violet  { --tone: var(--t-violet); --tone-2: var(--t-pink); }
.empty-amber   { --tone: #f59e0b;         --tone-2: var(--t-orange); }
.empty-pink    { --tone: var(--t-pink);   --tone-2: var(--t-orange); }
.empty-art {
    position: relative;
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin-bottom: var(--s-1);
    border-radius: 24px;
    background: linear-gradient(135deg, var(--tone, var(--primary)), var(--tone-2, var(--brand-2)));
    color: #fff;
    font-size: 1.9rem;
    box-shadow: 0 16px 30px -14px var(--tone, var(--primary));
    transform: rotate(-6deg);
    animation: vv-float 4s ease-in-out infinite;
}
.empty-art > i { transform: rotate(6deg); }
.empty-dot { position: absolute; border-radius: 50%; background: var(--tone, var(--primary)); opacity: 0.35; }
.empty-dot.d1 { width: 12px; height: 12px; top: -10px; inset-inline-start: -14px; }
.empty-dot.d2 { width: 8px; height: 8px; bottom: -6px; inset-inline-end: -16px; background: var(--t-amber); opacity: 0.6; }
.empty-dot.d3 { width: 6px; height: 6px; top: 10px; inset-inline-end: -12px; background: var(--t-pink); opacity: 0.5; }

/* ── Placeholder اسکلتی ─────────────────────────────────────────── */

.skeleton { display: flex; flex-direction: column; gap: var(--s-4); animation: vv-fade 0.25s ease both; }
.bone {
    display: block;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--sk-base) 0%, var(--sk-hi) 50%, var(--sk-base) 100%);
    background-size: 200% 100%;
    animation: vv-shimmer 1.5s ease-in-out infinite;
    animation-delay: var(--sk-delay, 0ms);
}
.bone-sm { height: 9px; }
.bone-lg { height: 18px; border-radius: 8px; }
.bone-avatar { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; }
.bone-avatar-lg { width: 52px; height: 52px; border-radius: 15px; }
.bone-icon { width: 34px; height: 34px; border-radius: 10px; }
.bone-pill { width: 64px; height: 24px; border-radius: var(--r-pill); flex-shrink: 0; }

.sk-panel {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    padding: var(--s-5);
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
    border-radius: var(--r-panel);
    box-shadow: var(--shadow-card);
}
.sk-lines { display: flex; flex: 1; flex-direction: column; gap: 8px; min-width: 0; }
.sk-row { display: flex; align-items: center; gap: var(--s-3); }
.sk-list { display: flex; flex-direction: column; gap: var(--s-4); padding: var(--s-2) 0; }
.sk-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.sk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s-4); }
.sk-card { gap: var(--s-3); }
.sk-detail-head { flex-direction: row; align-items: center; gap: var(--s-4); }

.sk-hero {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    min-height: 196px;
    padding: var(--s-5);
    border-radius: 18px;
    background: linear-gradient(125deg, color-mix(in srgb, var(--primary) 16%, #fff), color-mix(in srgb, var(--brand-2) 12%, #fff));
}
.sk-hero .bone { --sk-base: rgba(255, 255, 255, 0.55); --sk-hi: rgba(255, 255, 255, 0.95); }
.sk-rail { height: 44px; margin-top: auto; border-radius: 10px; }

.skeleton-table .sk-panel { gap: 0; padding: 0; overflow: hidden; }
.sk-table-head { display: flex; gap: var(--s-5); padding: 14px var(--s-4); background: color-mix(in srgb, var(--primary) 3.5%, #fff); border-bottom: 1px solid var(--line); }
.sk-table-head .bone { flex: 1; max-width: 110px; }
.sk-table-row { display: flex; align-items: center; gap: var(--s-5); padding: 12px var(--s-4); border-bottom: 1px solid var(--line); }
.sk-table-row:last-child { border-bottom: 0; }
.sk-table-row .sk-lines { flex: 2; }
.sk-table-row .sk-cell { flex: 1; max-width: 110px; }
.sk-table-row .bone-avatar { margin-inline-end: calc(-1 * var(--s-3)); }

/* نوار پیشرفت نازک بالای پنل هنگام به‌روزرسانی (فیلتر/جست‌وجو) */
.is-refreshing { position: relative; }
.is-refreshing::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline: 0;
    z-index: 2;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--brand-2), transparent);
    background-size: 40% 100%;
    background-repeat: no-repeat;
    animation: vv-progress-bg 1s linear infinite;
}
@keyframes vv-progress-bg { from { background-position: 140% 0; } to { background-position: -40% 0; } }
.is-refreshing > .table-responsive { opacity: 0.6; transition: opacity 0.2s ease; }

/* ── مودال ─────────────────────────────────────────────────────── */

/* backwards (نه both): پس از انیمیشن transform روی پنجره نمی‌ماند؛ وگرنه عناصر position:fixed داخل مودال
   (تقویم شمسی) به‌جای صفحه نسبت به پنجره جا می‌گرفتند و بیرون از دید می‌افتادند */
.modal.show .modal-dialog { animation: vv-pop-dialog 0.28s var(--ease-out) backwards; }
@keyframes vv-pop-dialog { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-header { background: color-mix(in srgb, var(--primary) 4%, #fff); border-radius: var(--r-panel) var(--r-panel) 0 0; }

/* ── progress بوت‌استرپ (گزارش مدیر) ─────────────────────────────── */

.progress { border-radius: var(--r-pill); background: var(--surface-sunken); }
.progress-bar { background-image: var(--grad-brand); border-radius: var(--r-pill); font-weight: 700; }

/* ── ورود ─────────────────────────────────────────────────────── */

.login-page-shell {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(600px 420px at 85% 10%, color-mix(in srgb, var(--brand-2) 40%, transparent), transparent 65%),
        radial-gradient(560px 420px at 10% 90%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 65%),
        var(--grad-brand-deep);
}
.login-page-shell::before,
.login-page-shell::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.10);
    pointer-events: none;
}
.login-page-shell::before { width: 520px; height: 520px; top: -180px; inset-inline-start: -160px; }
.login-page-shell::after { width: 360px; height: 360px; bottom: -120px; inset-inline-end: -100px; }
.login-card {
    position: relative;
    z-index: 1;
    /* والد grid با place-items:center است و width:100% را به اندازه‌ی محتوا جمع می‌کرد */
    width: min(480px, calc(100vw - 32px));
    max-width: 480px;
    padding: 44px 44px 36px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    background: color-mix(in srgb, #fff 95%, transparent);
    box-shadow: 0 40px 90px -24px rgba(6, 10, 40, 0.6), 0 0 0 8px rgba(255, 255, 255, 0.06);
    animation: vv-rise 0.5s var(--ease-out) backwards;
}
.login-card-spacious { max-width: 480px; }
/* نوار گرادیانی بالای کارت */
.login-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, var(--accent), var(--primary), var(--brand-2));
}

/* برند بالای فیلدها: وسط کارت */
.login-brand { display: flex; flex-direction: column; align-items: center; margin-bottom: var(--s-6); text-align: center; }
.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 0 var(--s-4);
    border-radius: 22px;
    background: var(--grad-brand);
    font-size: 1.9rem;
    box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--primary) 85%, transparent),
                0 0 0 8px color-mix(in srgb, var(--primary) 8%, transparent);
}
.login-logo.has-image { box-shadow: 0 14px 30px -14px rgba(20, 30, 70, 0.35), 0 0 0 8px color-mix(in srgb, var(--primary) 6%, transparent); }
.login-wordmark { font-size: 2rem; font-weight: 800; line-height: 1.2; }
.login-wordmark span {
    background: linear-gradient(135deg, var(--accent), var(--brand-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.login-brand p { margin-top: var(--s-2); font-size: var(--text-md); }

.login-card .form-label { font-weight: 600; color: var(--ink-2); }
.login-card .mb-3 { margin-bottom: var(--s-4) !important; }

/* آیکون داخل فیلد (در design-system پنهان بود) */
.login-input-wrap > i {
    display: block;
    position: absolute;
    top: 50%;
    inset-inline-start: 15px;
    z-index: 1;
    transform: translateY(-50%);
    color: var(--faint);
    font-size: 1.05rem;
    pointer-events: none;
    transition: color 0.18s ease;
}
.login-input-wrap:focus-within > i { color: var(--primary); }
.login-input-wrap .form-control {
    min-height: 50px;
    padding-inline-start: 44px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--primary) 2.5%, #fff);
    font-size: var(--text-lg);
}
.login-input-wrap .form-control:focus { background: #fff; }
.btn-login { min-height: 52px; margin-top: var(--s-3); border-radius: 12px; font-size: var(--text-lg); }

@media (max-width: 520px) {
    .login-card { padding: 36px 22px 28px; border-radius: 20px; }
    .login-wordmark { font-size: 1.65rem; }
}

.auth-transition { background: var(--grad-brand-deep); color: #fff; }
.auth-transition > span { color: rgba(255, 255, 255, 0.7); }
.loader-orbit { border-color: rgba(255, 255, 255, 0.18); border-top-color: #fff; }

@media (max-width: 960px) {
    /* کشوی منو در موبایل: به‌جای بیرون بردن با translateX (که روی گوشی layout viewport را پهن می‌کرد و صفحه
       افقی اسکرول/کوچک می‌شد)، همان‌جا می‌ماند و با clip-path پنهان و آشکار می‌شود. clip-path کلیک را هم قطع می‌کند. */
    .sidebar {
        background: var(--grad-brand-deep);
        transform: none;
        clip-path: inset(0 0 0 100%);
        visibility: hidden;
        transition: clip-path 0.28s var(--ease-out), visibility 0s linear 0.28s;
    }
    .app-shell.nav-open .sidebar {
        transform: none;
        clip-path: inset(0 0 0 0);
        visibility: visible;
        transition: clip-path 0.28s var(--ease-out), visibility 0s;
    }
}
@media (max-width: 1080px) {
    .sk-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
    .sk-table-row .sk-cell:nth-child(n+4) { display: none; }
}

/* ── پیش‌نمایش برند (تنظیمات › برند سازمان) ───────────────────────
   گرادیان‌ها دوباره تعریف می‌شوند تا --primary/--accent خودِ پیش‌نمایش (style درون‌خطی) را بگیرند */

.brand-preview {
    --grad-brand: linear-gradient(135deg, var(--primary) 0%, color-mix(in oklch, var(--primary) var(--brand-mix, 55%), var(--brand-2)) 100%);
    --grad-brand-deep: linear-gradient(160deg,
        color-mix(in srgb, var(--primary-dark) 78%, #0b1033) 0%,
        color-mix(in srgb, var(--primary-dark) 55%, color-mix(in srgb, var(--brand-2) 32%, #0b1033)) 100%);
    --hover: color-mix(in srgb, var(--primary) 5%, transparent);
    --primary-soft: color-mix(in srgb, var(--primary) 8%, #fff);
    --primary-line: color-mix(in srgb, var(--primary) 30%, #fff);
    --grad-call: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, #22c55e) 100%);
    --glow-primary: 0 6px 18px -6px color-mix(in srgb, var(--primary) 70%, transparent);
    --glow-call: 0 6px 18px -6px color-mix(in srgb, var(--accent) 75%, transparent);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
}
.brand-preview-bar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--grad-brand-deep); color: #fff; }
.brand-preview-bar small { color: rgba(255, 255, 255, 0.65); font-size: var(--text-xs); }
.brand-preview-logo { width: 32px; height: 32px; border-radius: 10px; object-fit: contain; background: #fff; }
.brand-preview-body { display: flex; flex-wrap: wrap; gap: var(--s-2); padding: var(--s-4); background: var(--canvas); }
.brand-preview-body .btn { pointer-events: none; }
.brand-preview-app { display: grid; grid-template-columns: 150px minmax(0, 1fr); }
.brand-preview-nav { display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; background: var(--grad-brand-deep); }
.brand-preview-link { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; color: rgba(255, 255, 255, 0.78); font-size: var(--text-xs); }
.brand-preview-link i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: rgba(255, 255, 255, 0.07); color: var(--nav-tone); }
.brand-preview-link.active { background: rgba(255, 255, 255, 0.13); color: #fff; }
.brand-preview-link.active i { background: var(--nav-tone); color: #fff; }
.brand-preview-app .brand-preview-body { flex-direction: column; align-items: stretch; gap: var(--s-3); background:
    radial-gradient(260px 160px at 100% 0%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 70%),
    radial-gradient(220px 140px at 0% 0%, color-mix(in srgb, var(--brand-2) 10%, transparent), transparent 70%), var(--canvas); }
.brand-preview-title { display: flex; align-items: center; gap: 8px; font-size: var(--text-md); }
.brand-preview-title i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--grad-brand); color: #fff; box-shadow: var(--glow-primary); }
.brand-preview-body .chips { pointer-events: none; }
.brand-preview-body .progress { height: 8px; }
.brand-preview-linktext { color: var(--primary); text-decoration: underline; }
.brand-preview-avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: var(--text-xs); }
.brand-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.brand-preset { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--ink-2); font-size: var(--text-xs); }
.brand-preset:hover { border-color: var(--line-strong); }
.brand-preset[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); font-weight: 700; }
.brand-preset-swatch { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--p) 50%, var(--a) 50%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
@media (max-width: 575.98px) { .brand-preview-app { grid-template-columns: 1fr; } .brand-preview-nav { flex-direction: row; flex-wrap: wrap; } }

/* ── اشتراک ─────────────────────────────────────────────────────── */

.plan-name {
    font-size: 1.75rem;
    font-weight: 800;
    background: var(--grad-hero);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ── PWA: دکمه‌ی «نصب برنامه» در نوار بالا ────────────────────────
   پیش‌فرض پنهان؛ App.razor با رویداد beforeinstallprompt کلاس pwa-installable را روی <html> می‌گذارد */

.header-icon-button.pwa-install { display: none; }
.pwa-installable .header-icon-button.pwa-install {
    display: inline-flex;
    gap: 6px;
    width: auto;
    padding: 0 12px;
    border-radius: var(--r-pill);
    background: var(--grad-brand);
    color: #fff;
    font: 600 var(--text-xs)/1 var(--font);
    box-shadow: var(--glow-primary);
    animation: vv-pop 0.4s var(--ease-spring) both;
}
.pwa-installable .header-icon-button.pwa-install:hover { color: #fff; transform: translateY(-1px); }
@media (max-width: 600px) {
    .pwa-installable .header-icon-button.pwa-install { width: 34px; padding: 0; justify-content: center; }
    .pwa-installable .header-icon-button.pwa-install span { display: none; }
}

/* در پنجره‌ی اپ نصب‌شده نوار عنوان مرورگر نیست؛ سربرگ کمی جمع‌وجورتر */
@media (display-mode: standalone) {
    .app-header { background: color-mix(in srgb, #fff 86%, transparent); }
}

/* ── گزارش‌ها (گزارش مدیر و هر جدول آماری) ────────────────────────── */

.min-width-0 { min-width: 0; }
.agent-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.agent-cell strong { font-weight: 700; }

/* رتبه: سه نفر اول طلایی/نقره‌ای/برنزی */
.rank {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-sunken);
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: 800;
}
.rank-1 { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #7a4a00; box-shadow: 0 4px 10px -4px #f59e0b; }
.rank-2 { background: linear-gradient(135deg, #f1f5f9, #94a3b8); color: #334155; box-shadow: 0 4px 10px -4px #94a3b8; }
.rank-3 { background: linear-gradient(135deg, #fed7aa, #c2410c); color: #fff; box-shadow: 0 4px 10px -4px #c2410c; }

/* عدد در قرص رنگی */
.num-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 32px;
    padding: 2px 10px;
    border-radius: var(--r-pill);
    background: var(--tone-soft, var(--primary-soft));
    color: color-mix(in srgb, var(--tone, var(--primary)) 85%, #000);
    font-size: var(--text-sm);
    font-weight: 700;
    justify-content: center;
    white-space: nowrap;
}

/* مقدار + نوار نسبی کوچک زیر آن */
.metric-bar { display: flex; flex-direction: column; gap: 5px; min-width: 120px; max-width: 220px; }
.metric-bar strong { font-size: var(--text-sm); font-weight: 700; white-space: nowrap; }
.mini-bar { height: 6px; border-radius: var(--r-pill); background: var(--tone-soft, var(--surface-sunken)); overflow: hidden; }
.mini-bar > span {
    display: block;
    height: 100%;
    min-width: 4px;
    border-radius: inherit;
    background: linear-gradient(270deg, var(--tone, var(--primary)), color-mix(in srgb, var(--tone, var(--primary)) 55%, #fff));
    transform-origin: right;
    animation: vv-grow 0.8s var(--ease-out) backwards;
}

.report-table > tbody > tr > td { padding-block: 12px; }
.report-table > tbody > tr:nth-child(even) > td { background: color-mix(in srgb, var(--primary) 1.8%, transparent); }

/* کاشی کارشناس (تماس‌های صوتی) */
.agent-tile {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    height: 100%;
    padding: var(--s-3) var(--s-4);
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    background: linear-gradient(135deg, #fff, color-mix(in srgb, var(--primary) 3%, #fff));
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s ease, border-color 0.2s ease;
}
.agent-tile:hover { transform: translateY(-2px); border-color: var(--primary-line); box-shadow: var(--shadow-lift); }
.agent-tile-info { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.agent-tile-info span { color: var(--muted); font-size: var(--text-xs); }

/* گروه تاشونده به تفکیک کارمند (تسک‌های منقضی، یادداشت‌ها) */
.report-group {
    margin-bottom: var(--s-3);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    background: #fff;
}
.report-group-toggle,
.report-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    width: 100%;
    padding: 10px var(--s-4);
    border: 0;
    background: color-mix(in srgb, var(--primary) 3%, #fff);
    font: inherit;
    text-align: start;
}
.report-group-toggle { cursor: pointer; transition: background-color 0.15s ease; }
.report-group-toggle:hover { background: var(--primary-soft); }
.report-group-toggle[aria-expanded="true"],
.report-group-open > .report-group-head { border-bottom: 1px solid var(--line); }
.report-group .table-responsive { margin: 0 !important; }
.report-group-open { padding-bottom: var(--s-2); }
.report-group-open .daily-note-item { margin: var(--s-2) var(--s-3) 0; }

/* ── نمودارها (.viz) ─────────────────────────────────────────────────
   پالت دسته‌ای ۸تایی اعتبارسنجی‌شده برای حالت روشن (CVD و تمایز رنگ در جفت‌های مجاور قبول؛
   سبزآبی و زرد زیر ۳:۱ روی سفید → هر نمودار عدد/راهنمای نوشتاری دارد). ترتیب شکاف‌ها خودش بخشی از ایمنی است. */

.viz {
    --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
    --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
    /* پله‌های ترتیبی آبی (نقشه‌ی حرارتی) */
    --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #2a78d6; --seq-5: #184f95;
    margin: 0;
    color: var(--ink);
}
.chart-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s-4); }
.chart-card { display: flex; flex-direction: column; margin-bottom: 0; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-4); }
.chart-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: var(--text-lg); font-weight: 700; }
.chart-head .meta { color: var(--muted); font-size: var(--text-sm); }
@media (max-width: 1080px) { .chart-row { grid-template-columns: minmax(0, 1fr); } }

.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 var(--s-3); padding: 0; list-style: none; font-size: var(--text-sm); color: var(--ink-2); }
.viz-legend li { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend-value { color: var(--muted); font-weight: 600; }
.viz-swatch { display: inline-block; flex-shrink: 0; width: 10px; height: 10px; border-radius: 3px; }

/* راهنمای شناور (hover/focus) — مشترک بین نمودارها */
.viz-tip {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 50%;
    z-index: 20;
    min-width: 160px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #1b2236;
    color: #fff;
    font-size: var(--text-xs);
    line-height: 1.7;
    box-shadow: 0 12px 28px -10px rgba(10, 15, 40, 0.55);
    opacity: 0;
    visibility: hidden;
    transform: translate(50%, 4px);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
    pointer-events: none;
    white-space: nowrap;
}
.viz-tip strong { display: block; margin-bottom: 4px; font-size: var(--text-sm); }
.viz-tip-row { display: flex; align-items: center; gap: 6px; }
.viz-tip-row b { margin-inline-start: auto; padding-inline-start: 14px; font-weight: 700; }
.viz-tip-total { margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(255, 255, 255, 0.18); }
.edge-start > .viz-tip { right: 0; transform: translate(0, 4px); }
.edge-end > .viz-tip { right: auto; left: 0; transform: translate(0, 4px); }
:is(.trend-col, .heatmap-cell):is(:hover, :focus-visible) > .viz-tip { opacity: 1; visibility: visible; transform: translate(50%, 0); }
:is(.trend-col, .heatmap-cell).edge-start:is(:hover, :focus-visible) > .viz-tip,
:is(.trend-col, .heatmap-cell).edge-end:is(:hover, :focus-visible) > .viz-tip { transform: none; }

.viz-table { margin-top: var(--s-3); font-size: var(--text-sm); }
.viz-table summary { width: fit-content; color: var(--primary); cursor: pointer; }
.viz-table .table-responsive { max-height: 260px; margin-top: var(--s-2); overflow-y: auto; }

/* ── روند تماس روزانه: ستون‌های انباشته ── */
.trend-plot { position: relative; height: 220px; padding-inline-start: 28px; }
.trend-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.trend-gridline { position: relative; border-top: 1px dashed var(--line); }
.trend-gridline:last-child { border-top: 1px solid var(--line-strong); }
.trend-gridline span { position: absolute; top: -9px; inset-inline-start: 0; color: var(--faint); font-size: 11px; line-height: 1; }
.trend-cols { position: relative; display: flex; align-items: flex-end; gap: 4px; height: 100%; }
.trend-col { position: relative; display: flex; flex: 1; align-items: flex-end; height: 100%; min-width: 0; border-radius: 4px; outline: none; }
.trend-col:hover, .trend-col:focus-visible { background: color-mix(in srgb, var(--primary) 6%, transparent); }
/* راهنمای ستون بالای ناحیه‌ی نمودار می‌نشیند، نه بالای ستون — تا از کارت بیرون نزند */
.trend-col > .viz-tip { top: 0; bottom: auto; }
.trend-stack {
    display: flex;
    flex-direction: column-reverse;   /* اولین کارشناس پایین ستون */
    gap: 2px;                         /* فاصله‌ی هم‌رنگ سطح بین بخش‌ها */
    width: 100%;
    max-width: 22px;
    margin-inline: auto;
    animation: vv-rise-bar 0.6s var(--ease-out) backwards;
    transform-origin: bottom;
}
.trend-stack > span { flex-basis: 0; min-height: 3px; }
.trend-stack > span:last-child { border-radius: 4px 4px 0 0; }
@keyframes vv-rise-bar { from { transform: scaleY(0); } to { transform: none; } }
.trend-axis { display: flex; gap: 4px; padding-inline-start: 28px; margin-top: 6px; }
.trend-axis span { flex: 1; min-width: 0; overflow: visible; color: var(--faint); font-size: 11px; text-align: center; white-space: nowrap; }

/* ── دونات نتیجه‌ی تماس‌ها ── */
.donut-chart { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-4); }
.donut-wrap { position: relative; width: 190px; height: 190px; }
.donut-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-track { fill: none; stroke: var(--surface-sunken); stroke-width: 16; }
.donut-seg { fill: none; stroke-width: 16; stroke-linecap: butt; outline: none; transition: stroke-width 0.15s ease; cursor: default; }
.donut-seg:hover, .donut-seg:focus-visible { stroke-width: 20; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center strong { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.donut-center span { color: var(--muted); font-size: var(--text-sm); }
.donut-legend { display: grid; gap: 8px; width: 100%; margin: 0; padding: 0; list-style: none; font-size: var(--text-sm); }
.donut-legend li { display: flex; align-items: center; gap: 8px; }
.donut-legend .donut-label { flex: 1; color: var(--ink-2); }
.donut-legend b { font-weight: 700; }
.donut-legend .donut-pct { min-width: 48px; color: var(--muted); text-align: end; }

/* ── نقشه‌ی حرارتی مدت تماس هفته ── */
.heatmap-grid {
    display: grid;
    grid-template-columns: minmax(130px, 1.3fr) repeat(var(--days), minmax(72px, 1fr)) minmax(84px, 0.9fr);
    gap: 4px;
    overflow-x: auto;
}
.heatmap-day, .heatmap-total-head { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 4px; color: var(--muted); font-size: var(--text-xs); }
.heatmap-day strong { color: var(--ink-2); font-size: var(--text-sm); }
.heatmap-day.is-today strong { color: var(--primary); }
.heatmap-agent { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; font-size: var(--text-sm); }
.heatmap-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    border-radius: 8px;
    font-size: var(--text-xs);
    outline: none;
    transition: transform 0.15s var(--ease-out), box-shadow 0.15s ease;
}
.heatmap-cell strong { font-size: var(--text-sm); font-weight: 800; }
.heatmap-cell:hover, .heatmap-cell:focus-visible { transform: scale(1.05); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--seq-4); z-index: 5; }
.heatmap-zero { color: var(--faint); }
.heatmap-total { display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-size: var(--text-sm); }
.step-0 { background: var(--surface-sunken); color: var(--muted); }
.step-1 { background: var(--seq-1); color: #0d366b; }
.step-2 { background: var(--seq-2); color: #0d366b; }
.step-3 { background: var(--seq-3); color: #0b1e3d; }
.step-4 { background: var(--seq-4); color: #fff; }
.step-5 { background: var(--seq-5); color: #fff; }
.heatmap-scale { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: var(--s-3); color: var(--muted); font-size: var(--text-xs); }
.heatmap-scale i { width: 22px; height: 10px; border-radius: 3px; }

/* ── تحلیل کارشناسان ─────────────────────────────────────────────────
   رنگ وضعیت کیفیت (good/warning/critical از پالت وضعیت) همیشه با آیکون یا برچسب نوشتاری می‌آید. */

:root { --q-good: #0ca30c; --q-mid: #fab219; --q-bad: #d03b3b; }
.chart-row-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1080px) { .chart-row-even { grid-template-columns: minmax(0, 1fr); } }

.q-good { background: var(--q-good); color: #fff; }
.q-mid { background: var(--q-mid); color: #4a3300; }
.q-bad { background: var(--q-bad); color: #fff; }
.viz-swatch.q-good, .viz-swatch.q-mid, .viz-swatch.q-bad { color: transparent; }
.q-good-text { color: var(--q-good); }
.q-mid-text { color: #b97c00; }
.q-bad-text { color: var(--q-bad); }

.score-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--text-sm); font-weight: 700; }

/* مقایسه‌ی میانگین امتیاز: میله‌ی افقی با خط مرجع ۴۰ و ۶۰ */
.score-bars-plot { display: flex; flex-direction: column; gap: 10px; }
.score-row {
    display: grid;
    grid-template-columns: minmax(110px, 150px) minmax(0, 1fr) 92px;
    align-items: center;
    gap: var(--s-3);
    padding: 4px 6px;
    border-radius: 8px;
    outline: none;
}
.score-row:hover, .score-row:focus-visible { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.score-track { position: relative; height: 14px; border-radius: 4px 0 0 4px; background: var(--surface-sunken); }
.score-fill { display: block; height: 100%; border-radius: inherit; animation: vv-grow 0.8s var(--ease-out) backwards; transform-origin: right; }
.score-value { display: flex; flex-direction: column; line-height: 1.3; }
.score-value strong { font-size: var(--text-md); font-weight: 800; }
.score-value span { color: var(--muted); font-size: 11px; }
/* خط مرجع ۴۰ و ۶۰: لایه‌ای روی ریل و میله (از راست، هم‌جهت با پر شدن میله) + برچسب در ردیف محور */
.score-track::after {
    content: "";
    position: absolute;
    inset: -3px 0;
    z-index: 2;
    background:
        linear-gradient(to left, transparent calc(40% - 1px), rgba(20, 30, 70, 0.3) calc(40% - 1px), rgba(20, 30, 70, 0.3) 40%, transparent 40%),
        linear-gradient(to left, transparent calc(60% - 1px), color-mix(in srgb, var(--q-good) 80%, #000) calc(60% - 1px), color-mix(in srgb, var(--q-good) 80%, #000) 60%, transparent 60%);
    pointer-events: none;
}
.score-fill { position: relative; z-index: 1; }
.score-axis { padding-block: 0; }
.score-axis:hover { background: none; }
.score-axis-track { position: relative; height: 14px; }
.score-axis-track span { position: absolute; top: 0; transform: translateX(50%); color: var(--faint); font-size: 11px; line-height: 14px; }
.score-axis-track span.is-good { color: var(--q-good); }

/* روند پیشرفت (دمبلی) */
.dumbbell { display: flex; flex-direction: column; gap: 14px; }
.dumbbell-row { display: grid; grid-template-columns: minmax(110px, 150px) minmax(0, 1fr) 80px; align-items: center; gap: var(--s-3); }
.dumbbell-track { position: relative; height: 22px; border-radius: var(--r-pill); background: linear-gradient(90deg, transparent calc(50% - 0.5px), var(--line) calc(50% - 0.5px), var(--line) calc(50% + 0.5px), transparent calc(50% + 0.5px)), var(--surface-sunken); }
.dumbbell-line { position: absolute; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; }
.dumbbell-line.is-up { background: color-mix(in srgb, var(--q-good) 55%, #fff); }
.dumbbell-line.is-down { background: color-mix(in srgb, var(--q-bad) 50%, #fff); }
.dumbbell-dot {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0;
    margin-inline-start: -7px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(20, 30, 70, 0.25);
}
.dumbbell-dot.is-first { background: #9aa3b5; }
.dumbbell-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: var(--text-xs); }
.dumbbell-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dumbbell-legend .dumbbell-dot { position: static; display: inline-block; width: 10px; height: 10px; margin: 0; box-shadow: none; }
.dumbbell-legend .dumbbell-dot.is-legend { background: var(--series-1); }
.trend-badge { display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px; border-radius: var(--r-pill); font-size: var(--text-xs); font-weight: 800; }
.trend-badge.is-up { background: color-mix(in srgb, var(--q-good) 14%, #fff); color: #087a08; }
.trend-badge.is-down { background: color-mix(in srgb, var(--q-bad) 12%, #fff); color: var(--q-bad); }

/* توزیع کیفیت: میله‌ی ۱۰۰٪ انباشته */
.quality-bars { display: flex; flex-direction: column; gap: 12px; }
.quality-bars .viz-legend li i { font-size: 0.8rem; }
.quality-row { display: grid; grid-template-columns: minmax(110px, 150px) minmax(0, 1fr); align-items: center; gap: var(--s-3); }
.quality-stack { display: flex; gap: 2px; height: 26px; overflow: hidden; border-radius: 6px; background: var(--surface-sunken); }
.quality-stack > span {
    display: grid;
    place-items: center;
    flex-basis: 0;
    min-width: 4px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    animation: vv-grow 0.8s var(--ease-out) backwards;
    transform-origin: right;
}
.quality-stack > .q-empty { flex: 1; color: var(--muted); font-weight: 500; }

/* کارت هر کارشناس */
.agent-card { height: 100%; }
.agent-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.agent-card-head strong { font-size: var(--text-lg); }
.score-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--r-pill); font-size: var(--text-sm); }
.score-pill b { font-size: var(--text-md); font-weight: 800; }
.score-pill.sm { min-width: 36px; justify-content: center; padding: 1px 8px; }
.score-pill.sm b { font-size: var(--text-sm); }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; margin-bottom: var(--s-4); }
.mini-stats > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--primary) 3%, var(--surface-sunken));
    text-align: center;
}
.mini-stats strong { font-size: var(--text-xl); font-weight: 800; line-height: 1.2; }
.mini-stats span { color: var(--muted); font-size: 11px; }

.recent-scores { margin-bottom: var(--s-4); }
.recent-scores figcaption { margin-bottom: 6px; color: var(--muted); font-size: var(--text-xs); }
.recent-scores-plot { display: flex; align-items: flex-end; gap: 6px; height: 96px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.recent-score { position: relative; display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.recent-score-bar { width: 100%; max-width: 26px; border-radius: 4px 4px 0 0; animation: vv-rise-bar 0.6s var(--ease-out) backwards; transform-origin: bottom; }
.recent-score .num { position: absolute; bottom: -18px; color: var(--muted); font-size: 11px; }

.recent-calls-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; color: var(--muted); font-size: var(--text-xs); }
.recent-calls { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.recent-calls li { display: flex; align-items: center; gap: var(--s-2); min-width: 0; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.recent-calls li:last-child { border-bottom: 0; }
.recent-calls-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.recent-calls-summary { flex: 1; min-width: 0; color: var(--muted); font-size: var(--text-xs); text-align: end; }
/* نقاط قوت/ضعف/پیشنهادهای تحلیل تماس خط‌به‌خط («• ...») ذخیره می‌شوند */
.analysis-list { white-space: pre-line; }
.lead-link { display: inline-flex; align-items: center; gap: 2px; padding: 0 8px; border-radius: var(--r-pill); background: var(--t-emerald-soft); color: #0a7a4f; font-size: var(--text-xs); }

/* ── تمدید اشتراک: اشتراک خودِ سازمان (لایسنس/پلن) ───────────────────────────────── */

.sub-hero {
    --state: #34d399;
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--s-5);
    margin-bottom: var(--s-4);
    padding: var(--s-5);
    overflow: hidden;
    isolation: isolate;
    border-radius: var(--r-panel);
    background: var(--primary);
    background-image: var(--grad-brand);
    color: #fff;
    box-shadow: 0 18px 40px -22px var(--primary);
    animation: vv-rise 0.35s var(--ease-out) backwards;
}
/* دایره‌های نرم پس‌زمینه */
.sub-hero::before,
.sub-hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}
.sub-hero::before { width: 320px; height: 320px; inset-inline-end: -90px; top: -150px; }
.sub-hero::after { width: 200px; height: 200px; inset-inline-start: 30%; bottom: -120px; }
.sub-hero[data-state="expiring"], .sub-hero[data-state="grace"], .sub-hero[data-state="trial"] { --state: #fcd34d; }
.sub-hero[data-state="expired"], .sub-hero[data-state="invalid"], .sub-hero[data-state="missing"] { --state: #fca5a5; }

.sub-hero-main { display: flex; flex: 1; flex-direction: column; gap: var(--s-4); min-width: 0; }
.sub-hero-brand { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.sub-hero-brand > div { min-width: 0; }
.sub-hero-brand .avatar { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35); }
.sub-hero-logo { width: 56px; height: 56px; flex-shrink: 0; padding: 6px; border-radius: 16px; background: #fff; object-fit: contain; }
.sub-hero h2 { margin: 0 0 6px; overflow: hidden; color: #fff; font-size: var(--text-2xl); font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.sub-hero-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sub-plan,
.sub-state {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 12px;
    border-radius: var(--r-pill);
    font-size: var(--text-xs);
    font-weight: 700;
}
.sub-plan { background: rgba(255, 255, 255, 0.18); color: #fff; backdrop-filter: blur(4px); }
.sub-state { background: #fff; color: var(--ink); }
.sub-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--state); box-shadow: 0 0 0 3px color-mix(in srgb, var(--state) 35%, transparent); }

.sub-dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s-2); margin: 0; }
.sub-dates > div { padding: 8px 12px; border-radius: var(--r-control); background: rgba(255, 255, 255, 0.12); }
.sub-dates dt { color: rgba(255, 255, 255, 0.78); font-size: var(--text-xs); font-weight: 500; }
.sub-dates dd { margin: 2px 0 0; color: #fff; font-size: var(--text-lg); font-weight: 750; font-variant-numeric: normal; white-space: nowrap; }

.sub-timeline { min-width: 0; }
.sub-track { position: relative; height: 10px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.2); }
.sub-fill {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    border-radius: inherit;
    background: linear-gradient(270deg, rgba(255, 255, 255, 0.55), var(--state));
    transition: width 0.6s var(--ease-out);
}
.sub-now {
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    margin-inline-start: -9px;
    border: 4px solid #fff;
    border-radius: 50%;
    background: var(--state);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transform: translateY(-50%);
}
.sub-track-labels { display: flex; justify-content: space-between; gap: var(--s-2); margin-top: 8px; color: rgba(255, 255, 255, 0.78); font-size: var(--text-xs); }
.sub-track-labels strong { color: #fff; font-size: var(--text-sm); font-weight: 750; text-align: center; }

/* حلقه‌ی باقی‌مانده: سهم رنگی = درصد باقی‌مانده‌ی دوره */
.sub-ring {
    --p: 100;
    position: relative;
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 168px;
    height: 168px;
    border-radius: 50%;
    background: conic-gradient(var(--state) calc(var(--p) * 1%), rgba(255, 255, 255, 0.18) 0);
    animation: vv-pop 0.5s var(--ease-out) backwards 0.1s;
}
.sub-ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: rgba(15, 23, 42, 0.28); backdrop-filter: blur(6px); }
.sub-ring > div { position: relative; display: flex; flex-direction: column; align-items: center; line-height: 1.05; text-align: center; }
.sub-ring strong { color: #fff; font-size: 2.6rem; font-weight: 800; font-variant-numeric: normal; }
.sub-ring span { margin-top: 4px; color: rgba(255, 255, 255, 0.85); font-size: var(--text-sm); }

.sub-info { display: grid; gap: 0; margin: 0; }
.sub-info > div { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding: 9px 0; border-bottom: 1px dashed var(--line); }
.sub-info > div:last-child { border-bottom: 0; }
.sub-info dt { flex-shrink: 0; color: var(--muted); font-size: var(--text-sm); font-weight: 500; }
.sub-info dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--ink); font-weight: 650; text-align: end; }
.sub-code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: var(--text-xs); font-weight: 500 !important; }

.sub-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.sub-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-control);
    font-size: var(--text-sm);
    transition: transform 0.18s var(--ease-out), box-shadow 0.18s ease;
}
.sub-features li > span:first-of-type { flex: 1; min-width: 0; }
.sub-features li.on { border-color: color-mix(in srgb, var(--t-emerald) 30%, var(--line)); background: var(--t-emerald-soft); }
.sub-features li.on > i { color: var(--t-emerald); }
.sub-features li.off { color: var(--muted); background: var(--surface-sunken); }
.sub-features li:hover { transform: translateY(-1px); box-shadow: var(--shadow-card); }

.sub-renew { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.sub-renew-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--grad-brand);
    color: #fff;
    font-size: 1.3rem;
}

@media (max-width: 720px) {
    .sub-hero { flex-direction: column-reverse; align-items: stretch; padding: var(--s-4); }
    .sub-ring { align-self: center; width: 140px; height: 140px; }
    .sub-ring strong { font-size: 2.1rem; }
}
@media (prefers-reduced-motion: reduce) {
    .sub-hero, .sub-ring { animation: none; }
    .sub-fill { transition: none; }
}

/* ── تماس‌های صوتی: جدول ۶ستونه که در فضای کم کارت می‌شود (بدون اسکرول افقی) ─────────── */

.call-list { container-type: inline-size; }
.call-list .table-responsive { overflow-x: visible; }
.call-table { width: 100%; margin: 0; }
.call-table td { min-width: 0; }
.call-table .call-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; color: var(--muted); font-size: var(--text-xs); }
.call-table .call-chip { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.call-table .c-status .badge + .badge { margin-inline-start: 4px; }
/* ستون متن: باقی عرض را می‌گیرد و با «…» کوتاه می‌شود، نه اینکه جدول را پهن کند */
.call-table .c-text { width: 100%; max-width: 0; }
.call-table .c-actions { text-align: end; }

@container (max-width: 860px) {
    .call-table thead { display: none; }
    .call-table, .call-table tbody { display: block; }
    .call-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 10px 14px;
        padding: 14px 16px;
        border-bottom: 1px solid var(--line);
    }
    .call-table tr:last-child { border-bottom: 0; }
    .call-table > tbody > tr > td { display: block; padding: 0; border: 0; background: none; box-shadow: none; }
    .call-table .c-text { grid-column: 1 / -1; width: auto; max-width: none; }
    .call-table .c-actions { grid-column: 1 / -1; text-align: start; }
}
@container (max-width: 420px) {
    .call-table tr { grid-template-columns: minmax(0, 1fr); }
}

/* ── لیدها: در فضای کم هر لید یک کارت (بدون اسکرول افقی و بدون ستون اقدامِ بیرون‌افتاده) ─── */

.lead-list { container-type: inline-size; }

@container (max-width: 900px) {
    .lead-list .table-responsive { overflow-x: visible; }
    .lead-table thead { display: none; }
    .lead-table, .lead-table tbody { display: block; }
    .lead-table tr {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        align-items: center;
        gap: 8px 14px;
        padding: 12px 16px;
        border-bottom: 1px solid var(--line);
    }
    .lead-table tr:last-child { border-bottom: 0; }
    .lead-table > tbody > tr > td { display: block; min-width: 0; padding: 0; border: 0; background: none; text-align: start; }
    .lead-table > tbody > tr > td:empty { display: none; }
    .lead-table .lead-name { grid-column: 1 / -1; min-width: 0; }
    .lead-table td[data-label]::before { content: attr(data-label) ":"; margin-inline-end: 4px; color: var(--muted); font-size: var(--text-xs); }
    .lead-table .lead-phone { direction: rtl; text-align: start; }
    .lead-table .row-actions { grid-column: 1 / -1; width: auto; text-align: end; }
    .lead-table .row-actions .btn { opacity: 1; transform: none; }
}

/* ── ماتریس پلن‌ها: در موبایل حروف نام امکان و کلید شکسته نشوند؛ جدول داخل کادر خودش اسکرول می‌خورد ── */
.plan-matrix td:first-child { min-width: 170px; overflow-wrap: normal; }
.plan-matrix td:first-child small { overflow-wrap: anywhere; }
.plan-matrix th .form-control,
.plan-matrix td .form-control { min-width: 96px; }

/* ── فیلدهای فرم: یکدست، نرم و خوش‌رنگ در کل سامانه (ورودی، کشو، متن بلند، تیک، سوییچ، فایل) ───── */

.form-label { margin-bottom: 6px; color: var(--ink-2); font-size: var(--text-sm); font-weight: 600; }
.form-text { margin-top: 5px; line-height: 1.7; }

.form-control,
.form-select {
    min-height: 40px;
    padding-block: 0.45rem;
    border: 1.5px solid color-mix(in srgb, var(--line-strong) 80%, transparent);
    border-radius: 11px;
    background-color: color-mix(in srgb, var(--surface-sunken) 40%, var(--surface));
    color: var(--ink);
    transition: border-color 0.18s ease, box-shadow 0.2s ease, background-color 0.18s ease;
}
.form-control:hover,
.form-select:hover {
    border-color: color-mix(in srgb, var(--primary) 38%, var(--line-strong));
    background-color: var(--surface);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    background-color: var(--surface);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
    outline: 0;
}
.form-control::placeholder { color: var(--faint); opacity: 1; }
.form-control:disabled,
.form-select:disabled {
    border-style: dashed;
    background-color: var(--surface-sunken);
    color: var(--muted);
    cursor: not-allowed;
}
textarea.form-control { min-height: 88px; line-height: 1.8; resize: vertical; }

/* کشو: فلش ظریف خودی، سمت چپ (انتهای خط در RTL) */
.form-select:not([multiple]):not([size]) {
    padding-inline: 0.8rem 2.2rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m4 6 4 4 4-4'/%3e%3c/svg%3e");
    background-position: left 0.75rem center;
    background-size: 14px 14px;
    background-repeat: no-repeat;
}
.form-select:not([multiple]):not([size]):focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%232f6fed' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m4 6 4 4 4-4'/%3e%3c/svg%3e");
}

.form-control-sm,
.form-select-sm { min-height: 32px; padding-block: 0.25rem; border-radius: 9px; font-size: var(--text-sm); }
.form-select-sm:not([multiple]):not([size]) { padding-inline: 0.65rem 1.9rem; background-position: left 0.6rem center; }

/* گروه ورودی: آیکون/پسوند هم‌رنگ فیلد و با فوکوس رنگی می‌شود */
.input-group-text {
    border: 1.5px solid color-mix(in srgb, var(--line-strong) 80%, transparent);
    border-radius: 11px;
    background: color-mix(in srgb, var(--primary) 7%, var(--surface));
    color: var(--primary);
    transition: border-color 0.18s ease, color 0.18s ease;
}
.input-group:focus-within .input-group-text { border-color: var(--primary); }
.input-group-sm > .input-group-text { border-radius: 9px; }

/* تیک، رادیو و سوییچ */
.form-check-input {
    width: 1.15em;
    height: 1.15em;
    border: 1.5px solid var(--line-strong);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.2s ease;
}
.form-check-input:hover { border-color: var(--primary); }
.form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent); }
.form-check-input:disabled { cursor: not-allowed; }
.form-check-label { cursor: pointer; }
.form-switch .form-check-input { width: 2.3em; height: 1.25em; border-radius: 2em; }

/* انتخاب فایل */
.form-control[type="file"] { padding-block: 0; line-height: 38px; }
.form-control[type="file"]::file-selector-button {
    margin-block: 0;
    margin-inline: -0.75rem 0.75rem;
    padding: 0 14px;
    height: 37px;
    border: 0;
    border-inline-end: 1.5px solid color-mix(in srgb, var(--line-strong) 80%, transparent);
    background: color-mix(in srgb, var(--primary) 9%, var(--surface));
    color: var(--primary);
    font-weight: 600;
}

/* تاریخ‌گزین شمسی: فیلد فقط‌خواندنی ولی قابل کلیک — ظاهر فیلد معمولی */
.jalali-date-picker .form-control[readonly] { background-color: var(--surface); cursor: pointer; }

/* ── صدور و تمدید اشتراک مشتری (مرکز مشتریان ← جزئیات) ─────────────────────────────── */

.issue-current {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    margin-bottom: var(--s-3);
    padding: 10px 14px;
    border-radius: var(--r-control);
    background: var(--surface-sunken);
    color: var(--ink-2);
    font-size: var(--text-sm);
}
.issue-current-plan { color: var(--primary); font-weight: 700; }
.issue-current-empty { color: var(--q-bad); font-weight: 600; }
.issue-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--s-3) var(--s-4); margin-bottom: var(--s-3); }
.issue-days { max-width: 180px; }
/* قواعد سازمان در جزئیات مشتری */
.rules-group { display: flex; align-items: center; gap: 6px; margin: var(--s-3) 0 var(--s-2); color: var(--ink-2); font-size: var(--text-sm); font-weight: 700; }
.rules-input { max-width: 240px; }
/* درخواست و پیشنهاد مشتری / صندوق درخواست‌ها */
.feedback-panel { max-width: 760px; }
.feedback-note { margin: var(--s-3) 0 var(--s-2); color: var(--ink-2); font-size: var(--text-sm); }
.feedback-contact { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--faint); font-size: var(--text-xs); }
.feedback-contact a { color: inherit; text-decoration: none; }
.feedback-contact a:hover { text-decoration: underline; }
.feedback-list { display: grid; gap: var(--s-3); }
.feedback-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); }
.feedback-item header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.feedback-item footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.feedback-message { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-1, inherit); }
.issue-features { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s-3); }
.issue-features span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: var(--text-xs);
}
.issue-features .on { background: var(--t-emerald-soft); color: #0a7a4f; }
.issue-features .off { background: var(--surface-sunken); color: var(--faint); text-decoration: line-through; }
.issue-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    margin-bottom: var(--s-4);
    padding: 12px 16px;
    border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--line));
    border-radius: var(--r-control);
    background: color-mix(in srgb, var(--primary) 6%, var(--surface));
}
.issue-summary i { color: var(--primary); }

/* ── زنگوله‌ی اعلان‌ها: کادر کوچک عمودی زیر زنگوله، ۶ اعلان و بقیه با اسکرول ─────────────── */

.notif-wrap { position: relative; }
.notif-backdrop { position: fixed; inset: 0; z-index: 1040; }
.notif-panel {
    position: absolute;
    top: calc(100% + 10px);
    inset-inline-end: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    width: min(360px, calc(100vw - 24px));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 24px 48px -18px rgba(15, 23, 42, 0.35);
    animation: vv-pop-dialog 0.2s var(--ease-out);
    transform-origin: top left;
}
.notif-panel::before {
    content: "";
    position: absolute;
    top: -6px;
    inset-inline-end: 14px;
    width: 12px;
    height: 12px;
    border-top: 1px solid var(--line);
    border-inline-start: 1px solid var(--line);
    background: var(--surface);
    transform: rotate(45deg);
}
.notif-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--primary) 5%, var(--surface));
}
.notif-head strong { font-size: var(--text-sm); }
.notif-head strong i { color: var(--primary); }
.notif-head span { color: var(--muted); font-size: var(--text-xs); }
/* ارتفاع ۶ اعلان؛ بیشتر از آن با اسکرول عمودی همین کادر */
.notif-list { max-height: calc(6 * 62px); margin: 0; padding: 4px 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; scrollbar-width: thin; }
.notif-item {
    --nt: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 62px;
    padding: 8px 16px;
    color: var(--ink);
    text-decoration: none;
    transition: background-color 0.15s ease;
}
.notif-item:hover, .notif-item:focus-visible { background: color-mix(in srgb, var(--nt) 7%, var(--surface)); }
.notif-info { --nt: var(--primary); }
.notif-success { --nt: var(--t-emerald); }
.notif-warning { --nt: var(--t-amber); }
.notif-danger { --nt: var(--q-bad); }
.notif-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: color-mix(in srgb, var(--nt) 13%, var(--surface));
    color: var(--nt);
}
.notif-text { display: flex; flex-direction: column; min-width: 0; }
.notif-text strong { overflow: hidden; font-size: var(--text-sm); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.notif-text small { overflow: hidden; color: var(--muted); font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.notif-danger .notif-text strong { color: color-mix(in srgb, var(--q-bad) 85%, var(--ink)); }
.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 18px; color: var(--muted); font-size: var(--text-sm); text-align: center; }
.notif-empty i { color: var(--t-emerald); font-size: 1.8rem; }
.notif-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px;
    border-top: 1px solid var(--line);
    color: var(--primary);
    font-size: var(--text-xs);
    font-weight: 600;
    text-decoration: none;
}
.notif-foot:hover { background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }

/* صفحه‌ی «اعلان‌ها»: همان ردیف‌های زنگوله، با جای کافی برای متن کامل */
.notif-page { display: grid; gap: var(--s-4); }
.notif-page .notif-list { max-height: none; }
.notif-page .notif-text strong,
.notif-page .notif-text small { overflow: visible; white-space: normal; }

/* ── کارت پیش‌نمایش لید (hover روی نام لید) ─────────────────────────────────────────── */

.lead-peek {
    position: fixed;
    z-index: 1080;
    width: min(330px, calc(100vw - 16px));
    padding: 14px 16px 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 22px 46px -18px rgba(15, 23, 42, 0.38);
    color: var(--ink);
    font-size: var(--text-sm);
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px) scale(0.98);
    transition: opacity 0.16s ease, transform 0.18s var(--ease-out);
    /* هیچ متنی از کارت بیرون نمی‌زند */
    overflow: hidden;
    overflow-wrap: anywhere;
}
.lead-peek.is-open { opacity: 1; pointer-events: auto; transform: none; }
.lead-peek .lp-loading { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.lead-peek .lp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lead-peek .lp-title { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.lead-peek .lp-title strong { overflow: hidden; font-size: var(--text-md); font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.lead-peek .lp-title small { overflow: hidden; color: var(--muted); font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.lead-peek .lp-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 0 0 10px; padding: 10px 12px; border-radius: var(--r-control); background: var(--surface-sunken); }
.lead-peek .lp-facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; min-width: 0; }
.lead-peek .lp-facts dt { flex-shrink: 0; color: var(--muted); font-size: var(--text-xs); font-weight: 500; }
/* مقدار بلند (مثل عنوان پیگیری بعدی) در چند خط می‌شکند، نه بیرون از کارت */
.lead-peek .lp-facts dd { flex: 1; min-width: 0; margin: 0; font-size: var(--text-xs); font-weight: 650; line-height: 1.7; text-align: end; overflow-wrap: anywhere; }
.lead-peek .lp-facts dd.ltr { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-peek .lp-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.lead-peek .lp-stats span { padding: 2px 9px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); color: var(--primary); font-size: var(--text-xs); }
.lead-peek .lp-note { display: -webkit-box; margin: 0 0 8px; overflow: hidden; color: var(--ink-2); font-size: var(--text-xs); line-height: 1.8; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.lead-peek .lp-note i { color: var(--t-violet); }
.lead-peek .lp-foot { padding-top: 6px; border-top: 1px dashed var(--line); color: var(--faint); font-size: 0.68rem; text-align: center; }
@media (prefers-reduced-motion: reduce) { .lead-peek { transition: none; } }

/* ── راهنمای گام‌به‌گام منو (اولین ورود) ─────────────────────────────────────────────── */

.tour-layer { position: fixed; inset: 0; z-index: 3000; cursor: pointer; opacity: 0; transition: opacity 0.22s ease; }
.tour-layer.is-on { opacity: 1; }
.tour-layer.is-out { opacity: 0; }
.tour-spot {
    position: fixed;
    border-radius: 14px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95), 0 0 0 9999px rgba(15, 23, 42, 0.62);
    transition: left 0.35s var(--ease-out), top 0.35s var(--ease-out), width 0.35s var(--ease-out), height 0.35s var(--ease-out);
    pointer-events: none;
}
.tour-spot::after {
    content: "";
    position: absolute;
    inset: -8px;
    border: 2px solid rgba(255, 255, 255, 0.75);
    border-radius: 18px;
    animation: tour-ring 1.6s ease-out infinite;
}
@keyframes tour-ring { from { opacity: 0.9; transform: scale(0.96); } to { opacity: 0; transform: scale(1.12); } }
.tour-bubble {
    position: fixed;
    padding: 16px 18px 14px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 26px 50px -18px rgba(0, 0, 0, 0.45);
    color: var(--ink);
    transition: left 0.3s var(--ease-out), top 0.3s var(--ease-out);
}
.tour-bubble.is-in { animation: vv-pop-dialog 0.25s var(--ease-out); }
.tour-count {
    display: inline-block;
    margin-bottom: 6px;
    padding: 1px 10px;
    border-radius: var(--r-pill);
    background: color-mix(in srgb, var(--primary) 10%, var(--surface));
    color: var(--primary);
    font-size: var(--text-xs);
    font-weight: 700;
}
.tour-title { display: block; margin-bottom: 4px; font-size: var(--text-lg); font-weight: 800; }
.tour-text { margin: 0 0 12px; color: var(--ink-2); font-size: var(--text-sm); line-height: 1.9; }
.tour-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
.tour-hint { color: var(--faint); font-size: 0.7rem; }
.tour-skip { padding: 0; border: 0; background: none; color: var(--muted); font-size: var(--text-xs); text-decoration: underline; cursor: pointer; }
.tour-skip:hover { color: var(--q-bad); }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-bubble { transition: none; } .tour-spot::after { animation: none; } }

/* ── دکمه و کشوی «راهنمای این صفحه» ──────────────────────────────────────────────── */

.help-backdrop { position: fixed; inset: 0; z-index: 1060; background: rgba(15, 23, 42, 0.28); animation: vv-fade 0.2s ease; }
.help-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-end: 0;
    z-index: 1070;
    display: flex;
    flex-direction: column;
    width: min(380px, calc(100vw - 24px));
    padding: 20px;
    overflow-y: auto;
    background: var(--surface);
    box-shadow: 0 0 60px -20px rgba(15, 23, 42, 0.5);
    animation: help-in 0.28s var(--ease-out);
}
@keyframes help-in { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
.help-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.help-head > div { flex: 1; min-width: 0; }
.help-head small { display: block; color: var(--muted); font-size: var(--text-xs); }
.help-head strong { font-size: var(--text-lg); font-weight: 800; }
.help-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--grad-brand); color: #fff; font-size: 1.25rem; }
.help-summary { margin-bottom: 12px; padding: 10px 12px; border-radius: var(--r-control); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); color: var(--ink-2); font-size: var(--text-sm); }
.help-tips { display: grid; gap: 10px; margin: 0 0 16px; padding: 0; list-style: none; }
.help-tips li { display: flex; gap: 8px; color: var(--ink-2); font-size: var(--text-sm); line-height: 1.85; }
.help-tips i { flex-shrink: 0; margin-top: 4px; color: var(--t-emerald); }
.help-foot { margin-top: auto; }

/* ── اهداف فروش: حلقه‌ی پیشرفت، صفحه‌ی هدف‌گذاری و جشن ───────────────────────────────── */

.goal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: var(--s-3); padding: var(--s-3) var(--s-4) var(--s-4); }
.goal-meter {
    --gp: var(--primary);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--gp) 4%, var(--surface));
}
.goal-meter[data-pace="achieved"] { --gp: var(--t-emerald); }
.goal-meter[data-pace="ahead"] { --gp: var(--t-emerald); }
.goal-meter[data-pace="ontrack"] { --gp: var(--t-blue); }
.goal-meter[data-pace="behind"] { --gp: var(--t-amber); }
.goal-meter[data-pace="notarget"] { --gp: #94a3b8; }
.goal-ring {
    --p: 0;
    position: relative;
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: conic-gradient(var(--gp) calc(min(var(--p), 100) * 1%), color-mix(in srgb, var(--gp) 14%, var(--surface)) 0);
    transition: background 0.6s var(--ease-out);
}
.goal-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.goal-ring > div { position: relative; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.goal-ring i { color: var(--gp); font-size: 0.85rem; }
.goal-ring strong { font-size: var(--text-md); font-weight: 800; }
.goal-meter[data-pace="achieved"] .goal-ring { box-shadow: 0 0 0 4px color-mix(in srgb, var(--t-emerald) 18%, transparent); }
.goal-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.goal-label { color: var(--muted); font-size: var(--text-xs); font-weight: 600; }
.goal-values { color: var(--ink); font-size: var(--text-sm); }
.goal-values b { font-size: var(--text-lg); font-weight: 800; }
.goal-values small { margin-inline-start: 4px; color: var(--muted); }
.goal-pace { width: fit-content; padding: 1px 9px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--gp) 13%, var(--surface)); color: color-mix(in srgb, var(--gp) 75%, var(--ink)); font-size: var(--text-xs); font-weight: 650; }
.goal-need { color: var(--muted); font-size: 0.72rem; }
.goal-card { margin-bottom: var(--s-4); padding: 0; }
.goal-card .panel-head { padding: var(--s-3) var(--s-4) 0; border: 0; }

.target-month { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.target-month-title { display: flex; flex: 1; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; text-align: center; }
.target-month-title strong { font-size: var(--text-xl); font-weight: 800; }
.target-month-title small { width: 100%; color: var(--muted); }
.target-list { container-type: inline-size; }
.target-row {
    display: grid;
    grid-template-columns: minmax(160px, 1.1fr) repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: var(--s-3);
    padding: 14px var(--s-4);
    border-bottom: 1px solid var(--line);
}
.target-agent { display: flex; align-items: center; gap: 10px; min-width: 0; padding-top: 22px; }
.target-agent strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.target-cell { --gp: #94a3b8; min-width: 0; }
.target-cell[data-pace="achieved"], .target-cell[data-pace="ahead"] { --gp: var(--t-emerald); }
.target-cell[data-pace="ontrack"] { --gp: var(--t-blue); }
.target-cell[data-pace="behind"] { --gp: var(--t-amber); }
.target-cell .form-label { margin-bottom: 4px; font-size: var(--text-xs); }
.target-bar { height: 6px; margin-top: 8px; overflow: hidden; border-radius: var(--r-pill); background: color-mix(in srgb, var(--gp) 15%, var(--surface)); }
.target-bar span { display: block; height: 100%; border-radius: inherit; background: var(--gp); transition: width 0.5s var(--ease-out); }
.target-meta { display: block; margin-top: 4px; color: var(--muted); font-size: 0.72rem; }
.target-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-4); }
@container (max-width: 720px) {
    .target-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .target-agent { grid-column: 1 / -1; padding-top: 0; }
}
@container (max-width: 420px) {
    .target-row { grid-template-columns: minmax(0, 1fr); }
}

.celebrate-canvas { position: fixed; inset: 0; z-index: 4000; width: 100vw; height: 100vh; pointer-events: none; }
.celebrate-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 4001;
    padding: 12px 22px;
    border-radius: var(--r-pill);
    background: var(--grad-brand);
    box-shadow: 0 16px 36px -14px var(--primary);
    color: #fff;
    font-weight: 700;
    opacity: 0;
    transform: translate(-50%, -16px);
    transition: opacity 0.3s ease, transform 0.35s var(--ease-out);
}
.celebrate-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── دکمه‌های کنار عنوان صفحه (مثل «خروجی PDF» و «لید جدید») ──────── */
.page-actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.page-header .bi-file-earmark-pdf { color: #d93a3a; }

/* ── تسک‌های منقضی‌شده در گزارش مدیر (ExpiredTasksPanel) ─────────── */
.xt-panel { padding: 0; margin-bottom: var(--s-4); }
.xt-panel .panel-head { border: 0; padding-bottom: 0; flex-wrap: wrap; }
.xt-body { padding: var(--s-3) var(--s-4) var(--s-4); display: grid; gap: var(--s-4); }
.xt-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: var(--s-2); }
.xt-stat {
    display: grid; gap: 2px; padding: 10px 14px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--surface-sunken);
}
.xt-stat strong { font-size: 1.35rem; font-weight: 750; line-height: 1.2; }
.xt-stat span { color: var(--muted); font-size: var(--text-xs); }
.xt-stat.is-expired { background: var(--t-pink-soft); border-color: color-mix(in srgb, var(--t-pink) 25%, #fff); }
.xt-stat.is-expired strong { color: var(--t-pink); }
.xt-stat.is-partial { background: var(--t-amber-soft); border-color: color-mix(in srgb, var(--t-amber) 25%, #fff); }
.xt-stat.is-partial strong { color: #a86f00; }

.xt-agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: var(--s-3); }
.xt-agent {
    display: grid; gap: 10px; padding: 12px 14px; text-align: start;
    border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.xt-agent:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.xt-agent[aria-selected="true"] {
    border-color: color-mix(in srgb, var(--t-pink) 55%, #fff);
    box-shadow: 0 10px 24px -14px var(--t-pink), inset 0 0 0 1px color-mix(in srgb, var(--t-pink) 35%, #fff);
}
.xt-agent-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.xt-agent-name { display: grid; min-width: 0; flex: 1; }
.xt-agent-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xt-agent-name small { color: var(--muted); font-size: var(--text-xs); }
.xt-agent-total { font-size: 1.5rem; font-weight: 800; color: var(--t-pink); line-height: 1; }
.xt-split { display: flex; height: 6px; border-radius: var(--r-pill); overflow: hidden; background: var(--surface-sunken); }
.xt-split i { width: var(--w); }
.xt-split .is-expired { background: var(--t-pink); }
.xt-split .is-partial { background: var(--t-amber); }
.xt-spark { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; align-items: end; height: 54px; }
.xt-spark-col { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 3px; text-align: center; }
.xt-spark-bar { align-self: end; height: max(3px, var(--h)); border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, var(--t-pink), color-mix(in srgb, var(--t-pink) 55%, #fff)); }
.xt-spark-bar.is-zero { background: var(--line); }
.xt-spark-col small { color: var(--faint, var(--muted)); font-size: 0.625rem; white-space: nowrap; overflow: hidden; }

.xt-detail { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.xt-detail-head {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap;
    padding: 10px 14px; background: var(--surface-sunken); border-bottom: 1px solid var(--line);
}
.xt-detail > .empty-inline { margin: var(--s-3); }
.xt-list { list-style: none; margin: 0; padding: 0; max-height: 440px; overflow-y: auto; }
.xt-row {
    --row-tone: var(--t-pink); --row-soft: var(--t-pink-soft);
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
    padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.xt-row:last-child { border-bottom: 0; }
.xt-row.is-partial { --row-tone: #a86f00; --row-soft: var(--t-amber-soft); }
.xt-date {
    display: grid; place-items: center; width: 48px; padding: 4px 0; border-radius: 10px;
    background: var(--row-soft); color: var(--row-tone); line-height: 1.15;
}
.xt-date b { font-size: 1.1rem; font-weight: 800; }
.xt-date small { font-size: 0.625rem; }
.xt-main { display: grid; gap: 3px; min-width: 0; }
.xt-main strong { font-weight: 650; overflow-wrap: anywhere; }
.xt-meta { color: var(--muted); font-size: var(--text-xs); }
.xt-progress { display: flex; align-items: center; gap: 8px; }
.xt-progress-track { flex: 0 1 160px; height: 5px; border-radius: var(--r-pill); background: var(--surface-sunken); overflow: hidden; }
.xt-progress-track > span { display: block; width: var(--p); height: 100%; background: var(--row-tone); border-radius: inherit; }
.xt-progress small { color: var(--muted); font-size: var(--text-xs); white-space: nowrap; }
.xt-pill {
    padding: 3px 10px; border-radius: var(--r-pill); font-size: var(--text-xs); font-weight: 650;
    background: var(--row-soft); color: var(--row-tone); white-space: nowrap;
}
.xt-agents.is-single { grid-template-columns: 1fr; }
.xt-agents.is-single .xt-agent { pointer-events: none; box-shadow: none; border-color: var(--line); }
.xt-agents.is-single .xt-spark { height: 70px; }
.week-banner .week-note a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* ── میانبرهای پرکاربرد داشبورد ───────────────────────────────────── */

.quick-links { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-4); }
.quick-links-title { color: var(--muted); font-size: var(--text-sm); font-weight: 600; }
.quick-links-hint { color: var(--muted); font-size: var(--text-sm); }
.quick-links-list { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.quick-link {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    min-height: 36px;
    padding: 0 var(--s-3);
    border: 1px solid var(--line);
    border-radius: var(--r-control);
    background: var(--surface);
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.quick-link i { color: var(--primary); }
.quick-link:hover { border-color: var(--primary-line); background: var(--hover); color: var(--ink); }
.quick-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* تنظیم اختصاصی امکانات یک اشتراک (مرکز مشتریان) */
.issue-overrides { border: 1px dashed var(--line-strong); border-radius: var(--r-panel); padding: 10px 14px; }
.issue-overrides > summary { cursor: pointer; font-weight: 700; color: var(--primary); width: fit-content; }
.issue-override-table td, .issue-override-table th { vertical-align: middle; font-size: var(--text-sm); }
.issue-override-table .form-select-sm { max-width: 140px; }
