/* ── Reset & Variables ──────────────────────────────────────────────────────── */

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

:root {
  --primary: #7e22ce;
  --primary-l: #a855f7;
  --primary-d: #6b21a8;
  --accent: #e11d48;
  --accent-l: #fb7185;
  --bg: #faf5ff;
  --surface: #fff;
  --border: #e9d5ff;
  --text: #09090b;
  --muted: #71717a;
  --danger: #dc2626;
  --success: #16a34a;
  --r: 8px;
  --shadow: 0 1px 4px rgba(126, 34, 206, 0.08);
  --shadow-md: 0 4px 16px rgba(126, 34, 206, 0.12);
}

body {
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Forms ──────────────────────────────────────────────────────────────────── */

label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}
input,
textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
input:focus,
textarea:focus {
  border-color: var(--primary-l);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.12);
}
input.input-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
input.input-ok {
  border-color: var(--success);
}
textarea {
  resize: vertical;
  min-height: 70px;
}
.mono {
  font-family: "DM Mono", monospace;
  font-size: 0.8rem;
}
.form-row {
  margin-bottom: 0.875rem;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
}
.hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
.req {
  color: var(--accent);
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--r);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.12s;
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  filter: none !important;
}
.btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
  flex-shrink: 0;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 2px 8px rgba(126, 34, 206, 0.3);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
}
.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border: 1.5px solid #fecaca;
}
.btn-danger:hover:not(:disabled) {
  background: #fee2e2;
}
.btn-full {
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
}

/* ── Inline error ────────────────────────────────────────────────────────────── */

.inline-error {
  display: none;
  font-size: 0.8rem;
  color: var(--danger);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--r);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

/* ── Field hint (password match) ─────────────────────────────────────────────── */

.field-hint {
  font-size: 0.72rem;
  margin-top: 0.25rem;
  min-height: 1rem;
  transition: color 0.15s;
}
.field-hint.ok {
  color: var(--success);
}
.field-hint.error {
  color: var(--danger);
}

/* ── Toasts ─────────────────────────────────────────────────────────────────── */

#toast-root {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.toast {
  padding: 0.65rem 1rem;
  border-radius: var(--r);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastIn 0.2s ease;
  max-width: 300px;
}
.toast svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke-width: 2.5;
}
.toast-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}
.toast-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .main {
    padding: 1.25rem 1rem;
  }
}
