:root {
  --bg: #f6f7f9;
  --panel: #fff;
  --ink: #172033;
  --muted: #667085;
  --line: #e4e7ec;
  --blue: #2563eb;
  --green: #16803c;
  --red: #d92d20;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; background: var(--bg); color: var(--ink); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
h1 { margin: 0; font-size: 22px; }
p { margin: 6px 0 0; color: var(--muted); }
button, select, input { border: 1px solid #cbd5e1; background: #fff; border-radius: 6px; padding: 9px 11px; font-size: 14px; }
button { cursor: pointer; }
main { padding: 18px 24px 28px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.segmented { display: inline-flex; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #eef2f7; }
.segmented button { min-width: 64px; border-color: transparent; background: transparent; font-weight: 800; color: #475467; }
.segmented button.active { background: #fff; color: var(--blue); border-color: #bcd0f7; box-shadow: 0 1px 3px rgba(15, 23, 42, .08); }
.live-status { align-self: center; color: var(--muted); font-size: 13px; }
.ticker-bar { display: grid; grid-template-columns: 1.2fr repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.ticker-item { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 68px; }
.ticker-label { color: var(--muted); font-size: 12px; }
.ticker-value { margin-top: 5px; font-weight: 800; font-size: 20px; line-height: 1.1; }
.ticker-sub { margin-top: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-grid { display: grid; grid-template-columns: minmax(360px, .9fr) minmax(420px, 1.1fr); gap: 10px; margin-bottom: 14px; }
.account-box { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px; }
.account-metric { border: 1px solid var(--line); border-radius: 7px; padding: 8px; background: #f8fafc; }
.positions-panel { margin-bottom: 14px; }
.positions-box { overflow-x: auto; }
.positions-empty { padding: 14px; }
.positions-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.positions-table th, .positions-table td { padding: 9px 10px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.positions-table th:first-child, .positions-table td:first-child { text-align: left; }
.trade-box { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(120px, .7fr) minmax(120px, .7fr) 110px 110px; gap: 10px; padding: 12px 12px 8px; align-items: end; }
.trade-box label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.trade-box input { width: 100%; }
.buy-button { background: #dcfce7; border-color: #86efac; color: var(--green); font-weight: 800; }
.sell-button { background: #fee2e2; border-color: #fecaca; color: var(--red); font-weight: 800; }
.close-button { background: #fff7ed; border-color: #fed7aa; color: #c2410c; font-weight: 800; }
.mini-input { width: 82px; padding: 6px 7px; font-size: 12px; }
.mini-button { padding: 6px 8px; font-size: 12px; font-weight: 800; }
.position-actions { display: inline-flex; gap: 6px; align-items: center; }
.trade-status { padding: 0 12px 12px; min-height: 28px; color: var(--muted); font-size: 13px; }
.overview { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer; }
.tile.active { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(37, 99, 235, .12); }
.tile .sym { font-weight: 800; font-size: 18px; }
.tile .meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.grid { display: grid; grid-template-columns: minmax(520px, 1.4fr) minmax(420px, .8fr); gap: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.panel-title { padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 800; }
.chart { height: 560px; }
.chart-legend { display: flex; gap: 12px; align-items: center; padding: 9px 14px 0; color: var(--muted); font-size: 12px; overflow: hidden; white-space: nowrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.dot.green { background: var(--green); }
.dot.black { background: #111827; }
.dot.purple { background: #7c3aed; }
.dot.blue { background: var(--blue); }
.cards { height: 560px; overflow: auto; padding: 12px; display: grid; gap: 10px; align-content: start; background: #f8fafc; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.card-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-weight: 800; }
.muted { color: var(--muted); }
.vals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.box { border: 1px solid var(--line); border-radius: 7px; padding: 8px; background: #f8fafc; }
.label { color: var(--muted); font-size: 12px; }
.value { font-size: 17px; font-weight: 800; margin-top: 3px; }
.up { color: var(--green); }
.down { color: var(--red); }
.login-body { min-height: 100vh; display: grid; place-items: center; }
.login-panel { width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 22px; display: grid; gap: 14px; box-shadow: 0 20px 50px rgba(15, 23, 42, .08); }
.login-panel label { display: grid; gap: 6px; color: var(--muted); }
.login-panel button { background: var(--blue); color: #fff; border-color: var(--blue); }
@media (max-width: 1100px) {
  .segmented { width: 100%; overflow-x: auto; }
  .segmented button { flex: 1; }
  .ticker-bar { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .account-grid { grid-template-columns: 1fr; }
  .account-box { grid-template-columns: repeat(2, 1fr); }
  .trade-box { grid-template-columns: 1fr; }
  .overview { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .grid { grid-template-columns: 1fr; }
}
