:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-card-hover: #263348;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --accent-yellow: #eab308;
    --accent-purple: #a855f7;
    --risk-high: #ef4444;
    --risk-medium: #f97316;
    --risk-low: #22c55e;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --color-profit: #22c55e;
    --color-loss: #ef4444;
    --color-neutral: #3b82f6;
    --color-bonds: #a855f7;
}

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

html {
    font-size: 90%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    direction: rtl;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--bg-secondary), #0f1d32);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.header h1 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: var(--text-secondary);
}

.refresh-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.refresh-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Summary Bar */
.summary-bar {
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.summary-main {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 12px;
}

.summary-card-large {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.summary-card-large .label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.summary-card-large .value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.2;
}

.summary-card-large .sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.summary-secondary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.summary-card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    border: 1px solid var(--border);
}

.summary-card .label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.summary-card .value {
    font-size: 16px;
    font-weight: 700;
}

.summary-card .sub {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Filters */
.filters {
    display: flex;
    gap: 8px;
    padding: 14px 24px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.filter-btn {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.filter-btn:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.search-input {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 11px;
    font-family: inherit;
    width: 200px;
    direction: rtl;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.sort-select {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 11px;
    font-family: inherit;
    direction: rtl;
    cursor: pointer;
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.filter-separator {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

/* Exposure Section */
.exposure-section {
    padding: 14px 24px;
}

.exposure-section h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.exposure-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.exposure-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 20px;
}

.exposure-card h3 {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: 700;
}

.exposure-bar {
    display: flex;
    height: 34px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 12px;
    width: 100%;

}

.exposure-bar-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    min-width: 40px;
    transition: width 0.5s;
}

.exposure-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.exposure-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 600;
}

.exposure-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.sector-chart-container {
    height: 280px;
}

/* Grid */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
    padding: 0 24px 24px;
    align-items: stretch;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin: 0 0 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

/* Client Card */
.client-card {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.client-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.client-name {
    font-size: 14px;
    font-weight: 700;
}

.risk-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.risk-badge.high {
    background: rgba(239, 68, 68, 0.15);
    color: var(--risk-high);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.risk-badge.medium {
    background: rgba(249, 115, 22, 0.15);
    color: var(--risk-medium);
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.risk-badge.low {
    background: rgba(34, 197, 94, 0.15);
    color: var(--risk-low);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.card-body {
    padding: 14px 16px;
    display: flex;
    gap: 16px;
}

.chart-container {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.card-performance {
    padding: 0 16px 8px;
    border-bottom: 1px solid var(--border);
}

.time-range-toggle {
    display: flex;
    gap: 4px;
    padding: 6px 16px 0;
}

.time-range-btn {
    padding: 3px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.time-range-btn:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.time-range-btn.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.card-performance-chart {
    width: 100%;
    height: 75px;
}

.holdings-summary {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.allocation-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    font-size: 11px;
}

.allocation-row:last-child {
    border-bottom: none;
}

.allocation-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.allocation-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.allocation-value {
    font-weight: 600;
    color: var(--text-primary);
}

.card-footer {
    padding: 8px 16px;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    margin-top: auto;
}

.portfolio-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-green);
}

.portfolio-label {
    font-size: 10px;
    color: var(--text-muted);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border-radius: 20px;
    border: 1px solid var(--border);
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 22px;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
    overflow-x: auto;
}

.modal-tab {
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
    white-space: nowrap;
}

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

.modal-tab.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.modal-tab-content {
    display: none;
}

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

.benchmark-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.benchmark-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.benchmark-line {
    width: 20px;
    height: 3px;
    border-radius: 2px;
}

.sector-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 16px;
}

.sector-table th {
    text-align: right;
    padding: 8px 12px;
    background: var(--bg-primary);
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

.sector-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    color: var(--text-secondary);
}

.transaction-badge {
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
}

.transaction-badge.buy {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-profit);
}

.transaction-badge.sell {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-loss);
}

.transaction-badge.deposit {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.transaction-badge.withdraw {
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
}

.modal-chart-container {
    width: 250px;
    height: 250px;
    margin: 0 auto 24px;
}

.modal-chart-container.modal-chart-small {
    width: 230px;
    height: 230px;
    flex: 0 0 230px;
}

.modal-performance-container {
    width: 100%;
    height: 280px;
    margin-bottom: 24px;
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border);
}

.modal-performance-container h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
}

.modal-charts-row {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    align-items: flex-start;
}

.modal-charts-row>div {
    flex: 1;
}

/* Performance chart controls */
.perf-chart-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.perf-time-range {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
}

.time-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.time-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.time-btn.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.perf-benchmarks {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.benchmark-toggle-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.benchmark-toggle-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.benchmark-toggle-btn.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.benchmark-options {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.benchmark-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 2px;
}

.benchmark-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.benchmark-btn:hover {
    border-color: var(--text-secondary);
}

.benchmark-btn.active {
    border-width: 2px;
    font-weight: 700;
}

@media (max-width: 768px) {
    .modal-charts-row {
        flex-direction: column;
    }

    .modal-chart-container.modal-chart-small {
        width: 180px;
        height: 180px;
        flex: 0 0 auto;
        margin: 0 auto;
    }
}

/* Fullscreen Chart Overlay */
.fullscreen-chart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 30px;
}

.fullscreen-chart-overlay.active {
    display: flex;
}

.fullscreen-chart-box {
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border);
    width: 95%;
    max-width: 1200px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fullscreen-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.fullscreen-chart-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.fullscreen-chart-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: inherit;
}

.zoom-btn:hover {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.zoom-btn.reset {
    width: auto;
    padding: 0 12px;
    font-size: 12px;
}

.fullscreen-chart-body {
    flex: 1;
    padding: 20px;
    position: relative;
}

.expand-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 5;
}

.expand-btn:hover {
    background: var(--accent-blue);
    color: white;
}

.chart-wrapper-relative {
    position: relative;
}

.zoom-hint {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 6px 0 0;
}

.modal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.modal-stat {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    border: 1px solid var(--border);
}

.modal-stat .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.modal-stat .stat-value {
    font-size: 18px;
    font-weight: 700;
}

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

.holdings-table th {
    text-align: right;
    padding: 10px 12px;
    background: var(--bg-primary);
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.holdings-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    color: var(--text-secondary);
}

.holdings-table tr:hover td {
    background: rgba(59, 130, 246, 0.05);
}

.holdings-footer-row td {
    border-top: 2px solid var(--border);
    background: rgba(59, 130, 246, 0.04);
    padding-top: 10px;
    padding-bottom: 10px;
}

.holdings-footer-row:hover td {
    background: rgba(59, 130, 246, 0.04);
}

.asset-type-badge {
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
}

.asset-type-badge.stock {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.asset-type-badge.bond {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
}

.price-change.positive {
    color: var(--accent-green);
}

.price-change.negative {
    color: var(--accent-red);
}

/* Macro News Page */
.macro-page {
    display: none;
    min-height: 100vh;
    background: var(--bg-primary);
    padding: 0;
}

.macro-page.active {
    display: block;
}

.macro-page-header {
    background: linear-gradient(135deg, var(--bg-secondary), #0f1d32);
    border-bottom: 1px solid var(--border);
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.macro-page-header h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.macro-back-btn {
    padding: 8px 20px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.macro-back-btn:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.macro-content {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.macro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.macro-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 24px;
    transition: all 0.2s;
    cursor: pointer;
}

.macro-card:hover {
    transform: translateY(-2px);
}

/* Unread - red border and glow */
.macro-card.macro-unread {
    border-color: rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.06);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

.macro-card.macro-unread:hover {
    border-color: rgba(239, 68, 68, 0.8);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

/* Read - blue border */
.macro-card.macro-read {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.03);
}

.macro-card.macro-read:hover {
    border-color: rgba(59, 130, 246, 0.6);
}

.macro-new-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 8px;
    background: var(--accent-red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    margin-right: 6px;
    vertical-align: middle;
}

.macro-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.macro-card-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.macro-card-category {
    font-size: 12px;
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.macro-card-data {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.macro-data-item {
    text-align: center;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.macro-data-item .data-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.macro-data-item .data-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.macro-card-time {
    font-size: 12px;
    color: var(--text-muted);
}

.alert-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    margin-right: 4px;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.5s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .clients-grid {
        grid-template-columns: 1fr;
        padding: 0 16px 16px;
    }

    .header {
        padding: 16px;
    }

    .summary-bar {
        padding: 16px;
    }

    .summary-main {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-secondary {
        grid-template-columns: 1fr;
    }

    .filters {
        padding: 16px;
    }

    .exposure-grid {
        grid-template-columns: 1fr;
    }

    .card-body {
        flex-direction: column;
        align-items: center;
    }

    .modal-stats {
        grid-template-columns: 1fr;
    }
}

/* Report */
.report-view {
    display: none;
    padding: 40px;
    background: white;
    color: #1a1a1a;
    max-width: 800px;
    margin: 0 auto;
    direction: rtl;
}

.report-view.active {
    display: block;
}

.report-header {
    text-align: center;
    border-bottom: 2px solid #333;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.report-header h1 {
    font-size: 24px;
    color: #1a1a1a;
    background: none;
    -webkit-text-fill-color: #1a1a1a;
}

.report-header p {
    color: #666;
    font-size: 14px;
    margin-top: 8px;
}

.report-section {
    margin-bottom: 30px;
    page-break-inside: avoid;
}

.report-section h3 {
    font-size: 16px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
    margin-bottom: 16px;
    color: #333;
}

.report-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.report-stat {
    text-align: center;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.report-stat .label {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}

.report-stat .value {
    font-size: 18px;
    font-weight: 700;
}

.report-chart-img {
    width: 100%;
    max-height: 300px;
    margin: 16px 0;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.report-table th,
.report-table td {
    padding: 8px 10px;
    border: 1px solid #ddd;
    text-align: right;
}

.report-table th {
    background: #f5f5f5;
    font-weight: 700;
}

.report-back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 10px 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    z-index: 9999;
}

@media print {
    body {
        background: white !important;
    }

    .header,
    .filters,
    .clients-grid,
    .exposure-section,
    .modal-overlay,
    .fullscreen-chart-overlay,
    .macro-page,
    .loading-overlay,
    .summary-bar,
    .report-back-btn {
        display: none !important;
    }

    .report-view {
        display: block !important;
        padding: 20px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Management Modal */
.mgmt-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1500;
    padding: 20px;
}
.mgmt-overlay.active { display: flex; }
.mgmt-box {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    max-width: 500px;
    width: 100%;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.mgmt-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mgmt-header h3 { font-size: 16px; font-weight: 700; }
.mgmt-body { padding: 20px 24px; }
.mgmt-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}
.mgmt-field { margin-bottom: 14px; }
.mgmt-field label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
}
.mgmt-field input, .mgmt-field select {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    direction: rtl;
}
.mgmt-field input:focus, .mgmt-field select:focus {
    outline: none;
    border-color: var(--accent-blue);
}
.mgmt-btn {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.mgmt-btn.primary { background: var(--accent-blue); color: white; }
.mgmt-btn.primary:hover { background: #2563eb; }
.mgmt-btn.danger { background: var(--accent-red); color: white; }
.mgmt-btn.danger:hover { background: #dc2626; }
.mgmt-btn.secondary { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.mgmt-btn.secondary:hover { border-color: var(--text-secondary); }
.mgmt-confirm-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}
.mgmt-confirm-text strong { color: var(--text-primary); }

/* Card action buttons */
.card-actions {
    display: flex;
    gap: 4px;
}
.card-action-btn {
    width: 26px; height: 26px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.card-action-btn:hover { background: var(--bg-primary); color: var(--text-primary); }
.card-action-btn.delete:hover { background: rgba(239,68,68,0.15); color: var(--accent-red); border-color: rgba(239,68,68,0.3); }

/* Holdings action buttons in table */
.holding-action-btn {
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.holding-action-btn:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.holding-action-btn.sell { color: var(--accent-orange); border-color: rgba(249,115,22,0.3); }
.holding-action-btn.sell:hover { border-color: var(--accent-orange); background: rgba(249,115,22,0.1); }
.holding-action-btn.delete:hover { border-color: var(--accent-red); color: var(--accent-red); }

.mgmt-readonly {
    padding: 8px 12px;
    background: rgba(51,65,85,0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

/* Cash balance display in buy modal */
.cash-balance-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(34,197,94,0.08);
    border: 1px solid rgba(34,197,94,0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}
.cash-balance-display .cash-amount {
    font-weight: 700;
    color: var(--accent-green);
    font-size: 15px;
}

/* Buy cost summary */
.buy-cost-summary {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(51,65,85,0.2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.buy-cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.buy-cost-row span:last-child {
    font-weight: 700;
    color: var(--text-primary);
}

/* Insufficient cash warning */
.insufficient-cash-warning {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-red);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

/* Deposit button on card */
.card-action-btn.deposit { color: var(--accent-green); }
.card-action-btn.deposit:hover { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.3); }

/* Disabled buy button */
.mgmt-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Ticker search dropdown */
.ticker-search-wrapper {
    position: relative;
}
.ticker-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.ticker-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
    direction: ltr;
    text-align: left;
}
.ticker-search-item:hover {
    background: var(--bg-card-hover);
}
.ticker-search-symbol {
    font-weight: 700;
    color: var(--accent-blue);
    min-width: 60px;
    font-size: 13px;
}
.ticker-search-name {
    flex: 1;
    color: var(--text-primary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ticker-search-meta {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}
.ticker-search-empty, .ticker-search-loading {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}
.ticker-selected-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--accent-blue);
    background: rgba(59,130,246,0.1);
    color: var(--text-primary);
    font-size: 13px;
    direction: ltr;
    text-align: left;
}
.ticker-selected-badge span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ticker-clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.ticker-clear-btn:hover {
    color: var(--accent-red);
}

.add-asset-btn {
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--accent-blue);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
    margin-bottom: 12px;
}
.add-asset-btn:hover { background: rgba(59,130,246,0.1); border-color: var(--accent-blue); }

/* Transaction badge for edit types in per-portfolio modal */
.transaction-badge.edit_settings,
.transaction-badge.edit_holding {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
}

/* ========== Add Client - Holdings Import ========== */

.mgmt-section-divider {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 16px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

/* File Dropzone */
.file-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
    background: rgba(51,65,85,0.08);
}
.file-dropzone:hover {
    border-color: var(--accent-blue);
    background: rgba(59,130,246,0.05);
}
.file-dropzone.dragover {
    border-color: var(--accent-blue);
    background: rgba(59,130,246,0.1);
    transform: scale(1.01);
}
.dropzone-icon {
    font-size: 28px;
    margin-bottom: 6px;
    opacity: 0.6;
}
.dropzone-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}
.dropzone-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* File status messages */
.file-status-loading {
    padding: 8px 12px;
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: var(--radius-sm);
    color: var(--accent-blue);
    font-size: 12px;
    text-align: center;
}
.file-status-success {
    padding: 8px 12px;
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.2);
    border-radius: var(--radius-sm);
    color: var(--accent-green);
    font-size: 12px;
    text-align: center;
}
.file-status-error {
    padding: 8px 12px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius-sm);
    color: var(--accent-red);
    font-size: 12px;
    text-align: center;
}

/* Dynamic Holdings Table */
.mgmt-holdings-wrapper {
    margin-bottom: 12px;
}
.mgmt-holdings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 8px;
}
.mgmt-holdings-table th {
    text-align: right;
    padding: 6px 8px;
    background: var(--bg-primary);
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.3px;
}
.mgmt-holdings-table td {
    padding: 4px 4px;
    border-bottom: 1px solid rgba(51,65,85,0.3);
    vertical-align: middle;
}
.mgmt-holdings-table input {
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
}
.mgmt-holdings-table input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Row ticker search */
.row-ticker-wrapper {
    position: relative;
}
.row-ticker-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid var(--accent-blue);
    background: rgba(59,130,246,0.1);
    color: var(--accent-blue);
    font-size: 12px;
    font-weight: 700;
    direction: ltr;
}
.row-ticker-badge .ticker-clear-btn {
    font-size: 14px;
    padding: 0 2px;
    margin-right: auto;
}
.row-ticker-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 180px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* Add Row button */
.add-row-btn {
    padding: 5px 14px;
    border-radius: 6px;
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--accent-blue);
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
    width: 100%;
}
.add-row-btn:hover {
    background: rgba(59,130,246,0.1);
    border-color: var(--accent-blue);
}

/* Risk Indicator */
.risk-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(51,65,85,0.15);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-top: 4px;
}
.risk-indicator-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}
.risk-indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.risk-indicator-value {
    font-size: 13px;
    font-weight: 700;
}
.risk-indicator-pct {
    font-size: 11px;
    color: var(--text-muted);
    margin-right: auto;
    direction: ltr;
}
