:root {
    /* Palette */
    --bg-dark: #0f1115;
    /* Deepest background */
    --bg-card: #161b22;
    /* Card background */
    --bg-card-hover: #1c222b;

    --text-primary: #ffffff;
    --text-secondary: #94a3b8;

    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-blue: #3b82f6;

    --glow-green: rgba(34, 197, 94, 0.15);
    --border-color: rgba(255, 255, 255, 0.08);

    --font-family: 'Outfit', sans-serif;
    --grid-gap: 1.5rem;

    /* Semantic UI Vars */
    --hover-bg: rgba(255, 255, 255, 0.05);
    --border-dashed: rgba(255, 255, 255, 0.1);
    --pill-bg: rgba(255, 255, 255, 0.1);
    --cal-day-bg: rgba(255, 255, 255, 0.03);

    /* Heatmap Palette - Dark Mode Defaults */
    --heat-win-bg-low: rgba(34, 197, 94, 0.2);
    --heat-win-bg-mid: rgba(34, 197, 94, 0.5);
    --heat-win-bg-high: rgba(34, 197, 94, 0.8);

    --heat-loss-bg-low: rgba(239, 68, 68, 0.2);
    --heat-loss-bg-mid: rgba(239, 68, 68, 0.5);
    --heat-loss-bg-high: rgba(239, 68, 68, 0.8);

    --heat-text-low: #ffffff;
    --heat-text-mid: #ffffff;
    --heat-text-high: #ffffff;
    --heat-text-flat: var(--text-secondary);
}

[data-theme="light"] {
    --bg-dark: #f8fafc;
    /* Light background */
    --bg-card: #ffffff;
    /* White Card background */
    --bg-card-hover: #f1f5f9;

    --text-primary: #0f172a;
    --text-secondary: #64748b;

    --border-color: #e2e8f0;

    --glow-green: rgba(34, 197, 94, 0.25);

    /* Light Mode Semantic Overrides */
    --hover-bg: rgba(0, 0, 0, 0.05);
    --border-dashed: rgba(0, 0, 0, 0.15);
    --pill-bg: rgba(0, 0, 0, 0.06);
    --cal-day-bg: rgba(0, 0, 0, 0.03);

    /* Heatmap Palette - Light Mode */
    --heat-win-bg-low: #dcfce7;
    /* Green 100 */
    --heat-win-bg-mid: #86efac;
    /* Green 300 */
    --heat-win-bg-high: #22c55e;
    /* Green 500 */

    --heat-loss-bg-low: #fee2e2;
    /* Red 100 */
    --heat-loss-bg-mid: #fca5a5;
    /* Red 300 */
    --heat-loss-bg-high: #ef4444;
    /* Red 500 */

    --heat-text-low: var(--text-primary);
    --heat-text-mid: #0f172a;
    --heat-text-high: #ffffff;
    --heat-text-flat: var(--text-secondary);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    padding: 2rem;
    display: flex;
    /* justify-content: center; REMOVED to allow top alignment of content */
    /* display: flex; REMOVED - allows normal flow */
}

.container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    /* Increased from 1200px for wider view */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-green);
}

.date-display {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.logout-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: transform 0.2s, background-color 0.2s;
    backdrop-filter: blur(10px);
}

.card:hover,
.card.force-hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

/* Disable hover transform for cards with tables */
.card.card-static:hover {
    transform: none;
}

/* Specific Glow for Total Equity */
.glow-card {
    box-shadow: 0 4px 30px var(--glow-green);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-header i {
    font-size: 1.2rem;
    opacity: 0.7;
}

.value {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.1;
}

.subtext {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

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


/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 20000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.2s;
}

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

.modal-content.large-heatmap-modal {
    background: var(--bg-dark);
    width: 90vw;
    height: 85vh;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Note Modal - higher z-index to appear above other modals */
#note-modal {
    z-index: 25000;
}

.note-modal-content {
    width: 90%;
    max-width: 500px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.note-modal-body {
    padding: 16px;
}

#note-modal-input {
    width: 100%;
    height: 150px;
    background: var(--pill-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 12px;
    font-family: inherit;
    resize: none;
    font-size: 1rem;
}

#note-modal-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.note-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 0 16px 16px;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-save {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--accent-blue);
    border: 1px solid var(--accent-blue);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-family: var(--font-family);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-save:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-save.saved {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

/* Settings Button in Header */
.settings-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.settings-btn:hover {
    color: var(--text-primary);
    background: var(--pill-bg);
}

/* Settings Modal */
.settings-modal-content {
    width: 90%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.settings-body {
    padding: 16px;
}

.settings-field {
    margin-bottom: 16px;
}

.settings-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.settings-field input {
    width: 100%;
    background: var(--pill-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.95rem;
}

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

.settings-field select {
    width: 100%;
    background: var(--pill-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

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

.settings-field select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.settings-field small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 0 0 0;
    margin-top: 8px;
}

/* AI Recap Button */
.ai-recap-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 6px;
    margin-left: 8px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.9rem;
    vertical-align: middle;
}

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

.ai-recap-btn i {
    font-size: 1rem;
}

/* AI Recap Modal */
.ai-recap-modal-content {
    width: 90%;
    max-width: 720px;
    max-height: 85vh;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Header */
.recap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.recap-header-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.recap-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
}

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

.recap-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
    display: block;
    font-family: var(--font-family);
}


/* Body */
.ai-recap-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Stats Grid */
.recap-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.recap-stats .stat-card {
    background: var(--bg-tertiary);
    padding: 18px 14px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.recap-stats .stat-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.recap-stats .stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 1rem;
}

.recap-stats .stat-icon.pnl { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.recap-stats .stat-icon.pnl.negative { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.recap-stats .stat-icon.rate { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.recap-stats .stat-icon.trades { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.recap-stats .stat-icon.notes { background: rgba(251, 146, 60, 0.15); color: #fb923c; }

.recap-stats .stat-value {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    letter-spacing: -0.5px;
}

.recap-stats .stat-value.positive { color: var(--accent-green); }
.recap-stats .stat-value.negative { color: var(--accent-red); }

.recap-stats .stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    font-family: var(--font-family);
}

/* Insights Section */
.recap-insights-wrapper {
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.insights-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(250, 204, 21, 0.08);
    border-bottom: 1px solid var(--border-color);
    color: #facc15;
    font-weight: 600;
    font-size: 0.85rem;
    font-family: var(--font-family);
}

.insights-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.insights-header-left i {
    font-size: 1.1rem;
}

.insights-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.recap-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s;
}

.recap-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.recap-action-btn.primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.recap-action-btn.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.recap-action-btn.saved {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.recap-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.recap-action-btn.hidden {
    display: none;
}

.recap-action-btn i {
    font-size: 0.9rem;
}

/* Spinner animation for save button */
.ph-spin {
    animation: spin 1s linear infinite;
}

.recap-insights {
    padding: 20px;
    line-height: 1.75;
    color: var(--text-primary);
    min-height: 280px;
    max-height: 500px;
    overflow-y: auto;
    font-size: 0.95rem;
}

.recap-insights strong {
    color: #60a5fa;
    font-weight: 600;
}

.recap-insights em {
    color: var(--text-secondary);
}

.recap-insights h2, .recap-insights h3, .recap-insights h4 {
    color: var(--text-primary);
    margin: 20px 0 10px 0;
    font-weight: 600;
}

.recap-insights h2:first-child,
.recap-insights h3:first-child,
.recap-insights h4:first-child,
.recap-insights p:first-child {
    margin-top: 0;
}

.recap-insights p {
    margin: 12px 0;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    color: var(--text-secondary);
    gap: 14px;
}

.loading-state.hidden {
    display: none;
}

.loading-spinner-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #60a5fa;
}

.loading-spinner-icon i {
    animation: spin 1s linear infinite;
}

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

/* AI Response Formatting */
.ai-section {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border-left: 3px solid var(--accent-blue);
    font-family: var(--font-family);
}

.ai-section:last-child {
    margin-bottom: 0;
}

.ai-section-title {
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-family: var(--font-family);
}

.ai-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.6;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.ai-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ai-list li:first-child {
    padding-top: 0;
}

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

.ai-paragraph {
    margin: 0 0 12px;
    line-height: 1.6;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
}

.ai-paragraph:last-child {
    margin-bottom: 0;
}

#recap-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

#recap-content em {
    color: var(--text-secondary);
    font-style: italic;
}

/* Messages */
.no-notes, .error {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.no-notes {
    font-style: italic;
}

.error {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    margin: 10px;
    padding: 16px;
}

/* Responsive AI Recap Modal */
@media (max-width: 600px) {
    .ai-recap-modal-content {
        max-width: 95%;
        max-height: 90vh;
    }

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

    .recap-stats .stat-card {
        padding: 12px 8px;
    }

    .recap-stats .stat-value {
        font-size: 1.1rem;
    }

    .recap-insights {
        max-height: 380px;
    }
}

/* Responsive Visibility Utilities */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none !important;
}

/* Mobile Edit Note Button */
.mobile-note-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0 auto;
}

.mobile-note-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.mobile-note-btn.has-note {
    color: var(--accent-blue);
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.1);
}

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

.modal-header h2,
.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-family);
}

.close-modal-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-modal-btn:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

.modal-body-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    flex: 1;
    overflow: hidden;
}

/* Large Calendar */
.large-calendar-section {
    padding: 24px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.calendar-header.large {
    font-size: 1.2rem;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    font-weight: 500;
    color: var(--text-primary);
}

.large-calendar-grid {
    display: grid;
    /* 7 Days + 1 Summary Column */
    grid-template-columns: repeat(7, 1fr) 0.6fr;
    grid-auto-rows: 1fr;
    gap: 8px;
    flex: 1;
}

.cal-day-large {
    background: var(--cal-day-bg);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

/* Weekly Total Cell */
.cal-week-total {
    background: transparent;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center vertically */
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    gap: 6px;
    border: 1px dashed var(--border-dashed);
}

.total-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    margin-bottom: 4px;
    opacity: 0.7;
}

.total-val {
    font-weight: 600;
    font-size: 0.9rem;
}

.cal-day-large:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.cal-day-large.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 1px var(--text-primary);
    /* Double border effect */
}

.cal-day-large.empty {
    background: transparent;
    cursor: default;
}

.day-num {
    opacity: 0.5;
    font-size: 0.8rem;
}

.day-pnl {
    font-weight: 600;
    font-size: 0.95rem;
    align-self: flex-end;
}

/* Day Details Panel */
.day-details-panel {
    background: var(--bg-card);
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.day-details-panel h3 {
    margin-bottom: 16px;
    font-weight: 500;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.detail-trade-row {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.trade-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.trade-sym {
    font-weight: 600;
    background: var(--pill-bg);
    padding: 2px 6px;
    border-radius: 4px;
}

.trade-side.long {
    color: var(--accent-green);
}

.trade-side.short {
    color: var(--accent-red);
}

.trade-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.heatmap-note-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.heatmap-note-btn:hover {
    color: white;
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.heatmap-note-btn.has-note {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border-color: rgba(59, 130, 246, 0.3);
}

.trade-row-actions > div:last-child {
    min-width: 80px;
    text-align: right;
}

/* Day details header with view button */
#detail-date-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.view-day-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

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

/* Charts Section */
.chart-section {
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

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

/* Chart Header Styling (Consistent with Stats) */
.chart-header h3 {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    /* Remove default margins */
}

.chart-toggles {
    display: flex;
    align-items: center;
    /* Ensure divider is centered */
    background: var(--bg-dark);
    padding: 4px;
    border-radius: 8px;
    margin-left: auto;
    /* Push toggles to the right */
}

.chart-toggles button {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.chart-toggles button:hover {
    color: var(--text-primary);
}

.chart-toggles button.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Chart Legend */
.chart-legend {
    display: flex;
    gap: 16px;
    margin-left: 16px;
    /* Space from title */
    /* Removed margin-right: auto*/
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* Configuration Bar */
.sim-unified-header {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 0;
}

/* Legacy .sim-inputs-horizontal removed */

.sim-unified-header .input-group {
    display: flex;
    flex-direction: row;
    /* Side-by-side label/input */
    gap: 8px;
    align-items: center;
}

.sim-unified-header .input-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
}

.sim-unified-header .search-input {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 0 8px;
    /* Compact padding */
    height: 32px;
    /* Fixed unified height */
    border-radius: 8px;
    color: var(--text-primary);
    width: 80px;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
}

/* Ensure chips match height */
.sim-filter-btn,
.sim-tag-chip,
.sim-time-filters button {
    height: 32px;
    /* Match input height */
    font-size: 0.8rem;
}


.chart-legend.visible {
    opacity: 1;
    pointer-events: auto;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

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

.legend-dot.win {
    background-color: var(--accent-green);
}

.legend-dot.loss {
    background-color: var(--accent-red);
}

.legend-dot.fee {
    background-color: #9ca3af;
}

.chart-container {
    position: relative;
    flex-grow: 1;
    width: 100%;
}

canvas#mainChart {
    width: 100% !important;
    height: 100% !important;
}

/* Recent Activity Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
    padding-bottom: 8px;
    /* Space for scrollbar */
}

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

.simple-table th {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.85rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.simple-table tbody tr.trade-row {
    transition: background-color 0.2s ease;
}

.simple-table tbody tr.trade-row:hover {
    background-color: var(--hover-bg);
}

.simple-table td {
    padding: 12px clamp(4px, 1.5vw, 16px);
    /* Fluid padding: Min 4px, Pref 1.5vw, Max 16px */
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    white-space: nowrap;
    /* Prevent values/signs from breaking */
}



/* Specific Cell Widths for Logic */
.tags-cell {
    width: 180px;
    /* Reduced default width */
    max-width: 180px;
}

.notes-header {
    width: 400px;
    /* Default wide for text */
    min-width: 400px;
}

/* Notes Column Logic */
@media (max-width: 1250px) {

    .notes-header,
    .notes-cell {
        width: 80px !important;
        min-width: 80px !important;
        max-width: 80px !important;
        box-sizing: border-box;
    }
}

/* Force Default Wide (Desktop) */
.notes-header,
.notes-cell {
    width: 400px;
    min-width: 400px;
    box-sizing: border-box;
}

.notes-cell {
    white-space: normal !important;
    /* ABSOLUTELY REQUIRED: Allow text to wrap, overriding global td rule */
}

@media (max-width: 1200px) {
    .tags-cell {
        width: 140px;
        max-width: 140px;
    }
}

@media (max-width: 900px) {
    .tags-cell {
        width: 100px;
        max-width: 100px;
    }
}

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

/* Status Badges */
.status-win,
.status-loss {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-win {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-green);
}

.status-loss {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

/* Symbol Pill */
.symbol-pill {
    display: inline-block;
    padding: 2px 6px;
    background: var(--pill-bg);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
}

/* Responsiveness */


/* Time Filters (Segmented Control) */
.time-filters {
    background: var(--bg-card);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    gap: 2px;
}

/* Shared Filter Button Styles */
.time-filters button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: var(--font-family);
}

.time-filters button:hover {
    color: var(--text-primary);
}

.time-filters button.active {
    background: var(--pill-bg);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* PnL Toggle - Distinct Segmented Control Look */
.segmented-control {
    background: rgba(0, 0, 0, 0.2);
    /* Darker inner background */
    padding: 3px;
    border-radius: 8px;
    display: flex;
    gap: 2px;
    border: 1px solid var(--border-color);
}

/* Keep dark background but remove extra border/padding when inside filter-pill */
.filter-pill .segmented-control {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px;
    border: none;
    border-radius: 6px;
}

.segmented-control button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: var(--font-family);
}

.segmented-control button:hover {
    color: var(--text-primary);
}

.segmented-control button.active {
    background: var(--bg-card);
    /* Popped out look */
    color: var(--accent-green);
    /* Distinct text color */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 600;
}

/* --- Middle Row: Chart + Heatmap --- */
.middle-row-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* Chart takes 2/3, Heatmap 1/3 */
    gap: var(--grid-gap);
    height: 400px;
    /* Fixed height for alignment */
}

.middle-row-grid .chart-section {
    margin-bottom: 0;
    /* Remove old margin */
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
}

.chart-section .chart-container {
    flex: 1;
    min-height: 0;
}

/* Heatmap Card (V1 Style) */
.heatmap-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.calendar-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-wrap: nowrap;
}

/* Prevent heatmap nav buttons from wrapping on mobile */
.calendar-header > div:last-child {
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 2px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 1fr;
    gap: 6px;
    flex: 1;
    width: 100%;
    min-height: 0;
}

.cal-day {
    border-radius: 4px;
    background: var(--cal-day-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    cursor: default;
}

.cal-day:hover {
    transform: translateY(-2px);
    z-index: 10;
    border: 1px solid var(--border-color);
}

.cal-day.empty {
    background: transparent;
}

/* PnL Colors for Heatmap */
.pnl-value-text {
    color: var(--heat-text-flat);
}

.cal-win-high {
    background: var(--heat-win-bg-high);
}

.cal-win-high .day-pnl,
.cal-win-high .pnl-value-text {
    color: var(--heat-text-high);
}

.cal-win-mid {
    background: var(--heat-win-bg-mid);
}

.cal-win-mid .day-pnl,
.cal-win-mid .pnl-value-text {
    color: var(--heat-text-mid);
}

.cal-win-low {
    background: var(--heat-win-bg-low);
}

.cal-win-low .day-pnl,
.cal-win-low .pnl-value-text {
    color: var(--heat-text-low);
}


.cal-loss-high {
    background: var(--heat-loss-bg-high);
}

.cal-loss-high .day-pnl,
.cal-loss-high .pnl-value-text {
    color: var(--heat-text-high);
}

.cal-loss-mid {
    background: var(--heat-loss-bg-mid);
}

.cal-loss-mid .day-pnl,
.cal-loss-mid .pnl-value-text {
    color: var(--heat-text-mid);
}

.cal-loss-low {
    background: var(--heat-loss-bg-low);
}

.cal-loss-low .day-pnl,
.cal-loss-low .pnl-value-text {
    color: var(--heat-text-low);
}

/* Simple Calendar Nav Buttons (V1 style) */
.cal-nav-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 4px;
}

.cal-nav-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* Custom Floating Tooltip */
.tooltip-glass {
    position: fixed;
    /* Fixed relative to viewport prevents offset parent issues */
    background: rgba(22, 27, 34, 0.95);
    background: var(--bg-card);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    transition: all 0.2s ease;
    opacity: 0;
    /* Hidden by default */
    pointer-events: none;
    /* Ignore mouse interactions */
    transform: translateY(0);
}

.custom-inputs {
    position: absolute;
    top: 70px;
    right: 0;
    background: var(--bg-card);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    transition: all 0.2s ease;
    opacity: 1;
    transform: translateY(0);
}

/* Triangle pointer toward Custom button */
.custom-inputs::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 150px;
    width: 14px;
    height: 14px;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    transform: rotate(45deg);
    clip-path: polygon(0% 0%, 100% 0%, 0% 100%);
}

.custom-inputs.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    visibility: hidden;
}

.custom-inputs input[type="date"] {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    color-scheme: dark;
}

.custom-inputs input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.6;
    cursor: pointer;
}

.custom-inputs input[type="date"]:hover {
    border-color: var(--text-secondary);
}

/* Tag Filter Select */
.tag-select {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    margin-right: 8px;
}

.tag-select:hover,
.tag-select:focus {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 8px;
}

/* Navigation Tabs */
.main-tabs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

/* Navigation Tabs (Pill Style) */
.nav-pill {
    background: var(--bg-card);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    gap: 2px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    /* Matches time filters */
    font-weight: 500;
    padding: 6px 16px;
    /* Matches time filters */
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: transparent;
    /* Hover handled by pill container bg? No, distinct item hover */
}

.tab-btn.active {
    background: var(--pill-bg);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Mobile Filter Toggle - Hidden on desktop, matches nav-pill height */
.mobile-filter-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px 12px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    /* Match nav-pill inner button height */
    min-height: calc(6px + 1em + 6px);
    box-sizing: border-box;
}

.mobile-filter-toggle:hover {
    background: var(--bg-hover);
}

/* Active state when filter panel is open */
.mobile-filter-toggle.active {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.mobile-filter-toggle .filter-badge {
    font-size: 0.7rem;
    background: var(--accent-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* Nav Right - Filter Container (desktop default) */
.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

/* Hide filters (used on Simulation view) */
.nav-right.filters-hidden {
    display: none !important;
    visibility: hidden;
}

/* Views Visibility */
.view-section.hidden {
    display: none;
}

.view-section.active {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Trade Search & Table */
.search-input {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-primary);
    width: 250px;
    font-family: inherit;
}

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

.trades-table td {
    vertical-align: middle;
    text-align: center;
    border-right: 1px solid var(--border-dashed);
    overflow: hidden;
    text-overflow: ellipsis;
}

.trades-table th {
    text-align: center;
    border-right: 1px solid var(--border-dashed);
}

/* Fixed column widths for trades table */
.trades-table th:nth-child(1),
.trades-table td:nth-child(1) { width: 8%; }   /* Date */
.trades-table th:nth-child(2),
.trades-table td:nth-child(2) { width: 7%; }   /* Symbol */
.trades-table th:nth-child(3),
.trades-table td:nth-child(3) { width: 5%; }   /* Side */
.trades-table th:nth-child(4),
.trades-table td:nth-child(4) { width: 5%; }   /* Qty */
.trades-table th:nth-child(5),
.trades-table td:nth-child(5) { width: 8%; }   /* Gross PnL */
.trades-table th:nth-child(6),
.trades-table td:nth-child(6) { width: 6%; }   /* Fees */
.trades-table th:nth-child(7),
.trades-table td:nth-child(7) { width: 8%; }   /* Net PnL */
.trades-table th:nth-child(8),
.trades-table td:nth-child(8) { width: 7%; }   /* Entry */
.trades-table th:nth-child(9),
.trades-table td:nth-child(9) { width: 7%; }   /* Exit */
.trades-table th:nth-child(10),
.trades-table td:nth-child(10) { width: 6%; }  /* ROI */
.trades-table th:nth-child(11),
.trades-table td:nth-child(11) { width: 15%; } /* Tags */
.trades-table th:nth-child(12),
.trades-table td:nth-child(12) { width: 18%; } /* Notes */

.trades-table td:last-child,
.trades-table th:last-child {
    border-right: none;
}

/* Tag Pills */
.tag-container {
    display: flex;
    flex-wrap: nowrap;
    /* Prevent stacking */
    overflow-x: auto;
    /* Show scrollbar only when needed */
    gap: 6px;
    align-items: center;
    max-width: 300px;
    /* Ensure it fits in column */
    padding-bottom: 4px;
    /* Space for scrollbar */

    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: var(--text-secondary) transparent;
}

/* Icon Toggle (Discreet Button) */
/* Icon Toggle (Discreet Button) */
.icon-toggle {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    opacity: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

/* When inside chart toggles, look like a segment button */
.chart-toggles .icon-toggle {
    background: none;
    border: none;
    padding: 6px 16px;
    /* Match standard chart toggle padding */
    margin-right: 0;
    font-size: 0.9rem;
    /* Match specific font size */
}

.chart-toggles .icon-toggle:hover {
    color: var(--text-primary);
    background: transparent;
}

.chart-toggles .icon-toggle.active {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-green) !important;
    box-shadow: none;
    border-radius: 6px;
}

/* Vertical Separator inside Chart Toggles */
.chart-toggles .divider {
    width: 1px;
    height: 16px;
    background-color: var(--border-color);
    margin: 0 4px;
    display: block !important;
}

.icon-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.icon-toggle.active {
    color: var(--accent-green);
    background: rgba(34, 197, 94, 0.1);
}

/* Custom Scrollbar for Tag Slider (Webkit) */
.tag-container::-webkit-scrollbar {
    height: 8px;
    /* Slightly thicker */
    background-color: rgba(255, 255, 255, 0.05);
    /* Ensure track is visible */
}

.tag-container::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.tag-container::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
    border: 1px solid var(--bg-card);
    /* contrast */
}

.tag-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}

/* Custom Tag Autocomplete */
.tag-dropdown {
    position: fixed;
    /* Fixed to viewport, positioned by JS */
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    width: 150px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px 0;
}

.tag-dropdown-item {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: none;
    /* Disable transition to prevent flicker */
}

/* Explicitly force no change on hover to override any defaults */
.tag-dropdown-item:hover {
    background-color: var(--bg-card) !important;
    color: var(--text-secondary) !important;
    box-shadow: none !important;
    cursor: pointer;
}


.tag-dropdown.hidden {
    display: none;
}

.tag-pill {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    border: 1px solid rgba(59, 130, 246, 0.3);
    cursor: pointer;
    transition: all 0.2s;
}

.tag-pill:hover {
    background: rgba(59, 130, 246, 0.25);
}

.tag-pill .remove {
    margin-left: 4px;
    opacity: 0.6;
    font-weight: bold;
}

.tag-pill .remove:hover {
    opacity: 1;
}

/* --- Premium Sim Component Styling --- */

/* 1. Segmented Control for Time Filters */
.sim-time-filters {
    display: flex;
    background: var(--bg-main);
    padding: 3px 6px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    align-items: center;
    gap: 8px;
    height: 34px;
    flex-shrink: 0;
}

.sim-config-pill {
    display: flex;
    background: var(--bg-main);
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    align-items: center;
    gap: 12px;
    height: 36px;
    flex: 1 1 auto;
}

/* Config Pill Specifics */
.sim-config-pill .input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
}

.sim-config-pill label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.sim-config-pill input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    min-width: 55px;
    width: 100%;
    max-width: 90px;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    text-align: right;
    padding: 4px 6px;
    height: 26px;
    flex: 1 1 auto;
}

/* Wider inputs for capital values */
.sim-config-pill input#sim-base-cap,
.sim-config-pill input#sim-start-cap {
    min-width: 60px;
    max-width: 100px;
}

.sim-config-pill input:hover {
    border-color: var(--text-secondary);
}

.sim-config-pill input:focus {
    outline: none;
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
}

.sim-config-pill .pill-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    opacity: 0.5;
    flex-shrink: 0;
}

.sim-config-pill select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    padding: 4px 18px 4px 6px;
    height: 26px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath fill='%236b7280' d='M0 2l4 4 4-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    min-width: 50px;
    flex: 1 1 auto;
}

.sim-config-pill select:hover {
    border-color: var(--text-secondary);
}

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

.sim-config-pill select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.sim-scale-toggle {
    display: flex;
    background: var(--bg-main);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    gap: 2px;
    height: 36px;
    align-items: center;
    margin-left: auto;
}

.sim-scale-toggle .scale-btn {
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 0 14px;
    height: 28px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sim-scale-toggle .scale-btn:hover {
    color: var(--text-primary);
}

.sim-scale-toggle .scale-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Two-Row Config Layout */
.sim-config-row-1 {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sim-config-row-1::-webkit-scrollbar {
    display: none;
}

@media (max-width: 1100px) {
    .sim-config-row-1 {
        flex-wrap: wrap;
        row-gap: 0.75rem;
        overflow-x: visible;
    }
}

.sim-config-row-2 {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    width: 100%;
    flex-wrap: wrap;
}

/* Section with label */
.sim-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
}

.sim-section .section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.3px;
    opacity: 0.6;
    white-space: nowrap;
}

/* Section divider */
.section-divider {
    width: 1px;
    height: 28px;
    background: var(--border-color);
    opacity: 0.4;
    margin: 0 0.25rem;
    flex-shrink: 0;
}

/* Tag cloud */
.sim-tag-cloud {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
    align-items: center;
    scrollbar-width: none;
    padding: 0 0.5rem;
    justify-content: flex-start;
    mask-image: linear-gradient(to right, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 90%, transparent 100%);
}

.sim-tag-cloud::-webkit-scrollbar {
    display: none;
}

/* Scaling Indicator */
.scaling-indicator {
    font-size: 0.75rem;
    font-family: 'Space Mono', monospace;
    color: var(--text-secondary);
    background: var(--bg-main);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: help;
    white-space: nowrap;
    flex-shrink: 0;
}

.scaling-indicator.scaled-up {
    color: var(--accent-green);
    border-color: var(--accent-green);
    background: rgba(34, 197, 94, 0.1);
}

.scaling-indicator.scaled-down {
    color: var(--accent-red);
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

.sim-time-filters button {
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 0 10px;
    height: 24px;
    /* Compact internal height */
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sim-time-filters button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.sim-time-filters button.active {
    background: var(--bg-card);
    /* Lifted card effect */
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

/* 2. Minimalist Number Inputs */
.sim-unified-header .search-input {
    background: transparent;
    border: 1px solid var(--border-color);
    /* border-bottom: 1px solid var(--border-color); */
    /* border-radius: 0; */
    border-radius: 6px;
    padding: 0 8px;
    height: 30px;
    color: var(--text-primary);
    width: 60px;
    /* Tighter width */
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.2s;
}

.sim-unified-header .search-input:focus {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
    outline: none;
}

/* 3. Refined Input Labels */
.sim-unified-header .input-group label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 4px;
}

/* 4. Filter Chips (Tags) - Refined */
.sim-tag-chip {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0 10px;
    height: 26px;
    /* Match effective height of time buttons */
    border-radius: 13px;
    /* Full pill */
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.sim-tag-chip:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.05);
}

.sim-tag-chip.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    font-weight: 600;
}

/* Specific spacing for time filters to join them? No, keep independent for 'chip' look requested. */
.sim-time-filters,
.sim-pnl-toggle {
    display: flex;
    gap: 6px;
}

.add-tag-input {
    background: transparent;
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    width: 80px;
    transition: border-color 0.2s;
}

.add-tag-input:focus {
    width: 200px;
    outline: none;
    border-color: var(--accent-green);
    color: var(--text-primary);
    border-style: solid;
}

/* Simple Run Button - Matched to Logout */
.sim-run-btn-simple {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    border-radius: 8px;
    padding: 0 24px;
    height: 34px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: none;
    text-shadow: none;
    margin-left: auto;
    flex-shrink: 0;
}

.sim-run-btn-simple:hover {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
    border-color: var(--accent-green);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}

.sim-run-btn-simple:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.05);
}

.sim-run-btn-simple:disabled {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.sim-run-btn-simple:disabled {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
    transform: none;
}

.sim-run-btn-simple i.spin {
    animation: simpleSpin 1s linear infinite;
}

@keyframes simpleSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Multi-select Dropdown */
.multi-select-wrapper {
    position: relative;
    margin-right: 8px;
}

.tag-select-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.tag-select-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tag-select-btn.active {
    color: var(--accent-green);
    background: rgba(34, 197, 94, 0.1);
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.multi-select-dropdown.hidden {
    display: none;
}

/* Scrollbar for dropdown */
.multi-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

.multi-select-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.multi-select-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Checkbox Items */
.filter-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: background 0.2s;
}

.filter-checkbox-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.filter-checkbox-item input[type="checkbox"] {
    accent-color: var(--accent-green);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.filter-checkbox-item.selected {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

/* Generic CSS Tooltip */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: rgba(22, 27, 34, 0.95);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 999999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    margin-bottom: 8px;
}

[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;

    /* Rotated Square for Bordered Arrow */
    width: 8px;
    height: 8px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);

    /* Position and Rotate */
    transform: translateX(-50%) translateY(0) rotate(45deg);

    z-index: 1000000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    margin-bottom: 2px;
    /* Closer to element */
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    /* Lift less on hover to stay connected */
    transform: translateX(-50%) translateY(-2px) rotate(45deg);
}

[data-tooltip]:hover::before {
    /* Lift bubble similarly (less high) */
    transform: translateX(-50%) translateY(-2px);
}

/* Unified Card Titles */
.section-header h3,
.calendar-header {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

/* Simulation Info Icon */
.sim-label {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    position: relative;
}

.info-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    opacity: 0.6;
    transition: opacity 0.2s;
    color: var(--text-secondary);

    /* Position Top Right */
    position: absolute;
    top: 8px;
    right: 8px;
}

/* Eliminate Double Tooltip: Disable CSS tooltip for these wrappers */
.info-wrapper[data-tooltip]::before,
.info-wrapper[data-tooltip]::after {
    display: none !important;
    content: none !important;
}

.info-wrapper:hover {
    opacity: 1;
    color: var(--accent-blue);
}

.info-wrapper i {
    font-size: 0.9em;
    pointer-events: none;
    /* Let wrapper handle events */
}

/* Tooltip Override for Simulation Cards to prevent clipping */
/* REPLACED BY GLOBAL JS TOOLTIP */

/* Global Tooltip Element */
.global-tooltip {
    position: fixed;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 220px;
    width: max-content;
    z-index: 10000;
    /* Always on top */
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    font-weight: 400;
    text-align: center;
}

.global-tooltip.visible {
    opacity: 1;
}

.section-header h3 {
    margin-bottom: 1rem;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-left: 4px;
    /* Slight alignment fix */
}

/* --- Responsiveness --- */

/* Tablet & Smaller Desktop (Max Width 1000px) */
@media (max-width: 1000px) {

    /* Stack Chart and Heatmap */
    .middle-row-grid {
        grid-template-columns: 1fr;
        height: auto;
        /* Allow auto height */
        gap: 1rem;
    }

    .middle-row-grid .chart-section {
        min-height: 400px;
        /* Maintain height */
    }

    .heatmap-card {
        min-height: 400px;
        /* Give heatmap enough space */
    }
}

/* Tablet - Show filter toggle before overflow */
@media (max-width: 1150px) {
    /* Show mobile filter toggle before "All Tags" wraps */
    .mobile-filter-toggle {
        display: flex;
    }

    /* Make nav relative for dropdown positioning, stretch children to equal height */
    .main-tabs {
        position: relative;
        align-items: stretch;
    }

    /* Ensure nav-pill and filter toggle align */
    .nav-pill {
        display: flex;
        align-items: stretch;
    }

    .nav-pill .tab-btn {
        display: flex;
        align-items: center;
    }

    /* Collapsible filter panel */
    .nav-right.mobile-filter-panel {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        box-sizing: border-box;
        background: transparent;
        border: none;
        padding: 12px 0 8px 0;
        z-index: 100;
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
        overflow: visible;
    }

    .nav-right.mobile-filter-panel.open {
        display: flex;
    }

    /* Filter pill inside panel - with triangle pointer */
    .mobile-filter-panel .filter-pill {
        position: relative;
        flex-wrap: wrap;
        gap: 4px;
        background: var(--bg-card) !important;
        border: 1px solid var(--border-color) !important;
        padding: 4px !important;
        border-radius: 8px;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    /* Triangle pointer toward button */
    .mobile-filter-panel .filter-pill::before {
        content: '';
        position: absolute;
        top: -8px;
        right: 10px;
        width: 14px;
        height: 14px;
        background: inherit;
        border-left: 1px solid var(--border-color);
        border-top: 1px solid var(--border-color);
        transform: rotate(45deg);
        clip-path: polygon(0% 0%, 100% 0%, 0% 100%);
    }

    .mobile-filter-panel .time-filters {
        flex-wrap: wrap;
        justify-content: center;
    }

    .mobile-filter-panel .divider {
        display: none;
    }

    .mobile-filter-panel .segmented-control {
        justify-content: center;
    }
}

/* =============================================
   REPORTS VIEW STYLES
   ============================================= */

/* Report Top Section: CSS Grid layout */
.report-top-section {
    display: grid;
    grid-template-columns: 1fr 200px 200px;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: stretch;
}

/* Left Column: Stacked Charts */
.report-charts-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Sidebars */
.report-sidebar {
    /* Grid handles sizing */
}

/* Chart */
.report-chart {
    flex: 1;
    min-height: 180px;
}

/* Waterfall Card */
.waterfall-card {
    padding: 1rem 1.25rem;
}

.waterfall-card .section-header {
    margin-bottom: 0.75rem;
}

.waterfall-card .section-header h3 {
    font-size: 0.7rem;
}

.waterfall-chart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.waterfall-row {
    display: grid;
    grid-template-columns: 70px 1fr 100px;
    align-items: center;
    gap: 0.75rem;
}

.waterfall-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.waterfall-bar-container {
    height: 6px;
    background: var(--bg-card-hover);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.waterfall-bar {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.waterfall-bar.gross {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.waterfall-bar.fees {
    background: linear-gradient(90deg, #dc2626, #f87171);
}

.waterfall-bar.net.positive {
    background: linear-gradient(90deg, #16a34a, #4ade80);
}

.waterfall-bar.net.negative {
    background: linear-gradient(90deg, #dc2626, #f87171);
}

.waterfall-bar.net {
    background: linear-gradient(90deg, #16a34a, #4ade80);
}

.waterfall-value {
    font-size: 0.85rem;
    font-family: 'Space Mono', monospace;
    font-weight: 500;
    text-align: right;
}

.waterfall-result {
    /* No extra spacing - equal gap handled by parent */
}

/* Right Sidebar */
.report-sidebar {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    height: 100%;
}

.report-sidebar .section-header {
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.report-sidebar .section-header h3 {
    font-size: 0.75rem;
}

.report-stats-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
}

.report-stat-item {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.report-stat-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.report-stat-item:first-child {
    padding-top: 0;
}

.report-stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.15rem;
}

.report-stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Space Mono', monospace;
}

.report-stat-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* P&L Breakdown Waterfall */
.pnl-breakdown {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.breakdown-header {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.breakdown-bars {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.breakdown-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.breakdown-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.breakdown-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.breakdown-bar-container {
    height: 8px;
    background: var(--bg-card-hover);
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
    position: relative;
}

.breakdown-bar {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.breakdown-bar.gross {
    background: #60a5fa; /* Bright blue */
}

.breakdown-bar.fees {
    background: var(--accent-red);
}

.breakdown-bar.net {
    background: var(--accent-green);
}

.breakdown-value {
    font-size: 0.7rem;
    font-family: 'Space Mono', monospace;
}

.net-row {
    padding-top: 0.4rem;
    border-top: 1px dashed var(--border-color);
    margin-top: 0.3rem;
}

/* Quarter Header Rows */
.quarter-header {
    background: var(--bg-card-hover);
    border-left: 3px solid var(--accent-primary);
}

.quarter-header td {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
    font-weight: 500;
}

/* Month Rows (indented under quarters) */
.month-row td:first-child {
    color: var(--text-secondary);
}

/* Report Table alignment */
.report-table th,
.report-table td {
    text-align: right;
}

.report-table th:first-child,
.report-table td:first-child {
    text-align: left;
}

/* Dynamic wrap when JS detects overflow - sidebars go below charts */
.report-top-section.wrapped {
    grid-template-columns: 1fr 1fr;
}

.report-top-section.wrapped .report-charts-column {
    grid-column: 1 / -1;  /* Span full width */
}

/* Compact sidebar in wrapped mode */
.report-top-section.wrapped .report-sidebar {
    height: auto;
    padding: 0.75rem;
}

/* Use CSS Grid for compact stat cards layout */
.report-top-section.wrapped .report-stats-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    flex: 0;
    justify-content: start;
}

.report-top-section.wrapped .report-stat-item {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    border-bottom: 1px solid var(--border-color);
}

.report-top-section.wrapped .report-stat-item:last-child {
    border-bottom: 1px solid var(--border-color);
}

@media (max-width: 900px) {
    /* Fallback for no-JS: same as .wrapped styles */
    .report-top-section {
        grid-template-columns: 1fr 1fr;
    }

    .report-charts-column {
        grid-column: 1 / -1;
    }

    .report-sidebar {
        height: auto;
        padding: 0.75rem;
    }

    .report-stats-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        flex: 0;
    }

    .report-stat-item {
        padding: 0.5rem 0.75rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
    }
}

@media (max-width: 500px) {
    /* Mobile: single column layout */
    .report-top-section {
        grid-template-columns: 1fr;
    }

    .report-charts-column {
        grid-column: auto;
    }

    .report-stats-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Keep header in row - logo left, buttons right */
    header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    /* Smaller stat cards */
    .report-stat-item {
        min-width: 100px;
    }

    .waterfall-row {
        grid-template-columns: 70px 1fr 80px;
        gap: 0.5rem;
    }

    .waterfall-label {
        font-size: 0.7rem;
    }

    .waterfall-value {
        font-size: 0.8rem;
    }
}

/* Mobile (Max Width 768px) */
@media (max-width: 768px) {
    body {
        padding: 0.5rem;
        overflow-x: hidden; /* Prevent page-level horizontal scroll on mobile */
    }

    .container {
        gap: 1rem;
    }

    /* Header stays in row, compact on mobile */
    header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .logo {
        font-size: 1.2rem;
    }

    /* Hide logout text on mobile, keep icon */
    .logout-btn span {
        display: none;
    }

    /* Stats Grid: Single Column */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Smaller tabs on mobile */
    .nav-pill {
        flex: 1;
        min-width: 0;
    }

    .tab-btn {
        flex: 1;
        text-align: center;
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .filter-pill .divider {
        display: none;
    }

    .time-filters {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .recent-activity {
        padding: 1rem;
        overflow-x: auto;
    }

    .section-header h3 {
        font-size: 0.8rem;
    }

    .simple-table {
        min-width: 500px;
    }

    /* Trades table - auto-sizes based on content, scrolls horizontally */
    .trades-table {
        width: auto;
    }

    /* Reports View Mobile */
    .report-top-section {
        gap: 0.5rem;
    }

    .report-chart {
        min-height: 180px;
    }

    .report-stat-value {
        font-size: 0.95rem;
    }

    .report-stat-label {
        font-size: 0.6rem;
    }

    /* Table improvements for mobile */
    .report-table {
        font-size: 0.75rem;
    }

    .report-table th,
    .report-table td {
        padding: 0.5rem 0.4rem;
        white-space: nowrap;
    }
}

/* Small Phone (Max Width 480px) */
@media (max-width: 480px) {
    /* Full width stat cards on small phones */
    .report-stat-item {
        flex: 1 1 100%;
        min-width: 0;
        padding: 0.4rem 0.6rem;
    }

    .report-stat-value {
        font-size: 0.9rem;
    }

    .report-stat-label {
        font-size: 0.6rem;
    }

    /* Compact waterfall on small screens */
    .waterfall-row {
        grid-template-columns: 55px 1fr 65px;
        gap: 0.4rem;
    }

    .waterfall-label {
        font-size: 0.6rem;
    }

    .waterfall-value {
        font-size: 0.7rem;
    }

    /* Smaller chart on phone */
    .report-chart {
        min-height: 150px;
    }
}

/* Heatmap Modal Specific Mobile Layout (Max Width 1200px) */
@media (max-width: 1200px) {

    /* Modal Adjustments */
    .modal-content.large-heatmap-modal {
        width: 90vw;
        height: 92vh;
        margin: auto;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-body-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .large-calendar-section {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 8px;
        flex: 0 1 auto;
        /* Can shrink, can grow slightly */
        max-height: 70%;
        /* Don't take more than 60% of vertical space */
        min-height: 40%;
        /* Ensure calendar is always visible */
        overflow-y: auto;
    }

    /* Heatmap Grid Mobile */
    #large-calendar-grid {
        /* Restore 8th column for weekly total, but keep it narrow */
        grid-template-columns: repeat(7, minmax(0, 1fr)) 0.85fr !important;
        gap: 2px;
    }

    /* Show Weekly Totals on Mobile */
    .cal-week-total {
        display: flex !important;
        /* Restore display */
        font-size: 0.7rem;
        /* Smaller font for total */
        padding: 2px;
        align-items: center;
        justify-content: center;
        word-break: break-all;
    }

    /* Compact Day Cells */
    .cal-day-large {
        padding: 2px;
        min-height: 85px;
        /* Taller cells as requested */
        overflow: hidden;
    }

    .day-num {
        font-size: 0.65rem;
        margin-bottom: 2px;
    }

    .day-pnl {
        font-size: 0.85rem;
        /* Increased size */
        font-weight: 500;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .day-details-panel {
        padding: 12px;
        flex: 1;
        min-height: 0;
        overflow-x: auto;
        width: 100%;
        max-width: 100vw;
        /* Crucial for overflow to work */
        box-sizing: border-box;
        -webkit-overflow-scrolling: touch;
    }

    .day-details-panel h3 {
        margin-bottom: 8px;
        font-size: 1rem;
        padding-bottom: 8px;
    }

    .detail-trade-row {
        padding: 8px;
        margin-bottom: 6px;
        min-width: 300px;
        /* Force minimum width to prevent squashing */
    }

    .trade-info {
        gap: 6px;
        /* Remove overflow masking to allow content to show */
    }

    .trade-sym {
        font-size: 0.85rem;
        padding: 1px 4px;
        white-space: nowrap;
        /* Remove truncation */
    }

    .trade-side {
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .trade-info span:last-child {
        font-size: 0.8rem !important;
        /* Quantity text */
        white-space: nowrap;
    }

    /* Adjust font sizes */
    .value {
        font-size: 1.75rem;
    }



    .chart-header {
        flex-direction: row;
        /* Keep side by side */
        gap: 0.5rem;
    }

    .chart-toggles {
        margin-left: auto;
        /* Push to right */
        width: auto;
        /* Take only needed space */
    }

    .chart-toggles button {
        flex: 0 1 auto;
        padding: 6px 12px;
        font-size: 0.85rem;
        line-height: 1.2;
    }
}

/* --- Premium Note Styles (Global) --- */

/* Read-Only Note Cell (Desktop) */
.note-cell-content {
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    min-height: 36px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-size: 0.9rem;
    border: 1px solid transparent;
    /* Reserve space for border */
}

/* Filled State ("Text looks nicer") */
/* Filled State ("Text looks nicer") */
.note-cell-content.filled {
    background: var(--pill-bg);
    font-family: 'Outfit', sans-serif;
    line-height: 1.4;
    color: var(--text-primary);

    /* Multi-line Truncation (2 lines) */
    white-space: normal !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* Standard property for compatibility */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;

    max-width: 500px;
    width: 100%;
    padding: 6px 12px;
    text-align: left;
    font-size: 0.85rem;
    height: auto;
    /* Allow growth */
    min-height: 44px;
    /* Sufficient for 2 lines */
    max-height: 48px;
    /* STRICT LIMIT: 48px chops off any 3rd line definitively */
    overflow: hidden;
    /* Chop off anything extra */
    box-sizing: border-box;
    /* Redundant but safe */
}

.note-cell-content:hover {
    background: var(--hover-bg);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-color: var(--border-color);
}

/* Empty State ("Input button looks interesting") */
.note-cell-content .placeholder {
    display: flex;
    align-items: center;
    gap: 6px;
    font-style: normal;
    font-weight: 500;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    transition: all 0.2s;
    opacity: 0.8;
}

.note-cell-content .placeholder::before {
    content: '+';
    font-size: 1.1em;
    font-weight: bold;
}

.note-cell-content:hover .placeholder {
    opacity: 1;
    background: rgba(59, 130, 246, 0.2);
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

/* Polished Mobile Button */
.mobile-note-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0;
    border-radius: 50%;
    /* Circle */
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0 auto;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy */
}

.mobile-note-btn:hover {
    color: white;
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.mobile-note-btn.has-note {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border-color: rgba(59, 130, 246, 0.3);
}

/* Ensure centering wrapper works for this too */
td .note-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Tag Interaction Layout */
.tag-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 4px;
    position: relative;
    min-height: 28px;
    overflow: hidden;
}

.tag-list {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex-grow: 1;
    /* Tags take space */
    padding-bottom: 4px;
    scrollbar-width: none;
    /* No transitions, always visible */
    max-width: 100%;
    /* Ideally huge number or flex basis */
}

/* Premium Add Tag Button */
/* Premium Add Tag Button - Subtle & Discreet */
.add-tag-input {
    min-width: 28px;
    width: 28px;
    height: 22px;
    padding: 0;
    text-align: center;
    background: transparent;
    /* Ghost button by default */
    border: 1px solid transparent;
    border-radius: 20px;
    /* NO ANIMATION */
    flex-shrink: 0;
    color: var(--accent-blue);
    font-weight: 500;
    font-size: 0.9rem;
    outline: none;
    opacity: 0.4;
    /* Very discreet when idle */
    line-height: 22px;
}

.add-tag-input::placeholder {
    color: var(--accent-blue);
    font-weight: bold;
    opacity: 0.7;
    font-size: 1.1em;
}

.add-tag-input:hover {
    opacity: 1;
    /* Reveal on hover */
    background: rgba(59, 130, 246, 0.1);
    /* Subtle tint on hover only */
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.1);
    cursor: pointer;
    transition: none;
    /* Ensure no lag */
}

/* Expanded State (Focus) - Instant Full Width Overlay */
.add-tag-input.expanded,
.add-tag-input:focus {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    text-align: left;
    padding: 0 8px;
    background: var(--bg-dark);
    border: none;
    border-bottom: 1px solid var(--accent-blue);
    border-radius: 0;
    color: var(--text-primary);
    box-shadow: none;
    cursor: text;
    opacity: 1;
    box-sizing: border-box;
}

/* --- FINAL VISIBILITY OVERRIDES (MOVED TO END FOR SPECIFICITY) --- */
@media (max-width: 1250px) {

    /* Ultra-strong selector to override any display: flex/block !important elsewhere */
    html body .desktop-only,
    html body .note-cell-content.desktop-only,
    .note-cell-content.filled.desktop-only {
        display: none !important;
    }

    html body .mobile-only,
    html body .mobile-note-btn.mobile-only {
        display: flex !important;
    }
}

.sim-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    grid-auto-rows: minmax(110px, 1fr);
    gap: 1rem;
    width: 100%;
    height: 100%;
    flex-grow: 1;
}

.sim-card {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 16px;
    text-align: left;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically to use more space */
    align-items: flex-start;
    height: 100%;
    gap: 12px;
    /* Increased, equal spacing */
    transition: transform 0.2s, background-color 0.2s;
}

/* Hovering lifts z-index */
.sim-card:hover {
    z-index: 10;
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    border-color: var(--border-color);
}

.sim-label {
    font-size: 0.75rem;
    /* Slightly larger */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    /* Maximize efficiency */
    color: var(--text-secondary);
    margin-bottom: 0;
    padding: 0 24px 0 0;
    /* Right padding only for icon, maximize left space */
    font-weight: 600;
    line-height: 1.25;
    /* relaxed line height for multi-line */
    max-height: 2.6em;
    /* Allow 2 full lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.sim-value {
    font-size: 1.15rem;
    /* Final refinement from 1.25rem */
    font-family: 'Space Mono', monospace;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
    margin-top: 0;
    /* Separation handled by card gap */
    text-align: left;
    /* Left align value */
    width: 100%;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sim-sub {
    font-size: 0.75rem;
    /* Larger Subtext */
    color: var(--text-tertiary);
    margin-top: 0;
}

.info-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    opacity: 0.4;
    /* More subtle until hover */
    transition: all 0.2s;
    color: var(--text-secondary);

    /* Position Top Right aligned with padding */
    position: absolute;
    top: 8px;
    /* Closer to top edge */
    right: 8px;
    /* Closer to right edge */
}

.info-wrapper:hover {
    opacity: 1;
    color: var(--accent-blue);
    transform: scale(1.1);
}

.sim-value.pos {
    color: var(--accent-green);
}

.sim-value.neg {
    color: var(--accent-red);
}

.sim-sub {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.8;
    margin-top: 0;
}

/* Legacy simulation styles consolidated above */

/* Simulation Layout V2 (Top Inputs, Split Bottom) */
.simulation-container-v2 {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: calc(100vh - 140px);
    width: 100%;
}

/* Top Controls Bar */
.simulation-controls-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    flex-wrap: wrap;
    gap: 20px;
}

.section-header-inline h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.sim-inputs-horizontal {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    flex-wrap: wrap;
}

.sim-inputs-horizontal .input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sim-inputs-horizontal label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.sim-inputs-horizontal button {
    height: 38px;
    padding: 0 24px;
}

/* Bottom Split Layout */
.simulation-split-bottom {
    display: grid;
    grid-template-columns: 360px 1fr;
    /* Wider sidebar for visual balance */
    gap: 1rem;
    flex-grow: 1;
    min-height: 0;
    overflow: hidden;
}

/* Left Sidebar (Stats Only) */
.sim-sidebar-left {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

.sim-stats-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    margin-top: 0;
}

.sim-stats-card #sim-stats {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Main Chart Area */
.sim-main-content {
    height: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chart-card.full-height {
    height: 100%;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chart-card.full-height .chart-container {
    flex-grow: 1;
    height: 100%;
    min-height: 0;
    position: relative;
    width: 100%;
}

/* Button Glow (Re-added) */
.glow-btn {
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.3);
    transition: all 0.3s ease;
}

.glow-btn:hover {
    box-shadow: 0 0 25px rgba(34, 197, 94, 0.5);
    transform: translateY(-1px);
}

/* Responsive adjustments */
@media (max-width: 1100px) {
    .simulation-container-v2 {
        height: auto;
    }

    .simulation-split-bottom {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .sim-stats-card {
        height: auto;
    }

    .chart-card.full-height {
        height: 500px;
    }
}

@media (max-width: 700px) {
    .simulation-controls-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .sim-inputs-horizontal {
        width: 100%;
        justify-content: space-between;
    }
}

/* ============================================
   SORTABLE TABLE COLUMNS
   ============================================ */

.trades-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.trades-table th.sortable:hover {
    background: var(--hover-bg);
}

.sort-indicator {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.7rem;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.sort-indicator::after {
    content: '\2195';
}

.trades-table th.sortable.sort-asc .sort-indicator,
.trades-table th.sortable.sort-desc .sort-indicator {
    opacity: 1;
    color: var(--accent-blue);
}

.trades-table th.sortable.sort-asc .sort-indicator::after {
    content: '\2191';
}

.trades-table th.sortable.sort-desc .sort-indicator::after {
    content: '\2193';
}

/* ============================================
   MONTHLY GROUP HEADERS (Subtle Style)
   ============================================ */

.month-group-header {
    background: transparent;
    cursor: pointer;
}

.month-group-header td {
    padding: 8px 16px !important;
    font-weight: 500;
    border-bottom: 1px solid var(--border-color) !important;
}

.month-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.collapse-icon {
    font-size: 0.65rem;
    color: var(--text-secondary);
    opacity: 0.7;
    transition: transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    flex-shrink: 0;
}

.month-group-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.month-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.month-trade-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
    font-weight: 400;
}

.month-pnl {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.9;
}

.month-pnl.positive {
    color: var(--accent-green);
}

.month-pnl.negative {
    color: var(--accent-red);
}

.trade-row.collapsed {
    display: none;
    visibility: collapse;
    pointer-events: none;
}

.trade-row {
    background: transparent;
}

/* Prevent layout shifts on month headers */
.month-group-header td {
    height: 40px;
    box-sizing: border-box;
}

.month-group-header {
    contain: layout style;
}

/* Mobile responsive for month headers */
@media (max-width: 768px) {
    .month-header-content {
        flex-wrap: wrap;
        gap: 6px;
    }

    .sort-indicator {
        display: none;
    }
}

/* ============================================
   DAY VIEW STYLES
   ============================================ */

#view-day.hidden {
    display: none;
}

#view-day {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Day View Header */
.day-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.day-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.day-back-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.day-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.day-nav h2 {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
}

.day-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.day-nav-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Day Summary Cards */
.day-summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.day-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.day-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.day-stat-value.positive {
    color: var(--accent-green);
}

.day-stat-value.negative {
    color: var(--accent-red);
}

/* Day Notes Section */
.day-notes-section {
    display: flex;
    flex-direction: column;
}

.day-notes-card.card {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1rem;
}

.day-notes-card .section-header {
    padding: 0;
    margin: 0 0 0.75rem 0;
}

.day-notes-card .section-header h3 {
    margin: 0;
}

.day-notes-textarea {
    flex: 1;
    width: 100%;
    margin: 0;
    padding: 0.75rem 1rem;
    background: var(--pill-bg);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    outline: none;
}

.day-notes-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Daily Note Modal Content */
.daily-note-modal-content {
    max-width: 600px;
}

.daily-note-modal-content textarea {
    min-height: 200px;
}

/* Day View Left Column (Notes + Trade Selector stacked) */
.day-left-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.day-left-column .day-notes-section {
    flex: 2;  /* 2/3 of vertical space */
}

.day-left-column .trade-selector-panel {
    flex: 1;  /* 1/3 of vertical space */
}

/* Day View Top Section (Notes + Trade Selector + Chart) */
.day-view-top {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    min-height: 450px;
    align-items: stretch;
}

/* Trade Selector Panel */
.trade-selector-panel.card {
    display: flex;
    flex-direction: column;
    padding: 1rem;
}


.trade-selector-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.trade-selector-list:hover {
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.trade-selector-list::-webkit-scrollbar {
    width: 4px;
}

.trade-selector-list::-webkit-scrollbar-track {
    background: transparent;
}

.trade-selector-list::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 2px;
}

.trade-selector-list:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

.trade-selector-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.trade-selector-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-right: 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.trade-selector-row:hover {
    background: var(--hover-bg);
}

.trade-selector-row.selected {
    background: var(--pill-bg);
    border-color: var(--border-color);
}

.trade-selector-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.trade-selector-symbol {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.trade-selector-side {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.trade-selector-side.b,
.trade-selector-side.l {
    color: var(--accent-green);
    background: rgba(34, 197, 94, 0.15);
}

.trade-selector-side.s,
.trade-selector-side.ss {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.15);
}

.trade-selector-qty {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.trade-selector-pnl {
    font-weight: 600;
    font-size: 0.9rem;
}

.trade-selector-pnl.positive {
    color: var(--accent-green);
}

.trade-selector-pnl.negative {
    color: var(--accent-red);
}

/* Day Chart Panel */
.day-chart-panel.card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1rem;
}

.day-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    margin: -12px 0 0.75rem 0;
}

.day-chart-panel .day-chart-header h3 {
    margin: 8px 0 0 0 !important;
}

.timeframe-selector {
    display: flex;
    background: var(--bg-dark);
    padding: 3px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    gap: 2px;
    position: relative;
    top: 5px;
}

.timeframe-btn {
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.timeframe-btn:hover {
    color: var(--text-primary);
}

.timeframe-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.day-chart-container {
    flex: 1;
    min-height: 400px;
    position: relative;
    margin-top: 0;
}

.chart-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
}

.chart-placeholder i {
    font-size: 3rem;
    opacity: 0.3;
}

.chart-placeholder span {
    font-size: 0.9rem;
}

.chart-placeholder.chart-error {
    color: var(--accent-red);
}

.chart-placeholder.chart-error i {
    opacity: 0.6;
}

/* Chart Loading State */
.chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
    background: var(--bg-card);
}

.chart-loading i {
    font-size: 2rem;
    opacity: 0.6;
}

.chart-loading span {
    font-size: 0.9rem;
}

/* Spinning animation for loading icon */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinning {
    animation: spin 1s linear infinite;
}

/* Day Trades Detail Table */
.day-trades-detail {
    overflow-x: auto;
}

/* TradingView Widget Container */
.tradingview-widget-container {
    height: 100%;
    width: 100%;
}

.tradingview-widget-container__widget {
    height: 100%;
    width: 100%;
}

/* Day View Responsive */
@media (max-width: 1000px) {
    .day-view-top {
        grid-template-columns: 1fr;
        grid-template-rows: auto 400px;
    }

    .day-left-column {
        display: flex;
        flex-direction: row;
        gap: 1rem;
    }

    .day-left-column .day-notes-section,
    .day-left-column .trade-selector-panel {
        flex: 1;
        max-height: 200px;
    }

    .trade-selector-panel {
        max-height: 200px;
    }

    .trade-selector-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .trade-selector-row {
        flex: 0 0 auto;
        padding: 8px 12px;
    }
}

@media (max-width: 768px) {
    .day-view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .day-nav {
        width: 100%;
        justify-content: center;
    }

    .day-nav h2 {
        font-size: 1rem;
    }

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

    .day-stat-value {
        font-size: 1.25rem;
    }

    .day-view-top {
        grid-template-rows: auto 350px;
    }

    .day-chart-container {
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .day-summary-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .day-summary-card {
        padding: 0.75rem;
    }

    .day-stat-value {
        font-size: 1.1rem;
    }

    .day-left-column {
        flex-direction: column;
    }

    .day-left-column .day-notes-section,
    .day-left-column .trade-selector-panel {
        max-height: none;
    }

    .day-left-column .day-notes-section {
        max-height: 150px;
    }

    .day-left-column .trade-selector-panel {
        max-height: 180px;
    }

    .trade-selector-list {
        flex-direction: column;
    }

    .trade-selector-row {
        width: 100%;
    }
}

/* Clickable date cell in trades table */
.date-cell-clickable {
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.date-cell-clickable:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

.date-cell-clickable::after {
    content: '';
    position: absolute;
    inset: -4px -8px;
    border-radius: 4px;
    background: transparent;
    transition: background 0.15s;
    z-index: -1;
}

.date-cell-clickable:hover::after {
    background: rgba(59, 130, 246, 0.1);
}