:root {
  --color-bg: #f4f6f8;
  --color-card: #ffffff;
  --color-text: #1f2933;
  --color-muted: #6b7280;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-up: #16a34a;
  --color-down: #dc2626;
  --color-slow: #d97706;
  --color-unknown: #6b7280;
  --border-radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

.topbar {
  background: var(--color-primary);
  color: white;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar .brand { color: white; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.topbar nav a, .topbar nav .link-btn {
  color: white;
  text-decoration: none;
  margin-left: 16px;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
}
.topbar nav a:hover, .topbar nav .link-btn:hover { text-decoration: underline; }

.container {
  max-width: 1000px;
  margin: 24px auto;
  padding: 0 16px;
}

.card {
  background: var(--color-card);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

h1 { margin-top: 0; font-size: 1.4rem; }

label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: var(--color-muted);
}

label.checkbox { display: flex; align-items: center; gap: 8px; }
label.checkbox input { width: auto; }

input[type=text], input[type=email], input[type=password], input[type=number], select {
  display: block;
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
}

button {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}
button:hover { background: var(--color-primary-dark); }
button.danger { background: var(--color-down); }
button.danger:hover { background: #b91c1c; }

.error { color: var(--color-down); font-weight: 600; }

.auth-card { max-width: 380px; margin: 60px auto; }

.list-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.tab {
  padding: 6px 14px;
  border-radius: 999px;
  background: white;
  color: var(--color-text);
  text-decoration: none;
  border: 1px solid #d1d5db;
  font-size: 0.9rem;
}
.tab.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }

.inline-form { display: inline-flex; gap: 6px; align-items: center; }

.public-toggle { display: flex; align-items: center; }

table.monitor-table {
  width: 100%;
  border-collapse: collapse;
}
.monitor-table th, .monitor-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
}
.monitor-table .empty { color: var(--color-muted); text-align: center; padding: 30px; }
.error-row td { color: var(--color-down); font-size: 0.8rem; padding-top: 0; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  text-transform: capitalize;
}
.badge-up { background: var(--color-up); }
.badge-down { background: var(--color-down); }
.badge-slow { background: var(--color-slow); }
.badge-unknown { background: var(--color-unknown); }

.status-up { color: var(--color-up); font-weight: 600; }

.actions { display: flex; gap: 6px; }

.domain-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 14px;
}
.muted { color: var(--color-muted); font-size: 0.8rem; }

.footer {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.8rem;
  padding: 20px;
}

/* Responsive */
@media (max-width: 600px) {
  .monitor-table thead { display: none; }
  .monitor-table tr { display: block; margin-bottom: 12px; border-bottom: 2px solid #e5e7eb; }
  .monitor-table td { display: flex; justify-content: space-between; border: none; padding: 4px 0; }
  .monitor-table td::before { content: attr(data-label); font-weight: 600; color: var(--color-muted); }
  .actions { flex-direction: column; }
}