/* Webapp del operario (móvil). Letra grande: se usa a pleno sol, con guantes y
   a un brazo de distancia. Nada por debajo de 17 px y botones de 60 px. */

:root {
  --fondo: #eef2f7;
  --tarjeta: #ffffff;
  --texto: #0f172a;
  --tenue: #55637a;
  --borde: #c3cedd;
  --acento: #1d4ed8;
  --ok: #15803d;
  --error: #b91c1c;
  --aviso: #b45309;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--fondo); color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 19px;              /* base grande */
  -webkit-text-size-adjust: 100%;
}

/* ─── Vistas ─── */
.vista { display: none; flex-direction: column; height: 100dvh; }
.vista.activa { display: flex; }

/* ─── Login ─── */
#v-login { justify-content: center; padding: 22px; }
.login-caja {
  background: var(--tarjeta); border-radius: 18px; padding: 26px 22px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .1); max-width: 460px; width: 100%; margin: 0 auto;
}
.login-caja h1 { margin: 0 0 6px; font-size: 1.7rem; }
.login-caja .sub { margin: 0 0 22px; color: var(--tenue); font-size: 1rem; }

label { display: block; font-size: .95rem; color: var(--tenue); margin: 18px 0 7px; font-weight: 700; }
input[type=text], input[type=password], input[type=date], input[type=time], select {
  width: 100%; padding: 16px 14px; font-size: 1.15rem; font-family: inherit;
  border: 1px solid var(--borde); border-radius: 12px; background: #fff; color: var(--texto);
  min-height: 60px;
}
input[type=time] { font-size: 1.3rem; text-align: center; font-weight: 700; }
select { appearance: none; background-image: none; }
input:focus, select:focus { outline: 3px solid var(--acento); outline-offset: -1px; }

.recordar {
  display: flex; align-items: center; gap: 10px;
  font-size: 1rem; color: var(--tenue); font-weight: 600; margin-top: 18px;
}
.recordar input { width: 24px; height: 24px; }

/* ─── Botones ─── */
.btn {
  border: none; border-radius: 14px; padding: 18px 20px; font-size: 1.15rem;
  font-weight: 800; cursor: pointer; width: 100%; margin-top: 18px;
  min-height: 66px; font-family: inherit;
}
.btn-principal { background: var(--acento); color: #fff; }
.btn-principal:active { background: #1e40af; }
.btn-secundario { background: #dde5ef; color: var(--texto); }
.btn.grande { min-height: 96px; font-size: 1.25rem; margin-top: 8px; }
.btn:disabled { opacity: .55; }

.btn-icono {
  border: none; background: transparent; color: var(--texto);
  font-size: 1.7rem; width: 56px; height: 56px; border-radius: 50%; cursor: pointer;
  flex: 0 0 auto;
}

/* ─── Cabecera ─── */
.cab {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: var(--tarjeta); border-bottom: 2px solid #dbe3ee;
  position: sticky; top: 0; z-index: 5;
}
.cab .crece { flex: 1; font-weight: 800; font-size: 1.1rem; }
.hola { font-size: 1.5rem; font-weight: 800; line-height: 1.15; }
.rol { font-size: .95rem; color: var(--tenue); font-weight: 600; margin-top: 2px; }

/* ─── Navegación de semana ─── */
.semana-nav {
  display: flex; align-items: center; gap: 6px; padding: 10px 8px;
  background: var(--tarjeta); border-bottom: 2px solid #dbe3ee;
}
.semana-nav .rango { flex: 1; text-align: center; font-weight: 800; font-size: 1.1rem; }
.nav-flecha {
  border: 1px solid var(--borde); background: #fff; color: var(--texto);
  font-size: 1.6rem; line-height: 1; width: 58px; height: 58px; border-radius: 14px;
  cursor: pointer; font-family: inherit;
}

/* ─── Botones rápidos ─── */
.rapidos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 12px 6px; }
.rapido {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 8px; border-radius: 16px; border: 2px solid var(--borde);
  background: var(--tarjeta); color: var(--texto); font-weight: 800; font-size: 1.02rem;
  cursor: pointer; min-height: 96px; font-family: inherit;
}
.rapido:active { background: #e8eef7; }
.rapido .ico { font-size: 2rem; line-height: 1; }

/* ─── Lista de la semana (como el calendario del PC) ─── */
.semana-lista { padding: 8px 12px 24px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.dia-bloque { margin-bottom: 14px; }
.dia-bloque.es-hoy .dia-cab { background: #dbeafe; border-color: #93b4f7; }
.dia-cab {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--tarjeta); border: 2px solid #dbe3ee; border-radius: 14px 14px 0 0;
  cursor: pointer;
}
.dia-nombre { font-weight: 800; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .04em; }
.dia-fecha { font-weight: 800; font-size: 1.35rem; }
.dia-hoy {
  background: var(--acento); color: #fff; font-size: .78rem; font-weight: 800;
  padding: 3px 9px; border-radius: 999px; letter-spacing: .05em;
}
.dia-n {
  margin-left: auto; font-weight: 800; font-size: 1rem; color: var(--tenue);
  background: #e8eef7; border-radius: 999px; padding: 3px 12px; min-width: 34px; text-align: center;
}
.dia-trabajos { border: 2px solid #dbe3ee; border-top: none; border-radius: 0 0 14px 14px; overflow: hidden; }
.dia-vacio { margin: 0; padding: 14px 16px; color: var(--tenue); font-size: .98rem; background: #fff; }

.trabajo-chip {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: #fff; border-left: 8px solid var(--borde); cursor: pointer;
  border-bottom: 1px solid #e8eef7; min-height: 64px;
}
.dia-trabajos .trabajo-chip:last-child { border-bottom: none; }
.trabajo-chip:active { background: #f2f6fc; }
.chip-txt { flex: 1; min-width: 0; }
.chip-tit { display: block; font-weight: 700; font-size: 1.08rem; line-height: 1.25; }
.chip-sub { display: block; font-size: .86rem; color: var(--tenue); margin-top: 3px; font-weight: 600; }
.chip-ok { color: var(--ok); font-weight: 800; font-size: 1.3rem; }

/* ─── Asistente de cierre ─── */
.contenido { padding: 16px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.contenido h2 { font-size: 1.4rem; margin: 0 0 10px; line-height: 1.25; }
.contenido h3 { font-size: 1rem; margin: 26px 0 10px; color: var(--tenue); text-transform: uppercase; letter-spacing: .05em; }
.meta { color: var(--tenue); font-size: .98rem; margin: 6px 0; font-weight: 600; }
.desc { margin-top: 14px; line-height: 1.5; white-space: pre-wrap; }
.docs a {
  display: block; padding: 16px; background: var(--tarjeta); border-radius: 12px;
  margin-bottom: 10px; color: var(--acento); text-decoration: none; font-weight: 700;
  border: 2px solid #dbe3ee; font-size: 1rem;
}
.nota { font-size: .88rem; color: var(--tenue); margin-top: 20px; line-height: 1.45; }
.vacio { color: var(--tenue); text-align: center; padding: 26px 14px; font-size: 1rem; }
.aviso-pend {
  background: #fff7ed; border: 2px solid #fdba74; color: #7c2d12;
  border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; font-size: .95rem; font-weight: 600;
}

.cd-trabajo {
  background: var(--tarjeta); border: 2px solid #dbe3ee; border-radius: 14px;
  padding: 14px; margin-bottom: 12px;
}
.cd-cab { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cd-tit { font-weight: 800; font-size: 1.08rem; flex: 1; line-height: 1.25; }
.cd-ok {
  background: #dcfce7; color: var(--ok); font-size: .82rem; font-weight: 800;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.cd-horas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cd-campo label { margin: 0 0 6px; font-size: .85rem; }

/* ─── Acciones al pie ─── */
.acciones {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--tarjeta); border-top: 2px solid #dbe3ee;
  display: flex; gap: 10px;
}
.acciones .btn { margin-top: 0; }

/* ─── Lista de trabajos (elegir) ─── */
.lista { padding: 12px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.lista .trabajo-chip { border: 2px solid #dbe3ee; border-left-width: 8px; border-radius: 14px; margin-bottom: 10px; }

/* ─── Fotos del escaneo ─── */
.fotos { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.fotos .foto { position: relative; width: 108px; height: 108px; }
.fotos img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; border: 2px solid var(--borde); }
.fotos .quitar {
  position: absolute; top: -8px; right: -8px; width: 34px; height: 34px; border-radius: 50%;
  border: none; background: var(--error); color: #fff; font-size: .95rem; cursor: pointer;
}

/* ─── Avisos ─── */
.error { color: var(--error); font-size: 1rem; margin-top: 14px; min-height: 22px; font-weight: 600; }
.aviso {
  position: fixed; left: 14px; right: 14px; bottom: calc(24px + env(safe-area-inset-bottom));
  background: #0f172a; color: #fff; padding: 18px 20px; border-radius: 14px;
  font-size: 1.05rem; font-weight: 600; z-index: 50; box-shadow: 0 8px 26px rgba(0, 0, 0, .3);
}
.aviso.malo { background: var(--error); }
.aviso.bueno { background: var(--ok); }

/* ─── Fichas del detalle ─── */
.fichas { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.ficha {
  display: inline-flex; align-items: center; gap: 7px;
  background: #fff; border: 2px solid #dbe3ee; border-radius: 999px;
  padding: 6px 13px; font-size: .9rem; font-weight: 700; color: var(--texto);
}
.ficha .punto { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* ─── Material ─── */
.material-fila {
  display: flex; align-items: center; gap: 10px; background: #fff;
  border: 2px solid #dbe3ee; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
}
.mat-tipo {
  font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}
.mat-tipo.pedir { background: #fef3c7; color: #92400e; }
.mat-tipo.gastado { background: #dcfce7; color: #166534; }
.mat-nombre { flex: 1; font-weight: 700; font-size: .98rem; line-height: 1.25; }
.mat-cant { color: var(--tenue); font-weight: 800; }

/* ─── Galería de fotos ─── */
.galeria { display: flex; flex-wrap: wrap; gap: 10px; }
.galeria .miniatura { display: block; width: 100px; height: 100px; }
.galeria img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 12px; border: 2px solid var(--borde);
}

/* ─── Segmentado ─── */
.segmentado { display: flex; gap: 8px; margin: 6px 0 4px; }
.seg {
  flex: 1; padding: 14px 8px; border-radius: 12px; border: 2px solid var(--borde);
  background: #fff; color: var(--tenue); font-weight: 800; font-size: .98rem;
  font-family: inherit; cursor: pointer; min-height: 58px;
}
.seg.activo { background: var(--acento); border-color: var(--acento); color: #fff; }

/* ─── Etiqueta de gremio en el chip (vista administrador) ─── */
.chip-gremio { font-size: 1.1rem; flex: 0 0 auto; }

/* ─── Lista de operarios con casilla ─── */
.lista-check { display: flex; flex-direction: column; gap: 8px; }
.op-check {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border: 2px solid #dbe3ee; border-radius: 12px; padding: 14px; margin: 0;
  font-size: 1rem; font-weight: 700; color: var(--texto); cursor: pointer;
}
.op-check input { width: 24px; height: 24px; }
.op-check .op-tag { margin-left: auto; }

textarea {
  width: 100%; padding: 14px; font-size: 1.05rem; font-family: inherit; color: var(--texto);
  border: 1px solid var(--borde); border-radius: 12px; background: #fff; resize: vertical;
}
textarea:focus { outline: 3px solid var(--acento); outline-offset: -1px; }

/* Equipo asignado en la línea del calendario */
.chip-equipo { color: #334155; font-weight: 700; }

/* Día sin trabajos: una sola línea */
.dia-vacio-linea {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 8px;
  background: #fff; border: 2px solid #e2e8f0; border-radius: 12px; cursor: pointer;
}
.dia-vacio-linea .dl-nombre { font-weight: 800; font-size: .95rem; text-transform: uppercase; letter-spacing: .03em; }
.dia-vacio-linea .dl-texto { color: var(--tenue); font-size: .9rem; margin-left: auto; }

/* Dos botones apilados al pie del asistente */
.acciones.columna { flex-direction: column; }
.acciones.columna .btn { width: 100%; }

/* Trabajo ya cerrado dentro del asistente */
.cd-trabajo.cerrado { background: #f8fafc; }
.cd-horas-fijas { margin: 0; font-size: 1.15rem; font-weight: 800; text-align: center; color: var(--ok); }
