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

:root {
  --green: #16a34a;
  --green-bg: #dcfce7;
  --orange: #ea580c;
  --orange-bg: #fff7ed;
  --yellow: #ca8a04;
  --yellow-bg: #fefce8;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ---- Typography ---- */

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  margin-bottom: 2px;
}

.subtitle {
  color: var(--gray-500);
  font-size: 0.925rem;
  max-width: 56ch;
  margin-top: 4px;
}

.muted {
  color: var(--gray-400);
  font-size: 0.825rem;
}

/* ---- Header ---- */

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

.dashboard-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

/* ---- Overall panel ---- */

.overall-panel {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 200px;
  text-align: center;
}

.panel-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  margin-bottom: 6px;
}

.overall-status {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 4px;
  display: inline-block;
}

/* ---- Notification banner ---- */

.notification-banner {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 16px;
}

.notification-banner[hidden] {
  display: none;
}

.notification-banner.notification-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.notification-banner.notification-error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #fecaca;
}

/* ---- Signal grid ---- */

.signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* ---- Signal card ---- */

.signal-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

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

.card-heading h2 {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--gray-700);
}

/* ---- Status pills ---- */

.status-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 9999px;
  text-transform: uppercase;
}

.status-green {
  background: var(--green-bg);
  color: var(--green);
}

.status-orange {
  background: var(--orange-bg);
  color: var(--orange);
}

.status-yellow {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.status-red {
  background: var(--red-bg);
  color: var(--red);
}

.status-warning {
  background: var(--yellow-bg);
  color: var(--yellow);
}

/* ---- Metric display ---- */

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 2px;
}

.metric-meta {
  font-size: 0.825rem;
  color: var(--gray-500);
}

/* ---- Detail panel ---- */

.detail-panel {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.section-heading h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-900);
}

/* ---- Usage details (DL grid) ---- */

.usage-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.usage-details div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.usage-details dt {
  font-size: 0.725rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-400);
}

.usage-details dd {
  font-size: 0.925rem;
  color: var(--gray-800);
}

/* ---- Table ---- */

.table-wrap {
  overflow-x: auto;
  margin-bottom: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  border-bottom: 2px solid var(--gray-200);
}

th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.empty-state {
  text-align: center;
  color: var(--gray-400);
  padding: 24px 12px !important;
  font-style: italic;
}

/* ---- Pagination ---- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.pagination button {
  padding: 6px 16px;
  font-size: 0.825rem;
  font-weight: 500;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: #fff;
  color: var(--gray-700);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.pagination button:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- History dots ---- */

.history-dots-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 10px;
  background: #f3f4f6;
  border-radius: 6px;
  margin: 8px 0;
}

.history-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.dot-green {
  background: #22c55e;
}

.dot-orange {
  background: #f97316;
}

.dot-yellow {
  background: #eab308;
}

.dot-red {
  background: #ef4444;
}

.history-dots-label {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
}

.history-dots-empty {
  font-size: 0.8rem;
  color: var(--gray-400);
  font-style: italic;
  margin: 8px 0 2px;
}

/* ---- Responsive ---- */

@media (max-width: 640px) {
  .page-shell {
    padding: 16px 12px 32px;
  }

  .dashboard-header {
    flex-direction: column;
  }

  .overall-panel {
    width: 100%;
  }

  .usage-details {
    grid-template-columns: 1fr 1fr;
  }

  .signal-grid {
    grid-template-columns: 1fr;
  }
}
