* { box-sizing: border-box; }
html { scroll-padding-bottom: 96px; scroll-padding-top: 70px; }
body {
  font-family: "Segoe UI", Arial, sans-serif;
  margin: 0; background: #f4f6f9; color: #1f2733;
}
header.top {
  background: #1f4e79; color: #fff; padding: 14px 22px;
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
header.top h1 { font-size: 18px; margin: 0; }
header.top .sub { font-size: 12px; opacity: .85; }
.container { max-width: 1000px; margin: 0 auto; padding: 20px; padding-bottom: 96px; }
.container.wide { max-width: none; }   /* panel de trámites: usa todo el ancho de la página */
.wa-icon { display: inline-flex; vertical-align: middle; margin-left: 6px; line-height: 0; text-decoration: none; }
.wa-icon svg { transition: transform .1s ease; }
.wa-icon:hover svg { transform: scale(1.18); }

/* Solapas de la página de configuración */
.config-tabs { display: flex; gap: 4px; border-bottom: 2px solid #d7e2f0; margin: 4px 0 18px; }
.config-tab {
  background: #eef2f7; color: #5a6473; border: 1px solid #d7e2f0; border-bottom: none;
  padding: 9px 18px; font-size: 14px; cursor: pointer; border-radius: 8px 8px 0 0; margin-bottom: -2px;
}
.config-tab:hover { background: #e2e9f2; }
.config-tab.active { background: #fff; color: #1f4e79; font-weight: 600; border-color: #d7e2f0; border-bottom: 2px solid #fff; }

/* Mensajes predefinidos (config) */
.msg-row { border: 1px solid #dbe4ef; border-radius: 8px; padding: 10px; margin: 0 0 10px; background: #fafcff; }
.msg-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.msg-ord { width: 64px; padding: 6px 8px; border: 1px solid #c4ccd6; border-radius: 6px; font-size: 14px; }
.msg-tit { flex: 1; padding: 6px 8px; border: 1px solid #c4ccd6; border-radius: 6px; font-size: 14px; }
.msg-txt { width: 100%; padding: 8px; border: 1px solid #c4ccd6; border-radius: 6px; font-size: 14px; resize: vertical; box-sizing: border-box; }
.msg-del { flex: 0 0 auto; }

/* Popup de mensajes predefinidos (panel) */
.msgpop { position: absolute; z-index: 60; background: #fff; border: 1px solid #c4ccd6; border-radius: 10px;
  box-shadow: 0 12px 34px rgba(0,0,0,.22); min-width: 240px; max-width: 340px; max-height: 60vh; overflow: auto; padding: 6px; }
.msgpop h4 { margin: 6px 8px 8px; font-size: 13px; color: #1f4e79; }
.msgpop button.msgitem { display: block; width: 100%; text-align: left; background: transparent; border: 0;
  padding: 9px 10px; border-radius: 6px; font-size: 14px; cursor: pointer; color: #22303f; }
.msgpop button.msgitem:hover { background: #eef4fb; }
.msgpop .empty { padding: 10px; font-size: 13px; color: #888; }
/* Fila seleccionada (para completar los mensajes) + indicador */
#grid tr.row-selected > td { background: #fff6d9 !important; box-shadow: inset 3px 0 0 #e0a800; }
.selmsg { font-size: 13px; color: #8a6d00; font-weight: 600; }

/* Fecha de inicio (subtítulo en la celda N°) */
.num .inicio { font-size: 11px; color: #7a8698; font-weight: normal; margin-top: 3px; white-space: nowrap; }

/* Chip de cobro en la grilla */
.cobro-chip { border: 1px solid transparent; border-radius: 14px; padding: 4px 10px; font-size: 12px; font-weight: 700;
  cursor: pointer; white-space: nowrap; }
.cobro-chip.unpaid  { background: #fdecea; color: #b3261e; border-color: #f2c2bd; }
.cobro-chip.partial { background: #fff4de; color: #9a6a00; border-color: #f2dcac; }
.cobro-chip.ok      { background: #e6f4ea; color: #1e7d34; border-color: #b7e0c3; }
.cobro-chip:hover { filter: brightness(0.96); }
#soloImpagos.on { background: #fdecea; color: #b3261e; border-color: #e0a800; font-weight: 700; }

/* Modal de cobro */
.cobro-modal { max-width: 400px; }
.cobro-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.cobro-row label { flex: 0 0 130px; font-size: 13px; color: #444; }
.cobro-row input, .cobro-row select, .cobro-row textarea { flex: 1; padding: 7px 9px; border: 1px solid #c4ccd6; border-radius: 6px; font-size: 14px; }
.cobro-est { margin: 10px 0 4px; font-size: 14px; font-weight: 600; color: #1f4e79; }
.cobro-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
#dashboardBtn.on { background: #e8f0fb; color: #1f4e79; border-color: #1f4e79; font-weight: 700; }

/* Dashboard / resumen */
.dashboard { background: #fff; border: 1px solid #e2e6ec; border-radius: 10px; padding: 16px 18px; margin: 0 0 16px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.dash-loading { color: #777; font-size: 14px; }
.dash-kpis { display: flex; flex-wrap: wrap; gap: 12px; }
.kpi { flex: 1 1 150px; min-width: 140px; background: #f6f9fc; border: 1px solid #e2e6ec; border-radius: 10px; padding: 12px 14px; }
.kpi.warn { background: #fff7ec; border-color: #f2dcac; }
.kpi.ok { background: #eef8f0; border-color: #b7e0c3; }
.kpi-n { font-size: 24px; font-weight: 800; color: #1f4e79; line-height: 1.1; }
.kpi.warn .kpi-n { color: #9a6a00; }
.kpi.ok .kpi-n { color: #1e7d34; }
.kpi-l { font-size: 12px; color: #6a7686; margin-top: 4px; }
.dash-rows { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.dash-line { font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dash-lbl { font-weight: 700; color: #444; margin-right: 4px; }
.dchip { background: #eef3fa; border: 1px solid #d7e2f0; border-radius: 12px; padding: 3px 10px; font-size: 12px; color: #22303f; }
.dchip.unpaid { background: #fdecea; border-color: #f2c2bd; color: #b3261e; }
.dchip.partial { background: #fff4de; border-color: #f2dcac; color: #9a6a00; }
.dchip.ok { background: #e6f4ea; border-color: #b7e0c3; color: #1e7d34; }
.dash-note { color: #8a6d00; font-weight: 600; margin-left: 6px; }

.section { background: var(--brand-section-bg, #fff); border: 1px solid #e2e6ec; border-radius: 8px; margin: 16px 0; overflow: hidden; }
.section > h2 {
  background: var(--brand-section, #1f4e79); color: #fff; margin: 0; padding: 10px 16px; font-size: 15px;
}
.field {
  display: grid; grid-template-columns: 1fr 230px 60px 60px 70px 75px; gap: 12px; align-items: center;
  padding: 9px 16px; border-top: 1px solid #eef1f5;
}
.field:nth-child(odd) { background: #fafbfc; }
.field .label { font-size: 14px; }
.field .label .req { color: #c00000; font-weight: bold; margin-left: 4px; }
.field .label .tag { font-size: 11px; color: #8a93a0; display: block; }

.field-2cols { grid-template-columns: 1fr 320px; }

input[type=text], select, textarea {
  width: 100%; padding: 6px 8px; border: 1px solid #c4ccd6; border-radius: 5px;
  font-size: 14px; background: #fff;
}
textarea { resize: vertical; font-family: inherit; }
.radio-group label { margin-right: 12px; font-size: 14px; white-space: nowrap; }
.date-group { display: flex; gap: 6px; }
.date-group select.date-part { width: auto; flex: 1; }
.date-group input.date-part { padding: 6px 8px; border: 1px solid #c4ccd6; border-radius: 5px; }
.colhead {
  display: grid; grid-template-columns: 1fr 230px 60px 60px 70px 75px; gap: 12px;
  padding: 6px 16px; font-size: 12px; font-weight: bold; color: #5a6473;
  background: #eef2f7; border-top: 1px solid #e2e6ec;
}
.toggle { text-align: center; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-box {
  background: #fff; border-radius: 10px; padding: 22px 26px; width: 560px; max-width: 92vw;
  max-height: 80vh; overflow: auto; box-shadow: 0 12px 44px rgba(0,0,0,.32);
}
.modal-box h3 { margin: 0 0 10px; color: #b26a00; font-size: 18px; }
.modal-box p { margin: 0 0 8px; font-size: 14px; color: #333; }
.miss-list { margin: 8px 0 18px; padding-left: 18px; }
.miss-list li { margin-bottom: 6px; font-size: 14px; }
.modal-box .primary { display: block; margin-left: auto; }
.highlight-missing { outline: 2px solid #c00000; outline-offset: 2px; background: #fff4f4; border-radius: 4px; }

.bar {
  position: sticky; bottom: 0; background: #fff; border-top: 1px solid #e2e6ec;
  padding: 12px 22px; display: flex; gap: 12px; align-items: center; justify-content: flex-end;
}
button.primary {
  background: #1f4e79; color: #fff; border: 0; padding: 10px 20px; border-radius: 6px;
  font-size: 14px; cursor: pointer;
}
button.primary:hover { background: #163a5a; }
.status { font-size: 13px; color: #2e7d32; }
.hidden-row { opacity: .45; }
.repeat-group { border-left: 3px solid #cfe0f3; margin: 4px 0; }
.record { border: 1px solid #dbe3ee; border-radius: 6px; background: #fafcff; margin: 10px 0 12px; padding: 2px 10px 8px; }
.rec-head { font-weight: bold; color: #1f4e79; font-size: 13px; margin: 0 0 6px; padding: 5px 0 4px; border-bottom: 1px solid #e3e9f2; }
button.addmore {
  margin: 6px 0 10px 16px; background: #eaf1fb; color: #1f4e79; border: 1px solid #b9cde8;
  padding: 5px 12px; border-radius: 5px; cursor: pointer; font-size: 13px;
}
button.addmore:hover { background: #dbe7f7; }
.sectitle {
  width: 90%; background: #ffffff; border: 1px solid #b9cde8; color: #1f4e79;
  font-size: 15px; font-weight: bold; padding: 3px 8px; border-radius: 4px;
}
.sectitle:focus { border-color: #fff; outline: 2px solid #cfe0f3; }
.lblinput {
  width: 100%; border: 1px solid #e2e6ec; border-radius: 4px; padding: 4px 6px; font-size: 13px;
}
.lblinput:focus { border-color: #1f4e79; outline: none; }
.clear-default {
  display: inline-block; margin-top: 4px; padding: 1px 6px; font-size: 11px;
  color: #8a93a0; background: #f3f5f8; border: 1px solid #e2e6ec; border-radius: 4px; cursor: pointer;
}
.clear-default:hover { color: #c0392b; border-color: #c0392b; }
.grp-toggle {
  margin-right: 6px; padding: 0 6px; min-width: 34px; font-size: 12px; line-height: 20px;
  color: #1f4e79; background: #eef3f9; border: 1px solid #cddaea; border-radius: 4px; cursor: pointer;
}
.grp-toggle:hover { background: #dfe9f5; }
.grp-toggle b { color: #1f4e79; }
.mini.dlall { background: #455a64; color: #fff; }
/* Estado de visa (CEAC): badge por persona + tinte de fila */
.ceac-badge { display: inline-block; margin-top: 5px; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
.ceac-badge.ceac-refused { background: #fdeaea; color: #b02a2a; border-color: #e6b3b3; }
.ceac-badge.ceac-approved { background: #e8f6ec; color: #1e7a3a; border-color: #b3ddc0; }
.ceac-badge.ceac-waiting { background: #fff5e0; color: #8a6d00; border-color: #e6d090; }
#rows tr.ceacrow-refused td { background: #fcf1f1 !important; }
#rows tr.ceacrow-approved td { background: #f0f9f2 !important; }
.ceac-popup { max-height: 60vh; overflow: auto; font-size: 13px; line-height: 1.5; }
.ceac-popup .status { font-size: 18px; font-weight: bold; margin: 8px 0; }
.ceac-popup .app-name, .ceac-popup .dos { font-weight: bold; }
/* Turno asignado: botón de cita, popup y calendario */
.mini.calbtn { background: #eae6fb; color: #5b3ea8; border-color: #cabfec; font-weight: 600; }
/* Columna Acciones (turno) y Pago (PDF arancel + Cita + PDFs): botones apilados SIN romper la tabla
   (no se toca el display del <td>; solo se apilan los botones internos). */
table.grid td.arancel, table.grid td.pdf-aran { text-align: center; vertical-align: middle; }
table.grid td.arancel .mini, table.grid td.pdf-aran .mini { display: block; width: fit-content; max-width: 100%; box-sizing: border-box; text-align: center; margin: 4px auto 0; white-space: nowrap; }
table.grid td.pdf-aran .pdficon { display: inline-block; }
/* La grilla scrollea DENTRO de su caja si es muy ancha, sin empujar la página. */
.grid-wrap { max-width: 100%; overflow-x: auto; }
.appt-summary { background: #f4f7fb; border: 1px solid #dbe4ef; border-radius: 8px; padding: 10px 12px; font-size: 14px; line-height: 1.7; }
.appt-summary b { color: #1f4e79; }
.cal-list { max-height: 62vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.cal-item { border: 1px solid #e2e6ec; border-left: 4px solid #7a4ea8; border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.6; }
.cal-item.cal-soon { border-left-color: #c0392b; background: #fdf3f2; }
.cal-name { font-weight: bold; color: #1f4e79; margin-bottom: 4px; }
.cal-people { color: #46566b; font-size: 12px; margin-bottom: 4px; }
.appt-people { color: #46566b; font-size: 13px; margin: 4px 0 10px; }
.appt-mini { margin-top: 4px; font-size: 12px; font-weight: 600; color: #1f6a3a; cursor: pointer; white-space: nowrap; }
.appt-mini:hover { text-decoration: underline; }
.cal-del { color: #555; font-size: 12px; }
.secorder {
  width: 56px; margin-right: 8px; padding: 3px; border-radius: 4px;
  border: 1px solid #b9cde8; font-weight: bold; color: #1f4e79;
}
.section > h2 { display: flex; align-items: center; }
.caret { margin-right: 8px; font-size: 12px; width: 12px; display: inline-block; }

/* Ícono de info (ⓘ) con popup, en labels de config */
.infoi {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; background: #1f4e79; color: #fff;
  font-size: 12px; cursor: pointer; vertical-align: middle; user-select: none;
}
.infoi:hover { background: #163a5a; }

/* Banner de credenciales AIS (form admin) */
.creds-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  background: #fff8e6; border: 1px solid #e6cf80; border-radius: 8px;
  padding: 10px 14px; margin: 6px 0 12px; font-size: 14px;
}
.creds-banner .creds-ttl { font-weight: bold; color: #8a6d00; }
.creds-banner .creds-row { display: inline-flex; align-items: center; gap: 6px; }
.creds-banner b { color: #1f2733; }
.creds-banner.wa-banner { flex-wrap: nowrap; gap: 8px; }   /* WhatsApp: todo en una línea */

/* Solapas (form): PRINCIPAL + acompañantes */
.tabbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; }
.tab {
  background: #e8eef6; color: #1f4e79; border: 1px solid #b9cde8; border-bottom: none;
  padding: 8px 16px; border-radius: 8px 8px 0 0; cursor: pointer; font-size: 14px; font-weight: 600;
}
.tab.active { background: #1f4e79; color: #fff; border-color: #1f4e79; }
.tab.addtab { background: #eafbea; color: #2e7d32; border-color: #b6e0b6; font-weight: 600; }
.tab.addtab:hover { background: #d8f3d8; }
.tab .tabx { margin-left: 8px; opacity: .75; font-weight: bold; }
.tab .tabx:hover { opacity: 1; color: #c00000; }

/* Acordeón de secciones (form) */
.sec-head { cursor: pointer; user-select: none; }
.sec-caret { width: 12px; display: inline-block; font-size: 12px; margin-right: 8px; }
.sec-status { margin-right: 8px; font-weight: bold; font-size: 15px; }
.sec-status.ok { color: #36d36b; }
.sec-status.pending { color: #ffd24d; }
.sec-title { flex: 1; }
.sec-body { overflow: hidden; transition: max-height .2s ease; }
.sec-body.collapsed { max-height: 0; }

/* Botón flotante de WhatsApp */
.wa-fab {
  position: fixed; right: 20px; bottom: 78px; z-index: 1200;
  width: 56px; height: 56px; border-radius: 50%; background: #25d366;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.3); text-decoration: none;
}
.wa-fab:hover { background: #1ebe5d; }

/* Panel de trámites (index) */
.addbar { margin: 4px 0 16px; }
.addbar-main { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.addbar-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 10px;
  border-top: 1px solid #eef2f7; padding-top: 10px; }
.addbar .tsep { width: 1px; height: 22px; background: #d7e2f0; margin: 0 4px; }
.addbar .tspace { flex: 1 1 auto; }
.addbar .lastupd { font-size: 12px; color: #8a97a6; white-space: nowrap; }
/* Campo único: busca mientras escribís y sirve para agregar el trámite (con el botón). */
.search-box { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 420px;
  border: 1px solid #c4ccd6; border-radius: 6px; padding: 0 10px; background: #fff; }
.search-box:focus-within { border-color: #1f4e79; box-shadow: 0 0 0 2px rgba(31,78,121,.15); }
.search-box .search-ico { font-size: 15px; opacity: .7; }
.search-box input { flex: 1; border: 0; outline: 0; padding: 8px 0; font-size: 14px; background: transparent; }
table.grid { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e2e6ec; border-radius: 8px; overflow: hidden; }
table.grid th { background: #1f4e79; color: #fff; font-size: 13px; text-align: left; padding: 10px 12px; }
table.grid th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.grid th.sortable:hover { background: #163a5a; }
table.grid th.sortable::after { content: '⇅'; opacity: .4; margin-left: 6px; font-size: 11px; }
table.grid th.sortable[data-dir="asc"]::after { content: '▲'; opacity: 1; }
table.grid th.sortable[data-dir="desc"]::after { content: '▼'; opacity: 1; }
table.grid td { border-top: 1px solid #eef1f5; padding: 8px 12px; font-size: 14px; vertical-align: middle; }
/* (el rayado por trámite reemplaza al rayado por fila — ver #rows tr.grp* abajo) */
table.grid td.num { font-family: monospace; color: #1f4e79; font-weight: bold; }
table.grid td.acts { white-space: nowrap; }
.mini { display: inline-block; background: #eaf1fb; color: #1f4e79; border: 1px solid #b9cde8; padding: 5px 10px; border-radius: 5px; cursor: pointer; font-size: 13px; text-decoration: none; }
.mini:hover { background: #dbe7f7; }
.mini.word { background: #eafbea; color: #2e7d32; border-color: #b6e0b6; }
.mini.word:hover { background: #d8f3d8; }
.mini.ar { background: #fff3d6; color: #8a6d00; border-color: #e6cf80; font-weight: 600; }
.mini[disabled] { opacity: .45; cursor: not-allowed; }
.mini.ar:hover { background: #ffe9b0; }
.pdf .none { color: #b0b7c0; }
/* Columna Nombre más ancha */
table.grid th:nth-child(2), table.grid td:nth-child(2) { min-width: 220px; }
/* Columnas de PDF (ConfDS / APP): angostas y centradas, con ícono colorido */
table.grid th:nth-child(6), table.grid th:nth-child(7) { text-align: center; }
table.grid td:nth-child(6), table.grid td:nth-child(7) { text-align: center; }
a.pdficon { display: inline-block; line-height: 0; text-decoration: none; }
a.pdficon .pdfsvg { display: block; margin: 0 auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.18)); transition: transform .1s ease; }
a.pdficon:hover .pdfsvg { transform: scale(1.14); }
select.estado { padding: 5px 6px; border: 1px solid #b9cde8; border-radius: 5px; font-size: 13px; min-width: 140px; width: 100%; }
table.grid td.estado-cell { min-width: 150px; }
/* Link / Word apilados para angostar la columna "Enviar a usuario" */
.acts-col { display: flex; flex-direction: column; gap: 5px; align-items: stretch; }
.acts-col .mini { text-align: center; }
/* Fila resaltada al volver del fill (?focus=) */
table.grid tr.rowfocus td { background: #fff3cd !important; transition: background .5s ease; box-shadow: inset 0 0 0 9999px rgba(255,210,77,.12); }
.errico { color: #c00000; cursor: pointer; font-size: 16px; margin-left: 4px; vertical-align: middle; }
.delx { background: none; border: 1px solid #e2b6b6; color: #c00000; border-radius: 5px; padding: 4px 9px; cursor: pointer; font-size: 13px; line-height: 1; }
.delx:hover { background: #c00000; color: #fff; border-color: #c00000; }
td.rowacts { white-space: nowrap; display: flex; gap: 5px; align-items: center; }
.mini.arch { background: #f0eefb; color: #5a3e8a; border-color: #cfc4ea; padding: 4px 8px; }
.mini.arch:hover { background: #e4dcf6; }
#toggleArch.on { background: #5a3e8a; color: #fff; border-color: #5a3e8a; }
.finlbl { font-size: 13px; color: #1f4e79; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
/* Rayado por TRÁMITE: el principal y sus acompañantes comparten un tinte; alterna entre trámites
   (así se ve dónde empieza y termina cada trámite, en vez de rayar fila por fila). */
#rows tr.grp0 td { background: #ffffff; }
#rows tr.grp1 td { background: #eef4fb; }
#rows tr.childrow td { border-top: 1px dashed #d7e2f0; color: #33465c; }
#rows tr.childrow td.num { text-align: center; color: #7a93b5; font-weight: normal; }
/* Vista de archivados: toda la grilla toma el color de marca "Grilla Archivados". */
#rows.arch-view tr td { background: var(--brand-archived, #f6f0e2); }
#rows.arch-view tr.grp1 td { background: var(--brand-archived-alt, #efe7d2); }
/* Trámite archivado que aparece en la búsqueda de activos: mismo color + badge. */
#rows tr.arch-match td { background: var(--brand-archived, #f6f0e2) !important; }
.arch-badge { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; color: #8a6d00;
  background: #fbf3d9; border: 1px solid #e6d59a; border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.subt { color: #8a93a0; font-size: 12px; }
.lastupd { font-size: 12px; color: #8a93a0; }
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 2000; max-width: 360px;
  background: #1f4e79; color: #fff; padding: 12px 16px; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.28); font-size: 14px; line-height: 1.35;
  opacity: 0; transform: translateY(12px); transition: opacity .3s ease, transform .3s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Popup de progreso del turno/arancel (showTurnoProgress). En celular se agranda y el log se ve más grande. */
.tp-modal { width: 540px; max-width: 96vw; }
.tp-log { max-height: 220px; font-size: 12px; line-height: 1.4; }
@media (max-width: 760px) {
  .tp-modal { width: 96vw; padding: 16px; }
  .tp-modal h3 { font-size: 20px; }
  .tp-log { max-height: 55vh; font-size: 14px; }
  #tp-step { font-size: 15px; }
  #tp-pct { font-size: 15px; }
}

/* ============================================================
   Responsive / celular (solo hasta 760px; el desktop no cambia)
   ============================================================ */
@media (max-width: 760px) {
  /* --- FORMULARIO --- Apila etiqueta sobre el control para que cada campo
     use TODO el ancho del celular (antes el control iba en una columna fija
     de 320px que se salía de pantalla). */
  .field, .field.field-2cols { grid-template-columns: 1fr; gap: 4px 0; }
  .field .label { font-weight: 600; }
  .radio-group label { display: inline-block; margin: 2px 12px 2px 0; }

  /* Fechas: día y mes compactos (al tamaño de su contenido) y el año SIEMPRE
     visible; alineados a la izquierda en vez de estirados a lo ancho. */
  .date-group { flex-wrap: nowrap; justify-content: flex-start; }
  .date-group select.date-part { width: auto; flex: 0 0 auto; min-width: 62px; }
  .date-group input.date-part { flex: 0 0 auto; width: 72px; }

  /* --- GRILLA (panel del gestor) --- Que la página se ensanche con la tabla
     para poder hacer zoom-out y verla entera, y que el header y la barra de
     acciones acompañen ese ancho (antes el header quedaba más angosto). */
  body:has(.container.wide) { min-width: max-content; }
  .container.wide { padding-left: 12px; padding-right: 12px; }
  .grid-wrap { overflow-x: visible; }
}

/* --- Franja de metadatos del trámite (sede + subtipo de visa) --- */
.meta-strip {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin: 10px 0 14px;
}
.meta-chip {
  background: #eef4ff; border: 1px solid #cfe0f3; color: #1f3d63;
  border-radius: 999px; padding: 6px 14px; font-size: 14px;
}
.meta-chip b { color: #12365e; font-weight: 700; margin-right: 4px; }
@media (prefers-color-scheme: dark) {
  .meta-chip { background: #16283d; border-color: #24466b; color: #cfe0f3; }
  .meta-chip b { color: #9ec5f0; }
}
.meta-loc-sel { font-size: 14px; padding: 3px 6px; border-radius: 6px; border: 1px solid #cfe0f3; max-width: 300px; }
.meta-note { margin-left: 8px; font-size: 12px; }
.meta-note.ok { color: #2e7d32; }
.meta-note.warn { color: #b26a00; }
@media (prefers-color-scheme: dark) {
  .meta-loc-sel { background: #16283d; color: #cfe0f3; border-color: #24466b; }
  .meta-note.ok { color: #7fd18b; }
  .meta-note.warn { color: #e0a552; }
}
.num .tflag { width: 22px; height: 16px; vertical-align: -3px; margin-right: 2px; border: 1px solid rgba(0,0,0,.12); border-radius: 2px; object-fit: cover; }
.meta-visa-sel { font-size: 14px; padding: 3px 6px; border-radius: 6px; border: 1px solid #cfe0f3; max-width: 320px; }
@media (prefers-color-scheme: dark) { .meta-visa-sel { background: #16283d; color: #cfe0f3; border-color: #24466b; } }

/* --- Bloque de subida de foto del solicitante --- */
.photo-block { margin: 10px 0 16px; padding: 14px 16px; border: 1px solid #cfe0f3; border-radius: 10px; background: #f5f9ff; }
.photo-block h3 { margin: 0 0 4px; font-size: 17px; color: #12365e; }
.photo-req { font-size: 12px; color: #b26a00; font-weight: 600; }
.photo-help { margin: 0 0 10px; font-size: 13px; color: #46566b; }
.photo-preview { display: block; width: 150px; height: 150px; object-fit: cover; border: 1px solid #cfe0f3; border-radius: 8px; margin: 10px 0 6px; }
.photo-status { font-size: 13px; color: #2e7d32; }

/* Recorte guiado de la foto (modal) */
.crop-modal { max-width: 420px; }
.crop-help { font-size: 13px; color: #555; margin: 2px 0 12px; }
.crop-stage { position: relative; margin: 0 auto; border-radius: 8px; overflow: hidden;
  background: #eef2f7; box-shadow: inset 0 0 0 1px #c4ccd6; touch-action: none; cursor: grab; }
.crop-stage:active { cursor: grabbing; }
.crop-img { position: absolute; top: 0; left: 0; user-select: none; -webkit-user-drag: none; }
.crop-guides { position: absolute; inset: 0; pointer-events: none; }
.crop-guides svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0 1px rgba(0,0,0,.6)); }
.crop-zoom { width: 100%; margin: 14px 0 2px; }
.crop-msg { min-height: 18px; font-size: 13px; color: #b26a00; margin: 4px 0; }
.crop-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

@media (prefers-color-scheme: dark) {
  .photo-block { background: #14202f; border-color: #24466b; }
  .photo-block h3 { color: #9ec5f0; }
  .photo-help { color: #9fb0c4; }
  .crop-help { color: #9fb0c4; }
  .crop-stage { background: #0f1722; box-shadow: inset 0 0 0 1px #24466b; }
}
