/* De Salas Firma — negro y azul #104D97, esquinas rectas, Inter */
@font-face { font-family: Inter; src: url(fonts/inter-latin.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: Firma; src: url(fonts/firma-delafield.woff2) format("woff2"); font-display: swap; }
:root { --azul: #104D97; --azul-o: #0B3A73; --negro: #111; --gris: #666; --linea: #e3e3e3; --fondo: #f5f5f3; --rojo: #B4462C; --verde: #2E7D4F; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 Inter, system-ui, -apple-system, Segoe UI, sans-serif; color: var(--negro); background: var(--fondo); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--azul); }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; margin: 22px 0 8px; color: var(--gris); }
.tenue { color: var(--gris); } .peq { font-size: 13px; } .centro { text-align: center; } .rompe { word-break: break-all; }
.peligro { color: var(--rojo) !important; }

.barra { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--linea); position: sticky; top: 0; z-index: 20; }
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--negro); }
.marca img { height: 36px; width: auto; display: block; }
.marca span { font-weight: 600; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--azul); border-left: 1px solid var(--linea); padding-left: 10px; }
.menu { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.menu > a:not(.btn) { color: var(--negro); text-decoration: none; font-weight: 500; }
.menu > a:not(.btn):hover { color: var(--azul); }
.quien { font-size: 13px; color: var(--gris); }
.contenido { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 24px 48px; }
.pie { text-align: center; font-size: 12px; color: var(--gris); padding: 18px 16px 24px; }
.pie a { color: var(--gris); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; font: 600 14px/1.2 Inter, sans-serif; border: 1px solid transparent; border-radius: 0; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-azul { background: var(--azul); color: #fff; } .btn-azul:hover { background: var(--azul-o); }
.btn-azul:disabled { background: #9db3cf; cursor: not-allowed; }
.btn-linea { background: #fff; color: var(--negro); border-color: #cfcfcf; } .btn-linea:hover { border-color: var(--negro); }
.btn-peligro { background: var(--rojo); color: #fff; }
.btn.peq { padding: 6px 12px; font-size: 13px; }
.ancho { width: 100%; }
.enlace { background: none; border: 0; padding: 0; color: var(--azul); cursor: pointer; font: inherit; text-decoration: underline; text-align: left; }

input, select, textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #cfcfcf; border-radius: 0; background: #fff; color: var(--negro); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--azul); outline-offset: -1px; border-color: var(--azul); }
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 14px; }
label > input, label > select, label > textarea { margin-top: 5px; font-weight: 400; font-size: 15px; }
.chk { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 14px; }
.chk input { width: auto; margin-top: 3px; }
input.codigo { font-size: 28px; letter-spacing: .4em; text-align: center; font-weight: 700; }

.tarjeta { background: #fff; border: 1px solid var(--linea); padding: 24px; }
.estrecha { max-width: 460px; margin: 24px auto; }
.rejilla-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.cab-pagina { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.acciones form { margin: 0; }
.aviso { padding: 12px 16px; margin: 0 0 16px; border-left: 4px solid; background: #fff; }
.aviso-error { border-color: var(--rojo); background: #fbf1ee; }
.aviso-ok { border-color: var(--verde); background: #eef7f1; }
.aviso-info { border-color: var(--azul); background: #eef3fa; }
blockquote { margin: 12px 0 18px; padding: 6px 0 6px 14px; border-left: 3px solid var(--azul); color: #333; }

.pestanas { display: flex; gap: 2px; border-bottom: 1px solid var(--linea); margin-bottom: 16px; overflow-x: auto; }
.pestanas a { padding: 9px 14px; text-decoration: none; color: var(--gris); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.pestanas a.activa { color: var(--negro); border-bottom-color: var(--azul); }
.buscar { display: flex; gap: 14px; align-items: center; }
.buscar input[type=search] { width: 320px; }
.buscar .chk { margin: 0; white-space: nowrap; }

.tabla { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--linea); }
.tabla th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--gris); padding: 10px 14px; border-bottom: 1px solid var(--linea); }
.tabla td { padding: 12px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.tabla tr:hover td { background: #fafbfd; }
.titulo-sobre { font-weight: 600; color: var(--negro); text-decoration: none; } .titulo-sobre:hover { color: var(--azul); }
.vacio { background: #fff; border: 1px dashed #cfcfcf; padding: 48px 24px; text-align: center; }

.estado { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border: 1px solid; white-space: nowrap; }
.estado-borrador { color: var(--gris); border-color: #ccc; }
.estado-enviado, .estado-sellando, .estado-f-enviado, .estado-f-verificado { color: var(--azul); border-color: #b7c9e2; background: #f1f5fb; }
.estado-completado, .estado-f-firmado { color: var(--verde); border-color: #b9dcc6; background: #f0f8f3; }
.estado-rechazado, .estado-anulado, .estado-caducado, .estado-f-rechazado { color: var(--rojo); border-color: #e6c0b5; background: #fcf3f0; }
.estado-f-pendiente { color: var(--gris); border-color: #ddd; }

.soltar { border: 2px dashed #c8c8c8; padding: 34px 16px; text-align: center; cursor: pointer; font-weight: 400; background: #fafafa; }
.soltar.encima { border-color: var(--azul); background: #f1f5fb; }
.soltar input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.soltar span { display: block; font-weight: 600; } .soltar small { color: var(--gris); }
.lista-plantillas { list-style: none; margin: 0; padding: 0; }
.lista-plantillas li { border-bottom: 1px solid #f0f0f0; padding: 10px 0; }
.lista-plantillas .enlace { text-decoration: none; display: flex; flex-direction: column; color: var(--negro); }

.firmantes { margin: 0; padding-left: 20px; }
.firmantes li { padding: 10px 0; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.firmantes li::marker { color: var(--gris); }
.eventos { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow: auto; }
.eventos li { padding: 8px 0; border-bottom: 1px solid #f3f3f3; }
.anular { margin-top: 18px; } .anular summary { cursor: pointer; color: var(--rojo); font-size: 13px; }
.anular form { margin-top: 12px; }
.datos { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; }
.datos dt { font-weight: 600; } .datos dd { margin: 0; }

/* ── Editor ── */
.p-editor .contenido, .p-firma-doc .contenido { max-width: none; padding: 0; }
.p-editor .pie { display: none; }
.editor { display: grid; grid-template-columns: 300px 1fr 240px; height: calc(100vh - 57px); }
.panel-izq, .panel-der { background: #fff; overflow-y: auto; padding: 18px; }
.panel-izq { border-right: 1px solid var(--linea); }
.panel-der { border-left: 1px solid var(--linea); display: flex; flex-direction: column; gap: 10px; }
.panel-der form { margin-top: 8px; }
.lienzo { overflow: auto; padding: 24px; background: #e9e9e6; }
.cargando { text-align: center; color: var(--gris); padding: 60px; }
.pagina { position: relative; margin: 0 auto 18px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.pagina canvas { display: block; width: 100%; height: auto; }
.pagina .num { position: absolute; right: -2px; top: -18px; font-size: 11px; color: var(--gris); }
.colocando .pagina { cursor: crosshair; }

.firmante { border: 1px solid var(--linea); border-left: 4px solid var(--c); padding: 10px; margin-bottom: 10px; cursor: pointer; }
.firmante.activo { box-shadow: 0 0 0 2px var(--c) inset; background: #fbfcfe; }
.firmante .fila { display: flex; gap: 6px; }
.firmante input { padding: 6px 8px; font-size: 13px; margin: 0 0 6px; }
.firmante .cab { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; color: var(--c); margin-bottom: 6px; }
.firmante .cab button { background: none; border: 0; color: var(--gris); cursor: pointer; font-size: 16px; padding: 0 4px; }
.paleta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.paleta button { padding: 9px 8px; border: 1px solid #cfcfcf; background: #fff; cursor: pointer; font: 500 13px Inter, sans-serif; text-align: left; border-radius: 0; }
.paleta button:hover { border-color: var(--azul); }
.paleta button.activo { background: var(--azul); color: #fff; border-color: var(--azul); }
.leyenda { font-size: 12px; color: var(--gris); margin-top: auto; }
#e-problemas .aviso { font-size: 13px; padding: 8px 10px; }
#e-problemas ul { margin: 4px 0 0; padding-left: 16px; }

.campo { position: absolute; border: 1.5px solid var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); font: 600 11px/1.1 Inter, sans-serif; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; user-select: none; touch-action: none; cursor: move; }
.campo .x { position: absolute; top: -1px; right: -1px; width: 16px; height: 16px; background: var(--c); color: #fff; border: 0; font-size: 11px; line-height: 16px; padding: 0; cursor: pointer; display: none; }
.campo .tam { position: absolute; right: 0; bottom: 0; width: 10px; height: 10px; background: var(--c); cursor: nwse-resize; display: none; }
.campo:hover .x, .campo:hover .tam, .campo.sel .x, .campo.sel .tam { display: block; }
.campo.sel { outline: 2px dashed var(--c); outline-offset: 2px; }

/* ── Firma ── */
.p-firma .contenido { max-width: 1100px; }
.firma-cab { position: sticky; top: 57px; z-index: 15; background: #fff; border-bottom: 1px solid var(--linea); padding: 10px 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.firma-progreso { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.lienzo-firma { padding: 24px 12px; min-height: 60vh; }
.lienzo-firma .pagina { max-width: 900px; }
.cf { position: absolute; border: 2px solid var(--azul); background: rgba(16,77,151,.08); display: flex; align-items: center; justify-content: center; cursor: pointer; font: 600 12px Inter, sans-serif; color: var(--azul); overflow: hidden; }
.cf.req::after { content: "*"; position: absolute; top: 0; right: 3px; color: var(--rojo); }
.cf.hecho { border-color: var(--verde); background: rgba(46,125,79,.06); }
.cf.foco { box-shadow: 0 0 0 4px rgba(16,77,151,.35); animation: latido 1s ease 2; }
@keyframes latido { 50% { box-shadow: 0 0 0 9px rgba(16,77,151,.12); } }
.cf img { max-width: 100%; max-height: 100%; }
.cf input[type=text] { border: 0; background: transparent; padding: 0 3px; height: 100%; font-size: 12px; outline: none; }
.cf input[type=checkbox] { width: 70%; height: 70%; margin: 0; }
.cf .txt { font-weight: 400; color: #000; white-space: nowrap; font-size: 12px; }
.firma-final { max-width: 900px; margin: 0 auto 40px; background: #fff; border: 1px solid var(--linea); padding: 20px 24px; }
.firma-final .acciones { margin: 14px 0 10px; }
.modal { border: 0; padding: 0; width: min(720px, 94vw); border-radius: 0; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal::backdrop { background: rgba(0,0,0,.45); }
.modal-caja { padding: 22px; }
.modal canvas { width: 100%; height: auto; aspect-ratio: 3/1; border: 1px solid #cfcfcf; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.modal .acciones { justify-content: flex-end; margin-top: 14px; }
.firma-tipo { font-family: Firma, cursive; font-size: 56px; min-height: 110px; padding: 10px; border: 1px solid #eee; margin-top: 10px; color: #0b1f45; overflow: hidden; white-space: nowrap; }
.p-verificar .estrecha { max-width: 560px; }

@media (max-width: 960px) {
  .editor { grid-template-columns: 1fr; height: auto; }
  .panel-der { border-left: 0; border-top: 1px solid var(--linea); }
  .lienzo { max-height: none; }
  .rejilla-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .barra { padding: 8px 16px; flex-wrap: wrap; }
  .menu { gap: 12px; font-size: 14px; }
  .contenido { padding: 18px 16px 40px; }
  .buscar, .buscar input[type=search] { width: 100%; }
  .tabla thead { display: none; }
  .tabla, .tabla tbody, .tabla tr, .tabla td { display: block; width: 100%; }
  .tabla tr { border-bottom: 1px solid var(--linea); }
  .tabla td { border: 0; padding: 6px 14px; }
  .firma-cab { top: 0; padding: 10px 16px; }
  .lienzo-firma { padding: 12px 6px; }
  .firma-final { margin: 0 8px 30px; padding: 16px; }
  .firma-tipo { font-size: 40px; }
}
