/* Trading Journal - Tradervue-inspired dark theme */
:root {
  --bg-0: #0e1117;
  --bg-1: #161b22;
  --bg-2: #1f262d;
  --bg-3: #2a323b;
  --border: #2d343c;
  --text-0: #e6edf3;
  --text-1: #c9d1d9;
  --text-2: #8b949e;
  --text-3: #6e7681;
  --accent: #2ea043;
  --accent-soft: #2ea0431a;
  --green: #2ea043;
  --green-soft: #2ea0431a;
  --red: #f85149;
  --red-soft: #f851491a;
  --yellow: #d29922;
  --yellow-soft: #d299221a;
  --blue: #58a6ff;
  --radius: 10px;
  --shadow: 0 4px 16px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg-0); color: var(--text-0); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }

a { color: var(--text-1); text-decoration: none; }
a:hover { color: var(--text-0); }

/* ------------ Layout ------------ */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg-1); border-right: 1px solid var(--border); padding: 20px 12px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; }
.brand-logo { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--green), #58a6ff); }
.brand-name { font-weight: 600; font-size: 16px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text-2); font-size: 14px; }
.nav a:hover { background: var(--bg-2); color: var(--text-0); }
.nav a.active { background: var(--bg-2); color: var(--text-0); }
.nav .icon { width: 16px; height: 16px; display: inline-block; opacity: 0.8; }

.user-card { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 8px; background: var(--bg-2); margin-top: 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #58a6ff, var(--green)); display: flex; align-items: center; justify-content: center; font-weight: 600; color: #fff; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta .name { font-size: 13px; }
.user-meta .plan { font-size: 11px; color: var(--text-3); }

.main { padding: 24px 32px; overflow-y: auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-head h1 { font-size: 22px; margin: 0; font-weight: 600; }
.page-head .actions { display: flex; gap: 8px; }

/* ------------ Cards ------------ */
.card { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 12px; font-size: 13px; color: var(--text-2); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.card .big { font-size: 24px; font-weight: 600; color: var(--text-0); }

/* KPI Grid */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-grid .card { padding: 16px 18px; }
.kpi-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.kpi-value { font-size: 22px; font-weight: 600; }
.kpi-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.kpi-value.pos { color: var(--green); }
.kpi-value.neg { color: var(--red); }

/* TTP Account Status Panel */
.account-panel { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.account-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.account-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.status-dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-dot.warning { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.status-dot.breach { background: var(--red); box-shadow: 0 0 8px var(--red); }
.account-switcher select { background: var(--bg-2); color: var(--text-0); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 13px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.metric { padding: 12px 14px; background: var(--bg-2); border-radius: 8px; }
.metric .label { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.metric .value { font-size: 18px; font-weight: 600; }
.metric .value.pos { color: var(--green); }
.metric .value.neg { color: var(--red); }

.progress-bar { height: 6px; background: var(--bg-3); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width 0.3s; }
.progress-fill.danger { background: linear-gradient(90deg, var(--yellow), var(--red)); }

/* Calendar Strip */
.calendar-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 24px; }
.cal-day { background: var(--bg-1); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; min-height: 80px; }
.cal-day .date { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.cal-day .pnl { font-size: 14px; font-weight: 600; }
.cal-day .pnl.pos { color: var(--green); }
.cal-day .pnl.neg { color: var(--red); }
.cal-day .trades { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* Trades Table */
.trades-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.trades-table th, .trades-table td { padding: 10px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border); }
.trades-table th { background: var(--bg-2); color: var(--text-2); font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; font-size: 11px; }
.trades-table tbody tr:hover { background: var(--bg-2); }
.trades-table tbody tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.tag.long { background: var(--green-soft); color: var(--green); }
.tag.short { background: var(--red-soft); color: var(--red); }
.tag.window-Asia { background: #58a6ff1a; color: #58a6ff; }
.tag.window-London { background: #d299221a; color: #d29922; }
.tag.window-NY { background: var(--green-soft); color: var(--green); }
.tag.window-Out-of-Window { background: var(--bg-3); color: var(--text-3); }
.pnl-cell.pos { color: var(--green); }
.pnl-cell.neg { color: var(--red); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text-0); font-size: 13px; cursor: pointer; font-family: inherit; }
.btn:hover { background: var(--bg-3); }
.btn-primary { background: var(--green); border-color: var(--green); color: #0e1117; font-weight: 600; }
.btn-primary:hover { background: #3fb755; }

/* Forms */
.form { max-width: 380px; margin: 80px auto; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.form h1 { margin: 0 0 24px; font-size: 22px; }
.form label { display: block; margin-bottom: 6px; color: var(--text-2); font-size: 13px; }
.form input { width: 100%; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; color: var(--text-0); font-size: 14px; font-family: inherit; margin-bottom: 16px; }
.form input:focus { outline: none; border-color: var(--green); }
.form .error { color: var(--red); font-size: 13px; margin-bottom: 12px; }
.form button { width: 100%; padding: 10px; background: var(--green); border: none; border-radius: 6px; color: #0e1117; font-weight: 600; cursor: pointer; font-size: 14px; }
.form button:hover { background: #3fb755; }

/* Empty State */
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty h2 { color: var(--text-1); font-weight: 500; }

/* Account row */
.account-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--bg-1); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
.account-info { display: flex; flex-direction: column; gap: 2px; }
.account-info .name { font-weight: 600; }
.account-info .meta { font-size: 12px; color: var(--text-3); }
