:root {
  --bg: #0f1115;
  --panel: #171a21;
  --border: #272b35;
  --text: #e6e8ec;
  --muted: #8b93a3;
  --ok: #2ecc71;
  --failing: #f1c40f;
  --down: #e74c3c;
  --accent: #5b8def;
}

* { box-sizing: border-box; }

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

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

header h1 {
  font-size: 18px;
  margin: 0;
}

header .overall {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

#logoutBtn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

main {
  padding: 16px;
  max-width: 900px;
  margin: 0 auto;
}

.category {
  margin-bottom: 24px;
}

.category h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 8px 4px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  border-left: 4px solid var(--muted);
}

.tile.OK { border-left-color: var(--ok); }
.tile.FAILING { border-left-color: var(--failing); }
.tile.DOWN { border-left-color: var(--down); }
.tile.UNKNOWN { border-left-color: var(--muted); }

.tile .label {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.tile .detail {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile .meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.dot.OK { background: var(--ok); }
.dot.FAILING { background: var(--failing); }
.dot.DOWN { background: var(--down); }
.dot.UNKNOWN { background: var(--muted); }

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 360px;
}

.login-card h1 {
  font-size: 18px;
  margin: 0 0 20px;
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}

.login-card button {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}

.login-card .error {
  color: var(--down);
  font-size: 13px;
  margin-top: 8px;
  min-height: 16px;
}

.password-wrap {
  position: relative;
  margin-bottom: 10px;
}

.password-wrap input {
  margin-bottom: 0;
  padding-right: 54px;
}

.password-wrap button {
  position: absolute;
  width: auto;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
}

.login-card .toggle {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  margin-top: 14px;
  cursor: pointer;
}

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

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h3 { margin-top: 0; font-size: 16px; }

.history-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.modal .close {
  display: block;
  margin: 16px auto 0;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}
