:root {
    --cor-visita: #0d6efd; --cor-pedido: #fd7e14; --cor-instalacao: #198754;
    --altura-barra: 62px;
}
html, body { background: #f2f4f8; overscroll-behavior-y: contain; }
body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; padding-bottom: calc(var(--altura-barra) + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }

#telaLogin { position: fixed; inset: 0; z-index: 3000; background: linear-gradient(135deg, #0d6efd, #0a58ca); display: flex; align-items: center; justify-content: center; padding: 16px; }
#telaLogin .card { width: 100%; max-width: 380px; border: 0; border-radius: 16px; }

.alert-toast { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 8px; right: 8px; z-index: 4000; }
.alert-toast .alert { margin-bottom: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.15); }

.topo { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
        background: linear-gradient(135deg, #0d6efd, #0a58ca); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.topo img { height: 34px; border-radius: 6px; background: #fff; padding: 2px; }
.btn-topo { color: #fff; font-size: 1.15rem; width: 42px; height: 42px; border-radius: 50%; }
.btn-topo:hover, .btn-topo:active { background: rgba(255,255,255,.2); color: #fff; }

/* Agenda */
.semana-nav { display: flex; align-items: center; gap: 6px; padding: 10px 12px 4px; }
.dias { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 4px 10px; }
.dia { border: 0; border-radius: 12px; background: #fff; padding: 6px 0; text-align: center; line-height: 1.15; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.dia small { display: block; font-size: .68rem; color: #6c757d; text-transform: uppercase; }
.dia strong { font-size: 1.05rem; }
.dia .pontos { height: 6px; display: flex; justify-content: center; gap: 2px; margin-top: 2px; }
.dia .pontos i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dia.hoje strong { color: #0d6efd; }
.dia.sel { background: #0d6efd; color: #fff; }
.dia.sel small, .dia.sel strong { color: #fff; }

.lista { padding: 8px 12px 16px; }
.grupo-dia { font-weight: 700; font-size: .85rem; color: #6c757d; margin: 12px 4px 6px; text-transform: capitalize; }
.cartao { display: block; width: 100%; text-align: left; background: #fff; border: 0; border-left: 6px solid #adb5bd; border-radius: 12px;
          padding: 10px 12px; margin-bottom: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.07); color: inherit; text-decoration: none; }
.cartao:active { transform: scale(.99); }
.cartao .hora { font-weight: 700; font-size: .95rem; }
.cartao .nome { font-weight: 600; font-size: 1.02rem; }
.cartao .end { font-size: .82rem; color: #6c757d; }
.cartao.concluida { opacity: .55; }
.vazio { text-align: center; color: #868e96; padding: 36px 16px; }
.vazio i { font-size: 2rem; display: block; margin-bottom: 8px; opacity: .5; }

.etapa-chip { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: .74rem; font-weight: 600; color: #fff; }
.etapa-visita { background: var(--cor-visita); } .etapa-pedido { background: var(--cor-pedido); } .etapa-instalacao { background: var(--cor-instalacao); }
.etapa-entrega { background: #6c757d; }

/* Detalhe */
.tela-cheia { position: fixed; inset: 0; z-index: 1000; background: #f2f4f8; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.bloco { background: #fff; border-radius: 14px; margin: 12px; padding: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.bloco h6 { font-weight: 700; color: #495057; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 10px; }
.acoes-contato { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acoes-contato .btn { padding: 12px 6px; font-weight: 600; }
.btn-gps { display: block; width: 100%; padding: 14px; font-size: 1.05rem; font-weight: 700; }
.endereco-txt { font-size: 1.02rem; }
.valores { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 6px; }
.valores small { display: block; color: #6c757d; font-size: .72rem; }
.valores strong { font-size: 1rem; }
.linha-etapa { border-left: 5px solid #ccc; border-radius: 10px; background: #f8f9fa; padding: 10px 12px; margin-bottom: 8px; }
.linha-etapa.concluida { opacity: .7; }
.pg-linha { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #eee; gap: 8px; }
.pg-linha:last-child { border-bottom: 0; }
.pg-linha.estornado { text-decoration: line-through; color: #adb5bd; }
.galeria { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.galeria img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }

/* Folha de ação */
.folha.offcanvas-bottom { height: auto; max-height: 92vh; border-radius: 18px 18px 0 0; }
.folha .offcanvas-body { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.opcoes { display: flex; flex-wrap: wrap; gap: 6px; }
.opcoes .btn { flex: 1 1 auto; }
.preview-valor { font-weight: 700; min-height: 1.4em; }
.seletor-responsaveis .btn { border-radius: 999px; }

/* Barra inferior */
.barra { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; display: flex; background: #fff; border-top: 1px solid #e3e6ea;
         padding-bottom: env(safe-area-inset-bottom); height: calc(var(--altura-barra) + env(safe-area-inset-bottom)); }
.barra button { flex: 1; border: 0; background: none; color: #6c757d; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .75rem; }
.barra button i { font-size: 1.25rem; }
.barra button.ativo { color: #0d6efd; font-weight: 600; }

@media (min-width: 700px) { main, .tela-cheia > div { max-width: 680px; margin: 0 auto; } }

/* No toque, o celular deixa o botão em "hover": a opção marcada fica sempre cheia. */
.btn-check:checked + .btn-outline-primary { background: #0d6efd; border-color: #0d6efd; color: #fff; }
.btn-check:checked + .btn-outline-secondary { background: #6c757d; border-color: #6c757d; color: #fff; }
.btn-check:checked + .btn-outline-dark { background: #212529; border-color: #212529; color: #fff; }
