/* ============================================================
   TradeHub CZ — Dark Trading Theme
   ============================================================ */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --surface-light: #334155;
    --accent: #3b82f6;
    --profit: #22c55e;
    --loss: #ef4444;
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.1);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.1);
    --blue: #3b82f6;
    --blue-bg: rgba(59, 130, 246, 0.1);
    --yellow: #f59e0b;
    --yellow-bg: rgba(245, 158, 11, 0.1);
    --purple: #a855f7;
    --sidebar-width: 240px;
    --border-radius: 6px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: #60a5fa; }

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--blue);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.sidebar-brand span { color: var(--text-primary); }

.sidebar-nav { padding: 0.4rem 0; flex: 1; overflow-y: auto; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.85rem;
    color: var(--text-secondary);
    transition: all 0.15s;
    border-left: 3px solid transparent;
    font-size: 0.82rem;
    text-decoration: none;
    line-height: 1.2;
}

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

.nav-item.active {
    background: var(--blue-bg);
    color: var(--blue);
    border-left-color: var(--blue);
}

.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.nav-section {
    padding: 0.35rem 0.85rem 0.15rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 1.5rem;
    max-width: calc(100% - var(--sidebar-width));
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

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

.card-header h3 { font-size: 0.95rem; font-weight: 600; }
.card-body { padding: 1.25rem; }

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

/* Stats */
.stat-card { padding: 1rem 1.25rem; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { font-size: 1.5rem; font-weight: 700; margin-top: 0.25rem; }
.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }
.stat-sub { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.2rem; }

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th {
    text-align: left;
    padding: 0.625rem 0.875rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

td {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

tr:hover td { background: rgba(255, 255, 255, 0.02); }

.pnl-positive { color: var(--green); font-weight: 600; }
.pnl-negative { color: var(--red); font-weight: 600; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-long { background: var(--green-bg); color: var(--green); }
.badge-short { background: var(--red-bg); color: var(--red); }
.badge-open { background: var(--blue-bg); color: var(--blue); }
.badge-closed { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-planned { background: var(--yellow-bg); color: var(--yellow); }
.badge-ok { background: var(--green-bg); color: var(--green); }
.badge-warning { background: var(--yellow-bg); color: var(--yellow); }
.badge-blocked { background: var(--red-bg); color: var(--red); }

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

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

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

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

.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.form-check input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--blue);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #2563eb; color: #fff; }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--surface-light); color: var(--text-primary); border-color: var(--text-muted); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #16a34a; color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-warning { background: var(--yellow); color: #000; }
.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn-lg { padding: 0.65rem 1.5rem; font-size: 0.9rem; }

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.alert-success { background: var(--green-bg); color: var(--green); border-color: rgba(34, 197, 94, 0.2); }
.alert-error { background: var(--red-bg); color: var(--red); border-color: rgba(239, 68, 68, 0.2); }
.alert-warning { background: var(--yellow-bg); color: var(--yellow); border-color: rgba(245, 158, 11, 0.2); }

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

.page-header h1 { font-size: 1.5rem; font-weight: 700; }

/* Risk Guard */
.risk-guard { padding: 0.75rem 1rem; margin-bottom: 1rem; border-radius: 0.375rem; }
.risk-guard.blocked { background: var(--red-bg); border: 1px solid rgba(239, 68, 68, 0.3); }
.risk-guard.warning { background: var(--yellow-bg); border: 1px solid rgba(245, 158, 11, 0.3); }
.risk-guard.ok { background: var(--green-bg); border: 1px solid rgba(34, 197, 94, 0.3); }

.risk-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
}

/* Charts container */
.chart-container { position: relative; height: 250px; }

/* Pagination */
.pagination { display: flex; gap: 0.25rem; justify-content: center; padding: 1rem; }
.pagination a, .pagination span {
    padding: 0.35rem 0.65rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.pagination a:hover { background: var(--bg-tertiary); }
.pagination .active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* Mood indicator */
.mood-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.mood-1, .mood-2 { background: var(--green); }
.mood-3, .mood-4 { background: #84cc16; }
.mood-5, .mood-6 { background: var(--yellow); }
.mood-7 { background: #f97316; }
.mood-8 { background: var(--red); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}
.empty-state h3 { color: var(--text-secondary); margin-bottom: 0.5rem; }

/* Auth pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
}

.auth-card h1 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--blue);
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 1rem; max-width: 100%; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
}

/* Utils */
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-blue { color: var(--blue); }
.text-yellow { color: var(--yellow); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none; }

/* ============================================================
   Additional components
   ============================================================ */

/* Auth page */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-primary); }
.auth-header { text-align: center; margin-bottom: 1.5rem; }
.auth-header h1 { font-size: 1.8rem; margin-bottom: 0.3rem; }
.auth-header p { color: var(--text-muted); }
.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--text-muted); }

/* Text colors */
.text-profit { color: var(--green) !important; }
.text-loss { color: var(--red) !important; }
.text-warning { color: var(--yellow) !important; }
.text-accent { color: var(--blue) !important; }
.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }
.text-red { color: var(--red); }

/* Badges extended */
.badge-profit { background: var(--green-bg); color: var(--green); }
.badge-loss { background: var(--red-bg); color: var(--red); }
.badge-info { background: var(--blue-bg); color: var(--blue); }
.badge-warning { background: var(--yellow-bg); color: var(--yellow); }
.badge-danger { background: var(--red-bg); color: var(--red); }
.badge-muted { background: var(--bg-tertiary); color: var(--text-muted); }
.badge-long { background: var(--green-bg); color: var(--green); }
.badge-short { background: var(--red-bg); color: var(--red); }

/* Direction toggle */
.direction-toggle { display: flex; gap: 0.5rem; }
.direction-btn {
    flex: 1; padding: 0.75rem; text-align: center; border: 2px solid var(--border-color);
    border-radius: 6px; cursor: pointer; font-weight: 600; transition: all 0.2s;
}
.direction-btn input { display: none; }
.direction-btn.long:hover, .direction-btn.long.selected { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.direction-btn.short:hover, .direction-btn.short.selected { border-color: var(--red); background: var(--red-bg); color: var(--red); }

/* Risk calc box */
.risk-calc-box {
    background: var(--bg-primary); border: 1px solid var(--border-color);
    border-radius: 6px; padding: 0.75rem; font-size: 0.85rem;
}
.risk-calc-box div { margin-bottom: 0.25rem; }
.risk-calc-box div:last-child { margin-bottom: 0; }

/* Risk result grid */
.risk-result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.risk-result-item { }
.risk-result-label { display: block; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.risk-result-value { display: block; font-size: 1.1rem; font-weight: 600; margin-top: 0.15rem; }

/* R:R Visual bar */
.rr-visual { margin-top: 0.5rem; }
.rr-bar { display: flex; height: 40px; border-radius: 6px; overflow: hidden; }
.rr-segment { display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 600; min-width: 30px; transition: width 0.3s; }
.rr-loss { background: var(--red); color: white; }
.rr-entry { background: var(--bg-tertiary); color: var(--text-primary); width: 40px; flex-shrink: 0; }
.rr-profit { background: var(--green); color: white; }
.rr-profit2 { background: #16a34a; color: white; }

/* Big stat number */
.big-stat { font-size: 2rem; font-weight: 700; text-align: center; margin: 1rem 0; }
.big-stat small { font-size: 0.8rem; color: var(--text-muted); }

/* Screenshots */
.screenshot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.screenshot-item img { width: 100%; border-radius: 6px; border: 1px solid var(--border-color); }
.screenshot-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Modal */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal.hidden { display: none !important; }
.modal-content { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; padding: 1.5rem; width: 90%; max-width: 500px; position: relative; }
.modal-content h3 { margin-bottom: 1rem; }
.modal-close-btn { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; padding: 0 0.25rem; line-height: 1; border-radius: 4px; }
.modal-close-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }

/* Form actions */
.form-actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 1rem; }
.btn-delete-sm { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; padding: 0.2rem 0.45rem; border-radius: 4px; line-height: 1; }
.btn-delete-sm:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* RiskGuard alert bar */
.risk-guard { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.risk-guard.warning { background: var(--yellow-bg); border: 1px solid var(--yellow); color: var(--yellow); }
.risk-guard.blocked { background: var(--red-bg); border: 1px solid var(--red); color: var(--red); }

/* Mood dot */
.mood-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.mood-dot.mood-1, .mood-dot.mood-2 { background: var(--green); }
.mood-dot.mood-3, .mood-dot.mood-4 { background: #84cc16; }
.mood-dot.mood-5, .mood-dot.mood-6 { background: var(--yellow); }
.mood-dot.mood-7, .mood-dot.mood-8 { background: var(--red); }

/* P&L coloring */
.pnl-positive { color: var(--green); }
.pnl-negative { color: var(--red); }
.positive { color: var(--green); }
.negative { color: var(--red); }

/* Btn additional styles */
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--text-secondary); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }

/* Chart container */
.chart-container { position: relative; height: 250px; }

/* Grid 4 cols */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .grid-4 { grid-template-columns: 1fr; } }

/* Table improvements */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border-color); }
table th { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em; }
table tbody tr:hover { background: rgba(255,255,255,0.02); }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ========== PHASE 2: Plans, Setups, Checklists ========== */

.plan-rules { font-size: 0.9rem; line-height: 1.7; color: var(--text-secondary); }

.template-card {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.template-card:hover { border-color: var(--accent); background: rgba(59, 130, 246, 0.05); }
.template-card.selected { border-color: var(--accent); background: rgba(59, 130, 246, 0.1); }
.template-card h4 { margin: 0 0 0.5rem 0; font-size: 0.95rem; }
.template-card p { font-size: 0.8rem; margin-bottom: 0.5rem; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 768px) {
    .grid-3 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

.checklist-item {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item-header { display: flex; align-items: center; gap: 0.5rem; flex: 1; }
.checklist-item-desc { font-size: 0.8rem; color: var(--text-muted); margin-left: 2rem; width: 100%; }
.checklist-order {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.5rem; height: 1.5rem; border-radius: 50%;
    background: var(--surface-light); font-size: 0.75rem; font-weight: 600; flex-shrink: 0;
}

.checklist-builder-item {
    padding: 0.75rem; border: 1px solid var(--border-color);
    border-radius: var(--border-radius); margin-bottom: 0.75rem; background: var(--surface-light);
}

.checklist-exec-item { padding: 0.5rem 0; border-bottom: 1px solid var(--border-color); }
.checklist-exec-item:last-child { border-bottom: none; }
.checklist-exec-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; }
.checklist-exec-order {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.3rem; height: 1.3rem; border-radius: 50%;
    background: var(--surface-light); font-size: 0.7rem; font-weight: 600; flex-shrink: 0;
}
.checklist-exec-desc { font-size: 0.75rem; color: var(--text-muted); margin-left: 3rem; }
.checklist-checkbox { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); flex-shrink: 0; }
.checklist-score {
    font-size: 1.1rem; font-weight: 700; padding: 0.75rem; margin-top: 0.75rem;
    border-radius: var(--border-radius); background: var(--surface-light); text-align: center;
}

.checklist-result-group { margin-bottom: 1rem; }
.checklist-result-group:last-child { margin-bottom: 0; }
.checklist-result-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 0; border-bottom: 2px solid var(--border-color); margin-bottom: 0.5rem;
}
.checklist-result-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0; font-size: 0.85rem; }

.stat-card { padding: 1rem; text-align: center; }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state p { margin-bottom: 0.5rem; }
.empty-state .btn { margin-top: 1rem; }

.card-footer { padding: 0.75rem 1rem; border-top: 1px solid var(--border-color); display: flex; gap: 0.5rem; }
.btn-lg { padding: 0.75rem 2rem; font-size: 1rem; }

.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
@media (max-width: 768px) { .form-row { flex-direction: column; } }

.badge-warning { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.badge-loss { background: rgba(239, 68, 68, 0.15); color: var(--loss); }
.text-warning { color: #f59e0b; }
.badge-long { background: rgba(16, 185, 129, 0.15); color: var(--profit); }
.badge-short { background: rgba(239, 68, 68, 0.15); color: var(--loss); }

/* ========== PHASE 3: Psychology, Emotions, Prep ========== */

/* Mood selector (1-8 scale) */
.mood-selector {
    display: flex; gap: 0.4rem; flex-wrap: wrap;
}
.mood-selector-sm { gap: 0.3rem; }
.mood-option {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.5rem; height: 2.5rem; border-radius: 0.5rem;
    border: 2px solid var(--border-color); cursor: pointer;
    transition: all 0.2s; background: var(--surface-light);
}
.mood-selector-sm .mood-option { width: 2rem; height: 2rem; }
.mood-option:hover { border-color: var(--accent); background: rgba(59, 130, 246, 0.1); }
.mood-option.selected, .mood-option:has(input:checked) {
    border-color: var(--mood-color, var(--accent));
    background: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 0 1px var(--mood-color, var(--accent));
}
.mood-option input { display: none; }
.mood-num { font-weight: 700; font-size: 0.9rem; }

/* Ritual checkboxes grid */
.ritual-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem;
}
.ritual-option {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 0.75rem; border-radius: var(--border-radius);
    border: 1px solid var(--border-color); cursor: pointer;
    transition: all 0.2s; background: var(--surface-light);
}
.ritual-option:has(input:checked) { border-color: var(--accent); background: rgba(59, 130, 246, 0.1); }
.ritual-option input { accent-color: var(--accent); }
@media (max-width: 768px) { .ritual-grid { grid-template-columns: 1fr; } }

/* Fit to trade toggle */
.fit-toggle { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.fit-label { font-size: 1rem; font-weight: 600; }

/* Emotion grid (evening review) */
.emotion-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem;
}
.emotion-option {
    display: flex; flex-direction: column; gap: 0.25rem;
    padding: 0.75rem; border-radius: var(--border-radius);
    border: 2px solid var(--border-color); cursor: pointer;
    transition: all 0.2s; background: var(--surface-light);
}
.emotion-option input { accent-color: var(--accent); }
.emotion-option span { font-weight: 600; }
.emotion-option small { font-size: 0.75rem; color: var(--text-muted); }
.emotion-option:has(input:checked) { border-color: #ef4444; background: rgba(239, 68, 68, 0.1); }
@media (max-width: 768px) { .emotion-grid { grid-template-columns: 1fr; } }

/* Emotion log items in trade view */
.emotion-log-item {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    padding: 0.4rem 0; border-bottom: 1px solid var(--border-color);
}
.emotion-log-item:last-child { border-bottom: none; }

/* Prep steps layout */
.prep-step {
    display: flex; gap: 1rem; margin-bottom: 1rem; align-items: flex-start;
}
.prep-step-num {
    display: flex; align-items: center; justify-content: center;
    min-width: 2.5rem; height: 2.5rem; border-radius: 50%;
    background: var(--accent); color: white; font-weight: 700;
    font-size: 1.1rem; margin-top: 0.75rem; flex-shrink: 0;
}

/* Level and event rows in prep */
.level-row, .event-row { margin-bottom: 0.5rem; }

/* Stat row */
.stat-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.4rem 0; border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* ========== PHASE 3: Psychology, Preparation, Emotions ========== */

/* Mood slider */
.mood-slider { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.mood-slider .slider {
    flex: 1;
    min-width: 120px;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--surface-light);
    outline: none;
}
.mood-slider .slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}
.mood-slider .slider::-moz-range-thumb {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}
.slider-value {
    font-size: 1.4rem;
    font-weight: 700;
    min-width: 2rem;
    text-align: center;
    color: var(--accent);
}
.slider-labels {
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: -0.25rem;
}

/* Routine & emotion checks */
.routine-checks, .emotion-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.check-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--border-radius);
    background: var(--surface-light);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.check-label:hover { background: rgba(255,255,255,0.08); }
.check-label input[type="checkbox"] {
    width: 1rem; height: 1rem;
    accent-color: var(--accent);
}
.emotion-bad { border-left: 3px solid var(--loss); }
.emotion-good { border-left: 3px solid var(--profit); }

/* Fit to trade box */
.fit-to-trade-box {
    padding: 0.75rem;
    border-radius: var(--border-radius);
    background: var(--surface-light);
    border: 2px solid var(--border-color);
    transition: border-color 0.3s;
}

/* Emotion log in trade view */
.emotion-log-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}
.emotion-log-item:last-child { border-bottom: none; }
.emotion-phase {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    min-width: 5rem;
}
.emotion-intensity {
    display: inline-block;
    width: 2rem;
    height: 0.4rem;
    border-radius: 2px;
    background: var(--surface-light);
    position: relative;
}
.emotion-intensity-fill {
    position: absolute;
    left: 0; top: 0;
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
}

/* Level/macro row styling */
.level-row, .macro-row {
    align-items: center;
}

/* Stat row (key-value) */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--text-muted); font-size: 0.8rem; }

/* ========== PHASE 4: Analytics ========== */

.period-selector { display: flex; gap: 0.25rem; }

.direction-stat {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5rem 0; border-bottom: 1px solid var(--border-color);
}
.direction-stat:last-child { border-bottom: none; }
.direction-bar { flex: 1; height: 8px; background: var(--surface-light); border-radius: 4px; overflow: hidden; }
.direction-bar-fill { height: 100%; border-radius: 4px; }
.direction-bar-fill.profit { background: var(--profit); }
.direction-bar-fill.loss { background: var(--loss); }

.mb-2 { margin-bottom: 1.5rem; }

/* ========== PHASE 5: Tags, Export ========== */

.tag-badge {
    display: inline-block;
    padding: 1px 6px;
    margin: 1px 2px;
    border-radius: 10px;
    font-size: 0.7rem;
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    white-space: nowrap;
}

/* Pagination */
.pagination {
    display: flex; gap: 0.25rem; padding: 0.75rem 1rem; justify-content: center;
    border-top: 1px solid var(--border-color);
}
.pagination a, .pagination span {
    padding: 0.35rem 0.65rem; border-radius: var(--border-radius);
    font-size: 0.85rem; text-decoration: none;
}
.pagination a { background: var(--surface-light); color: var(--text-primary); }
.pagination a:hover { background: var(--accent); color: #fff; }
.pagination span.active { background: var(--accent); color: #fff; font-weight: 600; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: none;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* Quick actions */
.quick-actions {
    display: flex; gap: 0.5rem; flex-wrap: wrap;
}
.quick-action-btn {
    padding: 0.5rem 1rem;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
    white-space: nowrap;
}
.quick-action-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

/* Sidebar user bar */
.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.85rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}
.sidebar-user-name { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.sidebar-logout {
    font-size: 1rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.15rem 0.35rem;
    border-radius: var(--border-radius);
    transition: all 0.15s;
    background: none;
    border: none;
    cursor: pointer;
}
.sidebar-logout:hover { color: var(--loss); background: rgba(239,68,68,0.1); }

/* Calendar */
.calendar-summary { display: flex; gap: 2rem; flex-wrap: wrap; }
.cal-stat { text-align: center; }
.cal-stat-value { display: block; font-size: 1.4rem; font-weight: 700; }
.cal-stat-label { font-size: 0.75rem; color: var(--text-muted); }

.calendar-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.calendar-grid th { padding: 0.5rem; text-align: center; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.cal-cell { padding: 0.4rem; height: 80px; vertical-align: top; border: 1px solid var(--border-color); position: relative; }
.cal-empty { background: var(--bg); }
.cal-today { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-weekend { background: rgba(0,0,0,0.02); }
.cal-profit { background: rgba(34,197,94,0.06); }
.cal-loss { background: rgba(239,68,68,0.06); }
.cal-day-num { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.cal-pnl { font-size: 0.9rem; font-weight: 700; margin-top: 0.15rem; }
.cal-meta { font-size: 0.65rem; color: var(--text-muted); margin-top: 0.1rem; }

/* What-if */
.card-highlight-profit { border-left: 3px solid var(--profit); }
.card-highlight-loss { border-left: 3px solid var(--loss); }

/* Mistake tags */
.mistake-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }

/* Seasonality heatmap */
.heatmap-table { border-collapse: collapse; width: 100%; }
.heatmap-table th { font-size: 0.75rem; padding: 0.4rem; white-space: nowrap; }
.heatmap-table td { padding: 0.3rem; }
.heatmap-cell { min-width: 52px; border-radius: 4px; transition: transform 0.1s; }
.heatmap-cell:hover { transform: scale(1.05); z-index: 1; }
.hm-val { font-weight: 700; font-size: 0.8rem; line-height: 1.2; }
.hm-sub { font-size: 0.6rem; opacity: 0.7; line-height: 1; }
.heatmap-total-row { border-top: 2px solid var(--border-color); }

/* Market seasonality */
.market-season-table .market-row { cursor: pointer; transition: background 0.15s; }
.market-season-table .market-row:hover { background: rgba(59,130,246,0.08); }
.mistake-check { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.5rem; border: 1px solid; border-radius: 6px; cursor: pointer; font-size: 0.8rem; transition: background 0.15s; }
.mistake-check:hover { background: rgba(239,68,68,0.05); }
.mistake-check input[type="checkbox"] { margin: 0; }
.btn-delete-sm { background: none; border: 1px solid var(--loss); color: var(--loss); border-radius: 4px; padding: 0.15rem 0.4rem; cursor: pointer; font-size: 0.8rem; }
.btn-delete-sm:hover { background: var(--loss); color: #fff; }
.tag-badge { display: inline-block; padding: 0.2rem 0.5rem; background: rgba(100,116,139,0.15); border-radius: 4px; font-size: 0.8rem; color: var(--text-secondary); }
