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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
}

.container { max-width: 960px; margin: 0 auto; padding: 2rem 1rem; }
.container.narrow { max-width: 420px; padding-top: 5rem; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
h1 { font-size: 1.8rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 1rem; }

.header-actions { display: flex; gap: 1rem; align-items: center; font-size: .875rem; }
.header-actions a { color: #6b7280; text-decoration: none; }
.header-actions a:hover { color: #1a1a2e; }
.logout { color: #6b7280 !important; }

.card {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  margin-bottom: 1.5rem;
}

/* Login */
.card label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .4rem; }
.card input[type="password"],
.card input[type="text"] {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: 1rem;
  outline: none;
}
.card input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }

button[type="submit"] {
  display: inline-block;
  padding: .55rem 1.25rem;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
button[type="submit"]:hover { background: #4f46e5; }

/* Status grid */
.status-grid { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.5rem; }

.status-card {
  background: #fff;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid #d1d5db;
}
.status-card.status-up   { border-left-color: #22c55e; }
.status-card.status-down { border-left-color: #ef4444; }
.status-card.status-unknown { border-left-color: #d1d5db; }

.status-name { font-weight: 600; font-size: 1rem; }
.status-ip   { font-size: .8rem; color: #6b7280; margin-top: .15rem; font-family: monospace; }

.status-right { display: flex; align-items: center; gap: .75rem; }

.badge {
  padding: .25rem .7rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .05em;
}
.badge-up      { background: #dcfce7; color: #15803d; }
.badge-down    { background: #fee2e2; color: #b91c1c; }
.badge-unknown { background: #f3f4f6; color: #6b7280; }

.ping-form { margin: 0; }
.btn-ping {
  padding: .35rem .85rem;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  color: #374151;
  transition: background .15s;
}
.btn-ping:hover { background: #e5e7eb; }

/* Log */
.log-card .log-header { display: flex; justify-content: space-between; align-items: baseline; }
.log-note { font-size: .75rem; color: #9ca3af; font-weight: 400; margin-left: .5rem; }
.log-text {
  white-space: pre-wrap;
  word-break: break-all;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .78rem;
  line-height: 1.55;
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: .75rem 1rem;
  max-height: 350px;
  overflow-y: auto;
}

/* Settings table */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; padding: .5rem .75rem; border-bottom: 2px solid #e5e7eb; font-weight: 600; }
td { padding: .5rem .75rem; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
tr:last-child td { border-bottom: none; }

.btn-remove {
  padding: .3rem .7rem;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-remove:hover { background: #fecaca; }

.btn-edit {
  display: inline-block;
  padding: .3rem .7rem;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s;
}
.btn-edit:hover { background: #dbeafe; text-decoration: none; }

.btn-save {
  padding: .3rem .7rem;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-save:hover { background: #bbf7d0; }

.btn-cancel {
  display: inline-block;
  padding: .3rem .7rem;
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s;
}
.btn-cancel:hover { background: #e5e7eb; text-decoration: none; }

.action-cell { white-space: nowrap; display: flex; gap: .4rem; align-items: center; }
.edit-row td input[type="text"] {
  width: 100%;
  padding: .35rem .6rem;
  border: 1px solid #6366f1;
  border-radius: 6px;
  font-size: .9rem;
  outline: none;
  margin-bottom: 0;
}

/* Add form */
.add-form .form-row { display: flex; gap: 1rem; margin-bottom: .75rem; }
.add-form .form-group { flex: 1; }
.add-form label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .4rem; }
.add-form input {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: .95rem;
  outline: none;
  margin-bottom: 0;
}
.add-form input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }

/* Flash */
.flash {
  background: #fef3cd;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  font-size: .9rem;
}

.empty { color: #6b7280; font-size: .9rem; }
a { color: #6366f1; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Webhook & API section */
.section-divider { border: none; border-top: 1px solid #e5e7eb; margin: 1.25rem 0; }
h3 { font-size: 1rem; font-weight: 600; margin-bottom: .5rem; }
.help-text { font-size: .8rem; color: #6b7280; margin-bottom: .75rem; line-height: 1.6; }
.help-text code { background: #f3f4f6; padding: .1rem .35rem; border-radius: 4px; font-size: .78rem; }
.api-key-row { display: flex; gap: .5rem; align-items: center; }
.api-key-row input[type="text"] {
  flex: 1;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .8rem;
  padding: .4rem .65rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f9fafb;
  color: #374151;
  margin-bottom: 0;
}
