/* LEG Energy Dashboard 1.2 */

.led-dashboard {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: #111827;
  line-height: 1.5;
}

/* ── Filters ──────────────────────────────────────────────────────────────── */

/* Stack vertically on mobile, row on wider screens */
.led-filters {
  display:        flex;
  flex-direction: column;
  gap:            10px;
  margin-bottom:  24px;
}

@media (min-width: 600px) {
  .led-filters {
    flex-direction: row;
    align-items:    center;
  }
}

/* Mode tabs — equal-width grid so all 4 fit on any phone */

.led-mode-tabs {
  display:               grid;
  grid-template-columns: repeat(4, 1fr);
  gap:                   4px;
  background:            #f3f4f6;
  border:                1px solid #e5e7eb;
  border-radius:         10px;
  padding:               4px;
}

.led-mode-tab {
  padding:       10px 4px;
  border:        none;
  border-radius: 7px;
  background:    transparent;
  font-size:     12px;
  font-weight:   600;
  color:         #6b7280;
  cursor:        pointer;
  text-align:    center;
  transition:    background 0.15s, color 0.15s;
  /* 44 px min touch target height */
  min-height:    44px;
  display:       flex;
  align-items:   center;
  justify-content: center;
}

.led-mode-tab:hover { background: #e5e7eb; color: #374151; }

.led-mode-tab--active {
  background: #fff;
  color:      #111827;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Prev / Next nav */

.led-nav {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             8px;
  flex:            1;
}

/* 44 × 44 px touch targets */
.led-nav-btn {
  width:           44px;
  height:          44px;
  border:          1px solid #e5e7eb;
  border-radius:   10px;
  background:      #fff;
  font-size:       22px;
  line-height:     1;
  color:           #374151;
  cursor:          pointer;
  display:         flex;
  align-items:     center;
  justify-content: center;
  flex-shrink:     0;
  transition:      background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.led-nav-btn:hover  { background: #f3f4f6; }
.led-nav-btn:active { background: #e5e7eb; }

.led-nav-label {
  flex:        1;
  text-align:  center;
  font-size:   14px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, monospace;
  color:       #111827;
  white-space: nowrap;
  overflow:    hidden;
  text-overflow: ellipsis;
}

/* ── Table section ────────────────────────────────────────────────────────── */

.led-table-section {
  border:        1px solid #e5e7eb;
  border-radius: 10px;
  overflow:      hidden;
  margin-bottom: 32px;
}

.led-table-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  flex-wrap:       wrap;
  gap:             8px;
  padding:         12px 16px;
  background:      #f3f4f6;
  border-bottom:   1px solid #e5e7eb;
}

.led-table-title {
  font-size:      10px;
  font-weight:    700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color:          #6b7280;
}

.led-table-summary {
  font-size:   11px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  color:       #6b7280;
}

.led-table-summary strong { font-weight: 700; }

.led-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.led-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       12px;
}

.led-table th {
  text-align:     left;
  padding:        8px 12px;
  font-size:      10px;
  font-weight:    700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color:          #9ca3af;
  border-bottom:  1px solid #e5e7eb;
  white-space:    nowrap;
  background:     #f9fafb;
}

.led-table td {
  padding:       8px 12px;
  border-bottom: 1px solid #f3f4f6;
  white-space:   nowrap;
  font-family:   ui-monospace, SFMono-Regular, monospace;
}

@media (max-width: 599px) {
  .led-table th,
  .led-table td { padding: 6px 10px; font-size: 11px; }
}

.led-table tbody tr:last-child td { border-bottom: none; }
.led-table tbody tr:hover td      { background: #f9fafb; }

.led-total-row td {
  background:     #f3f4f6;
  font-weight:    700;
  font-size:      11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color:          #374151;
  border-top:     1px solid #e5e7eb;
}

/* ── LEG section ──────────────────────────────────────────────────────────── */

.led-lec-section   { margin-bottom: 36px; }

.led-lec-title {
  font-size:    14px;
  font-weight:  700;
  font-family:  ui-monospace, SFMono-Regular, monospace;
  color:        #374151;
  margin:       0 0 4px;
}

.led-lec-counts {
  display:      flex;
  align-items:  center;
  gap:          6px;
  font-size:    12px;
  color:        #9ca3af;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.led-counts-sep { color: #d1d5db; }

/* ── Stat cards ───────────────────────────────────────────────────────────── */

.led-stat-cards {
  display:               grid;
  grid-template-columns: repeat(2, 1fr);
  gap:                   12px;
  margin-bottom:         20px;
}

@media (min-width: 540px) { .led-stat-cards { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .led-stat-cards { grid-template-columns: repeat(5, 1fr); } }

.led-stat-card {
  background:    #f9fafb;
  border:        1px solid #e5e7eb;
  border-radius: 10px;
  padding:       12px 14px;
  position:      relative;
  overflow:      hidden;
}

.led-stat-bar {
  position:     absolute;
  top: 0; left: 0; right: 0;
  height:       3px;
  border-radius: 10px 10px 0 0;
}

.led-stat-label {
  font-size:      10px;
  font-weight:    700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color:          #9ca3af;
  margin-bottom:  4px;
}

.led-stat-value {
  font-size:   18px;
  font-weight: 900;
  font-family: ui-monospace, SFMono-Regular, monospace;
  color:       #111827;
  line-height: 1.2;
}

@media (min-width: 600px) { .led-stat-value { font-size: 20px; } }

.led-stat-unit {
  font-size:  11px;
  font-weight: 400;
  color:      #9ca3af;
  margin-left: 2px;
}

/* ── Charts ───────────────────────────────────────────────────────────────── */

.led-charts {
  display:               grid;
  grid-template-columns: 1fr;
  gap:                   16px;
}

@media (min-width: 900px) { .led-charts { grid-template-columns: 1fr 1fr; } }

.led-chart-card {
  background:    #f9fafb;
  border:        1px solid #e5e7eb;
  border-radius: 10px;
  padding:       12px;
}

@media (min-width: 600px) { .led-chart-card { padding: 16px; } }

.led-chart-title {
  font-size:      10px;
  font-weight:    700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color:          #9ca3af;
  margin-bottom:  12px;
}

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

/* ── Colour helpers ───────────────────────────────────────────────────────── */

.led-col-green  { color: #16a34a; }
.led-col-violet { color: #7c3aed; }
.led-col-amber  { color: #d97706; }
.led-col-teal   { color: #0d9488; }
.led-col-purple { color: #9333ea; }
.led-col-muted  { color: #6b7280; }

/* ── States ───────────────────────────────────────────────────────────────── */

.led-loading {
  padding:    24px;
  text-align: center;
  font-size:  13px;
  color:      #9ca3af;
  font-style: italic;
}

.led-no-data {
  background:    #f9fafb;
  border:        1px solid #e5e7eb;
  border-radius: 10px;
  padding:       40px;
  text-align:    center;
  font-size:     13px;
  color:         #9ca3af;
  font-family:   ui-monospace, SFMono-Regular, monospace;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.led-footer {
  margin-top:  24px;
  text-align:  center;
  font-size:   11px;
  color:       #9ca3af;
}

.led-footer a {
  color:           #9ca3af;
  text-decoration: none;
}

.led-footer a:hover {
  color:           #6b7280;
  text-decoration: underline;
}

/* ── Error ────────────────────────────────────────────────────────────────── */

.led-error {
  background:    #fef2f2;
  border:        1px solid #fecaca;
  border-radius: 8px;
  padding:       12px 16px;
  color:         #dc2626;
  font-size:     13px;
}
