* { box-sizing: border-box; }
body {
  font-family: Segoe UI, Arial, sans-serif;
  background: #f4f6f8;
  color: #222;
  margin: 0;
  padding: 20px;
}
h1 { font-size: 20px; margin-bottom: 4px; }
.subtitulo { color: #666; margin-top: 0; margin-bottom: 20px; font-size: 13px; }

.topo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.topo .logo { width: 36px; height: 36px; flex-shrink: 0; }
.topo-titulos { flex: 1; min-width: 0; }
.topo-titulos h1 { margin-bottom: 2px; }
.topo-titulos .subtitulo { margin-bottom: 0; }
.topo-usuario {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #444;
  white-space: nowrap;
}
.botao-link {
  display: inline-block;
  text-decoration: none;
  color: #fff;
  background: #6c757d;
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 13px;
}
.botao-link:hover { background: #565e64; }

.escondido { display: none; }

.pagina-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.caixa-login {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  padding: 32px;
  width: 340px;
  max-width: 100%;
  text-align: center;
}
.caixa-login .logo-login { width: 48px; height: 48px; margin-bottom: 10px; }
.caixa-login h1 { font-size: 17px; margin-bottom: 2px; }
.caixa-login .subtitulo { margin-bottom: 20px; }
.caixa-login form { text-align: left; }
.caixa-login button { width: 100%; margin-top: 6px; }
.erro-login { color: #c62828; font-size: 12px; margin: 4px 0 0; }

.painel {
  background: #fff;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.barra {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.barra label { font-size: 13px; color: #444; }

.busca {
  flex: 1;
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
}
.busca:focus { outline: 2px solid #1a5fb4; outline-offset: -1px; }

button {
  background: #1a5fb4;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
}
button:hover { background: #144a8f; }
button:disabled { background: #aaa; cursor: not-allowed; }
button.secundario { background: #6c757d; }
button.secundario:hover { background: #565e64; }
button.perigo { background: #c62828; }

.resumo {
  display: flex;
  gap: 24px;
  margin-left: auto;
  font-size: 13px;
}
.resumo b { font-size: 16px; display: block; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 6px 8px; border-bottom: 1px solid #eee; text-align: left; }
th { background: #f0f2f5; position: sticky; top: 0; }
tr.erro { background: #fdecea; }
td.num { text-align: right; }
td.status { white-space: nowrap; }
td.acoes button { padding: 4px 8px; font-size: 12px; margin-right: 4px; }

.modal-fundo {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
}
.modal-fundo.escondido { display: none; }
.modal {
  background: #fff;
  border-radius: 6px;
  padding: 20px;
  width: 420px;
  max-width: 90vw;
}
.modal h2 { margin-top: 0; font-size: 16px; }
.campo { margin-bottom: 10px; }
.campo label { display: block; font-size: 12px; color: #444; margin-bottom: 3px; }
.campo input, .campo select {
  width: 100%;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
}
.linha-dupla { display: flex; gap: 10px; }
.linha-dupla .campo { flex: 1; }
.acoes-modal { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- Responsivo (celular / telas estreitas) ---------- */

@media (max-width: 720px) {
  body { padding: 12px; }

  .topo { flex-wrap: wrap; gap: 10px 14px; }
  .topo-titulos { flex-basis: 100%; }
  .topo-usuario { flex-wrap: wrap; gap: 8px; margin-left: auto; white-space: normal; }
  .topo-usuario span { white-space: normal; word-break: break-word; }

  .caixa-login { padding: 24px 18px; }

  .barra { flex-direction: column; align-items: stretch; gap: 10px; }
  .busca { width: 100%; padding: 11px 10px; font-size: 16px; }
  .barra label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
  }
  .barra label input[type="date"] { flex: 1; min-width: 0; }
  .barra > button { width: 100%; }
  .resumo { margin-left: 0; width: 100%; justify-content: space-between; gap: 8px; }

  button { padding: 11px 16px; font-size: 14px; }

  /* Tabela vira lista de cartões: cada <tr> é um cartão, cada <td> uma linha rótulo/valor. */
  table, thead, tbody, th, td, tr { display: block; width: 100%; }
  thead { position: absolute; left: -9999px; top: -9999px; }
  table { border: none; }
  tbody tr {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 4px 10px;
  }
  tbody tr.erro { border-color: #f3b5ae; }
  td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    text-align: right;
  }
  td:last-child { border-bottom: none; }
  td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 12px;
    color: #555;
    text-align: left;
    flex-shrink: 0;
  }
  td.acoes { justify-content: flex-end; gap: 8px; }
  td.acoes::before { display: none; }
  td.acoes button { padding: 9px 14px; font-size: 13px; margin-right: 0; }

  .modal { width: 100%; max-width: 100%; height: 100%; max-height: 100vh; border-radius: 0; overflow-y: auto; }
  .modal-fundo { padding: 0; }
  .linha-dupla { flex-direction: column; gap: 0; }
  .campo input, .campo select { font-size: 16px; padding: 10px; }
  .acoes-modal button { flex: 1; padding: 12px; }
}
