*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #0f1117; color: #e2e8f0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; }

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: #1a1d2e; border: 1px solid #2d3148; border-radius: 12px; padding: 40px; width: 340px; text-align: center; }
.login-box h2 { font-size: 1.6rem; margin-bottom: 6px; }
.login-sub { color: #94a3b8; margin-bottom: 24px; }
.login-error { background: #3b1212; color: #f87171; border-radius: 6px; padding: 8px 12px; margin-bottom: 16px; font-size: 0.85rem; }
.login-box input { width: 100%; padding: 10px 14px; margin-bottom: 12px; background: #0f1117; border: 1px solid #2d3148; border-radius: 8px; color: #e2e8f0; font-size: 0.95rem; }
.login-box button { width: 100%; padding: 10px; background: #4a9eff; border: none; border-radius: 8px; color: #fff; font-size: 1rem; font-weight: 600; cursor: pointer; }
.login-box button:hover { background: #3a8eef; }

/* Navbar */
.navbar { display: flex; align-items: center; gap: 20px; padding: 12px 24px; background: #1a1d2e; border-bottom: 1px solid #2d3148; }
.nav-brand { font-size: 1.1rem; font-weight: 700; text-decoration: none; color: #e2e8f0; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link { color: #94a3b8; text-decoration: none; padding: 6px 12px; border-radius: 6px; font-size: 0.9rem; }
.nav-link:hover, .nav-link.active { background: #2d3148; color: #e2e8f0; }
.nav-logout { color: #64748b; text-decoration: none; font-size: 0.85rem; }
.nav-logout:hover { color: #94a3b8; }

/* Container */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }

/* Page header */
.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: #64748b; font-size: 0.82rem; }

/* Search */
.search-row { display: flex; gap: 10px; margin-bottom: 20px; }
.search-row input { flex: 1; padding: 10px 16px; background: #1a1d2e; border: 1px solid #2d3148; border-radius: 8px; color: #e2e8f0; font-size: 0.95rem; }
.search-row input:focus { outline: none; border-color: #4a9eff; }
.search-row button { padding: 10px 20px; background: #4a9eff; border: none; border-radius: 8px; color: #fff; font-weight: 600; cursor: pointer; }
.search-row button:hover { background: #3a8eef; }

/* Tabs */
.tab-bar { display: flex; gap: 4px; flex-wrap: wrap; }
.tab-btn { background: #1a1d2e; border: 1px solid #2d3148; color: #94a3b8; padding: 6px 14px; cursor: pointer; font-size: 0.85rem; border-radius: 20px; }
.tab-btn:hover { color: #e2e8f0; }
.tab-btn.active { background: #4a9eff; border-color: #4a9eff; color: #fff; font-weight: 600; }

/* Summary cards */
.cards-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.card { background: #1a1d2e; border: 1px solid #2d3148; border-radius: 10px; padding: 14px; text-align: center; }
.card-label { font-size: 0.72rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 5px; }
.card-value { font-size: 1.2rem; font-weight: 700; }

/* Leaderboard table */
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th { text-align: left; padding: 8px 12px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; border-bottom: 1px solid #2d3148; }
.lb-table td { padding: 12px 12px; border-bottom: 1px solid #1e2235; vertical-align: middle; }
.lb-row { cursor: pointer; transition: background 0.1s; }
.lb-row:hover td { background: #1e2235; }
.lb-rank { color: #64748b; font-weight: 700; width: 32px; }
.lb-name { font-weight: 600; font-size: 0.9rem; }
.lb-addr { color: #64748b; font-family: monospace; font-size: 0.75rem; margin-top: 2px; }
.lb-pnl { font-weight: 700; font-size: 1rem; }
.lb-meta { color: #94a3b8; font-size: 0.85rem; }

/* Data table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 8px 10px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; border-bottom: 1px solid #2d3148; }
.data-table td { padding: 9px 10px; border-bottom: 1px solid #1e2235; vertical-align: top; line-height: 1.3; }
.data-table tr:hover td { background: #1e2235; }

/* Colours */
.positive { color: #4ade80; }
.negative { color: #f87171; }
.neutral  { color: #94a3b8; }
.badge-buy  { background: #14532d; color: #4ade80; border-radius: 4px; padding: 2px 7px; font-size: 0.72rem; font-weight: 600; }
.badge-sell { background: #3b1212; color: #f87171; border-radius: 4px; padding: 2px 7px; font-size: 0.72rem; font-weight: 600; }

/* Misc */
.loading { color: #64748b; padding: 40px; text-align: center; line-height: 2; }
.empty { color: #64748b; padding: 24px; text-align: center; font-style: italic; }
.results-label { font-size: 0.8rem; color: #64748b; }
.hidden { display: none; }
.wallet-panel-section { }

/* Position drill-down */
.pos-row { cursor: pointer; }
.pos-row:hover td { background: #1a2040 !important; }
.drill-arrow { display: inline-block; font-size: 0.65rem; color: #4a9eff; margin-right: 6px; transition: transform 0.15s; width: 10px; }
.pos-detail-row td { padding: 0; background: #0f1520; }
.pos-detail-inner { border-left: 3px solid #4a9eff; margin: 0 0 4px 0; }
.pos-detail-inner .data-table td { padding: 6px 10px; font-size: 0.8rem; border-bottom: 1px solid #1a2235; }
.pos-detail-inner .data-table tr:hover td { background: #162030; }

/* ── Back link ──────────────────────────────────────────────────────────────── */
.back-link { display:inline-block; color:#4a9eff; text-decoration:none; font-size:0.85rem; margin-bottom:16px; }
.back-link:hover { text-decoration:underline; }

/* ── Markets table ──────────────────────────────────────────────────────────── */
.mkt-table .mkt-question { max-width:320px; font-size:0.88rem; line-height:1.35; }
.mkt-table .mkt-odds-cell { white-space:nowrap; }
.mkt-table .mkt-vol { text-align:right; font-size:0.85rem; color:#94a3b8; font-variant-numeric:tabular-nums; }
.mkt-table .mkt-end { font-size:0.8rem; color:#64748b; white-space:nowrap; }
.mkt-row { cursor:pointer; }
.mkt-row:hover td { background:#1e2235; }
.outcome-pill { display:inline-block; border:1px solid; border-radius:12px; padding:2px 8px; font-size:0.75rem; margin:1px 2px; white-space:nowrap; }

/* ── Market detail ──────────────────────────────────────────────────────────── */
.mkt-header { display:flex; gap:16px; align-items:flex-start; margin-bottom:20px; flex-wrap:wrap; }
.mkt-image { width:72px; height:72px; border-radius:10px; object-fit:cover; flex-shrink:0; }
.mkt-header-text { flex:1; min-width:200px; }
.mkt-title { font-size:1.3rem; font-weight:700; line-height:1.3; margin-bottom:8px; }
.mkt-meta-row { display:flex; flex-wrap:wrap; gap:12px; align-items:center; }
.mkt-meta-item { font-size:0.85rem; color:#94a3b8; }
.mkt-ext-link { font-size:0.82rem; color:#4a9eff; text-decoration:none; }
.mkt-ext-link:hover { text-decoration:underline; }

.mkt-odds-row { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:4px; }
.mkt-odds-card { background:#1a1d2e; border:1px solid; border-radius:10px; padding:14px 22px; text-align:center; min-width:100px; }
.mkt-odds-label { font-size:0.75rem; color:#94a3b8; margin-bottom:4px; text-transform:uppercase; letter-spacing:0.05em; }
.mkt-odds-pct { font-size:2.2rem; font-weight:800; line-height:1; }
.mkt-odds-price { font-size:0.75rem; color:#64748b; margin-top:3px; }

.mkt-desc-details { margin:16px 0; }
.mkt-desc-details summary { font-size:0.85rem; color:#94a3b8; cursor:pointer; padding:4px 0; }
.mkt-desc { background:#1a1d2e; border:1px solid #2d3148; border-radius:8px; padding:14px 16px; margin-top:8px; font-size:0.82rem; color:#94a3b8; line-height:1.6; max-height:200px; overflow-y:auto; }

/* Chart zoom buttons */
.chart-zoom-btn { background:#1a1d2e; border:1px solid #2d3148; color:#e2e8f0; width:28px; height:28px; border-radius:6px; font-size:1.1rem; line-height:1; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.chart-zoom-btn:hover { background:#2d3148; border-color:#4a9eff; color:#4a9eff; }
