:root {
  --bg:            oklch(1.000 0.000   0);
  --surface:       oklch(0.975 0.006 210);
  --surface-2:     oklch(0.950 0.010 210);
  --border:        oklch(0.900 0.010 210);
  --border-focus:  oklch(0.42  0.110 210);
  --ink:           oklch(0.13  0.015 210);
  --muted:         oklch(0.50  0.010 210);
  --subtle:        oklch(0.68  0.008 210);
  --primary:       oklch(0.42  0.110 210);
  --primary-dark:  oklch(0.32  0.110 210);
  --primary-light: oklch(0.94  0.028 210);
  --primary-ring:  oklch(0.42  0.110 210 / 0.20);
  --warning:       oklch(0.66  0.14   78);
  --warning-bg:    oklch(0.97  0.04   78);
  --font: 'Inter', system-ui, sans-serif;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.06);
  --shadow-lg: 0 8px 28px oklch(0 0 0 / 0.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

/* ── Page header bar ─────────────────────────────── */
.topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-brand {
  display: flex; align-items: center; gap: .5rem;
  text-decoration: none; color: var(--ink);
}
.topbar-brand img { height: 28px; }
.topbar-brand span { font-size: .8125rem; font-weight: 600; }
.topbar-back {
  display: inline-flex; align-items: center; gap: .375rem;
  font-size: .8125rem; color: var(--muted); text-decoration: none;
  padding: .35rem .625rem; border-radius: var(--r-sm);
  transition: color .15s, background .15s;
}
.topbar-back:hover { color: var(--ink); background: var(--surface); }
.topbar-back svg { width: 14px; height: 14px; }

/* ── Main layout ─────────────────────────────────── */
.page-wrap {
  max-width: 820px; margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  animation: fadeUp .4s ease-out both;
}
.page-heading { margin-bottom: 2rem; }
.page-heading h1 {
  font-size: 1.5rem; font-weight: 700;
  letter-spacing: -.025em; line-height: 1.2; margin-bottom: .35rem;
}
.page-heading p { font-size: .875rem; color: var(--muted); }

/* ── Form card ───────────────────────────────────── */
.form-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 2rem 2rem 2.25rem;
  box-shadow: var(--shadow-sm);
}
.form-section-title {
  font-size: .6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--subtle);
  padding-bottom: .625rem; border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem; margin-top: 1.75rem;
}
.form-section-title:first-child { margin-top: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.form-group { display: flex; flex-direction: column; gap: .375rem; }
.form-group.full { grid-column: 1 / -1; }

label { font-size: .8125rem; font-weight: 500; color: var(--ink); }
label .req { color: var(--primary); margin-left: .15rem; }

input[type="text"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%; padding: .625rem .875rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--ink);
  font-family: var(--font); font-size: .9375rem; line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
  outline: none; appearance: none; -webkit-appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--subtle); }
input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23718096' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.25rem;
}
textarea { resize: vertical; min-height: 90px; }

/* ── Autocomplete override ───────────────────────── */
.ui-autocomplete {
  background: var(--bg) !important; border: 1px solid var(--border) !important;
  border-radius: var(--r-md) !important; box-shadow: var(--shadow-lg) !important;
  padding: .3rem 0 !important; font-family: var(--font) !important;
  font-size: .875rem !important; z-index: 9999 !important;
}
.ui-menu-item .ui-menu-item-wrapper {
  padding: .5rem .875rem !important; color: var(--ink) !important;
  cursor: pointer !important; transition: background .1s !important; border-radius: 0 !important;
}
.ui-menu-item .ui-menu-item-wrapper.ui-state-active,
.ui-menu-item .ui-menu-item-wrapper:hover {
  background: var(--primary-light) !important; color: var(--primary) !important; border: none !important;
}
.ui-helper-hidden-accessible { display: none !important; }

/* ── Warning alert ───────────────────────────────── */
#alerta-destino {
  display: none; grid-column: 1 / -1;
  background: var(--warning-bg); border: 1px solid oklch(0.88 0.06 78);
  border-radius: var(--r-md); padding: .875rem 1rem;
  font-size: .85rem; color: oklch(0.40 0.10 78); line-height: 1.5;
}
#alerta-destino .icon { margin-right: .35rem; }
.hint { font-size: .75rem; color: var(--muted); margin-top: .125rem; }

/* ── Submit row ──────────────────────────────────── */
.form-footer {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 1rem; margin-top: 2rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.btn-cancel {
  display: inline-flex; align-items: center;
  padding: .625rem 1.125rem; font-size: .9rem; font-weight: 500;
  color: var(--muted); text-decoration: none; border-radius: var(--r-md);
  transition: color .15s, background .15s;
}
.btn-cancel:hover { color: var(--ink); background: var(--surface); }
.btn-submit {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.5rem; background: var(--primary); color: #fff;
  font-family: var(--font); font-size: .9375rem; font-weight: 600;
  border: none; border-radius: var(--r-md); cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 2px 8px oklch(0.42 0.11 210 / 0.32);
}
.btn-submit:hover:not(:disabled) {
  background: var(--primary-dark); transform: translateY(-1px);
  box-shadow: 0 4px 14px oklch(0.42 0.11 210 / 0.38);
}
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-submit svg { width: 16px; height: 16px; }
