:root {
  --tinta: #0b3b36;
  --tinta-2: #145a52;
  --fundo: #f4f2ec;
  --papel: #ffffff;
  --linha: #e3dfd4;
  --texto: #1d2422;
  --suave: #66706c;
  --ouro: #f2b544;
  --ouro-esc: #b9831a;
  --ok: #15803d;
  --ok-bg: #e7f6ec;
  --alerta: #b45309;
  --alerta-bg: #fdf3e2;
  --erro: #b91c1c;
  --erro-bg: #fdecec;
  --azul: #1d4ed8;
  --azul-bg: #e8eefc;
  --raio: 12px;
  --sombra: 0 1px 2px rgba(11, 59, 54, .06), 0 4px 16px rgba(11, 59, 54, .06);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--texto);
  background: var(--fundo);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.45; }
a { color: var(--tinta-2); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.muted { color: var(--suave); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }

/* Estrutura */
.layout { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.lateral { background: var(--tinta); color: #dfe9e6; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.marca { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.marca .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--ouro); display: grid; place-items: center; color: var(--tinta); font-size: 18px; }
.marca small { display: block; font-weight: 500; font-size: 12px; color: #9fbab4; letter-spacing: 0; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: #cfdfdb; text-decoration: none; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.ativo { background: rgba(242, 181, 68, .16); color: #fff; box-shadow: inset 3px 0 0 var(--ouro); }
.nav .ic { width: 20px; text-align: center; opacity: .9; }
.nav .badge { margin-left: auto; background: var(--ouro); color: var(--tinta); border-radius: 99px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.nav .sep { height: 1px; background: rgba(255, 255, 255, .1); margin: 10px 6px; }
.lateral .rodape { margin-top: auto; font-size: 13px; padding: 8px; color: #9fbab4; }
.lateral .rodape button { background: none; border: 0; color: #cfdfdb; padding: 0; cursor: pointer; text-decoration: underline; font: inherit; }
.principal { padding: 26px 32px 60px; max-width: 1200px; width: 100%; }
.topo { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topo .acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.menu-movel { display: none; }

/* Componentes */
.card { background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 18px 20px; box-shadow: var(--sombra); }
.card + .card { margin-top: 16px; }
.grade > .card { margin-top: 0; }
.card-titulo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.grade { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi .rot { font-size: 13px; color: var(--suave); font-weight: 500; }
.kpi .val { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12.5px; color: var(--suave); }
.barra { height: 6px; background: #ece8dd; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.barra > i { display: block; height: 100%; background: var(--tinta-2); border-radius: 99px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--linha); background: var(--papel); color: var(--texto); padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #c9c3b4; }
.btn.prim { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.btn.prim:hover { background: var(--tinta-2); }
.btn.ouro { background: var(--ouro); border-color: var(--ouro); color: var(--tinta); }
.btn.perigo { color: var(--erro); }
.btn.peq { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--tinta-2); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

label.campo { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 12px; }
label.campo > span.dica { font-weight: 400; color: var(--suave); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=time], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: 5px; font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid #d6d1c4; border-radius: 9px; background: #fff; color: var(--texto);
}
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(20, 90, 82, .25); border-color: var(--tinta-2); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; margin: 6px 0; }
.check input { width: 17px; height: 17px; accent-color: var(--tinta); }

.seg { display: inline-flex; background: #ece8dd; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 13px; border-radius: 8px; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--suave); cursor: pointer; }
.seg button.on { background: #fff; color: var(--tinta); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--linha); }
.tabela td { padding: 10px; border-bottom: 1px solid #efece4; vertical-align: middle; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela tr.clicavel:hover td { background: #faf8f3; cursor: pointer; }
.rolagem { overflow-x: auto; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eeebe3; color: var(--suave); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.alerta { background: var(--alerta-bg); color: var(--alerta); }
.pill.erro { background: var(--erro-bg); color: var(--erro); }
.pill.azul { background: var(--azul-bg); color: var(--azul); }
.pill .pt { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; color: #fff; margin: 1px 3px 1px 0; }

.vazio { text-align: center; padding: 36px 16px; color: var(--suave); }
.vazio .grande { font-size: 34px; margin-bottom: 6px; }
.aviso { padding: 11px 14px; border-radius: 10px; background: var(--alerta-bg); color: #7c3f06; font-size: 14px; margin-bottom: 16px; }
.aviso.info { background: var(--azul-bg); color: #1e3a8a; }
.aviso.ok { background: var(--ok-bg); color: #14532d; }

/* Composição de mensagem */
.compor { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .9fr); gap: 18px; align-items: start; }
.passo { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.passo .n { width: 26px; height: 26px; border-radius: 50%; background: var(--tinta); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.chip { border: 1px dashed #b9b2a1; background: #faf8f3; border-radius: 7px; padding: 3px 9px; font-size: 12.5px; cursor: pointer; font-family: ui-monospace, Menlo, Consolas, monospace; }
.chip:hover { border-style: solid; border-color: var(--tinta-2); }
.lista-sel { max-height: 260px; overflow: auto; border: 1px solid var(--linha); border-radius: 10px; margin-top: 8px; }
.lista-sel label { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid #f0ede5; cursor: pointer; font-size: 14px; }
.lista-sel label:hover { background: #faf8f3; }
.lista-sel input { accent-color: var(--tinta); width: 16px; height: 16px; }
.contagem { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #f5f9f8; border: 1px solid #d5e6e2; border-radius: 10px; margin-top: 12px; font-size: 14px; }
.contagem b { font-size: 22px; color: var(--tinta); }

.celular { background: #e9e2d6; border-radius: 22px; padding: 14px; position: sticky; top: 20px; border: 8px solid #1d2422; }
.celular .cab { display: flex; align-items: center; gap: 10px; background: var(--tinta); color: #fff; margin: -14px -14px 14px; padding: 12px 14px; border-radius: 12px 12px 0 0; font-weight: 600; font-size: 14px; }
.celular .cab .av { width: 30px; height: 30px; border-radius: 50%; background: var(--ouro); color: var(--tinta); display: grid; place-items: center; font-size: 14px; }
.balao { background: #fff; border-radius: 0 10px 10px 10px; padding: 8px 10px 18px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; position: relative; max-width: 92%; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); min-height: 40px; }
.balao .hora { position: absolute; right: 8px; bottom: 3px; font-size: 11px; color: #8a918e; }
.balao img { max-width: 100%; border-radius: 6px; display: block; margin-bottom: 6px; }
.balao .doc { background: #f3f1ec; border-radius: 6px; padding: 8px; font-size: 13px; margin-bottom: 6px; }

/* QR */
.qr-box { display: grid; grid-template-columns: 320px 1fr; gap: 28px; align-items: center; }
.qr-box img { width: 300px; height: 300px; border-radius: 12px; border: 1px solid var(--linha); background: #fff; padding: 8px; }
.qr-vazio { width: 300px; height: 300px; border-radius: 12px; border: 1px dashed #c9c3b4; display: grid; place-items: center; color: var(--suave); text-align: center; padding: 20px; }
ol.passos li { margin-bottom: 8px; }

/* Datas */
.data-item { display: flex; gap: 14px; align-items: center; padding: 11px 0; border-bottom: 1px solid #efece4; }
.data-item:last-child { border-bottom: 0; }
.calend { width: 50px; flex: none; text-align: center; border: 1px solid var(--linha); border-radius: 9px; overflow: hidden; background: #fff; }
.calend .m { background: var(--tinta); color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 2px 0; }
.calend .d { font-size: 19px; font-weight: 700; padding: 3px 0; }
.data-item .info { flex: 1; min-width: 0; }

/* Mensagens recebidas */
.msg-rec { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #efece4; }
.msg-rec .av { width: 36px; height: 36px; border-radius: 50%; background: #e2ece9; color: var(--tinta); display: grid; place-items: center; font-weight: 700; flex: none; }
.msg-rec.nova .av { background: var(--ouro); }

/* Modal e toast */
.modal { position: fixed; inset: 0; background: rgba(13, 27, 25, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal[hidden] { display: none; }
.modal .caixa { background: #fff; border-radius: 14px; width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal .caixa.larga { width: min(860px, 100%); }
.modal .rodape-modal { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--tinta); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 500; z-index: 60; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); max-width: 90vw; }
.toast.erro { background: var(--erro); }

/* Login */
.tela-login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, #1c6b61 0, transparent 60%), var(--tinta); }
.tela-login .caixa { background: #fff; border-radius: 18px; padding: 30px; width: min(420px, 100%); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.tela-login .marca { color: var(--tinta); padding: 0 0 18px; }
.tela-login .marca small { color: var(--suave); }

.filtros { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: end; }
.filtros > * { flex: 1 1 180px; margin: 0; }
.filtros input, .filtros select { margin-top: 0; }

@media (max-width: 980px) {
  .compor { grid-template-columns: 1fr; }
  .celular { position: static; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: 1fr; }
  .qr-box { grid-template-columns: 1fr; justify-items: center; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .lateral { position: fixed; z-index: 40; left: 0; top: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .lateral.aberta { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .principal { padding: 16px 14px 60px; }
  .btn.menu-movel { display: inline-flex; }
  .g2 { grid-template-columns: 1fr; }
  .tabela .esconder-movel { display: none; }
}

/* Relatório */
.grafico-meses { display: flex; flex-direction: column; gap: 8px; }
.gm-linha { display: grid; grid-template-columns: 120px 1fr 100px; gap: 10px; align-items: center; padding: 2px 0; border-radius: 6px; }
.gm-linha:hover { background: #faf8f3; }
.gm-rot { font-size: 13px; color: var(--suave); }
.gm-barra { display: flex; gap: 2px; height: 14px; }
.gm-barra i { display: block; height: 100%; border-radius: 4px; min-width: 0; }
.gm-barra i:first-child { border-radius: 4px 0 0 4px; }
.gm-barra i:last-child { border-radius: 0 4px 4px 0; }
.gm-val { text-align: right; color: var(--suave); }

@media print {
  .lateral, .topo .acoes, .filtros-rel, .no-print, .menu-movel { display: none !important; }
  .layout { display: block; }
  .principal { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
  details { display: block; } details > * { display: block; }
}
