/* ============ RESET ============ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { overflow: hidden; }
body {
  background-color: #000;
  color: #c9d1d9;
  font-family: 'Segoe UI', Roboto, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  transition: padding-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 95%;
  max-width: 900px;
  height: 95vh;
  transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ BOAS-VINDAS ============ */
.welcome-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: opacity 0.5s;
}
.welcome-overlay.hidden { opacity: 0; pointer-events: none; }
.welcome-card { text-align: center; padding: 40px; }
.welcome-icon { font-size: 5em; margin-bottom: 20px; animation: pulse 2s infinite; }
.welcome-card h2 { color: #58a6ff; font-size: 2em; margin-bottom: 15px; }
.welcome-card p { color: #8b949e; font-size: 1.2em; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* ============ MODAL DE ALARME ============ */
.alarm-modal {
  position: fixed; inset: 0;
  z-index: 2500;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(65, 105, 225, 0.2);
}
.alarm-modal.open {
  display: flex;
  animation: backdropPulse 0.5s infinite alternate;
}
@keyframes backdropPulse {
  from { background: rgba(65, 105, 225, 0.1); }
  to { background: rgba(65, 105, 225, 0.35); }
}
.alarm-modal-content {
  background: #0a0a0a;
  padding: 40px 50px;
  border-radius: 20px;
  border: 4px solid #4169E1;
  box-shadow: 0 0 60px rgba(65, 105, 225, 0.8);
  text-align: center;
  max-width: 650px; width: 90%;
  animation: modalShake 0.5s ease, bordaPulse 1s infinite alternate 0.5s;
}
@keyframes modalShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-12px); }
  40% { transform: translateX(12px); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(8px); }
}
@keyframes bordaPulse {
  from { border-color: #4169E1; box-shadow: 0 0 40px rgba(65, 105, 225, 0.5); }
  to { border-color: #5a7be6; box-shadow: 0 0 90px rgba(65, 105, 225, 1); }
}
.alarm-modal h2 { color: #f85149; font-size: 1.8em; margin-bottom: 15px; letter-spacing: 2px; padding-left: 2px; }
.alarm-senha-numero {
  font-size: 15vh; font-weight: 900; color: #58a6ff;
  text-shadow: 0 0 40px rgba(88, 166, 255, 0.8);
  line-height: 1; margin: 20px 0;
}
.alarm-modal p { color: #c9d1d9; font-size: 1.1em; margin-bottom: 20px; }
.alarm-contador { color: #fff; font-size: 1.4em; font-weight: bold; margin-bottom: 25px; }
.btn-ciente {
  background: #4169E1; color: white; border: none;
  padding: 22px 40px; font-size: 1.5em; border-radius: 12px;
  cursor: pointer; font-weight: bold; width: 100%;
  box-shadow: 0 0 20px rgba(65, 105, 225, 0.8);
  animation: pulse 1s infinite;
}
.btn-ciente:hover { background: #5a7be6; }

/* ============ MODAIS GENÉRICOS ============ */
.overlay-modal {
  position: fixed; inset: 0;
  z-index: 2200;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.75);
}
.overlay-modal.open { display: flex; }
.overlay-content {
  background: #0d1117;
  padding: 25px 30px;
  border-radius: 16px;
  border: 1px solid #30363d;
  max-width: 500px; width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.9);
}
.overlay-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; padding-bottom: 15px;
  border-bottom: 1px solid #1a1a1a;
}
.overlay-header h2 { color: #58a6ff; font-size: 1.3em; }
.overlay-header button {
  background: #da3633; border: none; color: #fff;
  font-size: 1.3em; cursor: pointer; padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s;
  font-family: inherit;
  line-height: 1;
}
.overlay-header button:hover { background: #f85149; color: #fff; }
.config-section { margin-bottom: 25px; }
.config-label {
  display: block; color: #8b949e; font-size: 0.95em;
  margin-bottom: 12px;
}
.config-row {
  display: flex; align-items: center; gap: 15px;
  justify-content: center;
}
.config-row span { color: #8b949e; font-size: 1em; }
.config-row input[type="text"] {
  padding: 12px; width: 100px; text-align: center;
  background: #000; color: #fff;
  border: 1px solid #30363d; border-radius: 8px;
  font-size: 1.3em; font-family: monospace; font-weight: bold;
}
.config-row input[type="text"]:focus { outline: none; border-color: #58a6ff; }
.config-row input[type="text"]#hora-inicio,
.config-row input[type="text"]#hora-fim {
  width: 100px;
  padding: 10px 8px;
  font-family: 'Consolas', 'Monaco', monospace;
}
.config-slider-row {
  display: flex; align-items: center; gap: 15px;
  justify-content: center;
}
.config-slider-row input[type="range"] {
  flex: 1; max-width: 250px;
  accent-color: #58a6ff;
}
.slider-value {
  color: #58a6ff; font-size: 1.5em; font-weight: bold;
  min-width: 40px; text-align: center;
}
.config-hint {
  color: #484f58; font-size: 0.8em;
  margin-top: 8px; text-align: center;
  font-style: italic;
  line-height: 1.4;
}
.btn-panel {
  padding: 14px; font-size: 1em; background: #1f6feb;
  color: white; border: none; border-radius: 8px;
  cursor: pointer; font-weight: bold; width: 100%;
  margin-top: 10px;
}
.btn-panel:hover { background: #388bfd; }

/* ============ HEADER ============ */
.header {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  padding: clamp(8px, 1vw, 14px) clamp(10px, 1.5vw, 18px);
  gap: clamp(6px, 1vw, 12px);
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: clamp(8px, 1vw, 14px);
  border: 1px solid #1a1a1a;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  transform: translateY(0);
  opacity: 1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.header.collapsed,
.app-wrapper.fullscreen .header {
  transform: translateY(-110%);
  opacity: 0;
  pointer-events: none;
}
.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: clamp(6px, 0.8vw, 10px) clamp(8px, 1vw, 14px);
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid #30363d;
  border-radius: clamp(8px, 1vw, 10px);
  color: #c9d1d9;
  font-size: clamp(0.75em, 0.9vw, 0.9em);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  justify-self: center;
  min-height: clamp(36px, 5vh, 48px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.header-btn:hover {
  background: rgba(88, 166, 255, 0.12);
  border-color: #58a6ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(88, 166, 255, 0.2);
}
.header-btn:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.header-btn.ativo { border-color: #58a6ff; color: #58a6ff; background: rgba(88, 166, 255, 0.1); }
.header-btn .btn-icon { font-size: 1.2em; line-height: 1; }
.header-btn .btn-label { white-space: nowrap; }

.status-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: clamp(6px, 0.8vw, 10px) clamp(10px, 1.2vw, 16px);
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid #30363d;
  border-radius: clamp(8px, 1vw, 12px);
  color: #c9d1d9;
  font-size: clamp(0.75em, 0.9vw, 0.95em);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s ease;
  min-height: clamp(36px, 5vh, 48px);
  width: 100%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  justify-self: center;
  overflow: hidden;
}
.status-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.4); filter: brightness(1.15); }
.status-btn:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.status-btn .status-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: #f85149; flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.status-btn .status-label {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; text-align: center;
}
.status-btn.estado-0 { border-color: #484f58; background: rgba(72, 79, 88, 0.15); color: #8b949e; }
.status-btn.estado-0 .status-dot { background: #f85149; box-shadow: 0 0 8px rgba(248, 81, 73, 0.8); }
.status-btn.estado-1-ativo { border-color: #58a6ff; background: rgba(88, 166, 255, 0.1); color: #c9d1d9; }
.status-btn.estado-1-ativo .status-dot { background: #3fb950; box-shadow: 0 0 10px rgba(63, 185, 80, 0.9); }
.status-btn.estado-1-silenciado { border-color: #d29922; background: rgba(210, 153, 34, 0.1); color: #d29922; }
.status-btn.estado-1-silenciado .status-dot { background: #d29922; box-shadow: 0 0 10px rgba(210, 153, 34, 0.9); }
.status-btn.estado-1-fora { border-color: #58a6ff; background: rgba(88, 166, 255, 0.04); color: #8b949e; opacity: 0.75; }
.status-btn.estado-1-fora .status-dot { background: #3fb950; box-shadow: 0 0 6px rgba(63, 185, 80, 0.5); }
.status-btn.estado-2 { border-color: #3fb950; background: rgba(63, 185, 80, 0.1); color: #c9d1d9; }
.status-btn.estado-2 .status-dot { background: #3fb950; box-shadow: 0 0 10px rgba(63, 185, 80, 0.9); }

/* ============ CARD DA SENHA ============ */
.container {
  position: relative;
  container-type: size;
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: clamp(15px, 2vw, 30px);
  padding-top: clamp(80px, 12vh, 110px);
  text-align: center;
  background-color: #0a0a0a;
  border-radius: clamp(12px, 1.5vw, 20px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.7);
  border: 1px solid #1a1a1a;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  transition: padding-top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-wrapper.fullscreen .container {
  padding-top: clamp(10px, 2vh, 20px);
  padding-bottom: clamp(40px, 6vh, 60px);
}
.app-wrapper.fullscreen .alarm-config-info {
  max-height: 0; opacity: 0; margin: 0; padding: 0;
  overflow: hidden; pointer-events: none;
}

.center-block {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px;
  min-height: 0; min-width: 0; overflow: hidden;
  transition: padding-bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* ============ MENSAGEM DE SAUDAÇÃO ============ */
.saudacao-mensagem {
  position: absolute;
  top: 80%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  color: #58a6ff;
  font-size: 1.2em;
  font-weight: 600;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(88, 166, 255, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
  z-index: 20;
  white-space: nowrap;
}
.saudacao-mensagem.mostrar {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ RELÓGIO ============ */
.relogio {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: clamp(1.6em, 3vw, 2.4em);
  font-weight: 400;
  color: #ffffff;
  opacity: 0.95;
  letter-spacing: 3px;
  padding-left: 3px;
  text-align: center;
  margin-bottom: 0;
  user-select: none;
  transition: opacity 0.3s;
  flex-shrink: 0;
}

/* ============ RELÓGIO COM BORDA (FULLSCREEN) + STATUS ============ */
.relogio-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 14px;
  border: 3px solid transparent;
  border-radius: 16px;
  transition: border-color 0.4s ease, box-shadow 0.4s ease, padding 0.4s ease;
  flex-shrink: 0;
  margin-bottom: 4px;
}

.app-wrapper.fullscreen .relogio-wrapper {
  padding: 10px 26px;
  margin-bottom: 18px;
}

.app-wrapper.fullscreen .relogio { display: none; }

.app-wrapper.fullscreen .relogio-wrapper.estado-0 { border-color: #484f58; }
.app-wrapper.fullscreen .relogio-wrapper.estado-1-ativo {
  border-color: #58a6ff;
  box-shadow: 0 0 22px rgba(88, 166, 255, 0.35);
}
.app-wrapper.fullscreen .relogio-wrapper.estado-1-silenciado {
  border-color: #d29922;
  box-shadow: 0 0 22px rgba(210, 153, 34, 0.35);
}
.app-wrapper.fullscreen .relogio-wrapper.estado-1-fora {
  border-color: #58a6ff;
  opacity: 0.65;
  box-shadow: 0 0 15px rgba(88, 166, 255, 0.15);
}
.app-wrapper.fullscreen .relogio-wrapper.estado-2 {
  border-color: #3fb950;
  box-shadow: 0 0 22px rgba(63, 185, 80, 0.35);
}

.fullscreen-status {
  display: none;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.95em;
  font-weight: 600;
  letter-spacing: 1.5px;
  padding-left: 1.5px;
  text-transform: uppercase;
  text-align: center;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.app-wrapper.fullscreen .fullscreen-status { display: block; }

.app-wrapper.fullscreen .relogio-wrapper.estado-0 .fullscreen-status { color: #8b949e; }
.app-wrapper.fullscreen .relogio-wrapper.estado-1-ativo .fullscreen-status { color: #58a6ff; }
.app-wrapper.fullscreen .relogio-wrapper.estado-1-silenciado .fullscreen-status { color: #d29922; }
.app-wrapper.fullscreen .relogio-wrapper.estado-1-fora .fullscreen-status { color: #58a6ff; opacity: 0.85; }
.app-wrapper.fullscreen .relogio-wrapper.estado-2 .fullscreen-status { color: #3fb950; }

/* ============ NÚMERO DA SENHA ============ */
#senha-display {
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(24px, min(38cqw, 42cqh), 320px);
  font-weight: 900; color: #58a6ff;
  text-shadow: 0 0 40px rgba(88, 166, 255, 0.6);
  line-height: 1.05; margin: 0;
  padding: 4px 0;
  transition: font-size 0.4s ease, color 0.4s;
  white-space: nowrap; max-width: 100%; max-height: 100%;
  min-height: 0; overflow: visible;
  cursor: pointer; user-select: none;
}
#senha-display.offline {
  color: #484f58; text-shadow: none; opacity: 0.6; font-weight: 400;
}
#senha-display.incerta {
  color: #8b949e; text-shadow: none; opacity: 0.85;
}
@supports (font-size: 1cqh) {
  #senha-display { font-size: clamp(24px, min(38cqw, 42cqh), 320px); }
  .app-wrapper.fullscreen #senha-display {
    font-size: clamp(100px, min(44cqw, 52cqh), 640px);
    line-height: 1.0;
  }
}

@keyframes piscarSenha {
  0% {
    color: #ffffff;
    text-shadow: 0 0 80px rgba(255, 255, 255, 1), 0 0 120px rgba(255, 255, 255, 0.7);
  }
  100% {
    color: #58a6ff;
    text-shadow: 0 0 40px rgba(88, 166, 255, 0.6);
  }
}
#senha-display.piscando { animation: piscarSenha 600ms ease-out; }

/* ============ AVISOS DO ADMIN ============ */
.avisos-motorista {
  display: none;
  width: 100%;
  margin: 8px auto 2px;
  padding: 0 10px;
  max-width: 95%;
  text-align: center;
  line-height: 1.35;
  font-size: 1.15em;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #ffa657;
  user-select: none;
  flex-shrink: 0;
  transition: opacity 0.3s;
  word-break: break-word;
}
.avisos-motorista.ativo { display: block; }
.avisos-motorista .aviso-item { display: inline-block; margin: 0 2px; }
.avisos-motorista .aviso-sep {
  display: inline-block; margin: 0 6px; color: #6e7681; opacity: 0.6;
}
.avisos-motorista .aviso-direcionamento { color: #ffa657; }
.avisos-motorista .aviso-encerramento { color: #ffa657; }
.avisos-motorista .aviso-fila { color: #ffa657; }
.avisos-motorista .aviso-cancelado { color: #ff7b72; }
.avisos-motorista .aviso-livre { color: #ffa657; font-style: italic; }

.app-wrapper.fullscreen .avisos-motorista {
  font-size: 1.3em;
  margin-top: 14px;
}

/* ============================================================
   CAIXA DO RODAPÉ (nome do usuário + folgas)
   ============================================================ */
.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  flex-shrink: 0;
  margin-top: 10px;
  transition: opacity 0.3s;
}

/* ============ NOME DO USUÁRIO (dentro da caixa do rodapé) ============ */
.usuario-info {
  text-align: center;
  font-size: 0.75em;
  font-weight: 500;
  letter-spacing: 1.5px;
  padding-left: 1.5px;
  text-transform: uppercase;
  user-select: none;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  opacity: 0.55;
  pointer-events: auto;
  z-index: 5;
}
.usuario-info .ui-nome { color: #ffffff; font-weight: 600; }
.usuario-info .ui-status { color: #ffffff; }
.usuario-info .ui-status:not(:empty)::before {
  content: "—"; margin-right: 8px; color: #30363d;
}

/* ============================================================
   FULLSCREEN — esconde folgas, mantém só o nome no fundo
   ============================================================ */
.app-wrapper.fullscreen .footer-container {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  margin: 0;
  gap: 0;
}
.app-wrapper.fullscreen .footer-container .footer-row {
  display: none;
}

/* ============================================================
   PORTRAIT + HISTÓRICO — esconde o rodapé inteiro
   ============================================================ */
@media (orientation: portrait) {
  body.history-open .footer-container {
    display: none;
  }
}

/* ============ INFO DE FAIXA DE SENHAS (legado) ============ */
.alarm-config-info {
  text-align: center; color: #6e7681;
  font-size: 0.8em; font-weight: 500; letter-spacing: 0.3px;
  margin-top: 12px; margin-bottom: 4px; opacity: 0.85;
  transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
  max-height: 30px; overflow: hidden; flex-shrink: 0;
}
.alarm-config-info.hidden { max-height: 0; opacity: 0; margin: 0; }

/* ============================================================
   RODAPÉ: FOLGA HOJE · [folga] · [SENHAS] · [folga] · PRÓX FOLGA
   ============================================================ */
.footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  width: 100%;
  max-width: 95%;
  flex-shrink: 0;
  transition: opacity 0.3s;
}

/* Labels FOLGA HOJE / PRÓX FOLGA em cinza */
.folga-label {
  color: #484f58;
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 1.2px;
  padding-left: 1.2px;
  text-transform: uppercase;
  user-select: none;
  white-space: nowrap;
}

/* Separador "·" (nos itens de folga e nos globais) */
.folga-sep {
  color: #30363d;
  font-size: 0.9em;
  user-select: none;
  font-weight: bold;
}
.folga-sep-global {
  font-size: 1.1em;
  color: #484f58;
  margin: 0 2px;
}

/* Item de folga = label + sep + valor */
.folga-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Valor da folga (com borda colorida) */
.folga-valor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 4px 10px;
  padding-left: calc(10px + 0.5px);
  border: 1.5px solid #30363d;
  border-radius: 8px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.85em;
  font-weight: bold;
  letter-spacing: 0.5px;
  user-select: none;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.02);
  color: #c9d1d9;
}

/* Cor: amarelo (segunda letra "A") */
.folga-valor.cor-amarelo {
  border-color: #d29922;
  color: #d29922;
  background: rgba(210, 153, 34, 0.08);
}

/* Cor: vermelho (segunda letra "V") */
.folga-valor.cor-vermelho {
  border-color: #f85149;
  color: #f85149;
  background: rgba(248, 81, 73, 0.08);
}

/* Sem folga: "--" em cinza */
.folga-valor.sem-folga {
  border-color: #30363d;
  color: #484f58;
  background: rgba(255, 255, 255, 0.02);
}

/* ============ HANDLE DE HISTÓRICO (dentro do rodapé) ============ */
.history-handle {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  width: fit-content;
  user-select: none;
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  margin: 0;
}
.history-handle:active { transform: scale(0.95); }

.handle-triangle {
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid #1a1a1a;
  position: relative;
  z-index: 2;
  margin-bottom: -2px;
}

.handle-text {
  padding: 8px 22px;
  padding-left: calc(22px + 2px);
  background: #1a1a1a;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #c9d1d9;
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  transition: all 0.2s;
}

.history-handle:hover .handle-text {
  border-color: #58a6ff;
  color: #58a6ff;
}

body.history-open .footer-row {
  display: flex;
}

/* ============ PAINEL DE HISTÓRICO ============ */
.history-panel {
  position: fixed;
  z-index: 2800;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.history-folgas-row {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid #1a1a1a;
  background: rgba(88, 166, 255, 0.02);
  flex-shrink: 0;
}
.history-folgas-row .folga-label { font-size: 0.62em; }
.history-folgas-row .folga-valor {
  min-width: 36px;
  padding: 3px 8px;
  padding-left: calc(8px + 0.5px);
  font-size: 0.75em;
}

.history-folgas-row .history-handle .handle-triangle {
  border-bottom: 10px solid #1a1a1a;
  transform: rotate(180deg);
  margin-bottom: -2px;
}

@media (orientation: portrait) {
  .history-panel {
    bottom: 0; left: 0; right: 0;
    height: 70vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  .history-panel.open { transform: translateY(0); }

  .app-wrapper {
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                margin-top 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body.history-open .app-wrapper {
    height: 27vh;
    align-self: flex-start;
    margin-top: 1.5vh;
  }

  body.history-open .footer-row { display: none; }
  body.history-open .history-folgas-row { display: flex; }

  body.history-open .container {
    padding-top: clamp(45px, 7vh, 60px);
    padding-bottom: 4px;
  }

  body.history-open .relogio {
    font-size: clamp(0.85em, 2.8vw, 1.1em);
    letter-spacing: 1px;
    padding-left: 1px;
    opacity: 0.85;
  }

  body.history-open .center-block { gap: 0; }

  body.history-open #senha-display {
    font-size: clamp(60px, min(42cqw, 55cqh), 300px);
    line-height: 1.05;
  }
}

@media (orientation: landscape) {
  .history-panel {
    top: 0; right: 0; bottom: 0;
    width: 42%;
    border-radius: 20px 0 0 20px;
    transform: translateX(100%);
  }
  .history-panel.open { transform: translateX(0); }

  body.history-open {
    display: grid;
    grid-template-columns: 1fr 42%;
    padding: 0;
    align-items: center;
    justify-content: normal;
  }
  body.history-open .app-wrapper {
    grid-column: 1;
    justify-self: center;
    align-self: center;
    width: 95%;
    max-width: 900px;
    height: 95vh;
  }
}

@media (orientation: landscape) {
  body.history-open .footer-row .history-handle .handle-triangle {
    transform: rotate(180deg);
  }
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
  gap: 12px;
}

.history-filters {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid #30363d;
  flex: 1;
}

.filter-btn {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  color: #8b949e;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.2s;
}
.filter-btn:hover { color: #c9d1d9; background: rgba(88, 166, 255, 0.08); }
.filter-btn.active {
  background: #1f6feb;
  color: #fff;
  box-shadow: 0 2px 8px rgba(31, 111, 235, 0.35);
}
.filter-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.history-close {
  width: 36px;
  height: 36px;
  background: #da3633;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1.1em;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  font-family: inherit;
}
.history-close:hover { background: #f85149; }

.history-resumo {
  padding: 14px 20px;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
  background: rgba(88, 166, 255, 0.03);
}

.history-resumo-titulo {
  color: #c9d1d9;
  font-size: 0.95em;
  font-weight: 600;
  margin-bottom: 8px;
}

.history-resumo-titulo strong {
  color: #58a6ff;
  font-weight: 700;
}

.history-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-pill {
  padding: 5px 10px;
  background: rgba(31, 111, 235, 0.15);
  border: 1px solid #1f6feb;
  border-radius: 12px;
  color: #58a6ff;
  font-size: 0.75em;
  font-weight: bold;
  font-family: 'Consolas', 'Monaco', monospace;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.history-pill:hover {
  background: #1f6feb;
  color: #fff;
  transform: translateY(-1px);
}
.history-pill:active { transform: translateY(0); }

.history-blocks {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 20px;
  -webkit-overflow-scrolling: touch;
}

.history-loading {
  text-align: center;
  color: #8b949e;
  padding: 40px;
  font-size: 0.9em;
}

.history-empty {
  text-align: center;
  color: #484f58;
  padding: 60px 20px;
  font-size: 0.9em;
  font-style: italic;
}

.hour-block {
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid #1a1a1a;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.hour-block[data-has-user="true"] { border-color: rgba(31, 111, 235, 0.5); }

.hour-header {
  padding: 12px 14px;
  padding-left: calc(14px + 1px);
  background: rgba(88, 166, 255, 0.05);
  color: #58a6ff;
  font-size: 0.85em;
  font-weight: bold;
  letter-spacing: 1px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}
.hour-header::-webkit-details-marker { display: none; }
.hour-header:hover { background: rgba(88, 166, 255, 0.12); }
.hour-block[data-has-user="true"] .hour-header {
  background: rgba(31, 111, 235, 0.12);
  color: #79c0ff;
}

.hour-info { display: flex; align-items: center; gap: 10px; }
.hour-indicator { font-size: 0.9em; color: #58a6ff; }
.hour-arrow { font-size: 0.75em; color: #8b949e; transition: transform 0.2s; }
.hour-block[open] .hour-arrow { transform: rotate(180deg); }
.hour-body { border-top: 1px solid #1a1a1a; }

.block-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #0d0d0d;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 1em;
  position: relative;
  transition: background 0.2s;
}
.block-item:last-child { border-bottom: none; }

.block-time {
  color: #8b949e;
  font-size: 0.85em;
  width: 55px;
  flex-shrink: 0;
}

.block-value {
  color: #c9d1d9;
  font-weight: bold;
  flex: 1;
  text-align: center;
  font-size: 1.05em;
}

.block-item.is-user { background: rgba(31, 111, 235, 0.08); }
.block-item.is-user::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #1f6feb;
}
.block-value.matches-user { color: #58a6ff; }

.block-item.is-futuro { opacity: 0.3; }
.block-item.is-futuro .block-time,
.block-item.is-futuro .block-value {
  color: #484f58;
  font-weight: normal;
}

.block-item.highlight { animation: highlightBlock 1.2s ease; }
@keyframes highlightBlock {
  0% { background: rgba(88, 166, 255, 0.4); }
  100% { background: rgba(31, 111, 235, 0.08); }
}

.days-list { padding: 8px 0; }

.day-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid #1a1a1a;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.day-item:hover {
  background: rgba(88, 166, 255, 0.05);
  border-color: #58a6ff;
}
.day-item.disabled { opacity: 0.35; cursor: not-allowed; }
.day-item.disabled:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: #1a1a1a;
}

.day-date {
  color: #c9d1d9;
  font-size: 0.95em;
  font-weight: 600;
}
.day-date small {
  display: block;
  color: #484f58;
  font-size: 0.75em;
  font-weight: normal;
  margin-top: 2px;
}

.day-count {
  color: #58a6ff;
  font-weight: bold;
  font-size: 1.05em;
  font-family: 'Consolas', 'Monaco', monospace;
}

/* ============ TOASTS ============ */
.toast-container {
  position: fixed; top: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 4000;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  background: #161b22; color: #c9d1d9;
  padding: 15px 25px; border-radius: 10px;
  border-left: 4px solid #58a6ff;
  box-shadow: 0 8px 25px rgba(0,0,0,0.8);
  font-size: 1em; font-weight: 500;
  min-width: 250px; max-width: 400px;
  animation: slideDown 0.3s ease;
  display: flex; align-items: center; justify-content: center;
  gap: 12px; pointer-events: auto; text-align: center;
}
.toast.saindo { animation: slideUp 0.3s ease forwards; }
.toast.sucesso { border-left-color: #3fb950; }
.toast.erro { border-left-color: #f85149; }
.toast.aviso { border-left-color: #d29922; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-30px); }
}

#confirm-modal .overlay-content {
  border: 2px solid #4169E1;
  box-shadow: 0 0 40px rgba(65, 105, 225, 0.5);
  animation: bordaPulse 1s infinite alternate;
}
#confirm-modal .btn-panel { font-size: 0.95em; padding: 12px; }

/* ============ TELA DE BLOQUEIO ============ */
.block-screen {
  position: fixed; inset: 0;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.block-screen.hidden { display: none; }
.block-content { text-align: center; padding: 40px; }
.block-icon { font-size: 6em; margin-bottom: 20px; animation: pulse 2s infinite; }
.block-content h1 { color: #8b949e; font-size: 1.8em; margin-bottom: 10px; font-weight: 500; }
.block-content p { color: #484f58; font-size: 1.1em; }

/* ============ MODAL ADMIN ============ */
.admin-input {
  width: 100%;
  padding: 12px;
  background: #000;
  color: #fff;
  border: 1px solid #30363d;
  border-radius: 8px;
  font-size: 1.1em;
  font-family: inherit;
  margin-top: 5px;
}
.admin-input:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 15px rgba(88, 166, 255, 0.2);
}
.admin-resultado { margin-top: 15px; font-size: 0.9em; line-height: 1.5; }

#admin-pin-modal .overlay-content {
  border: 2px solid #58a6ff;
  box-shadow: 0 0 40px rgba(88, 166, 255, 0.3);
}
#admin-pin-input { font-family: 'Consolas', 'Monaco', monospace; font-weight: bold; }
@keyframes shakePin {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
#admin-pin-modal .overlay-content.shake { animation: shakePin 0.4s ease; }

.admin-collapse {
  margin-bottom: 12px;
  border: 1px solid #30363d;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}
.admin-collapse-summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px;
  padding-left: calc(16px + 1px);
  cursor: pointer;
  background: rgba(88, 166, 255, 0.05);
  color: #58a6ff;
  font-size: 0.9em; font-weight: bold;
  text-transform: uppercase; letter-spacing: 1px;
  list-style: none; user-select: none;
  transition: background 0.2s ease;
}
.admin-collapse-summary::-webkit-details-marker { display: none; }
.admin-collapse-summary:hover { background: rgba(88, 166, 255, 0.12); }
.collapse-arrow { font-size: 0.8em; transition: transform 0.2s ease; color: #8b949e; }
.admin-collapse[open] .collapse-arrow { transform: rotate(180deg); }
.admin-collapse-body { padding: 16px; border-top: 1px solid #1a1a1a; }

.admin-tabs {
  display: flex; gap: 4px; margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px; border-radius: 10px; border: 1px solid #30363d;
}
.admin-tab-btn {
  flex: 1; padding: 10px 12px;
  background: transparent; color: #8b949e;
  border: none; border-radius: 7px; cursor: pointer;
  font-size: 0.85em; font-weight: 600; font-family: inherit;
  transition: all 0.2s ease;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.admin-tab-btn:hover { color: #c9d1d9; background: rgba(88, 166, 255, 0.06); }
.admin-tab-btn.active {
  background: #1f6feb; color: #fff;
  box-shadow: 0 2px 8px rgba(31, 111, 235, 0.35);
}

.admin-lista-tokens { margin-top: 6px; }
.admin-token-details {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px; margin-bottom: 6px;
  overflow: hidden; transition: border-color 0.2s;
}
.admin-token-details:hover { border-color: #58a6ff; }
.admin-token-details[open] { border-color: #58a6ff; background: #1a2029; }
.admin-token-details.bloqueado { border-color: #f85149; background: rgba(248, 81, 73, 0.08); }
.admin-token-details.inativo { opacity: 0.6; }

.admin-token-summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; cursor: pointer;
  list-style: none; user-select: none; gap: 10px;
}
.admin-token-summary::-webkit-details-marker { display: none; }
.admin-token-nome {
  color: #fff; font-weight: bold; font-size: 0.9em;
  flex: 1; overflow: hidden; text-overflow: ellipsis;
}
.admin-token-status {
  font-size: 0.7em; padding: 3px 8px; border-radius: 10px;
  font-weight: bold; flex-shrink: 0;
}
.admin-token-status.ativo { color: #3fb950; background: rgba(63, 185, 80, 0.15); }
.admin-token-status.inativo { color: #8b949e; background: rgba(139, 148, 158, 0.15); }
.admin-token-status.bloqueado { color: #f85149; background: rgba(248, 81, 73, 0.15); }

.admin-token-body { padding: 10px 12px 12px 12px; border-top: 1px solid #1a1a1a; }
.admin-token-info {
  color: #8b949e; font-size: 0.75em;
  font-family: 'Consolas', 'Monaco', monospace;
  word-break: break-all; margin-bottom: 10px; line-height: 1.4;
}
.admin-token-actions { display: flex; gap: 6px; }
.admin-token-btn {
  flex: 1; padding: 8px 10px; border: none; border-radius: 6px;
  cursor: pointer; font-size: 0.8em; font-weight: bold;
  font-family: inherit; transition: all 0.2s;
}
.admin-token-btn.toggle { background: #30363d; color: #c9d1d9; }
.admin-token-btn.toggle:hover { background: #484f58; }
.admin-token-btn.deletar { background: #da3633; color: white; }
.admin-token-btn.deletar:hover { background: #f85149; }

.admin-lista-vazia {
  color: #484f58; font-style: italic;
  text-align: center; padding: 20px; font-size: 0.85em;
}

.online-details.offline-token .admin-token-nome { color: #8b949e; font-weight: 500; }
.online-badge {
  font-size: 0.7em; padding: 3px 8px; border-radius: 10px;
  font-weight: bold; flex-shrink: 0;
}
.online-badge.ativo { color: #3fb950; background: rgba(63, 185, 80, 0.15); }
.online-badge.inativo { color: #484f58; background: rgba(72, 79, 88, 0.15); }
.online-ip-row {
  display: flex; justify-content: space-between;
  font-size: 0.75em; padding: 6px 4px; border-top: 1px solid #1a1a1a;
  font-family: 'Consolas', 'Monaco', monospace; gap: 8px;
}
.online-ip-row:first-of-type { border-top: none; }
.online-ip-row.online { color: #3fb950; }
.online-ip-row.offline { color: #8b949e; }

.admin-content-2col {
  max-width: 900px; width: 95%;
  padding: 0; overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 90vh;
}
.admin-header {
  padding: 16px 22px; margin-bottom: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; border-bottom: 1px solid #1a1a1a; flex-shrink: 0;
}
.admin-header-title {
  flex: 1; color: #58a6ff; font-size: 1.3em; text-align: center;
  padding-left: 0;
}
.admin-voltar-btn {
  background: transparent !important;
  color: #8b949e !important;
  font-size: 0.95em !important;
  padding: 6px 10px !important;
  border: 1px solid #30363d !important;
  border-radius: 8px !important;
  transition: all 0.2s;
  font-family: inherit;
  cursor: pointer;
}
.admin-voltar-btn:hover {
  color: #c9d1d9 !important;
  border-color: #58a6ff !important;
}
.admin-voltar-btn.hidden { visibility: hidden; }
.admin-layout {
  display: grid; grid-template-columns: 220px 1fr;
  flex: 1; min-height: 0; overflow: hidden;
}

.admin-menu {
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid #1a1a1a;
  padding: 12px 8px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.admin-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: transparent;
  border: 1px solid transparent; border-radius: 8px;
  color: #8b949e; font-family: inherit;
  font-size: 0.9em; font-weight: 600;
  text-align: left; cursor: pointer;
  transition: all 0.2s; width: 100%;
}
.admin-menu-item:hover { background: rgba(88, 166, 255, 0.06); color: #c9d1d9; }
.admin-menu-item.active {
  background: rgba(31, 111, 235, 0.15);
  border-color: rgba(31, 111, 235, 0.5);
  color: #58a6ff;
}
.admin-menu-icon { font-size: 1.2em; flex-shrink: 0; }
.admin-menu-label { flex: 1; }

.admin-content { padding: 16px 20px 20px; overflow-y: auto; min-width: 0; }
.admin-section { display: none; }
.admin-section.active { display: block; animation: adminFadeIn 0.2s ease; }
@keyframes adminFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.admin-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid #1a1a1a; border-radius: 12px;
  padding: 16px; margin-bottom: 14px;
}
.admin-card h3 {
  color: #c9d1d9; font-size: 0.95em;
  margin-bottom: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.admin-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 10px;
}
.admin-card-header h3 { margin-bottom: 0; }

.admin-avisos-lista { display: flex; flex-direction: column; gap: 8px; }
.admin-aviso-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 10px 12px;
  background: #161b22; border: 1px solid #30363d;
  border-radius: 8px; font-size: 0.9em;
}
.admin-aviso-item-texto { flex: 1; color: #c9d1d9; word-break: break-word; }
.admin-aviso-item-meta {
  font-size: 0.75em; color: #6e7681;
  margin-top: 3px; display: block;
}
.admin-aviso-item-remove {
  background: #da3633; color: #fff; border: none;
  border-radius: 6px; cursor: pointer; padding: 6px 10px;
  font-size: 0.8em; font-family: inherit;
  transition: all 0.2s; flex-shrink: 0;
}
.admin-aviso-item-remove:hover { background: #f85149; }
.admin-btn-limpar-todos {
  background: #da3633; color: #fff; border: none;
  border-radius: 6px; padding: 6px 12px;
  font-size: 0.8em; font-weight: bold;
  font-family: inherit; cursor: pointer;
  transition: all 0.2s; flex-shrink: 0;
}
.admin-btn-limpar-todos:hover { background: #f85149; }

.admin-senha-manual-row { display: flex; gap: 10px; align-items: center; }
.admin-input-senha {
  flex: 1; margin-top: 0 !important;
  text-align: center; font-size: 1.5em !important;
  letter-spacing: 6px;
  font-family: 'Consolas', 'Monaco', monospace !important;
}
.admin-btn-senha {
  margin-top: 0 !important; width: auto !important;
  padding: 12px 20px !important;
}

.admin-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.admin-quick-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 10px; background: #161b22;
  border: 1.5px solid #30363d; border-radius: 8px;
  color: #c9d1d9; font-family: inherit;
  font-size: 0.85em; font-weight: 600;
  cursor: pointer; transition: all 0.15s; text-align: center;
}
.admin-quick-btn:hover {
  background: rgba(88, 166, 255, 0.12);
  border-color: #58a6ff; color: #58a6ff;
  transform: translateY(-1px);
}
.admin-quick-btn:active { transform: translateY(0); }
.admin-quick-btn.ativo {
  background: rgba(31, 111, 235, 0.25);
  border-color: #58a6ff; color: #fff;
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.3);
}
.admin-quick-icon { font-size: 1.15em; line-height: 1; }

.admin-filas-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
}
.admin-fila-btn {
  padding: 14px 8px; background: #161b22;
  border: 1.5px solid #30363d; border-radius: 8px;
  color: #c9d1d9; font-family: inherit;
  font-size: 1.3em; font-weight: bold;
  cursor: pointer; transition: all 0.15s; text-align: center;
}
.admin-fila-btn:hover {
  background: rgba(88, 166, 255, 0.12);
  border-color: #58a6ff; color: #58a6ff;
}
.admin-fila-btn.ativo {
  background: #1f6feb; border-color: #58a6ff; color: #fff;
  box-shadow: 0 0 15px rgba(31, 111, 235, 0.6);
}

.admin-texto-counter {
  font-size: 0.75em; color: #6e7681;
  text-align: right; margin-top: 4px; margin-bottom: 10px;
}

.preview-label {
  color: #8b949e; font-size: 0.85em;
  margin-bottom: 10px; text-align: center;
}
.preview-painel {
  background: #0a0a0a; border: 1px solid #1a1a1a;
  border-radius: 12px; padding: 20px 15px;
  text-align: center; margin-bottom: 15px;
}
.preview-hora {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 1.2em; color: #fff; opacity: 0.85;
  letter-spacing: 2px; padding-left: 2px;
  margin-bottom: 8px;
}
.preview-senha {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 3.5em; font-weight: 900;
  color: #58a6ff; line-height: 1; margin: 8px 0;
}
.preview-aviso {
  font-size: 1.05em; color: #ffa657;
  margin: 12px 0; font-weight: 600; line-height: 1.4;
}
.preview-nome {
  font-size: 0.7em; color: #484f58;
  letter-spacing: 1.5px; padding-left: 1.5px;
  text-transform: uppercase; margin-top: 12px;
}
.preview-actions { margin-top: 10px; }

/* ============ RESPONSIVO ============ */
@media (orientation: portrait) {
  .header { grid-template-columns: auto 1fr auto; padding: 8px 10px; gap: 6px; }
  .header-btn { padding: 6px 8px; font-size: 0.75em; min-height: 34px; }
  .status-btn { padding: 6px 8px; font-size: 0.72em; min-height: 34px; gap: 6px; }
  .status-btn .status-dot { width: 10px; height: 10px; }
  .alarm-config-info { font-size: 0.72em; margin-top: 10px; margin-bottom: 3px; }
  .usuario-info { font-size: 0.7em; }
  .relogio { font-size: clamp(1.2em, 4vw, 1.8em); letter-spacing: 2px; padding-left: 2px; }
  .alarm-senha-numero { font-size: 12vh; }
  .alarm-modal-content { padding: 30px 25px; }
  .alarm-modal h2 { font-size: 1.4em; }
  .btn-ciente { font-size: 1.2em; padding: 18px; }
  .avisos-motorista { font-size: 1em; }
  .relogio-wrapper { padding: 2px 12px; border-width: 2.5px; }
  .app-wrapper.fullscreen .relogio-wrapper { padding: 8px 16px; }
  .app-wrapper.fullscreen .fullscreen-status { font-size: 0.82em; letter-spacing: 1px; padding-left: 1px; }
  .footer-row { gap: 6px; }
  .folga-label { font-size: 0.62em; letter-spacing: 1px; padding-left: 1px; }
  .folga-valor { min-width: 36px; padding: 3px 8px; padding-left: calc(8px + 0.5px); font-size: 0.78em; }
  .handle-text { padding: 8px 18px; padding-left: calc(18px + 2px); font-size: 0.68em; letter-spacing: 1.5px; }
}

@media (max-width: 500px) {
  .header-btn .btn-label { display: none; }
  .header-btn { padding: 6px 10px; }
  .header-btn .btn-icon { font-size: 1.4em; }
}

@media (max-width: 420px) {
  .folga-label { font-size: 0.55em; letter-spacing: 0.6px; }
  .footer-row { gap: 4px; }
  .folga-sep-global { margin: 0 0; }
}

@media (max-width: 380px) {
  .folga-label { display: none; }
  .footer-row { gap: 8px; }
}

@media (max-height: 350px) {
  .container { padding-top: clamp(60px, 20vh, 80px); padding-bottom: 8px; padding-left: 10px; padding-right: 10px; }
  .header { padding: 4px 8px; }
  .header-btn { min-height: 30px; font-size: 0.7em; padding: 4px 8px; }
  .status-btn { min-height: 30px; font-size: 0.65em; padding: 4px 8px; }
  .relogio { font-size: 1em; letter-spacing: 1px; padding-left: 1px; }
  .alarm-config-info { font-size: 0.65em; margin-top: 6px; margin-bottom: 2px; }
  .usuario-info { font-size: 0.6em; }
}

@media (max-height: 400px), (max-width: 350px) {
  .alarm-modal-content { padding: 15px 20px; max-height: 95vh; overflow-y: auto; border-width: 2px; }
  .alarm-modal h2 { font-size: 1.2em; margin-bottom: 5px; }
  .alarm-senha-numero { font-size: clamp(50px, 15vh, 90px); margin: 5px 0; }
  .alarm-modal p { display: none; }
  .alarm-contador { font-size: 1em; margin-bottom: 12px; }
  .btn-ciente { padding: 12px; font-size: 1em; }
}

@media (max-height: 400px) and (orientation: portrait) {
  .history-panel { height: 85vh; }
  body.history-open .app-wrapper { height: 12vh; margin-top: 1vh; }
  .history-header { padding: 10px 14px; }
  .history-resumo { padding: 10px 14px; }
  .history-blocks { padding: 8px 10px 14px; }
  .block-item { padding: 6px 10px; font-size: 0.9em; }
}

@media (max-width: 400px) and (orientation: portrait) {
  .history-header { padding: 12px 14px; }
  .filter-btn { padding: 7px 8px; font-size: 0.8em; }
  .history-resumo { padding: 12px 14px; }
  .history-resumo-titulo { font-size: 0.88em; }
  .block-item { padding: 7px 10px; }
  .block-time { width: 48px; font-size: 0.8em; }
}

@media (orientation: portrait), (max-width: 700px) {
  .admin-content-2col { max-width: 500px; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-menu {
    border-right: none;
    border-bottom: 1px solid #1a1a1a;
    padding: 8px;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .admin-menu-item {
    flex-direction: column;
    padding: 10px 8px;
    font-size: 0.75em;
    gap: 4px;
    min-width: 90px;
    text-align: center;
  }
  .admin-menu-label { font-size: 0.9em; }
  .admin-content-2col.mostrando-secao .admin-menu { display: none; }
  .admin-content-2col.mostrando-secao .admin-voltar-btn { visibility: visible; }
  .admin-content-2col:not(.mostrando-secao) .admin-content { display: none; }
  .admin-content-2col.mostrando-secao .admin-content { display: block; }
  .admin-filas-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .admin-fila-btn { font-size: 1.1em; padding: 12px 4px; }
}

@media (hover: none) {
  .history-handle:hover .handle-text {
    border-color: #30363d !important;
    color: #c9d1d9 !important;
  }
  .header-btn:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: #30363d !important;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
  }
  .header-btn.ativo:hover {
    border-color: #58a6ff !important;
    color: #58a6ff !important;
    background: rgba(88, 166, 255, 0.1) !important;
  }
  .status-btn:hover {
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
    filter: none !important;
  }
  .btn-panel:hover { background: #1f6feb !important; }
  .filter-btn:hover {
    color: #8b949e !important;
    background: transparent !important;
  }
  .filter-btn.active:hover {
    background: #1f6feb !important;
    color: #fff !important;
  }
  .history-close:hover { background: #da3633 !important; }
  .history-pill:hover {
    background: rgba(31, 111, 235, 0.15) !important;
    color: #58a6ff !important;
    transform: none !important;
  }
  .day-item:hover {
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: #1a1a1a !important;
  }
  .admin-quick-btn:hover {
    background: #161b22 !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
    transform: none !important;
  }
  .admin-quick-btn.ativo:hover {
    background: rgba(31, 111, 235, 0.25) !important;
    border-color: #58a6ff !important;
    color: #fff !important;
  }
  .admin-fila-btn:hover {
    background: #161b22 !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
  }
  .admin-fila-btn.ativo:hover {
    background: #1f6feb !important;
    border-color: #58a6ff !important;
    color: #fff !important;
  }
  .admin-menu-item:hover {
    background: transparent !important;
    color: #8b949e !important;
  }
  .admin-menu-item.active:hover {
    background: rgba(31, 111, 235, 0.15) !important;
    border-color: rgba(31, 111, 235, 0.5) !important;
    color: #58a6ff !important;
  }
  .admin-tab-btn:hover {
    color: #8b949e !important;
    background: transparent !important;
  }
  .admin-tab-btn.active:hover {
    background: #1f6feb !important;
    color: #fff !important;
  }
  .admin-token-btn.toggle:hover { background: #30363d !important; }
  .admin-token-btn.deletar:hover { background: #da3633 !important; }
  .admin-aviso-item-remove:hover { background: #da3633 !important; }
  .admin-btn-limpar-todos:hover { background: #da3633 !important; }
  .admin-voltar-btn:hover {
    color: #8b949e !important;
    border-color: #30363d !important;
  }
  .admin-token-details:hover { border-color: #30363d !important; }
  .admin-token-details[open]:hover { border-color: #58a6ff !important; }
  .admin-token-details.bloqueado:hover { border-color: #f85149 !important; }
  .admin-collapse-summary:hover {
    background: rgba(88, 166, 255, 0.05) !important;
  }
  .hour-header:hover {
    background: rgba(88, 166, 255, 0.05) !important;
  }
  .hour-block[data-has-user="true"] .hour-header:hover {
    background: rgba(31, 111, 235, 0.12) !important;
  }
  .overlay-header button:hover { background: #da3633 !important; }
  .btn-ciente:hover { background: #4169E1 !important; }
}

/* ============================================================
   ESTILOS DO TUTORIAL
   ============================================================ */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
}
.tutorial-overlay.hidden {
  display: none;
}

.tutorial-spotlight {
  position: absolute;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85);
  z-index: 100000;
  transition: all 0.3s ease-in-out;
  pointer-events: none;
}

.tutorial-tooltip {
  position: absolute;
  background: #161b22;
  border: 2px solid #58a6ff;
  border-radius: 12px;
  padding: 20px;
  width: 320px;
  max-width: 90vw;
  z-index: 100001;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  color: #c9d1d9;
  transition: all 0.3s ease-in-out;
  pointer-events: auto;
}

.tutorial-tooltip h3 {
  color: #58a6ff;
  margin-bottom: 10px;
  font-size: 1.2em;
}

.tutorial-tooltip p {
  font-size: 0.95em;
  line-height: 1.4;
  margin-bottom: 20px;
}

.tutorial-botoes {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.tutorial-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.tutorial-btn.pular {
  background: transparent;
  color: #8b949e;
  border: 1px solid #30363d;
}

.tutorial-btn.pular:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #c9d1d9;
}

.tutorial-btn.proximo {
  background: #1f6feb;
  color: #fff;
  flex: 1;
}

.tutorial-btn.proximo:hover {
  background: #388bfd;
}