/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --subtle: #94a3b8;
  --purple: #6366f1;
  --purple-dark: #4f46e5;
  --purple-light: #ede9fe;
  --green: #22c55e;
  --green-light: #dcfce7;
  --yellow: #eab308;
  --yellow-light: #fef9c3;
  --red: #ef4444;
  --blue: #3b82f6;
  --blue-light: #dbeafe;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Nav ── */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-logo {
  font-size: 22px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--purple), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
  margin-right: 16px;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 8px 16px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  font-weight: 500;
  transition: .15s;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--purple-light); color: var(--purple); }
.btn-mtx {
  background: linear-gradient(135deg, var(--purple), #8b5cf6);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
  flex-shrink: 0;
}
.btn-mtx:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(99,102,241,.45); }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--purple) 0%, #7c3aed 55%, #a78bfa 100%);
  padding: 44px 32px;
  color: #fff;
}
.hero-inner { max-width: 1200px; margin: 0 auto; }
.hero h2 { font-size: 30px; font-weight: 800; margin-bottom: 6px; }
.hero p { font-size: 15px; opacity: .85; margin-bottom: 28px; }
.hero-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.hero-stat {
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px;
  padding: 16px 28px;
  text-align: center;
  min-width: 120px;
}
.hs-val { font-size: 28px; font-weight: 800; line-height: 1; }
.hs-lbl { font-size: 12px; opacity: .75; margin-top: 4px; font-weight: 500; }

/* ── Content ── */
.content {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  padding: 28px 32px;
  max-width: 1200px;
  margin: 0 auto;
  align-items: start;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  margin-bottom: 20px;
}
.card:last-child { margin-bottom: 0; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.icon-green { background: var(--green-light); }
.icon-blue  { background: var(--blue-light); }
.icon-purple{ background: var(--purple-light); }

/* ── Primary button ── */
.btn-primary {
  background: linear-gradient(135deg, var(--purple), #8b5cf6);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(99,102,241,.45); }
.btn-primary.danger { background: linear-gradient(135deg,#ef4444,#dc2626); box-shadow: 0 2px 8px rgba(239,68,68,.3); }

/* ── Status list ── */
.status-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.si-left { display: flex; align-items: center; gap: 12px; }
.si-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--subtle);
  flex-shrink: 0;
  transition: background .4s;
}
.si-dot.green  { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.si-dot.yellow { background: var(--yellow); box-shadow: 0 0 0 3px rgba(234,179,8,.15); }
.si-dot.red    { background: var(--red); }
.si-name { font-size: 13px; font-weight: 600; color: var(--text); }
.si-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }

.badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: var(--green-light); color: #16a34a; }
.badge-yellow { background: var(--yellow-light); color: #a16207; }
.badge-red    { background: #fee2e2; color: #dc2626; }
.badge-muted  { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }

/* ── Read-only badge ── */
.read-only-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--subtle);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
}

/* ── Quick actions ── */
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qa-btn {
  padding: 16px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: .2s;
  font-family: inherit;
}
.qa-btn:hover {
  border-color: var(--purple);
  background: #fafafe;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99,102,241,.12);
}
.qa-icon { font-size: 24px; margin-bottom: 6px; }
.qa-name { font-size: 13px; font-weight: 700; color: var(--text); }
.qa-desc { font-size: 11px; color: var(--subtle); margin-top: 2px; }

/* ── Log list (sidebar) ── */
.log-filter-row { display: flex; gap: 5px; }
.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.filter-btn:hover { border-color: #aaa; color: var(--text); }
.filter-btn.active { background: var(--purple-light); border-color: var(--purple); color: var(--purple); }
.filter-btn.warn.active  { background: var(--yellow-light); border-color: var(--yellow); color: #a16207; }
.filter-btn.error.active { background: #fee2e2; border-color: var(--red); color: var(--red); }

.log-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.log-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.log-item-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.log-item-title { font-size: 12px; font-weight: 600; color: var(--text); }
.log-item-meta  { font-size: 11px; color: var(--subtle); margin-top: 2px; }
.log-empty { padding: 20px; text-align: center; font-size: 13px; color: var(--muted); }

.see-all-btn {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--purple);
  padding: 10px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.see-all-btn:hover { background: var(--purple-light); border-color: var(--purple); }

/* ── Updated chip ── */
.updated-chip {
  text-align: center;
  font-size: 12px;
  color: var(--subtle);
  padding: 8px;
}

/* ── Offline banner ── */
.offline-banner {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #c2410c;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

/* ── Log overlay ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.overlay.open { display: flex; }
.overlay-panel {
  background: var(--surface);
  border-radius: 18px;
  width: 100%;
  max-width: 760px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow: hidden;
}
.overlay-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.overlay-title { font-size: 16px; font-weight: 700; color: var(--text); }
.close-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: grid; place-items: center;
  transition: .15s;
}
.close-btn:hover { background: #fee2e2; border-color: var(--red); color: var(--red); }
.overlay-logs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Auth overlay ── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--purple) 0%, #7c3aed 55%, #a78bfa 100%);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.auth-overlay.open { display: flex; }
.auth-panel {
  background: var(--surface);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
}
.auth-logo {
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--purple), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
  margin-bottom: 4px;
}
.auth-sub  { font-size: 13px; color: var(--muted); margin-bottom: 28px; }
.auth-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: .15s;
  margin-bottom: 12px;
  text-align: center;
  letter-spacing: 2px;
}
.auth-input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.auth-err  { font-size: 12px; color: var(--red); margin-top: 10px; display: none; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .content { grid-template-columns: 1fr; }
  .hero-stats { gap: 10px; }
  .nav { padding: 0 16px; }
  .hero { padding: 28px 16px; }
  .content { padding: 20px 16px; }
}
