@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #F3F4F6;
  --surface: #FFFFFF;
  --surface-alt: #F2EEE3;
  --ink: #182A44;
  --ink-soft: #5C6C80;
  --accent: #16294C;
  --accent-ink: #FFFFFF;
  --gold: #93793C;
  --warn: #BD8323;
  --danger: #B23A2E;
  --ok: #3E8B5E;
  --info: #3569A8;
  --border: #E3DECF;
  --shadow: 0 1px 2px rgba(22,41,76,0.06);
  --radius: 12px;
  --band: #16294C; --band-ink: #F4F1E6; --band-soft: #A9B8CE; --band-gold: #C9AF6E; --band-line: rgba(255,255,255,0.14);
  --logo-navy: #1F3A68;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1826; --surface: #17263D; --surface-alt: #1C2E48; --ink: #EDE7D6; --ink-soft: #9FB0C4;
    --accent: #7DA0D6; --accent-ink: #0F1826; --gold: #C9AF6E; --warn: #DBA83F; --danger: #E08370;
    --ok: #6FBE8C; --info: #7DA0D6; --border: #263750; --shadow: 0 1px 2px rgba(0,0,0,0.3); --band: #0A1420; --band-line: rgba(255,255,255,0.10); --logo-navy: #E8E2CF;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1826; --surface: #17263D; --surface-alt: #1C2E48; --ink: #EDE7D6; --ink-soft: #9FB0C4;
  --accent: #7DA0D6; --accent-ink: #0F1826; --gold: #C9AF6E; --warn: #DBA83F; --danger: #E08370;
  --ok: #6FBE8C; --info: #7DA0D6; --border: #263750; --shadow: 0 1px 2px rgba(0,0,0,0.3); --band: #0A1420; --band-line: rgba(255,255,255,0.10); --logo-navy: #E8E2CF;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 'IBM Plex Sans', system-ui, sans-serif; }
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; color: var(--ink); line-height: 1.2; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.btn { font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 10px; padding: 11px 18px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); min-height: 44px; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-sec { background: var(--surface); color: var(--accent); border-color: var(--border); }
.btn-link { background: none; border: 0; color: var(--accent); padding: 6px 0; min-height: 0; text-decoration: underline; font-weight: 500; }
.btn-peligro { background: var(--danger); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-chico { padding: 6px 12px; min-height: 34px; font-size: 14px; }

input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); width: 100%;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; }

.tarjeta { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }

/* Campos del formulario */
.campo { margin: 0 0 20px; }
.etiqueta { display: block; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--danger); }
.ayuda { color: var(--ink-soft); font-size: 14px; margin: -2px 0 8px; }
.sec-desc { color: var(--ink-soft); margin-top: 0; }
.con-error input, .con-error select, .con-error textarea, .con-error .opciones, .con-error canvas { border-color: var(--danger); }
.con-error .opciones { border: 1px solid var(--danger); border-radius: 10px; padding: 6px; }
.msg-error { color: var(--danger); font-size: 14px; margin-top: 6px; }
.aviso { background: var(--surface-alt); border-left: 4px solid var(--gold); border-radius: 8px; padding: 14px 16px; margin: 0 0 20px; font-weight: 500; }
.subtitulo { font-size: 19px; margin: 28px 0 14px; padding-top: 18px; border-top: 1px solid var(--border); }

.opciones { display: grid; gap: 8px; }
.opciones.en-linea { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.opcion { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; background: var(--surface); min-height: 44px; }
.opcion input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--accent); flex: none; }
.opcion:has(input:checked) { border-color: var(--accent); background: var(--surface-alt); font-weight: 600; }

.archivos { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.archivo { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px 6px 6px; background: var(--surface); max-width: 100%; }
.archivo img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.archivo span:not(.icono-archivo), .archivo a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.icono-archivo { width: 44px; height: 44px; display: grid; place-items: center; background: var(--surface-alt); border-radius: 6px; font-size: 12px; font-weight: 700; color: var(--ink-soft); flex: none; }
.quitar { border: 0; background: none; color: var(--ink-soft); font-size: 22px; cursor: pointer; padding: 0 6px; line-height: 1; }
.subiendo { font-size: 14px; color: var(--ink-soft); }

.firma canvas { width: 100%; max-width: 700px; aspect-ratio: 700 / 220; background: #fff; border: 1px dashed var(--border); border-radius: 10px; touch-action: none; display: block; }
.firma-pie { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; max-width: 700px; }

.lista { display: grid; gap: 12px; }
.fila { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px 4px; margin: 0; }
.fila legend { font-weight: 700; padding: 0 6px; font-family: 'Fraunces', Georgia, serif; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.subcampo { margin-bottom: 10px; }
.subcampo label { display: block; font-size: 14px; color: var(--ink-soft); margin-bottom: 4px; }

/* Vista de solo lectura */
.bloque-datos { margin-bottom: 22px; }
.bloque-datos h3 { font-size: 18px; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--gold); }
.datos { display: grid; grid-template-columns: minmax(150px, 38%) 1fr; gap: 0; margin: 0; }
.datos dt, .datos dd { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--border); margin: 0; }
.datos dt { color: var(--ink-soft); font-size: 14px; }
.datos dd { white-space: pre-wrap; word-break: break-word; }
.datos dd.vacio { color: var(--ink-soft); }
.datos .dt-sub { grid-column: 1 / -1; font-family: 'Fraunces', Georgia, serif; color: var(--ink); font-size: 16px; padding-top: 16px; }
.datos .dd-sub { display: none; }
.archivos-leer { display: flex; flex-wrap: wrap; gap: 10px; }
.archivo-leer { display: flex; flex-direction: column; gap: 4px; text-decoration: none; font-size: 13px; max-width: 140px; color: var(--accent); }
.archivo-leer img { width: 140px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-alt); }
.archivo-leer img.firma-img { object-fit: contain; background: #fff; }
.archivo-leer span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archivo-leer .icono-archivo { width: 140px; height: 110px; }
.lista-leer div { margin-bottom: 4px; }
@media (max-width: 560px) {
  .datos { grid-template-columns: 1fr; }
  .datos dt { border-bottom: 0; padding-bottom: 0; }
}

/* Estados */
.estado { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; border: 1px solid currentColor; }
.estado-borrador { color: var(--ink-soft); }
.estado-recibida { color: var(--info); }
.estado-en_revision { color: var(--gold); }
.estado-faltan_documentos { color: var(--warn); }
.estado-aprobada { color: var(--ok); }
.estado-rechazada { color: var(--danger); }

.cargando { color: var(--ink-soft); padding: 30px; text-align: center; }
.aviso-error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.aviso-ok { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ok); border-radius: 10px; padding: 12px 14px; margin: 12px 0; }

/* ===== Logo oficial, igual que en las otras apps de Shevet Ahim:
   en la banda azul va el escudo y el texto en blanco, con línea dorada abajo;
   en la pantalla de entrada, vertical con sus colores ===== */
.banda { background: var(--band); color: var(--band-ink); border-bottom: 1px solid var(--band-gold); }
.banda-in { max-width: 1240px; margin: 0 auto; padding: 16px 16px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.lockup { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }
.lockup img { height: 44px; width: auto; }
.lk-text { font-family: 'Times New Roman', Times, 'Liberation Serif', serif; color: var(--logo-navy); text-align: center; line-height: 1.08; white-space: nowrap; }
.banda .lk-text { color: #FFFFFF; }
.lk-1 { font-size: 15px; letter-spacing: 0.02em; }
.lk-2 { font-size: 9.5px; margin-top: 2px; }
.lk-3 { font-size: 7px; margin-top: 2px; }
.app-title { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 24px; color: var(--band-ink); padding-left: 22px; border-left: 1px solid var(--band-gold); margin: 0; line-height: 1.2; }
.app-title small { display: block; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 13px; font-weight: 500; color: var(--band-gold); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 2px; }
.lockup.lockup-grande { gap: 10px; margin: 4px auto 18px; }
.lockup.lockup-grande img { height: 96px; }
.lockup.lockup-grande .lk-1 { font-size: 25px; }
.lockup.lockup-grande .lk-2 { font-size: 15.5px; }
.lockup.lockup-grande .lk-3 { font-size: 10.5px; margin-top: 4px; }
@media (max-width: 560px) {
  .banda-in { gap: 14px; }
  .lockup img { height: 36px; }
  .lk-1 { font-size: 12.5px; } .lk-2 { font-size: 8px; } .lk-3 { font-size: 6px; }
  .app-title { font-size: 19px; padding-left: 14px; }
  .app-title small { font-size: 11px; }
}
