.monitor-page {
  padding: 80px 2rem 4rem;
  max-width: 900px;
  margin: 0 auto;
}

.monitor-back { margin-bottom: 1.5rem; }

.back-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text); }

/* ─── Header ─── */
.monitor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  gap: 1rem;
}

.monitor-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.btn-danger {
  background: transparent;
  border: 1px solid rgba(224,92,58,0.4);
  border-radius: 4px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-danger:hover {
  background: rgba(224,92,58,0.1);
  border-color: var(--accent);
}

.btn-small {
  font-size: 11px;
  padding: 3px 10px;
}

/* button_to wraps in a form — reset it */
.monitor-header-actions form { display: inline; margin: 0; }

.monitor-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.monitor-title h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--mono);
}

.monitor-schedule {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2rem;
}

/* ─── Stats row ─── */
.monitor-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

/* ─── Chart ─── */
.chart-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.chart-title {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ─── Range toggle ─── */
.range-toggle {
  display: flex;
  gap: 2px;
}

.range-btn {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 2px 0;
  min-width: 36px;
  text-align: center;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  line-height: 1.6;
}

.range-btn:hover {
  color: var(--text);
  border-color: var(--border2);
}

.range-btn--active {
  color: var(--text);
  border-color: var(--border2);
  background: var(--bg3);
}

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

.chart-empty {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

/* ─── Notification log ─── */

.alert-log {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.alert-log thead th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  font-weight: 400;
  text-align: left;
  padding: 0 1rem 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.alert-log tbody td {
  padding: 0.55rem 1rem 0.55rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.alert-log-time {
  color: var(--muted);
  white-space: nowrap;
}

.alert-log-kind {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.alert-log-kind--late     { background: var(--yellow-dim); color: var(--yellow); }
.alert-log-kind--failing  { background: var(--red-dim);    color: var(--red);    }
.alert-log-kind--resolved { background: var(--green-dim);  color: var(--green);  }

.alert-log-recipient {
  color: var(--text);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-log-status {
  font-size: 11px;
  white-space: nowrap;
}
.alert-log-status--sent    { color: var(--green);  }
.alert-log-status--failed  { color: var(--accent); }
.alert-log-status--pending { color: var(--muted);  }

.alert-log-detail {
  color: var(--muted);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-card--below { margin-top: 1.5rem; }

/* ─── Ping history ─── */

.history-meta {
  font-size: 12px;
  color: var(--muted);
}

.alert-log-duration {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.history-pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem 0.25rem;
}

.history-page-info {
  font-size: 12px;
  color: var(--muted);
}

.history-retention-note {
  font-size: 12px;
  color: var(--muted);
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .monitor-stats { grid-template-columns: repeat(2, 1fr); }
  .monitor-header { flex-direction: column; align-items: flex-start; }
}
