/* Tab Navigation */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #334155;
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #94a3b8;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #e2e8f0;
    background: rgba(59, 130, 246, 0.1);
}

.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Optimization Tab Styles */
.optimization-results {
    margin-top: 30px;
}

.opt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.opt-card {
    background: #1e293b;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #334155;
}

.opt-card h3 {
    margin-top: 0;
    color: #3b82f6;
    font-size: 18px;
    margin-bottom: 15px;
}

.opt-param {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #334155;
}

.opt-param:last-child {
    border-bottom: none;
}

.opt-param-label {
    color: #94a3b8;
    font-size: 14px;
}

.opt-param-value {
    color: #e2e8f0;
    font-weight: 600;
}

.opt-chart-container {
    margin: 30px 0;
    background: #1e293b;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #334155;
}

.opt-table {
    margin-top: 30px;
    overflow-x: auto;
}

.opt-table table {
    width: 100%;
    border-collapse: collapse;
    background: #1e293b;
    border-radius: 8px;
    overflow: hidden;
}

.opt-table th {
    background: #334155;
    color: #e2e8f0;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.opt-table td {
    padding: 12px;
    border-bottom: 1px solid #334155;
    color: #94a3b8;
}

.opt-table tr:hover {
    background: rgba(59, 130, 246, 0.1);
}

.opt-row-clickable {
    cursor: pointer;
    transition: background 0.2s ease;
}

.opt-row-clickable:hover {
    background: rgba(59, 130, 246, 0.2) !important;
}

.opt-row-clickable.selected-row {
    background: rgba(59, 130, 246, 0.3) !important;
    border-left: 3px solid #3b82f6;
}

/* Scanner Tab Styles */
.scanner-results {
    margin-top: 30px;
}

.scan-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.scan-stat {
    background: #1e293b;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #334155;
    text-align: center;
}

.stat-label {
    display: block;
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    color: #3b82f6;
    font-size: 32px;
    font-weight: 700;
}

.scan-table {
    margin-top: 30px;
    overflow-x: auto;
}

.scan-table table {
    width: 100%;
    border-collapse: collapse;
    background: #1e293b;
    border-radius: 8px;
    overflow: hidden;
}

.scan-table th {
    background: #334155;
    color: #e2e8f0;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.scan-table td {
    padding: 12px;
    border-bottom: 1px solid #334155;
    color: #94a3b8;
}

.scan-table tr:hover {
    background: rgba(59, 130, 246, 0.1);
    cursor: pointer;
}

/* Sortable Table Headers */
.scan-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.scan-table th.sortable:hover {
    background: #475569;
}

.signal-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.signal-badge.buy {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.signal-badge.sell {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.confidence-bar {
    width: 100%;
    height: 8px;
    background: #334155;
    border-radius: 4px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    transition: width 0.3s ease;
}

/* Loading Progress */
#scan-progress {
    color: #3b82f6;
    font-weight: 600;
}

/* Progress Bar Styles */
.progress-container {
    width: 100%;
    max-width: 600px;
    height: 30px;
    background-color: rgba(51, 65, 85, 0.3);
    border-radius: 15px;
    overflow: hidden;
    margin: 20px auto;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 15px;
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.progress-text {
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
    margin-top: 10px;
}

/* Logs Tab Styles */
.logs-container {
    margin-top: 20px;
}

.logs-info {
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 15px;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.logs-table th,
.logs-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #334155;
}

.logs-table th {
    background: rgba(51, 65, 85, 0.5);
    color: #f1f5f9;
    font-weight: 600;
}

.logs-table tr {
    cursor: pointer;
    transition: background 0.2s ease;
}

.logs-table tr:hover {
    background: rgba(59, 130, 246, 0.1);
}

.log-type-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.log-type-scan {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.log-type-signal {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.log-type-analysis {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.log-viewer {
    margin-top: 30px;
    border: 1px solid #334155;
    border-radius: 8px;
    overflow: hidden;
}

.log-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(51, 65, 85, 0.5);
    border-bottom: 1px solid #334155;
}

.log-viewer-header h3 {
    margin: 0;
    color: #f1f5f9;
    font-size: 16px;
}

.log-viewer-actions {
    display: flex;
    gap: 10px;
}

.log-content {
    padding: 20px;
    background: #0f172a;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Signal History Tab Styles */
.history-stats {
    margin-top: 20px;
}

.history-stats h2 {
    color: #f1f5f9;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #334155;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
}

.stat-icon {
    font-size: 32px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #3b82f6;
}

.stat-card .stat-label {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-section {
    margin-top: 30px;
    padding: 20px;
    background: #1e293b;
    border-radius: 12px;
    border: 1px solid #334155;
}

.history-section h3 {
    color: #f1f5f9;
    margin-top: 0;
    margin-bottom: 5px;
}

.section-description {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 20px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    background: rgba(51, 65, 85, 0.5);
    color: #f1f5f9;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.history-table td {
    padding: 12px;
    border-bottom: 1px solid #334155;
    color: #e2e8f0;
}

.history-table tr {
    cursor: pointer;
    transition: background 0.2s ease;
}

.history-table tr:hover {
    background: rgba(59, 130, 246, 0.1);
}

.clickable-row {
    cursor: pointer;
}

.mini-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
}

.mini-badge.buy {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.mini-badge.sell {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Scan Detail View */
.scan-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.scan-detail-header h3 {
    margin: 0;
}

.scan-detail-content {
    margin-top: 20px;
}

.signal-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.signal-column h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #f1f5f9;
    font-size: 16px;
}

.signal-card {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.signal-card:hover {
    background: rgba(15, 23, 42, 0.8);
    transform: translateX(4px);
}

.signal-card.buy {
    border-left-color: #10b981;
}

.signal-card.sell {
    border-left-color: #ef4444;
}

/* Stale signal styling */
.signal-item.stale {
    opacity: 0.5;
    background: #1e293b;
    border: 1px dashed #64748b;
}

.signal-item.stale .signal-icon {
    filter: grayscale(70%);
}

.stale-indicator {
    color: #64748b;
    font-size: 0.8rem;
    font-style: italic;
    margin-left: 8px;
}

.signal-rank {
    font-size: 14px;
    font-weight: 700;
    color: #64748b;
    min-width: 30px;
}

.signal-main {
    flex: 1;
}

.signal-main strong {
    display: block;
    color: #f1f5f9;
    font-size: 16px;
}

.signal-sector {
    color: #64748b;
    font-size: 12px;
}

.signal-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-size: 12px;
    color: #94a3b8;
}

.signal-conf {
    font-weight: 600;
    color: #3b82f6;
}

/* Backtest Styles */
.backtest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.backtest-header h3 {
    margin: 0;
}

.backtest-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.backtest-controls label {
    color: #94a3b8;
    font-size: 14px;
}

.backtest-controls select {
    padding: 8px 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 14px;
}

.backtest-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.backtest-stat {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    border: 1px solid #334155;
}

.backtest-stat .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #3b82f6;
    display: block;
}

.backtest-stat .stat-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
}

.backtest-stat.win .stat-value {
    color: #10b981;
}

.backtest-stat.loss .stat-value {
    color: #ef4444;
}

.backtest-table tr.positive {
    border-left: 3px solid #10b981;
}

.backtest-table tr.negative {
    border-left: 3px solid #ef4444;
}

.return-cell {
    font-weight: 600;
}

.return-cell.positive {
    color: #10b981;
}

.return-cell.negative {
    color: #ef4444;
}

.trade-highlights {
    display: flex;
    gap: 20px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.highlight-card {
    flex: 1;
    min-width: 200px;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.highlight-card.best {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.highlight-card.worst {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.highlight-label {
    font-size: 12px;
    color: #94a3b8;
}

.highlight-card strong {
    font-size: 18px;
    color: #f1f5f9;
}

.highlight-return {
    margin-left: auto;
    font-size: 18px;
    font-weight: 700;
}

.highlight-card.best .highlight-return {
    color: #10b981;
}

.highlight-card.worst .highlight-return {
    color: #ef4444;
}

/* Holding Analysis */
.holding-analysis {
    margin: 25px 0;
}

.holding-analysis h4 {
    margin-bottom: 10px;
}

.holding-table tr.best-period {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15), transparent);
    border-left: 3px solid #10b981;
}

.best-period-highlight {
    margin-top: 15px;
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    color: #10b981;
}

.best-period-highlight strong {
    color: #f1f5f9;
}

/* Confidence badge */
.conf-badge {
    display: inline-block;
    padding: 3px 8px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    color: #818cf8;
}

/* ============================================
   TOP PERFORMERS WATCHLIST STYLES
   ============================================ */

.watchlist-header {
    margin-bottom: 20px;
}

.watchlist-header h2 {
    margin: 0 0 8px 0;
    color: #f1f5f9;
}

.watchlist-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.watchlist-info {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.info-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    font-size: 14px;
    color: #94a3b8;
}

.info-badge strong {
    color: #f1f5f9;
}

.info-icon {
    font-size: 18px;
}

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

.watchlist-card {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.watchlist-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.watchlist-card.buy {
    border-left: 4px solid #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), #0f172a);
}

.watchlist-card.sell {
    border-left: 4px solid #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), #0f172a);
}

.watchlist-card.neutral {
    border-left: 4px solid #64748b;
}

.watchlist-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.watchlist-rank {
    font-size: 14px;
    font-weight: 700;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.2);
    padding: 4px 10px;
    border-radius: 20px;
}

.watchlist-symbol {
    font-size: 24px;
    font-weight: 700;
    color: #f1f5f9;
    flex: 1;
}

.watchlist-signal {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.watchlist-signal.buy {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.watchlist-signal.sell {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.watchlist-signal.neutral {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.4);
}

.watchlist-sector {
    color: #64748b;
    font-size: 13px;
    margin-bottom: 15px;
}

.watchlist-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}

.watchlist-stat {
    text-align: center;
}

.watchlist-stat .stat-label {
    display: block;
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.watchlist-stat .stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #f1f5f9;
}

.watchlist-stat .stat-value.positive {
    color: #10b981;
}

.watchlist-stat .stat-value.negative {
    color: #ef4444;
}

.watchlist-signal-detail {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #334155;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.6;
}

.watchlist-signal-detail strong {
    color: #cbd5e1;
}

.signal-date-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #334155;
}

.signal-date {
    color: #60a5fa;
    font-weight: 500;
}

.holding-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.holding-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.holding-badge.expired {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.watchlist-card.signal-expired {
    opacity: 0.7;
    border-color: #4b5563 !important;
}

.watchlist-card.signal-expired .watchlist-signal {
    background: #374151 !important;
    color: #9ca3af !important;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.empty-state p:first-child {
    font-size: 48px;
    margin-bottom: 15px;
}

.empty-state p:last-child {
    font-size: 14px;
}

/* Alert Settings */
.alert-settings {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    margin-bottom: 20px;
}

.settings-label {
    font-size: 14px;
    color: #f59e0b;
    font-weight: 600;
}

.alert-settings select {
    padding: 6px 12px;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 14px;
}

.btn-small {
    padding: 6px 14px;
    font-size: 13px;
}

.settings-status {
    font-size: 13px;
    color: #10b981;
    margin-left: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    
    .tab-btn.active {
        border-left-color: #3b82f6;
        border-bottom-color: transparent;
    }
    
    .opt-grid,
    .scan-summary,
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .signal-columns {
        grid-template-columns: 1fr;
    }
}

/* Count Input for Watchlist */
.count-input {
    width: 70px;
    padding: 8px 12px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 14px;
    text-align: center;
}

.count-input:focus {
    outline: none;
    border-color: #3b82f6;
}

/* ============================================
   WATCHLIST HISTORY STYLES
   ============================================ */

.watchlist-history-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #334155;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.history-header h3 {
    margin: 0;
    color: #f1f5f9;
    font-size: 20px;
}

.history-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.history-content {
    margin-top: 20px;
}

.history-summary {
    margin-bottom: 30px;
}

.history-summary h4 {
    color: #f1f5f9;
    margin: 0 0 8px 0;
    font-size: 16px;
}

.history-subtitle {
    color: #64748b;
    font-size: 13px;
    margin: 0 0 20px 0;
}

.history-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.history-stat-card {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-stat-card:hover {
    transform: translateY(-2px);
    border-color: #3b82f6;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
}

.stat-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.stat-card-header .stat-rank {
    font-size: 12px;
    font-weight: 600;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
}

.stat-card-header .stat-symbol {
    font-size: 18px;
    font-weight: 700;
    color: #f1f5f9;
}

.stat-card-header .stat-last-time {
    margin-left: auto;
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
}

.history-stat-card .stat-sector {
    color: #64748b;
    font-size: 12px;
    margin-bottom: 12px;
}

.stat-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.stat-item {
    text-align: center;
}

.stat-item .stat-label {
    display: block;
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.stat-item .stat-value {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
}

.stat-item .stat-value.positive {
    color: #10b981;
}

.stat-item .stat-value.negative {
    color: #ef4444;
}

.history-timeline-section {
    margin-top: 30px;
}

.history-timeline-section h4 {
    color: #f1f5f9;
    margin: 0 0 15px 0;
    font-size: 16px;
}

.timeline-entries {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-entry {
    display: flex;
    gap: 20px;
    padding: 15px;
    background: #1e293b;
    border-radius: 10px;
    border-left: 3px solid #3b82f6;
}

.timeline-date {
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.timeline-date .date {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
}

.timeline-date .time {
    font-size: 11px;
    color: #64748b;
}

.timeline-content {
    flex: 1;
}

.timeline-meta {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 8px;
}

.timeline-symbols {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.timeline-symbol {
    font-size: 13px;
    color: #cbd5e1;
}

.timeline-symbol .positive {
    color: #10b981;
}

.timeline-symbol .negative {
    color: #ef4444;
}

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

@media (max-width: 768px) {
    .history-stats-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    
    .timeline-entry {
        flex-direction: column;
        gap: 10px;
    }
    
    .timeline-date {
        flex-direction: row;
        gap: 10px;
    }
}

/* ============================================
   PORTFOLIO MANAGEMENT STYLES
   ============================================ */

.portfolio-header {
    margin-bottom: 25px;
}

.portfolio-header h2 {
    color: #f1f5f9;
    margin-bottom: 8px;
}

.portfolio-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 25px;
    padding: 20px;
    background: #1e293b;
    border-radius: 12px;
}

.portfolio-controls .control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.portfolio-controls label {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 500;
}

.portfolio-controls input,
.portfolio-controls select {
    padding: 10px 14px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 14px;
}

.portfolio-controls .symbol-input {
    width: 100px;
    text-transform: uppercase;
}

.portfolio-controls .price-input {
    width: 100px;
}

.portfolio-controls .notes-input {
    width: 200px;
}

.portfolio-controls input:focus,
.portfolio-controls select:focus {
    outline: none;
    border-color: #3b82f6;
}

.portfolio-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.summary-card {
    background: #1e293b;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.summary-label {
    display: block;
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 8px;
}

.summary-value {
    display: block;
    color: #f1f5f9;
    font-size: 24px;
    font-weight: 700;
}

.summary-value.positive {
    color: #10b981;
}

.summary-value.negative {
    color: #ef4444;
}

.portfolio-section {
    margin-bottom: 30px;
}

.portfolio-section h3 {
    color: #f1f5f9;
    margin-bottom: 15px;
    font-size: 16px;
}

.portfolio-table table {
    width: 100%;
    border-collapse: collapse;
    background: #1e293b;
    border-radius: 12px;
    overflow: hidden;
}

.portfolio-table th {
    background: #334155;
    color: #e2e8f0;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

.portfolio-table td {
    padding: 12px;
    border-bottom: 1px solid #334155;
    color: #94a3b8;
}

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

.portfolio-table tr:hover {
    background: rgba(59, 130, 246, 0.1);
}

.portfolio-table .action-buy {
    color: #10b981;
    font-weight: 600;
}

.portfolio-table .action-sell {
    color: #ef4444;
    font-weight: 600;
}

.portfolio-table .pnl-positive {
    color: #10b981;
    font-weight: 600;
}

.portfolio-table .pnl-negative {
    color: #ef4444;
    font-weight: 600;
}

.portfolio-table .close-btn {
    padding: 4px 10px;
    background: #ef4444;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.portfolio-table .close-btn:hover {
    background: #dc2626;
}

.trade-status {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.trade-status.status-open {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.trade-status.status-closed {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
}

.success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid #10b981;
    color: #10b981;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .portfolio-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .portfolio-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .portfolio-controls .notes-input {
        width: 100%;
    }
}
