* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #ffffff;
  color: #111111;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px 20px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 16px;
}

.header h1 { font-size: 22px; font-weight: 700; }
.header .date { font-size: 15px; color: #6b7280; }

.updated {
  text-align: center;
  font-size: 14px;
  color: #9ca3af;
  margin-bottom: 4px;
}

/* Hero P&L */
.hero {
  text-align: center;
  padding: 20px 16px 8px;
}

.hero-number {
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
}

/* Velocity arrow */
.velocity {
  font-size: 28px;
  margin-right: 8px;
  vertical-align: middle;
}
.vel-up { color: #22C55E; }
.vel-down { color: #EF4444; }

/* Day's Range bar */
.day-range {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}

.dr-label {
  color: #9ca3af;
  font-weight: 600;
  white-space: nowrap;
}

.dr-val {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

.dr-bar {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  position: relative;
}

.dr-fill {
  height: 100%;
  background: linear-gradient(90deg, #EF4444, #FCD34D, #22C55E);
  border-radius: 3px;
}

.dr-marker {
  position: absolute;
  top: -4px;
  width: 8px;
  height: 14px;
  background: #111;
  border-radius: 2px;
  transform: translateX(-50%);
}

/* Exposure bar */
.exposure-bar {
  display: flex;
  justify-content: space-around;
  padding: 10px 8px;
  margin-bottom: 16px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.exp-item { text-align: center; }
.exp-label { display: block; font-size: 11px; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px; }
.exp-val { font-size: 15px; font-weight: 700; }

/* Colors */
.positive { color: #22C55E; }
.negative { color: #EF4444; }
.neutral { color: #6b7280; }

/* Intraday chart */
.chart-container {
  margin-bottom: 20px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}
.chart-container canvas { display: block; width: 100%; }

/* Trading Signals */
.signals-section { margin-bottom: 20px; }
.signals-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e5e7eb;
}

.signal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}

.signal-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  min-width: 65px;
  text-align: center;
}

.signal-info { flex: 1; min-width: 0; }
.signal-sym { font-weight: 700; font-size: 14px; }
.signal-desc { font-size: 11px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signal-pnl { font-weight: 700; font-size: 14px; text-align: right; white-space: nowrap; }

/* Account cards */
.accounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.account-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.account-card:active { background: #f3f4f6; }
.account-name { font-size: 15px; font-weight: 600; color: #374151; }
.account-pnl { font-size: 28px; font-weight: 700; }
.account-detail { font-size: 13px; color: #6b7280; margin-top: 2px; }

/* Accordion */
.account-positions {
  display: none;
  margin-top: 10px;
  border-top: 1px solid #e5e7eb;
  padding-top: 8px;
}
.account-card.expanded .account-positions { display: block; }

/* Winners/Losers tables */
.wl-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.wl-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: #374151;
  padding-bottom: 6px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 4px;
}

.wl-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  padding: 5px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}

.wl-sym { font-weight: 600; font-size: 13px; }
.wl-desc { color: #9ca3af; font-size: 11px; grid-column: 1; }
.wl-side { color: #9ca3af; font-size: 11px; grid-column: 1; }
.wl-pnl { font-weight: 700; text-align: right; grid-column: 2; grid-row: 1 / span 3; align-self: center; font-size: 14px; }
.wl-empty { color: #d1d5db; font-size: 13px; padding: 8px 0; }

/* Momentum indicators */
.momentum {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}
.mom-up { background: #DCFCE7; color: #166534; }
.mom-down { background: #FEF3C7; color: #92400E; }

/* Movers */
.movers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.movers-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e5e7eb;
}

.mover-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 15px;
  border-bottom: 1px solid #f3f4f6;
  min-height: 38px;
}

.mover-rank { color: #9ca3af; width: 22px; font-size: 13px; }
.mover-sym { font-weight: 700; flex: 1; font-size: 14px; }
.mover-pnl { font-weight: 700; text-align: right; font-size: 14px; }

/* Changes since last refresh */
.changes-section { margin-bottom: 20px; }
.changes-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e5e7eb;
}

/* Fills section */
.fills-section { margin-bottom: 20px; }

.fill-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 14px;
  border-bottom: 1px solid #f3f4f6;
}

.fill-sym { font-weight: 700; min-width: 70px; }
.fill-detail { flex: 1; color: #374151; font-size: 13px; padding: 0 8px; }
.fill-pnl { text-align: right; font-size: 14px; }

.fill-group.expandable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fill-group.expandable:active { background: #f9fafb; }

.fill-sub-container {
  padding: 4px 0 8px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.fill-sub-row {
  display: flex;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
  color: #555;
  border-bottom: 1px solid #f9fafb;
}

.fill-sub-side { font-weight: 600; min-width: 40px; }
.fill-sub-qty { min-width: 55px; text-align: right; }
.fill-sub-px { min-width: 65px; text-align: right; font-weight: 600; }
.fill-sub-pnl { min-width: 60px; text-align: right; font-weight: 600; }
.fill-sub-acct { color: #9ca3af; font-size: 11px; }

.fills-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e5e7eb;
}

.order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid #f3f4f6;
  min-height: 40px;
}

.order-sym { font-weight: 700; min-width: 70px; }
.order-detail { flex: 1; color: #374151; font-size: 13px; padding: 0 8px; }
.order-status { font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.order-status-open { background: #DBEAFE; color: #1E40AF; }
.order-status-partial { background: #FEF3C7; color: #92400E; }
.order-status-filled { background: #DCFCE7; color: #166534; }

/* Refresh button */
.refresh-btn {
  background: #3B82F6;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.refresh-btn:active { background: #2563EB; }

/* Market badge */
.market-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.market-badge.open { background: #DCFCE7; color: #166534; }
.market-badge.closed { background: #F3F4F6; color: #6b7280; }
.market-badge.pre { background: #FEF3C7; color: #92400E; }
.market-badge.after { background: #DBEAFE; color: #1E40AF; }

/* Sync indicator */
.sync-indicator { color: #9ca3af; }
.sync-indicator.syncing { color: #3B82F6; font-weight: 600; }
.sync-indicator.sync-note { color: #B45309; font-weight: 600; }

/* Loading / error */
.loading { text-align: center; padding: 80px 20px; font-size: 24px; color: #9ca3af; }
.error { text-align: center; padding: 80px 20px; }
.error h2 { font-size: 24px; color: #EF4444; margin-bottom: 8px; }
.error p { font-size: 18px; color: #6b7280; }

.stale-banner {
  background: #FEF3C7;
  color: #92400E;
  text-align: center;
  padding: 8px;
  font-size: 14px;
  font-weight: 600;
  display: none;
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px 0;
  color: #d1d5db;
  font-size: 13px;
  border-top: 1px solid #f3f4f6;
  margin-top: 24px;
}

/* Email-style comparison (primary view) */
.compare-card { margin-bottom: 20px; }

.cmp-toggle { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.cmp-win {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cmp-win.active { background: #111; color: #fff; border-color: #111; }

.cmp-wait { text-align: center; color: #9ca3af; padding: 28px 12px; font-size: 14px; }

.cmp-head { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.cmp-head th {
  font-size: 13px;
  color: #6b7280;
  font-weight: 600;
  text-align: right;
  padding: 6px 10px;
  border-bottom: 2px solid #e5e7eb;
}
.cmp-head th:first-child { text-align: left; }
.cmp-head td {
  text-align: right;
  padding: 10px;
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cmp-rowlbl { text-align: left !important; color: #374151; }
.cmp-net.positive { color: #16a34a; }
.cmp-net.negative { color: #dc2626; }

.cmp-actual { text-align: center; font-size: 11px; color: #9ca3af; margin: -8px 0 14px; }

.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cmp-coltitle {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  padding: 7px 10px;
  border-radius: 6px 6px 0 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cmp-coltitle.up { background: #16a34a; }
.cmp-coltitle.down { background: #dc2626; }

.cmp-movers { width: 100%; border-collapse: collapse; }
.cmp-movers th {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 600;
  text-align: right;
  padding: 5px 6px;
  border-bottom: 1px solid #e5e7eb;
}
.cmp-movers th:first-child { text-align: left; }
.cmp-movers td {
  text-align: right;
  padding: 6px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid #f3f4f6;
  color: #111;
}
.cmp-tkr { text-align: left !important; font-weight: 700; }
.cmp-movers td.positive { color: #16a34a; }
.cmp-movers td.negative { color: #dc2626; }
.cmp-empty { text-align: center !important; color: #d1d5db; padding: 14px 0; }

/* Details disclosure */
.details-section { margin-top: 8px; }
.details-section > summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: #374151;
  padding: 12px 0;
  border-top: 2px solid #e5e7eb;
  border-bottom: 2px solid #e5e7eb;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.details-section > summary::-webkit-details-marker { display: none; }
.details-section > summary::before { content: '\25B8\00a0'; color: #9ca3af; }
.details-section[open] > summary::before { content: '\25BE\00a0'; }
.details-section[open] > summary { margin-bottom: 16px; }

@media (max-width: 600px) {
  .hero-number { font-size: 48px; }
  .accounts { grid-template-columns: 1fr; }
  .movers { grid-template-columns: 1fr; }
  .wl-tables { grid-template-columns: 1fr; }
  .account-pnl { font-size: 24px; }
  .exposure-bar { flex-wrap: wrap; gap: 8px; }
  .exp-item { flex: 0 0 45%; }
  .cmp-grid { grid-template-columns: 1fr; }
  .cmp-head td { font-size: 16px; padding: 8px 6px; }
  .cmp-head th { padding: 6px; }
}
