/* ============================================================
   hm-app.css — App de campo del operario (private/app/shell.php)
   Diseño: artifact «HomeManager · App de campo».
   Móvil primero; en pantallas anchas se centra a 560 px.
   ============================================================ */
:root {
  --navy: #1e2a44;
  --teal: #0f766e;
  --teal-claro: #e0f2f1;
  --fondo: #f4f6f9;
  --caja: #ffffff;
  --texto: #1f2937;
  --gris: #6b7280;
  --linea: #e3e8ef;
  --aviso: #9a3412;
  --aviso-fondo: #fff7ed;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fondo); }
body { font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--texto);
       -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
       background: var(--fondo); }
.app-main { flex: 1; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.app-cargando { padding: 60px 20px; text-align: center; color: var(--gris); }

/* ── Cabecera de «Hoy» ── */
.app-cab { background: var(--navy); color: #fff; padding: calc(18px + env(safe-area-inset-top)) 20px 20px;
           display: flex; flex-direction: column; gap: 14px; }
.app-cab-fecha { font-size: 13px; color: #b9c3d6; }
.app-cab-hola { margin: 2px 0 0; font: 700 22px "Exo 2", sans-serif; }
.app-cifras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.app-cifra { background: rgba(255,255,255,.08); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.app-cifra b { font: 700 22px "Exo 2", sans-serif; }
.app-cifra span { font-size: 12px; color: #b9c3d6; }

/* ── Barra superior de pantallas interiores ── */
.app-barra { position: sticky; top: 0; z-index: 2; background: var(--caja); border-bottom: 1px solid var(--linea);
             padding: calc(10px + env(safe-area-inset-top)) 12px 12px; display: flex; align-items: center; gap: 8px; }
.app-barra-tit { flex: 1; min-width: 0; padding-left: 6px; }
.app-barra-tit h1 { margin: 0; font: 700 19px "Exo 2", sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-barra-tit span { font-size: 13px; color: var(--gris); }

.app-cuerpo { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.app-cuerpo.con-pie { padding-bottom: 100px; }

/* ── Pastillas Hoy / Mañana / Semana ── */
.app-pastillas { display: flex; gap: 8px; }
.app-pastilla { height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid #d5dbe5; background: var(--caja);
                font-weight: 500; font-size: 14px; color: #374151; cursor: pointer; }
.app-pastilla.on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }

.app-dia { margin: 8px 0 -2px; font-size: 12px; font-weight: 600; color: var(--gris); text-transform: uppercase; letter-spacing: .06em; }

/* ── Tarjeta de tarea ── */
.app-tarjeta { width: 100%; text-align: left; border: 0; cursor: pointer; background: var(--caja); border-radius: 14px;
               padding: 14px; display: flex; gap: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.06);
               border-left: 4px solid var(--c, #6b7280); }
.app-tarjeta:active { transform: scale(.99); }
.app-tarjeta.hecha { opacity: .65; }
.app-tarjeta.hecha .app-tarjeta-tit { text-decoration: line-through; }
.app-tarjeta.atrasada { box-shadow: 0 0 0 2px #f2c48d inset, 0 1px 2px rgba(15,23,42,.06); }
.app-tarjeta-ico { width: 44px; height: 44px; border-radius: 12px; flex: none; display: flex; align-items: center; justify-content: center;
                   background: var(--cs, #eef1f5); color: var(--c, #374151); }
.app-tarjeta-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.app-tarjeta-fila { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.app-tarjeta-tit { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-tarjeta-prop { font-size: 14px; color: #374151; }
.app-tarjeta-ctx { font-size: 13px; color: var(--gris); }

.app-estado { flex: none; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 10px; background: #eef1f5; color: #374151; }
.app-estado.curso { background: #fdeac9; color: #92400e; }
.app-estado.hecha { background: #ccebd7; color: #166534; }
.app-estado.bloq { background: #fbdada; color: #991b1b; }

.app-vacio { padding: 50px 20px; text-align: center; color: var(--gris); }
.app-vacio svg { color: #16a34a; }

/* ── Detalle de tarea ── */
.app-caja { background: var(--caja); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.app-fila-sb { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.app-fuerte { font-weight: 600; font-size: 15px; }
.app-gris { font-size: 13px; color: var(--gris); }
.app-sub { margin: 0; font-weight: 600; font-size: 15px; }
.app-nota { margin: 0; font-size: 14px; color: #374151; }
.app-etiquetas { display: flex; flex-wrap: wrap; gap: 6px; }
.app-etiquetas span { font-size: 13px; background: #eef1f5; padding: 5px 9px; border-radius: 8px; }
.app-check { min-height: 44px; display: flex; align-items: center; gap: 12px; font-size: 15px; cursor: pointer; }
.app-check input { width: 22px; height: 22px; accent-color: var(--teal); flex: none; }
.app-check input:checked + span { color: var(--gris); text-decoration: line-through; }
.app-fotos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.app-foto { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #e5e9f0; display: flex; align-items: center;
            justify-content: center; font-size: 12px; font-weight: 600; color: #374151; text-decoration: none; }
.app-foto img { width: 100%; height: 100%; object-fit: cover; }
.app-foto.nueva { border: 2px dashed #9aa6b8; background: #f8fafc; color: #4b5563; cursor: pointer; }
.app-comentar { display: flex; gap: 8px; }
.app-comentar input { flex: 1; min-width: 0; height: 44px; border-radius: 12px; border: 1px solid #d5dbe5; padding: 0 12px; background: #fff; }
.app-com { font-size: 14px; border-top: 1px solid var(--linea); padding-top: 8px; }

.app-icono { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--texto);
             display: flex; align-items: center; justify-content: center; flex: none; cursor: pointer; }
.app-icono.teal { background: var(--teal-claro); color: var(--teal); }

/* ── Botones ── */
.app-btn { border: 0; border-radius: 12px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.app-btn.grande { min-height: 52px; padding: 0 18px; font-size: 16px; width: 100%; }
.app-btn.peq { height: 36px; padding: 0 12px; font-size: 13px; font-weight: 500; border: 1px solid #d5dbe5; background: #fff; color: #374151; border-radius: 18px; }
.app-btn.teal { background: var(--teal); color: #fff; }
.app-btn.aviso { background: var(--aviso-fondo); color: var(--aviso); border: 1px solid #f2c48d; }
.app-btn.linea { background: #fff; color: #374151; border: 1px solid #d5dbe5; }
.app-btn:disabled { opacity: .6; }

.app-pie { position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 3;
           max-width: 560px; margin: 0 auto; background: var(--caja); border-top: 1px solid var(--linea);
           padding: 12px 16px; display: flex; gap: 10px; }

.app-select { width: 100%; font-size: 16px; height: 48px; border-radius: 12px; border: 1px solid #d5dbe5; background: #fff; padding: 0 12px; }

/* ── Avisar de un problema ── */
fieldset.app-caja { border: 0; margin: 0; min-width: 0; }
fieldset.app-caja legend { padding: 0; margin-bottom: 10px; float: left; width: 100%; }
fieldset.app-caja legend + * { clear: both; }
.app-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.app-chip, .app-segmento label { position: relative; }
.app-chip input, .app-segmento input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; margin: 0; }
.app-chip span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 22px;
                 border: 1px solid #d5dbe5; background: #fff; font-size: 14px; font-weight: 500; color: #374151; cursor: pointer; }
.app-chip input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.app-chip input:focus-visible + span, .app-segmento input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.app-segmento { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.app-segmento span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 48px; padding: 4px 6px;
                     border-radius: 12px; border: 1px solid #d5dbe5; background: #fff; font-size: 14px; font-weight: 500; cursor: pointer; }
.app-seg-baja input:checked + span { background: #e0f2f1; border-color: var(--teal); color: var(--teal); font-weight: 600; }
.app-seg-alta input:checked + span { background: #fdeac9; border-color: #d97706; color: #92400e; font-weight: 600; }
.app-seg-urgente input:checked + span { background: #fbdada; border-color: #dc2626; color: #991b1b; font-weight: 600; }
.app-texto { width: 100%; border-radius: 12px; border: 1px solid #d5dbe5; padding: 12px; resize: vertical; min-height: 110px; background: #fff; font-size: 16px; }
.app-foto.previa { position: relative; overflow: visible; }
.app-foto.previa img { border-radius: 10px; }
.app-foto-quitar { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 13px; border: 2px solid #fff;
                   background: #374151; color: #fff; font-size: 15px; line-height: 1; padding: 0; cursor: pointer; }
.app-avisar { margin-top: 8px; }
.app-check-fila { flex-direction: row; }
.app-check-fila input:checked + span { color: inherit; text-decoration: none; }
.app-nota-flot { position: fixed; left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 6;
                 max-width: 480px; margin: 0 auto; background: #14532d; color: #fff; padding: 12px 16px; border-radius: 12px;
                 font-size: 14px; font-weight: 500; box-shadow: 0 6px 20px rgba(15,23,42,.25); }
.app-nota-flot[hidden] { display: none; }

/* ── Coordinador ── */
.app-cifras.cuatro { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.app-cifras.cuatro .app-cifra { padding: 9px 10px; }
.app-cifras.cuatro .app-cifra b { font-size: 20px; }
.app-cifras.cuatro .app-cifra span { font-size: 11px; }
button.app-cifra { border: 0; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.app-cifra.aviso { background: rgba(245,158,11,.22); }
.app-cifra.aviso span { color: #fde6c0; }
.app-pastillas.desliza { overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.app-pastillas.desliza::-webkit-scrollbar { display: none; }
.app-pastilla { flex: none; }
.app-tarjeta-pie { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.app-persona { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 8px; background: #e0f2f1; color: #115e59; }
.app-persona.sin { background: #fdeac9; color: #92400e; }
.app-mov { background: var(--caja); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
           border: 1px solid transparent; }
.app-mov.falta { border-color: #f2c48d; }
.app-chipes { display: flex; gap: 6px; flex-wrap: wrap; }
.app-chipe { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 8px; background: #eef1f5; color: #374151; }
.app-chipe.ok { background: #ccebd7; color: #166534; }
.app-chipe.curso { background: #fdeac9; color: #92400e; }
.app-chipe.mal { background: #fbdada; color: #991b1b; }
.app-mov-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.app-mov-btns .app-btn.peq { height: 40px; border-radius: 10px; text-decoration: none; font-weight: 600; }
.app-mov-btns.uno { grid-template-columns: 1fr; }
.app-btn.peq.wa { background: #e3f6e9; color: #166534; border-color: #bfe5cb; }
.app-nadie { margin: 0; padding: 0 2px; }
.app-mas { align-self: center; }
.app-equipo { gap: 0; padding: 4px 14px; }
.app-equipo .app-fila-sb { min-height: 48px; align-items: center; border-bottom: 1px solid #eef1f5; }
.app-equipo .app-fila-sb:last-child { border-bottom: 0; }
.app-quien { align-items: center; }
.app-fila-fecha { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; }
.app-gente { gap: 0; padding: 6px 14px; }
.app-gente legend { margin: 8px 0 4px; }
.app-persona-op { min-height: 56px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #eef1f5; cursor: pointer; }
.app-persona-op:last-child { border-bottom: 0; }
.app-persona-op input { width: 22px; height: 22px; accent-color: var(--teal); flex: none; }
.app-persona-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-carga { font-size: 12px; color: var(--gris); white-space: nowrap; }
.app-nav.cuatro { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ── Avisos ── */
.app-aviso { width: 100%; text-align: left; border: 1px solid transparent; cursor: pointer; background: var(--caja);
             border-radius: 14px; padding: 14px; display: flex; gap: 12px; }
.app-aviso.nueva { border-color: #b7e0dc; }
.app-punto { width: 10px; height: 10px; border-radius: 5px; margin-top: 6px; flex: none; background: transparent; }
.app-aviso.nueva .app-punto { background: var(--teal); }
.app-aviso-txt { display: flex; flex-direction: column; gap: 3px; font-size: 14px; color: #374151; }

/* ── Barra inferior ── */
.app-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; max-width: 560px; margin: 0 auto;
           background: var(--caja); border-top: 1px solid var(--linea); display: grid;
           grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
.app-nav button { position: relative; min-height: 52px; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column;
                  align-items: center; justify-content: center; gap: 3px; color: var(--gris); font-size: 11px; font-weight: 500; }
.app-nav button.on { color: var(--teal); font-weight: 600; }
.app-nav-num { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; border-radius: 9px; padding: 0 4px;
               background: #f59e0b; color: #1f2937; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.app-nav-num[hidden] { display: none; }

/* ── Check-in online del huésped (checkin/pagina.php) ── */
.ck .app { min-height: 100dvh; }
.ck .app-cuerpo { padding-bottom: 40px; }
.ck .app-cuerpo.con-pie { padding-bottom: 110px; }
.ck .app-pie, .ck-pie { bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
/* Idiomas en su propia fila, encima de la cabecera: con siete ya no
   cabian a la derecha y tapaban «Check-in online». Si no caben, se
   deslizan. */
.ck .app { position: relative; }
.ck-idiomas { display: flex; justify-content: flex-end; padding: calc(10px + env(safe-area-inset-top)) 12px 0; background: var(--navy); position: relative; z-index: 6; }
.ck-idi { position: relative; }
.ck-idi summary { list-style: none; display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 20px; cursor: pointer;
                  font-size: 14px; font-weight: 600; color: #fff; border: 1.5px solid rgba(255,255,255,.35); user-select: none; }
.ck-idi summary::-webkit-details-marker { display: none; }
.ck-idi[open] summary { background: rgba(255,255,255,.12); }
.ck-idi[open] .ck-idi-fl { transform: rotate(180deg); }
.ck-idi-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; background: #fff; border-radius: 14px; padding: 6px;
               box-shadow: 0 16px 40px -12px rgba(15,23,42,.45); display: flex; flex-direction: column; }
.ck-idi-menu a { display: flex; align-items: center; min-height: 46px; padding: 0 14px; border-radius: 10px; font-size: 16px; color: #1f2937; text-decoration: none; }
.ck-idi-menu a:hover { background: #f1f5f9; }
.ck-idi-menu a.on { background: var(--teal); color: #fff; font-weight: 600; }
/* En la ficha de cada viajero la barra es clara */
.ck .app:has(> .app-barra) .ck-idiomas { background: var(--caja); }
.ck .app:has(> .app-barra) .ck-idi summary { color: var(--navy); border-color: var(--linea); }
.ck .app-barra .app-barra-tit h1 { white-space: normal; }
.ck-cab { padding-top: 12px; gap: 6px; }
.ck-reserva { font-size: 14px; color: #d6deeb; }
.ck-ok { margin: 0; background: #ccebd7; color: #14532d; border-radius: 12px; padding: 10px 14px; font-weight: 600; font-size: 14px; }
.ck-aviso { margin: 0; background: #fbdada; color: #7f1d1d; border-radius: 12px; padding: 10px 14px; font-weight: 600; font-size: 14px; }
.ck-listo { flex-direction: row; align-items: flex-start; gap: 12px; background: #e9f7ee; color: #14532d; }
.ck-listo svg { flex: none; color: #16a34a; }
.ck-listo p { margin: 4px 0 0; font-size: 14px; color: #1f3d2b; }
.ck-paso.activo { box-shadow: 0 0 0 2px var(--teal) inset; }
.ck-paso-cab { display: flex; align-items: center; gap: 12px; }
.ck-paso-cab > div { display: flex; flex-direction: column; gap: 2px; }
.ck-num { width: 30px; height: 30px; border-radius: 15px; flex: none; display: flex; align-items: center; justify-content: center;
          background: #d5dbe5; color: #374151; font-weight: 700; font-size: 14px; }
.ck-paso.activo .ck-num { background: var(--teal); color: #fff; }
.ck-paso.hecho .ck-num { background: #16a34a; color: #fff; }
.ck-llegada { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.ck-aviso-datos { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.45; background: #fdecd6; color: #92400e; }
.ck-auto-ok { align-self: center; color: #15803d; font-weight: 600; font-size: 14px; white-space: nowrap; }
.ck-btn { height: 48px; padding: 0 16px; }
.ck-col { grid-column: 1 / -1; }
.ck-ayuda { margin: 0; }
.ck-viajeros { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ck-viajero { min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; border: 1px solid #d5dbe5;
              text-decoration: none; color: inherit; background: #fff; }
.ck-viajero.ok { background: #f2faf5; border-color: #bfe5cb; }
.ck-viajero-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.ck-viajero-txt b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ck-mas { align-self: flex-start; text-decoration: none; }
.ck-wa { background: #e3f6e9; color: #166534; text-decoration: none; }
.ck-legal { font-size: 12px; margin: 4px 2px 0; }
.ck-campo { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #4b5563; border: 0; padding: 0; margin: 0; min-width: 0; }
.ck-campo legend { padding: 0; margin-bottom: 5px; }
.ck-campo input:not([type=radio]):not([type=checkbox]), .ck-campo select { height: 48px; border-radius: 12px; border: 1px solid #c9d1dd; padding: 0 12px; background: #fff;
                                    font-size: 16px; color: var(--texto); width: 100%; }
.ck-campo small { font-size: 12px; }
.ck-campo.mal input, .ck-campo.mal select { border-color: #dc2626; box-shadow: 0 0 0 1px #dc2626 inset; }
.ck-campo.mal .app-segmento span { border-color: #dc2626; }
.ck-err { color: #b91c1c; font-size: 12px; font-weight: 600; }
.ck-dos { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 8px; }
.ck [hidden] { display: none !important; }
.ck-form .app-caja > div[data-si] { display: flex; flex-direction: column; gap: 10px; }
/* Firma del parte: lienzo a todo el ancho, sin que el dedo mueva la página */
.ck-firma { position: relative; }
.ck-firma canvas { display: block; width: 100%; height: 190px; border: 1px solid #c9d1dd; border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; }
.ck-firma-linea { position: absolute; left: 18px; right: 18px; bottom: 46px; border-bottom: 1px dashed #c9d1dd; pointer-events: none; }
.ck-firma [data-firma-borrar] { position: absolute; top: 8px; right: 8px; }
.ck-firma.mal canvas { border-color: #dc2626; box-shadow: 0 0 0 1px #dc2626 inset; }

/* ── Propietario ── */
.app-barra-ocup { height: 8px; border-radius: 4px; background: #e5e9f0; overflow: hidden; }
.app-barra-ocup span { display: block; height: 100%; background: var(--teal); border-radius: 4px; }
.app-viv { gap: 10px; }
.app-mov.ahora { border-color: #b7e0dc; }
.hm-dm-arriba ~ .app .app-cab, .hm-dm-arriba ~ .app .app-barra { padding-top: 14px; }
.hm-dm-arriba ~ .app .app-barra { top: 46px; }
.hm-dm-arriba ~ .app { min-height: calc(100dvh - 46px); }
