:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --blue: #2563eb;
  --dark: #0f172a;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }

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

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.sidebar {
  background: #0b1220;
  color: white;
  padding: 24px;
}

.brand {
  font-size: 22px;
  font-weight: 850;
  margin-bottom: 28px;
}

.nav {
  display: block;
  color: #cbd5e1;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 700;
}

.nav.active, .nav:hover {
  background: rgba(255,255,255,.1);
  color: white;
}

.main {
  padding: 28px;
}

.hero {
  background: linear-gradient(135deg, #0f172a, #2563eb);
  color: white;
  border-radius: 28px;
  padding: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 22px 60px rgba(15,23,42,.18);
  margin-bottom: 22px;
}

.hero h1 {
  margin: 0;
  font-size: 32px;
}

.hero p {
  margin: 8px 0 0;
  color: #dbeafe;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 18px;
}

.card, .site-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(15,23,42,.06);
}

.site-card {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: .16s ease;
}

.site-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 45px rgba(15,23,42,.10);
}

.site-title {
  font-size: 19px;
  font-weight: 850;
  margin-bottom: 6px;
}

.muted {
  color: var(--muted);
}

.row, .status-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 800;
}

.badge.ok {
  background: #dcfce7;
  color: #166534;
}

.badge.warn {
  background: #fef3c7;
  color: #92400e;
}

.badge.bad {
  background: #fee2e2;
  color: #991b1b;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 20px;
}

.tab {
  text-decoration: none;
  padding: 11px 16px;
  border-radius: 14px;
  background: white;
  color: #475569;
  font-weight: 850;
  border: 1px solid var(--border);
}

.tab.active {
  color: white;
  background: var(--blue);
  border-color: var(--blue);
}

.button {
  display: inline-block;
  text-decoration: none;
  background: var(--blue);
  color: white;
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 850;
}

.button.ghost {
  background: rgba(255,255,255,.14);
}

.wide {
  grid-column: span 2;
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid { grid-template-columns: 1fr; }
  .wide { grid-column: span 1; }
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, #dbeafe, #f8fafc 45%, #eef2ff);
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  background: white;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 30px;
  box-shadow: 0 26px 80px rgba(15,23,42,.16);
}

.brand.dark {
  color: #0f172a;
  margin-bottom: 12px;
}

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

.login-card form {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}

.login-card label {
  font-weight: 800;
  color: #334155;
}

.login-card input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 16px;
}

.login-card button {
  margin-top: 8px;
  border: none;
  background: var(--blue);
  color: white;
  border-radius: 16px;
  padding: 13px 14px;
  font-weight: 900;
  cursor: pointer;
}

.login-error {
  margin-top: 16px;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 800;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}

.admin-actions form {
  margin: 0;
}

button.button {
  border: 0;
  cursor: pointer;
}

.button.blue { background: #2563eb; }
.button.dark { background: #0f172a; }
.button.cyan { background: #0891b2; }
.button.orange { background: #ea580c; }

.action-result {
  border-radius: 18px;
  padding: 14px 16px;
  margin: 0 0 18px;
  border: 1px solid var(--border);
}

.action-result.ok {
  background: #ecfdf5;
  color: #14532d;
  border-color: #86efac;
}

.action-result.bad {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.action-result pre {
  white-space: pre-wrap;
  background: rgba(255,255,255,.7);
  border: 1px solid rgba(0,0,0,.08);
  padding: 10px;
  border-radius: 12px;
  overflow-x: auto;
}

button.tab {
  cursor: pointer;
  font: inherit;
}

#tab-content {
  animation: diamondFade .16s ease;
}

@keyframes diamondFade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.htmx-request #tab-content,
#tab-content.htmx-request {
  opacity: .55;
}

.logbox {
  margin: 0;
  white-space: pre-wrap;
  overflow-x: auto;
  background: #0f172a;
  color: #dbeafe;
  border-radius: 18px;
  padding: 16px;
  line-height: 1.55;
  font-size: 13px;
  max-height: 560px;
}

.alert {
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 12px;
  font-weight: 800;
}

.alert.bad {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
