/* ===================================================================
   ESTILOS.CSS — Casaenmano · Formularios de registro
   Paleta y tipografía según el brand book. Mobile-first.
   =================================================================== */

:root {
  --verde: #1C261B;
  --crema: #FFFBE9;
  --lima: #B0E454;
  --gris: #6E6A57;
  --banda: #F0EBD8;
  --subtotal: #DDE7CE;
  --linea: #D8D2BC;
  --alerta: #9C6B2B;
  --alerta-bg: #F5E9D6;
  --error: #B3261E;
  --error-bg: #FBEAE8;
  --acento: var(--lima);
  --radio: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--crema);
  color: var(--verde);
  font-family: 'Satoshi', 'Manrope', 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}
body.cargando #app { visibility: hidden; }

.wrap { max-width: 880px; margin: 0 auto; padding: 16px 16px 64px; }
@media (min-width: 640px) { .wrap { padding: 28px 24px 80px; } }

/* --- Encabezado con logos ------------------------------------------ */
.cabecera {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 6px 0 16px; border-bottom: 1px solid var(--linea);
}
.logos { display: flex; align-items: center; gap: 14px; min-height: 40px; }
.logos img { display: block; height: 34px; width: auto; }
.logos .aliado { height: 38px; max-width: 160px; object-fit: contain; }
.logos .separador { width: 1px; height: 32px; background: var(--linea); }
.cabecera .sitio { font-size: 13px; color: var(--gris); text-decoration: none; font-weight: 500; }
.cabecera .sitio:hover { color: var(--verde); }
@media (max-width: 480px) { .cabecera .sitio { display: none; } }

/* --- Barra de progreso ---------------------------------------------- */
.progreso { margin: 18px 0 0; }
.progreso ol {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
}
.progreso li {
  height: 5px; border-radius: 999px; background: var(--linea);
  transition: background .25s;
}
.progreso li.completo { background: var(--acento); }
.progreso .leyenda { font-size: 12px; color: var(--gris); margin-top: 6px; }

/* --- Cabecera del formulario --------------------------------------- */
.formhead { margin: 22px 0 20px; }
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gris);
}
.formhead h1 { font-size: clamp(24px, 5vw, 32px); font-weight: 700; margin: 6px 0 6px; line-height: 1.15; }
.formhead .intro { font-size: 15px; color: var(--gris); margin: 0; max-width: 620px; }

/* --- Aviso de borrador ---------------------------------------------- */
.aviso {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--banda); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 10px 14px; margin: 0 0 16px; font-size: 14px; color: var(--verde);
}
.aviso button {
  background: transparent; border: 1px solid var(--verde); color: var(--verde);
  font-family: inherit; font-size: 13px; font-weight: 700; padding: 8px 14px;
  border-radius: 999px; cursor: pointer; min-height: 44px;
}
.aviso button:hover { background: var(--verde); color: var(--crema); }

/* --- Bloques ----------------------------------------------------------- */
fieldset.bloque {
  border: 1px solid var(--linea); border-radius: 12px; background: #fff;
  margin: 0 0 16px; padding: 14px 16px 18px; min-width: 0;
}
@media (min-width: 640px) { fieldset.bloque { padding: 18px 22px 22px; } }
fieldset.bloque > legend {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--verde); padding: 0 8px;
}
.nota {
  font-size: 13.5px; margin: 0 0 14px; padding: 10px 12px; border-radius: 8px;
  background: var(--subtotal); color: var(--verde);
}
.nota.advertencia { background: var(--alerta-bg); border: 1px solid #DDBF8E; color: var(--alerta); }

.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }
.f { margin: 0; min-width: 0; }
.f.completo { grid-column: 1 / -1; }
.f label, .f .etiqueta { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.f .req { color: var(--alerta); font-weight: 700; }
.f .ayuda { font-size: 12.5px; color: var(--gris); margin-top: 5px; line-height: 1.4; }
.f .mensaje { display: none; font-size: 12.5px; color: var(--error); margin-top: 5px; font-weight: 700; }
.f.error .mensaje { display: block; }
.f.error input, .f.error select, .f.error textarea, .f.error .moneda { border-color: var(--error); background: var(--error-bg); }

.f input, .f select, .f textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--linea); border-radius: 8px;
  background: #fff; font-family: inherit; font-size: 16px; color: var(--verde);
}
.f select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231C261B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.f textarea { min-height: 88px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { outline: 2px solid var(--verde); outline-offset: 1px; }

.f .moneda { display: flex; align-items: center; border: 1px solid var(--linea); border-radius: 8px; background: #fff; padding: 0 12px; }
.f .moneda span { color: var(--gris); font-size: 16px; margin-right: 4px; }
.f .moneda input { border: none; padding-left: 0; }
.f .moneda input:focus { outline: none; }
.f .moneda:focus-within { outline: 2px solid var(--verde); outline-offset: 1px; }

.f .fijo {
  min-height: 44px; display: flex; align-items: center; padding: 10px 12px;
  border: 1px dashed var(--linea); border-radius: 8px; background: var(--subtotal);
  font-size: 16px; font-weight: 700; color: var(--verde);
}

.casillas { display: flex; flex-wrap: wrap; gap: 8px; }
.casillas label {
  display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--linea); border-radius: 999px; padding: 9px 14px; min-height: 44px;
  cursor: pointer; background: #fff; margin: 0;
}
.casillas input { accent-color: var(--verde); width: 18px; height: 18px; min-height: 0; margin: 0; }
.casillas label.on { background: var(--subtotal); border-color: #9FB98F; }
.casillas label:focus-within { outline: 2px solid var(--verde); outline-offset: 1px; }

.f.casilla label { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; font-size: 14px; cursor: pointer; }
.f.casilla input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; flex: 0 0 auto; accent-color: var(--verde); }

/* Honeypot: fuera de la vista, nunca se muestra */
.hp { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; opacity: 0; }

/* --- Errores y envío ------------------------------------------------- */
.resumen-errores {
  display: none; background: var(--error-bg); border: 1px solid #E5B4AF; border-radius: var(--radio);
  padding: 12px 16px; margin: 0 0 16px; font-size: 14px; color: var(--error);
}
.resumen-errores.visible { display: block; }
.resumen-errores h2 { margin: 0 0 4px; font-size: 14px; }
.resumen-errores p { margin: 0 0 6px; }
.resumen-errores ul { margin: 0; padding-left: 18px; }
.resumen-errores button { background: none; border: none; color: var(--error); font: inherit; text-decoration: underline; cursor: pointer; padding: 2px 0; text-align: left; }

.barra { display: flex; align-items: center; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
button.enviar {
  background: var(--verde); color: var(--crema); border: none; padding: 14px 26px;
  border-radius: 8px; font-family: inherit; font-weight: 700; font-size: 16px; cursor: pointer;
  min-height: 48px; width: 100%;
}
@media (min-width: 640px) { button.enviar { width: auto; } }
button.enviar:hover { background: #0F160E; }
button.enviar:disabled { opacity: .6; cursor: wait; }
button.enviar:focus-visible { outline: 3px solid var(--lima); outline-offset: 2px; }
.error-envio { display: none; color: var(--error); font-size: 14px; font-weight: 700; margin-top: 10px; }
.error-envio.visible { display: block; }

/* --- Confirmación ------------------------------------------------------ */
.confirmacion {
  background: var(--verde); color: var(--crema); border-radius: 14px;
  padding: 36px 24px; margin: 24px 0; text-align: center;
}
.confirmacion h2 { font-size: 28px; margin: 0 0 8px; color: var(--crema); }
.confirmacion p { font-size: 16px; margin: 0 auto; max-width: 520px; color: #DCDACB; }
.confirmacion .codigo { margin-top: 18px; font-size: 13px; color: #CFCDBE; }
.confirmacion .codigo strong { display: block; color: var(--lima); font-size: 22px; letter-spacing: .04em; margin-top: 2px; }
.confirmacion button {
  margin-top: 24px; background: var(--lima); color: var(--verde); border: none;
  padding: 14px 26px; border-radius: 8px; font-family: inherit; font-weight: 700; font-size: 16px;
  cursor: pointer; min-height: 48px;
}
.confirmacion button:hover { filter: brightness(.95); }

/* --- Pie ----------------------------------------------------------------- */
footer.pie {
  margin-top: 32px; border-top: 1px solid var(--linea); padding-top: 14px;
  font-size: 12.5px; color: var(--gris); display: flex; align-items: center; gap: 10px;
}
footer.pie img { height: 18px; width: auto; opacity: .8; }

/* --- Vista interna /admin/ ------------------------------------------ */
.admin-login { max-width: 380px; margin: 40px auto; }
.admin-login .f { margin-bottom: 12px; }
.admin-barra { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.admin-barra .espacio { flex: 1; }
.admin-barra .total { font-size: 13px; color: var(--gris); }
button.secundario {
  background: transparent; border: 1px solid var(--verde); color: var(--verde);
  padding: 10px 16px; border-radius: 8px; font-family: inherit; font-weight: 700; font-size: 14px;
  cursor: pointer; min-height: 44px;
}
button.secundario:hover { background: var(--verde); color: var(--crema); }
button.primario {
  background: var(--verde); color: var(--crema); border: none;
  padding: 10px 18px; border-radius: 8px; font-family: inherit; font-weight: 700; font-size: 14px;
  cursor: pointer; min-height: 44px;
}
.tabla-wrap { overflow-x: auto; border: 1px solid var(--linea); border-radius: var(--radio); background: #fff; }
table.registros { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
table.registros th {
  text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gris); border-bottom: 1px solid var(--verde); padding: 10px 12px; white-space: nowrap;
}
table.registros td { padding: 10px 12px; border-bottom: 1px solid var(--linea); vertical-align: top; }
table.registros tr:nth-child(odd) td { background: var(--banda); }
table.registros tbody tr { cursor: pointer; }
table.registros tbody tr:hover td { background: var(--subtotal); }
table.registros td.codigo { font-weight: 700; white-space: nowrap; }
.etiqueta-estado { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--subtotal); }
.etiqueta-estado.error { background: var(--error-bg); color: var(--error); }
.etiqueta-estado.neutro { background: #fff; border: 1px solid var(--linea); color: var(--gris); }
.detalle { background: #fff; border: 1px solid var(--linea); border-radius: var(--radio); padding: 18px 20px; }
.detalle h2 { margin: 0 0 4px; font-size: 20px; }
.detalle .meta { font-size: 13px; color: var(--gris); margin: 0 0 14px; }
.detalle .dup { background: var(--alerta-bg); color: var(--alerta); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; margin: 0 0 14px; }
.detalle h3 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gris); margin: 18px 0 6px; }
.detalle dl { margin: 0; display: grid; grid-template-columns: 1fr; gap: 6px 16px; }
@media (min-width: 640px) { .detalle dl { grid-template-columns: minmax(180px, 1fr) 2fr; } }
.detalle dt { font-weight: 700; font-size: 13px; color: var(--gris); }
.detalle dd { margin: 0 0 6px; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.mensaje-admin { font-size: 14px; color: var(--gris); padding: 20px 0; }
.mensaje-admin.error { color: var(--error); font-weight: 700; }
