:root {
  --fundo: #a8bfa3;        /* verde claro do painel Delphi */
  --escuro: #2f4538;       /* verde escuro (cabecalhos/cartoes) */
  --claro: #ffffff;
  --texto: #111;
  --emergencia: #d32f2f;
  --urgencia: #f57c00;
  --naourgente: #2e7d32;
  --internacao: #1976d2;
  --retorno: #7b1fa2;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column;
  background: var(--fundo); color: var(--texto);
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
  overflow: hidden; cursor: none;
}

#topo {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--escuro); color: #fff; padding: 1.2vh 2.5vw;
}
#titulo { font-size: 3.2vh; font-weight: 700; letter-spacing: .1em; }
#relogio { font-size: 3vh; }

main { flex: 1; display: flex; flex-direction: column; gap: 1.6vh; padding: 1.6vh 2vw 0; min-height: 0; }

/* chamada atual */
#chamada { display: flex; flex-direction: column; gap: 1.2vh; }
#tipoAtual {
  display: flex; align-items: center; justify-content: center; gap: 1.2vw;
  min-height: 7vh; background: var(--escuro); color: #fff; border-radius: 1vh;
  font-size: 3.6vh; font-weight: 700;
}
#tipoAtual img { height: 5.5vh; width: auto; }
.duplo { display: grid; grid-template-columns: 1fr 1fr; gap: 2vw; }
.cartao {
  position: relative; background: var(--escuro); color: #fff; border-radius: 1.2vh;
  min-height: 23vh; padding: 3.4vh 2vw 2vh; text-align: center;
  display: flex; flex-direction: column; justify-content: center; gap: 1vh;
}
.rotulo {
  position: absolute; top: 1vh; left: 1.4vw; font-size: 2vh; letter-spacing: .15em; opacity: .7;
}
.nome { font-size: 8vh; font-weight: 800; line-height: 1.05; word-break: break-word; }
.sub { font-size: 3.6vh; opacity: .9; }
.vazio .nome { font-size: 5.5vh; opacity: .55; font-weight: 600; }
.chamando { animation: pisca 0.9s ease-in-out 6; }
@keyframes pisca {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 235, 59, 0); }
  50% { box-shadow: 0 0 0 1.2vh rgba(255, 235, 59, .95); background: #3d5a49; }
}

/* legenda */
#legenda { display: flex; justify-content: center; gap: .9vw; flex-wrap: wrap; }
.item-legenda {
  display: flex; align-items: center; gap: .5vw; background: var(--claro);
  border-radius: 5vh; padding: .5vh 1vw .5vh .5vh; font-size: 2vh; font-weight: 600; white-space: nowrap;
}
.item-legenda img { height: 3.6vh; width: auto; }

/* icones padrao (quando nao ha imagem) */
.selo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 4vh; height: 4vh; border-radius: 50%; color: #fff; font-weight: 800; font-size: 2.4vh;
}
.selo-E { background: var(--emergencia); } .selo-U { background: var(--urgencia); }
.selo-N { background: var(--naourgente); } .selo-C { background: var(--internacao); }
.selo-R { background: var(--retorno); }
#tipoAtual .selo { width: 5.5vh; height: 5.5vh; font-size: 3.4vh; }

/* lista */
#lista { flex: 1; min-height: 0; overflow: hidden; background: var(--claro); border-radius: 1vh; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th {
  background: var(--escuro); color: #fff; font-size: 2.6vh; padding: 1vh .8vw; text-align: center;
}
td {
  font-size: 2.9vh; padding: .9vh .8vw; text-align: center; border: 1px solid #cfd8cc;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
th:nth-child(1) { width: 22%; } th:nth-child(2) { width: 17%; } th:nth-child(3) { width: 18%; }
th:nth-child(4) { width: 10%; } th:nth-child(5) { width: 14%; } th:nth-child(6) { width: 19%; }
td.tipo img { height: 3.6vh; max-width: 100%; object-fit: contain; vertical-align: middle; }
td.tipo .selo { width: 3.6vh; height: 3.6vh; font-size: 2.2vh; }
.st-em { font-weight: 700; color: #1b5e20; }
.st-fin { color: #555; }

/* faixa de mensagens */
footer { padding: 1.2vh 0 0; }
#faixa {
  background: var(--escuro); color: #fff; overflow: hidden; white-space: nowrap;
  font-size: 3vh; padding: 1.2vh 0;
}
#mensagem { display: inline-block; padding-left: 100vw; animation: corre linear infinite; }
@keyframes corre { to { transform: translateX(-100%); } }

#aviso {
  position: fixed; right: 1vw; bottom: 8vh; max-width: 40vw; background: rgba(0,0,0,.78); color: #fff;
  padding: 1vh 1.4vw; border-radius: 1vh; font-size: 2vh; cursor: pointer;
}
#aviso.erro { background: rgba(183, 28, 28, .92); }

#ativarSom {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 90; background: rgba(0, 0, 0, .78); color: #fff;
  display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer;
}
#ativarSom[hidden] { display: none; }
#ativarSom h1 { font-size: 7vh; margin: 0 0 2vh; }
#ativarSom p { font-size: 3.6vh; margin: 0; }
#bloqueio {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; background: #7f1d1d; color: #fff; display: flex;
  flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 4vw;
}
#bloqueio[hidden] { display: none; }
#bloqueio h1 { font-size: 8vh; margin: 0 0 3vh; }
#bloqueio p { font-size: 3.4vh; margin: 1vh 0; }

@media (max-width: 900px) {
  .duplo { grid-template-columns: 1fr; }
  .nome { font-size: 6vh; }
}
