:root {
  --fondo: #f4f6f5;
  --tarjeta: #ffffff;
  --texto: #1c2422;
  --suave: #5d6b67;
  --borde: #d5dcd9;
  --marca: #0f5c4d;
  --bien: #1a7f4b;
  --bien-fondo: #e2f4ea;
  --mal: #b3261e;
  --mal-fondo: #fbe6e4;
  --alerta-fondo: #fff1cf;
  --alerta: #7a5200;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }

input:not([type=checkbox]), select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: var(--tarjeta);
}

label { display: block; margin: 14px 0; font-size: 14px; color: var(--suave); }
label input, label select, label textarea { margin-top: 4px; color: var(--texto); font-size: 16px; }
label small { display: block; margin-top: 4px; }
label.check { display: flex; align-items: center; gap: 10px; color: var(--texto); font-size: 16px; }
label.check input { width: 22px; height: 22px; margin: 0; }
label.check small { margin: 0; }

button { cursor: pointer; border: 0; border-radius: 10px; min-height: 46px; padding: 0 16px; background: #e3e9e6; }
button:disabled { opacity: .5; cursor: default; }
button.principal { width: 100%; background: var(--marca); color: #fff; font-weight: 600; }
button.principal.angosto { width: auto; }
button.chico { min-height: 36px; padding: 0 12px; font-size: 14px; }
button.claro { background: rgba(255, 255, 255, .18); color: #fff; }
button.enlace { background: none; color: var(--suave); text-decoration: underline; }

/* ---------- Encabezado ---------- */

header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--marca);
  color: #fff;
  padding-top: env(safe-area-inset-top);
}
header .fila { display: flex; align-items: center; gap: 8px; padding: 10px 16px; }
header h1 { flex: 1; font-size: 19px; }
header .volver { color: #fff; font-size: 34px; line-height: 1; text-decoration: none; padding: 0 12px 4px 0; }
header nav { display: flex; align-items: center; gap: 16px; padding: 0 16px 10px; font-size: 14px; }
header nav .quien { flex: 1; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header nav a { color: #fff; }

.barra-sync {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: #e6eeeb;
  color: var(--texto);
  font-size: 13px;
}
.barra-sync.con-pendientes { background: var(--alerta-fondo); color: var(--alerta); font-weight: 600; }
.barra-sync .estado { flex: 1; }
.barra-sync button { background: var(--tarjeta); border: 1px solid var(--borde); font-weight: 400; }
.punto { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.punto.en-linea { background: var(--bien); }
.punto.fuera { background: var(--mal); }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); }
main h2 { margin: 20px 0 8px; font-size: 14px; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }

.vacio { padding: 32px 8px; text-align: center; color: var(--suave); }
.nota { margin: 12px 0; font-size: 13px; color: var(--suave); }
.error { color: var(--mal); }

/* ---------- Login ---------- */

.login { max-width: 380px; padding-top: 14vh; }
.login h1 { font-size: 24px; color: var(--marca); margin-bottom: 20px; }
.login .error { min-height: 22px; margin-bottom: 8px; font-size: 14px; }

/* ---------- Habitaciones ---------- */

.grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.hab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  padding: 8px 4px;
  border: 1px solid var(--borde);
  border-radius: 12px;
  background: var(--tarjeta);
  color: var(--texto);
  text-decoration: none;
  text-align: center;
}
.hab strong { font-size: 20px; }
.hab small { font-size: 12px; color: var(--suave); overflow-wrap: anywhere; }
.hab.hecha { background: var(--bien-fondo); border-color: var(--bien); }
.hab.hecha small { color: var(--bien); font-weight: 600; }
.hab.empezada { background: var(--alerta-fondo); border-color: #d9a520; }
.hab.empezada small { color: var(--alerta); font-weight: 600; }

/* ---------- Checklist ---------- */

.item { margin-bottom: 10px; padding: 14px; border: 1px solid var(--borde); border-radius: 12px; background: var(--tarjeta); }
.item p { margin-bottom: 10px; font-size: 17px; }
.item textarea { margin-top: 10px; }
.opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opcion { min-height: 52px; border: 2px solid var(--borde); background: var(--tarjeta); font-weight: 600; font-size: 17px; }
.opcion.bien.activa { background: var(--bien); border-color: var(--bien); color: #fff; }
.opcion.mal.activa { background: var(--mal); border-color: var(--mal); color: #fff; }
.pie { display: grid; gap: 10px; margin-top: 8px; text-align: center; color: var(--suave); }

/* ---------- Listas ---------- */

.lista > li { margin-bottom: 8px; border: 1px solid var(--borde); border-radius: 12px; background: var(--tarjeta); }
.lista > li:not(.expandible):not(.vacio), .lista .cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}
.lista .cabecera { width: 100%; min-height: 0; background: none; text-align: left; }
.lista small { display: block; font-size: 13px; color: var(--suave); }
.lista small.error { color: var(--mal); }
.lista > li.vacio { border: 0; background: none; }
.etiqueta { flex: none; padding: 4px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; }
.etiqueta.pendiente { background: var(--alerta-fondo); color: var(--alerta); }
.etiqueta.subida { background: var(--bien-fondo); color: var(--bien); }
.etiqueta.rechazada { background: var(--mal-fondo); color: var(--mal); }
.detalle { padding: 0 14px 12px; border-top: 1px solid var(--borde); }
.detalle p { margin-top: 10px; }
.detalle li { margin: 8px 0 0; }
.detalle li.mal { color: var(--mal); font-weight: 600; }
.detalle li small { font-weight: 400; color: var(--texto); }

/* ---------- Panel ---------- */

.pestanas { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.pestanas button { flex: none; min-height: 40px; }
.pestanas button.activa { background: var(--marca); color: #fff; }
.filtros { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.filtros label { margin: 0; }
.filtros label.check { min-height: 46px; }
.tarjeta { margin: 16px 0; padding: 4px 16px 16px; border: 1px solid var(--borde); border-radius: 12px; background: var(--tarjeta); }
.tarjeta h3 { margin-top: 14px; font-size: 17px; }
.acciones { display: flex; gap: 8px; }
.tabla { margin-top: 16px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--tarjeta); font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: middle; }
th { color: var(--suave); font-weight: 600; white-space: nowrap; }
/* La columna del botón Editar queda fija al desplazar la tabla en pantallas angostas. */
th:last-child, td:last-child { position: sticky; right: 0; background: var(--tarjeta); text-align: right; }
tr.inactivo td { color: #9aa5a1; }

/* ---------- Avisos ---------- */

#aviso {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 10;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 12px;
  background: #26302d;
  color: #fff;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
#aviso.visible { opacity: 1; }
#aviso.ok { background: var(--bien); }
#aviso.error { background: var(--mal); }
