/* Gestão · Estadia Ideal — tela operacional, pensada para o celular */
:root {
  --tinta: #14213d;       /* azul-marinho da marca */
  --tinta-2: #3d4a63;
  --fundo: #f4f5f2;
  --papel: #ffffff;
  --linha: #dfe2dc;
  --suave: #6b7280;
  --acento: #0f766e;      /* botões e ações */
  --acento-2: #0b5d57;

  /* Cores de status (mesmas da planilha) */
  --st-futura: #1e3a8a;
  --st-ocupado: #9cc8f5;
  --st-sai: #d9dcd6;
  --st-checkout: #111111;
  --st-limpando: #facc15;
  --st-liberado: #22a55a;
  --st-pendencia: #dc2626;
  --st-passado: #eef0ec;

  --grave: #dc2626;
  --moderada: #ea8a0c;
  --leve: #6b7280;

  --raio: 10px;
  --fonte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
#app { height: 100%; }
body {
  font-family: var(--fonte);
  background: var(--fundo);
  color: var(--tinta);
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }

.carregando-tela { display: grid; place-items: center; height: 100vh; color: var(--suave); }

/* ---------- Estrutura ---------- */
.app { display: flex; flex-direction: column; height: 100%; height: 100dvh; }
.topo {
  background: var(--tinta); color: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  display: flex; align-items: center; gap: 12px;
}
.topo .marca { font-weight: 700; letter-spacing: .2px; }
.topo .marca small { display: block; font-weight: 400; opacity: .7; font-size: 12px; }
.topo .usuario { margin-left: auto; text-align: right; font-size: 13px; opacity: .9; }
.topo .usuario button { background: none; border: 0; color: #fff; text-decoration: underline; padding: 0; font-size: 12px; opacity: .8; }
.principal { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
.nav {
  display: flex; background: var(--papel); border-top: 1px solid var(--linha);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  flex: 1; text-align: center; padding: 9px 4px 8px; color: var(--suave);
  text-decoration: none; font-size: 12px; display: flex; flex-direction: column; gap: 2px; align-items: center;
}
.nav a .ic { font-size: 19px; line-height: 1; }
.nav a.ativo { color: var(--tinta); font-weight: 700; }
.nav a .badge { background: var(--grave); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; margin-left: 2px; }

.pagina { padding: 14px 14px 32px; max-width: 900px; margin: 0 auto; }
.pagina-larga { padding: 10px 0 0; height: 100%; display: flex; flex-direction: column; }
.titulo-pagina { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.titulo-pagina h1 { font-size: 20px; }
.titulo-pagina .dir { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Botões e campos ---------- */
.bt {
  border: 1px solid var(--linha); background: var(--papel); border-radius: 8px;
  padding: 9px 13px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px;
}
a.bt { text-decoration: none; color: inherit; }
a.bt.bt-pri, a.bt.bt-escuro { color: #fff; }
.bt:disabled { opacity: .5; cursor: default; }
.bt-pri { background: var(--acento); border-color: var(--acento); color: #fff; }
.bt-pri:active { background: var(--acento-2); }
.bt-perigo { color: var(--grave); border-color: #f3c4c4; }
.bt-escuro { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.bt-peq { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.bt-bloco { width: 100%; justify-content: center; }
.bt-icone { padding: 6px 10px; min-width: 40px; justify-content: center; }

.campo { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.campo label { font-size: 13px; color: var(--tinta-2); font-weight: 600; }
.campo input, .campo select, .campo textarea {
  border: 1px solid var(--linha); border-radius: 8px; padding: 10px 11px; background: #fff; width: 100%;
  font-size: 16px; /* evita zoom no iPhone */
}
.campo textarea { min-height: 70px; resize: vertical; }
.linha-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ajuda { font-size: 12.5px; color: var(--suave); }
.erro-msg { background: #fdecec; color: #8c1d1d; border-radius: 8px; padding: 9px 11px; font-size: 14px; margin-bottom: 12px; }
.aviso-msg { background: #fff7e0; color: #6b4b00; border-radius: 8px; padding: 9px 11px; font-size: 14px; margin-bottom: 12px; }

.cartao { background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 12px; }
.lista { display: flex; flex-direction: column; gap: 8px; }
.vazio { color: var(--suave); text-align: center; padding: 28px 10px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px;
  font-size: 12px; font-weight: 600; background: #eef0ec; color: var(--tinta-2); white-space: nowrap;
}
.chip .bola { width: 9px; height: 9px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.15); }
.chip-grave { background: #fde2e2; color: #991b1b; }
.chip-moderada { background: #fdebd3; color: #8a4b04; }
.chip-leve { background: #ececec; color: #4b5563; }
.chip-entrada { background: #e0ecff; color: #1e3a8a; }

/* ---------- Login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; background: var(--tinta); }
.login .caixa { background: #fff; border-radius: 14px; padding: 24px 20px; width: 100%; max-width: 380px; }
.login h1 { font-size: 22px; margin-bottom: 2px; }
.login .sub { color: var(--suave); margin: 0 0 18px; font-size: 14px; }

/* ---------- Grade ---------- */
.grade-barra {
  flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 0 12px 10px; flex-wrap: wrap;
}
.grade-barra .mes { font-weight: 700; font-size: 17px; min-width: 130px; text-align: center; }
.grade-barra .dir { margin-left: auto; display: flex; gap: 6px; }
.legenda { display: flex; gap: 6px; padding: 0 12px 10px; overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.legenda::-webkit-scrollbar { display: none; }
.legenda .chip { background: #fff; border: 1px solid var(--linha); font-weight: 500; font-size: 11.5px; }
.faixa-mover {
  flex-shrink: 0; margin: 0 12px 10px; background: #fff7e0; border: 1px solid #f2d27a; border-radius: 8px;
  padding: 9px 11px; display: flex; gap: 8px; align-items: center; font-size: 14px;
}
.faixa-mover .bt { margin-left: auto; }

.grade-wrap { overflow: auto; border-top: 1px solid var(--linha); background: #fff; flex: 1; min-height: 160px; }
table.grade { border-collapse: separate; border-spacing: 0; font-size: 12px; }
table.grade th, table.grade td { border-right: 1px solid #e8eae5; border-bottom: 1px solid #e8eae5; }
table.grade thead th {
  position: sticky; top: 0; z-index: 3; background: #fafaf8; font-weight: 600; padding: 4px 0;
  min-width: 78px; width: 78px; text-align: center; color: var(--tinta-2);
}
table.grade thead th .dsem { display: block; font-size: 10.5px; font-weight: 500; color: var(--suave); text-transform: uppercase; }
table.grade thead th.hoje-col { background: var(--tinta); color: #fff; }
table.grade thead th.hoje-col .dsem { color: #cbd5e1; }
table.grade thead th.fds .dsem { color: #b45309; }
table.grade .col-un {
  position: sticky; left: 0; z-index: 2; background: #fff; min-width: 104px; width: 104px; max-width: 104px;
  padding: 0 8px; text-align: left; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
table.grade thead .col-un { z-index: 4; }
table.grade .col-un small { color: var(--suave); font-weight: 400; margin-left: 3px; }
table.grade .col-un .ponto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--st-pendencia); margin-left: 4px; vertical-align: middle; }
table.grade tr.faixa td { height: 18px; padding: 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
table.grade tr.faixa td.col-un { overflow: visible; }
table.grade tr.area td.col-un { font-weight: 500; font-style: italic; color: var(--tinta-2); }
table.grade td.c {
  height: 34px; padding: 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 78px;
  cursor: pointer; position: relative; font-weight: 500;
}
table.grade td.c.futura { background: var(--st-futura); color: #fff; }
table.grade td.c.ocupado { background: var(--st-ocupado); color: #0b2447; }
table.grade td.c.sai { background: var(--st-sai); color: #1f2937; }
table.grade td.c.checkout { background: var(--st-checkout); color: #fff; }
table.grade td.c.limpando { background: var(--st-limpando); color: #3b2f00; }
table.grade td.c.liberado { background: var(--st-liberado); color: #fff; }
table.grade td.c.pendencia { background: var(--st-pendencia); color: #fff; }
table.grade td.c.passado { background: var(--st-passado); color: #8a8f87; }
table.grade td.c.hoje-col { box-shadow: inset 2px 0 0 var(--tinta), inset -2px 0 0 var(--tinta); }
table.grade td.c.saida::after {
  content: ""; position: absolute; left: 0; top: 0; border-top: 9px solid #6b7280; border-right: 9px solid transparent;
}
table.grade td.c.alvo { outline: 3px dashed #f59e0b; outline-offset: -3px; }
table.grade td.c.origem { outline: 3px solid #f59e0b; outline-offset: -3px; }
table.grade td.c .pess { opacity: .85; font-size: 11px; }
table.grade tr.area td.c { background-image: repeating-linear-gradient(135deg, #fafaf8 0 6px, #f2f3ef 6px 12px); cursor: pointer; }

/* ---------- Bottom sheet ---------- */
.sheet-fundo {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--fundo); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 18px);
}
@media (min-width: 700px) {
  .sheet-fundo { align-items: center; }
  .sheet { border-radius: 16px; }
}
.sheet .alca { width: 40px; height: 4px; background: #c9ccc4; border-radius: 2px; margin: 4px auto 10px; }
.sheet .cab { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.sheet .cab h2 { font-size: 18px; }
.sheet .cab .sub { color: var(--suave); font-size: 13px; margin-top: 2px; }
.sheet .cab .fechar { margin-left: auto; background: none; border: 0; font-size: 24px; line-height: 1; padding: 0 4px; color: var(--suave); }
.sheet .bloco { background: #fff; border: 1px solid var(--linha); border-radius: var(--raio); padding: 12px; margin-bottom: 10px; }
.sheet .bloco h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--suave); margin-bottom: 8px; }
.sheet .acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.dl dt { color: var(--suave); }
.dl dd { margin: 0; font-weight: 600; }
.opcao {
  display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--linha); border-radius: var(--raio);
  padding: 12px; margin-bottom: 8px;
}
.opcao strong { display: block; }
.opcao span { color: var(--suave); font-size: 13px; }

/* ---------- Hoje ---------- */
.resumo { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.local-titulo { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--suave); margin: 16px 0 6px; font-weight: 700; }
.card-limpeza { display: grid; grid-template-columns: 8px 1fr; gap: 0; padding: 0; overflow: hidden; }
.card-limpeza .tarja { background: var(--st-sai); }
.card-limpeza .corpo { padding: 11px 12px; display: flex; flex-direction: column; gap: 6px; }
.card-limpeza .l1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-limpeza .l1 strong { font-size: 16px; }
.card-limpeza .info { font-size: 13px; color: var(--tinta-2); }
.card-limpeza .acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.st-aguardando .tarja { background: var(--st-sai); }
.st-checkout .tarja { background: var(--st-checkout); }
.st-em_limpeza .tarja { background: var(--st-limpando); }
.st-liberado .tarja { background: var(--st-liberado); }
.st-pendencia .tarja { background: var(--st-pendencia); }

/* ---------- Checklist ---------- */
.progresso { height: 8px; background: #e3e6df; border-radius: 4px; overflow: hidden; margin: 6px 0 4px; }
.progresso div { height: 100%; background: var(--acento); }
.amb { margin-bottom: 14px; }
.amb-cab { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; }
.amb-cab h2 { font-size: 16px; }
.amb-cab .bt { margin-left: auto; }
.item {
  background: #fff; border: 1px solid var(--linha); border-radius: var(--raio); padding: 10px 11px; margin-bottom: 6px;
  display: flex; flex-direction: column; gap: 8px;
}
.item.ok { border-color: #b6e2c6; background: #f3fbf6; }
.item.nok { border-color: #f3b4b4; background: #fff5f5; }
.item .topo-item { display: flex; align-items: center; gap: 8px; }
.item .nome { font-weight: 600; flex: 1; }
.item .cat { font-size: 11px; color: var(--suave); text-transform: uppercase; letter-spacing: .3px; }
.item .controles { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.passo { display: inline-flex; align-items: center; border: 1px solid var(--linha); border-radius: 8px; overflow: hidden; background: #fff; }
.passo button { border: 0; background: #f4f5f2; width: 40px; height: 38px; font-size: 20px; font-weight: 700; }
.passo span { min-width: 44px; text-align: center; font-weight: 700; font-size: 16px; }
.esperado { font-size: 13px; color: var(--suave); }
.falta { color: var(--grave); font-weight: 700; font-size: 13px; }
.foto-mini { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--linha); background: #eee; }
.fotos { display: flex; gap: 6px; flex-wrap: wrap; }
.obs { font-size: 13px; color: #8c1d1d; }
.rodape-fixo {
  position: sticky; bottom: 0; background: linear-gradient(to top, var(--fundo) 70%, transparent);
  padding: 14px 0 6px; margin-top: 10px;
}
.sel-on { background: var(--acento) !important; border-color: var(--acento) !important; color: #fff !important; }
.sel-nok { background: var(--grave) !important; border-color: var(--grave) !important; color: #fff !important; }
.enviando { opacity: .6; pointer-events: none; }

/* ---------- Pendências ---------- */
.filtros { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filtros select { border: 1px solid var(--linha); border-radius: 8px; padding: 7px 9px; background: #fff; }
.seg { display: inline-flex; border: 1px solid var(--linha); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 7px 12px; font-weight: 600; font-size: 13px; }
.seg button.on { background: var(--tinta); color: #fff; }
.card-pend { display: grid; grid-template-columns: 6px 1fr; padding: 0; overflow: hidden; }
.card-pend .tarja { background: var(--leve); }
.card-pend.g-grave .tarja { background: var(--grave); }
.card-pend.g-moderada .tarja { background: var(--moderada); }
.card-pend .corpo { padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
.card-pend .l1 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-pend .desc { font-size: 15px; }
.card-pend .meta { font-size: 12.5px; color: var(--suave); }
.vencida { color: var(--grave); font-weight: 700; }

/* ---------- Unidades e usuários ---------- */
.linha-un { display: flex; align-items: center; gap: 10px; padding: 11px 12px; background: #fff; border: 1px solid var(--linha); border-radius: var(--raio); text-decoration: none; color: inherit; }
.linha-un .dir { margin-left: auto; color: var(--suave); font-size: 13px; }
.tab-itens { width: 100%; border-collapse: collapse; font-size: 14px; }
.tab-itens td { padding: 7px 4px; border-bottom: 1px solid #eef0ec; vertical-align: middle; }
.tab-itens td.n { width: 100%; }
.tab-itens .cat-ic { font-size: 11px; color: var(--suave); display: block; text-transform: uppercase; letter-spacing: .3px; }
.mini-passo { display: inline-flex; align-items: center; gap: 2px; }
.mini-passo button { width: 30px; height: 30px; border: 1px solid var(--linha); background: #fff; border-radius: 6px; font-weight: 700; }
.mini-passo span { min-width: 26px; text-align: center; font-weight: 700; }
.troca { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.troca input { width: 18px; height: 18px; }
.link-convite { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: #f4f5f2; border-radius: 6px; padding: 8px; word-break: break-all; margin: 6px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 76px); transform: translateX(-50%);
  background: var(--tinta); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 80; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 90vw; text-align: center;
}
.toast.erro { background: #991b1b; }

@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: sobe .18s ease-out; }
  @keyframes sobe { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}
