:root {
  --ink: #16211e;
  --paper: #f4f5f1;
  --surface: #ffffff;
  --line: #dbded6;
  --line-forte: #b9bfb5;
  --accent: #1f5f52;
  --accent-suave: #e4eeea;
  --alerta: #b4531b;
  --alerta-suave: #fbede2;
  --muted: #6e7973;
  --num: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--accent); }

.topo {
  background: var(--ink);
  color: #eef1ec;
  padding: 0 20px;
}
.topo-interno {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 56px;
  flex-wrap: wrap;
}
.marca { font-weight: 600; letter-spacing: -0.01em; }
.topo nav { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; }
.topo nav a {
  color: #b8c4bd;
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  font-size: 15px;
}
.topo nav a:hover { color: #fff; }
.topo nav a.ativo { color: #fff; border-bottom-color: var(--accent); }
.quem { font-size: 13px; color: #9fada5; display: flex; align-items: center; gap: 12px; }
.quem form { margin: 0; }
.link-botao {
  background: none; border: 0; color: #9fada5; cursor: pointer;
  font: inherit; font-size: 13px; text-decoration: underline; padding: 0;
}

main { max-width: 860px; margin: 0 auto; padding: 28px 20px 64px; }

h1 { font-size: 24px; letter-spacing: -0.02em; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 18px; margin: 32px 0 12px; font-weight: 600; }
.sub { color: var(--muted); margin: 0 0 24px; font-size: 15px; }

.cartao {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

/* Linhas de contagem — o número é o conteúdo, por isso ele domina a linha. */
.linhas { border-top: 1px solid var(--line); }
.linha {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.linha-nome { flex: 1; min-width: 0; }
.linha-nome strong { font-weight: 500; display: block; }
.linha-nome small { color: var(--muted); font-size: 13px; font-family: var(--num); }

input[type="number"], input[type="text"], input[type="password"], select {
  font-family: var(--num);
  font-size: 17px;
  padding: 10px 12px;
  border: 1px solid var(--line-forte);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
input[type="text"], input[type="password"], select { font-family: var(--sans); }
input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input[type="number"] { text-align: right; -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.campo-num { width: 108px; flex: none; }

.botao {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 13px 22px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.botao:hover { background: #17493f; }
.botao-secundario {
  background: transparent; color: var(--accent); border: 1px solid var(--line-forte);
}
.botao-secundario:hover { background: var(--accent-suave); }
.botao-perigo { background: transparent; color: var(--alerta); border: 1px solid var(--alerta); }
.acoes { display: flex; gap: 12px; align-items: center; margin-top: 20px; flex-wrap: wrap; }

.aviso {
  border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; font-size: 15px;
  background: var(--accent-suave); border: 1px solid #c3ddd4; color: #14453b;
}
.aviso-alerta { background: var(--alerta-suave); border-color: #eccbb1; color: #8a3e12; }

.etiqueta {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em;
}
.etiqueta-ok { background: var(--accent-suave); color: #14453b; }
.etiqueta-espera { background: #eceee8; color: var(--muted); }
.etiqueta-alerta { background: var(--alerta-suave); color: #8a3e12; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line-forte);
}
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.n, th.n { text-align: right; font-family: var(--num); }
tr.deficit td { background: var(--alerta-suave); }

.lista-hoteis { display: grid; gap: 12px; }
.hotel-linha {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  text-decoration: none; color: inherit;
}
.hotel-linha:hover { border-color: var(--accent); }
.hotel-linha .nome { flex: 1; font-weight: 500; }

.data-form { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; }
.data-form input { width: auto; }

.vazio { color: var(--muted); padding: 24px 0; }

/* ---------------- Comanda ---------------- */
.corte {
  border-top: 1px dashed var(--line-forte);
  margin: 22px 0;
  text-align: center;
  height: 0;
}
.corte span {
  background: var(--paper);
  padding: 0 10px;
  font-size: 11px;
  color: var(--muted);
  position: relative;
  top: -8px;
}
.comanda { background: #fff; padding: 32px; border: 1px solid var(--line); border-radius: 10px; }
.comanda-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
  border-bottom: 2px solid var(--ink); padding-bottom: 14px; margin-bottom: 18px; }
.comanda-numero { font-family: var(--num); font-size: 26px; font-weight: 600; }
.comanda-meta { font-size: 14px; color: var(--muted); }
.assinaturas { display: flex; gap: 40px; margin-top: 48px; }
.assinatura { flex: 1; border-top: 1px solid var(--ink); padding-top: 6px; font-size: 13px; color: var(--muted); }

@media print {
  /* Duas vias na mesma folha A4, separadas por linha de corte. */
  @page { size: A4; margin: 10mm; }
  .tab-resp, .tab-resp thead, .tab-resp tbody,
  .tab-resp tr, .tab-resp td, .tab-resp th { display: revert; }
  .tab-resp td::before { content: none; }
  body { background: #fff; font-size: 9pt; line-height: 1.35; }
  .topo, .acoes, .nao-imprime { display: none !important; }
  main { max-width: none; padding: 0; }
  .comanda { border: 0; padding: 0; border-radius: 0; }
  tr.deficit td { background: transparent; }

  .comanda-topo { padding-bottom: 5px; margin-bottom: 8px; border-bottom-width: 1.5px; }
  .comanda-topo > div:first-child > div:first-child { font-size: 11pt !important; }
  .comanda-numero { font-size: 15pt; }
  .comanda-meta { font-size: 8pt; }

  table { font-size: 8.5pt; }
  th { padding: 3px 5px; font-size: 7pt; }
  td { padding: 4px 5px; }

  .assinaturas { margin-top: 26px; gap: 26px; }
  .assinatura { font-size: 7.5pt; padding-top: 4px; }

  .corte {
    border-top: 1px dashed #666;
    margin: 12px 0;
    text-align: center;
    height: 0;
  }
  .corte span {
    background: #fff;
    padding: 0 8px;
    font-size: 7pt;
    color: #666;
    position: relative;
    top: -6px;
  }
}

@media screen and (max-width: 700px) {
  /* Tabelas largas viram cartões: cada linha é um bloco,
     cada célula mostra o rótulo da coluna à esquerda. */
  .tab-resp thead { display: none; }
  .tab-resp, .tab-resp tbody, .tab-resp tfoot, .tab-resp tr, .tab-resp td { display: block; width: 100%; }
  .tab-resp tr {
    border: 1px solid var(--line-forte);
    border-radius: 10px;
    padding: 4px 14px;
    margin-bottom: 12px;
    background: var(--surface);
  }
  .tab-resp td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
    text-align: left;
  }
  .tab-resp tr td:last-child { border-bottom: 0; }
  .tab-resp td::before {
    content: attr(data-rotulo);
    flex: none;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
  }
  /* Primeira célula é o título do cartão, sem rótulo. */
  .tab-resp td.cel-nome {
    display: block;
    font-weight: 600;
    font-size: 15px;
    padding: 12px 0 10px;
  }
  .tab-resp td.cel-nome::before { content: none; }
  .tab-resp td.cel-acao { justify-content: flex-end; flex-wrap: wrap; }
  .tab-resp td.cel-acao::before { content: none; }
  .tab-resp td.n { font-size: 16px; }
  .tab-resp input[type="number"], .tab-resp input[type="text"] { width: 120px; }
  tr.deficit td { background: transparent; }
  .tab-resp tr.deficit { border-color: var(--alerta); background: var(--alerta-suave); }

  /* Empilha o cabeçalho na ordem do HTML: marca, navegação, usuário.
     A navegação rola na horizontal em vez de quebrar em várias linhas. */
  .topo-interno {
    display: block;
    padding: 10px 0;
    min-height: 0;
  }
  .marca { display: block; margin-bottom: 8px; }
  .topo nav {
    display: block;
    white-space: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .topo nav::-webkit-scrollbar { display: none; }
  .topo nav a { display: inline-block; margin-right: 18px; }
  .quem {
    display: block;
    font-size: 12px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #2c3a35;
  }
  .quem form { display: inline; margin-left: 10px; }

  main { padding: 18px 14px 48px; }
  h1 { font-size: 21px; }
  .cartao { padding: 14px; }
  .comanda { padding: 16px; }
  .comanda-topo { flex-direction: column; gap: 8px; }
  .assinaturas { flex-direction: column; gap: 28px; }
  .acoes { flex-direction: column; align-items: stretch; }
  .acoes .botao { width: 100%; }
  .acoes form { display: flex; flex-direction: column; gap: 8px; }
  .data-form { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .linha { flex-wrap: wrap; }
  .campo-num { width: 100%; }
  .linha-nome { flex-basis: 100%; }
}
