:root {
  --bg: #f7f4ed;
  --panel: #faf8f3;
  --text: #2c2c2c;
  --muted: #6b6b6b;
  --blue: #2563eb;
  --blue-light: rgba(37, 99, 235, 0.14);
  --forecast: #ea580c;
  --forecast-light: rgba(234, 88, 12, 0.08);
  --grey-line: #b8b8b8;
  --border: #e4dfd4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.header h1 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 600;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-right select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 0.95rem;
}

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

.tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: white;
  cursor: pointer;
  font-size: 0.9rem;
}

.tab.active {
  background: var(--text);
  color: white;
  border-color: var(--text);
}

.date-picker {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.hidden {
  display: none !important;
}

.metrics-panel {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.metric-value {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.metric-sub {
  font-size: 0.72rem;
  color: var(--muted);
}

.chart-subtitle {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 400;
}

.chart-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px 16px;
  position: relative;
}

.chart-panel.fullscreen {
  position: fixed;
  inset: 16px;
  z-index: 1000;
  max-width: none;
  margin: 0;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.chart-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
}

.chart-actions {
  display: flex;
  gap: 6px;
}

.chart-actions button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
}

.chart-wrap {
  position: relative;
  height: 420px;
}

.loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.peak-label {
  position: absolute;
  top: 80px;
  font-size: 0.75rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}

.info-tooltip {
  margin-top: 12px;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 960px) {
  .metrics-panel {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .header {
    flex-direction: column;
  }

  .metrics-panel {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    height: 320px;
  }
}
