/* CSS Custom Properties for Theming */
:root {
    /* Light theme colors */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --bg-accent: #e9ecef;
    --text-primary: #333333;
    --text-secondary: #6c757d;
    --text-muted: #9ca3af;
    --border-color: #e9ecef;
    --border-light: #f1f3f4;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    
    /* Brand colors (consistent across themes) */
    --primary: #0ea5e9;
    --primary-hover: #0284c7;
    --success: #22c55e;
    --success-hover: #16a34a;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --info: #3b82f6;
}

/* Dark theme colors */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #404040;
    --bg-accent: #525252;
    --text-primary: #ffffff;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #525252;
    --border-light: #404040;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }

p {
    margin-bottom: 1rem;
}

/* Layout */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 0.75rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.header.scrolled {
    padding: 0.5rem 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

/* Mobile optimizations for sticky header */
@media (max-width: 767px) {
    .header {
        padding: 0.5rem 0;
    }
    
    .header.scrolled {
        padding: 0.375rem 0;
    }
    
    .app-title {
        font-size: 1.25rem;
    }
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.app-title {
    text-align: center;
    font-size: 1.8rem;
    margin: 0;
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.portfolio-selector select {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.sidebar {
    display: none;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 44px;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

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

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

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    min-height: 44px;
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

/* Specific styling for new portfolio form */
.new-portfolio-form input[type="text"],
#newPortfolioName {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-color) !important;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Portfolio Sections */
.portfolio-section,
.new-portfolio-section,
.api-setup-section,
.welcome-section {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow);
    color: var(--text-primary);
}

/* Privacy Notice */
.privacy-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f9ff 100%);
    border: 1px solid #d1fae5;
    border-radius: 8px;
    padding: 1rem;
    margin: 1.5rem 0 2rem 0;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
}

.privacy-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.privacy-content {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #065f46;
}

.privacy-content strong {
    color: #047857;
    font-weight: 600;
}

/* Portfolio Management Content Spacing */
.portfolio-management-content {
    margin-top: 0;
}

.portfolio-management-content .section-header {
    margin-bottom: 2rem;
}

/* Two Column Portfolio Workspace */
.portfolio-workspace {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.portfolio-inputs-column {
    flex: 2;
    min-width: 0; /* Allow column to shrink */
}

.portfolio-recommendations-column {
    flex: 1;
    min-width: 300px;
    position: sticky;
    top: 2rem; /* Stick to top when scrolling */
}

/* Rebalancing Section Styling */
.portfolio-recommendations-column .rebalancing-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.portfolio-recommendations-column .rebalancing-section h3 {
    color: #374151;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

/* Compact Rebalancing Interface */
.rebalance-section-compact {
    text-align: center;
}

.sidebar-intro {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

.cash-input-compact {
    margin-bottom: 1rem;
}

.compact-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.compact-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.current-amount {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.btn-compact {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Compact Results */
.results-compact {
    margin-top: 1rem;
}

.compact-summary {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.summary-item:last-child {
    margin-bottom: 0;
}

.summary-item .label {
    font-size: 0.85rem;
    color: #6b7280;
}

.summary-item .value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

/* Cash Change Compact */
.cash-change-compact {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.change-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1d4ed8;
}

.new-amount {
    font-size: 0.8rem;
    color: #374151;
}

/* Recommendations List */
.recommendations-list {
    margin-top: 1rem;
}

/* Phase Headers for Order of Operations */
.phase-header {
    margin: 1.5rem 0 1rem 0;
    padding: 0.75rem;
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.phase-header:first-child {
    margin-top: 0;
}

.phase-header h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.phase-description {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Portfolio Preview Styles */
.portfolio-preview {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 1px 3px var(--shadow);
}

.portfolio-preview h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.preview-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preview-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr 0.8fr;
    gap: 1rem;
    padding: 0.5rem 0.25rem;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    align-items: center;
}

.preview-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr 0.8fr;
    gap: 1rem;
    padding: 0.5rem 0.25rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
    align-items: center;
}

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

.preview-ticker {
    font-weight: 600;
    color: var(--text-primary);
}

.preview-shares {
    text-align: right;
    color: var(--text-secondary);
}

.preview-value {
    text-align: right;
    font-weight: 500;
    color: var(--text-primary);
}

.preview-percent {
    text-align: right;
    font-weight: 500;
    color: var(--primary);
}

.preview-total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
    text-align: right;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* Responsive adjustments for preview table */
@media (max-width: 768px) {
    .preview-header,
    .preview-row {
        grid-template-columns: 1.5fr 0.8fr 1.2fr 0.8fr;
        gap: 0.5rem;
        font-size: 0.8rem;
    }
}

.rec-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.rec-item.buy {
    border-left: 3px solid #10b981;
}

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

.rec-item.cash {
    border-left: 3px solid #f59e0b;
}

.rec-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.rec-icon {
    font-size: 1rem;
}

.rec-ticker {
    font-weight: 600;
    font-size: 0.9rem;
    color: #374151;
    flex-grow: 1;
    text-align: left;
    margin-left: 0.5rem;
}

.rec-amount {
    font-size: 0.85rem;
    font-weight: 600;
    color: #059669;
}

.rec-action {
    font-size: 0.8rem;
    color: #6b7280;
    text-align: left;
}

.rec-allocation {
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: left;
    margin-top: 0.25rem;
}

/* ===== NEW MODERN PORTFOLIO DASHBOARD ===== */

/* Override section styles for new dashboard */
.portfolio-section {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    max-width: none !important;
}

/* Portfolio Dashboard Container */
.portfolio-dashboard {
    max-width: 1300px;
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.portfolio-title h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.portfolio-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-icon {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--bg-accent);
    transform: translateY(-1px);
    color: var(--text-primary);
}

.btn-danger-icon {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger-icon:hover {
    background: var(--bg-accent);
    border-color: var(--danger-hover);
    color: var(--danger-hover);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stat-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.stat-icon {
    font-size: 1.5rem;
    opacity: 0.7;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.125rem;
}

/* Primary Action Card */
.primary-action-card {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.action-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.action-subtitle {
    opacity: 0.9;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* Modern Form */
.modern-form .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    align-items: end;
}

.modern-form .form-grid .form-field:last-child {
    grid-column: 1 / -1;
    margin-top: 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.5rem;
}

.form-field input,
.form-field select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.75rem;
    color: white;
    font-size: 1rem;
    backdrop-filter: blur(10px);
}

.form-field input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.btn-large {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.btn-large:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Holdings Section */
.holdings-section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.holdings-list {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

/* Cash Cards */
.cash-position-card,
.add-cash-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.cash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.cash-actions {
    display: flex;
    gap: 0.5rem;
}

.add-cash-prompt {
    text-align: center;
}

.add-cash-prompt h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.add-cash-prompt p {
    color: #6b7280;
    margin-bottom: 1rem;
}

.btn-outline {
    background: transparent;
    border: 2px solid #3b82f6;
    color: #3b82f6;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-1px);
}

/* Cash Form */
.cash-form .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.cash-form .form-field label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.cash-form .form-field input,
.cash-form .form-field select {
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.75rem;
    color: #111827;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Rebalancing Card */
.rebalancing-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.rebalancing-header {
    margin-bottom: 1rem;
}

.rebalancing-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.rebalancing-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.rebalancing-prompt {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.prompt-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .header-actions {
        justify-content: space-between;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .modern-form .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .cash-form .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        justify-content: stretch;
    }
    
    .form-actions .btn {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .portfolio-dashboard {
        padding: 0.75rem 0.5rem 1rem;
    }
}

/* Holding Cards */
.holding-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s;
}

.holding-card:last-child {
    border-bottom: 1px solid #e5e7eb;
    border-radius: 0 0 12px 12px;
}

.holding-card:first-child {
    border-radius: 12px 12px 0 0;
}

.holding-card:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.holding-header {
    flex: 0 0 200px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.holding-info {
    flex: 1;
}

.holding-ticker {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.25rem;
}

.holding-company-name {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
    line-height: 1.2;
}

.holding-value {
    font-size: 0.875rem;
    color: #059669;
    font-weight: 600;
    flex-shrink: 0;
}

.holding-details {
    flex: 1;
    min-width: 0;
}

.holding-shares {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.holding-allocation {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.allocation-bar {
    position: relative;
    height: 6px;
    background: #f3f4f6;
    border-radius: 3px;
    overflow: hidden;
}

.allocation-current {
    height: 100%;
    background: #3b82f6;
    border-radius: 3px;
    transition: width 0.3s;
}

.allocation-target {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: #ef4444;
    transform: translateX(-1px);
}

.allocation-text {
    font-size: 0.75rem;
    color: #6b7280;
}

.holding-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-sm {
    padding: 0.25rem;
    font-size: 0.875rem;
}

/* Cash Display Updates */
.cash-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-top: 1rem;
}

.cash-amount-large {
    font-size: 1.25rem;
    font-weight: 700;
    color: #059669;
}

.cash-allocation-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Responsive Updates */
@media (max-width: 768px) {
    .holding-card {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .holding-header {
        flex: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .holding-actions {
        align-self: center;
    }
}

.portfolio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.portfolio-actions {
    display: flex;
    gap: 0.5rem;
}

.input-section,
.cash-section,
.portfolio-display,
.rebalancing-section {
    margin-bottom: 2rem;
}

/* Tables */
.portfolio-table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
}

/* Editable table cells */
.editable-shares,
.editable-allocation {
    position: relative;
}

/* Legacy editable cell styles - kept for backward compatibility */

.price-override-indicator {
    color: var(--text-secondary);
    font-weight: bold;
    margin-left: 2px;
}

/* Holding detail rows for inline editing */
.holding-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.detail-label {
    font-weight: 500;
    color: #64748b;
    font-size: 0.875rem;
}

.holding-detail-row .editable-cell {
    margin-left: auto;
    min-width: 80px;
    text-align: right;
    padding: 0.25rem 0.5rem;
}

.holding-detail-row .edit-input {
    width: 80px;
    text-align: right;
}

/* Enhanced editable cell styling for table format */
.editable-cell {
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    padding: 0.25rem 0.5rem;
    margin: -0.25rem -0.5rem;
    min-height: 32px;
    display: flex;
    align-items: center;
    color: var(--text-primary) !important;
    position: relative;
}

/* Ensure italicized editable text also stays black */
.editable-cell .price-override-indicator,
.editable-cell .manual-price-indicator {
    color: var(--text-secondary) !important;
    font-style: italic;
}

.editable-cell::after {
    content: "";
    width: 1.25rem; /* Reserve space for pencil */
    flex-shrink: 0;
}

.editable-cell:hover {
    background-color: var(--bg-accent);
}

.editable-cell:hover::after {
    content: "✏️";
    font-size: 0.75rem;
    opacity: 0.6;
    width: 1.25rem; /* Same reserved space */
    flex-shrink: 0;
    text-align: center;
}

/* Hide pencil when checkmark is present */
.editable-cell.has-checkmark:hover::after {
    display: none;
}

.editable-cell.editing {
    background-color: var(--bg-tertiary);
}

.editable-cell.editing::after {
    display: none;
}

/* Success checkmark for updated cells */
.success-checkmark {
    color: #10b981;
    font-size: 0.875rem;
    opacity: 1;
    transition: opacity 0.3s ease;
    animation: checkmarkFadeIn 0.3s ease-in;
    width: 1.25rem; /* Same reserved space as pencil */
    flex-shrink: 0;
    text-align: center;
    position: absolute;
    right: 0.25rem;
}

.success-checkmark.fade-out {
    opacity: 0;
}

@keyframes checkmarkFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Green highlight fade for newly added holdings */
.holdings-table .newly-added {
    animation: newHoldingHighlight 2.5s ease-out;
}

@keyframes newHoldingHighlight {
    0% {
        background-color: #d1fae5; /* Light green */
    }
    100% {
        background-color: transparent;
    }
}

.edit-input {
    border: none;
    background: transparent;
    font-weight: inherit;
    color: inherit;
    outline: none;
    width: 100%;
    font-size: inherit;
    padding: 0.25rem;
}

.edit-input:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.holding-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.edit-controls {
    display: flex;
    gap: 0.5rem;
}

/* Responsive table actions */
@media (max-width: 768px) {
    .holding-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .edit-controls {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Allocation warning */
.allocation-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem;
    color: #856404;
}

/* Dark mode allocation warning */
[data-theme="dark"] .allocation-warning {
    background: #3d2914;
    border: 1px solid #d97706;
    color: #fbbf24;
}

.warning-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.warning-icon {
    font-size: 1.2rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-height: auto;
}

.portfolio-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.portfolio-table th,
.portfolio-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
}

.portfolio-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.portfolio-table tbody tr:hover {
    background: #f8f9fa;
}

/* Rebalancing Results */
.rebalancing-results {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.rebalancing-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #e1e8ed;
}

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

.rebalancing-action {
    font-weight: 600;
}

.buy { color: #27ae60; }
.sell { color: #e74c3c; }
.hold { color: #95a5a6; }

/* Google Ads */
.ad-banner,
.ad-sidebar,
.ad-footer {
    background: #f1f3f4;
    border: 2px dashed #dadce0;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    color: #5f6368;
    font-size: 0.875rem;
    margin: 1rem 0;
}

.ad-placeholder {
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 4px;
}

/* Loading and Modals */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--border-color);
}

/* New Dashboard Layout */
.portfolio-overview {
    margin-bottom: 1rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-top: 1.25rem;
}

.portfolio-management, .rebalancing-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Quick Actions Card */
.quick-actions-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border-color);
}

.actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.actions-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1.1rem;
    font-weight: 600;
}

.quick-action {
    margin-bottom: 1rem;
}

.quick-action:last-child {
    margin-bottom: 0;
}

/* Compact Forms */
.compact-form {
    margin-top: 0.75rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    align-items: end;
}

.form-row input, .form-row select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
}

.form-row button {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

/* Holdings Input Table Styles */
.holdings-input-table {
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.table-header h4 {
    margin: 0;
    color: #374151;
    font-size: 1rem;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.input-table-container {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.holdings-input-table-element {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.holdings-input-table-element th {
    background: var(--bg-accent);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.holdings-input-table-element th:last-child {
    width: 60px;
    text-align: center;
}

.holdings-input-table-element td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.holdings-input-table-element tr:last-child td {
    border-bottom: none;
}

.holdings-input-table-element tr:hover {
    background: var(--bg-accent);
}

.table-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.875rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.table-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.table-input.error {
    border-color: #ef4444;
    background: #fef2f2;
}

.table-input.success {
    border-color: #10b981;
    background: #f0fdf4;
}

.remove-row-btn {
    padding: 0.25rem;
    border: none;
    border-radius: 4px;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.875rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.remove-row-btn:hover {
    background: #ef4444;
    color: white;
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
}

.help-text {
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
}

.validation-error {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Rate Limit Modal Styles */
.rate-limit-modal {
    max-width: 500px;
    width: 90%;
}

.rate-limit-content {
    text-align: center;
}

.rate-limit-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.rate-limit-details {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    color: #92400e;
    font-size: 0.875rem;
}

/* Dark mode modal styles */
[data-theme="dark"] .rate-limit-details {
    background: #3d2914;
    border: 1px solid #d97706;
    color: #fbbf24;
}

.rate-limit-solutions {
    text-align: left;
    margin: 1.5rem 0;
    background: #f0f9ff;
    border-radius: 8px;
    padding: 1rem;
}

.rate-limit-solutions h4 {
    margin: 0 0 0.75rem 0;
    color: #1e40af;
    font-size: 1rem;
}

.rate-limit-solutions ul {
    margin: 0;
    padding-left: 1.5rem;
}

.rate-limit-solutions li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.rate-limit-tip {
    background: #ecfdf5;
    border: 1px solid #10b981;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.rate-limit-tip p {
    margin: 0;
    color: #065f46;
    font-size: 0.875rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.modal-actions .btn {
    flex: 1;
    max-width: 160px;
}

/* Custom modal styling improvements */
.modal h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.modal-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Holdings Summary Card */
.holdings-summary-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.summary-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1.1rem;
    font-weight: 600;
}

.holdings-summary {
    /* Allow natural height expansion without scrolling */
}

.holdings-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

/* Add Holding Row Styles */
.add-holding-trigger, 
.add-holding-trigger-label {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
}

.add-holding-trigger:focus,
.add-holding-trigger-label:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    background: var(--bg-accent);
}

.add-holding-trigger:hover,
.add-holding-trigger-label:hover {
    background: var(--bg-accent);
    transform: translateY(-1px);
}

.add-holding-trigger:active,
.add-holding-trigger-label:active {
    transform: translateY(0);
}

.add-holding-icon {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(14, 165, 233, 0.1);
}

.add-holding-label {
    color: var(--primary);
    font-weight: 500;
}

.add-holding-row {
    transition: background-color 0.2s ease;
}

.add-holding-row:hover {
    background-color: var(--bg-accent);
}

.add-holding-row.editing {
    background-color: var(--bg-tertiary);
}

.add-holding-row.editing .add-holding-trigger,
.add-holding-row.editing .add-holding-trigger-label,
.add-holding-row.editing .add-placeholder {
    display: none;
}

/* Form validation and error styles */
.field-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.25rem;
    font-weight: 500;
}

.add-input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}

.add-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}

.add-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.add-actions .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    min-width: auto;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Allocations Card (Consolidated) */
.allocations-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border-color);
}

.allocations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.allocations-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

.allocation-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.allocation-actions button {
    flex: 1;
    min-width: 140px;
}

/* Cash Form Styles */
.cash-form {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.form-header {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.form-header h4 {
    margin: 0;
    color: #374151;
    font-size: 1rem;
}

.form-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.form-actions button {
    flex: 1;
    min-width: 120px;
}

.empty-holdings {
    text-align: center;
    color: #6b7280;
    padding: 2rem 0;
}

.holding-summary-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.holding-summary-item:hover {
    background-color: #f8fafc;
    border-radius: 8px;
    margin: 0 -1rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

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

.holding-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.holding-main {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.holding-ticker {
    font-weight: 700;
    color: #0f172a;
    font-size: 1.125rem;
    letter-spacing: -0.025em;
}

.holding-name {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
    margin: 0;
}

.holding-price-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.25rem 0;
}

.price-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
    min-width: 45px;
}

.holding-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-top: 0.125rem;
}

.shares-info, .value-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.price-display {
    font-weight: 600;
    color: #059669;
}

.manual-price-indicator {
    font-size: 0.75rem;
    margin-left: 0.25rem;
    opacity: 0.7;
}

.edit-price {
    opacity: 0.6;
    font-size: 0.75rem;
    padding: 0.2rem;
}

.edit-price:hover {
    opacity: 1;
}

.price-edit-form {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.5rem;
}

.price-input {
    width: 80px;
    padding: 0.25rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.8rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.btn-sm.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-sm.btn-secondary {
    background: #6b7280;
    color: white;
}

.price-label {
    color: #6b7280;
    font-size: 0.75rem;
    margin-right: 0.25rem;
}

.holding-price {
    font-weight: 600;
    color: #059669;
}

.holding-price.no-price {
    color: #9ca3af;
    font-weight: 400;
    font-style: italic;
    font-size: 0.75rem;
}

.holding-name {
    color: #6b7280;
    font-size: 0.8rem;
    font-weight: 500;
}

.holding-details {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
}

.detail-label {
    color: #6b7280;
    font-weight: 500;
    margin-right: 0.25rem;
}

.current-value {
    color: #059669;
    font-weight: 600;
}

/* Holdings Table - Matching Portfolio List Styling */
.holdings-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow);
}

.holdings-table th,
.holdings-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.holdings-table th {
    background: var(--bg-accent);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
    z-index: 1;
}

.holdings-table tbody tr:hover {
    background: var(--bg-accent);
}

.holdings-table .ticker-cell {
    font-weight: 600;
    color: var(--text-primary);
}

.holdings-table .company-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 2px;
    line-height: 1.2;
}

.holdings-table .actions-cell {
    text-align: center;
}

.holdings-table .btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    min-width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Cash row styling */
.holdings-table .cash-row {
    background-color: var(--bg-accent);
    font-style: italic;
}

.holdings-table .cash-row:hover {
    background-color: var(--bg-tertiary);
}

.holdings-table .cash-row .ticker-cell {
    color: #28a745;
}

/* Selected row styling - matching portfolio table */
.holdings-table tbody tr.selected {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--primary);
}

.holdings-table tbody tr.selected:hover {
    background: var(--bg-accent);
}

/* Selection Controls for Holdings */
.selection-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.selection-info {
    font-weight: 500;
    color: #495057;
    font-size: 0.875rem;
}

.selection-actions {
    display: flex;
    gap: 0.75rem;
}

/* Manual price indicator - uses italics for space efficiency */
.price-override-indicator {
    font-style: italic;
    color: #6b7280;
}

.manual-price-indicator {
    font-style: italic;
    color: var(--text-secondary);
}

/* Table-format Add Holding Row - matches regular rows */
.holdings-table .add-holding-row {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    /* Removed animation: fadeInSlide 0.3s ease; to prevent unwanted fading during cash toggle */
}

.holdings-table .add-holding-row:hover {
    background: var(--bg-accent);
}

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

.holdings-table .add-input {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
    color: var(--text-primary);
    width: 100%;
    max-width: 150px;
}


.holdings-table .add-input:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}

/* Hide spinner arrows for number inputs */
.holdings-table input[type="number"]::-webkit-outer-spin-button,
.holdings-table input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.holdings-table input[type="number"] {
    -moz-appearance: textfield;
}

/* Add dollar sign prefix to price input fields */
.price-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.price-input-wrapper::before {
    content: "$";
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
    z-index: 1;
    font-size: 0.875rem;
}

.price-input-wrapper input {
    padding-left: 1.25rem;
    width: 100%;
    text-indent: 0.5rem;
}

.holdings-table .ticker-input {
    text-transform: uppercase;
    font-weight: 600;
    max-width: 120px;
    min-width: 120px;
}

.holdings-table .allocation-input {
    text-align: right;
}

.holdings-table .price-placeholder, 
.holdings-table .value-placeholder, 
.holdings-table .current-placeholder {
    font-size: 0.8125rem;
    color: #9ca3af;
    font-style: italic;
}

/* Compact button group for table actions */
.holdings-table .add-holding-row .actions-cell {
    white-space: nowrap;
}

.holdings-table .add-holding-row .btn-xs {
    font-weight: 600;
    transition: all 0.15s ease;
    margin-right: 0.25rem;
}

.holdings-table .add-holding-row .btn-primary {
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: white;
}

.holdings-table .add-holding-row .btn-primary:hover {
    background: #0284c7;
    border-color: #0284c7;
}

.holdings-table .add-holding-row .btn-secondary {
    background: #6b7280;
    border-color: #6b7280;
    color: white;
}

.holdings-table .add-holding-row .btn-secondary:hover {
    background: #4b5563;
    border-color: #4b5563;
}

/* Rebalancing Dashboard */
.rebalancing-dashboard {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

.rebalancing-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border-color);
    min-height: 400px;
}

.rebalancing-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary);
}

.rebalancing-button-container {
    text-align: center;
    margin-bottom: 1.5rem;
}

.rebalancing-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
}

.rebalancing-content {
    min-height: 300px;
}

.rebalancing-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.rebalancing-prompt .prompt-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.rebalancing-prompt h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

/* Rebalancing Recommendations */
.rebalancing-summary {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.rebalancing-summary h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.rebalancing-total {
    font-size: 1rem;
    font-weight: 600;
    color: var(--success);
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.recommendation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.recommendation-action {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 80px;
}

.recommendation-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.recommendation-ticker {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.recommendation-amount {
    font-weight: 700;
    color: var(--success);
    font-size: 1rem;
}

.recommendation-shares {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Holdings Details Section */
.holdings-details-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e5e7eb;
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.breadcrumb-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.breadcrumb-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.5rem;
    margin: 0;
}

/* Selection Header Styles */
.selection-header {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.selection-info {
    font-weight: 600;
    color: #0369a1;
    display: flex;
    align-items: center;
}

.selection-info span {
    color: #0284c7;
    font-weight: 700;
}

/* Button Styles */
.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-outline {
    background: transparent;
    border: 2px solid #3b82f6;
    color: #3b82f6;
}

.btn-outline:hover {
    background: #3b82f6;
    color: white;
}


/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .rebalancing-dashboard {
        position: static;
    }
    
    .actions-header, .summary-header, .rebalancing-header, .allocations-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .allocation-actions {
        flex-direction: column;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .compact-form {
        padding: 0.75rem;
    }
    
    /* Holdings Input Table Mobile */
    .holdings-input-table {
        padding: 0.75rem;
    }
    
    .table-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .table-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .input-table-container {
        overflow-x: auto;
    }
    
    .holdings-input-table-element {
        min-width: 400px;
    }
    
    .table-footer {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
        text-align: center;
    }
    
    /* Mobile breadcrumb adjustments */
    .breadcrumb-current {
        font-size: 1.25rem;
    }
    
    .breadcrumb {
        flex-wrap: wrap;
    }
}

@media (min-width: 768px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .app-title {
        text-align: left;
        margin: 0;
    }
    
    .portfolio-selector select {
        width: 250px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .sidebar {
        display: none;
    }
    
    .portfolio-header {
        flex-wrap: nowrap;
    }
}

@media (min-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .portfolio-table-container {
        overflow-x: visible;
    }
    
    .portfolio-table {
        min-width: auto;
    }
}

/* Portfolio Management Section */
.manage-portfolios-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow);
    padding: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.portfolio-list-container {
    overflow-x: auto;
}

.portfolio-list-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow);
}

.portfolio-list-table th,
.portfolio-list-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.portfolio-list-table th {
    background: var(--bg-accent);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
    z-index: 1;
}

.portfolio-list-table tbody tr:hover {
    background: var(--bg-accent);
}

.checkbox-column {
    width: 50px;
    text-align: center;
}

.checkbox-column input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.portfolio-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.portfolio-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.no-portfolios {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.no-portfolios a {
    color: #3498db;
    text-decoration: none;
}

.no-portfolios a:hover {
    text-decoration: underline;
}

/* Portfolio row selected state */
.portfolio-list-table tbody tr.selected {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--primary);
}

.portfolio-list-table tbody tr.selected:hover {
    background: var(--bg-accent);
}

/* Rebalancing Section */
.rebalance-section {
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.rebalance-section p {
    margin-bottom: 1rem;
    color: #6c757d;
}

/* Alert Styles */
.alert {
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    margin: 1rem 0;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Dark mode alert styles */
[data-theme="dark"] .alert-danger {
    background-color: #3d1a1a;
    border-color: #5a2828;
    color: #f8d7da;
}

[data-theme="dark"] .alert-success {
    background-color: #1a3d1a;
    border-color: #285a28;
    color: #d4edda;
}

/* Cash Holdings Section */
.cash-form {
    margin-bottom: 1rem;
}

.current-cash {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.cash-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.cash-label {
    font-weight: 600;
    color: var(--text-primary);
}

.cash-amount {
    font-size: 1.125rem;
    font-weight: 600;
    color: #28a745;
}

.cash-allocation {
    color: #6c757d;
    font-style: italic;
}

.cash-info .btn {
    margin-left: auto;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .btn:hover,
    .loading-spinner {
        animation: none;
        transform: none;
    }
}

/* Focus styles for keyboard navigation */
.btn:focus,
input:focus,
select:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Dark Mode Toggle Switch */
.theme-toggle {
    margin-left: 1rem;
}

.theme-toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 0.5rem;
}

.theme-toggle-input {
    display: none;
}

.theme-toggle-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background: var(--bg-accent);
    border-radius: 12px;
    transition: background-color 0.3s ease;
    border: 1px solid var(--border-color);
}

.theme-toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--bg-secondary);
    border-radius: 50%;
    transition: transform 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 1px 3px var(--shadow);
}

.theme-toggle-input:checked + .theme-toggle-slider {
    background: var(--primary);
}

.theme-toggle-input:checked + .theme-toggle-slider::before {
    transform: translateX(26px);
}

.theme-icon {
    font-size: 1.1rem;
    transition: opacity 0.3s ease;
}

.theme-toggle-input:not(:checked) ~ .dark-icon {
    opacity: 0.4;
}

.theme-toggle-input:checked ~ .light-icon {
    opacity: 0.4;
}

.theme-toggle-label:hover .theme-toggle-slider {
    background: var(--primary);
}

.theme-toggle-label:hover .theme-toggle-slider::before {
    box-shadow: 0 2px 6px var(--shadow-hover);
}

/* Allocation bar rows - remove borders to connect visually with holding row above */
.holdings-table .allocation-bar-row td {
    border-top: none;
    padding-top: 0.5rem;
    padding-bottom: 1rem;
}

/* Remove bottom border from holding rows that have allocation bars below them */
.holdings-table tr:has(+ .allocation-bar-row) td {
    border-bottom: none;
}

/* Fallback for browsers that don't support :has() - target all holding rows except the last */
.holdings-table tbody tr:not(.allocation-bar-row):not(.add-holding-row):not(.cash-row) td {
    border-bottom: none;
}

/* Unified hover behavior - when hovering over holding row, highlight both rows */
.holdings-table tbody tr:not(.allocation-bar-row):not(.add-holding-row):not(.cash-row):hover {
    background: var(--bg-accent);
}
.holdings-table tbody tr:not(.allocation-bar-row):not(.add-holding-row):not(.cash-row):hover + .allocation-bar-row {
    background: var(--bg-accent);
}

/* When hovering over allocation bar row, highlight both rows */
.holdings-table .allocation-bar-row:hover {
    background: var(--bg-accent);
}
.holdings-table .allocation-bar-row:hover {
    background: var(--bg-accent);
}
/* Use :has() to highlight the holding row when hovering over its allocation bar */
.holdings-table tr:has(+ .allocation-bar-row:hover) {
    background: var(--bg-accent);
}

/* Selected state behavior - when holding row is selected, also select allocation bar row */
.holdings-table tbody tr.selected + .allocation-bar-row {
    background: var(--bg-tertiary);
}
.holdings-table tbody tr.selected + .allocation-bar-row:hover {
    background: var(--bg-accent);
}
/* Use :has() to select the holding row when its allocation bar is part of selection */
.holdings-table tr:has(+ .allocation-bar-row.selected) {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--primary);
}

.holdings-table .allocation-bar-row .empty-cell {
    border: none;
    padding: 0;
}

.holdings-table .allocation-bar-cell {
    text-align: center;
    padding-left: 1rem;
    padding-right: 1rem;
}

.holdings-table .holding-allocation-bar {
    width: 100%;
    margin: 0;
}

/* Cash Position Section */
.cash-position-section {
    margin-top: 2rem;
}

.cash-position-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.cash-position-section h4 {
    margin: 0;
    color: var(--text-primary);
    font-weight: 600;
}

.cash-actions {
    display: flex;
    gap: 0.5rem;
}

.cash-position-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px var(--shadow);
    border: 1px solid var(--border-color);
}

.cash-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cash-amount-row,
.cash-allocation-row,
.cash-target-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cash-label {
    font-weight: 600;
    color: var(--text-primary);
}

.cash-value {
    font-weight: 500;
    color: var(--success);
}

.cash-bar-row {
    margin-top: 0.5rem;
}

.cash-allocation-bar {
    width: 100%;
}

.empty-cash {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    font-style: italic;
}

/* Cash editing styles */
.editable-cash-amount:hover,
.editable-cash-allocation:hover {
    background-color: var(--bg-accent);
    border-radius: 4px;
    cursor: pointer;
}

/* Cash Target Section */
.cash-target-section {
    margin-top: 1rem;
}

.cash-target-header {
    margin-bottom: 0.75rem;
}

.cash-target-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cash-target-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 4px var(--shadow);
}

.cash-control-group {
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 0.75rem;
    background: transparent;
    border: 2px solid transparent;
}

.cash-control-group.active {
    background: var(--bg-primary);
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.cash-control-group:not(.active) {
    opacity: 0.5;
}

.control-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.control-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cash-control-group.active .control-label {
    color: #007AFF;
    font-weight: 600;
}

/* Enhanced cash value styling */
.cash-control-group .cash-value {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    min-width: 80px;
    text-align: center;
    transition: all 0.2s ease;
}

.cash-control-group .cash-value:hover {
    border-color: #007AFF;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
}

.cash-control-group.active .cash-value {
    background: var(--bg-tertiary);
    border-color: #007AFF;
    color: var(--text-primary);
}

/* Responsive design */
@media (max-width: 768px) {
    .cash-target-controls {
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: center;
    }
    
    .cash-toggle-switch {
        order: -1;
        margin-bottom: 0.5rem;
    }
    
    .control-content {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* Enhanced Toggle Switch */
.cash-toggle-switch {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cash-toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    display: block;
    width: 54px;
    height: 28px;
    background-color: var(--bg-tertiary);
    border-radius: 14px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    top: 2px;
    background-color: var(--text-primary);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cash-toggle-switch input:checked + .toggle-slider {
    background-color: #007AFF;
    border-color: #007AFF;
    box-shadow: inset 0 2px 4px rgba(0, 122, 255, 0.3);
}

.cash-toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
    background-color: white;
}

.cash-toggle-switch:hover .toggle-slider {
    transform: scale(1.05);
}

/* Legacy Cash Type Toggle (keeping for other views) */
.cash-type-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.cash-type-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.toggle-group {
    display: inline-flex;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.toggle-group input[type="radio"] {
    display: none;
}

.toggle-option {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.toggle-option:hover {
    color: #495057;
    background-color: #e9ecef;
}

.toggle-group input[type="radio"]:checked + .toggle-option {
    color: var(--primary);
    background: var(--bg-secondary);
    font-weight: 600;
    box-shadow: 0 1px 2px var(--shadow);
    border: 1px solid var(--primary);
}

/* Cash status display container for consistent positioning */
.cash-status-display {
    margin-top: 0.75rem;
    min-height: 60px; /* Ensure consistent height regardless of content */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cash difference display for fixed amounts */
.cash-difference-display {
    text-align: center;
    width: 100%;
    padding: 0.75rem;
}

.cash-difference-display .difference-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.cash-difference-display .difference-amount {
    font-size: 1.1rem;
    font-weight: 600;
}

.cash-allocation-bar {
    width: 100%;
    padding: 0.75rem;
}

.cash-allocation-bar .allocation-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-accent);
    border-radius: 4px;
    position: relative;
    margin-bottom: 0.5rem;
}

.cash-allocation-bar .allocation-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.cash-allocation-bar .allocation-target-line {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--success);
    border-radius: 1px;
}

.cash-allocation-bar .allocation-text {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Additional cash row styling */
.cash-value-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Cash difference display for fixed amounts */
.cash-difference-row {
    margin-top: 0.5rem;
    text-align: center;
}

.cash-difference {
    font-size: 0.875rem;
    font-weight: 600;
}

.difference-positive {
    color: #22c55e;
}

.difference-negative {
    color: #ef4444;
}

.difference-balanced {
    color: #6b7280;
}

/* Target allocation line colors based on rebalancing needs */
.allocation-target.target-high {
    background: #22c55e; /* Green - need to buy more */
}

.allocation-target.target-low {
    background: #ef4444; /* Red - need to sell some */
}

.allocation-target.target-balanced {
    background: #6b7280; /* Gray - balanced */
}

/* Section Divider */
.section-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 1.5rem 0;
    opacity: 0.6;
}

/* Missing Price Data Highlighting */
.missing-price-data {
    background-color: rgba(239, 68, 68, 0.1) !important;
    border: 2px solid var(--danger) !important;
    border-radius: 4px;
    animation: pulseRed 2s infinite;
}

@keyframes pulseRed {
    0%, 100% { 
        background-color: rgba(239, 68, 68, 0.1);
        border-color: var(--danger);
    }
    50% { 
        background-color: rgba(239, 68, 68, 0.2);
        border-color: #dc2626;
    }
}
