/* Por Perto — identidade visual
   Verde petróleo #0C655B, fundo branco quente, cartões claros e sombras discretas.
   Espaçamento em múltiplos de 8px. Área de toque mínima de 48x48. */

:root {
  --verde: #0C655B;
  --verde-escuro: #08514A;
  --verde-suave: #E6F1EC;
  --fundo: #F7F8F4;
  --superficie: #FFFFFF;
  --texto: #172B27;
  --texto-2: #5B6B65;
  --borda: #E4E8E2;
  --alerta: #B3261E;
  --alerta-suave: #FBEAE8;
  --atencao: #8A5A00;
  --atencao-suave: #FDF3E0;
  --raio: 20px;
  --raio-p: 12px;
  --sombra: 0 2px 8px rgba(23, 43, 39, .06), 0 8px 24px rgba(23, 43, 39, .04);
  --e1: 8px; --e2: 16px; --e3: 24px; --e4: 32px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; background: var(--fundo); color: var(--texto);
  font-family: var(--sans); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: env(safe-area-inset-bottom); }

h1, h2, h3 { margin: 0 0 var(--e1); line-height: 1.2; }
h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -.3px; }
h2 { font-size: 21px; font-weight: 650; }
h3 { font-size: 17px; font-weight: 650; }
p { margin: 0 0 var(--e2); }
.secundario { color: var(--texto-2); font-size: 15px; }
.pequeno { font-size: 13px; color: var(--texto-2); }

/* ------------------------------------------------------------ estrutura */

#app { max-width: 520px; margin: 0 auto; min-height: 100vh;
       display: flex; flex-direction: column; }
.tela { flex: 1; padding: var(--e2) var(--e2) 112px; animation: entra .18s ease-out; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tela { animation: none; } }

.cabecalho { display: flex; align-items: center; gap: var(--e2);
             padding: var(--e2) var(--e2) var(--e1); }
.cabecalho .voltar { background: none; border: 0; font-size: 26px; color: var(--verde);
                     width: 48px; height: 48px; border-radius: 50%; cursor: pointer; }
.cabecalho .titulo { font-weight: 650; font-size: 17px; flex: 1; text-align: center; }
.cabecalho .espaco { width: 48px; }

/* ------------------------------------------------------------ marca */

.marca { font-family: var(--serif); font-weight: 600; color: var(--verde);
         font-size: 26px; line-height: .95; letter-spacing: -.5px; }
.marca small { display: block; font-size: 26px; }
.marca .coracao { color: var(--verde); font-size: 15px; vertical-align: super; }
.marca-linha { font-family: var(--serif); font-size: 22px; color: var(--verde); }

/* ------------------------------------------------------------ cartões */

.cartao { background: var(--superficie); border-radius: var(--raio); padding: var(--e2);
          box-shadow: var(--sombra); margin-bottom: var(--e2); border: 1px solid var(--borda); }
.cartao.clicavel { cursor: pointer; display: flex; align-items: center;
                   gap: var(--e2); min-height: 72px; text-align: left; width: 100%;
                   font: inherit; color: inherit; }
.cartao.clicavel:active { transform: scale(.995); }
.cartao.verde { background: var(--verde); color: #fff; border-color: var(--verde); }
.cartao.verde .secundario, .cartao.verde .pequeno { color: rgba(255,255,255,.82); }
.cartao.suave { background: var(--verde-suave); border-color: #D6E7DE; }

.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e2); }

.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
          background: var(--verde-suave); display: grid; place-items: center;
          color: var(--verde); font-weight: 650; font-size: 19px; flex: none; }
.avatar.g { width: 96px; height: 96px; font-size: 32px; }
.avatar.p { width: 40px; height: 40px; font-size: 15px; }

/* ------------------------------------------------------------ botões */

.botao { display: flex; align-items: center; justify-content: center; gap: var(--e1);
         width: 100%; min-height: 56px; border-radius: 16px; border: 0;
         background: var(--verde); color: #fff; font-size: 17px; font-weight: 650;
         font-family: inherit; cursor: pointer; padding: 0 var(--e3); }
.botao:active { background: var(--verde-escuro); }
.botao[disabled] { opacity: .45; cursor: not-allowed; }
.botao.secundario-b { background: var(--superficie); color: var(--verde);
                      border: 1.5px solid var(--borda); }
.botao.alerta { background: var(--alerta-suave); color: var(--alerta); }
.botao.pequeno-b { min-height: 48px; font-size: 15px; }
.acoes-fixas { position: sticky; bottom: 88px; padding-top: var(--e1); }

.pilula { display: inline-flex; align-items: center; gap: 6px; background: var(--superficie);
          border: 1px solid var(--borda); border-radius: 999px; padding: 8px 14px;
          font-size: 14px; color: var(--texto-2); margin: 0 6px 6px 0; }
.pilula.verde { background: var(--verde-suave); color: var(--verde); border-color: #D6E7DE; }
.pilula.demo { background: var(--atencao-suave); color: var(--atencao); border-color: #F0DEBA; }

/* ------------------------------------------------------------ formulários */

label { display: block; font-size: 14px; font-weight: 600; color: var(--texto-2);
        margin: 0 0 6px; }
input, select, textarea {
  width: 100%; min-height: 52px; border-radius: var(--raio-p); border: 1.5px solid var(--borda);
  background: var(--superficie); padding: 12px 14px; font-size: 17px; font-family: inherit;
  color: var(--texto); margin-bottom: var(--e2);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(12, 101, 91, .25); border-color: var(--verde);
}
.campo-duplo { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e2); }

.opcao { display: flex; align-items: flex-start; gap: 12px; padding: 14px;
         border: 1.5px solid var(--borda); border-radius: var(--raio-p);
         background: var(--superficie); margin-bottom: 10px; cursor: pointer;
         min-height: 56px; }
.opcao input { width: 22px; min-height: 22px; margin: 2px 0 0; flex: none; }
.opcao.marcada { border-color: var(--verde); background: var(--verde-suave); }

/* ------------------------------------------------------------ estados */

.selo { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
        padding: 6px 12px; font-size: 13px; font-weight: 650; }
.selo::before { content: ""; width: 8px; height: 8px; border-radius: 50%;
                background: currentColor; }
.selo.ok { background: var(--verde-suave); color: var(--verde); }
.selo.espera { background: var(--atencao-suave); color: var(--atencao); }
.selo.ruim { background: var(--alerta-suave); color: var(--alerta); }
.selo.neutro { background: #EEF0EC; color: var(--texto-2); }

.aviso { border-radius: var(--raio-p); padding: 14px; font-size: 14px;
         margin-bottom: var(--e2); display: block; }
.aviso.info { background: var(--verde-suave); color: #0B4E46; }
.aviso.atencao { background: var(--atencao-suave); color: var(--atencao); }
.aviso.erro { background: var(--alerta-suave); color: var(--alerta); }

.faixa-demo { background: var(--atencao-suave); color: var(--atencao); text-align: center;
              font-size: 13px; font-weight: 650; padding: 8px var(--e2); }
.faixa-offline { background: var(--alerta-suave); color: var(--alerta); text-align: center;
                 font-size: 13px; font-weight: 650; padding: 8px; }

.vazio { text-align: center; padding: var(--e4) var(--e2); color: var(--texto-2); }
.vazio .icone { font-size: 40px; margin-bottom: var(--e2); }

.esqueleto { background: linear-gradient(90deg, #EEF0EC 25%, #F6F7F4 50%, #EEF0EC 75%);
             background-size: 200% 100%; animation: brilho 1.2s infinite;
             border-radius: var(--raio-p); height: 76px; margin-bottom: var(--e2); }
@keyframes brilho { to { background-position: -200% 0; } }

/* ------------------------------------------------------------ linha do tempo */

.linha { list-style: none; margin: 0; padding: 0; }
.linha li { display: flex; gap: 14px; padding-bottom: var(--e2); position: relative; }
.linha li::before { content: "✓"; width: 28px; height: 28px; border-radius: 50%;
                    background: var(--verde); color: #fff; display: grid;
                    place-items: center; font-size: 14px; flex: none; }
.linha li.pendente::before { content: ""; background: #E4E8E2; }
.linha li:not(:last-child)::after { content: ""; position: absolute; left: 13.5px;
                                    top: 30px; bottom: 4px; width: 1.5px; background: var(--borda); }
.linha .hora { font-weight: 650; font-size: 15px; }

/* ------------------------------------------------------------ navegação */

.abas { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,.94);
        backdrop-filter: blur(12px); border-top: 1px solid var(--borda);
        display: flex; padding-bottom: env(safe-area-inset-bottom); z-index: 30; }
.abas-interno { max-width: 520px; margin: 0 auto; display: flex; width: 100%; }
.aba { flex: 1; background: none; border: 0; padding: 10px 4px 12px; cursor: pointer;
       color: var(--texto-2); font-size: 11px; font-family: inherit; min-height: 60px;
       display: flex; flex-direction: column; align-items: center; gap: 4px; }
.aba .icone { font-size: 21px; line-height: 1; }
.aba.ativa { color: var(--verde); font-weight: 650; }

.troca-contexto { display: flex; gap: 6px; padding: 0 var(--e2) var(--e1); }
.troca-contexto button { flex: 1; min-height: 44px; border-radius: 999px; border: 1.5px solid var(--borda);
                         background: var(--superficie); color: var(--texto-2); font-size: 13px;
                         font-weight: 650; font-family: inherit; cursor: pointer; }
.troca-contexto button.ativa { background: var(--verde); color: #fff; border-color: var(--verde); }

/* ------------------------------------------------------------ valores */

.valor { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -.5px; }
.linha-valor { display: flex; justify-content: space-between; gap: var(--e2);
               padding: 10px 0; border-bottom: 1px solid var(--borda); font-size: 15px; }
.linha-valor:last-child { border-bottom: 0; }
.linha-valor.total { font-weight: 700; font-size: 18px; padding-top: 14px; }

/* ------------------------------------------------------------ painel (desktop) */

/* width:100% é necessário: margem automática dentro do flex impede o esticamento */
.painel { width: 100%; max-width: 1180px; margin: 0 auto; padding: var(--e3) var(--e3) 96px; }
.painel .grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
                 gap: var(--e2); }
.painel table { width: 100%; border-collapse: collapse; font-size: 14px; }
.painel th, .painel td { text-align: left; padding: 10px; border-bottom: 1px solid var(--borda); }
.painel th { color: var(--texto-2); font-weight: 650; font-size: 12px;
             text-transform: uppercase; letter-spacing: .4px; }
.metrica { font-family: var(--serif); font-size: 30px; font-weight: 600; }

@media (min-width: 900px) {
  #app.contexto-operacao { max-width: 100%; }
}
