/* Tema base (identidade original do protótipo). As cores da empresa sobrescrevem --c1/--c2 em runtime. */
:root {
  --c1: #667eea;
  --c2: #764ba2;
  --grad: linear-gradient(135deg, var(--c1) 0%, var(--c2) 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #0f0f0f;
  color: #fff;
  padding: 20px;
}

/* ---------- Páginas claras (gerar / cliente) ---------- */
body.claro {
  background: var(--grad);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cartao {
  background: #fff;
  color: #333;
  border-radius: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 50px;
  max-width: 500px;
  width: 100%;
  text-align: center;
}

.logo { max-width: 160px; max-height: 80px; object-fit: contain; margin: 0 auto 16px; display: block; }
.empresa-nome { color: #555; font-size: 20px; font-weight: 600; margin-bottom: 10px; }
.cartao h1 { color: #333; font-size: 34px; margin-bottom: 16px; }
.subtitle { color: #666; font-size: 18px; margin-bottom: 36px; font-weight: 500; }

.botao {
  background: var(--grad);
  color: #fff;
  border: none;
  padding: 25px 50px;
  font-size: 24px;
  font-weight: 700;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  width: 100%;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.botao:hover:not(:disabled) { transform: translateY(-3px); }
.botao:disabled { opacity: 0.6; cursor: wait; transform: none; }

.link-sec { display: inline-block; margin-top: 18px; color: var(--c1); font-weight: 600; text-decoration: none; background: none; border: none; cursor: pointer; font-size: 15px; }
.aviso-existente { background: #fff7e0; border-left: 4px solid #f5a623; color: #7a5200; padding: 14px; border-radius: 10px; margin-bottom: 20px; font-size: 15px; text-align: left; }
.aviso-existente a { color: #7a5200; font-weight: 700; }

/* Cliente */
.numero-grande-c {
  background: var(--grad);
  color: #fff;
  font-size: 100px;
  font-weight: 900;
  padding: 40px 20px;
  border-radius: 20px;
  margin: 24px 0;
  letter-spacing: 12px;
  animation: slideUp 0.5s ease;
  word-break: break-all;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.status { background: #e3f2fd; border-left: 4px solid #2196f3; padding: 20px; margin: 20px 0; border-radius: 10px; color: #1565c0; font-size: 17px; text-align: left; line-height: 1.6; }
.status.vez { background: #d4edda; border-color: #28a745; color: #155724; text-align: center; font-size: 22px; animation: vez 1s infinite; }
.status.fim { background: #eee; border-color: #999; color: #555; }
@keyframes vez { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
body.claro.vez-ativa { background: linear-gradient(135deg, #28a745, #1e7e34); }

.grade2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin: 20px 0; }
.grade2 .item { background: #f8f9fa; padding: 18px; border-radius: 10px; }
.item .rotulo { color: #999; font-size: 12px; text-transform: uppercase; margin-bottom: 8px; }
.item .valor { color: #333; font-size: 24px; font-weight: bold; }

.btn-cinza { width: 100%; padding: 14px; margin: 8px 0; background: #f0f0f0; color: #333; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-cinza:hover { background: #e4e4e4; }
.btn-cinza.perigo { color: #b02a37; }

.conexao { margin-top: 14px; font-size: 12px; color: #999; }
.conexao::before { content: '●'; margin-right: 6px; color: #dc3545; }
.conexao.ok::before { color: #28a745; }

/* ---------- Painel / Admin (escuro) ---------- */
.container { max-width: 800px; margin: 0 auto; }
.container.largo { max-width: 1100px; }
h1.titulo { text-align: center; margin-bottom: 8px; font-size: 32px; }
.topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.topo .quem { color: #aaa; font-size: 14px; }
.topo a, .topo button.link { color: #9fb0ff; background: none; border: none; cursor: pointer; font-size: 14px; text-decoration: underline; width: auto; padding: 0 6px; text-transform: none; }

.display { background: var(--grad); border-radius: 20px; padding: 40px; text-align: center; margin-bottom: 30px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.display .rotulo-d { font-size: 18px; margin-bottom: 10px; text-transform: uppercase; }
.numero { font-size: 120px; font-weight: 900; margin: 10px 0; line-height: 1.1; }
.numero.pulso { animation: pulse 1s; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px; margin-bottom: 30px; }
.info-item { background: #1a1a1a; border: 2px solid #333; border-radius: 15px; padding: 18px; text-align: center; }
.info-label { color: #999; font-size: 12px; text-transform: uppercase; margin-bottom: 10px; }
.info-value { font-size: 36px; font-weight: bold; color: var(--c1); }

.controles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 24px; }
.controle { background: #1a1a1a; border: 2px solid #333; border-radius: 15px; padding: 22px; text-align: center; }
.controle h3 { color: #999; font-size: 12px; text-transform: uppercase; margin-bottom: 14px; }

button, .btn {
  width: 100%; padding: 15px; font-size: 16px; font-weight: 600; border: none; border-radius: 8px;
  cursor: pointer; transition: all 0.2s; text-transform: uppercase; color: #fff; background: #444;
}
button:disabled { opacity: 0.5; cursor: wait; }
.btn-proximo { background: #28a745; } .btn-proximo:hover:not(:disabled) { background: #218838; transform: translateY(-2px); }
.btn-rechamar { background: #17a2b8; } .btn-rechamar:hover:not(:disabled) { background: #138496; }
.btn-finalizar { background: #6c757d; } .btn-finalizar:hover:not(:disabled) { background: #5a6268; }
.btn-atualizar, .btn-primary { background: var(--c1); } .btn-atualizar:hover:not(:disabled), .btn-primary:hover:not(:disabled) { filter: brightness(0.9); }
.btn-reset, .btn-danger { background: #dc3545; } .btn-reset:hover:not(:disabled), .btn-danger:hover:not(:disabled) { background: #c82333; }
.btn-small { width: auto; padding: 8px 14px; font-size: 12px; }

.input-group { display: flex; gap: 10px; }
input, select, textarea {
  flex: 1; padding: 10px; background: #2a2a2a; border: 2px solid #444; border-radius: 8px; color: #fff;
  font-size: 14px; width: 100%; font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--c1); }
input[type='color'] { padding: 2px; height: 40px; width: 70px; flex: none; }

.msg { text-align: center; padding: 14px; background: #d4edda; color: #155724; border-radius: 8px; margin-bottom: 18px; }
.msg.erro { background: #f8d7da; color: #721c24; }

.recentes { background: #1a1a1a; border: 2px solid #333; border-radius: 15px; padding: 18px; margin-bottom: 20px; }
.recentes h3 { color: #999; font-size: 12px; text-transform: uppercase; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: #2a2a2a; border-radius: 20px; padding: 6px 14px; font-weight: 700; font-size: 18px; }
.chip small { color: #999; font-weight: 400; font-size: 12px; margin-left: 6px; }
.tempo { text-align: center; color: #666; font-size: 12px; margin-top: 20px; }
.estado-conexao { text-align: center; color: #888; font-size: 12px; margin-top: 8px; }
.estado-conexao.ok { color: #5cb85c; }

/* Login */
.login-form { max-width: 380px; margin: 60px auto; background: #1a1a1a; border: 2px solid #333; border-radius: 15px; padding: 30px; display: grid; gap: 14px; }
.login-form h2 { text-align: center; }

/* Admin */
.abas { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.abas button { width: auto; padding: 10px 18px; font-size: 13px; background: #2a2a2a; }
.abas button.ativa { background: var(--c1); }
.painel-box { background: #1a1a1a; border: 2px solid #333; border-radius: 15px; padding: 22px; margin-bottom: 20px; }
.painel-box h3 { margin-bottom: 14px; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-grid label { display: grid; gap: 6px; font-size: 12px; color: #aaa; text-transform: uppercase; }
.form-grid label.largo { grid-column: 1 / -1; }
.acoes { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.acoes button { width: auto; padding: 10px 18px; font-size: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #333; vertical-align: middle; }
th { color: #999; font-size: 12px; text-transform: uppercase; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; background: #2a2a2a; }
.tag.ok { background: #1d5c2d; } .tag.off { background: #6b1f27; }
.mono { font-family: Consolas, monospace; font-size: 12px; color: #9fb0ff; word-break: break-all; }
.tabela-scroll { overflow-x: auto; }
.qr-box { background: #fff; padding: 14px; border-radius: 14px; display: inline-block; }
.links-lista { display: grid; gap: 6px; margin-top: 10px; font-size: 14px; }
.links-lista a { color: #9fb0ff; word-break: break-all; }

/* Landing */
.landing { max-width: 560px; margin: 60px auto; text-align: center; }
.landing a.botao { display: block; text-decoration: none; margin: 14px 0; }

/* ---------- TV ---------- */
body.tv { background: #000; padding: 20px; overflow: hidden; }
.tv-container { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; align-items: stretch; height: calc(100vh - 40px); max-width: 1600px; margin: 0 auto; }
.tv .grande { background: var(--grad); border-radius: 40px; padding: 40px; text-align: center; box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; justify-content: center; align-items: center; transition: background 0.3s; }
.tv .marca { display: flex; align-items: center; justify-content: center; gap: 20px; margin-bottom: 20px; }
.tv .marca img { max-height: 90px; max-width: 240px; object-fit: contain; background: rgba(255,255,255,0.92); border-radius: 14px; padding: 8px; }
.tv .marca span { font-size: clamp(22px, 3vw, 44px); font-weight: 700; }
.tv .label { font-size: clamp(22px, 2.6vw, 40px); margin-bottom: 20px; text-transform: uppercase; letter-spacing: 3px; opacity: 0.9; }
.tv .numero-grande { font-size: clamp(120px, 22vw, 380px); font-weight: 900; line-height: 1; }
.tv .grande.chamando { animation: chamando 1.2s ease 2; }
@keyframes chamando {
  0%, 100% { transform: scale(1); box-shadow: 0 20px 80px rgba(0,0,0,.5); }
  25% { transform: scale(1.04); box-shadow: 0 0 120px 30px rgba(255,255,255,.55); }
  50% { transform: scale(1); }
  75% { transform: scale(1.04); box-shadow: 0 0 120px 30px rgba(255,255,255,.55); }
}
.tv .lado-direito { display: flex; flex-direction: column; gap: 24px; justify-content: center; }
.tv .card { background: #fff; border-radius: 25px; padding: 24px; text-align: center; color: #333; }
.tv .info-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.tv .info-mini { background: #fff; border-radius: 15px; padding: 18px; text-align: center; color: #333; }
.tv .info-mini-label { color: #999; font-size: 12px; text-transform: uppercase; margin-bottom: 8px; }
.tv .info-mini-value { font-size: clamp(32px, 4vw, 64px); font-weight: bold; color: var(--c1); }
.tv .qrcode-box h3 { color: #333; margin-bottom: 14px; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
.tv #qrcode { display: flex; justify-content: center; }
.tv #qrcode img, .tv #qrcode canvas { max-width: 100%; height: auto; }
.tv .ultimas { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
.tv .ultimas .chip { background: rgba(255,255,255,0.22); font-size: clamp(18px, 2vw, 30px); }
.tv .som-btn { position: fixed; top: 14px; right: 14px; width: auto; padding: 10px 16px; font-size: 14px; background: rgba(255,255,255,.18); z-index: 5; }
.tv .estado { position: fixed; bottom: 8px; left: 12px; font-size: 12px; color: #666; }
.tv .estado.ok { color: #3a7d44; }

@media (max-width: 1100px) {
  body.tv { overflow: auto; }
  .tv-container { grid-template-columns: 1fr; height: auto; gap: 24px; }
  .tv .grande { padding: 30px 16px; }
}
@media (max-width: 600px) {
  body { padding: 12px; }
  .cartao { padding: 32px 20px; border-radius: 25px; }
  .cartao h1 { font-size: 26px; }
  .numero-grande-c { font-size: 64px; letter-spacing: 8px; }
  .botao { padding: 18px 28px; font-size: 19px; border-radius: 15px; }
  .numero { font-size: 72px; }
  .display { padding: 28px 16px; }
  .info-value { font-size: 28px; }
  .item .valor { font-size: 19px; }
  .input-group { flex-direction: column; }
}

.id-curto { cursor: pointer; white-space: nowrap; border-bottom: 1px dotted #9fb0ff; }
