* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
}
.header {
  background: #1a1a2e;
  color: #fff;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.header h1 { font-size: 1.25rem; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 0.5rem; }
.header select {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #444;
  background: #16213e;
  color: #fff;
  font-size: 0.875rem;
  cursor: pointer;
}
#yearPicker { min-width: 80px; }
#monthPicker { min-width: 130px; }
#dayPicker { min-width: 120px; }
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.stat-card .label {
  font-size: 0.7rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}
.stat-card .value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a1a2e;
}
.stat-card .sub {
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.25rem;
}
.stat-card.forecast { border-left: 3px solid #7c4dff; }
.stat-card.forecast .value { color: #7c4dff; }
.chart-section {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
}
.chart-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #444;
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.chart-header h2 { margin-bottom: 0; }
.chart-tabs {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #ddd;
}
.chart-tabs button {
  padding: 0.4rem 0.9rem;
  border: none;
  background: #fff;
  color: #666;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.chart-tabs button:not(:last-child) { border-right: 1px solid #ddd; }
.chart-tabs button.active {
  background: #1a1a2e;
  color: #fff;
}
.chart-wrapper {
  position: relative;
  width: 100%;
  height: 420px;
}
.legend {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: #666;
  flex-wrap: wrap;
}
.legend span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.legend .dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.table-section {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
.table-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #444;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
thead th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid #e0e0e0;
  color: #666;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
}
tbody tr:hover { background: #fafafa; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #e8f0fe; }
tbody tr.selected {
  background: #e3f2fd;
  border-left: 3px solid #1976d2;
}
tbody tr.selected td:first-child { padding-left: calc(0.75rem - 3px); }
.tarif-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}
.tarif-peak { background: #fff3e0; color: #e65100; }
.tarif-offpeak { background: #e8f5e9; color: #2e7d32; }
.tarif-default { background: #e3f2fd; color: #1565c0; }
.text-right { text-align: right; }
.text-mono { font-family: "SF Mono", "Consolas", "Monaco", monospace; }
.error {
  text-align: center;
  padding: 2rem;
  color: #c62828;
  background: #fff;
  border-radius: 10px;
  margin: 1rem 0;
}
.forecast-section {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
}
.forecast-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #444;
}
.forecast-progress {
  background: #e0e0e0;
  border-radius: 8px;
  height: 32px;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.forecast-progress-bar {
  background: linear-gradient(90deg, #1976d2, #42a5f5);
  height: 100%;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 80px;
  transition: width 0.3s;
}
.forecast-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.forecast-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid #e8e8e8;
}
.forecast-card .fc-label {
  font-size: 0.7rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}
.forecast-card .fc-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #333;
}
.forecast-card .fc-sub {
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.25rem;
}
.day-detail-divider {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.day-detail-divider hr {
  border: none;
  border-top: 2px dashed #ccc;
  margin: 0.5rem 0;
}
.day-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.day-detail-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a1a2e;
}
.btn-back {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #666;
  font-size: 0.8rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-back:hover { background: #f0f0f0; border-color: #999; }
.detail-tab-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid #e0e0e0;
}
.detail-tab {
  padding: 0.6rem 1.25rem;
  border: none;
  background: transparent;
  color: #888;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.detail-tab:hover { color: #444; }
.detail-tab.active {
  color: #1a1a2e;
  border-bottom-color: #1a1a2e;
  font-weight: 600;
}
.loading {
  text-align: center;
  padding: 2rem;
  color: #888;
  font-size: 0.9rem;
}
.analytics-filter {
  margin-bottom: 1rem;
}
.heatmap-container {
  overflow-x: auto;
  margin-top: 0.75rem;
}
.heatmap-grid {
  display: inline-grid;
  gap: 2px;
  font-size: 0.65rem;
  min-width: max-content;
}
.heatmap-cell {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 3px;
  font-size: 0;
  transition: outline 0.1s;
  position: relative;
}
.heatmap-cell:hover {
  outline: 2px solid #333;
  z-index: 1;
}
.heatmap-label {
  font-size: 0.65rem;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
}
.heatmap-day-label {
  font-size: 0.6rem;
  color: #888;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 20px;
}
.heatmap-tooltip {
  position: fixed;
  background: #1a1a2e;
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.trend-up { color: #c62828; }
.trend-down { color: #2e7d32; }
.trend-stable { color: #888; }
.tab-content { display: none; }
.tab-content.active { display: block; }
@media (max-width: 600px) {
  .header { flex-direction: column; align-items: stretch; }
  .header-right { flex-direction: row; flex-wrap: wrap; }
  .header-right select { flex: 1; min-width: 0; }
  .chart-wrapper { height: 320px; }
  table { font-size: 0.75rem; }
  thead th, tbody td { padding: 0.4rem 0.5rem; }
  .chart-header { flex-direction: column; align-items: flex-start; }
}
