* { box-sizing: border-box; }

body {
  margin: 0;
  background: #0f141b;
  color: #e2e8f0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #1a202c;
  max-width: 1200px;
  margin: 0 auto;
}
.nav-links { display: flex; gap: 4px; }
.nav a {
  color: #a0aec0;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
}
.nav a:hover { background: #1a202c; }
.nav a.active { color: #63b3ed; background: #1a202c; }
.nav-logout { color: #718096 !important; font-size: 12px !important; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

h1 { margin: 0 0 20px; font-size: 22px; }
h2 { font-size: 17px; margin: 0; }
.dim { color: #718096; }

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.arrow { color: #4a5568; }
.field { display: flex; align-items: center; gap: 5px; font-size: 12px; }

.btn {
  background: #1a202c;
  border: 1px solid #2d3748;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { border-color: #4a5568; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn.active { border-color: #63b3ed; color: #63b3ed; }

.input {
  background: #1a202c;
  border: 1px solid #2d3748;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
}

.info-box, .error-box {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}
.info-box { background: #1a202c; color: #a0aec0; }
.error-box { background: #451a1a; color: #fc8181; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat {
  background: #1a202c;
  border-radius: 8px;
  padding: 12px 16px;
}
.stat-label { font-size: 12px; color: #718096; margin-bottom: 2px; }
.stat-value { font-size: 18px; font-weight: 700; }

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.ticker-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.ticker-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) {
  .ticker-cards { grid-template-columns: 1fr; }
}

.ticker-card {
  background: #1a202c;
  border-radius: 10px;
  border: 1px solid #2d3748;
  overflow: hidden;
}

.ticker-head {
  padding: 10px 14px;
  background: #2d3748;
  cursor: pointer;
}
.ticker-head-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.ticker-symbol { font-weight: 700; font-size: 18px; }
.ticker-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #718096; }

.ticker-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
@media (max-width: 900px) {
  .ticker-metrics { grid-template-columns: repeat(2, 1fr); }
}
.metric {
  background: #1a202c;
  border-radius: 5px;
  padding: 4px 8px;
}
.metric-label { font-size: 11px; color: #718096; margin-bottom: 2px; }
.metric-value { font-size: 14px; font-weight: 700; }

.leg-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 4px;
  white-space: nowrap;
  display: inline-flex;
  gap: 6px;
}
.chip-short { background: #2a4365; color: #90cdf4; }
.chip-long { background: #1c4532; color: #9ae6b4; }
.chip-spread { background: #322659; color: #d6bcfa; }

.contract-row {
  padding: 10px 14px;
  border-top: 1px solid #2d3748;
}
.contract-row:first-child { border-top: none; }
.contract-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.contract-desc { font-size: 12px; font-weight: 600; }
.contract-tags { display: flex; gap: 6px; margin-top: 3px; }
.tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
}
.tag-closed { background: #2d3748; color: #a0aec0; }
.tag-open { background: #1a365d; color: #90cdf4; }
.contract-pnl { font-size: 13px; font-weight: 700; }
.contract-cashflow { font-size: 11px; color: #718096; }

.fills {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 8px;
  border-left: 2px solid #2d3748;
}
.fill-row {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
}
.fill-date { color: #718096; min-width: 52px; }
.fill-side { font-weight: 600; min-width: 28px; }
.fill-side.buy { color: #fc8181; }
.fill-side.sell { color: #48bb78; }
.fill-qty { color: #cbd5e0; }
.fill-net { margin-left: auto; }
.fill-pnl { font-size: 10px; }

.collapsible { margin-top: 28px; cursor: pointer; user-select: none; display: flex; align-items: center; gap: 10px; }
.collapsible span { font-size: 14px; color: #4a5568; font-weight: 400; }

table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #2d3748; }
th { color: #a0aec0; font-weight: 600; font-size: 12px; }

.pos { color: #48bb78; }
.neg { color: #fc8181; }
.neu { color: #e2e8f0; }

.chart-block {
  background: #1a202c;
  border: 1px solid #2d3748;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.chart-head h2 { font-size: 14px; color: #a0aec0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #cbd5e0; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.chart-canvas-wrap { position: relative; }
.chart-canvas-wrap canvas { display: block; }

.chart-tooltip {
  position: absolute;
  background: #0f141b;
  border: 1px solid #2d3748;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  line-height: 1.6;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-box {
  background: #1a202c;
  border: 1px solid #2d3748;
  border-radius: 10px;
  padding: 28px 24px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-box h1 { font-size: 18px; margin: 0 0 4px; text-align: center; }
.login-box .input { padding: 9px 12px; font-size: 14px; }
.login-box .btn { padding: 9px 12px; font-size: 14px; }
