/*
 * TradeVault - Terminal Noir Theme
 * A premium dark trading journal aesthetic
 */

/* ========================================
   CSS Variables & Theme
   ======================================== */
:root {
    /* Core Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-elevated: #22222f;
    --bg-hover: #2a2a3a;
    
    /* Borders */
    --border-primary: #2a2a3a;
    --border-secondary: #3a3a4a;
    --border-accent: #4a4a5a;
    
    /* Text */
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b0;
    --text-tertiary: #707080;
    --text-muted: #505060;
    
    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-primary-hover: #818cf8;
    --accent-secondary: #8b5cf6;
    --accent-glow: rgba(99, 102, 241, 0.3);
    
    /* Semantic Colors */
    --profit: #22c55e;
    --profit-bg: rgba(34, 197, 94, 0.1);
    --profit-glow: rgba(34, 197, 94, 0.3);
    --loss: #ef4444;
    --loss-bg: rgba(239, 68, 68, 0.1);
    --loss-glow: rgba(239, 68, 68, 0.3);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info: #06b6d4;
    --info-bg: rgba(6, 182, 212, 0.1);
    
    /* Status Colors */
    --status-idea: #8b5cf6;
    --status-watching: #f59e0b;
    --status-active: #06b6d4;
    --status-closed: #6b7280;
    
    /* Typography */
    --font-display: 'Space Grotesk', 'Inter', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px var(--accent-glow);
    --shadow-profit: 0 0 20px var(--profit-glow);
    --shadow-loss: 0 0 20px var(--loss-glow);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --max-content-width: 1800px;
}

/* ========================================
   Reset & Base Styles
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background gradient removed for readability - solid #0a0a0f via --bg-primary */
/* body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
} */

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
h5, h6 { font-size: 1rem; }

p {
    color: var(--text-secondary);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-primary-hover);
}

.text-profit { color: var(--profit); }
.text-loss { color: var(--loss); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.font-mono { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }

/* ========================================
   Layout Components
   ======================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-slow);
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 var(--spacing-lg);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon-img {
    width: 28px !important;
    height: 28px !important;
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-md);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--spacing-lg);
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-xs);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    margin-bottom: 2px;
}

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

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent-primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.nav-notification-dot {
    margin-left: auto;
    width: 8px;
    height: 8px;
    background: var(--loss);
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100%;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-xl);
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

#sidebar-toggle {
    display: none;
}

.header-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
}

.header-title h1 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* Search Bar */
.search-bar {
    position: relative;
    width: 300px;
    z-index: 1051;
}

.search-bar input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    padding-left: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-bar > i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Page Content */
.page-content {
    padding: var(--spacing-xl);
    max-width: var(--max-content-width);
    margin: 0 auto;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* ========================================
   Cards & Containers
   ======================================== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-secondary);
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.card-body {
    padding: var(--spacing-lg);
}

.card-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-primary);
    background: var(--bg-tertiary);
}

/* Stat Cards */
.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    position: relative;
    overflow: visible;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.profit::before {
    background: var(--profit);
}

.stat-card.loss::before {
    background: var(--loss);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

/* Dashboard/Analytics 6-column stat grids - compact cards */
.grid-stats:has(.stat-card:nth-child(6)) {
    gap: var(--spacing-sm);
}

.grid-stats:has(.stat-card:nth-child(6)) .stat-card {
    padding: var(--spacing-md);
}

.grid-stats:has(.stat-card:nth-child(6)) .stat-value {
    font-size: 1.35rem;
}

.grid-stats:has(.stat-card:nth-child(6)) .stat-label {
    font-size: 0.7rem;
}

.grid-stats:has(.stat-card:nth-child(6)) .stat-change {
    font-size: 0.75rem;
}

/* Fallback for browsers without :has() - using inline style detection */
.grid-stats[style*="repeat(6"] .stat-value {
    font-size: 1.35rem;
}

.stat-change {
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: var(--spacing-xs);
}

/* ========================================
   Trade Cards
   ======================================== */
.trade-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: all var(--transition-base);
    cursor: pointer;
}

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

.trade-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.trade-ticker {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.ticker-symbol {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ticker-type {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.trade-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.status-idea {
    background: rgba(139, 92, 246, 0.2);
    color: var(--status-idea);
}

.status-watching {
    background: rgba(245, 158, 11, 0.2);
    color: var(--status-watching);
}

.status-active {
    background: rgba(6, 182, 212, 0.2);
    color: var(--status-active);
}

.status-closed {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.trade-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.trade-meta-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.trade-meta-item i {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.trade-pnl {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.125rem;
}

.trade-pnl.profit {
    color: var(--profit);
}

.trade-pnl.loss {
    color: var(--loss);
}

/* ========================================
   Forms & Inputs
   ======================================== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.form-label.required::after {
    content: '*';
    color: var(--loss);
    margin-left: 4px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

/* Number Input Spinners - Styled */
input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

/* Custom number input with visible styled spinners */
.number-input-wrapper {
    position: relative;
    display: inline-flex;
    align-items: stretch;
}

.number-input-wrapper input[type="number"] {
    padding-right: 32px;
}

.number-input-wrapper .number-controls {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    width: 28px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    overflow: hidden;
}

.number-input-wrapper .number-controls button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 10px;
    padding: 0;
    transition: all var(--transition-fast);
}

.number-input-wrapper .number-controls button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.number-input-wrapper .number-controls button:first-child {
    border-bottom: 1px solid var(--border-primary);
}

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

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23707080'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

.form-error {
    font-size: 0.8125rem;
    color: var(--loss);
    margin-top: var(--spacing-xs);
}

/* Input Groups */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-input {
    flex: 1;
    min-width: 0;
}

/* When only append exists */
.input-group .form-input:first-child:not(:last-child) {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

/* When only prepend exists */
.input-group .form-input:last-child:not(:first-child) {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-left: none;
}

/* When both prepend and append exist */
.input-group .input-group-prepend + .form-input:not(:last-child) {
    border-radius: 0;
    border-left: none;
}

.input-group-prepend {
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.input-group-append {
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.form-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

/* Rating Input */
.rating-input {
    display: flex;
    gap: var(--spacing-xs);
}

.rating-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.rating-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

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

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-primary-hover);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-secondary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-success {
    background: var(--profit);
    color: white;
}

.btn-success:hover:not(:disabled) {
    box-shadow: var(--shadow-profit);
}

.btn-danger {
    background: var(--loss);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    box-shadow: var(--shadow-loss);
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8125rem;
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ========================================
   Badges & Tags
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-primary {
    background: var(--accent-glow);
    color: var(--accent-primary);
}

.badge-success {
    background: var(--profit-bg);
    color: var(--profit);
}

.badge-danger {
    background: var(--loss-bg);
    color: var(--loss);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-accent {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
}

.badge-accent:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
}

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
}

.tag-remove {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

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

/* ========================================
   Tables
   ======================================== */
.table-container {
    overflow-x: auto;
}

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

.table th,
.table td,
.data-table th,
.data-table td {
    padding: var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
}

.table th,
.data-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-tertiary);
}

.table tr:hover td,
.data-table tr:hover td {
    background: var(--bg-tertiary);
}

.table td,
.data-table td {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========================================
   Modals
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    margin: var(--spacing-xl);
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-xl);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-lg {
    max-width: 800px;
}

.modal-xl {
    max-width: 1000px;
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    max-height: calc(85vh - 160px);
}

.modal-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

/* ========================================
   Alerts & Notifications
   ======================================== */
.alert {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
}

.alert-success {
    background: var(--profit-bg);
    border-color: var(--profit);
    color: var(--profit);
}

.alert-danger {
    background: var(--loss-bg);
    border-color: var(--loss);
    color: var(--loss);
}

.alert-warning {
    background: var(--warning-bg);
    border-color: var(--warning);
    color: var(--warning);
}

.alert-info {
    background: var(--info-bg);
    border-color: var(--info);
    color: var(--info);
}

/* Notification Dropdown */
.notification-wrapper {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--loss);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + var(--spacing-sm));
    right: 0;
    width: 360px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    display: none;
}

.notification-dropdown.show {
    display: block;
}

.notification-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h4 {
    margin: 0;
    font-size: 0.9375rem;
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-secondary);
    display: flex;
    gap: var(--spacing-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.notification-item:hover {
    background: var(--bg-hover);
}

.notification-item.unread {
    background: rgba(var(--accent-primary-rgb), 0.05);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-primary);
}

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

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.notification-icon.like {
    background: rgba(239, 68, 68, 0.1);
    color: var(--loss);
}

.notification-icon.comment {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.notification-icon.follow {
    background: rgba(16, 185, 129, 0.1);
    color: var(--profit);
}

.notification-icon.system {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-muted);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-text {
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 2px;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.notification-empty {
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--text-muted);
}

.notification-empty i {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
    opacity: 0.5;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========================================
   Dashboard Grid
   ======================================== */
.dashboard-grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

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

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ========================================
   Trade Lifecycle Steps
   ======================================== */
.trade-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
    position: relative;
}

.trade-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50px;
    right: 50px;
    height: 2px;
    background: var(--border-primary);
}

.trade-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    position: relative;
    z-index: 1;
}

.step-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-muted);
    transition: all var(--transition-base);
}

.trade-step.active .step-icon {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.trade-step.completed .step-icon {
    background: var(--profit);
    border-color: var(--profit);
    color: white;
}

.step-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

.trade-step.active .step-label {
    color: var(--accent-primary);
}

.trade-step.completed .step-label {
    color: var(--profit);
}

/* ========================================
   Conviction Matrix
   ======================================== */
.conviction-matrix {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.conviction-cell {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.conviction-cell:hover {
    transform: scale(1.1);
}

/* ========================================
   Charts Placeholder
   ======================================== */
.chart-container {
    height: 300px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* ========================================
   Empty States
   ======================================== */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-muted);
}

.empty-state h3 {
    margin-bottom: var(--spacing-sm);
}

.empty-state p {
    margin-bottom: var(--spacing-lg);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================
   Loading States
   ======================================== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-primary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    #sidebar-toggle {
        display: flex !important;
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =====================================================
   Day of Week Performance Grid (Analytics)
   ===================================================== */

/* Utility: Prevent card from stretching in grid */
.card-auto-height {
    align-self: start;
}

.dow-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-xs);
}

.dow-grid-row-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-xs);
    margin-top: var(--spacing-xs);
    max-width: 66.666%;
    margin-left: auto;
    margin-right: auto;
}

.dow-card {
    text-align: center;
    padding: var(--spacing-sm) var(--spacing-xs);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.dow-day {
    font-weight: 600;
    font-size: 0.8rem;
}

.dow-pnl {
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    margin: 2px 0;
}

.dow-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Mobile: stack to 2 columns for both rows */
@media (max-width: 600px) {
    .dow-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dow-grid .dow-card:nth-child(3) {
        grid-column: span 2;
    }
    
    .dow-grid-row-2 {
        max-width: 100%;
    }
    
    .dow-pnl {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    /* Prevent horizontal overflow on mobile */
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    :root {
        --spacing-lg: 1rem;
        --spacing-xl: 1.25rem;
    }
    
    .page-content {
        padding: var(--spacing-md);
    }
    
    .grid-cols-4,
    .grid-cols-3,
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .header {
        padding: 0 var(--spacing-md);
        gap: var(--spacing-sm);
        height: 56px;
    }
    
    .header-title h1 {
        font-size: 1.125rem;
    }
    
    .search-bar {
        display: none;
    }
    
    /* Compact header on mobile */
    .header-right .btn-primary span {
        display: none;
    }
    
    .header-right .btn-primary {
        padding: var(--spacing-sm) var(--spacing-md);
        min-width: 44px;
        min-height: 44px;
    }
    
    .user-menu span {
        display: none;
    }
    
    /* Notification dropdown */
    .notification-dropdown {
        position: fixed;
        top: 56px;
        left: var(--spacing-md);
        right: var(--spacing-md);
        width: auto;
        max-height: calc(100vh - 80px);
    }
    
    /* Modals - near full screen on mobile */
    .modal-overlay {
        align-items: flex-end;
        /* Ensure modal overlay respects safe areas */
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .modal {
        margin: 0;
        max-width: 100%;
        width: 100%;
        max-height: calc(90vh - env(safe-area-inset-bottom, 0px));
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        max-height: none;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-footer {
        flex-direction: column;
        gap: var(--spacing-sm);
        flex-shrink: 0;
        /* Add safe area padding for iPhone home indicator */
        padding-bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom, 0px));
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Stat cards - 2 columns */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--spacing-sm) !important;
    }
    
    .stat-card {
        padding: var(--spacing-md);
    }
    
    .stat-value {
        font-size: 1.375rem;
    }
    
    .stat-label {
        font-size: 0.6875rem;
    }
    
    /* Cards */
    .card-header {
        padding: var(--spacing-md);
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .card-body {
        padding: var(--spacing-md);
    }
    
    .card-title {
        font-size: 0.9375rem;
    }
    
    /* Trade cards */
    .trade-card {
        padding: var(--spacing-md);
    }
    
    .ticker-symbol {
        font-size: 1.125rem;
    }
    
    /* Buttons - larger touch targets */
    .btn {
        min-height: 44px;
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 6px var(--spacing-sm);
    }
    
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Forms */
    .form-input,
    .form-select,
    .form-textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .form-group {
        margin-bottom: var(--spacing-md);
    }
    
    /* Tables */
    .table-container {
        margin: 0 calc(-1 * var(--spacing-md));
        padding: 0 var(--spacing-md);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Make any table inside a card scrollable */
    .card .table,
    .card .data-table,
    .card table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    
    .table th,
    .table td {
        padding: var(--spacing-sm);
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    /* Responsive grids - stack on mobile */
    .responsive-grid-2-1,
    .responsive-grid-2col,
    .responsive-grid-3col {
        grid-template-columns: 1fr !important;
    }
    
    .responsive-grid-2-1 > *:last-child {
        order: 0;
    }
    
    /* Hide sidebar panel on mobile */
    .sidebar-panel {
        display: none;
    }
    
    /* Tabs - horizontal scroll */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: var(--spacing-md);
        margin-bottom: var(--spacing-md);
    }
    
    .tab {
        flex-shrink: 0;
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    /* Empty states */
    .empty-state {
        padding: var(--spacing-lg);
    }
    
    .empty-state-icon {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.25rem !important;
    }
    
    /* Alert boxes */
    .alert {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.875rem;
        flex-direction: column;
        gap: var(--spacing-sm);
        text-align: center;
    }
    
    .alert .btn {
        width: 100%;
    }
    
    /* Detail grids in trade view */
    .detail-grid {
        grid-template-columns: 1fr !important;
        gap: var(--spacing-sm) !important;
    }
    
    /* P&L display */
    .pnl-display {
        font-size: 2rem;
    }
    
    /* Filter bar */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-bar > * {
        width: 100%;
    }
    
    /* Action buttons in cards */
    .card-header .btn {
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .header-title h1 {
        font-size: 1rem;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .header-right {
        gap: var(--spacing-xs);
    }
    
    /* Single column stats on very small screens */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Notification dropdown full width */
    .notification-dropdown {
        left: var(--spacing-sm);
        right: var(--spacing-sm);
    }
    
    .notification-item {
        padding: var(--spacing-sm);
    }
    
    /* Trade card adjustments */
    .trade-card-header {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .trade-pnl {
        align-self: flex-start;
    }
    
    /* Timeline adjustments */
    .timeline {
        padding-left: var(--spacing-md);
    }
    
    .timeline::before {
        left: 0;
    }
    
    .timeline-item {
        padding-left: var(--spacing-md);
    }
    
    /* Inline button groups stack */
    .btn-group-inline {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group-inline .btn {
        width: 100%;
    }
}

/* ========================================
   Utility Classes
   ======================================== */
   
/* Responsive two-column layout with sidebar */
.layout-with-sidebar {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--spacing-xl);
}

.layout-with-sidebar-narrow {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--spacing-xl);
}

/* Responsive grid utilities - collapse on mobile (handled in media queries) */
.responsive-grid-2col,
.responsive-grid-3col {
    /* Default stays as inline style, media queries override */
}

@media (max-width: 768px) {
    .layout-with-sidebar,
    .layout-with-sidebar-narrow {
        grid-template-columns: 1fr;
    }
    
    .sidebar-panel {
        display: none;
    }
    
    /* CRITICAL: Override inline grid styles on mobile */
    /* These use !important to override inline style="" attributes */
    .responsive-grid-2-1,
    .responsive-grid-2col,
    .responsive-grid-3col,
    [class*="responsive-grid"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Detail grids in trade view */
    .detail-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Prevent horizontal overflow on main content */
    .main-content {
        overflow-x: hidden;
    }
    
    .page-content {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    /* Tables - ensure they scroll within container, not page */
    .card-body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px; /* Force table to have minimum width so columns don't crush */
    }
    
    /* ========== MOBILE GRID OVERRIDES ========== */
    /* Override inline styles on stat grids */
    .grid-stats,
    .stats-grid,
    .sidebar-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Journal rating inputs - stack on mobile */
    .card-body > div[style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Fear & Greed widget mobile */
    .fg-widget {
        padding: var(--spacing-sm);
    }
    
    .fg-value-number {
        font-size: 1.5rem;
    }
    
    /* Watchlist research layout mobile */
    .research-layout {
        gap: var(--spacing-md);
    }
    
    .research-sidebar {
        max-height: none;
    }
    
    /* Trade card mobile improvements */
    .trade-meta {
        flex-wrap: wrap;
        gap: var(--spacing-xs);
    }
    
    .trade-meta-item {
        font-size: 0.75rem;
    }
    
    /* Journal date nav mobile */
    .journal-date-nav {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .journal-date-center {
        order: -1;
        width: 100%;
        text-align: center;
        margin-bottom: var(--spacing-sm);
    }
    
    .journal-date-center input[type="date"] {
        width: 100%;
        text-align: center;
    }
    
    /* Journal ratings grid - 2 columns on tablet */
    .journal-ratings-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--spacing-md) !important;
    }
}

@media (max-width: 480px) {
    /* Single column stats on very small screens */
    .grid-stats,
    .stats-grid,
    .sidebar-stats {
        grid-template-columns: 1fr !important;
    }
    
    /* Journal ratings grid - stack on mobile */
    .journal-ratings-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Smaller stat cards */
    .stat-card {
        padding: var(--spacing-sm);
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.6875rem;
    }
    
    /* Compact trade cards */
    .trade-card {
        padding: var(--spacing-sm);
    }
    
    .ticker-symbol {
        font-size: 1rem;
    }
}

.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* ========================================
   Wide Screen Layout Constraints
   ======================================== */
/* On large screens, constrain the right sidebar column so smaller widgets
   don't stretch awkwardly while allowing the left column to use more space */
@media (min-width: 1400px) {
    .responsive-grid-2-1 {
        grid-template-columns: 1fr 380px !important;
    }
}

@media (min-width: 1600px) {
    .responsive-grid-2-1 {
        grid-template-columns: 1fr 420px !important;
    }
}

/* ========================================
   Auth Pages
   ======================================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
}

.auth-logo {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.auth-title {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.auth-footer {
    text-align: center;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-primary);
}

/* ============================================
   Multi-Leg Options Support - CSS Additions
   Add these styles to style.css
   ============================================ */

/* Leg Card Styling */
.leg-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.leg-card:hover {
    border-color: var(--border-secondary);
}

.leg-card:focus-within {
    border-color: var(--accent-primary);
}

.leg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
}

.leg-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.leg-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    margin-right: var(--spacing-xs);
}

.leg-remove-btn {
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}

.leg-remove-btn:hover {
    opacity: 1;
    color: var(--loss);
}

.leg-body {
    padding: var(--spacing-md);
}

.leg-row {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.leg-row:last-child {
    margin-bottom: 0;
}

.leg-row .form-group {
    margin-bottom: 0;
}

/* Compact form styles for legs */
.form-label-sm {
    font-size: 0.6875rem;
    margin-bottom: 2px;
}

.form-select-sm,
.form-input-sm {
    padding: 6px 8px;
    font-size: 0.8125rem;
    height: 32px;
}

.input-group-sm .form-input {
    padding: 6px 8px;
    font-size: 0.8125rem;
    height: 32px;
}

.input-group-sm .input-group-append {
    padding: 6px 8px;
    font-size: 0.75rem;
}

/* Greeks collapsible section */
.leg-greeks {
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px dashed var(--border-primary);
}

.leg-greeks summary {
    font-size: 0.6875rem;
    user-select: none;
}

.leg-greeks summary::-webkit-details-marker {
    display: none;
}

.leg-greeks summary i {
    transition: transform var(--transition-fast);
    margin-right: 4px;
    font-size: 0.625rem;
}

.leg-greeks[open] summary i {
    transform: rotate(90deg);
}

/* Multi-leg header */
.multi-leg-header {
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-primary);
}

/* Net Premium Display */
.net-premium-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-md);
    border: 1px solid var(--border-primary);
}

.net-premium-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.net-premium-value {
    font-family: var(--font-mono);
    font-size: 1.125rem;
    font-weight: 700;
}

.net-premium-value.credit {
    color: var(--profit);
}

.net-premium-value.debit {
    color: var(--loss);
}

/* Legs Table (for trade detail view) */
.legs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.legs-table th {
    text-align: left;
    padding: var(--spacing-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-primary);
}

.legs-table td {
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--border-primary);
    vertical-align: middle;
}

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

.legs-table .leg-type {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.legs-table .leg-type-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
}

.legs-table .leg-type-badge.call {
    background: rgba(34, 197, 94, 0.15);
    color: var(--profit);
}

.legs-table .leg-type-badge.put {
    background: rgba(239, 68, 68, 0.15);
    color: var(--loss);
}

.legs-table .leg-action {
    font-size: 0.75rem;
    font-weight: 500;
}

.legs-table .leg-action.buy {
    color: var(--profit);
}

.legs-table .leg-action.sell {
    color: var(--loss);
}

.legs-table .leg-strike {
    font-family: var(--font-mono);
    font-weight: 600;
}

.legs-table .leg-expiration {
    color: var(--text-secondary);
}

.legs-table .leg-premium {
    font-family: var(--font-mono);
}

/* Strategy Summary Card */
.strategy-summary {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border-left: 4px solid var(--accent-primary);
}

.strategy-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.strategy-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.strategy-type-badge {
    padding: 4px 10px;
    background: var(--accent-primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.strategy-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--spacing-md);
}

.strategy-metric {
    text-align: center;
}

.strategy-metric-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.strategy-metric-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Responsive adjustments for legs */
@media (max-width: 768px) {
    .leg-row {
        flex-direction: column;
        gap: var(--spacing-xs);
    }
    
    .leg-row .form-group {
        width: 100%;
    }
    
    .legs-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .legs-table th,
    .legs-table td {
        white-space: nowrap;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    
    .strategy-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Animation for adding legs */
@keyframes slideInLeg {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.leg-card {
    animation: slideInLeg 0.2s ease-out;
}

/* Close trade modal legs section */
.close-legs-section {
    margin-bottom: var(--spacing-lg);
}

.close-legs-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.close-leg-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
}

.close-leg-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.close-leg-info .badge {
    font-size: 0.6875rem;
}

.close-leg-input {
    width: 120px;
}

/* Activate trade modal legs section */
.activate-legs-section {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-primary);
}

.activate-legs-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.activate-legs-section h4 i {
    color: var(--accent-primary);
}


/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

.animate-slide-up {
    animation: slideUp 0.4s ease;
}

/* Staggered animations for lists */
.stagger-animate > * {
    opacity: 0;
    animation: slideUp 0.4s ease forwards;
}

.stagger-animate > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-animate > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-animate > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-animate > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-animate > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-animate > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-animate > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-animate > *:nth-child(8) { animation-delay: 0.4s; }

/* Featured Navigation Items (Journal) */
.nav-item-featured {
    position: relative;
}

.nav-item-featured span {
    position: relative;
    background: linear-gradient(
        90deg, 
        var(--accent-primary) 0%,
        var(--accent-secondary) 25%,
        #c4b5fd 50%,
        var(--accent-secondary) 75%,
        var(--accent-primary) 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShimmer 3s ease-in-out infinite;
}

.nav-item-featured i {
    background: linear-gradient(
        90deg, 
        var(--accent-primary) 0%,
        var(--accent-secondary) 25%,
        #c4b5fd 50%,
        var(--accent-secondary) 75%,
        var(--accent-primary) 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShimmer 3s ease-in-out infinite;
}

.nav-item-featured:hover span,
.nav-item-featured:hover i {
    filter: brightness(1.2);
}

.nav-item-featured.active span,
.nav-item-featured.active i {
    filter: brightness(1.1);
}

@keyframes textShimmer {
    0% {
        background-position: 100% 50%;
    }
    100% {
        background-position: -100% 50%;
    }
}

/* ========================================
   Subscription & Billing Styles
   ======================================== */

/* Pro Badge in Navigation */
.pro-badge-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.125rem 0.375rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    font-size: 0.5rem;
    font-weight: 700;
    border-radius: 3px;
    margin-left: auto;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pro-badge-nav i {
    font-size: 0.5rem;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: white;
}

/* Override nav-item-featured styles for pro-badge-nav */
.nav-item-featured .pro-badge-nav {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: padding-box;
    -webkit-text-fill-color: white;
    background-clip: padding-box;
    animation: none;
}

.nav-item-featured .pro-badge-nav i {
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: white;
    animation: none;
}

/* Beta Badge in Navigation */
.beta-badge-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.125rem 0.375rem;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    font-size: 0.5rem;
    font-weight: 700;
    border-radius: 3px;
    margin-left: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Usage Indicator */
.usage-indicator {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-primary);
}

.usage-indicator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.usage-indicator-label {
    color: var(--text-secondary);
}

.usage-indicator-count {
    color: var(--text-primary);
    font-weight: 500;
}

.usage-indicator-count.at-limit {
    color: var(--warning-color);
}

.usage-indicator-bar {
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

.usage-indicator-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.usage-indicator-fill.warning {
    background: var(--warning-color);
}

.usage-indicator-fill.danger {
    background: var(--error-color);
}

/* Feature Card with Pro Gate */
.feature-card-gated {
    position: relative;
    overflow: hidden;
}

.feature-card-gated::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-card-gated.is-gated::before {
    opacity: 1;
}

.feature-card-gated .pro-gate-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 1rem;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.feature-card-gated.is-gated .pro-gate-overlay {
    opacity: 1;
    pointer-events: auto;
}

.pro-gate-overlay i {
    font-size: 2rem;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.pro-gate-overlay h4 {
    color: var(--text-primary);
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
}

.pro-gate-overlay p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0 0 0.75rem;
}

/* Limit Warning Banner */
.limit-warning-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.limit-warning-banner i {
    color: var(--warning-color);
    font-size: 1.125rem;
}

.limit-warning-banner p {
    flex: 1;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.limit-warning-banner .btn {
    flex-shrink: 0;
}

/* Plan comparison table */
.plan-comparison {
    width: 100%;
    border-collapse: collapse;
}

.plan-comparison th,
.plan-comparison td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
}

.plan-comparison th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
}

.plan-comparison td:not(:first-child) {
    text-align: center;
}

.plan-comparison .feature-name {
    color: var(--text-secondary);
}

.plan-comparison .check {
    color: var(--success-color);
}

.plan-comparison .cross {
    color: var(--text-muted);
}

/* Sidebar plan badge hover effect */
.plan-badge-free:hover {
    background: rgba(99, 102, 241, 0.15) !important;
    border-color: var(--accent-primary) !important;
}

/* ========================================
   Global Search Dropdown
   ======================================== */
.search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: var(--spacing-xs);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1050;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-primary);
}

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

.search-result-item:hover {
    background: var(--bg-tertiary);
}

.search-result-item i {
    color: var(--text-muted);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.search-result-item .result-content {
    flex: 1;
    min-width: 0;
}

.search-result-item .result-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-item .result-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-item .result-type {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.search-result-item.type-trade .result-type { background: rgba(99, 102, 241, 0.2); color: var(--accent-primary); }
.search-result-item.type-journal .result-type { background: rgba(34, 197, 94, 0.2); color: var(--success-color); }
.search-result-item.type-watchlist .result-type { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }

.search-no-results {
    padding: var(--spacing-lg);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.search-section-header {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-primary);
}

/* ========================================
   Journal Tags
   ======================================== */
.tag-input-container {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
}

.journal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
}

.journal-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.journal-tag:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.journal-tag .tag-remove,
.journal-tag .remove-tag {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
    background: none;
    border: none;
    color: inherit;
    font-size: 1rem;
    margin-left: var(--spacing-xs);
    padding: 0;
}

.journal-tag .tag-remove:hover,
.journal-tag .remove-tag:hover {
    opacity: 1;
    color: var(--loss);
}

.tag-input-wrapper {
    position: relative;
    margin-top: var(--spacing-sm);
}

.tag-input-wrapper input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    padding: var(--spacing-xs) 0;
}

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 4px;
}

.tag-suggestion {
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    font-size: 0.875rem;
    transition: background var(--transition-fast);
}

.tag-suggestion:hover,
.tag-suggestion.highlighted {
    background: var(--bg-tertiary);
}

/* ========================================
   Journal Date Navigation
   ======================================== */
.journal-date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
}

.journal-date-nav .btn-ghost {
    flex-shrink: 0;
}

.journal-date-center {
    text-align: center;
    flex: 1;
    min-width: 0;
}

.journal-date-center .form-input {
    text-align: center;
    font-size: 1.125rem;
    font-weight: 600;
    max-width: 180px;
    margin: 0 auto;
    display: block;
}

.journal-day-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

/* ========================================
   Tablet: Ensure content fits on iPad/tablet screens
   ======================================== */
@media (max-width: 1280px) {
    /* Stats grid - 3 columns on tablets to prevent overflow */
    .grid-stats {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    /* Slightly reduce stat card padding */
    .grid-stats .stat-card {
        padding: var(--spacing-md);
    }

    .grid-stats .stat-value {
        font-size: 1.35rem;
    }

    .grid-stats .stat-label {
        font-size: 0.7rem;
    }
}

/* Tablet: Collapse 2-column layout earlier */
@media (max-width: 1100px) {
    /* Main dashboard grid collapses to single column */
    .responsive-grid-2-1 {
        grid-template-columns: 1fr !important;
    }

    /* Ensure page content doesn't overflow */
    .page-content {
        overflow-x: hidden;
    }
}

/* ========================================
   Mobile: Enhanced Stats Grid Fixes
   ======================================== */
@media (max-width: 768px) {
    /* Stats grid - ensure scrollable overflow */
    .grid-stats {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--spacing-sm) !important;
        overflow-x: visible !important;
    }
    
    /* Force stats to fit within their containers */
    .stat-card {
        min-width: 0 !important;
        overflow: visible;
    }
    
    .stat-value {
        font-size: 1.25rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Weekly reviews - 3 columns on mobile for main stats */
    .grid-stats[style*="repeat(6"] {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    /* Responsive layout sidebars */
    .layout-with-sidebar,
    .layout-with-sidebar-narrow {
        display: block !important;
    }
    
    .layout-with-sidebar > div:last-child,
    .layout-with-sidebar-narrow > div:last-child {
        margin-top: var(--spacing-lg);
    }
    
    /* Page content overflow prevention */
    .page-content {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    /* Card body overflow */
    .card-body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fear & Greed widget mobile */
    .fg-widget {
        padding: var(--spacing-sm);
    }
    
    .fg-value-number {
        font-size: 1.5rem !important;
    }
    
    /* Journal date navigation on mobile */
    .journal-date-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--spacing-sm);
    }
    
    .journal-date-nav .btn-ghost {
        order: 2;
        padding: var(--spacing-sm);
        font-size: 0.875rem;
    }
    
    .journal-date-center {
        order: 1;
        width: 100%;
        margin-bottom: var(--spacing-xs);
    }
    
    /* Dashboard widgets container - ensure scrollable */
    .dashboard-widgets {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Trade cards on mobile */
    .trade-card {
        min-width: 0;
    }
    
    .trade-meta {
        flex-wrap: wrap;
    }
    
    .trade-meta-item {
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    /* Extra small screens - single column stats */
    .grid-stats {
        grid-template-columns: 1fr 1fr !important;
    }
    
    .grid-stats[style*="repeat(6"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .stat-value {
        font-size: 1.125rem !important;
    }
    
    .stat-label {
        font-size: 0.625rem !important;
    }
    
    /* Journal date navigation - smaller on very small screens */
    .journal-date-nav .btn-ghost {
        font-size: 0.75rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    
    .journal-date-nav .btn-ghost i {
        margin: 0;
    }
    
    /* Hide text, show only icons on very small screens */
    .journal-date-nav .btn-ghost span {
        display: none;
    }
}

/* ========================================
   Search bar mobile visibility toggle
   ======================================== */
@media (max-width: 1024px) {
    .search-bar {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: auto;
        padding: var(--spacing-md);
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-primary);
        display: none;
        z-index: 100;
    }
    
    .search-bar.mobile-visible {
        display: block;
    }
    
    .search-bar input {
        width: 100%;
    }
    
    /* Mobile search toggle button */
    .mobile-search-toggle {
        display: flex !important;
    }
}

@media (min-width: 1025px) {
    .mobile-search-toggle {
        display: none !important;
    }
}

/* ========================================
   Glowing Button Effect (Watchlist CTA)
   ======================================== */
.btn-glow-pulse {
    position: relative;
    animation: btn-glow-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
}

@keyframes btn-glow-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 0 12px 3px rgba(99, 102, 241, 0.3), 
                    0 0 20px 6px rgba(139, 92, 246, 0.15);
    }
}

/* Stop animation on hover to indicate interactivity */
.btn-glow-pulse:hover {
    animation: none;
    box-shadow: 0 0 15px 5px rgba(99, 102, 241, 0.35);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .btn-glow-pulse {
        animation: none;
        box-shadow: 0 0 8px 2px rgba(99, 102, 241, 0.25);
    }
}

/* ========================================
   Custom Indicators (Watchlist Technicals)
   ======================================== */
.custom-indicators-container {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.indicator-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
    min-height: 32px;
}

.indicator-tags:empty {
    display: none;
}

.indicator-tags:empty + .indicator-add-form {
    margin-top: 0;
}

.indicator-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-full);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8125rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.indicator-tag:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.15));
    border-color: rgba(99, 102, 241, 0.5);
}

.indicator-name {
    font-family: var(--font-mono);
    font-weight: 500;
}

.indicator-signal {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: var(--radius-sm);
}

.indicator-signal.signal-bullish {
    color: var(--profit);
    background: rgba(16, 185, 129, 0.15);
}

.indicator-signal.signal-bearish {
    color: var(--loss);
    background: rgba(239, 68, 68, 0.15);
}

.indicator-signal.signal-neutral {
    color: var(--text-secondary);
    background: rgba(148, 163, 184, 0.15);
}

.indicator-note-icon {
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: help;
}

.indicator-note-icon:hover {
    color: var(--accent-primary);
}

.indicator-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all 0.15s ease;
    font-size: 0.625rem;
}

.indicator-remove:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--loss);
}

.indicator-add-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.indicator-add-row {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.indicator-add-row .form-input,
.indicator-add-row .form-select {
    font-size: 0.875rem;
    padding: var(--spacing-xs) var(--spacing-sm);
    height: 34px;
}

.indicator-note-row {
    margin-top: var(--spacing-xs);
}

.indicator-note-row .form-input {
    font-size: 0.875rem;
    padding: var(--spacing-xs) var(--spacing-sm);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .indicator-add-row {
        flex-wrap: wrap;
    }
    
    .indicator-add-row .form-input {
        flex: 1 1 100% !important;
        margin-bottom: var(--spacing-xs);
    }
    
    .indicator-add-row .form-select {
        flex: 1 !important;
    }
    
    .indicator-add-row .btn {
        flex: 0 0 auto;
    }
}

/* ============================================
   ANALYTICS PAGE STYLES
   ============================================ */

.analytics-page {
    max-width: var(--max-content-width);
    margin: 0 auto;
}

/* Tab Navigation */
.analytics-tabs {
    display: flex;
    gap: var(--spacing-xs);
    background: var(--bg-secondary);
    padding: var(--spacing-xs);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.analytics-tab {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.analytics-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.analytics-tab.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.analytics-tab i {
    font-size: 0.875rem;
}

.tab-badge {
    font-size: 0.625rem;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.tab-badge.pro {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

/* Analytics Grid */
.analytics-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
}

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

/* Card Highlight */
.card-highlight {
    border: 1px solid rgba(99, 102, 241, 0.3);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
}

.card-locked {
    border: 1px dashed var(--border-primary);
    background: var(--bg-tertiary);
}

/* Research Comparison */
.research-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--spacing-md);
    align-items: stretch;
}

@media (max-width: 768px) {
    .research-comparison {
        grid-template-columns: 1fr;
    }
    .comparison-vs {
        display: none;
    }
}

.comparison-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.comparison-card.researched {
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.comparison-card.impulse {
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.comparison-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: 600;
    font-size: 0.875rem;
}

.comparison-card.researched .comparison-header {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
}

.comparison-card.impulse .comparison-header {
    background: rgba(239, 68, 68, 0.1);
    color: var(--loss);
}

.comparison-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
}

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

.comp-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.comp-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparison-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* Insight Banner */
.insight-banner {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.insight-banner.positive {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--profit);
}

.insight-banner.negative {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--loss);
}

.insight-banner.neutral {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--text-secondary);
}

/* Insights Grid */
.insights-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.insight-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.insight-card.insight-positive {
    border-left: 3px solid var(--profit);
}

.insight-card.insight-negative {
    border-left: 3px solid var(--loss);
}

.insight-card.insight-neutral {
    border-left: 3px solid var(--text-muted);
}

.insight-icon {
    font-size: 1.25rem;
}

/* Score Display */
.score-display {
    display: inline-flex;
    align-items: baseline;
}

.score-num {
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent-primary);
}

.score-max {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Indicator Name */
.indicator-name-display {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

/* Trend Badge */
.trend-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
}

.trend-badge.trend-strong_up {
    background: rgba(16, 185, 129, 0.2);
    color: var(--profit);
}

.trend-badge.trend-up {
    background: rgba(16, 185, 129, 0.15);
    color: var(--profit);
}

.trend-badge.trend-neutral {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
}

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

.trend-badge.trend-strong_down {
    background: rgba(239, 68, 68, 0.2);
    color: var(--loss);
}

/* Insight Text Small */
.insight-text-sm {
    font-size: 0.8125rem;
    color: var(--text-muted);
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

/* Empty State Small */
.empty-state-sm {
    text-align: center;
    padding: var(--spacing-lg);
}

.empty-state-sm p {
    margin: 0;
}

/* Day of Week Grid */
.dow-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--spacing-sm);
}

@media (max-width: 640px) {
    .dow-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.dow-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    text-align: center;
}

.dow-day {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.dow-pnl {
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.dow-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* Table Small */
.table-sm th,
.table-sm td {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8125rem;
}

/* Mobile Tab Navigation */
@media (max-width: 768px) {
    .analytics-tabs {
        padding: var(--spacing-xs);
    }
    
    .analytics-tab {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.75rem;
    }
    
    .analytics-tab span:not(.tab-badge) {
        display: none;
    }
    
    .analytics-tab i {
        font-size: 1rem;
    }
}

/* Badge Variants */
.badge-profit {
    background: rgba(16, 185, 129, 0.15);
    color: var(--profit);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

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

.badge-pro {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
}

/* ==================== NEW ANALYTICS STYLES ==================== */

/* Analytics Grid 4 columns */
.analytics-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-md);
}

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

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

/* Mini Stat Card */
.stat-card.mini {
    padding: var(--spacing-sm);
}

.stat-card.mini .stat-label {
    font-size: 0.7rem;
}

.stat-card.mini .stat-value {
    font-size: 1.125rem;
}

.stat-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Comparison Mini */
.comparison-mini {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.comparison-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xs);
}

.comparison-label {
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.comparison-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comparison-stats {
    display: flex;
    gap: var(--spacing-md);
}

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

.mini-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mini-value {
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* Research Card */
.research-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.research-card.researched {
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.research-card.impulse {
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.research-header {
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex;
    justify-content: center;
}

.research-card.researched .research-header {
    background: rgba(99, 102, 241, 0.1);
}

.research-card.impulse .research-header {
    background: rgba(239, 68, 68, 0.1);
}

.research-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.research-badge.positive {
    background: rgba(16, 185, 129, 0.2);
    color: var(--profit);
}

.research-badge.negative {
    background: rgba(239, 68, 68, 0.2);
    color: var(--loss);
}

.research-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
}

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

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

.research-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.research-stat-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vs-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .vs-divider {
        padding: var(--spacing-xs) 0;
    }
}

/* Score Bar */
.score-bar {
    position: relative;
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-full);
}

.score-text {
    position: absolute;
    right: 0;
    top: -18px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Stop Target Grid */
.stop-target-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
}

@media (max-width: 640px) {
    .stop-target-grid {
        grid-template-columns: 1fr;
    }
}

.st-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: center;
}

.st-card.st-positive {
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.st-card.st-negative {
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.st-card.st-neutral {
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.st-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
}

.st-icon {
    font-size: 1.25rem;
}

.st-label {
    font-weight: 600;
    font-size: 0.875rem;
}

.st-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
}

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

.st-value {
    display: block;
    font-size: 1.125rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

/* Hour Grid */
.hour-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: var(--spacing-xs);
}

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

@media (max-width: 640px) {
    .hour-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.hour-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    text-align: center;
}

.hour-card.hour-profit {
    border-bottom: 2px solid var(--profit);
}

.hour-card.hour-loss {
    border-bottom: 2px solid var(--loss);
}

.hour-card.hour-empty {
    opacity: 0.5;
}

.hour-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.hour-value {
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.hour-meta {
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* DTE Grid for Options */
.dte-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
}

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

.dte-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: center;
}

.dte-card.dte-profit {
    border-left: 3px solid var(--profit);
}

.dte-card.dte-loss {
    border-left: 3px solid var(--loss);
}

.dte-label {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: var(--spacing-sm);
}

.dte-stats {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.dte-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dte-value {
    font-weight: 600;
    font-family: var(--font-mono);
}

.dte-sublabel {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Compliance Ring */
.compliance-overview {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.compliance-ring {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(
        var(--compliance-color) calc(var(--compliance-percent) * 1%),
        var(--bg-secondary) calc(var(--compliance-percent) * 1%)
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.compliance-ring::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    background: var(--bg-tertiary);
    border-radius: 50%;
}

.compliance-value {
    position: relative;
    z-index: 1;
    font-size: 1.125rem;
    font-weight: 700;
}

.compliance-label {
    position: relative;
    z-index: 1;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.compliance-stats {
    display: flex;
    gap: var(--spacing-lg);
}

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

.compliance-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.compliance-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Progress Bar Mini */
.progress-bar-mini {
    display: inline-block;
    width: 50px;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
    vertical-align: middle;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

/* Consistency Chart */
.consistency-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 120px;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) 0;
}

.consistency-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.bar-fill {
    width: 100%;
    max-width: 40px;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    min-height: 4px;
    transition: height 0.3s ease;
}

.bar-value {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.bar-label {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* ========================================
   Dashboard Mobile Optimizations
   ======================================== */

/* Recently Closed - Card layout on mobile */
.recently-closed-cards {
    display: none;
}

.recently-closed-table {
    display: block;
}

/* Dashboard 2-column grid - collapse earlier at 640px */
@media (max-width: 640px) {
    .responsive-grid-2-1 {
        grid-template-columns: 1fr !important;
    }

    .responsive-grid-2-1 > *:last-child {
        order: 0;
    }
}

/* Mobile-specific dashboard optimizations */
@media (max-width: 768px) {
    /* Recently Closed: Show cards, hide table */
    .recently-closed-cards {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .recently-closed-table {
        display: none;
    }

    /* Recently closed card styles */
    .closed-trade-card {
        background: var(--bg-tertiary);
        border: 1px solid var(--border-primary);
        border-radius: var(--radius-md);
        padding: var(--spacing-md);
        cursor: pointer;
        transition: all var(--transition-fast);
    }

    .closed-trade-card:hover {
        border-color: var(--accent-primary);
    }

    .closed-trade-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: var(--spacing-sm);
    }

    .closed-trade-card-ticker {
        display: flex;
        align-items: center;
        gap: var(--spacing-xs);
    }

    .closed-trade-card-ticker .ticker {
        font-family: var(--font-mono);
        font-weight: 600;
        font-size: 1rem;
        color: var(--text-primary);
    }

    .closed-trade-card-pnl {
        text-align: right;
    }

    .closed-trade-card-pnl .pnl-value {
        font-family: var(--font-mono);
        font-weight: 600;
        font-size: 1rem;
    }

    .closed-trade-card-pnl .r-value {
        font-family: var(--font-mono);
        font-size: 0.75rem;
        display: block;
        margin-top: 2px;
    }

    .closed-trade-card-details {
        display: flex;
        flex-wrap: wrap;
        gap: var(--spacing-sm);
        font-size: 0.75rem;
        color: var(--text-secondary);
    }

    .closed-trade-card-details .detail-item {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .closed-trade-card-details .detail-item i {
        font-size: 0.625rem;
        opacity: 0.7;
    }

    /* Active Positions - Better wrapping */
    .trade-card-header {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .trade-card-header > div:last-child {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: var(--spacing-xs);
    }

    .trade-meta {
        flex-wrap: wrap;
        gap: var(--spacing-xs) !important;
    }

    .trade-meta-item {
        font-size: 0.75rem;
    }

    /* Fear & Greed bar labels - abbreviated on mobile */
    .fg-bar-labels {
        font-size: 0.5rem;
    }

    .fg-label-fear,
    .fg-label-greed {
        font-size: 0;
    }

    .fg-label-fear::after {
        content: "Fear";
        font-size: 0.5rem;
    }

    .fg-label-greed::after {
        content: "Greed";
        font-size: 0.5rem;
    }

    /* Stats grid - 3 columns on tablet */
    .grid-stats {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: var(--spacing-sm) !important;
    }

    /* Setups & Watchlist badge overflow */
    .idea-card-badges {
        flex-wrap: wrap;
        gap: var(--spacing-xs);
    }

    .idea-card-badges .badge {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Small phone optimizations (480px and below) */
@media (max-width: 480px) {
    /* Stats grid - 2 columns on phone */
    .grid-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Smaller stat values */
    .stat-value {
        font-size: 1.125rem !important;
    }

    .stat-label {
        font-size: 0.625rem !important;
    }

    /* Fear & Greed - abbreviated labels */
    .fg-bar-labels span {
        font-size: 0.5rem;
    }

    /* Closed trade cards - more compact */
    .closed-trade-card {
        padding: var(--spacing-sm);
    }

    .closed-trade-card-ticker .ticker {
        font-size: 0.9rem;
    }

    .closed-trade-card-pnl .pnl-value {
        font-size: 0.9rem;
    }

    /* Trade cards more compact */
    .trade-card {
        padding: var(--spacing-sm) !important;
    }

    .ticker-symbol {
        font-size: 1rem !important;
    }

    /* Year in Pixels - compact */
    .year-pixels-widget {
        padding: var(--spacing-sm);
    }

    .year-pixels-summary {
        flex-wrap: wrap;
        gap: var(--spacing-xs);
    }

    .year-pixels-pnl {
        font-size: 1rem;
    }

    .year-pixels-strip {
        padding: var(--spacing-xs);
        gap: 1px;
    }

    .mini-pixel {
        width: 5px;
        height: 5px;
    }

    /* Journal streak - more columns on small screens */
    .js-grid {
        grid-template-columns: repeat(10, 1fr);
        gap: 2px;
    }

    .js-day {
        border-radius: 1px;
    }

    /* Market Pulse - smaller metrics */
    .mp-metric-value {
        font-size: 0.875rem !important;
    }

    .mp-metric-label {
        font-size: 0.6rem !important;
    }

    .mp-insight-thesis {
        font-size: 0.7rem !important;
    }

    .mp-insight-badges {
        flex-wrap: wrap;
        gap: 4px;
    }

    .mp-badge {
        font-size: 0.6rem;
        padding: 2px 6px;
    }
}

/* ========================================
   CRITICAL: Mobile Overflow Prevention
   Added Dec 2025 to fix widgets running off screen
   ======================================== */
@media (max-width: 768px) {
    /* Force grid children to respect container bounds */
    .responsive-grid-2-1 > *,
    .responsive-grid-2col > *,
    .responsive-grid-3col > * {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    /* Cards must not exceed viewport */
    .card,
    .mp-widget,
    .fg-widget {
        max-width: 100% !important;
        overflow-x: hidden;
    }

    /* Market Pulse widget fixes */
    .mp-widget .card-body,
    .mp-body {
        max-width: 100%;
        overflow-x: hidden;
    }

    .mp-top-section {
        max-width: 100%;
        overflow: hidden;
    }

    .mp-radar-container {
        max-width: 140px;
        margin: 0 auto;
    }

    .mp-gauge-container {
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
    }

    .mp-pulse-metrics {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .mp-insights-list {
        max-width: 100%;
    }

    .mp-insight-card {
        max-width: 100%;
        overflow: hidden;
    }

    .mp-insight-thesis {
        word-break: break-word;
    }

    .mp-related-tickers {
        max-width: 100%;
        overflow-x: auto;
    }

    /* Active positions card fixes */
    .trade-card {
        max-width: 100% !important;
        overflow: hidden;
    }

    .trade-card-header {
        max-width: 100%;
    }

    .trade-ticker {
        max-width: 100%;
        overflow: hidden;
    }

    .ticker-symbol {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Ensure main content doesn't overflow */
    .main-content,
    .page-content {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* Body level overflow prevention */
    body {
        overflow-x: hidden;
    }
}

/* ========================================
   2025 PREMIUM POLISH
   Modern fintech design enhancements
   ======================================== */

/* -----------------------------------------
   1. BOLDER TYPOGRAPHY HIERARCHY
   Make key numbers command attention
   ----------------------------------------- */

/* Stat values - the most important data on any page */
.stat-value {
    color: #ffffff;
    letter-spacing: -0.02em;
}

/* Hero stat treatment - for primary metrics */
.stat-card.hero .stat-value,
.stat-value.hero {
    font-size: 2.25rem;
    text-shadow: 0 0 40px rgba(99, 102, 241, 0.3);
}

/* Profit/loss values get extra emphasis */
.stat-value.text-profit,
.trade-pnl.profit {
    text-shadow: 0 0 30px rgba(34, 197, 94, 0.4);
}

.stat-value.text-loss,
.trade-pnl.loss {
    text-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

/* Section headers with accent bar */
.section-header,
.oracle-section-header,
.card-header h3,
.card-header .card-title {
    position: relative;
}

/* Modern section title treatment */
.section-title-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: var(--spacing-lg);
}

.section-title-bar::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
    flex-shrink: 0;
}

.section-title-bar h2,
.section-title-bar h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Page titles - bolder presence */
.header-title h1 {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Ticker symbols - monospace confidence */
.ticker-symbol {
    letter-spacing: 0.02em;
}

/* -----------------------------------------
   2. GRADIENT ACCENTS ON INTERACTIVE ELEMENTS
   Modern gradient fills, not just borders
   ----------------------------------------- */

/* Primary button - gradient fill */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border: none;
    position: relative;
    isolation: isolate;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--accent-primary-hover) 0%, #a78bfa 100%);
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: -1;
}

.btn-primary:hover::before {
    opacity: 1;
}

/* Active navigation - gradient fade with left accent */
.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, transparent 100%);
    border-left: 3px solid var(--accent-primary);
    margin-left: -3px;
    padding-left: calc(var(--spacing-md) + 3px);
}

/* Focus states - softer, larger glow */
.btn:focus-visible,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* Badge accent - subtle gradient background */
.badge-primary {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.15) 100%);
}

/* -----------------------------------------
   3. BORDERS → SHADOWS & CONTRAST
   Remove thin borders, use depth instead
   ----------------------------------------- */

/* Cards - shadow instead of border */
.card {
    border: none;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.03);
}

.card:hover {
    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Stat cards - cleaner without visible border */
.stat-card {
    border: none;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.03);
}

/* Trade cards - lift on hover */
.trade-card {
    border: none;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.03);
}

.trade-card:hover {
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(99, 102, 241, 0.2);
    transform: translateY(-4px);
}

/* Keep internal dividers - they serve a purpose */
.card-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.card-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Tables - subtle row separation */
.table th,
.table td,
.data-table th,
.data-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Modals keep border - they float above everything */
.modal {
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Form inputs - keep subtle border for affordance */
.form-input,
.form-select,
.form-textarea {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(26, 26, 37, 0.8);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent-primary);
    background: rgba(26, 26, 37, 1);
}

/* Notification dropdown - elevated */
.notification-dropdown {
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Toast notifications - floating */
.toast {
    border: none;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* -----------------------------------------
   4. SCROLL-TRIGGERED ANIMATIONS
   Elements fade in as they enter viewport
   ----------------------------------------- */

/* Initial hidden state for animated elements */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* Visible state */
.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered delays for grid children */
.animate-on-scroll.stagger-1 { transition-delay: 0ms; }
.animate-on-scroll.stagger-2 { transition-delay: 50ms; }
.animate-on-scroll.stagger-3 { transition-delay: 100ms; }
.animate-on-scroll.stagger-4 { transition-delay: 150ms; }
.animate-on-scroll.stagger-5 { transition-delay: 200ms; }
.animate-on-scroll.stagger-6 { transition-delay: 250ms; }
.animate-on-scroll.stagger-7 { transition-delay: 300ms; }
.animate-on-scroll.stagger-8 { transition-delay: 350ms; }

/* Cards in grids get automatic staggering */
.grid-stats .stat-card,
.dashboard-grid .card,
.grid-cols-2 > .card,
.grid-cols-3 > .card,
.grid-cols-4 > .card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out, box-shadow 0.2s ease;
}

.grid-stats .stat-card.is-visible,
.dashboard-grid .card.is-visible,
.grid-cols-2 > .card.is-visible,
.grid-cols-3 > .card.is-visible,
.grid-cols-4 > .card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger within grid-stats */
.grid-stats .stat-card:nth-child(1) { transition-delay: 0ms; }
.grid-stats .stat-card:nth-child(2) { transition-delay: 60ms; }
.grid-stats .stat-card:nth-child(3) { transition-delay: 120ms; }
.grid-stats .stat-card:nth-child(4) { transition-delay: 180ms; }
.grid-stats .stat-card:nth-child(5) { transition-delay: 240ms; }
.grid-stats .stat-card:nth-child(6) { transition-delay: 300ms; }

/* Dashboard cards stagger */
.dashboard-grid > .card:nth-child(1),
.dashboard-grid > div:nth-child(1) .card { transition-delay: 0ms; }
.dashboard-grid > .card:nth-child(2),
.dashboard-grid > div:nth-child(2) .card { transition-delay: 80ms; }
.dashboard-grid > .card:nth-child(3),
.dashboard-grid > div:nth-child(3) .card { transition-delay: 160ms; }
.dashboard-grid > .card:nth-child(4),
.dashboard-grid > div:nth-child(4) .card { transition-delay: 240ms; }
.dashboard-grid > .card:nth-child(5),
.dashboard-grid > div:nth-child(5) .card { transition-delay: 320ms; }

/* -----------------------------------------
   5. ANIMATED STAT COUNTERS
   Numbers count up when they enter view
   ----------------------------------------- */

/* Counter animation class */
.stat-value[data-animate-number] {
    font-variant-numeric: tabular-nums;
}

/* -----------------------------------------
   6. REDUCED MOTION RESPECT
   Disable animations for users who prefer it
   ----------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .animate-on-scroll,
    .grid-stats .stat-card,
    .dashboard-grid .card,
    .grid-cols-2 > .card,
    .grid-cols-3 > .card,
    .grid-cols-4 > .card {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .btn-primary::before {
        display: none;
    }

    .trade-card:hover {
        transform: none;
    }
}
