/* ═══════════════════════════════════════════════════════════
   MokhbirPro — Dashboard Styles (Pie-chart layout)
   ═══════════════════════════════════════════════════════════ */

/* ── Loading State ───────────────────────────────────────── */
.dashboard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 80px 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 1400px;
    margin: 0 auto;
}
.dashboard-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent, #c08629);
    border-radius: 50%;
    animation: dash-spin 0.8s linear infinite;
}
@keyframes dash-spin {
    to { transform: rotate(360deg); }
}

/* ── Dashboard Content ───────────────────────────────────── */
.dashboard-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 0 40px;
}

/* ── Top pie charts now use .stats-bar / .stat-card-pie from style.css ── */

/* ── Pie chart empty overlay ─────────────────────────────── */
.pie-empty-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--text-secondary, #6b7280);
    pointer-events: none;
}

/* ── Wallet Section ──────────────────────────────────────── */
.wallet-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius, 12px);
    padding: 24px 20px;
    position: relative;
    overflow: hidden;
}
.wallet-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent, #c08629), var(--brand, #1a5722));
}
.wallet-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 20px;
}
.wallet-title-en {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-right: 8px;
}

/* ── Wallet Charts (2 side by side) ──────────────────────── */
.wallet-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.pie-card--small {
    padding: 16px;
}
.pie-canvas-wrap--small {
    height: 220px;
}
.pie-canvas-wrap--small canvas {
    max-height: 220px;
}

/* Dots hidden on desktop */
.wallet-charts-dots {
    display: none;
}

/* ── Ticker Card Grid ────────────────────────────────────── */
.wallet-tickers {
    margin-top: 8px;
}
.wallet-tickers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.ticker-card {
    background: var(--bg-surface, var(--bg-card));
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.ticker-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.ticker-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.ticker-card-symbol {
    font-weight: 800;
    font-size: 1rem;
    color: var(--brand, #1a5722);
    text-decoration: none;
}
.ticker-card-symbol:hover {
    text-decoration: underline;
}
.ticker-card-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted, #999);
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.ticker-card-remove:hover {
    background: rgba(196, 43, 54, 0.1);
    color: var(--red, #c42b36);
}
.ticker-card-market {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.ticker-card-alpha {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(192, 134, 41, 0.12);
    color: var(--accent, #c08629);
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
}
.ticker-card-details {
    display: flex;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-primary);
    margin-top: 6px;
    flex-wrap: wrap;
}
.ticker-card-detail-label {
    color: var(--text-secondary);
    font-size: 0.7rem;
    margin-left: 3px;
    display: block;
}
.ticker-card-notes {
    font-size: 0.75rem;
    color: var(--text-muted, #999);
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* ── Empty & Locked States ───────────────────────────────── */
.wallet-empty,
.wallet-locked {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-secondary);
}
.wallet-empty-icon,
.wallet-locked-icon {
    font-size: 2.4rem;
    display: block;
    margin-bottom: 10px;
}
.wallet-empty p,
.wallet-locked p {
    margin: 4px 0;
    font-size: 0.9rem;
}
.wallet-empty-sub,
.wallet-locked-sub {
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.wallet-empty-en,
.wallet-locked-en {
    font-size: 0.78rem;
    color: var(--text-muted, #999);
}
.wallet-cta-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--brand, #1a5722), var(--accent, #c08629));
    color: #fff;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}
.wallet-cta-btn:hover {
    opacity: 0.85;
}

/* ── Wallet Header (title + toggle) ──────────────────────── */
.wallet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.wallet-header .wallet-title {
    margin: 0;
}

/* ── View Toggle Buttons ─────────────────────────────────── */
.wallet-view-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-surface, var(--bg-card));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
}
.wvt-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted, #999);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.wvt-btn:hover {
    background: var(--bg-hover, rgba(0,0,0,0.05));
    color: var(--text-primary);
}
.wvt-btn.active {
    background: var(--brand, #1a5722);
    color: #fff;
}

/* ── Stats Panel ─────────────────────────────────────────── */
.wallet-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-surface, var(--bg-card));
    border: 1px solid var(--border);
    border-radius: 10px;
}
.wallet-stat-card {
    flex: 1 1 140px;
    min-width: 120px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.wallet-stat-capital {
    flex: 1 1 180px;
}
.wallet-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.2;
}
.wallet-stat-label-en {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-muted, #999);
    margin-right: 4px;
}
.wallet-stat-value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
}
.wallet-stat-pct {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.wallet-stat-risk .wallet-stat-value { color: var(--red, #c42b36); }
.wallet-stat-risk .wallet-stat-pct { color: var(--red, #c42b36); }
.wallet-stat-reward .wallet-stat-value { color: var(--green, #1a5722); }
.wallet-stat-reward .wallet-stat-pct { color: var(--green, #1a5722); }
.wallet-capital-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input, var(--bg-card));
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
    outline: none;
    transition: border-color 0.15s;
}
.wallet-capital-input:focus {
    border-color: var(--brand, #1a5722);
}
.wallet-capital-input::placeholder {
    color: var(--text-muted, #999);
    font-weight: 400;
    font-size: 0.8rem;
}

/* ── Portfolio Heat stat card ────────────────────────────── */
.wallet-stat-heat {
    border-color: var(--orange, #c08629);
}
.wallet-stat-heat .wallet-stat-value {
    font-weight: 800;
}
.wallet-stat-badge {
    margin-top: 2px;
}
.ws-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}
.ws-badge-sm {
    padding: 1px 6px;
    font-size: 0.62rem;
}

/* Heat category colors */
.heat-minimal  { background: #e2e8f0; color: #475569; }
.heat-low      { background: #d1fae5; color: #065f46; }
.heat-medium   { background: #fef3c7; color: #92400e; }
.heat-high     { background: #fee2e2; color: #991b1b; }
.heat-critical { background: #991b1b; color: #fff; }

/* Position size category colors */
.pos-minimal   { background: #e2e8f0; color: #475569; }
.pos-low       { background: #d1fae5; color: #065f46; }
.pos-medium    { background: #fef3c7; color: #92400e; }
.pos-high      { background: #fee2e2; color: #991b1b; }
.pos-excessive { background: #991b1b; color: #fff; }

/* Trade risk badges */
.risk-ok   { background: #d1fae5; color: #065f46; }
.risk-warn { background: #991b1b; color: #fff; }

/* Ticker card badges row */
.ticker-card-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* ── List View Table ─────────────────────────────────────── */
.wallet-tickers-list {
    margin-top: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.wallet-list-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}
.wallet-list-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-surface, var(--bg-card));
    padding: 10px 12px;
    text-align: right;
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.wallet-list-table thead .wlt-en {
    font-weight: 400;
    color: var(--text-muted, #999);
    font-size: 0.65rem;
    margin-right: 4px;
}
.wallet-list-table tbody tr {
    transition: background 0.1s;
}
.wallet-list-table tbody tr:nth-child(even) {
    background: var(--bg-surface, rgba(0,0,0,0.02));
}
.wallet-list-table tbody tr:hover {
    background: var(--bg-hover, rgba(26,87,34,0.04));
}
.wallet-list-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}
.wallet-list-table .wlt-symbol a {
    font-weight: 800;
    color: var(--brand, #1a5722);
    text-decoration: none;
}
.wallet-list-table .wlt-symbol a:hover {
    text-decoration: underline;
}
.wallet-list-table .wlt-market {
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.wallet-list-table .wlt-alpha {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(192, 134, 41, 0.12);
    color: var(--accent, #c08629);
    padding: 1px 6px;
    border-radius: 4px;
}
.wlt-input {
    width: 90px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: right;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.wlt-input:hover {
    border-color: var(--border);
    background: var(--bg-input, var(--bg-card));
}
.wlt-input:focus {
    border-color: var(--brand, #1a5722);
    background: var(--bg-input, var(--bg-card));
}
.wlt-input::placeholder {
    color: var(--text-muted, #999);
    font-weight: 400;
}
.wlt-input.wlt-total {
    color: var(--text-secondary);
    font-weight: 500;
}
.wlt-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted, #999);
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.wlt-remove:hover {
    background: rgba(196, 43, 54, 0.1);
    color: var(--red, #c42b36);
}

/* ── Responsive ──────────────────────────────────────────── */

/* ── Wallet Tabs ─────────────────────────────────────────── */
.wallet-tabs {
    display: flex;
    gap: 0;
    background: var(--bg-surface, var(--bg-card));
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.wallet-tab {
    padding: 8px 18px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.wallet-tab:hover {
    background: var(--bg-hover, rgba(0,0,0,0.04));
}
.wallet-tab.active {
    background: var(--brand, #1a5722);
    color: #fff;
}
.wallet-tab-en {
    font-size: 0.68rem;
    font-weight: 400;
    opacity: 0.8;
    margin-right: 4px;
}

/* ── Trade History ───────────────────────────────────────── */
.th-timeframe-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.th-tf-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.th-tf-btn:hover {
    background: var(--bg-hover, rgba(0,0,0,0.04));
    border-color: var(--text-secondary);
}
.th-tf-btn.active {
    background: var(--brand, #1a5722);
    color: #fff;
    border-color: var(--brand, #1a5722);
}
.th-tf-en {
    font-size: 0.62rem;
    font-weight: 400;
    opacity: 0.8;
    margin-right: 3px;
}

/* Trade History Stats Cards */
.th-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 14px;
    background: var(--bg-surface, var(--bg-card));
    border: 1px solid var(--border);
    border-radius: 10px;
}
.th-stat-card {
    flex: 1 1 120px;
    min-width: 100px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.th-stat-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.2;
}
.th-stat-en {
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--text-muted, #999);
    margin-right: 3px;
}
.th-stat-value {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
}
.th-stat-win .th-stat-value { color: var(--green, #1a5722); }
.th-stat-best .th-stat-value { color: var(--green, #1a5722); }
.th-stat-worst .th-stat-value { color: var(--red, #c42b36); }

.th-pnl-positive { color: var(--green, #1a5722) !important; font-weight: 700; }
.th-pnl-negative { color: var(--red, #c42b36) !important; font-weight: 700; }

/* Trade History Table */
.th-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.th-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}
.th-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-surface, var(--bg-card));
    padding: 10px 12px;
    text-align: right;
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.th-table thead .th-en {
    font-weight: 400;
    color: var(--text-muted, #999);
    font-size: 0.65rem;
    margin-right: 4px;
}
.th-table tbody tr {
    transition: background 0.1s;
}
.th-table tbody tr:nth-child(even) {
    background: var(--bg-surface, rgba(0,0,0,0.02));
}
.th-table tbody tr:hover {
    background: var(--bg-hover, rgba(26,87,34,0.04));
}
.th-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}
.th-table .th-symbol {
    font-weight: 800;
    color: var(--brand, #1a5722);
}
.th-table .th-notes {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--text-muted, #999);
}
.th-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-secondary);
}
.th-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

/* ── Close Trade Modal ───────────────────────────────────── */
.ct-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.ct-modal {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 24px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}
.ct-modal-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 4px;
}
.ct-modal-title-en {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-right: 6px;
}
.ct-modal-ticker {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--brand, #1a5722);
    margin-bottom: 16px;
}
.ct-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    margin-top: 12px;
}
.ct-label-en {
    font-size: 0.68rem;
    font-weight: 400;
    color: var(--text-muted, #999);
    margin-right: 4px;
}
.ct-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input, var(--bg-card));
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.ct-input:focus {
    border-color: var(--brand, #1a5722);
}
.ct-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}
.ct-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
}
.ct-btn:hover { opacity: 0.85; }
.ct-btn-confirm {
    background: var(--brand, #1a5722);
    color: #fff;
}
.ct-btn-cancel {
    background: var(--bg-surface, #e2e8f0);
    color: var(--text-primary);
}

/* ── Notes Edit Modal ────────────────────────────────────── */
.notes-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

/* ── Notes edit buttons ──────────────────────────────────── */
.ticker-card-notes-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
}
.ticker-card-notes-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.72rem;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.5;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.ticker-card-notes-btn:hover { opacity: 1; }
.ticker-card-notes-empty {
    color: var(--text-muted, #999);
}

.wlt-notes {
    max-width: 150px;
}
.wlt-notes-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    max-width: 110px;
    vertical-align: middle;
    font-size: 0.75rem;
    color: var(--text-muted, #999);
}
.wlt-notes-edit {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.72rem;
    padding: 1px 3px;
    border-radius: 4px;
    opacity: 0.4;
    transition: opacity 0.15s;
    vertical-align: middle;
}
.wlt-notes-edit:hover { opacity: 1; }

/* ── Entry date input in list view ───────────────────────── */
.wlt-input.wlt-entry-date {
    width: 120px;
    font-size: 0.78rem;
}

/* Close button on ticker card */
.ticker-card-actions {
    display: flex;
    gap: 2px;
    align-items: center;
}
.ticker-card-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--green, #1a5722);
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.ticker-card-close:hover {
    background: rgba(26, 87, 34, 0.1);
}

/* Close button in list view */
.wlt-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--green, #1a5722);
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.wlt-close:hover {
    background: rgba(26, 87, 34, 0.1);
}
.wlt-actions {
    text-align: center;
}
.wlt-actions-inner {
    display: inline-flex;
    gap: 2px;
    align-items: center;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .wallet-tabs {
        font-size: 0.78rem;
    }
    .wallet-tab {
        padding: 8px 12px;
        font-size: 0.78rem;
    }
    .th-timeframe-bar {
        gap: 4px;
    }
    .th-tf-btn {
        padding: 6px 10px;
        font-size: 0.72rem;
    }
    .th-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .th-stat-card {
        flex: unset;
        min-width: unset;
    }
    .th-table {
        font-size: 0.78rem;
    }
    .th-table th:first-child,
    .th-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        background: var(--bg-card);
    }
    .th-table th:first-child {
        background: var(--bg-secondary);
        z-index: 3;
    }
    .ct-modal {
        max-width: 100%;
    }
    .ct-input {
        font-size: 16px;
        min-height: 44px;
    }
    .wallet-charts {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 12px;
        padding: 0 20px 8px;
        margin: 0 -20px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .wallet-charts::-webkit-scrollbar {
        display: none;
    }
    .wallet-charts .pie-card--small {
        flex: 0 0 80%;
        min-width: 0;
        scroll-snap-align: center;
    }
    /* Scroll dot indicators */
    .wallet-charts-dots {
        display: flex;
        justify-content: center;
        gap: 8px;
        padding: 8px 0 4px;
    }
    .wc-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--border, #e2e8f0);
        transition: background 0.2s, transform 0.2s;
        cursor: pointer;
    }
    .wc-dot.active {
        background: var(--accent, #c08629);
        transform: scale(1.25);
    }
    .wallet-tickers-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .dashboard-content {
        padding: 0 12px 32px;
    }
    .wallet-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .wallet-stat-card {
        flex: unset;
        min-width: unset;
    }
    .wallet-stat-capital {
        grid-column: 1 / -1;
    }
    .wallet-list-table {
        font-size: 0.78rem;
    }
    .wlt-input {
        width: 75px;
        font-size: 16px;
    }
    .wallet-capital-input {
        font-size: 16px;
        min-height: 44px;
    }
    /* Sticky first column in wallet list table */
    .wallet-list-table th:first-child,
    .wallet-list-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        background: var(--bg-card);
    }
    .wallet-list-table th:first-child {
        background: var(--bg-secondary);
        z-index: 3;
    }
    /* Grid/List toggle buttons */
    .wvt-btn {
        min-width: 44px;
        min-height: 44px;
    }
    /* Dashboard loading */
    .dashboard-loading {
        padding: 40px 16px;
    }
    /* Pie chart areas */
    .hero-pie-wrap {
        height: 140px;
    }
    .hero-pie-wrap canvas {
        max-height: 140px;
    }
}

@media (max-width: 480px) {
    .wallet-tickers-grid {
        grid-template-columns: 1fr;
    }
    .wallet-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .wallet-stats {
        grid-template-columns: 1fr 1fr;
    }
    .wallet-stat-card {
        min-width: unset;
    }
    .wallet-charts .pie-card--small {
        flex: 0 0 85%;
    }
    .hero-pie-wrap {
        height: 120px;
    }
    .hero-pie-wrap canvas {
        max-height: 120px;
    }
    .dashboard-content {
        padding: 0 8px 24px;
    }
}

/* ═══════════════════════════════════════════════════════════
   Macro Dashboard Tab
   ═══════════════════════════════════════════════════════════ */

/* ── Sha'aban Sentiment Meter ────────────────────────────── */
.macro-shaaban-meter { margin-bottom: 16px; }
.shaaban-inner {
    padding: 16px 20px; border-radius: var(--radius, 8px);
    border: 1px solid var(--border); background: var(--bg-secondary, var(--bg-primary));
}
.shaaban-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.shaaban-title { font-size: 0.85rem; color: var(--text-muted); }
.shaaban-title-en { font-size: 0.75rem; opacity: 0.7; }
.shaaban-label { font-size: 1.1rem; font-weight: 700; }
.shaaban-optimistic .shaaban-label { color: #22c55e; }
.shaaban-neutral .shaaban-label { color: var(--text-secondary); }
.shaaban-pessimistic .shaaban-label { color: #ef4444; }
.shaaban-track { position: relative; height: 10px; border-radius: 5px; overflow: visible; margin: 8px 0; }
.shaaban-gradient {
    width: 100%; height: 100%; border-radius: 5px;
    background: linear-gradient(to right, #ef4444, #f59e0b, #22c55e);
    opacity: 0.6;
}
.shaaban-needle {
    position: absolute; top: -4px; width: 18px; height: 18px;
    border-radius: 50%; border: 3px solid var(--bg-primary, #fff);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    transform: translateX(-50%); transition: left 0.4s ease;
}
.shaaban-optimistic .shaaban-needle { background: #22c55e; }
.shaaban-neutral .shaaban-needle { background: #f59e0b; }
.shaaban-pessimistic .shaaban-needle { background: #ef4444; }
.shaaban-scale { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.shaaban-note {
    margin-top: 10px; padding: 8px 12px; border-radius: 6px;
    background: var(--bg-primary, #f8f8f8); border: 1px solid var(--border);
    font-size: 0.82rem; color: var(--text-secondary); font-style: italic;
}

/* ── Flash Alerts ────────────────────────────────────────── */
.macro-flash-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.macro-flash-item { padding: 12px 16px; border-radius: var(--radius, 8px); font-size: 0.9rem; font-weight: 600; display: flex; flex-direction: column; gap: 2px; }
.macro-flash-red { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.4); color: #ef4444; }
.macro-flash-amber { background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.4); color: #d97706; }
.macro-flash-en { font-size: 0.8rem; opacity: 0.8; font-weight: 400; }
@keyframes macro-flash-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
.macro-flash-red { animation: macro-flash-pulse 2s ease-in-out infinite; }

/* ── Top Row: Risk + VIX ─────────────────────────────────── */
.macro-top-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.macro-card { background: var(--bg-secondary, var(--bg-primary)); border: 1px solid var(--border); border-radius: var(--radius, 8px); padding: 20px; }
.macro-card-title { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.macro-card-title-en { font-size: 0.7rem; opacity: 0.7; }

/* Risk badge */
.macro-risk-badge { font-size: 1.6rem; font-weight: 700; margin: 8px 0; }
.macro-badge-on { color: #22c55e; }
.macro-badge-off { color: #ef4444; }
.macro-badge-neutral { color: var(--text-muted); }
.macro-badge-ar { display: block; }
.macro-badge-en { display: block; font-size: 0.9rem; font-weight: 500; opacity: 0.7; }
.macro-risk-detail { font-size: 0.8rem; color: var(--text-secondary); margin-top: 8px; }
.macro-risk-line { margin-bottom: 4px; }
.macro-risk-sig { font-weight: 600; font-size: 0.75rem; }
.macro-sig-above { color: #22c55e; }
.macro-sig-below { color: #ef4444; }

/* VIX card */
.macro-vix-value { font-size: 2rem; font-weight: 700; color: var(--text-primary); }
.macro-vix-change { font-size: 0.85rem; margin: 4px 0; }
.macro-vix-up { color: #ef4444; } /* VIX up = bad */
.macro-vix-down { color: #22c55e; } /* VIX down = good */
.macro-vix-threshold { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; margin: 4px 0 8px; }
.macro-thr-low { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.macro-thr-elevated { background: rgba(234, 179, 8, 0.15); color: #eab308; }
.macro-thr-caution { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.macro-thr-fear { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.macro-vix-spark { height: 120px; margin-top: 8px; border-radius: 4px; overflow: hidden; }

/* ── Charts Row (SPPHB / SPLV) ───────────────────────────── */
.macro-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.macro-chart-wrap { background: var(--bg-secondary, var(--bg-primary)); border: 1px solid var(--border); border-radius: var(--radius, 8px); padding: 12px; overflow: hidden; }
.macro-chart-label { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.macro-chart-label-sub { font-size: 0.75rem; font-weight: 400; color: var(--text-muted); }
.macro-chart-container { height: 300px; width: 100%; border-radius: 4px; overflow: hidden; }

/* ── Section Titles ──────────────────────────────────────── */
.macro-section-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); margin: 20px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.macro-section-title-en { font-size: 0.8rem; font-weight: 400; color: var(--text-muted); }

/* ── Below-MA Cards ──────────────────────────────────────── */
.macro-ma-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.macro-ma-card { background: var(--bg-secondary, var(--bg-primary)); border: 1px solid var(--border); border-radius: var(--radius, 8px); padding: 16px; text-align: center; transition: border-color 0.3s; }
.macro-ma-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 6px; }
.macro-ma-label-en { font-size: 0.7rem; display: block; }
.macro-ma-value { font-size: 1.8rem; font-weight: 700; color: var(--text-primary); }
.macro-ma-green { border-color: rgba(34, 197, 94, 0.5); }
.macro-ma-green .macro-ma-value { color: #22c55e; }
.macro-ma-amber { border-color: rgba(234, 179, 8, 0.5); }
.macro-ma-amber .macro-ma-value { color: #eab308; }
.macro-ma-red { border-color: rgba(239, 68, 68, 0.5); }
.macro-ma-red .macro-ma-value { color: #ef4444; }

/* ── Breadth Mini Charts ─────────────────────────────────── */
.macro-breadth-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.macro-mini-chart-wrap { background: var(--bg-secondary, var(--bg-primary)); border: 1px solid var(--border); border-radius: var(--radius, 8px); padding: 10px; overflow: hidden; }
.macro-mini-label { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 6px; text-align: center; }
.macro-mini-label-en { font-size: 0.65rem; display: block; }
.macro-mini-chart { height: 160px; width: 100%; border-radius: 4px; overflow: hidden; }

/* ── Sector Table ────────────────────────────────────────── */
.macro-sector-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.macro-sector-table thead th { padding: 8px 10px; text-align: start; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid var(--border); font-size: 0.75rem; }
.macro-th-en { font-size: 0.65rem; font-weight: 400; }
.macro-sector-table tbody td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.macro-sector-table tbody tr:hover { background: var(--bg-hover, rgba(128,128,128,0.06)); }
.macro-sector-name { font-size: 0.72rem; color: var(--text-muted); margin-inline-start: 4px; }
.macro-pos { color: #22c55e; font-weight: 600; }
.macro-neg { color: #ef4444; font-weight: 600; }
.macro-trend-up { color: #22c55e; }
.macro-trend-down { color: #ef4444; }
.macro-trend-label { font-size: 0.7rem; font-weight: 400; }

/* ── Sector Rotation Bars ────────────────────────────────── */
.macro-sector-bars { margin-top: 16px; }
.macro-bars-title { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; text-align: center; }
.macro-bars-title-en { font-size: 0.7rem; }
.macro-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.macro-bar-label { width: 40px; text-align: end; font-size: 0.72rem; font-weight: 600; color: var(--text-primary); flex-shrink: 0; }
.macro-bar-track { flex: 1; height: 18px; background: var(--border); border-radius: 3px; position: relative; overflow: hidden; }
.macro-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.macro-bar-pos { background: rgba(34, 197, 94, 0.6); }
.macro-bar-neg { background: rgba(239, 68, 68, 0.6); }
.macro-bar-val { width: 55px; font-size: 0.7rem; font-weight: 600; flex-shrink: 0; }

/* ── Macro Loading / Locked ──────────────────────────────── */
.macro-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 60px 20px; color: var(--text-secondary); font-size: 0.9rem; }
.macro-loading-en { font-size: 0.8rem; opacity: 0.7; }
.macro-locked { text-align: center; padding: 60px 20px; color: var(--text-secondary); }

/* ── Macro WoW badges & scan timestamp ───────────────────── */
.macro-scan-ts {
    text-align: center; padding: 0.5rem 1rem; margin-bottom: 0.75rem;
    font-size: 0.82rem; color: var(--text-muted, #888);
    border-bottom: 1px solid var(--border, #e0e0e0);
}
.macro-scan-ago { font-weight: 400; opacity: 0.7; }
.macro-wow-badge {
    display: inline-block; font-size: 0.72rem; font-weight: 600;
    padding: 1px 6px; border-radius: 4px; margin-left: 4px;
    vertical-align: middle; line-height: 1.4;
}
.macro-wow-up { color: #16a34a; background: rgba(22,163,74,0.1); }
.macro-wow-down { color: #dc2626; background: rgba(220,38,38,0.1); }
.macro-wow-warn { color: #d97706; background: rgba(217,119,6,0.1); }
.macro-spinner {
    width: 32px; height: 32px; border: 3px solid var(--border, #e0e0e0);
    border-top-color: var(--accent, #4a7c59); border-radius: 50%;
    animation: macro-spin 0.8s linear infinite; margin: 0 auto;
}
@keyframes macro-spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .macro-top-row { grid-template-columns: 1fr; }
    .macro-charts-row { grid-template-columns: 1fr; }
    .macro-ma-row { grid-template-columns: 1fr; }
    .macro-breadth-row { grid-template-columns: 1fr 1fr; }
    .macro-chart-container { height: 240px; }
    .macro-mini-chart { height: 130px; }
}
@media (max-width: 480px) {
    .macro-breadth-row { grid-template-columns: 1fr; }
    .macro-sector-table { font-size: 0.75rem; }
    .macro-sector-table thead th, .macro-sector-table tbody td { padding: 6px 6px; }
}

/* ── Market Price Colors ─────────────────────────────────── */
.ticker-card-price-up { color: var(--green, #1a5722) !important; }
.ticker-card-price-down { color: var(--red, #c42b36) !important; }
.wlt-price-up { color: var(--green, #1a5722); font-weight: 700; }
.wlt-price-down { color: var(--red, #c42b36); font-weight: 700; }
.wlt-mkt-price { white-space: nowrap; font-weight: 600; }

/* ── Sector ──────────────────────────────────────────────── */
.ticker-card-sector {
    font-size: 0.72rem;
    color: var(--text-muted, #999);
    margin-top: -2px;
}
.wlt-sector {
    font-size: 0.78rem;
    color: var(--text-secondary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Stop / Target inputs (grid card) ────────────────────── */
.ticker-card-stop-target {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.tc-stop-input, .tc-target-input, .tc-date-input, .tc-ep-input, .tc-qty-input, .tc-total-input {
    width: 72px;
    padding: 3px 6px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: right;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.tc-date-input {
    width: 110px;
}
.tc-total-input {
    width: 80px;
}
.tc-stop-input:hover, .tc-target-input:hover, .tc-date-input:hover,
.tc-ep-input:hover, .tc-qty-input:hover, .tc-total-input:hover {
    border-color: var(--border);
    background: var(--bg-input, var(--bg-card));
}
.tc-stop-input:focus, .tc-target-input:focus, .tc-date-input:focus,
.tc-ep-input:focus, .tc-qty-input:focus, .tc-total-input:focus {
    border-color: var(--brand, #1a5722);
    background: var(--bg-input, var(--bg-card));
}
.tc-stop-input::placeholder, .tc-target-input::placeholder,
.tc-ep-input::placeholder, .tc-qty-input::placeholder, .tc-total-input::placeholder {
    color: var(--text-muted, #999);
    font-weight: 400;
    font-size: 0.72rem;
}

/* ── Info tooltip icons ──────────────────────────────────── */
.wlt-info, .tc-info {
    cursor: help;
    font-size: 0.7rem;
    color: var(--text-muted, #999);
    vertical-align: middle;
}

/* ── Wallet Search ───────────────────────────────────────── */
.wallet-search-wrap {
    position: relative;
    margin-left: 12px;
}
.wallet-search-input {
    width: 180px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input, var(--bg-card));
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.15s, width 0.2s;
}
.wallet-search-input:focus {
    border-color: var(--brand, #1a5722);
    width: 240px;
}
.wallet-search-input::placeholder {
    color: var(--text-muted, #999);
    font-size: 0.75rem;
}
.wallet-search-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 500;
    margin-top: 4px;
}
.ws-dd-empty {
    padding: 14px;
    text-align: center;
    color: var(--text-muted, #999);
    font-size: 0.82rem;
}
.ws-dd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}
.ws-dd-item:last-child { border-bottom: none; }
.ws-dd-sym {
    font-weight: 800;
    color: var(--brand, #1a5722);
    flex-shrink: 0;
}
.ws-dd-count {
    color: var(--text-muted, #999);
    font-size: 0.72rem;
    flex: 1;
}
.ws-dd-in-pf {
    color: var(--green, #1a5722);
    font-weight: 700;
    font-size: 0.85rem;
}
.ws-dd-add {
    background: none;
    border: 1px solid var(--brand, #1a5722);
    color: var(--brand, #1a5722);
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.ws-dd-add:hover {
    background: var(--brand, #1a5722);
    color: #fff;
}
.ws-dd-form {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    padding: 6px 0 0;
    width: 100%;
}
.ws-dd-input {
    flex: 1 1 60px;
    min-width: 60px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-input, var(--bg-card));
    color: var(--text-primary);
    font-size: 0.78rem;
    outline: none;
}
.ws-dd-input:focus { border-color: var(--brand, #1a5722); }
.ws-dd-input::placeholder { color: var(--text-muted, #999); font-size: 0.72rem; }
.ws-dd-date { flex: 1 1 90px; min-width: 90px; }
.ws-dd-submit {
    background: var(--brand, #1a5722);
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}
.ws-dd-submit:hover { opacity: 0.9; }

/* ── Responsive additions ────────────────────────────────── */
@media (max-width: 768px) {
    .wallet-search-input { width: 140px; }
    .wallet-search-input:focus { width: 180px; }
    .wallet-search-dropdown { width: 260px; }
    .wlt-stop-loss, .wlt-take-profit { width: 70px; }
}
