@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --bg: #0a0d15;
  --bg-alt: #0f1420;
  --surface: #141a29;
  --surface-2: #1b2338;
  --border: #262f47;
  --text: #eaeefa;
  --text-dim: #94a0bd;
  --cyan: #00e5ff;
  --magenta: #ff2ee6;
  --violet: #8b5cf6;
  --teal: #00e5c7;
  --danger: #ff4d6d;
  --success: #34e7a4;
  --radius: 18px;
  --radius-sm: 10px;
  --pearl: conic-gradient(from 200deg, var(--cyan), var(--violet), var(--magenta), var(--teal), var(--cyan));
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 15% -10%, #16203a 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
}

h1, h2, h3, .brand {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.mono { font-family: 'JetBrains Mono', monospace; letter-spacing: 0.02em; }

a { color: inherit; }

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 18px;
  max-width: 880px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  text-decoration: none;
}

.brand-pearl {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--pearl);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.55);
  flex-shrink: 0;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
  color: var(--text-dim);
}

.topbar nav a { text-decoration: none; color: var(--text-dim); transition: color .15s ease; }
.topbar nav a:hover { color: var(--text); }

.topbar .whoami {
  font-size: 13px;
  color: var(--text-dim);
}

/* wave divider - motivo marino */
.wave {
  display: block;
  width: 100%;
  height: 28px;
  margin-bottom: 8px;
  opacity: 0.9;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.btn:hover { border-color: var(--cyan); box-shadow: 0 0 0 1px rgba(0,229,255,.25); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--violet) 60%, var(--magenta));
  border: none;
  color: #06070c;
}
.btn-primary:hover { box-shadow: 0 0 24px rgba(139, 92, 246, 0.45); }

.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); box-shadow: 0 0 0 1px rgba(255,77,109,.25); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- Cards / surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.auth-shell {
  max-width: 420px;
  margin: 8vh auto 0;
  padding: 0 20px;
}

.auth-shell .card { padding: 32px 28px; }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}

.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,229,255,.15);
}

.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

.file-drop {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  background: var(--bg-alt);
}
.file-drop input { color: var(--text-dim); font-size: 13px; }

.error-box {
  background: rgba(255, 77, 109, 0.1);
  border: 1px solid rgba(255, 77, 109, 0.4);
  color: #ffb3c1;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
}

.hint { font-size: 13px; color: var(--text-dim); margin-top: 18px; text-align: center; }
.hint a { color: var(--teal); text-decoration: none; font-weight: 600; }

/* ---------- Search ---------- */
.search-bar {
  display: flex;
  gap: 10px;
  margin: 8px 0 26px;
}
.search-bar input {
  flex: 1;
  padding: 13px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.search-bar input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,229,255,.15); }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 6px 0 4px;
}
.page-head p { color: var(--text-dim); margin: 4px 0 0; font-size: 14px; }

/* ---------- Entradas grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.entrada-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  position: relative;
}

.avatar-ring {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  margin: 0 auto 14px;
  padding: 3px;
  background: var(--pearl);
}
.avatar-ring img, .avatar-ring .avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}
.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 24px;
  color: var(--text-dim);
}

.entrada-card .nombre { font-weight: 600; font-size: 15px; }
.entrada-card .mote { color: var(--teal); font-size: 13px; margin-top: 2px; }
.entrada-card .ubicacion {
  margin-top: 10px;
  display: inline-flex;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-alt);
  border-radius: 999px;
  padding: 5px 12px;
}

.entrada-card .acciones {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty-state .brand-pearl { margin: 0 auto 16px; width: 34px; height: 34px; }

.fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--violet) 60%, var(--magenta));
  color: #06070c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  text-decoration: none;
  box-shadow: 0 6px 24px rgba(139, 92, 246, .45);
  border: none;
}

/* ---------- Tables (admin) ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-pending { background: rgba(139,92,246,.15); color: #c4b5fd; }
.badge-active { background: rgba(52,231,164,.12); color: var(--success); }
.badge-expired { background: rgba(255,77,109,.12); color: var(--danger); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.row-actions { display: flex; gap: 8px; }

footer.foot {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 40px 0 10px;
}

@media (max-width: 560px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .field-row { flex-direction: column; gap: 0; }
  table, thead, tbody, tr { display: block; width: 100%; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--border); padding: 10px 0; }
  td { border: none; padding: 4px 0; }
  td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
