/* AMI · sistema visual base */
:root {
  --bg: #09090b;
  --bg-2: #0e0e12;
  --panel: #131318;
  --panel-2: #1a1a21;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f4f0e8;
  --muted: #a09a8f;
  --dim: #6d6961;
  --gold: #e8c07d;
  --gold-2: #c98f45;
  --gold-soft: rgba(232, 192, 125, 0.12);
  --teal: #72e0cf;
  --red: #ff8273;
  --green: #86d9a0;
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --radius: 16px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--gold); color: #17110a; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.gold { color: var(--gold); }
.num { font-variant-numeric: tabular-nums; }

/* Marca */
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 26px; letter-spacing: 0.04em; line-height: 1; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px dashed var(--gold);
  display: grid; place-items: center;
}
.brand-mark::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(135deg, #f8dfa8, var(--gold-2)); box-shadow: 0 0 14px rgba(232, 192, 125, 0.7); }

/* Botones */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border-radius: 999px;
  font-weight: 700; font-size: 14px; letter-spacing: 0.01em; white-space: nowrap;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.03);
  transition: transform 0.25s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.3s, opacity 0.2s;
}
.btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.24); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-primary {
  color: #1b1307; border: 0;
  background: linear-gradient(135deg, #f8dfa8 0%, var(--gold) 45%, var(--gold-2) 100%);
  box-shadow: 0 8px 30px -8px rgba(232, 192, 125, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
/* pespunte interior: la firma de AMI */
.btn-primary::before {
  content: ''; position: absolute; inset: 4px; border-radius: 999px;
  border: 1px dashed rgba(60, 38, 8, 0.45); pointer-events: none;
}
.btn-primary:hover { background: linear-gradient(135deg, #fbe7b9 0%, #efcb8d 45%, #d39a51 100%); box-shadow: 0 12px 40px -8px rgba(232, 192, 125, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.6); transform: translateY(-1px); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 54px; padding: 0 30px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-danger { color: var(--red); border-color: rgba(255, 130, 115, 0.3); }
.btn-danger:hover { background: rgba(255, 130, 115, 0.1); border-color: rgba(255, 130, 115, 0.5); }
.link { color: var(--gold); font-weight: 600; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Formularios */
.field { display: grid; gap: 7px; }
.field > span { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.input, .field input, .field textarea, .field select {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line-2);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.field textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.field select option { background: #17171d; }
.field input:focus, .field textarea:focus, .field select:focus, .input:focus {
  outline: 0; border-color: var(--gold); background: rgba(232, 192, 125, 0.05); box-shadow: 0 0 0 4px rgba(232, 192, 125, 0.12);
}
.field input::placeholder, .field textarea::placeholder { color: var(--dim); }
.form { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.form-error { color: var(--red); font-size: 13.5px; min-height: 0; }
.form-error:empty { display: none; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: rgba(4, 4, 6, 0.72); backdrop-filter: blur(10px);
  animation: fade 0.25s ease both; overflow-y: auto;
}
.modal {
  position: relative; width: min(100%, 480px); margin: auto;
  background: linear-gradient(180deg, #17171d, #111116);
  border: 1px solid var(--line-2); border-radius: 22px; padding: 32px;
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(232, 192, 125, 0.04);
  animation: rise 0.4s var(--ease) both;
}
.modal.wide { width: min(100%, 760px); }
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted); font-size: 20px; line-height: 1;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.modal h2 { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.1; margin-bottom: 6px; }
.modal-sub { color: var(--muted); margin-bottom: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

/* Toasts */
.toasts { position: fixed; z-index: 200; bottom: 24px; left: 50%; transform: translateX(-50%); display: grid; gap: 10px; width: min(92vw, 420px); pointer-events: none; }
.toast {
  padding: 13px 18px; border-radius: 14px; font-size: 14px; font-weight: 600;
  background: #1d1d25; border: 1px solid var(--line-2); box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.8);
  animation: rise 0.35s var(--ease) both; display: flex; gap: 10px; align-items: center;
}
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
.toast.error::before { background: var(--red); }
.toast.ok::before { background: var(--green); }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.2); border-top-color: currentColor; animation: spin 0.7s linear infinite; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
  .modal { padding: 26px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
