/* ==========================================================================
   QR-Comanda · Terminal Copa & Cozinha (/copa)
   Tema "Noite Discreta" — alta legibilidade para tablet, celular e desktop
   ========================================================================== */

:root {
  --bg-base: #0D0E12;
  --bg-surface: #15171E;
  --bg-elevated: #1D202A;
  --bg-input: #111319;

  --border-subtle: #282C38;
  --border-strong: #3B4152;
  --border-gold: #6E5B38;

  --text-primary: #ECE7DE;
  --text-secondary: #A9A397;
  --text-muted: #827E75;

  --gold: #C9A96E;
  --gold-bright: #E0C289;
  --gold-soft: rgba(201, 169, 110, 0.14);

  --ok: #4F9A75;
  --ok-bg: rgba(79, 154, 117, 0.16);
  --warn: #D49B4B;
  --warn-bg: rgba(212, 155, 75, 0.16);
  --danger: #C85A5A;
  --danger-bg: rgba(200, 90, 90, 0.18);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 16px;

  --font-sans: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", "Consolas", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

button,
input {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 1px solid transparent;
  padding: 0;
  min-height: 44px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

input {
  font-size: 16px;
  min-height: 44px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

input::placeholder {
  color: var(--text-muted);
}

input:focus {
  border-color: var(--gold);
}

.copa-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
}

/* ==========================================================================
   Topbar e Abas
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(13, 14, 18, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topbar-linha {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.marca-bloco {
  display: flex;
  align-items: center;
  gap: 10px;
}

.marca-selo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-gold);
  background: var(--gold-soft);
  color: var(--gold-bright);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.marca-titulo {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.marca-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.topbar-acoes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.relogio-chip {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
}

.nav-abas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.aba-btn {
  min-height: 44px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.aba-btn.ativo {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold-bright);
}

.aba-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--gold);
  color: #14120D;
  font-size: 12px;
  font-weight: 700;
}

/* ==========================================================================
   Botões e Aviso de Som Desligado
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.btn-primario {
  background: var(--gold);
  color: #14120D;
  border-color: var(--gold);
}

.btn-primario:hover {
  background: var(--gold-bright);
}

.btn-sucesso {
  background: var(--ok-bg);
  color: #8AD7AF;
  border-color: rgba(79, 154, 117, 0.5);
}

.btn-sucesso:hover {
  background: rgba(79, 154, 117, 0.28);
}

.btn-secundario {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secundario:hover {
  border-color: var(--gold);
}

.btn-fantasma {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-fantasma:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-perigo {
  background: var(--danger-bg);
  color: #F4A5A5;
  border-color: rgba(200, 90, 90, 0.45);
}

.conteudo {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.aviso-som {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--gold);
  background: var(--gold-soft);
  color: var(--gold-bright);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.aviso-som:hover {
  background: rgba(201, 169, 110, 0.22);
}

/* ==========================================================================
   Filtros e Fila de Tickets
   ========================================================================== */

.filtros-linha {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.pill.ativo {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold-bright);
}

.fila-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.ticket-card {
  position: relative;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  background: var(--gold);
}

.ticket-card[data-urgencia="aviso"] {
  border-color: rgba(212, 155, 75, 0.52);
}

.ticket-card[data-urgencia="aviso"]::before {
  background: var(--warn);
}

.ticket-card[data-urgencia="critico"] {
  border-color: rgba(200, 90, 90, 0.62);
  background: linear-gradient(180deg, rgba(200, 90, 90, 0.12), var(--bg-surface) 60%);
}

.ticket-card[data-urgencia="critico"]::before {
  background: var(--danger);
}

.ticket-topo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ticket-suite {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.ticket-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.badges-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-normal {
  background: var(--gold-soft);
  color: var(--gold-bright);
  border: 1px solid var(--border-gold);
}

.badge-aviso {
  background: var(--warn-bg);
  color: #F0C47F;
  border: 1px solid rgba(212, 155, 75, 0.5);
}

.badge-critico {
  background: var(--danger-bg);
  color: #F4A5A5;
  border: 1px solid rgba(200, 90, 90, 0.55);
}

.badge-ok {
  background: var(--ok-bg);
  color: #8AD7AF;
  border: 1px solid rgba(79, 154, 117, 0.5);
}

.ticket-itens {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ticket-item-linha {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ticket-item-nome {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.ticket-item-obs {
  display: inline-block;
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--warn-bg);
  color: #F4CC8D;
  font-size: 13px;
  font-weight: 600;
}

.ticket-acoes {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.ticket-acoes .btn {
  flex: 1;
}

/* ==========================================================================
   Aba Esgotados
   ========================================================================== */

.esgotados-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.item-card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.item-card.esgotado {
  border-color: rgba(200, 90, 90, 0.55);
  background: rgba(200, 90, 90, 0.09);
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.item-nome {
  font-size: 15px;
  font-weight: 600;
}

.item-cat {
  font-size: 12px;
  color: var(--text-secondary);
}

.vazio-fila {
  padding: 40px 20px;
  text-align: center;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 15px;
}

/* Toast */

.toast-root {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.toast-msg {
  max-width: 500px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-gold);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.toast-msg.erro {
  border-color: var(--danger);
  color: #F4A5A5;
}

/* Tela de Login da Equipe */

.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 26px 22px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-campo {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-rotulo {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.login-erro {
  font-size: 13px;
  font-weight: 600;
  color: #F4A5A5;
  min-height: 18px;
}

@media (min-width: 720px) {
  .fila-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .esgotados-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .topbar-inner {
    padding: 14px 24px;
  }
  .conteudo {
    padding: 20px 24px;
  }
  .fila-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .esgotados-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
