:root {
  --bg: #080F0F;
  --bg-card: #101B1B;
  --teal: #0D9488;
  --teal-bright: #14B8A6;
  --amber: #F59E0B;
  --text: #E8F4F4;
  --text-dim: #8FA8A8;
  --red: #EF4444;
  --green: #22C55E;
  --border: rgba(232, 244, 244, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Lora', serif;
  padding: 24px;
}

h1, h2 {
  font-family: 'Syne', sans-serif;
  margin: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar h1 { font-size: 1.8rem; font-weight: 800; }

.topbar-actions { display: flex; align-items: center; gap: 16px; }

.last-updated { font-size: 0.85rem; color: var(--text-dim); }

.btn-refresh {
  background: var(--teal);
  color: var(--bg);
  border: none;
  padding: 10px 18px;
  border-radius: 12px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-refresh:hover:not(:disabled) { background: var(--teal-bright); }
.btn-refresh:active:not(:disabled) { transform: scale(0.97); }
.btn-refresh:disabled { opacity: 0.5; cursor: wait; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
}

.stat-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.stat-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(232, 244, 244, 0.08);
  overflow: hidden;
  margin-bottom: 10px;
}

.stat-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.stat-sub { font-size: 0.85rem; color: var(--text-dim); }

.site-section { margin-bottom: 36px; }
.site-section h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 16px; }

.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.site-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}

.site-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.site-name { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1.02rem; }

.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot-red { background: var(--red); box-shadow: 0 0 8px var(--red); }

.site-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.site-meta b { color: var(--text); font-weight: 500; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(13, 148, 136, 0.18);
  color: var(--teal-bright);
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  margin-left: 6px;
}

.cert-warn { color: var(--amber) !important; }
.cert-danger { color: var(--red) !important; }

.app-hidden { display: none !important; }

.login-screen {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}

.login-card h1 { font-size: 1.5rem; font-weight: 800; }
.login-sub { margin: 0; font-size: 0.9rem; color: var(--text-dim); }

.login-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
  font-family: 'Lora', serif;
  font-size: 0.95rem;
}
.login-input:focus { outline: 1px solid var(--teal); }

.login-submit { width: 100%; }

.login-error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--red);
  min-height: 1.1em;
}

.btn-logout {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 12px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-logout:hover { color: var(--text); border-color: var(--text-dim); }

@media (max-width: 480px) {
  body { padding: 16px; }
  .topbar h1 { font-size: 1.4rem; }
}
