:root {
  --bg: #10141a;
  --panel: #171c24;
  --panel-border: #232a35;
  --text: #e5e9f0;
  --muted: #6b7686;
  --wg: #4fd1c5;
  --pihole: #f2545b;
  --vps: #f2a365;
  --danger: #ef4444;
  --font-ui: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100vh;
}

.subtle { color: var(--muted); font-size: 0.85rem; }
.muted { color: var(--muted); }

/* --- shared terminal-prompt motif --- */
.prompt { font-family: var(--font-mono); color: var(--wg); }
.prompt-sep { font-family: var(--font-mono); color: var(--muted); }
.cursor {
  display: inline-block;
  width: 8px; height: 1.1em;
  background: var(--text);
  margin-left: 6px;
  vertical-align: text-bottom;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* --- login page --- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 32px;
}
.login-head { margin-bottom: 18px; }
.login-card h1 {
  font-size: 1.4rem;
  margin: 0 0 4px;
}
.login-card form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-card label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 12px;
}
.login-card input {
  background: #0d1117;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.95rem;
}
.login-card input:focus {
  outline: none;
  border-color: var(--wg);
}
.login-card button {
  margin-top: 20px;
  background: var(--wg);
  color: #06251f;
  border: none;
  border-radius: 6px;
  padding: 11px;
  font-weight: 600;
  cursor: pointer;
}
.login-card button:hover { filter: brightness(1.08); }
.login-card button:focus-visible,
.ghost-btn:focus-visible,
.login-card input:focus-visible {
  outline: 2px solid var(--wg);
  outline-offset: 2px;
}
.error { color: var(--danger); font-size: 0.85rem; margin-top: 12px; }

/* --- dashboard --- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  border-bottom: 1px solid var(--panel-border);
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.ghost-btn {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.ghost-btn:hover { border-color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  padding: 28px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 20px;
  border-top: 3px solid transparent;
}
.accent-wg { border-top-color: var(--wg); }
.accent-pihole { border-top-color: var(--pihole); }
.accent-vps { border-top-color: var(--vps); }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.card-head h2 { margin: 0; font-size: 1.05rem; }
.badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid #1e2430;
}
.stat-row:last-child { border-bottom: none; }
.stat-value { font-family: var(--font-mono); }

.peer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #1e2430;
  font-size: 0.85rem;
}
.peer:last-child { border-bottom: none; }
.peer-name { font-family: var(--font-mono); color: var(--muted); }
.peer-meta { margin-left: auto; text-align: right; color: var(--muted); font-size: 0.78rem; }

/* handshake pulse dot: green = fresh, amber = aging, gray = stale/never */
.pulse-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}
.pulse-dot.fresh { background: var(--wg); }
.pulse-dot.aging { background: var(--vps); }
.pulse-dot.stale { background: #3a4150; }
.pulse-dot.fresh::after {
  content: "";
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--wg);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cursor, .pulse-dot.fresh::after { animation: none; }
}

.progress-track {
  background: #1e2430;
  border-radius: 4px;
  height: 6px;
  margin-top: 6px;
  overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 4px; }
