:root {
  --bg: #ffffff;
  --text: #2b2b2b;
  --muted: #8a8a8a;
  --placeholder: #7d7a8c;
  --border: #c9c9c9;
  --focus: #1a9dd9;
  --button: #0670a8;
  --button-hover: #055a87;
  --error: #d64545;
  --ok: #2e8b57;
  /* Azules corporativos: TPV Online (#1a9dd9) y Gesio (#068ccb) */
  --brand: #1a9dd9;
  --brand-dark: #0670a8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", system-ui, -apple-system, sans-serif;
}

/* Pantalla partida: formulario a la izquierda, panel de producto a la derecha */
.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
}

/* Página sin panel azul: solo el formulario, centrado */
.layout.solo { grid-template-columns: 1fr; }

.card {
  width: 100%;
  max-width: 480px;
  margin: auto;
  padding: 40px 16px;
  text-align: center;
}

.logo {
  display: block;
  width: min(240px, 70%);
  height: auto;
  margin: 0 auto 32px;
}

.promo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px clamp(32px, 6vw, 96px);
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
}
.promo h2 { margin: 0 0 16px; font-size: clamp(28px, 3vw, 40px); line-height: 1.15; max-width: 16ch; }
.promo p { margin: 0 0 28px; font-size: 18px; opacity: .9; max-width: 40ch; }
.promo ul { margin: 0 0 32px; padding: 0; list-style: none; }
.promo li { position: relative; padding-left: 32px; margin-bottom: 14px; font-size: 17px; }
.promo li::before {
  content: "";
  position: absolute; left: 0; top: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,.2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1.5' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E") no-repeat center;
}
.promo .promo-note { font-size: 14px; opacity: .75; margin: 0; }
.by {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 48px;
  font-size: 14px;
  opacity: .9;
}
.by img { width: 110px; height: auto; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .promo { padding: 40px 16px; }
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(26px, 6vw, 36px);
  font-weight: 700;
}

.subtitle {
  margin: 0 0 36px;
  color: var(--muted);
  font-size: clamp(15px, 4vw, 18px);
}

form { text-align: left; }

.field { position: relative; margin-bottom: 16px; }

input, select {
  width: 100%;
  height: 52px;
  padding: 0 18px;
  font: 500 16px "Roboto", system-ui, sans-serif;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input::placeholder { color: var(--placeholder); }
#nif:not(:placeholder-shown) { text-transform: uppercase; }

input:focus, select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 1px var(--focus);
}

.field.invalid input { border-color: var(--error); }

/* Teléfono: prefijo y número dentro de una misma caja */
.phone {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color .15s, box-shadow .15s;
}
.phone:focus-within { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.phone select, .phone input { border: 0; box-shadow: none !important; }
.phone select {
  width: auto;
  padding: 0 28px 0 16px;
  color: #666;
  appearance: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23999' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 8px center;
  cursor: pointer;
}
.prefijo {
  display: grid;
  place-items: center;
  padding: 0 4px 0 16px;
  color: #666;
  font-weight: 500;
}
.enviar-codigo {
  flex: none;
  margin: 6px;
  padding: 0 14px;
  font: 500 14px "Roboto", system-ui, sans-serif;
  color: var(--button);
  background: #e8f4fb;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.enviar-codigo:hover:not(:disabled) { background: #d6ecf8; }
.enviar-codigo:disabled { color: var(--muted); cursor: default; }
.enviar-codigo.ok { color: var(--ok); background: #e7f5ec; }
.field.invalid .phone { border-color: var(--error); }
.phone input { min-width: 0; }

.ayuda { margin: 6px 2px 0; font-size: 13px; color: var(--muted); }
.ayuda:empty { display: none; }
.captcha { display: flex; justify-content: center; }
.captcha:empty { display: none; }

.password input { padding-right: 56px; }
.toggle {
  position: absolute;
  top: 0; right: 6px;
  height: 52px; width: 44px;
  display: grid; place-items: center;
  background: none; border: 0;
  color: #b3b3b3;
  cursor: pointer;
}
.toggle:hover { color: #888; }
.toggle[aria-pressed="true"] .slash { display: none; }

.requisitos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin: 8px 2px 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
}
.requisitos li { position: relative; padding-left: 18px; }
.requisitos li::before { content: "○"; position: absolute; left: 0; }
.requisitos li.ok { color: var(--ok); }
.requisitos li.ok::before { content: "✓"; }

/* Página de éxito */
.exito h1 { margin-top: 8px; }
.exito .subtitle { margin-bottom: 24px; color: var(--text); }
.exito .subtitle strong { color: var(--button); word-break: break-all; }
.spinner {
  width: 56px; height: 56px;
  margin: 8px auto 28px;
  border: 5px solid #d8eef9;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: girar 1s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.error {
  margin: 4px 2px 0;
  min-height: 0;
  font-size: 13px;
  color: var(--error);
}
.error:empty { display: none; }

.submit {
  width: 100%;
  height: 52px;
  margin-top: 40px;
  font: 700 17px "Roboto", system-ui, sans-serif;
  color: #fff;
  background: var(--button);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.submit:hover { background: var(--button-hover); }
.submit:disabled { opacity: .6; cursor: wait; }

.form-status { margin: 12px 0 0; text-align: center; font-size: 15px; }
.form-status:empty { display: none; }
.form-status.ok { color: var(--ok); }
.form-status.ko { color: var(--error); }

.legal {
  margin: 20px auto 0;
  max-width: 420px;
  color: #555;
  font-size: 15px;
  line-height: 1.6;
}
.legal a { color: #555; }
.legal a:hover { color: var(--text); }
