:root {
  --bg: #050506;
  --panel: #0D0D0F;
  --panel-2: #131316;
  --line: #1B1B1F;
  --line-2: #28282E;
  --text: #FFFFFF;
  --muted: #A6ABB5;
  --muted-2: #62656E;
  --gold: #E9D498;
  --gold-dim: rgba(233, 212, 152, 0.10);
  --gold-glow: rgba(233, 212, 152, 0.22);
  --blue: #6ea8ff;
  --blue-dim: rgba(110, 168, 255, 0.18);
  --green: #3fcb8e;
  --green-dim: rgba(63, 203, 142, 0.14);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.14);
  --warn: #f59e0b;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; transition: opacity 0.15s; }
a:hover { opacity: 0.75; text-decoration: none; }

.layout { display: flex; min-height: 100vh; }

/* ============ Sidebar ============ */
.sidebar {
  width: 196px;
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 26px 16px;
  display: flex;
  flex-direction: column;
}
.sidebar .brand { display: flex; align-items: center; gap: 9px; margin: 0 0 24px; padding: 0 4px; }
.sidebar .brand img { height: 22px; width: auto; }
.sidebar .brand .wordmark { font-weight: 300; font-size: 15px; letter-spacing: 0.2em; color: var(--text); }

.sidebar .user-search { margin-bottom: 16px; }
.sidebar .user-search input {
  width: 100%;
  padding: 9px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}
.sidebar .user-search input:focus { border-color: var(--gold); }
.sidebar .user-search input::placeholder { color: var(--muted-2); }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted-2);
  font-weight: 500;
  font-size: 13px;
}
.sidebar nav a svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar nav a:hover { background: var(--panel); color: var(--text); opacity: 1; }
.sidebar nav a.active { background: var(--panel); color: var(--gold); }

.sidebar .footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.sidebar .footer a { color: var(--muted-2); }
.sidebar .btn {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  width: 100%;
  transition: all 0.15s;
}
.sidebar .btn:hover { background: var(--gold-dim); border-color: var(--gold); }

/* Freshness badge */
.freshness {
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.freshness .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.freshness .dot.ok { background: var(--green); box-shadow: 0 0 6px rgba(63,203,142,0.6); }
.freshness .dot.warn { background: var(--warn); box-shadow: 0 0 6px rgba(245,158,11,0.6); }
.freshness .dot.bad { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,0.6); }

/* ============ Main ============ */
.main { flex: 1; padding: 40px 48px 64px; max-width: 1560px; }

.page-title {
  font-weight: 500;
  font-size: 34px;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: var(--text);
}
.page-sub { color: var(--muted); font-size: 14px; margin: 0 0 32px; max-width: 880px; line-height: 1.55; }
h2 { margin: 0 0 16px; font-weight: 600; font-size: 19px; letter-spacing: -0.015em; }
h3 { margin: 0 0 14px; font-weight: 600; font-size: 14.5px; letter-spacing: -0.005em; color: var(--text); }
.muted { color: var(--muted); font-size: 12px; }

/* ============ KPI cards ============ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.kpi {
  background: linear-gradient(180deg, var(--panel) 0%, rgba(13,13,15,0.4) 140%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: border-color 0.2s;
}
.kpi:hover { border-color: var(--line-2); }
/* Icon tile - rounded square, replaces old decorative ring */
.kpi .ring {
  position: relative;
  width: 48px; height: 48px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
}
.kpi .ring::before, .kpi .ring::after { content: none; }
.kpi .ring svg { width: 20px; height: 20px; color: var(--muted); opacity: 0.95; }
.kpi .body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kpi .label {
  color: var(--muted-2);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  order: 2;
}
.kpi .value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--text);
  order: 1;
}
.kpi .value.gold { color: var(--gold); }
.kpi .sub { color: var(--muted-2); font-size: 11.5px; font-variant-numeric: tabular-nums; order: 3; }
.kpi .util {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-top: 6px;
  text-transform: uppercase;
  order: 4;
  align-self: flex-start;
}
.kpi .util.low { background: var(--green-dim); color: var(--green); }
.kpi .util.mid { background: rgba(245, 158, 11, 0.16); color: var(--warn); }
.kpi .util.high { background: var(--red-dim); color: var(--red); }

/* ============ Tables ============ */
table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); }
th {
  background: transparent;
  color: var(--muted-2);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--panel-2); }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: rgba(233, 212, 152, 0.05); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.num.gold { color: var(--gold); }

/* ============ Panels ============ */
.panel {
  background: linear-gradient(180deg, var(--panel) 0%, rgba(13,13,15,0.35) 160%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  margin-bottom: 20px;
}
.panel h3 { margin-bottom: 4px; }
.panel .panel-sub { color: var(--muted-2); font-size: 12.5px; margin: 0 0 18px; line-height: 1.5; }

/* ============ Banners ============ */
.banner {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 13px;
}
.banner.info { border-left-color: var(--blue); }
.banner strong { color: var(--text); font-weight: 600; }
.banner code { background: var(--bg); padding: 2px 6px; border-radius: 4px; color: var(--gold); font-size: 12px; }

/* ============ Buttons ============ */
.btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-2);
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.refresh-form { display: inline; }

/* ============ Login ============ */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 20%, rgba(233, 212, 152, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(110, 168, 255, 0.03) 0%, transparent 40%),
    var(--bg);
}
.login-card {
  background: linear-gradient(180deg, var(--panel) 0%, rgba(13,13,15,0.4) 160%);
  border: 1px solid var(--line);
  padding: 40px;
  border-radius: 24px;
  width: 372px;
}
.login-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; justify-content: center; }
.login-card .brand img { height: 32px; }
.login-card .wordmark { font-weight: 300; font-size: 22px; letter-spacing: 0.22em; }
.login-card h1 {
  margin: 0 0 26px;
  font-size: 12px;
  text-align: center;
  font-weight: 500;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.login-card input {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
  color: var(--text);
  margin-bottom: 14px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s;
}
.login-card input:focus { outline: none; border-color: var(--gold); }
.login-card .err { color: var(--red); font-size: 12px; margin-bottom: 12px; text-align: center; }
.login-card .submit {
  background: var(--gold);
  color: #000;
  border: none;
  padding: 13px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  width: 100%;
  transition: opacity 0.15s;
}
.login-card .submit:hover { opacity: 0.85; }

/* ============ Charts ============ */
.chart-wrap { position: relative; height: 280px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

/* ============ Pills ============ */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pill.pos { background: var(--green-dim); color: var(--green); }
.pill.neg { background: var(--red-dim); color: var(--red); }
.pill.gold { background: var(--gold-dim); color: var(--gold); }
.pill.muted { background: var(--panel-2); color: var(--muted); }

/* Status pill with glowing dot, like "LIVE NOW" in the new designs */
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px;
  border: 1px solid var(--gold-dim);
  background: rgba(233, 212, 152, 0.06);
  border-radius: 999px;
  color: var(--gold);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.status-pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold-glow);
}
.status-pill.green { color: var(--green); border-color: rgba(63,203,142,0.2); background: rgba(63,203,142,0.05); }
.status-pill.green::before { background: var(--green); box-shadow: 0 0 8px rgba(63,203,142,0.5); }
.status-pill.red { color: var(--red); border-color: rgba(239,68,68,0.2); background: rgba(239,68,68,0.05); }
.status-pill.red::before { background: var(--red); box-shadow: 0 0 8px rgba(239,68,68,0.5); }

/* ============ Long/short bias bar ============ */
.bias-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--red-dim);
  overflow: hidden;
  margin-top: 10px;
}
.bias-bar .fill { height: 100%; background: var(--green); border-radius: 3px; }

/* ============ Timeline (trade detail) ============ */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--line-2);
}
.timeline li { position: relative; padding: 0 0 22px 30px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .t-dot {
  position: absolute; left: 0; top: 4px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 2px solid var(--line-2);
}
.timeline li.gold .t-dot { border-color: var(--gold); background: var(--gold-dim); }
.timeline li.green .t-dot { border-color: var(--green); background: var(--green-dim); }
.timeline li.red .t-dot { border-color: var(--red); background: var(--red-dim); }
.timeline .t-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.timeline .t-time { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ============ Profile header ============ */
.profile-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 28px; }
.profile-addrs { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.addr-label { color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; margin-right: 8px; }
.addr { color: var(--muted); font-size: 12px; font-family: ui-monospace, monospace; }
.profile-meta { display: flex; flex-direction: column; gap: 6px; text-align: right; font-size: 12px; }
.profile-meta .meta-label { color: var(--muted-2); margin-right: 8px; }

/* ============ Scroll tables ============ */
.scroll-table {
  max-height: 480px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: transparent;
}
.scroll-table table { border: none; border-radius: 0; }
.scroll-table thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 1; }
.scroll-table::-webkit-scrollbar { width: 8px; }
.scroll-table::-webkit-scrollbar-track { background: var(--bg); }
.scroll-table::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.scroll-table::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* ============ Donut legend ============ */
.donut-row { display: flex; gap: 28px; align-items: center; }
.donut-row .donut-canvas { flex-shrink: 0; }
.donut-legend { flex: 1; }
.donut-legend table { background: transparent; border: none; }
.donut-legend td { padding: 8px 10px; }
.legend-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 9px; vertical-align: middle;
}
