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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0d1117;
  color: #c9d1d9;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ========== HEADER ========== */
header {
  padding: 12px 24px;
  background: #161b22;
  border-bottom: 1px solid #21262d;
  display: flex;
  align-items: baseline;
  gap: 20px;
  flex-shrink: 0;
}

header h1 {
  font-size: 1.1rem;
  color: #f0f6fc;
  white-space: nowrap;
}

.subtitle {
  color: #8b949e;
  font-size: 0.8rem;
}

/* ========== COMPANY FILTER ========== */
.company-filter {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.company-filter span {
  color: #8b949e;
  font-size: 0.85rem;
  margin-right: 4px;
}

.filter-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  user-select: none;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.filter-checkbox-label:hover {
  background: rgba(255, 255, 255, 0.05);
}

.filter-checkbox-label input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #58a6ff;
}

.filter-checkbox-label .checkbox-text {
  color: #c9d1d9;
}

/* ========== TIME DISPLAY ========== */
#time-display {
  position: fixed;
  top: 60px;
  right: 30px;
  z-index: 100;
  pointer-events: none;
}

#current-date {
  font-size: 2.5rem;
  font-weight: 800;
  color: rgba(240, 246, 252, 0.12);
  letter-spacing: -1px;
  transition: color 0.1s;
}

/* ========== DASHBOARD GRID ========== */
.dashboard {
  flex: 1;
  display: flex;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

.panel {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
}

.panel-main {
  flex: 2;
  min-width: 0;
  min-height: 0;
}

.panel-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
}

.panel-small {
  flex: 1;
  min-height: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 0.95rem;
  color: #f0f6fc;
  white-space: nowrap;
}

/* ========== LEGEND ========== */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  user-select: none;
  transition: opacity 0.2s;
}

.legend-item:hover { background: #21262d; }
.legend-item.disabled { opacity: 0.25; }

.legend-swatch {
  width: 12px;
  height: 3px;
  border-radius: 2px;
}

/* ========== TIMELINE BAR ========== */
#timeline-bar {
  flex-shrink: 0;
  padding: 8px 24px 14px;
  background: #161b22;
  border-top: 1px solid #21262d;
}

#timeline-track {
  position: relative;
  height: 24px;
  background: #21262d;
  border-radius: 12px;
  cursor: crosshair;
  overflow: visible;
}

#timeline-cursor {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 32px;
  background: #58a6ff;
  border-radius: 2px;
  pointer-events: none;
  transition: left 0.05s linear;
  box-shadow: 0 0 8px rgba(88, 166, 255, 0.5);
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  padding: 4px 0 0;
  font-size: 0.7rem;
  color: #484f58;
}

/* Event ticks on timeline */
.timeline-tick {
  position: absolute;
  top: 4px;
  width: 2px;
  height: 16px;
  border-radius: 1px;
  pointer-events: none;
}

/* ========== TOOLTIP ========== */
#tooltip {
  position: fixed;
  background: rgba(33, 38, 45, 0.96);
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: #c9d1d9;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 1000;
  max-width: 300px;
  line-height: 1.5;
  backdrop-filter: blur(8px);
}

#tooltip .tt-title {
  font-weight: 600;
  color: #f0f6fc;
  margin-bottom: 4px;
}

#tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

#tooltip .tt-label { color: #8b949e; }

/* ========== CHART CONTAINERS ========== */
#stock-chart,
#capex-chart {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ========== CHART STYLES ========== */
.axis text { fill: #8b949e; font-size: 10px; }
.axis line, .axis path { stroke: #30363d; }
.grid line { stroke: #21262d; stroke-dasharray: 2,2; }
.grid path { stroke: none; }

.stock-line { fill: none; stroke-width: 2; }
.stock-line-future { fill: none; stroke-width: 2; stroke-dasharray: 4,3; opacity: 0.15; }

/* Time cursor on chart */
.time-cursor {
  stroke: #58a6ff;
  stroke-width: 1.5;
  stroke-dasharray: 4,3;
  pointer-events: none;
}

/* Price dots on cursor line */
.cursor-dot {
  pointer-events: none;
  transition: cy 0.05s;
}

/* Layoff markers */
.layoff-marker {
  cursor: pointer;
  transition: r 0.15s, opacity 0.3s;
}

.layoff-marker-hidden { opacity: 0 !important; r: 0 !important; }

/* ========== LAYOFF INFO CARDS ========== */
#layoff-panel {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.layoff-card {
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 10px 12px;
  transition: opacity 0.3s, transform 0.3s;
  opacity: 0.3;
  transform: scale(0.95);
}

.layoff-card.visible {
  opacity: 1;
  transform: scale(1);
}

.layoff-card .card-company {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.layoff-card .card-detail {
  font-size: 0.75rem;
  color: #8b949e;
}

.layoff-card .card-count {
  font-size: 1.3rem;
  font-weight: 700;
  color: #f0f6fc;
}

/* ========== CAPEX BARS ========== */
.capex-bar {
  transition: opacity 0.2s;
  cursor: pointer;
}
.capex-bar:hover { opacity: 0.8; }
.capex-bar-future { opacity: 0.15; }

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .dashboard { flex-direction: column; }
  .panel-right { max-width: none; flex-direction: row; }
  .panel-small { min-height: 200px; }
}
