/* Meraki Clientes — tokens e componentes. Mobile primeiro; a partir de 900 px a barra passa a coluna lateral. */
:root {
  --ink: #17130F;
  --cream: #F3EEE6;
  --paper: #FBF8F3;
  --sand: #E8DFD2;
  --caramel: #B98B5A;
  --caramel-deep: #8C6239;
  --soft: #6B5F55;
  --soft-on-dark: #C9BCAE;
  --branco: #FFFFFF;
  --erro: #9B2C1F;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: Jost, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 66px;
  --lateral: 220px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 400 15px/1.4 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: var(--caramel-deep); }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--caramel-deep); outline-offset: 2px; border-radius: 6px; }
main:focus { outline: none; }

/* ---------- estrutura ---------- */
#app { min-height: 100dvh; }
.ecra { padding: calc(env(safe-area-inset-top) + 28px) 22px calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px); max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.a-carregar { color: var(--soft); padding: 40px 0; text-align: center; }

.sobretitulo { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--caramel-deep); font-weight: 500; }
.titulo { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.05; }
.subtitulo { font-family: var(--serif); font-weight: 600; font-size: 24px; line-height: 1.1; }
.suave { color: var(--soft); }
.pequeno { font-size: 13px; }

/* ---------- navegação ---------- */
#nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around; align-items: center;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--cream); border-top: 1px solid var(--sand); }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 64px; min-height: 48px;
  text-decoration: none; color: var(--caramel-deep); font-size: 11px; font-weight: 500; }
.nav-item[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav-circulo { width: 40px; height: 40px; border-radius: 50%; background: var(--caramel); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.nav-item.destaque { color: var(--caramel-deep); }

@media (min-width: 900px) {
  #nav { top: 0; right: auto; width: var(--lateral); flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 6px;
    padding: 36px 14px; border-top: 0; border-right: 1px solid var(--sand); }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: 12px; font-size: 15px; }
  .nav-item:hover { background: var(--sand); }
  .nav-item[aria-current="page"] { background: var(--sand); }
  .nav-circulo { width: 28px; height: 28px; }
  .nav-circulo svg { width: 18px; height: 18px; }
  #ecra { margin-left: var(--lateral); }
  #nav[hidden] ~ #ecra { margin-left: 0; }
  .ecra { padding: 44px 32px 56px; }
}

/* ---------- cartões, etiquetas, botões ---------- */
.cartao { background: var(--branco); border: 1px solid var(--sand); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.cartao.escuro { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.etiqueta { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--caramel-deep); background: var(--cream); padding: 5px 9px; border-radius: 999px; white-space: nowrap; }
.etiqueta.forte { background: var(--caramel-deep); color: var(--cream); }
.etiqueta.neutra { background: var(--sand); color: var(--soft); }

.botao { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid transparent; border-radius: 12px;
  font-size: 14px; font-weight: 500; line-height: 1; text-decoration: none; cursor: pointer; background: var(--sand); color: var(--ink); }
.botao.primario { background: var(--ink); color: var(--cream); }
.botao.caramelo { background: var(--caramel); color: var(--ink); font-weight: 600; }
.botao.fantasma { background: transparent; border-color: var(--sand); color: var(--ink); }
.botao.perigo { background: transparent; border-color: var(--erro); color: var(--erro); }
.botao.perigo-cheio { background: var(--erro); color: var(--paper); }
.botao.cheio { width: 100%; }
.botao[disabled], .botao[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.botao-icone { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px;
  border: 1px solid var(--sand); background: var(--cream); color: var(--caramel-deep); cursor: pointer; text-decoration: none; }
.botao-icone.simples { border: 0; background: transparent; color: var(--ink); }
.botoes { display: flex; gap: 8px; }
.botoes > .botao:not(.botao-icone) { flex: 1; }

/* ---------- formulários ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > label, .campo > .rotulo { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--caramel-deep); font-weight: 500; }
input, select, textarea { font: inherit; font-size: 16px; /* 16 px: o iOS não faz zoom */ color: var(--ink); background: var(--branco); border: 1px solid var(--sand); border-radius: 14px; padding: 0 14px; min-height: 44px; width: 100%; }
textarea { padding: 10px 14px; resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: #9a8d80; }
.linha-campos { display: flex; gap: 8px; }
.linha-campos > * { flex: 1; min-width: 0; }
.erro-msg { color: var(--erro); font-size: 14px; font-weight: 500; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 32px 22px; max-width: 420px; margin: 0 auto; }
.login-logo { border-radius: 50%; }
.login-caixa { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.login-texto { text-align: center; color: var(--soft); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.codigo { text-align: center; font-size: 28px; letter-spacing: .4em; font-weight: 500; min-height: 56px; }
#ecra:has(.login) { margin-left: 0; }

/* ---------- avisos de sistema ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); display: flex; justify-content: center; pointer-events: none; z-index: 40; padding: 0 16px; }
.toast { background: var(--ink); color: var(--cream); padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(23, 19, 15, .22); }
@media (min-width: 900px) { #toasts { left: var(--lateral); bottom: 28px; } }

.erro-cartao { align-items: flex-start; }
.dialogo { border: 0; border-radius: 20px; padding: 22px; max-width: min(92vw, 400px); background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(23, 19, 15, .3); }
.dialogo::backdrop { background: rgba(23, 19, 15, .45); }
.dialogo h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; margin-bottom: 8px; }
.dialogo p { color: var(--soft); }
.dialogo-botoes { display: flex; gap: 8px; margin-top: 18px; }
.dialogo-botoes .botao { flex: 1; }

@media (prefers-reduced-motion: no-preference) { .toast { animation: entra .2s ease-out; } @keyframes entra { from { opacity: 0; transform: translateY(8px); } } }

/* ---------- Hoje ---------- */
.topo { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.topo-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--ink); color: var(--cream); display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 20px; font-weight: 600; text-decoration: none; }
.contadores { display: flex; gap: 10px; }
.contador { flex: 1; border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.contador.escuro { background: var(--ink); color: var(--cream); }
.contador.escuro .l { color: var(--sand); }
.contador.areia { background: var(--sand); }
.contador.areia .l { color: #5C4A3A; }
.contador .n { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1; }
.contador .l { font-size: 12px; }
.lista-avisos { display: flex; flex-direction: column; gap: 10px; }
.aviso-topo { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.aviso-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aviso-nome { font-size: 16px; font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.aviso-nome.riscado { text-decoration: line-through; }
.aviso.feito { opacity: .6; }
.pequeno-botao { min-height: 36px; padding: 0 12px; font-size: 13px; }
.botao-icone.destaque { background: var(--caramel); color: var(--ink); border-color: var(--caramel); }
.vazio { background: var(--branco); border: 1px dashed var(--sand); border-radius: 18px; padding: 28px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
@media (min-width: 900px) { .lista-avisos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } .lista-avisos > h2 { grid-column: 1 / -1; } }

/* ---------- Clientes: lista, formulário, ficha ---------- */
.barra-fixa { position: sticky; top: 0; z-index: 5; background: var(--cream); margin: 0 -22px; padding: 4px 22px 10px; display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 900px) { .barra-fixa { margin: 0 -32px; padding: 4px 32px 10px; } }
.pesquisa { position: relative; }
.pesquisa svg { position: absolute; left: 14px; top: 13px; color: var(--caramel-deep); pointer-events: none; }
.pesquisa input { padding-left: 42px; }
.lista-clientes { display: flex; flex-direction: column; gap: 8px; }
.linha-cliente { display: flex; align-items: center; gap: 12px; background: var(--branco); border: 1px solid var(--sand); border-radius: 16px; padding: 10px 14px; text-decoration: none; color: var(--ink); min-height: 60px; }
.linha-cliente:hover { border-color: var(--caramel); }
.linha-cliente > svg { color: var(--caramel-deep); flex: none; }
.linha-texto { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.avatar-cliente, .avatar-grande { flex: none; border-radius: 50%; background: var(--caramel); color: var(--ink); display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 600; }
.avatar-cliente { width: 38px; height: 38px; font-size: 17px; }
.avatar-grande { width: 60px; height: 60px; font-size: 26px; }
.centro { display: flex; justify-content: center; }
.ligacao { background: none; border: 0; padding: 12px; min-height: 44px; color: var(--caramel-deep); font-weight: 500; text-decoration: underline; cursor: pointer; }

.barra-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -10px; }
.barra-topo .subtitulo { font-size: 24px; }
.espaco-44 { width: 44px; flex: none; }
.formulario { display: flex; flex-direction: column; gap: 14px; }
.zona-perigo { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--sand); }

.identidade { display: flex; align-items: center; gap: 14px; }
.identidade-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; align-items: flex-start; }
.subtitulo.grande { font-size: 28px; line-height: 1.05; overflow-wrap: anywhere; }
.grelha-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mini { background: var(--branco); border: 1px solid var(--sand); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.mini-valor { font-size: 14px; font-weight: 500; }
.rotulo { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--caramel-deep); font-weight: 500; }
.rotulo-escuro { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--caramel); font-weight: 500; }
.retorno-linha { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.retorno-texto { display: flex; flex-direction: column; gap: 2px; }
.retorno-data { font-size: 15px; font-weight: 500; }
.retorno-quando { font-size: 12px; color: var(--sand); white-space: nowrap; }
.botao.fantasma-escuro { background: transparent; border-color: #5C4A3A; color: var(--sand); }
.campo-claro { background: var(--cream); }
.atencao { color: var(--caramel-deep); }
.cartao p { overflow-wrap: anywhere; }
.lembrete-form { gap: 12px; }
.visitas { display: flex; flex-direction: column; gap: 8px; }
.visitas-topo { display: flex; justify-content: space-between; align-items: baseline; padding-top: 6px; }
.visita { background: var(--branco); border: 1px solid var(--sand); border-radius: 14px; }
.visita summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; min-height: 52px; }
.visita summary::-webkit-details-marker { display: none; }
.visita-texto { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.visita-nome { font-size: 14px; font-weight: 500; }
.visita-valor { font-size: 14px; font-weight: 600; white-space: nowrap; }
.visita-detalhe { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.visita[open] { border-color: var(--caramel); }
.cartao.retorno > .botao.pequeno-botao { align-self: flex-start; }

/* ---------- Registar visita ---------- */
.rotulo-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--caramel-deep); font-weight: 500; }
.cliente-busca { display: flex; gap: 8px; align-items: center; }
.cliente-busca input { flex: 1; min-width: 0; }
.sugestoes { display: flex; flex-direction: column; gap: 6px; }
.sugestao { display: flex; align-items: center; gap: 10px; background: var(--branco); border: 1px solid var(--sand); border-radius: 14px; padding: 8px 12px; min-height: 52px; text-align: left; cursor: pointer; }
.sugestao:hover, .sugestao:focus-visible { border-color: var(--caramel); }
.cliente-escolhido { display: flex; align-items: center; gap: 10px; background: var(--branco); border: 1px solid var(--sand); border-radius: 14px; padding: 8px 10px; }
.nova-inline .cartao { gap: 10px; }
.pilulas { display: flex; flex-wrap: wrap; gap: 8px; }
.pilula { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--sand); background: var(--branco); color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; }
.pilula[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.valor-wrap { position: relative; }
.valor-wrap input { padding-right: 32px; text-align: right; }
.valor-wrap span { position: absolute; right: 14px; top: 11px; color: var(--soft); }
.so-leitor { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.retorno-nota { font-size: 13px; line-height: 1.4; color: var(--sand); }
.botoes-pequenos { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.barra-guardar { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 6px); display: flex; flex-direction: column; gap: 6px; padding: 10px 0 4px; background: var(--cream); border-top: 1px solid var(--sand); margin-top: 4px; }
.botao.grande { min-height: 52px; font-size: 16px; font-weight: 600; border-radius: 14px; }
.centro-texto { text-align: center; }
@media (min-width: 900px) { .barra-guardar { bottom: 0; } }

/* ---------- Mais ---------- */
.lista-menu { display: flex; flex-direction: column; gap: 8px; }
.linha-menu { display: flex; align-items: center; gap: 12px; background: var(--branco); border: 1px solid var(--sand); border-radius: 16px; padding: 12px 14px; text-decoration: none; color: var(--ink); min-height: 64px; }
.linha-menu:hover { border-color: var(--caramel); }
.linha-menu > svg { color: var(--caramel-deep); flex: none; }
.icone-menu { width: 40px; height: 40px; border-radius: 12px; background: var(--cream); color: var(--caramel-deep); display: flex; align-items: center; justify-content: center; flex: none; }
.sessao { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; text-align: center; }
.previa { background: var(--sand); border-radius: 14px 14px 14px 4px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.servico { gap: 10px; }
.servico-linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.servico-semanas { display: flex; align-items: center; gap: 8px; }
.servico-semanas input { width: 80px; text-align: center; }
.servico-ativo { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 500; cursor: pointer; }
.servico-ativo input { width: 22px; min-height: 22px; height: 22px; accent-color: var(--ink); }
.importar-corpo { display: flex; flex-direction: column; gap: 12px; }
.colunas summary { cursor: pointer; font-weight: 500; min-height: 24px; }
.colunas .formulario { margin-top: 12px; }
.passos { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.mini-largo { grid-column: 1 / -1; }
.mini-valor { overflow-wrap: anywhere; }
a.mini-valor { color: var(--ink); text-decoration-color: var(--caramel); text-underline-offset: 3px; }
a.mini-valor.acrescentar { color: var(--caramel-deep); font-weight: 500; }
