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

:root {
  --bg:         #07090f;
  --bg-2:       #0c0e18;
  --bg-3:       #111420;
  --card:       #10131e;
  --border:     rgba(255,255,255,0.07);
  --border-hi:  rgba(255,255,255,0.15);
  --text:       #e8eef8;
  --text-2:     #7a8aaa;
  --text-3:     #3a4560;
  --green:      #10b981;
  --green-bg:   rgba(16,185,129,0.1);
  --green-bd:   rgba(16,185,129,0.25);
  --yellow:     #f59e0b;
  --yellow-bg:  rgba(245,158,11,0.1);
  --yellow-bd:  rgba(245,158,11,0.25);
  --red:        #ef4444;
  --red-bg:     rgba(239,68,68,0.1);
  --red-bd:     rgba(239,68,68,0.25);
  --blue:       #3b82f6;
  --blue-bg:    rgba(59,130,246,0.1);
  --blue-bd:    rgba(59,130,246,0.25);
  --radius:     10px;
  --font:       'Inter', system-ui, sans-serif;
  --mono:       'JetBrains Mono', monospace;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
a    { color: inherit; text-decoration: none; }
p    { color: var(--text-2); }

.container { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* ─── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  border-bottom: 1px solid var(--border);
  background: rgba(7,9,15,0.9); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 50;
}
.navbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.nav-logo { font-weight: 800; font-size: 1rem; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-links a { font-size: 0.85rem; color: var(--text-2); transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }

/* ─── Overall banner ─────────────────────────────────────────────────────── */
.overall-banner {
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.overall-inner { display: flex; align-items: center; gap: 16px; }
.overall-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.overall-dot.online   { background: var(--green);  box-shadow: 0 0 10px var(--green); }
.overall-dot.degraded { background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }
.overall-dot.offline  { background: var(--red);    box-shadow: 0 0 10px var(--red); }
.overall-dot.checking { background: var(--text-3); }
.overall-title { font-size: 1.4rem; font-weight: 800; }
.overall-sub   { font-size: 0.85rem; color: var(--text-2); margin-top: 2px; }
.last-checked  { margin-left: auto; font-size: 0.78rem; color: var(--text-3); text-align: right; }

/* ─── Incident banner ────────────────────────────────────────────────────── */
.incident-banner {
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 24px;
  border-left: 3px solid var(--yellow); background: var(--yellow-bg);
  display: none;
}
.incident-banner.active { display: block; }
.incident-banner .title { font-size: 0.9rem; font-weight: 700; color: var(--yellow); margin-bottom: 4px; }
.incident-banner .body  { font-size: 0.85rem; color: var(--text-2); }
.incident-banner .time  { font-size: 0.75rem; color: var(--text-3); margin-top: 6px; }

/* ─── Service group ──────────────────────────────────────────────────────── */
.group-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; color: var(--text-3); margin-bottom: 10px; }
.services-group { margin-bottom: 32px; }

/* ─── Service row ────────────────────────────────────────────────────────── */
.service-row {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 8px;
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 16px;
  transition: border-color 0.2s;
}
.service-row:hover { border-color: var(--border-hi); }

.service-icon { font-size: 1.2rem; width: 28px; text-align: center; }
.service-info { min-width: 0; }
.service-name { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.service-url  { font-family: var(--mono); font-size: 0.72rem; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Uptime bar (last 60 checks as ticks) */
.uptime-bar { display: flex; gap: 2px; align-items: center; }
.uptime-tick { width: 6px; height: 20px; border-radius: 2px; background: var(--text-3); flex-shrink: 0; transition: background 0.3s; }
.uptime-tick.online   { background: var(--green); }
.uptime-tick.offline  { background: var(--red); }
.uptime-tick.degraded { background: var(--yellow); }
.uptime-tick.empty    { background: rgba(255,255,255,0.05); }
.uptime-pct { font-size: 0.78rem; color: var(--text-3); margin-left: 10px; white-space: nowrap; min-width: 46px; text-align: right; }

/* Status badge */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap;
}
.status-badge .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-badge.online   { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-bd); }
.status-badge.online .dot   { background: var(--green);  box-shadow: 0 0 6px var(--green); animation: pulse 2s infinite; }
.status-badge.offline  { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-bd); }
.status-badge.offline .dot  { background: var(--red); }
.status-badge.degraded { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-bd); }
.status-badge.degraded .dot { background: var(--yellow); }
.status-badge.checking { background: rgba(255,255,255,0.04); color: var(--text-3); border: 1px solid var(--border); }
.status-badge.checking .dot { background: var(--text-3); }

.response-time { font-size: 0.72rem; color: var(--text-3); margin-top: 2px; text-align: right; font-family: var(--mono); }

/* ─── Incident history ───────────────────────────────────────────────────── */
.history-section { margin-top: 8px; padding-top: 32px; border-top: 1px solid var(--border); margin-bottom: 48px; }
.history-section h2 { font-size: 1rem; font-weight: 700; margin-bottom: 20px; }
.history-empty { color: var(--text-3); font-size: 0.88rem; padding: 24px 0; }
.incident-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.incident-item:last-child { border-bottom: none; }
.incident-item .i-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 4px; }
.incident-item .i-body  { font-size: 0.85rem; color: var(--text-2); }
.incident-item .i-meta  { font-size: 0.75rem; color: var(--text-3); margin-top: 6px; display: flex; gap: 12px; }
.incident-item .i-status { padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.i-status.investigating { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-bd); }
.i-status.monitoring    { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-bd); }
.i-status.resolved      { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-bd); }
.i-status.maintenance   { background: var(--blue-bg);   color: var(--blue);   border: 1px solid var(--blue-bd); }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
footer { border-top: 1px solid var(--border); padding: 24px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 0.8rem; color: var(--text-3); }

/* ─── Admin ──────────────────────────────────────────────────────────────── */
.admin-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card  { width: 100%; max-width: 380px; padding: 36px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; }
.login-card h2 { margin-bottom: 6px; }
.login-card > p { margin-bottom: 24px; font-size: 0.88rem; }
.login-error { color: var(--red); font-size: 0.84rem; margin-bottom: 10px; display: none; }

.admin-wrap { max-width: 760px; margin: 0 auto; padding: 40px 20px; }
.admin-wrap h1 { font-size: 1.4rem; margin-bottom: 4px; }
.admin-wrap > p { margin-bottom: 32px; font-size: 0.88rem; }

.form-group  { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.form-label  { font-size: 0.83rem; font-weight: 600; color: var(--text-2); }
.form-input  { width: 100%; padding: 10px 13px; border-radius: 8px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--text); font-family: var(--font); font-size: 0.88rem; transition: border-color 0.2s; }
.form-input:focus  { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
.form-input::placeholder { color: var(--text-3); }
.form-select { width: 100%; padding: 10px 13px; border-radius: 8px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--text); font-family: var(--font); font-size: 0.88rem; cursor: pointer; }
.form-select:focus { outline: none; border-color: var(--blue); }
.form-select option { background: var(--card); }
.form-textarea { resize: vertical; min-height: 80px; }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 20px; border-radius: 8px; font-weight: 600; font-size: 0.88rem; cursor: pointer; border: none; transition: all 0.2s; font-family: var(--font); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-ghost   { background: rgba(255,255,255,0.05); color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,0.09); color: var(--text); }
.btn-danger  { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-bd); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

.admin-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.admin-card h3 { font-size: 1rem; margin-bottom: 16px; }

.incident-admin-item { padding: 14px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 10px; display: flex; align-items: flex-start; gap: 12px; }
.incident-admin-item .text { flex: 1; min-width: 0; }
.incident-admin-item .title { font-size: 0.88rem; font-weight: 600; margin-bottom: 2px; }
.incident-admin-item .meta  { font-size: 0.75rem; color: var(--text-3); }
.empty-note { color: var(--text-3); font-size: 0.85rem; padding: 12px 0; }

.toast { position: fixed; bottom: 20px; right: 20px; z-index: 999; padding: 11px 18px; border-radius: 8px; font-size: 0.85rem; font-weight: 500; background: var(--card); border: 1px solid var(--border); color: var(--text); transform: translateY(80px); opacity: 0; transition: all 0.3s; }
.toast.show    { transform: translateY(0); opacity: 1; }
.toast.success { border-color: var(--green-bd); }
.toast.error   { border-color: var(--red-bd); }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
@keyframes spin   { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 10px; height: 10px; border: 2px solid var(--text-3); border-top-color: var(--text); border-radius: 50%; animation: spin 0.7s linear infinite; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::selection { background: rgba(59,130,246,0.3); }

@media (max-width: 640px) {
  .service-row { grid-template-columns: auto 1fr auto; }
  .uptime-bar  { display: none; }
  .uptime-pct  { display: none; }
  .overall-inner { flex-wrap: wrap; }
  .last-checked { margin-left: 0; }
}
