/* ============================================================
   styles.css – دفتر انضباط سرمایه
   بارگذاری فونت وزیرمتن از فولدر fonts و سایر استایل‌ها
   ============================================================ */

/* ---------- فونت‌های محلی وزیرمتن ---------- */
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Thin.woff2') format('woff2');
    font-weight: 100;
    font-style: normal;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-ExtraLight.woff2') format('woff2');
    font-weight: 200;
    font-style: normal;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Black.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
}

/* ---------- متغیرها و ریشه (پالت بازطراحی‌شده توسط تیم UI/UX + روان‌شناسی رنگ + بازاریابی دیجیتال) ---------- */
:root {
    --bg: #0a0e18;
    --surface: #121a2c;
    --surface2: #1a2540;
    --paper: #f1ead8;
    --paper-line: #ded4ba;
    --gold: #e3b53c;
    --gold-dim: #b3872a;
    --teal: #22c38f;
    --red: #ef5350;
    --text: #f5f7fc;
    --muted: #93a3c2;
    --hair: #223154;
    --green: #22c38f;
    --orange: #f0a13c;
    --blue: #4c8dfa;
    --overlay: rgba(6, 10, 18, 0.88);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .30), 0 3px 8px rgba(0, 0, 0, .22);
    --shadow: 0 2px 6px rgba(0, 0, 0, .28), 0 8px 20px rgba(0, 0, 0, .20);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, .38), 0 24px 52px rgba(0, 0, 0, .24);
    --glow: radial-gradient(1100px 480px at 85% -8%, rgba(227, 181, 60, 0.09), transparent 60%),
        radial-gradient(850px 460px at 8% 0%, rgba(76, 141, 250, 0.07), transparent 55%);
}

/* ---------- حالت روشن (Light Mode) — پالت آبی ---------- */
:root[data-theme="light"] {
    --bg: #f4f7fc;
    --surface: #ffffff;
    --surface2: #eaf1fb;
    --paper: #eef4fc;
    --paper-line: #d3e3f7;
    --gold: #2563eb;
    --gold-dim: #1447a3;
    --teal: #0e9f6e;
    --red: #dc2626;
    --text: #101728;
    --muted: #57698d;
    --hair: #dbe6f5;
    --green: #0e9f6e;
    --orange: #c2660d;
    --blue: #2f6fed;
    --overlay: rgba(15, 23, 42, 0.45);
    --shadow-sm: 0 1px 2px rgba(30, 64, 175, .10), 0 3px 8px rgba(30, 64, 175, .07);
    --shadow: 0 3px 8px rgba(30, 64, 175, .08), 0 10px 24px rgba(30, 64, 175, .12);
    --shadow-lg: 0 16px 32px rgba(30, 64, 175, .16), 0 28px 56px rgba(30, 64, 175, .14);
    --glow: radial-gradient(1100px 480px at 85% -8%, rgba(37, 99, 235, 0.12), transparent 60%),
        radial-gradient(850px 460px at 8% 0%, rgba(14, 159, 110, 0.07), transparent 55%);
}

/* ---------- تنظیمات تکمیلی حالت روشن: کنتراست متن + gradient/سایه‌ی زنده روی کارت‌ها ---------- */
:root[data-theme="light"] .cd-btn:not(.green):not(.red):not(.ghost) {
    --btn-txt: #ffffff;
}

:root[data-theme="light"] .cd-chart-range-btn.active,
:root[data-theme="light"] .cd-candle-range-btn.active {
    color: #ffffff;
}

:root[data-theme="light"] .auth-btn {
    color: #ffffff;
}

:root[data-theme="light"] .cd-ledger {
    color: #16233d;
}

:root[data-theme="light"] .cd-ledger th {
    color: #5c6f92;
}

:root[data-theme="light"] .cd-ledger .empty {
    color: #7286a8;
}

:root[data-theme="light"] .cd-final-rec {
    background: linear-gradient(160deg, #ffffff 0%, #eaf1ff 100%);
}

:root[data-theme="light"] .cd-analytics-card,
:root[data-theme="light"] .cd-chartcard,
:root[data-theme="light"] .cd-setup,
:root[data-theme="light"] .cd-discipline-box,
:root[data-theme="light"] .cd-analysis,
:root[data-theme="light"] .cd-progress-dashboard,
:root[data-theme="light"] .cd-pf-table-wrap,
:root[data-theme="light"] .cd-sales-history {
    background: linear-gradient(160deg, #ffffff 0%, #f2f7ff 100%);
}

:root[data-theme="light"] .cd-summary {
    background: linear-gradient(135deg, color-mix(in srgb, #ffffff, transparent 25%) 0%, color-mix(in srgb, #eaf1fb, transparent 35%) 100%);
    border-color: rgba(90, 100, 120, 0.18);
    box-shadow: 0 8px 22px rgba(30, 64, 175, .10), 0 2px 8px rgba(30, 64, 175, .06), inset 0 1px 0 rgba(255, 255, 255, .6);
}

:root[data-theme="light"] .cd-gauge-card {
    background: linear-gradient(160deg, #ffffff 0%, #e5eefd 100%);
}

:root[data-theme="light"] .cd-discipline-box .cd-analysis {
    background: transparent;
    box-shadow: none;
}

:root[data-theme="light"] .auth-modal {
    background: linear-gradient(165deg, #ffffff 0%, #eef4ff 100%);
}

:root[data-theme="light"] .cd-modal {
    background: linear-gradient(165deg, #ffffff 0%, #eef4ff 100%);
}

:root[data-theme="light"] .cd-header::after {
    background: linear-gradient(90deg, transparent, var(--gold), var(--blue), transparent);
    opacity: .55;
}

html,
body {
    background: var(--bg);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ============================================================
   SIDEBAR — سایدبار مدرن سمت راست (RTL)
   ============================================================ */
.cd-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 56px;
    background: var(--surface);
    border-left: 1px solid var(--hair);
    z-index: 200;
    transition: width 0.3s cubic-bezier(.4,0,.2,1);
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.cd-sidebar.expanded {
    width: 210px;
}

.cd-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--hair);
    color: var(--muted);
    cursor: pointer;
    transition: color .2s, background .2s;
    flex-shrink: 0;
}

.cd-sidebar-toggle:hover {
    color: var(--gold);
    background: rgba(227,181,60,0.08);
}

.cd-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 0;
    overflow-y: auto;
    flex: 1;
}

.cd-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    border-right: 3px solid transparent;
    margin-right: 0;
}

.cd-sidebar-item:hover {
    color: var(--text);
    background: rgba(227,181,60,0.06);
}

.cd-sidebar-item.active {
    color: var(--gold);
    background: rgba(227,181,60,0.10);
    border-right-color: var(--gold);
}

.cd-sidebar-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
    line-height: 1;
}

/* Tooltip برای سایدبار بسته */
.cd-sidebar:not(.expanded) .cd-sidebar-item {
    position: relative;
}

.cd-sidebar:not(.expanded) .cd-sidebar-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface2);
    color: var(--text);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: var(--shadow);
    border: 1px solid var(--hair);
    z-index: 300;
}

.cd-sidebar:not(.expanded) .cd-sidebar-item:hover::after {
    opacity: 1;
}

.cd-sidebar-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity .25s, width .25s;
}

.cd-sidebar.expanded .cd-sidebar-label {
    opacity: 1;
    width: auto;
}

.cd-sidebar.expanded .cd-sidebar-item {
    justify-content: flex-start;
}

/* Content offset for sidebar */
.cd-root {
    margin-right: 56px;
    transition: margin-right 0.3s cubic-bezier(.4,0,.2,1);
}

.cd-sidebar.expanded ~ .cd-root {
    margin-right: 210px;
}

/* Responsive: hide sidebar on very small screens, use bottom bar instead */
@media (max-width: 768px) {
    .cd-sidebar {
        position: fixed;
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        height: 52px;
        width: 100% !important;
        flex-direction: row;
        border-left: none;
        border-top: 1px solid var(--hair);
        overflow-x: auto;
        overflow-y: hidden;
    }
    .cd-sidebar-toggle { display: none; }
    .cd-sidebar-nav {
        flex-direction: row;
        gap: 0;
        padding: 0;
        width: 100%;
        justify-content: space-around;
    }
    .cd-sidebar-item {
        flex-direction: column;
        gap: 2px;
        padding: 6px 4px;
        font-size: 10px;
        border-right: none;
        border-bottom: 3px solid transparent;
        flex: 1;
        justify-content: center;
        text-align: center;
    }
    .cd-sidebar-item.active {
        border-bottom-color: var(--gold);
        border-right-color: transparent;
    }
    .cd-sidebar-label {
        opacity: 1;
        width: auto;
        font-size: 9px;
    }
    .cd-sidebar-icon { font-size: 16px; }
    .cd-root {
        margin-right: 0;
        margin-bottom: 56px;
    }
    .cd-sidebar.expanded ~ .cd-root {
        margin-right: 0;
    }
}

.cd-sidebar-tooltip-float {
    position: fixed;
    background: var(--surface2);
    color: var(--text);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: var(--shadow);
    border: 1px solid var(--hair);
    z-index: 9999;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity 0.15s ease;
}
.cd-sidebar-tooltip-float.visible {
    opacity: 1;
}

/* ============================================================
   DASHBOARD LAYOUT — چیدمان جدید داشبورد پیشرفت
   ============================================================ */
.cd-dash-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.cd-dash-gauges {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 200px;
    flex-shrink: 0;
}

.cd-dash-gauges .cd-gauge-card {
    padding: 10px 8px 12px;
}

.cd-dash-gauges .cd-gauge-title {
    font-size: 11px;
    margin-bottom: 4px;
}

.cd-dash-gauges .cd-gauge-svg-wrap {
    max-width: 140px;
}

.cd-dash-gauges .cd-gauge-center-value {
    font-size: 16px;
}

.cd-dash-gauges .cd-gauge-sub {
    font-size: 10px;
}

.cd-dash-gauges .cd-gauge-legend {
    font-size: 9px;
}

.cd-dash-gauges .cd-ring-svg-wrap {
    width: 100px;
}

.cd-dash-gauges .cd-eta-card .cd-eta-icon {
    font-size: 28px;
    margin: 6px 0 4px;
}

.cd-dash-chart {
    flex: 1;
    min-width: 0;
}

@media (max-width: 900px) {
    .cd-dash-layout {
        flex-direction: column-reverse;
    }
    .cd-dash-gauges {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }
    .cd-dash-gauges .cd-gauge-card {
        flex: 1 0 calc(50% - 10px);
        min-width: 150px;
    }
}

@media (max-width: 480px) {
    .cd-dash-gauges .cd-gauge-card {
        flex: 1 0 100%;
    }
}

/* ============================================================
   cd-root — ریشه (تعدیل برای سایدبار)
   ============================================================ */
.cd-root {
    direction: rtl;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--bg);
    background-image: var(--glow);
    background-repeat: no-repeat;
    color: var(--text);
    padding: 28px 20px 60px;
    min-height: 100%;
    line-height: 1.7;
}

.cd-num {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    direction: ltr;
    display: inline-block;
}

/* وقتی کلاس cd-num مستقیماً روی <td> جدول اعمال می‌شود (مثلاً در جدول
   مدیریت پرتفوی و دفتر ثبت)، همان قانون display:inline-block بالا باعث
   می‌شد سلول از حالت table-cell خارج شود و کل چینش ستون‌های جدول به‌هم
   بریزد. اینجا آن را برای سلول‌های جدول به حالت درست برمی‌گردانیم. */
td.cd-num,
th.cd-num {
    display: table-cell;
}

.cd-wrap {
    max-width: 1300px;
    margin: 0 auto;
}

/* ---- Header ---- */
.cd-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 1px solid var(--hair);
    padding-bottom: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
}

/* خط طلایی ظریف زیر هدر — حس لوکس و خط افق */
.cd-header::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 18%;
    right: 18%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: .5;
    pointer-events: none;
}

.cd-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: .2px;
}

.cd-title small {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
    margin-top: 4px;
}

.cd-badge {
    font-size: 11px;
    color: var(--gold);
    border: 1px solid var(--gold-dim);
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: .3px;
}

.cd-header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.cd-header-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cd-theme-toggle {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border-radius: 50%;
    background: var(--surface2);
    border: 1px solid var(--hair);
    cursor: pointer;
    transition: background .2s;
}

.cd-theme-toggle:hover {
    background: var(--hair);
}

/* ---- Summary Strip ---- */
.cd-summary {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    align-items: center;
    position: relative;
    background: linear-gradient(135deg,
            color-mix(in srgb, var(--surface), transparent 30%) 0%,
            color-mix(in srgb, var(--surface2), transparent 45%) 100%);
    border: 1px solid color-mix(in srgb, var(--text), transparent 85%);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 22px;
    box-shadow:
        0 8px 24px rgba(0, 0, 0, .28),
        0 2px 10px rgba(0, 0, 0, .18),
        inset 0 1px 0 rgba(255, 255, 255, .07),
        inset 0 0 0 1px rgba(255, 255, 255, .02);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: 9px 4px;
}

.cd-cell {
    background: transparent;
    padding: 3px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1px;
    position: relative;
}

.cd-cell:not(:first-child)::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 1px;
    background: color-mix(in srgb, var(--text), transparent 88%);
}

.cd-cell .lbl {
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 0;
    white-space: nowrap;
}

.cd-cell .val {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.15;
}

.cd-cell .sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.cd-cell .cd-capital-quick {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
    margin-top: 3px;
}

.cd-cell .cd-capital-quick .cd-btn.sm {
    flex: 0 0 auto;
    width: 21px;
    height: 21px;
    padding: 0;
    font-size: 11px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: none;
}

.cd-cell .cd-capital-quick #cd-capital-open-add {
    background: color-mix(in srgb, var(--teal), var(--surface) 78%);
    color: var(--teal);
    border: 1px solid color-mix(in srgb, var(--teal), transparent 55%);
}

.cd-cell .cd-capital-quick #cd-capital-open-add:hover {
    background: color-mix(in srgb, var(--teal), var(--surface) 55%);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal), transparent 82%);
}

.cd-cell .cd-capital-quick #cd-capital-open-withdraw {
    background: color-mix(in srgb, var(--red), var(--surface) 78%);
    color: var(--red);
    border: 1px solid color-mix(in srgb, var(--red), transparent 55%);
}

.cd-cell .cd-capital-quick #cd-capital-open-withdraw:hover {
    background: color-mix(in srgb, var(--red), var(--surface) 55%);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--red), transparent 82%);
}

.cd-cell.cd-target-cell .cd-target-label {
    font-size: 12px;
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
}

.cd-cell.cd-target-cell .cd-target-label .cd-num {
    color: var(--gold);
    font-weight: 700;
}

.cd-cell.cd-target-cell .cd-target-quick {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
    margin-top: 3px;
}

.cd-cell.cd-target-cell .cd-target-quick .cd-btn.sm {
    flex: 0 0 auto;
    width: 21px;
    height: 21px;
    padding: 0;
    font-size: 11px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: none;
}

.cd-cell.cd-target-cell .cd-target-quick #cd-target-open-edit {
    background: color-mix(in srgb, var(--teal), var(--surface) 78%);
    color: var(--teal);
    border: 1px solid color-mix(in srgb, var(--teal), transparent 55%);
}

.cd-cell.cd-target-cell .cd-target-quick #cd-target-open-edit:hover {
    background: color-mix(in srgb, var(--teal), var(--surface) 55%);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal), transparent 82%);
}

.cd-cell.cd-target-cell .cd-target-quick #cd-target-open-minus {
    background: color-mix(in srgb, var(--red), var(--surface) 78%);
    color: var(--red);
    border: 1px solid color-mix(in srgb, var(--red), transparent 55%);
}

.cd-cell.cd-target-cell .cd-target-quick #cd-target-open-minus:hover {
    background: color-mix(in srgb, var(--red), var(--surface) 55%);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--red), transparent 82%);
}

.cd-pf-addrow td {
    background: var(--surface);
}

.cd-pf-addrow .cd-btn {
    background: var(--teal);
    color: #fff;
}

.cd-pf-addrow .cd-btn:hover {
    background: #6ea88b;
}

.pos {
    color: var(--teal);
}

.neg {
    color: var(--red);
}

@media (max-width: 640px) {
    .cd-summary {
        grid-template-columns: repeat(2, 1fr);
        border-radius: 26px;
        row-gap: 10px;
        padding: 12px 6px;
    }

    .cd-cell:nth-child(3)::before,
    .cd-cell:nth-child(5)::before {
        display: none;
    }

    .cd-cell {
        padding: 3px 10px;
    }
}

/* ---- Sections ---- */
.cd-section {
    margin-bottom: 28px;
}

.cd-sec-title {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.cd-sec-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--hair);
}

/* ---- Setup / Forms ---- */
.cd-setup {
    background: var(--surface);
    border: none;
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.cd-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.cd-field {
    flex: 1;
    min-width: 140px;
}

.cd-field label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.cd-field input,
.cd-field select,
.cd-field textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid color-mix(in srgb, var(--hair), transparent 35%);
    color: var(--text);
    border-radius: 7px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .12);
}

.cd-field input:focus,
.cd-field select:focus,
.cd-field textarea:focus {
    outline: 1px solid var(--gold-dim);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .08), 0 0 0 3px color-mix(in srgb, var(--gold-dim), transparent 78%);
}

/* ---- Buttons ---- */
.cd-btn {
    --btn-bg: var(--gold);
    --btn-txt: #14170f;
    background: var(--btn-bg);
    background-image: linear-gradient(135deg,
        color-mix(in srgb, var(--btn-bg), #ffffff 24%) 0%,
        var(--btn-bg) 50%,
        color-mix(in srgb, var(--btn-bg), #000000 15%) 100%);
    color: var(--btn-txt);
    border: none;
    border-radius: 7px;
    padding: 11px 22px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .22);
    transition: box-shadow .2s, transform .1s, filter .2s;
}

.cd-btn:hover {
    filter: brightness(1.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .26), inset 0 1px 0 rgba(255, 255, 255, .25);
    transform: translateY(-1px);
}

.cd-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .18);
}

.cd-btn.green {
    --btn-bg: var(--teal);
    --btn-txt: #ffffff;
}

.cd-btn.red {
    --btn-bg: var(--red);
    --btn-txt: #ffffff;
}

.cd-btn.ghost {
    background: transparent;
    border: 1px solid var(--hair);
    color: var(--muted);
}

.cd-btn.ghost:hover {
    color: var(--text);
    border-color: var(--muted);
}

.cd-btn.sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* ---- Tags ---- */
.cd-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cd-tag {
    flex: 1;
    text-align: center;
    padding: 10px;
    border: 1px solid var(--hair);
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    color: var(--muted);
    background: var(--surface2);
    min-width: 80px;
    transition: all .2s;
}

.cd-tag.active-plan {
    border-color: var(--teal);
    color: var(--teal);
    background: rgba(34, 195, 143, .12);
}

.cd-tag.active-emo {
    border-color: var(--red);
    color: var(--red);
    background: rgba(239, 83, 80, .12);
}

.cd-tag.active-pos {
    border-color: var(--teal);
    color: var(--teal);
    background: rgba(34, 195, 143, .12);
}

.cd-tag.active-neg {
    border-color: var(--red);
    color: var(--red);
    background: rgba(239, 83, 80, .12);
}

.cd-tag.active-neutral {
    border-color: var(--muted);
    color: var(--muted);
    background: rgba(147, 163, 194, .12);
}

/* ---- Alerts ---- */
.cd-alert {
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    margin-top: 14px;
    border: 1px solid var(--red);
    color: var(--red);
    background: rgba(239, 83, 80, .08);
}

.cd-alert.good {
    border-color: var(--teal);
    color: var(--teal);
    background: rgba(34, 195, 143, .08);
}

/* ---- Chart Card ---- */
.cd-chartcard {
    background: var(--surface);
    border: none;
    border-radius: 10px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.cd-chart-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.cd-legend {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--muted);
    flex-wrap: wrap;
    margin-bottom: 0;
}

.cd-chart-range-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface2);
    border: 1px solid var(--hair);
    border-radius: 8px;
    padding: 3px;
}

.cd-chart-range-btn,
.cd-candle-range-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
    box-shadow: none;
    white-space: nowrap;
}

.cd-chart-range-btn:hover,
.cd-candle-range-btn:hover {
    color: var(--text);
}

.cd-chart-range-btn.active,
.cd-candle-range-btn.active {
    background: var(--gold);
    color: #14170f;
}

@media (max-width: 640px) {
    .cd-chart-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .cd-chart-range-tabs {
        width: 100%;
        justify-content: space-between;
    }

    .cd-chart-range-btn,
    .cd-candle-range-btn {
        flex: 1;
        text-align: center;
        padding: 6px 4px;
    }
}

.cd-chart-wrap {
    position: relative;
    width: 100%;
    height: 480px;
}

.cd-chart-wrap.cd-magnifier-active {
    cursor: none;
}

@media (max-width: 640px) {
    .cd-chart-wrap {
        height: 360px;
    }
}

/* ---- دکمه ذره‌بین ---- */
.cd-chart-zoom-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--surface2);
    border: 1px solid var(--hair);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 8;
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .15s ease;
    padding: 0;
}

.cd-chart-zoom-btn:hover {
    color: var(--gold);
    border-color: var(--gold-dim);
    transform: scale(1.08);
}

.cd-chart-zoom-btn.active {
    background: var(--gold);
    color: #14170f;
    border-color: var(--gold);
}

/* ---- لنز بزرگ‌نمایی ---- */
.cd-chart-lens {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .55), inset 0 0 22px rgba(0, 0, 0, .25);
    pointer-events: none;
    overflow: hidden;
    background: var(--surface);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    transition: opacity .2s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1), left .05s linear, top .05s linear;
    z-index: 7;
}

.cd-chart-lens.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.cd-chart-lens img {
    position: absolute;
    top: 0;
    left: 0;
    transition: transform .05s linear;
    pointer-events: none;
}

@media (max-width: 640px) {
    .cd-chart-lens {
        width: 130px;
        height: 130px;
    }
}

.cd-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    display: inline-block;
}

/* ---- Ledger ---- */
.cd-ledger {
    background: var(--paper);
    color: #28241c;
    border-radius: 10px;
    overflow: hidden;
    border: none;
    box-shadow: var(--shadow);
}

.cd-ledger table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.cd-ledger th {
    text-align: right;
    padding: 10px 12px;
    font-size: 11px;
    color: #6b6250;
    border-bottom: 1px solid var(--paper-line);
    font-weight: 600;
}

.cd-ledger td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--paper-line);
}

/* ستون یادداشت را محدودتر کن تا جا برای ستون‌های سمت راست باز شود و سرریز نکنند */
.cd-ledger th:last-child,
.cd-ledger td:last-child {
    width: 65%;
    max-width: 65%;
    white-space: normal;
    word-break: break-word;
}

.cd-ledger tr:last-child td {
    border-bottom: none;
}

.cd-ledger .empty {
    padding: 26px;
    text-align: center;
    color: #8a806a;
    font-size: 13px;
}

/* ---- Tag pills (inside ledger) ---- */
.tag-pill {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
}

.tag-pill.plan {
    background: #d7f0e4;
    color: #0f6b47;
}

.tag-pill.emo {
    background: #fbe0dc;
    color: #a5342a;
}

.tag-pill.pos {
    background: #d7f0e4;
    color: #0f6b47;
}

.tag-pill.neg {
    background: #fbe0dc;
    color: #a5342a;
}

.tag-pill.neutral {
    background: #e0e0e0;
    color: #555;
}

.tag-pill.pos-mild {
    background: #e6f5ec;
    color: #1f7a54;
}

.tag-pill.neg-mild {
    background: #f7e6d3;
    color: #9a5a12;
}

/* ===== Range Slider برای تأثیر خبر ===== */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--red), var(--muted) 50%, var(--teal));
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gold);
    border: 2px solid #14170f;
    cursor: pointer;
    transition: 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gold);
    border: 2px solid #14170f;
    cursor: pointer;
}

/* ===== Portfolio ===== */
.cd-pf-controls {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
    background: var(--surface);
    border: none;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}

.cd-pf-controls .cd-field {
    min-width: 110px;
    flex: 0 0 auto;
}

.cd-pf-add {
    background: var(--surface);
    border: 1px dashed var(--hair);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.cd-pf-add-grid {
    display: grid;
    grid-template-columns: 1.2fr .8fr 1fr .7fr .7fr;
    gap: 10px;
    align-items: end;
}

.cd-pf-add-grid .cd-field {
    min-width: 0;
}

@media (max-width: 760px) {
    .cd-pf-add-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.cd-pf-summary {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    align-items: center;
    position: relative;
    background: linear-gradient(135deg,
            color-mix(in srgb, var(--surface), transparent 30%) 0%,
            color-mix(in srgb, var(--surface2), transparent 45%) 100%);
    border: 1px solid color-mix(in srgb, var(--text), transparent 85%);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow:
        0 6px 18px rgba(0, 0, 0, .24),
        0 2px 8px rgba(0, 0, 0, .16),
        inset 0 1px 0 rgba(255, 255, 255, .06);
    backdrop-filter: blur(18px) saturate(170%);
    -webkit-backdrop-filter: blur(18px) saturate(170%);
    padding: 14px 4px;
}

:root[data-theme="light"] .cd-pf-summary {
    background: linear-gradient(135deg, color-mix(in srgb, #ffffff, transparent 25%) 0%, color-mix(in srgb, #eaf1fb, transparent 35%) 100%);
    border-color: rgba(90, 100, 120, 0.18);
    box-shadow: 0 6px 16px rgba(30, 64, 175, .09), 0 2px 8px rgba(30, 64, 175, .05), inset 0 1px 0 rgba(255, 255, 255, .6);
}

@media (max-width: 640px) {
    .cd-pf-summary {
        grid-template-columns: repeat(2, 1fr);
        border-radius: 26px;
        row-gap: 10px;
        padding: 14px 6px;
    }

    .cd-pf-summary .cd-cell:nth-child(3)::before {
        display: none;
    }
}

.cd-pf-table-wrap {
    background: var(--surface);
    border: none;
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: var(--shadow);
}

table.cd-pf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    min-width: 760px;
    color: var(--text);
}

table.cd-pf-table th {
    text-align: right;
    padding: 10px 8px;
    font-size: 11px;
    color: var(--muted);
    border-bottom: 1px solid var(--hair);
    font-weight: 600;
    white-space: nowrap;
}

table.cd-pf-table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--hair);
    vertical-align: middle;
    white-space: normal;
    word-break: break-word;
    text-align: right;
}

table.cd-pf-table td.cd-num {
    text-align: right;
}

table.cd-pf-table tr:last-child td {
    border-bottom: none;
}

table.cd-pf-table .col-symbol {
    width: 10%;
}

table.cd-pf-table .col-qty {
    width: 8%;
}

table.cd-pf-table .col-buy {
    width: 10%;
}

table.cd-pf-table .col-price {
    width: 12%;
}

table.cd-pf-table .col-pl {
    width: 11%;
}

table.cd-pf-table .col-plpct {
    width: 8%;
}

table.cd-pf-table .col-sl {
    width: 12%;
}

table.cd-pf-table .col-tp {
    width: 12%;
}

table.cd-pf-table .col-status {
    width: 12%;
}

table.cd-pf-table .col-del {
    width: 5%;
}

table.cd-pf-table input.cd-pf-inline {
    width: 100%;
    max-width: 110px;
    background: var(--surface2);
    border: 1px solid var(--hair);
    color: var(--text);
    border-radius: 5px;
    padding: 4px 6px;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 12px;
    direction: ltr;
    box-sizing: border-box;
}

table.cd-pf-table input.cd-pf-inline.small {
    width: auto;
    max-width: 60px;
    background: var(--surface2);
    color: var(--text);
}

table.cd-pf-table input.cd-pf-inline:focus {
    outline: 1px solid var(--gold-dim);
}

.cd-sl-cell,
.cd-tp-cell {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.cd-sl-cell .cd-num,
.cd-tp-cell .cd-num {
    min-width: 40px;
}

.cd-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    color: var(--text);
}

.cd-users-table th {
    text-align: right;
    padding: 10px 8px;
    font-size: 11px;
    color: var(--muted);
    border-bottom: 1px solid var(--hair);
    font-weight: 600;
    white-space: nowrap;
}

.cd-users-table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--hair);
    vertical-align: middle;
    text-align: right;
}

.cd-users-table td.cd-num {
    text-align: right;
}

.cd-users-table tr:last-child td {
    border-bottom: none;
}

.cd-users-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.status-pill {
    font-size: 11px;
    padding: 4px 9px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
}

.status-hold {
    background: rgba(139, 147, 161, .15);
    color: var(--muted);
}

.status-warn-sl {
    background: rgba(239, 83, 80, .15);
    color: var(--red);
}

.status-warn-tp {
    background: rgba(227, 181, 60, .15);
    color: var(--gold);
}

.status-sell-sl {
    background: var(--red);
    color: #fff;
}

.status-sell-tp {
    background: var(--teal);
    color: #fff;
}

.cd-pf-del {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 15px;
}

.cd-pf-del:hover {
    color: var(--red);
}

/* ===== دکمه‌ی افزایش سرمایه در جدول پرتفوی ===== */
.cd-pf-capital-btn {
    background: color-mix(in srgb, var(--gold), var(--surface) 70%);
    color: var(--gold);
    border: 1px solid color-mix(in srgb, var(--gold), transparent 50%);
    border-radius: 5px;
    width: 30px;
    height: 28px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
    transition: background .2s, box-shadow .2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cd-pf-capital-btn:hover {
    background: color-mix(in srgb, var(--gold), var(--surface) 50%);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold), transparent 82%);
}

/* ===== ردیف حق تقدم و نشان آن ===== */
.cd-pf-rights-row td:first-child {
    padding-inline-start: 26px;
}

.cd-pf-rights-row {
    background: color-mix(in srgb, var(--surface2), transparent 60%);
}

.cd-pf-rights-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    color: var(--orange);
    border: 1px solid color-mix(in srgb, var(--orange), transparent 55%);
    background: color-mix(in srgb, var(--orange), var(--surface) 86%);
    border-radius: 4px;
    padding: 1px 6px;
    margin-inline-start: 5px;
    vertical-align: middle;
}

/* ===== مودال افزایش سرمایه ===== */
.cd-ci-current {
    margin-bottom: 10px;
}

.cd-ci-est-box {
    background: var(--surface2);
    border-right: 3px solid var(--gold);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.9;
    color: var(--text);
    margin: 10px 0;
}

.cd-ci-est-box b {
    color: var(--gold);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.cd-pf-empty {
    padding: 26px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

/* ---- Gauge ---- */
.cd-discipline-box {
    background: var(--surface);
    border: none;
    border-radius: 10px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.cd-discipline-box .cd-analysis {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 14px 0 0;
    margin-top: 14px;
    border-top: 1px solid var(--hair);
}

.cd-gauge-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cd-gauge-bar {
    flex: 1;
    height: 10px;
    background: var(--surface2);
    border-radius: 6px;
    overflow: hidden;
}

.cd-gauge-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--red), var(--gold), var(--teal));
}

.cd-gauge-num {
    font-size: 22px;
    font-weight: 800;
    min-width: 60px;
    text-align: left;
}

/* ---- Analysis Box ---- */
.cd-analysis {
    background: var(--surface);
    border: none;
    border-radius: 10px;
    padding: 18px;
    box-shadow: var(--shadow);
}

#cd-pf-analysis,
.cd-discipline-box .cd-analysis {
    font-size: 14px;
}

.cd-analysis ul {
    margin: 0;
    padding-inline-start: 20px;
}

.cd-analysis li {
    margin-bottom: 8px;
}

.cd-analysis .warn {
    color: var(--red);
}

.cd-analysis .good {
    color: var(--teal);
}

.cd-analysis .neutral {
    color: var(--muted);
}

/* ---- Footnotes, Reset ---- */
.cd-footnote {
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
}

.cd-reset {
    font-size: 11px;
    color: var(--muted);
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
}

/* ---- Analytics Grid (3 columns) ---- */
.cd-analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 900px) {
    .cd-analytics-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- کادر «تحلیل تکنیکال شاخص‌ها» بالا، کادر «تابلوخوانی و جریان
   سفارشات» پایین (به‌جای چیدمان دو ستونه‌ی قبلی) ---- */
.cd-daily-analysis-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* ---- چیدمان دو ستونه‌ی «شاخص کل» و «شاخص هم‌وزن» داخل کادر تحلیل
   تکنیکال، با یک خط جداکننده‌ی عمودی بین آن‌ها ---- */
.cd-tech-columns {
    display: flex;
    align-items: stretch;
    gap: 18px;
}

.cd-tech-col {
    flex: 1 1 0;
    min-width: 0;
}

.cd-tech-col + .cd-tech-col {
    border-inline-start: 1px solid var(--hair);
    padding-inline-start: 18px;
}

@media (max-width: 640px) {
    .cd-tech-columns {
        flex-direction: column;
    }

    .cd-tech-col + .cd-tech-col {
        border-inline-start: none;
        padding-inline-start: 0;
        border-top: 1px solid var(--hair);
        padding-top: 10px;
        margin-top: 6px;
    }
}

.cd-news-ticker {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 6px 0;
}

.cd-news-ticker-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--gold);
    white-space: nowrap;
}

.cd-news-ticker-track {
    flex: 1;
    overflow: hidden;
    height: 20px;
    position: relative;
}

.cd-news-ticker-text {
    display: block;
    font-size: 12px;
    color: var(--muted);
    line-height: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.cd-news-ticker-text.cd-fade-out {
    opacity: 0;
}

.cd-analytics-card {
    background: var(--surface);
    border: none;
    border-radius: 10px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    box-shadow: var(--shadow);
}

.cd-analytics-card .card-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gold);
}

.cd-analytics-card .card-title .icon {
    font-size: 18px;
}

/* ---- Indicator Grid (inside analytics cards) ---- */
.cd-indicator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 14px;
    font-size: 13px;
}

.cd-indicator-grid .ind-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
}

.cd-indicator-grid .ind-item .ind-label {
    color: var(--muted);
}

.cd-indicator-grid .ind-item .ind-val {
    font-weight: 600;
    font-family: 'Vazirmatn', sans-serif;
    direction: ltr;
}

/* ---- Recommendation Box ---- */
.cd-rec-box {
    background: var(--surface2);
    border-radius: 8px;
    padding: 14px 16px;
    margin-top: 12px;
    border-right: 3px solid var(--gold);
}

.cd-rec-box .rec-title {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}

.cd-rec-box .rec-text {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.6;
}

/* ---- Final Recommendation ---- */
.cd-final-rec {
    background: var(--surface);
    border: 2px solid var(--gold-dim);
    border-radius: 12px;
    padding: 20px 24px;
    margin-top: 12px;
}

.cd-final-rec .rec-label {
    font-size: 17px;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 0.3px;
    text-shadow: 0 1px 20px rgba(255, 200, 90, 0.30);
    margin-bottom: 10px;
}

.rec-label {
    font-weight: bolder ;
    text-align: center;
}

.cd-final-rec-details {
    margin-top: 10px;
    border-top: 1px solid var(--hair);
    padding-top: 6px;
}

.cd-final-rec-details-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
}

.cd-final-rec-details-head:hover {
    color: var(--gold);
}

.cd-final-rec-details-arrow {
    display: inline-block;
    font-size: 10px;
    transition: transform 0.2s ease;
    color: var(--gold);
}

.cd-final-rec-details-head.open .cd-final-rec-details-arrow {
    transform: rotate(180deg);
}

.cd-final-rec-details-body {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.95;
    margin-top: 6px;
}

.cd-final-rec .rec-main {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.8;
}

.cd-final-rec .rec-main .highlight {
    color: var(--gold);
}

/* ---- Inline Forms (inside cards) ---- */
.cd-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
}

.cd-inline-form .cd-field {
    flex: 1;
    min-width: 100px;
}

.cd-inline-form .cd-field label {
    font-size: 11px;
}

.cd-inline-form .cd-field input,
.cd-inline-form .cd-field select {
    padding: 6px 10px;
    font-size: 13px;
}

/* ---- News & Tech history scrollable lists ---- */
.cd-news-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    font-size: 12px;
}

.cd-news-list .news-item {
    display: flex;
    align-items: flex-start;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
    gap: 6px;
}

.cd-news-list .news-item .news-text-flow {
    flex: 1;
    line-height: 1.9;
}

.cd-news-list .news-item .news-date-inline {
    color: var(--muted);
    font-size: 10.5px;
    margin: 0 3px;
    white-space: nowrap;
}

.cd-news-list .news-item .news-impact-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 3px;
    border-radius: 50%;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    direction: ltr;
    vertical-align: middle;
}

.cd-news-list .news-item .cd-news-del {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: var(--red);
    color: #fff;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 3px;
}

.cd-tech-history {
    max-height: 140px;
    overflow-y: auto;
    font-size: 12px;
}

.cd-tech-history .th-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
    gap: 6px;
}

.cd-tech-history .th-item .th-date {
    color: var(--muted);
    min-width: 80px;
}

.cd-tech-history .th-item .th-close {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    direction: ltr;
}

/* Scrollbar styling */
.cd-news-list::-webkit-scrollbar,
.cd-tech-history::-webkit-scrollbar {
    width: 4px;
}

.cd-news-list::-webkit-scrollbar-track,
.cd-tech-history::-webkit-scrollbar-track {
    background: var(--surface2);
}

.cd-news-list::-webkit-scrollbar-thumb,
.cd-tech-history::-webkit-scrollbar-thumb {
    background: var(--gold-dim);
    border-radius: 4px;
}

/* ---- Dividers / Utilities ---- */
.cd-divider {
    border: none;
    border-top: 1px solid var(--hair);
    margin: 18px 0;
}

.cd-flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* ===== اضافه‌شده: استایل تب‌ها ===== */
.cd-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--hair);
    margin-bottom: 24px;
}

.cd-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.cd-tab:hover {
    color: var(--text);
}

.cd-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.cd-tab-content {
    display: none;
    padding-top: 4px;
}

.cd-tab-content.active {
    display: block;
}

@media (max-width: 480px) {
    .cd-tabs {
        flex-wrap: wrap;
        gap: 4px;
    }

    .cd-tab {
        flex: 1 0 auto;
        text-align: center;
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* ===== مودال ورود/ثبت‌نام ===== */
/* ---------- بازنشانی پایه ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---------- متغیرها (هماهنگ با styles.css) ---------- */
:root {
    --bg: #0a0e18;
    --surface: #121a2c;
    --surface2: #1a2540;
    --paper: #f1ead8;
    --paper-line: #ded4ba;
    --gold: #e3b53c;
    --gold-dim: #b3872a;
    --teal: #22c38f;
    --red: #ef5350;
    --text: #f5f7fc;
    --muted: #93a3c2;
    --hair: #223154;
    --green: #22c38f;
    --orange: #f0a13c;
    --blue: #4c8dfa;
    --overlay: rgba(6, 10, 18, 0.88);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .30), 0 3px 8px rgba(0, 0, 0, .22);
    --shadow: 0 2px 6px rgba(0, 0, 0, .28), 0 8px 20px rgba(0, 0, 0, .20);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, .38), 0 24px 52px rgba(0, 0, 0, .24);
}

/* ---------- استایل مودال (کاملاً مستقل) ---------- */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: fadeIn 0.3s ease;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    direction: rtl;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.auth-modal {
    background: var(--surface, #1a212b);
    border: none;
    border-radius: 16px;
    padding: 32px 30px 26px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    color: var(--text, #ece5d6);
}

.auth-header {
    text-align: center;
    margin-bottom: 20px;
}

.auth-brand {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: var(--gold, #c9a227);
}

.auth-sub {
    display: block;
    font-size: 13px;
    color: var(--muted, #8b93a1);
    margin-top: 4px;
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--hair, #2a3340);
    margin-bottom: 22px;
}

.auth-tab {
    flex: 1;
    padding: 8px 0;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--muted, #8b93a1);
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    margin-bottom: -2px;
}

.auth-tab.active {
    color: var(--gold, #c9a227);
    border-bottom-color: var(--gold, #c9a227);
}

.auth-tab:hover {
    color: var(--text, #ece5d6);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.auth-form.active {
    display: flex;
}

.auth-field label {
    display: block;
    font-size: 12px;
    color: var(--muted, #8b93a1);
    margin-bottom: 4px;
}

.auth-field input {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface2, #212a35);
    border: 1px solid color-mix(in srgb, var(--hair, #2a3340), transparent 35%);
    border-radius: 8px;
    color: var(--text, #ece5d6);
    font-family: inherit;
    font-size: 14px;
    transition: border 0.2s, box-shadow 0.2s;
    direction: rtl;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .12);
}

.auth-field input:focus {
    outline: none;
    border-color: var(--gold-dim, #8a7326);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .08), 0 0 0 3px color-mix(in srgb, var(--gold-dim, #8a7326), transparent 78%);
}

.auth-field input::placeholder {
    color: var(--muted, #8b93a1);
    opacity: 0.6;
}

.auth-btn {
    background: var(--gold, #c9a227);
    background-image: linear-gradient(135deg,
        color-mix(in srgb, var(--gold, #c9a227), #ffffff 24%) 0%,
        var(--gold, #c9a227) 50%,
        color-mix(in srgb, var(--gold, #c9a227), #000000 15%) 100%);
    color: #14170f;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.1s, filter 0.2s;
    font-family: inherit;
    margin-top: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.auth-btn:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .26), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.auth-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .18);
}

.auth-msg {
    font-size: 13px;
    text-align: center;
    min-height: 22px;
    color: var(--red, #b5533c);
}

.auth-msg.success {
    color: var(--teal, #5b9279);
}

.auth-footer {
    margin-top: 18px;
    text-align: center;
    font-size: 13px;
    color: var(--muted, #8b93a1);
}

.auth-link {
    background: none;
    border: none;
    color: var(--gold, #c9a227);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
}

.auth-link:hover {
    text-decoration: underline;
}

/* ---------- استایل کاربر در هدر (در صورت نیاز) ---------- */
.cd-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cd-user-name {
    font-size: 13px;
    color: var(--text, #ece5d6);
    font-weight: 500;
}

.cd-btn.ghost.sm {
    padding: 4px 12px;
    font-size: 11px;
    background: transparent;
    border: 1px solid var(--hair, #2a3340);
    color: var(--muted, #8b93a1);
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
}

.cd-btn.ghost.sm:hover {
    color: var(--text, #ece5d6);
    border-color: var(--muted, #8b93a1);
}

/* ===== Modal (Sell) ===== */
.cd-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    direction: rtl;
}

.cd-modal {
    background: var(--surface);
    border: none;
    border-radius: 14px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.cd-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--hair);
    font-weight: 700;
    font-size: 15px;
    color: var(--gold);
}

.cd-modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}

.cd-modal-close:hover { color: var(--red); }

.cd-modal-body {
    padding: 20px;
}

#cd-add-symbol-modal .cd-modal {
    max-width: 780px;
}

.cd-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid var(--hair);
}

/* ===== Sell button in portfolio table ===== */
.cd-pf-sell-btn {
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .2s;
    white-space: nowrap;
}

.cd-pf-sell-btn:hover {
    background: #d06048;
}

.cd-pf-sell-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== Portfolio col-sell width ===== */
table.cd-pf-table .col-sell {
    width: 7%;
}

/* ===== Sales history in portfolio ===== */
.cd-sales-toggle {
    font-size: 11px;
    color: var(--muted);
    cursor: pointer;
    text-decoration: underline;
    background: none;
    border: none;
    font-family: inherit;
    margin-top: 6px;
}

.cd-sales-toggle:hover {
    color: var(--text);
}

.cd-sales-history {
    background: var(--surface);
    border: none;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 12px;
    box-shadow: var(--shadow-sm);
}

.cd-sales-history .sale-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--hair);
    gap: 6px;
}

.cd-sales-history .sale-item:last-child {
    border-bottom: none;
}

.cd-sales-history .sale-item .sale-symbol {
    font-weight: 600;
    min-width: 50px;
}

.cd-sales-history .sale-item .sale-pnl.pos { color: var(--teal); }
.cd-sales-history .sale-item .sale-pnl.neg { color: var(--red); }

@media (max-width: 480px) {
    .auth-modal {
        padding: 24px 18px 20px;
    }

    .auth-brand {
        font-size: 19px;
    }

    .auth-tab {
        font-size: 12px;
        padding: 6px 0;
    }

    .auth-field input {
        font-size: 13px;
        padding: 8px 10px;
    }

    .auth-btn {
        font-size: 14px;
        padding: 10px;
    }
}

/* ============================================================
   داشبورد پیشرفت — گیج‌های آنالوگ
   ============================================================ */
.cd-progress-dashboard {
    background: var(--surface);
    border-radius: 12px;
    padding: 18px;
    border: none;
    box-shadow: var(--shadow);
}

.cd-gauge-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.cd-gauge-card {
    background: var(--surface2);
    border: none;
    border-radius: 12px;
    padding: 14px 12px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease;
}

.cd-gauge-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.cd-gauge-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 6px;
}

.cd-gauge-svg-wrap {
    width: 100%;
    max-width: 205px;
}

.cd-gauge-svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

/* ===== انیمیشن نرم عقربه‌ها و حلقه‌ها ===== */
/* توجه: transform-origin واقعی هر گیج (بر اساس مرکز صفحه‌ی آنالوگ) هر بار
   در script.js به‌صورت inline تنظیم می‌شود؛ مقادیر زیر فقط پیش‌فرض اولیه‌اند. */
.cd-gauge-needle-grp {
    transform-box: view-box;
    transform-origin: 110px 116px;
    transition: transform .8s cubic-bezier(.34, 1.56, .64, 1);
}

.cd-gauge-marker-grp {
    transform-box: view-box;
    transform-origin: 110px 116px;
    transition: transform .8s ease;
}

.cd-ring-progress {
    transition: stroke-dashoffset .9s ease, stroke .4s ease;
}

.cd-ring-svg-wrap {
    width: 130px;
    max-width: 100%;
    margin: 4px auto;
}

.cd-ring-svg {
    width: 100%;
    height: auto;
}

.cd-gauge-center-value {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: var(--gold);
    margin-top: 4px;
    direction: ltr;
}

.cd-gauge-center-value.pos { color: var(--teal); }
.cd-gauge-center-value.neg { color: var(--red); }
.cd-gauge-center-value.neutral { color: var(--muted); }

.cd-gauge-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
    line-height: 1.6;
}

.cd-gauge-legend {
    font-size: 10px;
    color: var(--muted);
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.cd-gauge-legend .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 4px;
}

.cd-eta-card .cd-eta-icon {
    font-size: 40px;
    margin: 10px 0 6px;
}

/* ============================================================
   ادغام محتوای «گذر زمان» و «تخمین رسیدن به هدف» در گیج‌های
   «پیشرفت کلی» و «سرعت روزانه» — فقط متن زیر گیج تغییر می‌کند
   ============================================================ */
.cd-gauge-sub-merged {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.cd-gauge-subline {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 3px;
    font-size: 10.5px;
    line-height: 1.5;
    color: var(--muted);
    max-width: 100%;
}

.cd-gauge-subline b {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    color: var(--text);
    font-weight: 700;
}

.cd-gauge-subline .dot {
    flex-shrink: 0;
}

.cd-gauge-subline-note {
    color: var(--muted);
    font-size: 9.5px;
}

.cd-gauge-subline-separated {
    position: relative;
    margin-top: 7px;
    padding-top: 7px;
    width: 100%;
}

.cd-gauge-subline-separated::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
    opacity: .6;
}

.cd-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--surface2);
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    font-size: 9px;
    font-style: italic;
    font-weight: 800;
    line-height: 1;
    cursor: help;
    position: relative;
    flex-shrink: 0;
}

.cd-info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface2);
    color: var(--text);
    font-size: 11px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    width: max-content;
    max-width: 220px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--hair);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease;
    z-index: 60;
    direction: rtl;
}

.cd-info-icon:hover::after,
.cd-info-icon:focus::after {
    opacity: 1;
    visibility: visible;
}

/* ============================================================
   دفتر ثبت (منتقل‌شده به داشبورد پیشرفت) — نمایش فقط ۵ ردیف
   اخیر و مشاهده‌ی مابقی از طریق اسکرول عمودی
   ============================================================ */
.cd-ledger-scroll {
    max-height: 248px;
    overflow-y: auto;
    scrollbar-width: auto;
    scrollbar-color: var(--gold-dim) var(--paper-line);
}

.cd-ledger-scroll table {
    width: 100%;
}

.cd-ledger-scroll thead th {
    position: sticky;
    top: 0;
    background: var(--paper);
    z-index: 2;
}

.cd-ledger-scroll::-webkit-scrollbar {
    width: 10px;
}

.cd-ledger-scroll::-webkit-scrollbar-track {
    background: var(--paper-line);
    border-radius: 5px;
}

.cd-ledger-scroll::-webkit-scrollbar-thumb {
    background: var(--gold-dim);
    border-radius: 5px;
    border: 2px solid var(--paper-line);
}

.cd-ledger-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

.cd-progress-alert {
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    background: rgba(239, 83, 80, 0.12);
    border: 1px solid var(--red);
    color: var(--red);
}

.cd-progress-alert.success {
    background: rgba(34, 195, 143, 0.12);
    border-color: var(--teal);
    color: var(--teal);
}

.cd-progress-alert.warning {
    background: rgba(240, 161, 60, 0.14);
    border-color: var(--orange);
    color: var(--orange);
}

@media (max-width: 900px) {
    .cd-gauge-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .cd-gauge-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   نمودار کندل‌استیک شاخص کل (Canvas خالص - بدون کتابخانه خارجی)
   ============================================================ */
#cd-candle-chart {
    display: block;
}

.cd-candle-tooltip {
    position: absolute;
    pointer-events: none;
    background: var(--surface2);
    border: 1px solid var(--gold-dim);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 11.5px;
    color: var(--text);
    white-space: nowrap;
    z-index: 6;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .45);
    min-width: 130px;
}

.cd-candle-tooltip .ct-date {
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 5px;
    display: block;
    font-size: 12px;
}

.cd-candle-tooltip .ct-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 1px 0;
}

.cd-candle-tooltip .ct-row span:first-child {
    color: var(--muted);
}

.cd-candle-tooltip .ct-row span:last-child {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    direction: ltr;
    font-weight: 600;
}

/* ============================================================
   رژیم ساختاری بازار: بنر وضعیت روند + ریبون تاریخچه‌ی رژیم‌ها
   ============================================================ */
.cd-trend-banner {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: var(--surface2);
    border: 1px solid var(--hair);
}

.cd-trend-banner .cd-trend-banner-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cd-trend-banner .cd-trend-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cd-trend-banner .cd-trend-title {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text);
}

.cd-trend-banner .cd-trend-meta {
    font-size: 11.5px;
    color: var(--muted);
}

.cd-trend-banner .cd-trend-power {
    margin-inline-start: auto;
    font-size: 12px;
    font-weight: 700;
}

.cd-trend-banner .cd-trend-signals {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.75;
    border-top: 1px dashed var(--hair);
    padding-top: 5px;
    margin-top: 2px;
}

.cd-trend-banner.bull { border-right: 3px solid var(--teal); }
.cd-trend-banner.bear { border-right: 3px solid var(--red); }
.cd-trend-banner.neutral { border-right: 3px solid var(--muted); }

/* نوار ریبون تاریخچه‌ی رژیم‌ها */
.cd-regime-ribbon {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0 6px;
    border-radius: 4px;
}

.cd-regime-strip {
    display: flex;
    gap: 2px;
    height: 14px;
    overflow: hidden;
    direction: ltr;
}

.cd-regime-strip .r-cell {
    flex: 1 1 0;
    min-width: 2px;
    height: 100%;
    cursor: pointer;
    border-radius: 2px;
}

.cd-regime-strip .r-cell.r-bull { background: var(--teal); }
.cd-regime-strip .r-cell.r-bear { background: var(--red); }
.cd-regime-strip .r-cell.r-neutral { background: var(--muted); opacity: .45; }
.cd-regime-strip .r-cell.r-none { background: var(--hair); }

/* زیرنویس ریبون (راهنمای رنگ‌ها) */
.cd-regime-ribbon-legend {
    display: flex;
    gap: 12px;
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 2px;
    flex-wrap: wrap;
}

.cd-regime-ribbon-legend .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-inline-end: 4px;
    vertical-align: middle;
}

/* ---- سرمایه‌ی اولیه / تغییر سرمایه ---- */
.cd-capital-tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cd-capital-info {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 10px 12px;
    background: var(--surface2);
    border-radius: 8px;
    border: 1px solid var(--gold-dim);
    font-size: 13px;
    color: var(--text);
}

.cd-capital-info b {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 14px;
    color: var(--text);
}

.cd-capital-msg {
    font-size: 12px;
    min-height: 16px;
    padding: 4px 0;
}

.cd-capital-msg.good {
    color: var(--teal);
}

.cd-capital-msg.warn {
    color: var(--red);
}

.cd-capital-history {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cd-capital-change-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: var(--surface2);
    border-radius: 6px;
    font-size: 13px;
}


/* ============================================================
   ۱۰ سهم برتر روز (Top Picks) — کارت‌های امتیازدهی
   ============================================================ */
.cd-tp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.cd-tp-card {
    background: var(--surface);
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cd-tp-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.cd-tp-rank {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
}

.cd-tp-symbol {
    font-size: 15px;
    font-weight: 800;
    color: var(--gold);
}

.cd-tp-name {
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cd-tp-total-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cd-tp-bar-track {
    flex: 1;
    height: 8px;
    border-radius: 5px;
    background: var(--surface2);
    overflow: hidden;
}

.cd-tp-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width .3s ease;
}

.cd-tp-total-num {
    font-size: 16px;
    font-weight: 800;
    min-width: 28px;
    text-align: left;
}

.cd-tp-subscores {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.cd-tp-subchip {
    background: var(--surface2);
    border-radius: 6px;
    padding: 5px 4px;
    text-align: center;
    font-size: 10px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cd-tp-subchip b {
    font-size: 13px;
}

.cd-tp-reasons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.cd-tp-reason-tag {
    font-size: 10.5px;
    color: var(--text);
    background: var(--surface2);
    border: 1px solid var(--hair);
    border-radius: 12px;
    padding: 3px 9px;
}

.cd-tp-foot {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
    border-top: 1px dashed var(--hair);
    padding-top: 8px;
}

/* ============================================================
   تابلوخوانی و جریان سفارشات — نمودارهای میله‌ای افقی مقایسه‌ای
   هر کارد فقط شامل نوار(های) مقایسه‌ای، عنوان کوتاه هر نوار و مقدار
   عددی آن است (بدون سرتیتر طلایی و بدون توضیح متنی معیار/درصد).
   منطق محاسبه‌ی معیار (baseline) و سهم هر آیتم از آن در جاوااسکریپت
   دست‌نخورده باقی مانده و فقط از نمایش دائمی حذف شده؛ همان اطلاعات از
   طریق نکته‌ی هاور (data-tooltip) روی هر نوار در دسترس می‌ماند.
   طراحی بدون گرادیانت روی خودِ میله (برای حداکثر خوانایی مقدار)،
   با تایپوگرافی فشرده و بدون سرریز برای جا شدن داخل کارت‌های تحلیلی.
   ============================================================ */
.of-groups {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: column;
    grid-template-rows: repeat(5, auto);
    gap: 10px 16px;
    align-items: start;
}

@media (max-width: 640px) {
    .of-groups {
        grid-template-columns: 1fr;
        grid-auto-flow: row;
        grid-template-rows: none;
    }
}

.of-group {
    background: var(--surface);
    border: 1px solid var(--hair);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.of-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.of-row-label {
    flex: 0 0 auto;
    width: 110px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.of-row-track {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    height: 7px;
    background: color-mix(in srgb, var(--muted), transparent 82%);
    border-radius: 5px;
    overflow: hidden;
}

.of-row-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    left: auto;
    border-radius: 5px;
    min-width: 3px;
    transition: width .6s cubic-bezier(.4, 0, .2, 1);
}

.of-row-fill.pos { background: var(--teal); }
.of-row-fill.neg { background: var(--red); }
.of-row-fill.neutral { background: var(--blue); }
.of-row-fill.neutral2 { background: color-mix(in srgb, var(--muted), transparent 45%); }

.of-ratio-mid {
    position: absolute;
    top: -3px;
    bottom: -3px;
    width: 2px;
    background: var(--text);
    opacity: .5;
    border-radius: 1px;
}

.of-row-val {
    flex: 0 0 auto;
    min-width: 60px;
    text-align: left;
    direction: ltr;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
}

.of-row-val.pos { color: var(--teal); }
.of-row-val.neg { color: var(--red); }
.of-row-val.neutral { color: var(--blue); }
.of-row-val.neutral2 { color: var(--muted); }

/* چیدمان دوطبقه‌ی مخصوص «شاخص‌های ترکیبی (نسبت‌ها)»: عنوان در سطر بالا
   با عرض کامل (بدون برش/سه‌نقطه) و نوار+مقدار در سطر پایین — تا عنوان‌های
   بلندتر این گروه هرگز روی نوار نیفتند و با آن هم‌پوشانی نداشته باشند. */
.of-row-stacked {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}

.of-row-stacked .of-row-label {
    width: auto;
    max-width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.4;
}

.of-row-bar-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.of-row-stacked .of-row-track {
    flex: 1 1 auto;
}

/* نکته‌ی هاور (Tooltip) روی هر نوار: با نگه‌داشتن ماوس روی هر ردیف،
   عنوان و مقدار دقیق آن (و در صورت وجود، سهم از معیار) نمایش داده می‌شود. */
.of-row[data-tooltip] {
    cursor: default;
}

.of-row[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface2);
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--hair);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease;
    z-index: 40;
    direction: rtl;
}

.of-row[data-tooltip]:hover::after,
.of-row[data-tooltip]:focus-within::after {
    opacity: 1;
    visibility: visible;
}

.of-note-group {
    gap: 4px;
}

.of-note-label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--gold);
}

.of-note-text {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.75;
}

@media (max-width: 480px) {
    .of-row-label { width: 64px; font-size: 10.5px; }
    .of-row-val { min-width: 50px; font-size: 11px; }
    .of-row[data-tooltip]::after { font-size: 10px; white-space: normal; max-width: 200px; text-align: center; }
}
