/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0f1a;
  --bg2:       #13162a;
  --card:      #181b30;
  --border:    #252844;
  --accent:    #6c63ff;
  --accent2:   #8b84ff;
  --text:      #e2e8f0;
  --muted:     #7b82a6;
  --green:     #10b981;
  --amber:     #f59e0b;
  --red:       #ef4444;
  --purple:    #a78bfa;
  --radius:    12px;
  --radius-sm: 8px;
  font-size: 15px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── Auth page ── */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 60% 20%, #1a1540 0%, var(--bg) 60%);
  padding: 24px;
}

.auth-wrap {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.auth-brand {
  text-align: center;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,.4);
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 20px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 7px 12px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab-btn.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form.hidden { display: none; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.label-hint { font-weight: 400; opacity: .7; }

input[type="text"],
input[type="email"],
input[type="password"] {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,.18);
}
input::placeholder { color: var(--muted); opacity: .6; }

.form-error {
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
}
.form-error.hidden { display: none; }

.btn-primary {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 11px;
  transition: background .15s, opacity .15s;
  margin-top: 2px;
}
.btn-primary:hover { background: var(--accent2); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--muted);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  border: none;
  border-radius: var(--radius-sm);
  color: #3c4043;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 11px;
  transition: background .15s, box-shadow .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  width: 100%;
}
.btn-google:hover { background: #f5f5f5; box-shadow: 0 2px 8px rgba(0,0,0,.25); }

/* ── Dashboard ── */
.dash-body { display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  background: rgba(13,15,26,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 12px;
  transition: border-color .15s, color .15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

.dash-main {
  padding: 32px 28px 48px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.section { display: flex; flex-direction: column; gap: 16px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.btn-refresh {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  transition: border-color .15s, color .15s;
}
.btn-refresh:hover { border-color: var(--accent); color: var(--accent); }

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .2s;
}
.stat-card:hover { border-color: #353860; }

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }

.stat-icon.color-green  { background: rgba(16,185,129,.15); color: var(--green); }
.stat-icon.color-amber  { background: rgba(245,158,11,.15); color: var(--amber); }
.stat-icon.color-red    { background: rgba(239,68,68,.15);  color: var(--red);   }
.stat-icon.color-purple { background: rgba(167,139,250,.15);color: var(--purple);}

.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; margin-top: 2px; }
.stat-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }

.stat-bar-wrap { margin-top: auto; }
.stat-bar {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .5s ease;
}
.stat-bar-fill.color-green  { background: var(--green); }
.stat-bar-fill.color-amber  { background: var(--amber); }
.stat-bar-fill.color-red    { background: var(--red);   }
.stat-bar-fill.color-purple { background: var(--purple);}

/* ── Service cards ── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .services-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .services-grid { grid-template-columns: 1fr; } }

.service-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .2s, transform .15s;
}
.service-card:hover { border-color: #353860; transform: translateY(-1px); }

.svc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.svc-icon {
  width: 42px;
  height: 42px;
  background: rgba(108,99,255,.12);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent2);
}
.svc-icon svg { width: 22px; height: 22px; }

.svc-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 99px;
}
.svc-badge.online  { background: rgba(16,185,129,.15); color: var(--green); }
.svc-badge.offline { background: rgba(239,68,68,.12);  color: var(--red);   }

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.online  .badge-dot { background: var(--green); box-shadow: 0 0 0 2px rgba(16,185,129,.3); }
.offline .badge-dot { background: var(--red);   }

.svc-name { font-size: 15px; font-weight: 600; }
.svc-desc { font-size: 12.5px; color: var(--muted); }

.svc-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  padding: 7px 14px;
  background: rgba(108,99,255,.12);
  color: var(--accent2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
  align-self: flex-start;
}
.svc-link:hover { background: rgba(108,99,255,.25); color: #fff; }
.svc-link.disabled { opacity: .4; pointer-events: none; }

/* ── Skeleton loading ── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--bg2) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  min-height: 130px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.load-error {
  color: var(--muted);
  font-size: 13.5px;
  padding: 20px 0;
}
