:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e7e9ec;
  --border-strong: #dcdfe3;
  --text: #1f2430;
  --text-muted: #667085;
  --text-faint: #98a1ac;
  --up: #22c55e;
  --up-text: #15803d;
  --up-ring: rgba(34, 197, 94, 0.16);
  --down: #ef4444;
  --down-text: #b91c1c;
  --down-ring: rgba(239, 68, 68, 0.16);
  --unknown: #b4bac2;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.05);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 940px;
  margin: 0 auto;
  padding: 34px 20px 56px;
}

/* Header */
.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #2b3039;
  flex: none;
  box-shadow: var(--shadow);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 4px var(--up-ring);
}

h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
}

.summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  gap: 7px;
  padding: 5px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  color: var(--text-muted);
  font-size: 12.5px;
}

.chip b {
  color: var(--text);
  font-weight: 600;
}

.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-up {
  background: var(--up);
}
.dot-down {
  background: var(--down);
}
.dot-unknown {
  background: var(--unknown);
}

.updated {
  color: var(--text-faint);
  font-size: 12px;
}

/* Card + table */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

table.monitors {
  width: 100%;
  border-collapse: collapse;
}

.monitors thead th {
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  white-space: nowrap;
}

.monitors th.num,
.monitors td.num {
  text-align: right;
}

.monitors tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.monitors tbody tr:last-child td {
  border-bottom: none;
}

.monitors tbody tr {
  transition: background 0.12s ease;
}

.monitors tbody tr:hover {
  background: var(--surface-2);
}

/* Status pill */
.status {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  gap: 9px;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.status .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: none;
  background: var(--unknown);
}

.status-up {
  color: var(--up-text);
}
.status-up .dot {
  background: var(--up);
  box-shadow: 0 0 0 4px var(--up-ring);
}

.status-down {
  color: var(--down-text);
}
.status-down .dot {
  background: var(--down);
  box-shadow: 0 0 0 4px var(--down-ring);
  animation: pulse 1.9s ease-in-out infinite;
}

.status-unknown {
  color: var(--text-muted);
}
.status-unknown .dot {
  background: var(--unknown);
  box-shadow: 0 0 0 4px rgba(180, 186, 194, 0.16);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 var(--down-ring);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.07);
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-down .dot {
    animation: none;
  }
}

.name {
  font-weight: 500;
  color: var(--text);
}

.url a {
  color: var(--text-muted);
  text-decoration: none;
}
.url a:hover {
  color: var(--text);
  text-decoration: underline;
}

.num {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Banner + empty state */
.banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff8e6;
  border: 1px solid #f3e2a6;
  color: #7a5b00;
  font-size: 13px;
}

.banner[hidden] {
  display: none;
}

.empty {
  padding: 44px 16px;
  text-align: center;
  color: var(--text-faint);
}

/* Screen-reader-only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Per-row history link (icon) */
.actions-col,
.actions {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

.history-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--text-faint);
  transition: color 0.12s ease, background 0.12s ease;
}

.history-link:hover {
  color: var(--text);
  background: var(--bg);
}

/* Back button on the history page */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.back-link:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* History page: error/detail column */
.detail {
  color: var(--text-muted);
  font-size: 12.5px;
}
