/**
 * Investment Companion Dashboard - Stylesheet
 * Mobile-first responsive design with WCAG compliant colors
 */

/* ========================================
   TAB SYSTEM
   ======================================== */
.tab-container {
    background: rgba(0, 0, 0, 0.2);
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.tab-bar {
    display: flex;
    gap: 0;
    padding: 0;
    overflow-x: auto;
}

.tab-button {
    padding: 15px 25px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #aaaaaa;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-button:hover {
    color: #029D6E;
    background: rgba(2, 157, 110, 0.05);
}

.tab-button.active {
    color: #029D6E;
    border-bottom-color: #029D6E;
    background: rgba(2, 157, 110, 0.1);
}

.tab-content {
    display: none !important;
    opacity: 0;
    animation: fadeIn 0.3s ease;
    visibility: hidden;
}

.tab-content.active {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
    z-index: 1 !important;
}

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

@media (max-width: 768px) {
    .tab-bar {
        gap: 0;
    }
    
    .tab-button {
        padding: 12px 15px;
        font-size: 12px;
    }
}

/* ========================================
   DECISIONS TAB
   ======================================== */
.decisions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    color: #cccccc;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
}

.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #029D6E;
    box-shadow: 0 0 0 2px rgba(2, 157, 110, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.submit-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #029D6E, #00d4ff);
    border: none;
    border-radius: 6px;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 0;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 157, 110, 0.3);
}

.decision-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.stat-label {
    color: #aaaaaa;
    font-size: 14px;
}

.stat-value {
    color: #029D6E;
    font-weight: bold;
    font-size: 16px;
}

.decision-item {
    padding: 15px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border-left: 3px solid #029D6E;
}

.decision-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.decision-symbol {
    font-weight: bold;
    color: #029D6E;
    font-size: 16px;
}

.decision-action {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.action-ACCEPTED {
    background: rgba(2, 157, 110, 0.2);
    color: #029D6E;
}

.action-DECLINED {
    background: rgba(255, 68, 68, 0.2);
    color: #ff6b6b;
}

.action-IGNORED {
    background: rgba(170, 170, 170, 0.2);
    color: #cccccc;
}

.decision-meta {
    font-size: 12px;
    color: #aaaaaa;
    margin-top: 8px;
}

.decision-reasoning {
    margin-top: 10px;
    color: #cccccc;
    font-size: 14px;
}

@media (max-width: 768px) {
    .decisions-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   INSIGHTS TAB
   ======================================== */
.insights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.insight-card {
    padding: 15px;
    margin-bottom: 12px;
    background: rgba(2, 157, 110, 0.05);
    border-radius: 8px;
    border-left: 3px solid #029D6E;
}

.insight-title {
    font-weight: bold;
    color: #029D6E;
    margin-bottom: 8px;
}

.insight-text {
    color: #cccccc;
    font-size: 14px;
}

/* ========================================
   SETTINGS TAB
   ======================================== */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.setting-item {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item h3 {
    color: #029D6E;
    margin-bottom: 5px;
    font-size: 16px;
}

.setting-desc {
    color: #aaaaaa;
    font-size: 13px;
    margin-bottom: 10px;
}

.setting-status {
    display: flex;
    gap: 10px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active {
    background: rgba(2, 157, 110, 0.2);
    color: #029D6E;
}

.status-badge.inactive {
    background: rgba(255, 68, 68, 0.2);
    color: #ff6b6b;
}

.setting-input {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
}

.setting-btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.setting-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #029D6E;
}

.setting-btn.danger {
    background: rgba(255, 68, 68, 0.1);
    border-color: #ff4444;
}

.setting-btn.danger:hover {
    background: rgba(255, 68, 68, 0.2);
}

@media (max-width: 768px) {
    .insights-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   GLOBAL RESET & BASE STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #029D6E;
    --secondary: #00d4ff;
    --success: #029D6E;
    --warning: #ffaa00;
    --danger: #ff4444;
    --background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: #aaa;
    --border: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    padding: 0;
    min-height: 100vh;
    margin: 0;
}

header {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px 40px;
    border-bottom: 2px solid #029D6E;
    backdrop-filter: blur(10px);
    margin-bottom: 0;
    box-shadow: 0 4px 10px rgba(2, 157, 110, 0.1);
}

header h1 {
    font-size: 2em;
    background: linear-gradient(90deg, #029D6E, #00d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    margin-bottom: 5px;
}

header .subtitle {
    color: #aaa;
    font-size: 0.9em;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

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

/* Generic button styles - refresh-btn-small class has its own styles in design-system.css */
button:not(.refresh-btn-small):not(.btn-primary) {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

button:not(.refresh-btn-small):not(.btn-primary):hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button:not(.refresh-btn-small):not(.btn-primary):disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

/* AVOID rank styling */
.rank-avoid,
.suitability-badge.avoid {
    background: #c62828 !important;
    color: white !important;
    font-weight: 700;
}

.recommendation-card.avoid {
    border-left: 4px solid #c62828;
    opacity: 0.7;
}

/* ========================================
   DASHBOARD GRID (MOBILE-FIRST)
   ======================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* Tablet: 2 columns */
@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3 columns */
@media (min-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   CARD STYLING
   ======================================== */
/* Card styling - unify to insights style */
.card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card-header { padding: 16px 20px; border-bottom: 1px solid rgba(148,163,184,0.2); }
.card-content { padding: 16px 20px; flex: 1; display: block; }

/* Equal height rows within grids */
.dashboard-grid { grid-auto-rows: 1fr; align-items: stretch; }
/* .decisions-grid removed from equal-height - cards should use natural height */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; grid-auto-rows: 1fr; align-items: stretch; }

/* Responsive: stack settings grid on mobile */
@media (max-width: 768px) {
    .settings-grid { grid-template-columns: 1fr; }
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(2, 157, 110, 0.2);
    border-color: #029D6E;
}

.card-header {
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.card-header h2 {
    font-size: 1.3em;
    font-weight: bold;
    color: #029D6E;
    margin-bottom: 0;
}

.card-content {
    padding: 16px 0;
}

.card-content > *:last-child {
    margin-bottom: 0;
}

.signal-description {
    font-size: 13px;
    color: #cccccc;
    margin-top: 5px;
    font-weight: normal;
    line-height: 1.6;
}

.signal-description strong {
    color: #029D6E;
}

/* ========================================
   PORTFOLIO OVERVIEW CARD
   ======================================== */
.portfolio-value {
    text-align: center;
    margin-bottom: 24px;
}

.portfolio-value .label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.portfolio-value .value {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
}

.portfolio-metrics {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--background);
    border-radius: 8px;
}

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

.metric .value {
    font-size: 16px;
    font-weight: 600;
}

.metric .value.positive {
    color: var(--success);
}

.metric .value.negative {
    color: var(--danger);
}

.last-sync {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    justify-content: center;
}

/* ========================================
   THEME ALLOCATION CARD
   ======================================== */
.theme-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.theme-item {
    padding: 16px;
    background: var(--background);
    border-radius: 8px;
}

.theme-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.theme-name {
    font-weight: 600;
    font-size: 14px;
}

.theme-percent {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.theme-bar-container {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.theme-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.theme-bar-green {
    background: var(--success);
}

.theme-bar-orange {
    background: var(--warning);
}

.theme-bar-red {
    background: var(--danger);
}

.theme-details {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.drift {
    font-weight: 600;
}

.drift.green {
    color: var(--success);
}

.drift.orange {
    color: var(--warning);
}

.drift.red {
    color: var(--danger);
}

.theme-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ========================================
   REBALANCING ALERTS CARD
   ======================================== */
.no-alerts {
    text-align: center;
    padding: 32px 16px;
}

.check-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

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

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-item {
    padding: 12px;
    background: rgba(255, 68, 68, 0.15);
    border-left: 4px solid #ff4444;
    border-radius: 6px;
    color: #ffffff;
}

.alert-icon {
    margin-right: 4px;
    vertical-align: middle;
}

.alert-item p {
    margin: 0;
    line-height: 1.6;
    color: #ffffff;
}

.alert-item strong {
    color: #029D6E;
}

.alert-suggestions {
    margin-top: 20px;
    padding: 16px;
    background: rgba(255, 170, 0, 0.15);
    border-radius: 8px;
    border-left: 4px solid #ffaa00;
}

.alert-suggestions p {
    color: #ffffff;
    margin-bottom: 8px;
}

.suggestion-header {
    font-weight: 600;
    margin-bottom: 8px;
    color: #029D6E !important;
}

.suggestion {
    font-size: 14px;
    color: #ffffff !important;
    margin-left: 20px;
    margin-bottom: 4px;
}

.ticker-list-holder {
    margin-top: 8px;
}

.ticker-item {
    color: #cccccc;
    margin-left: 30px;
    margin-bottom: 4px;
    font-size: 13px;
}

.ticker-item strong {
    color: #029D6E;
}

.suggestion:before {
    content: "→ ";
    color: var(--warning);
}

.ticker-list-holder {
    margin-left: 20px;
    margin-top: 8px;
}

.ticker-item {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    padding-left: 8px;
    border-left: 2px solid var(--warning);
}

.ticker-item strong {
    color: var(--text-primary);
}

/* ========================================
   PORTFOLIO HISTORY
   ======================================== */
.history-card {
    grid-column: 1 / -1; /* Full width */
}

.history-section {
    margin-bottom: 24px;
}

.history-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.value-timeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-entry {
    display: flex;
    align-items: center;
    gap: 12px;
}

.timeline-date {
    width: 70px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.timeline-bar-container {
    flex: 1;
    position: relative;
    background: #e5e7eb;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.timeline-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--primary));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.timeline-value {
    position: absolute;
    right: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    z-index: 1;
}

.changes-table {
    overflow-x: auto;
}

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

thead {
    background: var(--background);
}

th {
    padding: 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: var(--background);
}

/* ========================================
   FOOTER
   ======================================== */
footer {
    margin-top: 40px;
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

footer p {
    margin-bottom: 8px;
}

.disclaimer {
    color: var(--warning);
    font-weight: 500;
    font-size: 11px;
}

.footer-info {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.no-data {
    text-align: center;
    padding: 32px;
    color: var(--text-secondary);
}

#loading-indicator {
    text-align: center;
    padding: 32px;
    color: var(--primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .card {
        padding: 16px;
    }
    
    .portfolio-value .value {
        font-size: 28px;
    }
    
    .theme-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    header h1 {
        font-size: 20px;
    }
}

/* ========================================
   TRADING SIGNALS CARD
   ======================================== */
/* .refresh-btn-small styles are defined in design-system.css to match all Run buttons */

.signal-check-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    white-space: nowrap;
}

.signal-check-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.signal-check-btn:disabled {
    background: #93c5fd;
    cursor: not-allowed;
    transform: none;
}

.signals-summary {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(2, 157, 110, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(2, 157, 110, 0.3);
}

.signals-summary p {
    color: #ffffff;
}

.signals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Signal item styles moved to insights.css to match theme performance structure */

.signal-header {
    color: #ffffff;
}

.signal-header strong {
    color: #029D6E;
}

.signal-item.signal-buy {
    border-left: 3px solid #029D6E;
}

.signal-item.signal-sell {
    border-left: 3px solid #ef4444;
}

.signal-item.signal-hold {
    border-left: 3px solid #6b7280;
}

@media (max-width: 768px) {
    .signal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .refresh-btn-small {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .trading-signals .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .signal-check-btn {
        align-self: stretch;
        padding: 12px;
    }
    
    /* Hide Total Value column in history table on mobile */
    .history-card table th:nth-child(2),
    .history-card table td:nth-child(2) {
        display: none;
    }
}

/* ========================================
   SMART REBALANCING DASHBOARD
   ======================================== */
.rebalancing-dashboard {
    max-width: 100%;
    margin: 0;
}

/* Strategy Summary */
.strategy-summary {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

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

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

.strategy-header h2 {
    margin: 0;
    font-size: 24px;
    color: #ffffff;
}

.strategy-explanation {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin: 12px 0;
}

.strategy-stats {
    display: flex;
    gap: 24px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #ffffff;
}

.stat.warning .stat-value {
    color: #ffeb3b;
}

/* Actions Container */
.actions-container {
    margin-top: 24px;
}

.actions-container h3 {
    margin-bottom: 16px;
    font-size: 20px;
    color: var(--text-primary);
}

.no-actions {
    text-align: center;
    padding: 40px;
    background: rgba(2, 157, 110, 0.1);
    border-radius: 8px;
    font-size: 18px;
    color: var(--success);
}

/* Action Card */
.action-card {
    border: none;
    border-radius: 8px;
    padding: 16px;
    margin: 0 0 16px 0;
    background: var(--background);
    transition: transform 0.2s, box-shadow 0.2s;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.action-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.action-icon-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.action-icon {
    font-size: 28px;
}

.action-priority {
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.1);
}

.action-type-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.1);
}

.action-message {
    font-size: 20px;
    margin: 12px 0;
    font-weight: 600;
    color: var(--text-primary);
}

.action-description {
    color: var(--text-secondary);
    margin: 8px 0;
    font-size: 14px;
}

.action-note {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
    display: flex;
    gap: 8px;
    align-items: start;
}

.note-icon {
    font-size: 20px;
}

/* Buy Holdings */
.buy-holdings {
    margin: 16px 0;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.buy-holdings h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.holding-row {
    display: grid;
    grid-template-columns: 80px 2fr 1fr;
    gap: 12px;
    padding: 8px;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.holding-symbol {
    font-weight: bold;
    font-size: 14px;
    color: var(--primary);
}

.holding-name {
    color: var(--text-secondary);
    font-size: 13px;
}

.holding-value {
    text-align: right;
    font-weight: 600;
}

/* Sell Details */
.sell-details {
    margin: 16px 0;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.sell-details h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.sell-row {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.sell-main {
    display: grid;
    grid-template-columns: 80px 2fr 1fr;
    gap: 12px;
    margin-bottom: 8px;
}

.sell-symbol {
    font-weight: bold;
    color: var(--primary);
}

.sell-name {
    color: var(--text-secondary);
    font-size: 13px;
}

.sell-amount {
    text-align: right;
    font-weight: 600;
}

.sell-sub {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

.sell-reason {
    color: var(--success);
}

/* Alternative */
.action-alternative {
    margin-top: 16px;
    padding: 12px;
    background: rgba(255, 200, 87, 0.1);
    border-left: 4px solid #ffc857;
    border-radius: 4px;
    display: flex;
    gap: 8px;
}

.alt-icon {
    font-size: 20px;
}

/* Options */
.action-options {
    margin: 16px 0;
}

.action-options h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.option-row {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin: 8px 0;
    cursor: pointer;
    transition: background 0.2s;
}

.option-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.option-row input[type="radio"] {
    margin-top: 2px;
}

/* Action Button */
.action-button {
    width: 100%;
    padding: 14px;
    margin-top: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.5) 0%, rgba(118, 75, 162, 0.5) 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: not-allowed;
    opacity: 0.7;
}

.action-button:hover:not(:disabled) {
    opacity: 1;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

/* Priority-specific styling */
.action-critical {
    /* No border or background - matches Theme Allocation style */
}

.action-high {
    /* No border or background - matches Theme Allocation style */
}

.action-medium {
    /* No border or background - matches Theme Allocation style */
}

.action-low {
    /* No border or background - matches Theme Allocation style */
}

.action-info {
    /* No border or background - matches Theme Allocation style */
}

/* Responsive */
@media (max-width: 768px) {
    .strategy-stats {
        flex-direction: column;
        gap: 12px;
    }
    
    .holding-row {
        grid-template-columns: 60px 1fr 80px;
    }
    
    .sell-main {
        grid-template-columns: 60px 1fr 80px;
    }
    
    .strategy-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .strategy-header h2 {
        font-size: 18px;
    }
}

/* ========================================
   PORTFOLIO STATUS CARD (Matching Theme Allocation Style)
   ======================================== */
.portfolio-status-card {
    background: var(--background);
    border: none;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
}

.status-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
    min-height: auto;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.status-icon {
    font-size: 28px;
    line-height: 1;
}

.status-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-label {
    font-size: 13px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.status-value {
    font-size: 16px;
    font-weight: 600;
    word-break: break-word;
    line-height: 1.3;
}

.status-right {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: center;
    position: relative;
}

.status-badge {
    background: rgba(2, 157, 110, 0.15);
    color: #029D6E;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(2, 157, 110, 0.3);
    text-align: center;
}

.status-badge.no-actions {
    background: rgba(2, 157, 110, 0.15);
    color: #029D6E;
    border-color: rgba(2, 157, 110, 0.3);
}

.status-badge.has-actions {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.3);
}

.info-button {
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #94a3b8;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    position: absolute;
    right: 0;
}

.info-button:hover {
    background: rgba(148, 163, 184, 0.25);
    border-color: rgba(148, 163, 184, 0.5);
    transform: scale(1.05);
}

.info-button:focus {
    outline: 2px solid rgba(148, 163, 184, 0.5);
    outline-offset: 2px;
}

.status-info {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 14px;
}

/* Legacy support for old compact status bar - compatibility only */
.rebalancing-status-bar {
    /* Deprecated - use portfolio-status-card instead */
    background: var(--background);
    border: none;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

/* Legacy support - keep old class names if used elsewhere */
.rebalancing-status-header {
    /* Deprecated - use rebalancing-status-bar instead */
    /* Duplicate styles from .rebalancing-status-bar for compatibility */
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.action-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 12px 20px;
    border-radius: 8px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.badge-count {
    display: block;
    font-size: 32px;
    font-weight: bold;
    line-height: 1;
    color: #ffffff;
}

.badge-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    opacity: 0.9;
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.9);
}

.balanced-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(34, 197, 94, 0.2);
    padding: 12px 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.balanced-icon {
    font-size: 24px;
}

.balanced-text {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

/* ========================================
   CONCENTRATION CARD (Matching Theme Allocation Style)
   ======================================== */
.concentration-card {
    background: var(--background);
    border: none;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.concentration-header {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
    min-height: auto;
}

.concentration-left {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.concentration-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.concentration-label {
    font-size: 13px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    line-height: 1.4;
    display: inline-block;
}

/* Make emoji in label smaller */
.concentration-label span {
    vertical-align: middle;
}

.concentration-right {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: center;
    position: relative;
}

.concentration-content {
    padding: 0 16px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.concentration-safe-state {
    padding: 16px;
    background: rgba(2, 157, 110, 0.08);
    border-radius: 8px;
    border: 1px solid rgba(2, 157, 110, 0.2);
    margin-top: 16px;
    width: 100%;
    box-sizing: border-box;
}

.concentration-safe-state .safe-icon {
    font-size: 32px;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
    margin-right: 12px;
    white-space: nowrap;
}

.concentration-safe-state .safe-text {
    display: inline-block;
    vertical-align: middle;
    white-space: nowrap;
}

.concentration-safe-state .safe-text strong {
    display: inline;
    color: #029D6E;
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.concentration-safe-state .safe-description {
    margin: 12px 0 0 0;
    padding: 0;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
    display: block;
    width: 100%;
}

.concentration-info-section {
    margin-top: 20px;
    padding: 16px;
    background: rgba(148, 163, 184, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.concentration-info-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #e2e8f0;
}

.concentration-info-section ul {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    line-height: 1.8;
}

.concentration-info-section li {
    margin-bottom: 8px;
    color: #cbd5e1;
}

.concentration-info-section p {
    margin: 0;
    color: #cbd5e1;
    font-size: 13px;
}

/* Legacy support for old concentration section - compatibility only */
.concentration-section {
    /* Deprecated - use concentration-card instead */
    background: var(--background);
    border: none;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.concentration-badge {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.concentration-badge.safe {
    background: rgba(2, 157, 110, 0.15);
    color: #029D6E;
    border: 1px solid rgba(2, 157, 110, 0.3);
}

.concentration-badge.warning {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.concentration-badge.danger {
    background: rgba(245, 101, 101, 0.15);
    color: #f56565;
    border: 1px solid rgba(245, 101, 101, 0.3);
}

/* Concentration Alerts List */
.concentration-alerts-list {
    margin-bottom: 20px;
}

.concentration-alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 2px solid;
}

.concentration-alert.alert-warning {
    background: rgba(237, 137, 54, 0.1);
    border-color: #ed8936;
}

.concentration-alert.alert-danger {
    background: rgba(245, 101, 101, 0.1);
    border-color: #f56565;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.alert-stock {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.alert-symbol {
    font-size: 18px;
    font-weight: bold;
    color: #e2e8f0;
}

.alert-name {
    font-size: 13px;
    color: #94a3b8;
}

.alert-metrics {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.alert-percent {
    font-size: 24px;
    font-weight: bold;
    color: #f56565;
}

.alert-value {
    font-size: 13px;
    color: #94a3b8;
}

.alert-body {
    font-size: 14px;
}

.alert-message {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: #e2e8f0;
}

.alert-performance {
    margin: 8px 0;
    font-size: 13px;
    font-weight: 600;
}

.alert-recommendation {
    margin: 12px 0;
    padding: 12px;
    background: rgba(148, 163, 184, 0.05);
    border-radius: 4px;
    color: #cbd5e1;
}

.alert-warning {
    margin-top: 12px;
    padding: 12px;
    background: rgba(148, 163, 184, 0.05);
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: #cbd5e1;
}

/* Portfolio Status Card uses mobile layout on all screen sizes (already set above) */
/* Concentration Card uses mobile layout on all screen sizes (matches Portfolio Status) */

.concentration-info-button {
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #94a3b8;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    position: absolute;
    right: 0;
}

.concentration-info-button:hover {
    background: rgba(148, 163, 184, 0.25);
    border-color: rgba(148, 163, 184, 0.5);
    transform: scale(1.05);
}

.concentration-info-button:focus {
    outline: 2px solid rgba(148, 163, 184, 0.5);
    outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .portfolio-status-card {
        padding: 16px 20px;
    }
    
    .concentration-card {
        padding: 0;
    }
    
    .concentration-header {
        padding: 16px 20px;
    }
    
    .concentration-content {
        padding: 0 20px 20px 20px;
    }
    
    .alert-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .alert-metrics {
        align-items: flex-start;
    }
}

/* Navigation (multi-page) - Hierarchical with dropdowns - Matching dashboard tabs */
/* Z-INDEX FIX: Navigation must be high to establish stacking context */
.main-nav,
nav,
header nav {
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000 !important; /* FIXED: Higher z-index for nav */
    width: 100%;
    overflow: hidden; /* Prevent horizontal scroll */
}

.nav-container {
    display: flex;
    gap: 0;
    align-items: center; /* FIXED: Center items vertically */
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    position: relative;
    overflow-x: auto; /* Allow scrolling only within container */
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    min-height: 50px; /* FIXED: Ensure consistent height */
}

/* Custom scrollbar for webkit browsers */
.nav-container::-webkit-scrollbar {
    height: 4px;
}

.nav-container::-webkit-scrollbar-track {
    background: transparent;
}

.nav-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.nav-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Mobile menu toggle button - FIXED visibility and positioning */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #aaaaaa;
    font-size: 24px;
    padding: 12px 16px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    position: absolute; /* FIXED: Position absolutely */
    top: 0;
    left: 0;
    z-index: 10001; /* FIXED: Higher than nav container */
    height: 50px; /* FIXED: Match nav height */
}

.mobile-menu-toggle:hover {
    color: #029D6E;
}

.mobile-menu-toggle .hamburger-icon {
    display: block;
}

/* Navigation links - Matching dashboard tab style - FIXED ALIGNMENT */
.nav-link {
    display: flex;
    align-items: center; /* FIXED: Ensure vertical centering */
    justify-content: flex-start; /* FIXED: Align content to start */
    gap: 8px;
    padding: 15px 25px;
    background: transparent !important;
    color: #aaaaaa !important;
    text-decoration: none;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0 !important;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    cursor: pointer;
    flex-shrink: 0; /* Prevent items from shrinking */
    height: 100%; /* FIXED: Full height for alignment */
    line-height: 1; /* FIXED: Consistent line height */
}

.nav-link:hover { 
    color: #029D6E !important; 
    background: rgba(2, 157, 110, 0.05) !important; 
}

.nav-link.active { 
    color: #029D6E !important; 
    border-bottom-color: #029D6E !important; 
    background: rgba(2, 157, 110, 0.1) !important; 
}

.nav-link.active .nav-icon,
.nav-link.active .nav-label {
    color: #029D6E !important;
}

.nav-link:hover .nav-icon,
.nav-link:hover .nav-label {
    color: #029D6E !important;
}

.nav-icon { 
    font-size: 18px; 
    flex-shrink: 0;
}

/* Navigation groups with dropdowns - Z-INDEX FIX */
.nav-group,
.nav-group.dropdown,
.dropdown,
.nav-item.dropdown {
    position: relative;
    z-index: 1001 !important; /* FIXED: Higher than nav container */
}

.nav-group-toggle,
.nav-group-toggle.dropdown-toggle,
.dropdown-toggle {
    display: flex;
    align-items: center; /* FIXED: Ensure vertical centering */
    justify-content: flex-start; /* FIXED: Align content to start */
    gap: 8px;
    padding: 15px 25px;
    background: transparent !important;
    color: #aaaaaa !important;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0 !important;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s ease;
    font-family: inherit;
    position: relative;
    flex-shrink: 0; /* Prevent items from shrinking */
    height: 100%; /* FIXED: Full height for alignment */
    line-height: 1; /* FIXED: Consistent line height */
}

.nav-group-toggle:hover {
    color: #029D6E !important;
    background: rgba(2, 157, 110, 0.05) !important;
}

.nav-group-toggle.active {
    color: #029D6E !important;
    border-bottom-color: #029D6E !important;
    background: rgba(2, 157, 110, 0.1) !important;
}

.nav-group-toggle.active .nav-icon,
.nav-group-toggle.active .nav-label {
    color: #029D6E !important;
}

.nav-group-toggle:hover .nav-icon,
.nav-group-toggle:hover .nav-label {
    color: #029D6E !important;
}

.dropdown-arrow {
    font-size: 10px;
    margin-left: 4px;
    transition: transform 0.3s ease;
    opacity: 0.7;
}

.nav-group.open .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown menu - Z-INDEX FIX: Highest priority to appear above content */
.nav-dropdown,
.nav-dropdown.dropdown-menu,
.dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    left: 0;
    margin-top: 2px; /* Small gap */
    background: rgba(15, 23, 42, 0.98) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 8px 8px;
    min-width: 200px;
    max-width: 300px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9999 !important; /* FIXED: Very high z-index to be above everything */
    padding: 8px 0;
    pointer-events: none; /* FIXED: Prevent interaction when hidden */
    display: none; /* Standard dropdown hidden state */
}

.nav-group.open .nav-dropdown,
.nav-group.open .dropdown-menu,
.dropdown.open .dropdown-menu,
.dropdown-menu.show,
.nav-dropdown.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0);
    pointer-events: auto !important; /* FIXED: Enable interaction when visible */
    display: block !important; /* Standard dropdown show state */
    z-index: 9999 !important; /* FIXED: Ensure highest z-index when shown */
}

/* Removed duplicate - now handled above */

.nav-dropdown-link,
.nav-dropdown-link.dropdown-item,
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent !important;
    color: #aaaaaa !important;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    z-index: 10000 !important; /* FIXED: Highest z-index for dropdown items */
    pointer-events: auto !important; /* FIXED: Ensure clickable */
}

.nav-dropdown-link:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.nav-dropdown-link.active {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1) !important;
    font-weight: 600;
}

.nav-dropdown-link:hover .nav-icon,
.nav-dropdown-link:hover .nav-label {
    color: #ffffff !important;
}

.nav-dropdown-link.active .nav-icon,
.nav-dropdown-link.active .nav-label {
    color: #ffffff !important;
}

.nav-dropdown-link .nav-icon {
    font-size: 16px;
}

/* Navigation badge styles */
.nav-link .badge,
.nav-dropdown-link .badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: #ffffff;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    padding: 0 4px;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.nav-link .badge:empty,
.nav-dropdown-link .badge:empty {
    display: none;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
}

/* Constrain header and content to same width */
.site-header .header-content { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

/* Z-INDEX FIX: Content must have lower z-index than navigation */
/* PADDING FIX: Minimal spacing - Portfolio starts immediately below nav */
.main-content,
.dashboard-content,
.content-wrapper,
main,
.dashboard-grid,
.insights-grid {
    position: relative;
    z-index: 1 !important; /* FIXED: Much lower than nav (1000) and sidebar (2000) */
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    padding-top: 20px !important; /* FIXED: Minimal spacing - just 20px from nav */
    margin-top: 0 !important;
}

/* Z-INDEX FIX: Cards and other content elements */
.card,
.portfolio-card,
.stat-card,
.insight-card {
    position: relative;
    z-index: 2 !important; /* FIXED: Still lower than nav */
}

/* Z-INDEX FIX: Charts and interactive elements */
.chart-container,
canvas,
.chart-wrapper {
    position: relative;
    z-index: 3 !important; /* FIXED: Still lower than nav */
}

/* Responsive navigation - reduce padding on smaller screens */
@media (max-width: 1200px) {
    .nav-link,
    .nav-group-toggle {
        padding: 15px 20px;
        font-size: 13px;
    }
}

@media (max-width: 1024px) {
    .nav-link,
    .nav-group-toggle {
        padding: 15px 16px;
        font-size: 13px;
    }
    
    .nav-label {
        font-size: 13px;
    }
}

/* Mobile styles - FIXED mobile menu */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex !important; /* FIXED: Force display on mobile */
        position: fixed !important; /* FIXED: Fixed positioning */
        top: 0 !important;
        left: 0 !important;
        z-index: 10002 !important; /* FIXED: Highest z-index */
        background: rgba(0, 0, 0, 0.5) !important; /* FIXED: Visible background */
        backdrop-filter: blur(10px) !important;
    }
    
    .main-nav {
        position: relative; /* FIXED: Allow mobile toggle to position correctly */
    }
    
    .nav-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background: rgba(15, 23, 42, 0.98);
        backdrop-filter: blur(20px);
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        flex-direction: column;
        align-items: stretch;
        padding: 60px 0 20px 0; /* FIXED: Add top padding for toggle button */
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 10001; /* FIXED: High z-index */
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.3);
    }
    
    .nav-container.mobile-open {
        transform: translateX(0) !important; /* FIXED: Force visible */
    }
    
    .mobile-menu-overlay {
        display: block !important; /* FIXED: Force display */
    }
    
    .nav-link,
    .nav-group-toggle {
        padding: 16px 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        border-left: 3px solid transparent;
        width: 100%;
        justify-content: flex-start;
    }
    
    .nav-link.active,
    .nav-group-toggle.active {
        border-left-color: #029D6E;
        border-bottom-color: rgba(255, 255, 255, 0.05);
    }
    
    .nav-label {
        display: block;
    }
    
    .nav-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: rgba(0, 0, 0, 0.3);
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
        margin-left: 20px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .nav-group.open .nav-dropdown {
        max-height: 500px;
    }
    
    .nav-dropdown-link {
        padding: 12px 20px 12px 40px;
    }
    
    .dropdown-arrow {
        margin-left: auto;
    }
    
    .main-content { 
        padding: 16px; 
    }
}

/* Prevent body scroll when menu open - FIXED */
body.menu-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}

/* Dark theme selects - ensure dropdown options are visible */
.form-group select {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}
.form-group select option {
    background-color: #0f172a;
    color: #e2e8f0;
}
.form-group select option:checked {
    background-color: #1e293b;
    color: #ffffff;
}

/* Decisions grid layout */
.decisions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start; /* Changed from stretch - cards use natural height */
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Decisions page: stack and natural height */
.decisions-grid { grid-template-columns: 1fr; }
/* Removed old .card rules - decision sections now use .insight-card structure */

/* Compact stat grid spacing inside Decision Stats */
.stat-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); 
    gap: 12px; 
    margin-bottom: 0;
}

/* Normalize card header/content on all pages */
.card-header h2 { margin: 0; font-size: 18px; font-weight: 600; color: #22c55e; }
.card-content p.no-data { color: #94a3b8; }

/* Form inputs (text/number) to match dark theme */
.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
}

.form-group input[type="text"]::placeholder,
.form-group input[type="number"]::placeholder {
    color: #94a3b8;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus {
    outline: none;
    border-color: #029D6E;
    box-shadow: 0 0 0 2px rgba(2, 157, 110, 0.2);
}

/* Label tone */
.form-group label { color: #e2e8f0; font-weight: 500; margin-bottom: 6px; display: block; }

/* Site logo */
.site-logo { height: 36px; width: auto; display: block; }
@media (max-width: 768px) { .site-logo { height: 30px; } }

/* Brand link (logo + name) */
.brand { display:flex; align-items:center; gap:10px; text-decoration:none; }
.brand-name { color: var(--text-primary); font-weight: 600; font-size: 18px; letter-spacing: 0.2px; }
@media (max-width: 768px) { .brand-name { display:none; } }

/* Entry Points */
.stats-grid .stat-card { display:flex; flex-direction:column; gap:6px; }
.stats-grid .stat-label { color: var(--text-secondary, #9aa0a6); font-size: 12px; }
.stats-grid .stat-value { color: var(--text-primary, #e5fbe5); font-weight: 700; font-size: 22px; }
.opportunity-card { border-left: 4px solid rgba(0,255,127,0.35); }

/* Utilities for new pages */
.form-row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.text-input { padding:8px 10px; border-radius:8px; border:1px solid var(--border-color, #2a2a2a); background:#0e0e0e; color:var(--text-primary, #e6e6e6); }
.code-block { margin-top:12px; white-space:pre-wrap; max-height:420px; overflow:auto; background:#0b0b0b; color:#bde3bd; padding:12px; border-radius:8px; }

/* Entry Points layout */
.stats-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:12px; margin-bottom:20px; }
.opportunities-grid { display:grid; grid-template-columns:1fr; gap:16px; }
.empty-state { text-align:center; }
.empty-state .empty-emoji { font-size:36px; }

/* Card content rhythm for new pages */
.card .card-title { margin: 0 0 8px 0; font-weight: 700; }
.card .card-subtitle { margin: 0 0 10px 0; color: var(--text-secondary, #9aa0a6); font-size: 14px; }
.card .card-meta { margin: 6px 0 0 0; color: var(--text-secondary, #9aa0a6); font-size: 12px; }
.card .card-meta.warning { color: #ffb3b3; }

/* Consistent controls */
.form-row label { font-size: 14px; color: var(--text-secondary, #9aa0a6); }
.text-input { height: 36px; line-height: 36px; }
/* .btn-primary styles are defined in insights.css to match refresh-btn-small */

/* Layout tweaks for entry points */
.stats-grid { margin-bottom: 16px; }
.opportunities-grid { gap: 12px; }
.empty-state { padding: 28px; }

/* Status grid for API Test */
.status-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:12px; margin-bottom:16px; }
.status-card { display:flex; flex-direction:column; gap:6px; }
.status-card .status-label { color: var(--text-secondary, #9aa0a6); font-size: 12px; }
.status-card .status-value { color: var(--text-primary, #e5fbe5); font-weight: 700; font-size: 16px; }

