:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #dde1e6;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #1d4ed8;
  --accent-dark: #1e3a8a;
  --danger: #b91c1c;
  --radius: 8px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
}
.topbar nav a {
  margin-right: 16px;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
}
.topbar nav a:hover { color: var(--accent); }
.container { max-width: 960px; margin: 32px auto; padding: 0 20px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}
h1 { font-size: 1.4rem; }
h2 { font-size: 1.1rem; margin-top: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.78rem; background: #e0e7ff; color: var(--accent-dark); }
.badge.off { background: #fee2e2; color: var(--danger); }
form.inline { display: inline; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin: 10px 0 4px; }
input, select { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; }
button, .btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  margin-top: 12px;
}
button:hover, .btn:hover { background: var(--accent-dark); }
button.secondary, .btn.secondary { background: var(--muted); }
.btn.small { padding: 4px 10px; font-size: 0.8rem; margin-top: 0; }
.error { background: #fee2e2; color: var(--danger); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 0.9rem; }
.stat-grid { display: flex; gap: 16px; }
.stat { flex: 1; text-align: center; }
.stat .n { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat .l { color: var(--muted); font-size: 0.85rem; }
/* Login page: full-bleed dark security theme, independent of the app's light .container layout */
body:has(.login-page) { background: #0a0f1e; }
body:has(.login-page) .container { max-width: none; margin: 0; padding: 0; }

.login-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 24px;
}

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, #132043 0%, #0a0f1e 55%, #060911 100%);
}
.login-bg-grid {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(rgba(96, 165, 250, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, 0.09) 1px, transparent 1px);
  background-size: 42px 42px;
  animation: gridDrift 24s linear infinite;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 35%, black 30%, transparent 75%);
}
@keyframes gridDrift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(42px, 42px); }
}
.login-bg-glow {
  position: absolute;
  top: 8%;
  left: 50%;
  width: 640px;
  height: 640px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(34, 211, 238, 0.16) 0%, rgba(34, 211, 238, 0) 68%);
  animation: glowPulse 6s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.08); }
}

.login-fingerprint {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(70vw, 560px);
  height: min(70vw, 560px);
  transform: translate(-50%, -50%);
  color: #38bdf8;
  opacity: 0.5;
  animation: fpBreathe 5s ease-in-out infinite;
}
@keyframes fpBreathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.6; }
}
.login-fingerprint-scan {
  mix-blend-mode: screen;
  animation: fpScan 3.6s ease-in-out infinite;
}
@keyframes fpScan {
  0%, 100% { transform: translateY(-8px); }
  50% { transform: translateY(190px); }
}

.login-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 360px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: #e2e8f0;
}
.login-brand-icon {
  display: flex;
  color: #38bdf8;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.5));
}
.login-brand-title { font-weight: 700; font-size: 1.1rem; }
.login-brand-sub { font-size: 0.8rem; color: #93a3b8; }
.login-panel {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.login-panel h1 { color: #f1f5f9; }
.login-panel label { color: #93a3b8; }
.login-panel input {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(148, 163, 184, 0.25);
  color: #f1f5f9;
}
.login-panel input::placeholder { color: #64748b; }
.login-panel input:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}
.login-panel button { width: 100%; background: #2563eb; }
.login-panel button:hover { background: #1d4ed8; }
.login-footnote {
  text-align: center;
  color: #64748b;
  font-size: 0.76rem;
  margin-top: 18px;
  letter-spacing: 0.01em;
}

@media (prefers-reduced-motion: reduce) {
  .login-bg-grid, .login-bg-glow, .login-fingerprint, .login-fingerprint-scan {
    animation: none;
  }
}
