/* Painel das empresas — visual de app de celular (mobile-first). Cores da marca: --app-ink e --app-gold. */
:root {
    --app-ink: #16181d;
    --app-gold: #d9a441;
    --app-gold-rgb: 217, 164, 65;
    --app-gold-texto: #16181d;
    --app-bg: #f3f2ef;
    --app-card: #fff;
    --app-muted: #80868f;
    --app-line: rgba(0, 0, 0, .07);
    --app-tab-h: 62px;
    --app-safe-b: env(safe-area-inset-bottom, 0px);
    --app-safe-t: env(safe-area-inset-top, 0px);
    --bs-primary: var(--app-ink);
    --bs-primary-rgb: 22, 24, 29;
    --bs-link-color: var(--app-ink);
    --bs-link-color-rgb: 22, 24, 29;
    --bs-body-bg: var(--app-bg);
    --bs-border-radius: 12px;
}

body.app {
    background: var(--app-bg);
    color: var(--app-ink);
    padding-bottom: calc(var(--app-tab-h) + var(--app-safe-b) + 24px);
    -webkit-tap-highlight-color: transparent;
}

/* Barra superior */
.app-bar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: var(--app-ink);
    color: #fff;
    padding: calc(var(--app-safe-t) + 12px) 16px 14px;
}
.app-bar-inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 12px; min-height: 40px; }
.app-bar h1 { font-size: 1.2rem; font-weight: 700; margin: 0; line-height: 1.2; }
.app-bar .sub { font-size: .75rem; color: rgba(255, 255, 255, .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-bar .titulos { flex: 1; min-width: 0; }
.app-bar .icone-btn {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.35rem; text-decoration: none; flex: 0 0 auto;
    background: rgba(255, 255, 255, .08);
}
.app-bar .icone-btn.gold { background: var(--app-gold); color: var(--app-gold-texto); }

.app-main { max-width: 640px; margin: 0 auto; padding: 16px; }

/* Navegação inferior (abas) */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--app-line);
    padding-bottom: var(--app-safe-b);
}
.tabbar-inner { max-width: 640px; margin: 0 auto; display: flex; height: var(--app-tab-h); }
.tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--app-muted); text-decoration: none; font-size: .7rem; font-weight: 500;
}
.tabbar a i { font-size: 1.35rem; line-height: 1; }
.tabbar a.ativo { color: var(--app-ink); font-weight: 700; }
.tabbar a.ativo i { color: var(--app-gold); }

/* Botão flutuante */
.fab {
    position: fixed; z-index: 1031;
    right: max(16px, calc(50% - 320px + 16px));
    bottom: calc(var(--app-tab-h) + var(--app-safe-b) + 16px);
    width: 58px; height: 58px; border-radius: 50%;
    background: var(--app-gold); color: var(--app-gold-texto);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.9rem; text-decoration: none;
    box-shadow: 0 8px 20px rgba(var(--app-gold-rgb), .45);
}
.fab:active { transform: scale(.95); }

/* Cartões e listas */
.app-card { background: var(--app-card); border-radius: 18px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.secao { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--app-muted); font-weight: 600; margin: 20px 4px 8px; }
.lista { background: var(--app-card); border-radius: 18px; overflow: hidden; }
.lista .item {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    border-bottom: 1px solid var(--app-line); color: var(--app-ink); text-decoration: none;
}
.lista .item:last-child { border-bottom: 0; }
.lista .item:active { background: #f7f7f5; }
.lista .item .txt { flex: 1; min-width: 0; }
.lista .item .t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista .item .t2 { font-size: .8rem; color: var(--app-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista .item.inativo { opacity: .55; }
.avatar {
    width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto;
    background: var(--app-gold); color: var(--app-gold-texto);
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.4rem; }

/* Semana (faixa de dias) */
.mes-topo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mes-topo .mes-nome { font-weight: 700; font-size: 1.05rem; color: var(--app-ink); text-decoration: none; }
.mes-topo .setas a { color: var(--app-ink); font-size: 1.2rem; padding: 4px 8px; }
.semana { display: flex; gap: 6px; }
.semana a {
    flex: 1; text-align: center; border-radius: 14px; padding: 8px 0 6px;
    background: var(--app-card); color: var(--app-ink); text-decoration: none; border: 2px solid transparent;
}
.semana .dow { font-size: .62rem; text-transform: uppercase; color: var(--app-muted); font-weight: 600; }
.semana .num { font-size: 1.1rem; font-weight: 700; line-height: 1.3; }
.semana .ponto { width: 6px; height: 6px; border-radius: 50%; margin: 1px auto 0; background: transparent; }
.semana .tem .ponto { background: var(--app-gold); }
.semana a.hoje { border-color: var(--app-gold); }
.semana a.sel { background: var(--app-ink); color: #fff; }
.semana a.sel .dow { color: rgba(255, 255, 255, .6); }

/* Mês completo */
.mes-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; padding: 10px; }
.mes-grid .dow { font-size: .62rem; text-transform: uppercase; color: var(--app-muted); font-weight: 600; padding: 4px 0; }
.mes-grid a {
    aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-radius: 12px; color: var(--app-ink); text-decoration: none; font-weight: 600; font-size: .9rem; position: relative;
}
.mes-grid a.fora { opacity: .3; }
.mes-grid a.hoje { box-shadow: inset 0 0 0 2px var(--app-gold); }
.mes-grid a.sel { background: var(--app-ink); color: #fff; }
.mes-grid a.tem::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--app-gold); position: absolute; bottom: 6px; }

/* Chips (filtros roláveis na horizontal) */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px; }
.chips::-webkit-scrollbar { display: none; }
.chips a, .chips label {
    flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; background: var(--app-card);
    border: 1px solid var(--app-line); color: var(--app-ink); text-decoration: none; font-size: .85rem; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.chips a.ativo, .chips input:checked + label { background: var(--app-ink); color: #fff; border-color: var(--app-ink); }
.chips input { display: none; }

/* Agenda do dia */
.slot { display: flex; gap: 12px; margin-bottom: 8px; }
.slot .hora { width: 46px; flex: 0 0 46px; font-weight: 700; font-size: .85rem; padding-top: 13px; color: #5b6068; }
.slot .conteudo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ag {
    background: var(--app-card); border-radius: 14px; padding: 10px 10px 10px 14px;
    border-left: 4px solid var(--app-gold); display: flex; align-items: center; gap: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.ag .info { flex: 1; min-width: 0; color: var(--app-ink); text-decoration: none; }
.ag .nome { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag .meta { font-size: .78rem; color: var(--app-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag .acao {
    width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    background: #f1f1ef; color: var(--app-ink); text-decoration: none; font-size: 1.1rem;
}
.ag .acao.wa { background: #25d366; color: #fff; }
.livre {
    display: block; border: 1.5px dashed rgba(0, 0, 0, .14); border-radius: 14px; padding: 11px 14px;
    color: #a0a5ab; text-decoration: none; font-size: .85rem;
}
.livre:active { background: var(--app-card); }
.vazio { text-align: center; color: var(--app-muted); padding: 40px 16px; }
.vazio i { font-size: 2.6rem; display: block; margin-bottom: 8px; opacity: .5; }

/* Formulários com cara de app */
.app .form-control, .app .form-select { border-radius: 12px; padding: .75rem .9rem; font-size: 1rem; border-color: rgba(0, 0, 0, .12); }
.app .form-control:focus, .app .form-select:focus { border-color: var(--app-gold); box-shadow: 0 0 0 .2rem rgba(var(--app-gold-rgb), .25); }
.app .form-label { font-size: .8rem; font-weight: 600; color: #5b6068; margin-bottom: 4px; }
.app .btn { border-radius: 12px; font-weight: 600; }
.app .btn-lg { padding: .8rem 1rem; font-size: 1rem; }
.app .btn-primary { --bs-btn-bg: var(--app-ink); --bs-btn-border-color: var(--app-ink); --bs-btn-hover-bg: #2a2d35; --bs-btn-hover-border-color: #2a2d35; --bs-btn-active-bg: #000; --bs-btn-active-border-color: #000; }
.app .btn-gold { background: var(--app-gold); border-color: var(--app-gold); color: var(--app-gold-texto); }

/* Grade de horários (seleção por toque) */
.horas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.horas input { position: absolute; opacity: 0; pointer-events: none; }
.horas label {
    display: block; text-align: center; padding: 10px 0; border-radius: 12px; background: var(--app-card);
    border: 1px solid rgba(0, 0, 0, .1); font-weight: 600; font-size: .92rem; cursor: pointer; user-select: none;
}
.horas input:checked + label { background: var(--app-ink); color: #fff; border-color: var(--app-ink); }
.horas input:disabled + label { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
@media (min-width: 480px) { .horas { grid-template-columns: repeat(6, 1fr); } }

/* Aviso rápido (toast) */
.app-toast {
    position: fixed; left: 16px; right: 16px; z-index: 1040; max-width: 608px; margin: 0 auto;
    top: calc(var(--app-safe-t) + 76px); border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
    transition: opacity .3s, transform .3s;
}
.app-toast.sumir { opacity: 0; transform: translateY(-10px); pointer-events: none; }

/* Login */
.login-app { min-height: 100vh; min-height: 100dvh; background: var(--app-ink); display: flex; flex-direction: column; }
.login-app .topo { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; padding: 48px 24px 32px; }
.login-app .topo img { width: 84px; height: 84px; border-radius: 22px; margin-bottom: 14px; }
.login-app .folha { background: var(--app-bg); border-radius: 26px 26px 0 0; padding: 28px 20px calc(28px + var(--app-safe-b)); }
.login-app .folha form { max-width: 420px; margin: 0 auto; }

body.app.sem-abas { padding-bottom: 0; }
.login-app .form-control { background: #fff; }

/* Fechamento de agenda */
.semana a.fechado .num, .mes-grid a.fechado { text-decoration: line-through; color: var(--app-muted); }
.semana a.fechado.sel .num { color: rgba(255, 255, 255, .6); }
.mes-grid a.fechado.sel { color: rgba(255, 255, 255, .7); }
.aviso-fechado {
    display: flex; gap: 10px; align-items: flex-start; background: #2a2d35; color: #fff;
    border-radius: 14px; padding: 10px 14px; font-size: .88rem; margin-bottom: 10px;
}
.aviso-fechado > i { color: var(--app-gold); margin-top: 1px; }
.fechado-slot {
    border-radius: 14px; padding: 11px 14px; font-size: .85rem; color: #8a8f98;
    background: repeating-linear-gradient(45deg, #e9e7e2, #e9e7e2 8px, #f3f2ef 8px, #f3f2ef 16px);
}
.horas input:disabled + label.fechado {
    text-decoration: none; opacity: 1; color: #a0a5ab;
    background: repeating-linear-gradient(45deg, #efede8, #efede8 6px, #fff 6px, #fff 12px);
}

/* Sugestões de clientes (autocompletar) */
.sugestoes {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin-top: 4px;
    background: var(--app-card); border-radius: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, .16); overflow: hidden;
}
.sugestoes button {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    padding: 10px 12px; border: 0; border-bottom: 1px solid var(--app-line); background: none; color: var(--app-ink);
}
.sugestoes button:last-child { border-bottom: 0; }
.sugestoes button:active { background: #f7f7f5; }
.sugestoes button:disabled { opacity: .45; }
.sugestoes .txt { display: flex; flex-direction: column; min-width: 0; }
.sugestoes small { color: var(--app-muted); }
.avatar.sm { width: 32px; height: 32px; font-size: .8rem; }
.min-w-0 { min-width: 0; }

.semana a.folga, .mes-grid a.folga { opacity: .4; }
.semana a.folga.sel, .mes-grid a.folga.sel { opacity: 1; }

/* Chaves liga/desliga na cor do app */
.app .form-check-input:checked { background-color: var(--app-ink); border-color: var(--app-ink); }
.app .form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(var(--app-gold-rgb), .25); border-color: var(--app-gold); }

/* Modal de aviso pelo WhatsApp */
.modal-aviso { max-width: 380px; margin-left: auto; margin-right: auto; padding: 0 16px; }
.modal-aviso .modal-content { border: 0; border-radius: 24px; background: #fff; }
.aviso-icone {
    width: 64px; height: 64px; border-radius: 50%; margin: 0 auto;
    background: #25d366; color: #fff; font-size: 2rem;
    display: flex; align-items: center; justify-content: center;
}
.aviso-msg {
    background: #e7f8ee; border-radius: 14px 14px 14px 4px; padding: 12px 14px;
    font-size: .92rem; line-height: 1.4; color: #1c3a2a;
}

/* Aviso de assinatura (vencimento / atraso / bloqueio) */
.aviso-assinatura {
    display: flex; align-items: center; gap: 10px; border-radius: 14px; padding: 10px 12px 10px 14px;
    font-size: .86rem; line-height: 1.35; margin-bottom: 14px;
}
.aviso-assinatura > i { font-size: 1.1rem; }
.aviso-assinatura .btn { font-weight: 700; border-radius: 10px; white-space: nowrap; }
.aviso-assinatura.aviso { background: #fbf1dc; color: #6b4a0e; }
.aviso-assinatura.aviso .btn { background: var(--app-gold); color: var(--app-gold-texto); }
.aviso-assinatura.atraso { background: #fde2e1; color: #7a1c1a; }
.aviso-assinatura.atraso .btn, .aviso-assinatura.bloqueado .btn { background: #c62828; color: #fff; }
.aviso-assinatura.bloqueado { background: #2a2d35; color: #fff; }
.aviso-assinatura.bloqueado > i { color: #ff8a80; }

/* Assinatura */
.fatura-aberta { border: 2px solid var(--app-gold); }
.fatura-aberta.vencida { border-color: #c62828; }
.como-pagar { background: #f6f5f2; border-radius: 12px; padding: 12px; }

/* Garante que [hidden] esconda mesmo com utilitários do Bootstrap (ex.: d-flex). */
.app [hidden] { display: none !important; }
