/* Hotel PYSIS — pensado primero para el celular. Tema claro y oscuro. */
:root {
  --brand: #0d9e9e; --on-brand: #fff;
  --bg: #f4f4f8; --bg2: #fff; --card: #fff; --line: #e6e6ee; --txt: #15151c; --muted: #6b6b7b;
  --soft: color-mix(in srgb, var(--brand) 12%, var(--bg2));
  --libre: #16a34a; --ocupada: #e11d48; --limpieza: #d97706; --mant: #64748b;
  --sombra: 0 1px 2px rgba(20, 20, 40, .06), 0 4px 16px rgba(20, 20, 40, .06);
  --r: 18px; color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d0d12; --bg2: #16161e; --card: #1a1a24; --line: #2a2a38; --txt: #f2f2f7; --muted: #9a9aae;
  --soft: color-mix(in srgb, var(--brand) 20%, var(--bg2));
  --libre: #22c55e; --ocupada: #fb4570; --limpieza: #f59e0b; --mant: #94a3b8;
  --sombra: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--txt);
  font: 15px/1.4 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  min-height: 100dvh; overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; } h3 { font-size: 1rem; }
h2 small { font-size: .8rem; font-weight: 500; color: var(--muted); margin-left: 6px; }
small { color: var(--muted); }
.muted { color: var(--muted); font-size: .9rem; }
.err { color: var(--ocupada); } .okt { color: var(--libre); }
.center { min-height: 100dvh; display: grid; place-items: center; }
.center-t { text-align: center; }
.grow { flex: 1; min-width: 0; }
.tachado { text-decoration: line-through; color: var(--muted); }

/* ---------- barra superior y pestañas ---------- */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand b { display: block; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; font-size: .75rem; }
.top-btns { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.icon { width: 40px; height: 40px; border-radius: 12px; background: var(--card); box-shadow: var(--sombra); font-size: 1.1rem; }
.instalar { height: 40px; padding: 0 12px; border-radius: 12px; background: var(--soft); color: var(--brand); font-weight: 600; font-size: .85rem; }
.logo { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.logo.sm { width: 36px; height: 36px; border-radius: 11px; }
.logo.big { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 12px; display: block; }
.logo-txt { display: grid; place-items: center; background: var(--brand); color: var(--on-brand); font-weight: 800; font-size: 1.1rem; }
.logo.big.logo-txt { display: grid; font-size: 2rem; }
main { padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 900px; margin: 0 auto; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg2) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabs button { flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 14px; font-size: .72rem; color: var(--muted); font-weight: 500; }
.tabs button span { font-size: 1.25rem; line-height: 1; filter: grayscale(1); opacity: .7; }
.tabs button.on { color: var(--brand); background: var(--soft); font-weight: 700; }
.tabs button.on span { filter: none; opacity: 1; }
.aviso { margin: 0 16px 10px; padding: 10px 12px; border-radius: 14px; background: #fde68a; color: #422006; display: flex; gap: 10px; align-items: center; font-size: .9rem; }
.aviso span { flex: 1; }

/* ---------- habitaciones ---------- */
.resumen { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--card); box-shadow: var(--sombra); }
.pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); }
.st-libre { --c: var(--libre); } .st-ocupada { --c: var(--ocupada); }
.st-limpieza, .st-limpiando { --c: var(--limpieza); } .st-mantenimiento { --c: var(--mant); }
.banner { display: block; width: 100%; margin-bottom: 12px; padding: 12px; border-radius: 14px; background: var(--soft); color: var(--brand); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.hab {
  position: relative; text-align: left; min-height: 132px; padding: 14px; border-radius: var(--r);
  background: var(--card); box-shadow: var(--sombra); display: flex; flex-direction: column; gap: 2px; overflow: hidden;
  border: 1.5px solid transparent; transition: transform .12s;
}
.hab:active { transform: scale(.97); }
.hab::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.hab.st-ocupada { background: color-mix(in srgb, var(--ocupada) 9%, var(--card)); }
.hab.st-limpieza, .hab.st-limpiando { background: color-mix(in srgb, var(--limpieza) 10%, var(--card)); }
.hab.st-mantenimiento { opacity: .7; }
.hab-n { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.hab-estado { font-weight: 600; color: var(--c); }
.hab-t { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--txt); }
.hab-pie { margin-top: auto; font-size: .82rem; color: var(--muted); font-weight: 500; }
.warn { color: var(--limpieza) !important; }
.tol { color: var(--limpieza) !important; animation: latido 1.4s infinite; }
.over { color: var(--ocupada) !important; animation: latido 1s infinite; }
.hab:has(.over) { border-color: var(--ocupada); }
@keyframes latido { 50% { opacity: .55; } }

/* ---------- tarjetas, filas, botones ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sombra); padding: 16px; margin-bottom: 12px; }
.titulo { margin: 18px 4px 8px; font-size: .95rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.fila { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.fila:last-child { border-bottom: 0; }
.fila span { min-width: 0; }
.fila small { margin-left: 4px; }
.fila b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.fila.total { font-size: 1.15rem; font-weight: 800; border-top: 2px solid var(--line); border-bottom: 0; padding-top: 12px; }
.fila.tocable:active { background: var(--soft); }
.over-t { color: var(--ocupada); }
.x { width: 30px; height: 30px; border-radius: 10px; color: var(--muted); flex-shrink: 0; }
.x:active { background: var(--soft); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 16px;
  border-radius: 14px; background: var(--brand); color: var(--on-brand); font-weight: 700; transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.big { min-height: 54px; font-size: 1.05rem; }
.btn.block { display: flex; width: 100%; margin-top: 10px; }
.btn.ghost { background: var(--soft); color: var(--txt); }
.btn.ok { background: var(--libre); color: #fff; }
.btn.peligro { background: var(--ocupada); color: #fff; }
.peligro-t { color: var(--ocupada) !important; }
.link { display: block; margin: 12px auto 0; color: var(--brand); font-weight: 600; text-align: center; text-decoration: none; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; text-align: center; }
.tres div { background: var(--soft); border-radius: 12px; padding: 8px 4px; }
.tres small { display: block; font-size: .72rem; } .tres b { font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty.big { font-size: 1.1rem; line-height: 2; }
.hecho { width: 72px; height: 72px; margin: 8px auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; background: var(--libre); color: #fff; }
.hecho.gris { background: var(--soft); }

/* ---------- formularios ---------- */
label { display: block; font-size: .82rem; color: var(--muted); font-weight: 600; margin-top: 10px; }
input:not([type=checkbox]):not([type=color]), select {
  display: block; width: 100%; margin-top: 4px; min-height: 48px; padding: 0 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--bg2); font-size: 16px; color: var(--txt); outline: none;
}
input:focus, select:focus { border-color: var(--brand); }
label.check { display: flex; gap: 10px; align-items: center; color: var(--txt); font-weight: 500; font-size: .9rem; }
label.check input { width: 20px; height: 20px; accent-color: var(--brand); }
details { margin: 10px 0; padding: 10px 12px; border-radius: 14px; background: var(--bg); }
details summary { font-weight: 600; color: var(--muted); font-size: .9rem; cursor: pointer; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg); margin: 10px 0; }
.seg button { flex: 1; min-height: 40px; border-radius: 11px; font-weight: 600; font-size: .88rem; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--txt); box-shadow: var(--sombra); }
.opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.opcion { padding: 14px; border-radius: 16px; background: var(--bg); border: 2px solid transparent; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.opcion b { font-size: 1rem; } .opcion span { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.opcion.on { border-color: var(--brand); background: var(--soft); }
.opcion:active { transform: scale(.98); }
.dos-btn { display: grid; grid-template-columns: 1fr 110px 52px; gap: 8px; margin-top: 12px; }
.dos-btn input { margin: 0 !important; } .dos-btn .btn { min-height: 48px; padding: 0; }
.vuelto { min-height: 1.4em; font-size: 1.05rem; text-align: center; margin: 8px 0 0; }

/* ---------- hoja inferior ---------- */
dialog#sheet {
  margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92dvh; padding: 0; border: 0;
  border-radius: 26px 26px 0 0; background: var(--bg2); color: var(--txt); overflow: auto;
  animation: sube .22s cubic-bezier(.2, .9, .3, 1);
}
dialog#sheet::backdrop { background: rgba(0, 0, 0, .45); backdrop-filter: blur(2px); }
@keyframes sube { from { transform: translateY(40px); opacity: .4; } }
.sheet-in { padding: 8px 18px calc(20px + env(safe-area-inset-bottom)); }
.grip { width: 42px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 14px; }
@media (min-width: 700px) { dialog#sheet { margin: auto; border-radius: 26px; } }
.det-top { text-align: center; }
.det-reloj { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1.1; }
.chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.chips span { background: var(--bg); padding: 4px 10px; border-radius: 99px; font-size: .82rem; }
.cuenta { background: var(--bg); border-radius: 16px; padding: 4px 14px; margin: 12px 0; }
.acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.menu-lista { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.menu-lista > button { text-align: left; padding: 14px; border-radius: 14px; background: var(--bg); font-weight: 600; }
.menu-lista > button.peligro { color: var(--ocupada); }
.menu-user { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.menu-user b { display: block; }
.etq { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 0; }
.pasos li { margin: 8px 0; }
.prods { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.prod { position: relative; padding: 12px; border-radius: 14px; background: var(--bg); text-align: left; display: flex; flex-direction: column; gap: 2px; }
.prod:active { background: var(--soft); transform: scale(.97); }
.prod span { font-size: .85rem; color: var(--muted); }
.prod i { position: absolute; top: 8px; right: 8px; min-width: 24px; height: 24px; border-radius: 12px; background: var(--brand); color: var(--on-brand); font-style: normal; font-weight: 700; font-size: .8rem; display: grid; place-items: center; padding: 0 6px; }

/* ---------- limpieza, caja, reportes, ajustes ---------- */
.fila-limpieza { display: flex; align-items: center; gap: 8px; border-left: 5px solid var(--c); }
.fila-limpieza .btn { padding: 0 14px; }
.caja-top { text-align: center; }
.caja-grande { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { background: var(--card); border-radius: var(--r); padding: 14px; box-shadow: var(--sombra); }
.kpi small { display: block; font-size: .78rem; } .kpi b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.kpi.destacado { grid-column: 1 / -1; background: var(--brand); color: var(--on-brand); }
.kpi.destacado small { color: inherit; opacity: .85; } .kpi.destacado b { font-size: 1.8rem; }
.barra-fila { display: grid; grid-template-columns: 64px 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 6px 0; }
.barra-fila small { grid-column: 2 / 4; font-size: .74rem; }
.barra { height: 10px; border-radius: 9px; background: var(--bg); overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--brand); border-radius: 9px; }
.horas { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; height: 110px; align-items: end; }
.horas div { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.horas i { display: block; width: 100%; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }
.horas small { font-size: .62rem; height: 12px; }
.menu-ajustes { padding: 6px; }
.ajuste { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 10px; border-radius: 14px; }
.ajuste:active { background: var(--soft); }
.ajuste .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; font-size: 1.15rem; flex-shrink: 0; }
.ajuste > span:nth-child(2) { flex: 1; min-width: 0; }
.ajuste b { display: block; } .ajuste small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-edit { display: flex; align-items: center; gap: 16px; margin: 14px 0; }
.logo-edit .logo.big { margin: 0; }
.colores { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.color { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--bg2); box-shadow: 0 0 0 2px var(--line); }
.color.on { box-shadow: 0 0 0 3px var(--txt); }
.colores input[type=color] { width: 40px; height: 40px; border: 0; padding: 0; background: none; }

/* ---------- entrada ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 20% 0%, var(--soft), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 380px; text-align: center; padding: 28px 22px; }
.login-card input { margin-top: 10px; }
.login-card .btn.block { margin-top: 14px; }

/* ---------- avisos e impresión ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 50;
  background: var(--txt); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100% - 32px); text-align: center;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
.spin { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
#ticket { display: none; }
@media print {
  body > *:not(#ticket) { display: none !important; }
  #ticket { display: block; }
  .tk { width: 72mm; font: 12px/1.35 monospace; color: #000; }
  .tk h3 { text-align: center; margin: 0 0 4px; } .tk p { margin: 4px 0; }
  .tkf { display: flex; justify-content: space-between; gap: 8px; } .tkt { font-weight: 700; font-size: 14px; }
  .tkc { text-align: center; margin-top: 10px; } hr { border: 0; border-top: 1px dashed #000; }
  @page { margin: 3mm; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.aviso.demo { background: color-mix(in srgb, var(--brand) 16%, var(--card)); color: var(--txt); }
#actualizar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 12px; width: min(420px, calc(100% - 32px)); padding: 10px 10px 10px 16px;
  border-radius: 16px; background: var(--card); color: var(--txt); border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: .92rem; animation: subir .3s ease;
}
#actualizar span { flex: 1; text-align: left; }
#actualizar b { background: var(--brand); color: var(--on-brand); padding: 8px 14px; border-radius: 12px; }
@keyframes subir { from { opacity: 0; transform: translate(-50%, 20px); } }
