/* =========================
   Fuentes: via Google Fonts (en HTML)
========================= */

/* =========================
   Variables
========================= */
:root {
  --cg-blue: #004367;
  --cg-gray-light: #9e9e9e;
  --cg-gray-dark: #6c6c6c;

  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;

  --danger: #b91c1c;

  --shadow: 0 1px 10px rgba(0, 0, 0, 0.06);
  --radius: 12px;

  /* Preview */
  --sig-master-w: 1611;
  --sig-master-h: 332;
  --sig-preview-w: 650; /* default */
  --sig-scale: 0.403475; /* 650 / 1611 */
  --sig-preview-h: 134px; /* 332 * 0.403475 â‰ˆ 133.95 */
}

/* =========================
   Reset
========================= */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* =========================
   Header compacto
========================= */
.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.app-header__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
}
.app-title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.app-title__kicker {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.app-title__main {
  font-size: 16px;
  font-weight: 700;
}
.app-status {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: right;
}
.status-pill {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-weight: 600;
}
.status-pill--ok {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
  color: #166534;
}
.status-pill--warn {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
}
.status-text {
  font-size: 12px;
  color: var(--muted);
  max-width: 320px;
}

/* =========================
   Layout compacto 2 columnas
========================= */
.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 16px 16px;
}
.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

/* =========================
   Cards
========================= */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card--preview {
  overflow: visible;
}

.card__header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
}
.card__header--tight {
  padding: 10px 14px 8px;
}
.card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}
.card__subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.card__content {
  padding: 12px 14px;
}
.card__content--tight {
  padding: 10px 14px 12px;
}
.card__footer {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
}
.card__footer--tight {
  padding: 10px 14px;
}

/* =========================
   Form compacto (2x2)
========================= */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 10px;
  font-size: 13px;
  outline: none;
  background: #fff;
}
.field input:focus {
  border-color: rgba(0, 67, 103, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 67, 103, 0.10);
}

/* =========================
   Foto (compacta)
========================= */
.photo-block { margin-top: 12px; }
.photo-block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.photo-block__title {
  font-size: 12px;
  font-weight: 800;
}
.photo-block__hint {
  font-size: 11px;
  color: var(--muted);
}

.photo-upload {
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #fafafa;
  height: 160px;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

/* SECCIÃ“N B - INPUT FOTO INVISIBLE */
.photo-input{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  opacity:0;
  cursor:pointer;
  z-index:2;
}

.photo-upload.dragover {
  border-color: rgba(0, 67, 103, 0.8);
  background: rgba(0, 67, 103, 0.04);
}
.photo-placeholder {
  text-align: center;
  padding: 10px;
  color: var(--muted);
  z-index:1;
}
.photo-placeholder__plus {
  font-size: 36px;
  line-height: 1;
  color: #9ca3af;
  margin-bottom: 6px;
}
.photo-placeholder__text {
  font-size: 12px;
}
.photo-preview {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  z-index:1;
}
.photo-preview img {
  width: 124px;
  height: 124px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #fff;
}

.photo-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.missing-list {
  margin-top: 10px;
  font-size: 12px;
  color: var(--danger);
}

/* =========================
   Botones
========================= */
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.actions-hint {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}
.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--cg-blue);
  color: #fff;
  border-color: rgba(0, 67, 103, 0.8);
}
.btn--ghost {
  background: #fff;
}
.btn--danger {
  background: rgba(185, 28, 28, 0.08);
  border-color: rgba(185, 28, 28, 0.25);
  color: var(--danger);
}
.btn--pack {
  height: 42px;
  padding: 0 20px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--cg-blue) 0%, #006699 100%);
  border-color: var(--cg-blue);
}
.btn--pack:hover:not(:disabled) {
  background: linear-gradient(135deg, #005580 0%, #004367 100%);
}
.btn--secondary {
  background: #fff;
  color: var(--cg-blue);
  border-color: var(--cg-blue);
}
.btn--secondary:hover:not(:disabled) {
  background: rgba(0, 67, 103, 0.05);
}
.btn--copy {
  height: 42px;
  padding: 0 16px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn--success {
  background: rgba(34, 197, 94, 0.1) !important;
  border-color: rgba(34, 197, 94, 0.5) !important;
  color: #166534 !important;
}
.btn__icon {
  font-size: 16px;
}

/* =========================
   Preview (650) sin recortes
========================= */
.preview-frame {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  overflow-x: auto;
}

.signature-stage {
  width: 650px;
  height: 134px;
  margin: 0 auto;
  position: relative;
  overflow: visible;
}
.signature-scale-wrap {
  transform: scale(0.4035);
  transform-origin: top left;
  width: 1611px;
  height: 332px;
}
.signature-master {
  width: 1611px;
  height: 332px;
  background: #fff;
  position: relative;
  overflow: visible;
}

/* Texto placeholder en preview */
.sig-placeholder {
  width: 1611px;
  height: 332px;
  display: grid;
  place-items: center;
  color: #9ca3af;
  font-size: 22px;
  font-weight: 800;
  font-family: system-ui, sans-serif;
}

/* =========================
   Instructivo compacto
========================= */
.mini-instructions__title {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.mini-instructions__list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

/* =========================
   Modal Crop
========================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
}
.modal__panel {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 32px);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  flex-direction: column;
}
.modal__header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal__title {
  font-size: 14px;
  font-weight: 900;
}
.modal__subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.modal__body {
  padding: 12px 14px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.crop-container {
  max-height: 50vh;
}
.crop-container img {
  max-width: 100%;
  display: block;
}
.modal__footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* =========================
   Responsive
========================= */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .app-status { display: none; }
}

@media (max-height: 600px) {
  .crop-container {
    max-height: 35vh;
  }
  .modal__header {
    padding: 8px 12px;
  }
  .modal__body {
    padding: 8px 12px;
  }
  .modal__footer {
    padding: 8px 12px;
  }
}