*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  color: #f1f5f9;
}

.page {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* ── Card ─────────────────────────────────────────── */
.card {
  background: #1e1e2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}

/* ── States ───────────────────────────────────────── */
.state { display: flex; flex-direction: column; align-items: center; }
.hidden { display: none !important; }

/* Loading */
#state-loading {
  padding: 4rem 2rem;
  gap: 1rem;
  color: rgba(255,255,255,0.4);
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Not found / success */
#state-notfound, #state-success {
  padding: 2.5rem 2rem;
  text-align: center;
  gap: 1rem;
}

.icon-box {
  width: 60px; height: 60px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
}
.icon-box svg { width: 30px; height: 30px; }

.icon-box.error { background: rgba(239,68,68,0.12); stroke: #ef4444; }
.icon-box.error svg { stroke: #ef4444; }
.icon-box.success { background: rgba(34,197,94,0.12); }
.icon-box.success svg { stroke: #22c55e; }

#state-notfound h2, #state-success h2 {
  font-size: 1.3rem; font-weight: 700;
}

#state-notfound p, #state-success p {
  font-size: 14px; color: rgba(255,255,255,0.55); line-height: 1.6; max-width: 320px;
}

/* ── Card header ──────────────────────────────────── */
.card-header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  padding: 2rem 2rem 1.5rem;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
  gap: 0.6rem;
  width: 100%;
}

.header-icon {
  width: 50px; height: 50px;
  background: rgba(255,255,255,0.15);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
}
.header-icon svg { width: 24px; height: 24px; stroke: #fff; }

.card-header h1 { font-size: 1.5rem; font-weight: 800; color: #fff; }
.subtitle { font-size: 13px; color: rgba(255,255,255,0.8); }

/* ── Form ─────────────────────────────────────────── */
form {
  padding: 1.5rem 1.75rem 1.75rem;
  display: flex; flex-direction: column; gap: 1rem;
  width: 100%;
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.field { display: flex; flex-direction: column; gap: 0.35rem; }

label {
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,0.7); letter-spacing: 0.2px;
}

.optional { font-weight: 400; color: rgba(255,255,255,0.35); }

input, textarea {
  padding: 10px 13px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: #f1f5f9;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
  resize: none;
}
input:focus, textarea:focus {
  border-color: #6366f1;
  background: rgba(99,102,241,0.06);
}
input::placeholder, textarea::placeholder {
  color: rgba(255,255,255,0.25);
}

.hint {
  font-size: 12px; color: rgba(255,255,255,0.35); margin-top: 1px;
}

/* ── Error ────────────────────────────────────────── */
.error-box {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px; font-weight: 500;
}

/* ── Submit ───────────────────────────────────────── */
button[type="submit"] {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none; border-radius: 12px;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  margin-top: 0.25rem;
}
button[type="submit"]:hover { opacity: 0.9; }
button[type="submit"]:active { transform: scale(0.98); }
button[type="submit"]:disabled { opacity: 0.55; cursor: default; }

/* ── Mobile ───────────────────────────────────────── */
@media (max-width: 500px) {
  body { padding: 0; align-items: flex-start; }
  .card { border-radius: 0; min-height: 100vh; border: none; box-shadow: none; }
  .row { grid-template-columns: 1fr; }
}
