:root {
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-900: #1e3a8a;
  --navy-950: #050b18;
  --navy-900: #0a1128;
  --navy-800: #0f1c3d;
  --navy-700: #142850;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --red-600: #dc2626;
  --amber-700: #b45309;
  --radius: 0.9rem;
}

* { box-sizing: border-box; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, 20px) scale(1.05); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(59,130,246,0.35); }
  70% { box-shadow: 0 0 0 14px rgba(59,130,246,0); }
  100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--gray-900);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(160deg, var(--navy-950) 0%, var(--navy-900) 45%, var(--navy-700) 100%);
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
}

body::before, body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}
body::before {
  width: 420px; height: 420px;
  background: var(--blue-600);
  top: -120px; left: -100px;
  animation: drift 14s ease-in-out infinite;
}
body::after {
  width: 360px; height: 360px;
  background: var(--blue-500);
  bottom: -100px; right: -80px;
  animation: drift 18s ease-in-out infinite reverse;
}

main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  animation: fadeUp 0.5s ease both;
}
main.narrow { max-width: 440px; }
main.wide { max-width: 980px; }

h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 0.5rem; color: white; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 1.5rem 0 0.5rem; color: white; }
h3 { font-size: 1rem; font-weight: 700; margin: 0 0 0.25rem; }
p { line-height: 1.6; color: var(--blue-50); }

main .card p, main .card h3 { color: var(--gray-700); }
main .card h3 { color: var(--gray-900); }

a { color: var(--blue-100); }
.card a { color: var(--blue-700); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(6px);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4ade80;
  animation: pulseRing 2s infinite;
}

.center { text-align: center; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.7rem;
  padding: 0.75rem 1.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
  color: white;
  box-shadow: 0 6px 20px rgba(37,99,235,0.35);
}
.btn-primary:hover { box-shadow: 0 8px 26px rgba(37,99,235,0.5); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }

.btn-secondary { background: white; color: var(--blue-700); border-color: rgba(255,255,255,0.5); }
.btn-secondary:hover { background: var(--blue-50); }

.btn-ghost { background: rgba(255,255,255,0.12); color: white; border-color: rgba(255,255,255,0.3); }
.btn-ghost:hover { background: rgba(255,255,255,0.22); }

.btn-whatsapp {
  background: linear-gradient(135deg, #25d366, #1fb855);
  color: white;
  box-shadow: 0 6px 20px rgba(37,211,102,0.4);
}
.btn-whatsapp:hover { box-shadow: 0 8px 26px rgba(37,211,102,0.55); transform: translateY(-1px); }

.btn-sm { padding: 0.45rem 0.95rem; font-size: 0.85rem; }

.card {
  background: white;
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: 0 10px 40px rgba(15,23,42,0.18);
  animation: fadeUp 0.5s ease both;
}

.glass {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  padding: 1.4rem;
  color: white;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
}
.grid-3 .card { transition: transform 0.2s ease; }
.grid-3 .card:hover { transform: translateY(-4px); }

.field { display: block; margin-bottom: 1rem; }
.field span {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
}
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--gray-300);
  border-radius: 0.65rem;
  padding: 0.7rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrapper input {
  padding-right: 2.8rem !important;
}
.password-toggle {
  position: absolute;
  right: 0.65rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  font-size: 1.1rem;
  padding: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.password-toggle:hover { color: var(--gray-700); }

.photo-preview {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  object-fit: cover;
  margin: 0.5rem 0;
  border: 1px solid var(--gray-300);
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--gray-900);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 9999;
  animation: slideIn 0.3s ease;
  max-width: 320px;
}
.toast.success { background: #16a34a; }
.toast.error { background: var(--red-600); }

@keyframes slideIn {
  from { transform: translateX(400px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.error-text { color: var(--red-600); font-size: 0.9rem; margin: 0.5rem 0; }
.success-text { color: #16a34a; font-size: 0.9rem; margin: 0.5rem 0; }
.muted { color: var(--gray-500); font-size: 0.85rem; }
.glass .muted { color: rgba(255,255,255,0.75); }

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.entry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--gray-200);
  border-radius: 0.65rem;
  padding: 0.9rem 1rem;
  background: white;
  margin-bottom: 0.6rem;
  animation: fadeUp 0.3s ease both;
}
.entry-row .links { display: flex; gap: 0.9rem; font-size: 0.85rem; }
.entry-row .links a, .entry-row .links button {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; text-decoration: underline;
}
.link-edit { color: var(--blue-700); }
.link-delete { color: var(--red-600); }
.link-warn { color: var(--amber-700); }

.stat-number {
  font-size: 3rem;
  font-weight: 800;
  color: var(--blue-700);
  margin: 0;
  line-height: 1;
}

.progress-bar {
  width: 100%;
  height: 0.65rem;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.85rem;
  position: relative;
}
.progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-400), var(--blue-600));
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 999px;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.25);
  margin-bottom: 1.5rem;
}
.tab-btn {
  background: none;
  border: none;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: rgba(255,255,255,0.65);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s ease;
}
.tab-btn.active { color: white; border-color: white; }

.inline-form { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.inline-form input { flex: 1; }

footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
}
footer strong { color: white; }
footer .wa-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #7CFFB2;
  text-decoration: none;
  font-weight: 600;
}
footer .wa-link:hover { text-decoration: underline; }

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2.5rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
}

.loading { text-align: center; color: rgba(255,255,255,0.85); padding: 2rem 0; }
.loading::after {
  content: "";
  display: inline-block;
  width: 1rem; height: 1rem;
  margin-left: 0.5rem;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.floaty { animation: float 4s ease-in-out infinite; }

.share-box {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--gray-100);
  border: 1px dashed var(--gray-300);
  border-radius: 0.65rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  word-break: break-all;
}
