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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e2e8f0;
  --muted: #8892a4;
  --accent: #4f8ef7;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

header h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text);
}

main { padding: 24px; }

/* Table */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}

thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.03); }

td {
  padding: 12px 16px;
  vertical-align: middle;
}

td.name { font-weight: 500; }
td.desc { color: var(--muted); max-width: 260px; }

/* URL cell */
.url-cell { display: flex; align-items: center; gap: 6px; }
.url-cell a { color: var(--accent); text-decoration: none; }
.url-cell a:hover { text-decoration: underline; }

/* Health dot */
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.dot-green { background: var(--green); box-shadow: 0 0 4px var(--green); }
.dot-red   { background: var(--red);   box-shadow: 0 0 4px var(--red); }
.dot-yellow{ background: var(--yellow); }
.dot-grey  { background: var(--border); }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(234, 179, 8, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(234, 179, 8, 0.3);
}

/* Buttons */
button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}

button:hover { background: rgba(255,255,255,0.06); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #3a7fe8; border-color: #3a7fe8; }

.btn-danger { color: var(--red); border-color: rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.1); }

.btn-icon { padding: 6px 8px; }

/* Actions cell */
.actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }

/* Modal */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 15px; font-weight: 600; }

.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* Form */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 500; color: var(--muted); }

input[type=text], input[type=number], input[type=url], select, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  width: 100%;
  font-family: var(--font);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

select option { background: var(--bg); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* Log panel */
.log-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 300px;
  background: #0a0c12;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 90;
}

.log-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.log-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #a8b3c4;
}

.log-body .line { white-space: pre-wrap; word-break: break-all; }
.log-body .line.err { color: var(--red); }

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.status-running { background: rgba(79,142,247,0.15); color: var(--accent); }
.status-success { background: rgba(34,197,94,0.15); color: var(--green); }
.status-failed  { background: rgba(239,68,68,0.15); color: var(--red); }

/* Webhook box */
.webhook-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.webhook-box code {
  flex: 1;
  font-family: monospace;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty h3 { font-size: 15px; margin-bottom: 8px; color: var(--text); }

[x-cloak] { display: none !important; }
