/* PSX Pulse — minimal dark theme */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0a0e1a;
  color: #e6e9ef;
  overflow: hidden;
}

header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #1f2433;
  background: #0d1220;
}

header h1 {
  font-size: 1rem;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.02em;
}

header nav {
  display: flex;
  gap: 0.25rem;
}

header button {
  background: transparent;
  color: #8a92a6;
  border: 1px solid transparent;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

header button:hover {
  color: #e6e9ef;
}

header button.active {
  color: #e6e9ef;
  background: #1a2136;
  border-color: #2a3450;
}

#timeframe {
  margin-left: auto;
  background: #1a2136;
  color: #e6e9ef;
  border: 1px solid #2a3450;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

main {
  position: relative;
  height: calc(100% - 48px);
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* Morning Brief hero bar */
#morning-brief {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #1f2433;
  background: #0d1220;
  flex-shrink: 0;
  overflow-x: auto;
  min-height: 56px;
  align-items: center;
}

.brief-card {
  background: #141a2b;
  border: 1px solid #1f2433;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  min-width: 140px;
  flex-shrink: 0;
}

.brief-card .brief-label {
  font-size: 0.65rem;
  color: #5a6276;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.brief-card .brief-value {
  font-size: 1rem;
  font-weight: 700;
  color: #e6e9ef;
  line-height: 1.3;
}

.brief-card .brief-sub {
  font-size: 0.75rem;
  color: #8a92a6;
}

.brief-card.mover-up { border-left: 3px solid #2dd48f; }
.brief-card.mover-down { border-left: 3px solid #e85b5b; }
.brief-card.flow-in { border-left: 3px solid #3b9dff; }
.brief-card.flow-out { border-left: 3px solid #f5c542; }

canvas#z1 {
  display: block;
  width: 100%;
  flex: 1;
  cursor: grab;
}

canvas#z1:active { cursor: grabbing; }

#view-toggle {
  position: absolute;
  top: 0.5rem;
  left: 1rem;
  display: flex;
  gap: 0;
  z-index: 10;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #2a3450;
}
#view-toggle button {
  background: #1a2136;
  color: #8a92a6;
  border: none;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  cursor: pointer;
}
#view-toggle button.active {
  background: #2a3450;
  color: #e6e9ef;
}
#view-toggle button:hover { color: #e6e9ef; }

#heatmap-container {
  width: 100%;
  flex: 1;
  overflow: hidden;
}

#zoom-controls {
  position: absolute;
  bottom: 3rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 10;
}
#zoom-controls button {
  width: 36px; height: 36px;
  background: #1a2136;
  color: #e6e9ef;
  border: 1px solid #2a3450;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#zoom-controls button:hover {
  background: #2a3450;
  border-color: #3b9dff;
}

section#z2, section#sectors-view, section#flows-view, section#strategies-view {
  position: absolute;
  inset: 0;
  background: #0a0e1a;
  padding: 1rem;
  overflow-y: auto;
}

/* Z2 — ticker detail with voice cards */
.z2-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.z2-title h2 { margin: 0; font-size: 1.4rem; color: #e6e9ef; }
#z2-price-meta { font-size: 0.85rem; color: #8a92a6; margin-top: 0.15rem; }

button#z2-back {
  background: #1a2136; color: #e6e9ef;
  border: 1px solid #2a3450; padding: 0.4rem 0.8rem;
  border-radius: 6px; cursor: pointer; flex-shrink: 0;
}

#z2-annotations { margin-bottom: 1rem; }

#z2-voices {
  display: flex; flex-direction: column; gap: 0.75rem; max-width: 700px;
}

.voice-card {
  background: #0d1220; border: 1px solid #2a3450;
  border-radius: 10px; padding: 0.85rem 1rem;
}
.voice-card .voice-header {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem;
}
.voice-card .handle { font-weight: 600; color: #e6e9ef; }
.voice-card .tier-badge {
  font-size: 0.7rem; padding: 0.1rem 0.4rem;
  border-radius: 4px; font-weight: 600;
}
.tier-badge.tier-1 { background: #2dd48f22; color: #2dd48f; }
.tier-badge.tier-2 { background: #3b9dff22; color: #3b9dff; }
.tier-badge.tier-3 { background: #f5c54222; color: #f5c542; }
.tier-badge.tier-4 { background: #f5c54211; color: #c9a83a; }
.voice-card .timestamp { margin-left: auto; font-size: 0.75rem; color: #5a6276; }
.voice-card .post-text { font-size: 0.9rem; line-height: 1.45; color: #c8cdd8; margin: 0; }
.voice-card .post-footer {
  display: flex; gap: 1rem; margin-top: 0.5rem;
  font-size: 0.75rem; color: #5a6276;
}
.voice-card .post-footer a { color: #3b9dff; text-decoration: none; }
.voice-card .post-footer a:hover { text-decoration: underline; }
.z2-empty { color: #5a6276; text-align: center; padding: 3rem 1rem; font-size: 0.9rem; }

.positive { color: #2dd48f; }
.negative { color: #e85b5b; }

section#sectors-view svg,
section#flows-view svg {
  width: 100%;
  height: calc(100% - 80px);
  display: block;
}

section#sectors-view h2,
section#flows-view h2 {
  margin: 0.25rem 0 0.5rem;
  font-size: 1.1rem;
  color: #e6e9ef;
}

#sectors-meta, #flows-meta {
  position: absolute;
  bottom: 0.75rem;
  left: 1rem;
  color: #8a92a6;
  font-size: 0.75rem;
}

/* Strategies view */
#strategies-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.5rem;
}

.strat-header {
  margin: 0 0 1.5rem;
  font-size: 1rem;
  color: #8a92a6;
}

.strat-header strong { color: #e6e9ef; }

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.portfolio-card {
  background: #0d1220;
  border: 1px solid #2a3450;
  border-radius: 10px;
  padding: 1rem;
}

.portfolio-card.buy { border-left: 3px solid #2dd48f; }
.portfolio-card.avoid { border-left: 3px solid #e85b5b; }

.portfolio-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.portfolio-card h3 .symbol { color: #e6e9ef; }
.portfolio-card h3 .price { color: #8a92a6; font-size: 0.85rem; font-weight: 400; }

.portfolio-card .metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 1rem;
  font-size: 0.8rem;
}

.portfolio-card .metrics dt { color: #5a6276; }
.portfolio-card .metrics dd { margin: 0; color: #e6e9ef; }
.portfolio-card .metrics dd.positive { color: #2dd48f; }
.portfolio-card .metrics dd.negative { color: #e85b5b; }

.strat-section-title {
  font-size: 0.9rem;
  color: #8a92a6;
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #1f2433;
}

/* Collapsible sources */
.sources-toggle {
  background: transparent; border: 1px solid #2a3450;
  color: #8a92a6; padding: 0.3rem 0.7rem; border-radius: 5px;
  cursor: pointer; font-size: 0.75rem; margin-top: 0.5rem;
}
.sources-toggle:hover { color: #e6e9ef; border-color: #3b9dff; }
.sources-panel {
  display: none; margin-top: 0.5rem; padding: 0.5rem 0;
  border-top: 1px solid #1f2433;
}
.sources-panel.open { display: block; }
.source-item {
  font-size: 0.8rem; padding: 0.4rem 0; color: #8a92a6;
  border-bottom: 1px solid #141a2b;
}
.source-item .src-handle { color: #e6e9ef; font-weight: 600; }
.source-item .src-text { color: #c8cdd8; margin-top: 0.15rem; }
.source-item a { color: #3b9dff; text-decoration: none; font-size: 0.75rem; }

/* Strategy recommendation cards */
.strat-rec {
  background: #0d1220; border: 1px solid #2a3450;
  border-radius: 10px; padding: 1rem; margin-bottom: 0.75rem;
}
.strat-rec.bullish { border-left: 3px solid #2dd48f; }
.strat-rec.bearish { border-left: 3px solid #e85b5b; }
.strat-rec.neutral { border-left: 3px solid #8a92a6; }
.strat-rec h4 {
  margin: 0 0 0.3rem; font-size: 1rem;
  display: flex; justify-content: space-between; align-items: baseline;
}
.strat-rec h4 .symbol { color: #e6e9ef; }
.strat-rec h4 .direction-badge {
  font-size: 0.75rem; padding: 0.15rem 0.5rem;
  border-radius: 4px; font-weight: 600;
}
.direction-badge.bull { background: #2dd48f22; color: #2dd48f; }
.direction-badge.bear { background: #e85b5b22; color: #e85b5b; }
.direction-badge.mixed { background: #f5c54222; color: #f5c542; }
.strat-rec .rec-meta {
  font-size: 0.8rem; color: #8a92a6; margin-bottom: 0.3rem;
}
.strat-rec .rec-rationale {
  font-size: 0.85rem; color: #c8cdd8; line-height: 1.4;
}

.strat-empty {
  color: #5a6276; text-align: center; padding: 2rem; font-size: 0.9rem;
}

section#z2 h2 {
  margin: 0.5rem 0 1rem;
  font-size: 1.25rem;
  color: #e6e9ef;
}

button#z2-back, button#z3-back {
  background: #1a2136;
  color: #e6e9ef;
  border: 1px solid #2a3450;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
}

article#z3-card {
  max-width: 560px;
  margin: 2rem auto;
  padding: 1.5rem;
  border: 1px solid #2a3450;
  border-radius: 12px;
  background: #0d1220;
}

footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  color: #5a6276;
  border-top: 1px solid #1f2433;
  background: #0d1220;
}

/* Satellite (Z2) styling */
.satellite { cursor: pointer; }
.satellite circle.ring-green { stroke: #2dd48f; stroke-width: 2; }
.satellite circle.ring-blue  { stroke: #3b9dff; stroke-width: 2; }
.satellite circle.ring-yellow{ stroke: #f5c542; stroke-width: 2; }
.satellite circle.ring-red   { stroke: #e85b5b; stroke-width: 2; }
.satellite text { fill: #e6e9ef; font-size: 10px; }

.ticker-center text {
  fill: #e6e9ef;
  font-size: 16px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
}

/* Annotation badge (Flavor B) */
.annotation-bull { fill: #2dd48f; }
.annotation-bear { fill: #e85b5b; }
.annotation-neutral { fill: #8a92a6; }
