:root {
  --verde: #00963f;
  --verde-osc: #007a33;
  --verde-claro: #e8f5ec;
  --borde: #cfd8d3;
  --texto: #1f2a24;
  --gris: #6b7a72;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  color: var(--texto);
  background: linear-gradient(180deg, #ffffff 0%, #eef8f1 35%, #c9e8d3 100%) fixed;
  min-height: 100vh;
}

/* Cabecera */
.cabecera {
  max-width: 1140px; margin: 0 auto; padding: 18px 20px 0;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px;
}
.logo img { height: 70px; display: block; }
.anio { margin: 0; font-weight: 700; font-size: 15px; text-align: center; }
.ruc { text-align: right; font-size: 13px; line-height: 1.35; color: var(--gris); }
.ruc strong { display: block; color: var(--verde-osc); font-size: 14px; }
h1 {
  text-align: center; font-weight: 400; font-size: clamp(22px, 3.2vw, 34px);
  margin: 26px 16px 14px; letter-spacing: .3px;
}

/* Contenedor y paneles */
.contenedor { max-width: 1140px; margin: 0 auto; padding: 0 16px 30px; }
.panel {
  background: #fff; border: 1px solid var(--verde); border-radius: 4px;
  margin-bottom: 20px; overflow: hidden; box-shadow: 0 2px 6px rgba(0, 80, 30, .06);
}
.panel h2 {
  margin: 0; background: var(--verde); color: #fff; font-size: 16px; font-weight: 600;
  padding: 12px 16px;
}
.panel h2 small { font-size: 15px; font-weight: 600; }
.cuerpo { padding: 22px 24px 26px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 150px; }
.cuerpo.grid { padding-bottom: 32px; }
.full { grid-column: 1 / -1; }

/* Campos tipo "input-group" */
.campo {
  display: flex; align-items: stretch; border: 1px solid var(--borde); border-radius: 3px;
  background: #fff; min-height: 36px; transition: border-color .15s, box-shadow .15s;
}
.campo:focus-within { border-color: var(--verde); box-shadow: 0 0 0 3px rgba(0, 150, 63, .15); }
.campo.error { border-color: #d33; box-shadow: 0 0 0 3px rgba(221, 51, 51, .12); }
.ico, .etiqueta {
  display: flex; align-items: center; justify-content: center;
  background: #f4f7f5; border-right: 1px solid var(--borde); color: var(--verde-osc);
}
.ico { width: 40px; flex: 0 0 40px; }
.ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.etiqueta { padding: 0 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.campo input, .campo select, .campo textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 15px; padding: 7px 12px; color: var(--texto);
}
.campo input[readonly] { background: #f1f3f2; }
.campo input::placeholder, .campo textarea::placeholder { color: #8b958f; }
.campo select { cursor: pointer; }
.con-boton button {
  margin: 4px; border: 0; border-radius: 3px; background: var(--verde); color: #fff;
  font: inherit; font-size: 13px; font-weight: 600; padding: 0 12px; cursor: pointer;
}
.con-boton button:hover { background: var(--verde-osc); }
.con-boton button:disabled { opacity: .6; cursor: wait; }
.area { align-items: stretch; }
.area textarea { resize: vertical; min-height: 110px; }
.contador { text-align: right; font-size: 12px; color: var(--gris); margin-top: 4px; }

/* Autorización */
.panel-autoriza { display: flex; align-items: center; justify-content: space-between; background: var(--verde); }
.panel-autoriza h2 { padding: 14px 16px; }
.opciones { display: flex; gap: 56px; padding: 0 46px 0 16px; color: #fff; font-weight: 700; white-space: nowrap; }
.opciones label { cursor: pointer; display: flex; align-items: center; gap: 6px; }
.opciones input { accent-color: #fff; width: 16px; height: 16px; }

/* Aviso legal */
.aviso { text-align: center; font-size: 12px; line-height: 1.5; padding: 0 30px; }
.aviso strong { font-size: 13px; }
.aviso p { margin: 6px 0 14px; }
.acepto { display: inline-flex; gap: 8px; align-items: flex-start; text-align: left; font-size: 13px; cursor: pointer; max-width: 760px; }
.acepto input { margin-top: 3px; accent-color: var(--verde); }
.acepto.error { color: #c22; }

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

.mensaje { max-width: 640px; margin: 18px auto 0; padding: 10px 14px; border-radius: 4px; background: #fdecec; color: #a11; text-align: center; font-size: 14px; }

.btn-registrar {
  display: block; width: 100%; max-width: 432px; margin: 26px auto 0; padding: 9px;
  border: 1px solid var(--verde-osc); border-radius: 2px; background: var(--verde); color: #fff;
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; transition: background .15s;
}
.btn-registrar:hover { background: var(--verde-osc); }
.btn-registrar:disabled { opacity: .65; cursor: wait; }

.pie { text-align: center; font-size: 12px; color: var(--verde-osc); padding: 10px 0 24px; }

/* Modal constancia (Hoja de Reclamación) */
.modal { position: fixed; inset: 0; background: rgba(0, 40, 15, .55); display: flex; align-items: flex-start; justify-content: center; padding: 24px 12px; z-index: 50; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal-caja { background: #fff; border-radius: 8px; max-width: 840px; width: 100%; padding: 18px 20px 24px; border-top: 6px solid var(--verde); }
.modal-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid #e3e8e5; padding-bottom: 12px; margin-bottom: 14px; }
.modal-caja h3 { margin: 0 0 4px; color: var(--verde-osc); }
.peq { font-size: 13px; color: var(--gris); margin: 0; }
.acciones { display: flex; gap: 10px; }
.acciones button { border: 0; border-radius: 4px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; background: var(--verde); color: #fff; }
.acciones .sec { background: #e7ece9; color: var(--texto); }
.hoja { overflow-x: auto; }

/* Cabecera: logo SUSALUD */
.logo-susalud { height: 46px; display: block; justify-self: end; }

/* Info del establecimiento */
.info-ipress { display: flex; flex-wrap: wrap; gap: 6px 28px; font-size: 13px; background: var(--verde-claro); border-radius: 3px; padding: 8px 12px; }
.info-ipress[hidden] { display: none; }

/* Adjuntos */
.adjuntos { margin-top: 14px; border: 1px dashed var(--borde); border-radius: 4px; padding: 12px 14px; background: #fafcfb; }
.adjuntos input[type=file] { position: absolute; left: -9999px; }
.btn-adjuntar { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--verde); color: var(--verde-osc); border-radius: 3px; padding: 7px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.btn-adjuntar:hover { background: var(--verde-claro); }
.btn-adjuntar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ayuda { font-size: 12px; color: var(--gris); margin: 8px 0 0; }
.lista-adjuntos { list-style: none; margin: 8px 0 0; padding: 0; }
.lista-adjuntos li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; padding: 5px 8px; border-bottom: 1px solid #edf1ee; }
.lista-adjuntos li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-adjuntos button { border: 0; background: none; color: #c22; font-size: 18px; cursor: pointer; line-height: 1; }

/* Firma */
.nota-firma { font-size: 14px; line-height: 1.5; color: #39463f; padding: 16px 24px; }

/* Responsive */
@media (max-width: 900px) {
  .grid { gap: 14px 30px; }
}
@media (max-width: 720px) {
  .cabecera { grid-template-columns: 1fr; text-align: center; gap: 8px; }
  .logo img { margin: 0 auto; height: 60px; }
  .logo-susalud { justify-self: center; height: 38px; }
  .grid { grid-template-columns: 1fr; }
  .cuerpo { padding: 16px; }
  .panel-autoriza { flex-direction: column; align-items: stretch; }
  .opciones { padding: 0 16px 14px; gap: 40px; }
  .aviso { padding: 0 6px; }
}

/* Impresión: solo la Hoja de Reclamación */
@page { size: A4; margin: 10mm; }
@media print {
  body { background: #fff; }
  body > *:not(#constancia) { display: none !important; }
  .modal { position: static; background: none; padding: 0; overflow: visible; }
  .modal-caja { border: 0; padding: 0; max-width: none; }
  .modal-top { display: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
