:root {
  --ambr-azul: #075a9d;
  --ambr-azul-escuro: #034373;
  --ambr-verde: #237a45;
  --ambr-amarelo: #f4c95d;
  --texto: #17212b;
  --texto-suave: #52606d;
  --borda: #c8d3dc;
  --fundo: #eef3f7;
  --branco: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font-family: Arial, Helvetica, sans-serif;
}

button, a { font: inherit; }

.baile-pagina {
  width: min(100% - 24px, 1220px);
  margin: 24px auto;
  padding: clamp(18px, 3vw, 34px);
  background: var(--branco);
  border-radius: 22px;
  box-shadow: 0 14px 38px rgba(23, 33, 43, .11);
}

.baile-cabecalho { margin-bottom: 18px; }
.baile-cabecalho h1 { margin: 3px 0 8px; font-size: clamp(1.6rem, 4vw, 2.35rem); }
.baile-cabecalho p { margin: 0; color: var(--texto-suave); }
.baile-marca { color: var(--ambr-azul) !important; font-weight: 800; letter-spacing: .12em; }

.baile-mensagem,
.baile-aviso,
.baile-posicoes-pendentes,
.baile-alerta {
  padding: 12px 14px;
  border-radius: 10px;
  line-height: 1.45;
}

.baile-mensagem,
.baile-alerta { background: #fff0f0; border-left: 4px solid #a82632; }
.baile-mensagem--success { background: #edf8f1; border-left-color: var(--ambr-verde); }
.baile-aviso { background: #edf6ff; border-left: 4px solid var(--ambr-azul); }
.baile-posicoes-pendentes { background: #fff7dc; border: 1px solid #d7ae39; color: #5b4710; }

.baile-identificacao { max-width: 680px; }
.baile-identificacao__formulario {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid #d9e3ea;
  border-radius: 16px;
  background: #fbfdff;
}
.baile-identificacao__formulario label { font-weight: 800; }
.baile-identificacao__formulario input {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 7px;
  padding: 10px 12px;
  border: 1px solid #8da3b5;
  border-radius: 9px;
  font: inherit;
}

.baile-abas {
  display: flex;
  gap: 8px;
  margin: 22px 0 14px;
  border-bottom: 1px solid var(--borda);
}
.baile-aba {
  min-width: 100px;
  padding: 11px 18px;
  border: 0;
  border-bottom: 4px solid transparent;
  background: transparent;
  color: var(--texto-suave);
  font-weight: 700;
  cursor: pointer;
}
.baile-aba.is-active { border-bottom-color: var(--ambr-azul); color: var(--ambr-azul-escuro); }

.baile-aba:focus-visible,
.baile-controles button:focus-visible,
.baile-botao:focus-visible,
.mesas-lista a:focus-visible,
.mesa-painel-toque__fechar:focus-visible,
.baile-identificacao input:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 3px;
}

.baile-controles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.baile-controles button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid #8da3b5;
  border-radius: 9px;
  background: #f7fafc;
  color: var(--ambr-azul-escuro);
  font-weight: 700;
  cursor: pointer;
}
.baile-controles button:hover { background: #e6f1fa; }
.baile-controles button:disabled { cursor: wait; opacity: .6; }

.baile-mapa-viewport {
  position: relative;
  width: 100%;
  overflow: auto;
  border: 1px solid #bccbd6;
  border-radius: 16px;
  background: linear-gradient(145deg, #f8f3e9, #edf2f1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.baile-mapa-viewport:focus-visible { outline: 3px solid var(--ambr-azul); outline-offset: 2px; }
.baile-mapa-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}
.baile-planta {
  position: relative;
  width: max(100%, 720px);
  min-width: 720px;
  aspect-ratio: 6 / 5;
  transition: width .18s ease;
}
.mesas-layer { position: absolute; inset: 0; }

.planta-contorno { fill: rgba(255, 254, 249, .92); stroke: #95a5ad; stroke-width: .45; }
.planta-divisao,
.planta-detalhes path { fill: none; stroke: #95a5ad; stroke-width: .38; }
.planta-elemento rect,
.planta-elemento path { fill: #e4ebed; stroke: #81929a; stroke-width: .35; }
.planta-elemento text {
  fill: #44555d;
  font-size: 1.45px;
  font-weight: 700;
  letter-spacing: .06em;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}
.planta-palco rect { fill: #d8e2e7; stroke: #536973; stroke-width: .55; }
.planta-palco text { fill: #314a55; font-size: 1.65px; letter-spacing: .12em; }
.planta-antepasto ellipse { fill: #f7edd1; stroke: #b89441; stroke-width: .55; }
.planta-antepasto text { fill: #705419; font-size: 1.3px; }
.planta-entrada path,
.planta-escada path { fill: none; }
.planta-entrada text { font-size: 1.65px; }
.planta-apoio text { font-size: 1.05px; }
.planta-escada text { font-size: 1.05px; }

.mesa {
  --mesa-escala-visual: .89;
  position: absolute;
  top: calc(var(--mesa-y) * 1%);
  left: calc(var(--mesa-x) / 120 * 100%);
  width: 7.1%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: transparent;
  color: #153725;
  cursor: default;
  transform: translate(-50%, -50%);
}
.mesa[data-selecionavel="true"] { cursor: pointer; }
.mesa__visual {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: scale(var(--mesa-escala-visual));
  transform-origin: center;
}
.mesa__cadeiras,
.mesa__cadeiras::before,
.mesa__cadeiras::after {
  position: absolute;
  inset: 7%;
  border: 1px solid #81929a;
  border-radius: 42%;
  content: "";
}
.mesa__cadeiras::before { inset: 27% 0; }
.mesa__cadeiras::after { inset: 0 27%; }
.mesa__corpo {
  position: absolute;
  inset: 18%;
  display: grid;
  place-items: center;
  border: 2px solid #176538;
  border-radius: 50%;
  background: #c8ead3;
  box-shadow: 0 1px 2px rgba(30, 42, 49, .2);
}
.mesa__numero {
  color: #13202b;
  font-size: clamp(.62rem, 1.25vw, .9rem);
  font-weight: 800;
  pointer-events: none;
}
.mesa__indicador {
  position: absolute;
  top: 18%;
  right: 18%;
  color: currentColor;
  font-size: clamp(.5rem, .9vw, .72rem);
  font-weight: 900;
  text-shadow: 0 0 2px #fff;
  pointer-events: none;
}
.mesa--disponivel .mesa__corpo { background: #c8ead3; border-color: #176538; }
.mesa--parcial .mesa__corpo { background: var(--ambr-amarelo); border-color: #795b00; border-style: dashed; }
.mesa--esgotada { color: #333b43; }
.mesa--esgotada .mesa__corpo { background: repeating-linear-gradient(45deg, #e5e7eb, #e5e7eb 3px, #6b7280 3px, #6b7280 4px); border-color: #4b5563; }
.mesa--indisponivel { color: #fff; }
.mesa--indisponivel .mesa__corpo { background: radial-gradient(#f9fafb 13%, #374151 16%); background-size: 4px 4px; border-color: #111827; }
.mesa--indisponivel .mesa__numero { color: #fff; }
.mesa--venda_fechada { color: #fff; }
.mesa--venda_fechada .mesa__corpo { background: radial-gradient(#f9fafb 13%, #374151 16%); background-size: 4px 4px; border-color: #111827; }
.mesa--venda_fechada .mesa__numero,
.mesa--venda_fechada .mesa__resumo { color: #fff; }
.mesa--inativa { color: #4b5563; opacity: .72; }
.mesa--inativa .mesa__corpo { background: #f9fafb; border: 4px double #4b5563; }
.mesa--admin .mesa__corpo {
  inset: 12%;
  grid-template-rows: auto auto;
  align-content: center;
  line-height: 1.05;
}
.mesa--admin .mesa__numero { font-size: clamp(.58rem, 1.1vw, .82rem); }
.mesa__resumo {
  color: #13202b;
  font-size: clamp(.35rem, .58vw, .52rem);
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}
.mesa[data-selecionavel="true"]:hover .mesa__corpo,
.mesa[data-selecionavel="true"]:focus-visible .mesa__corpo {
  border-color: var(--ambr-azul);
  box-shadow: 0 0 0 3px rgba(7, 90, 157, .34), 0 0 5px rgba(7, 90, 157, .62);
}
.mesa:focus-visible { outline: none; }

.baile-tooltip {
  position: absolute;
  z-index: 10;
  width: max-content;
  max-width: 230px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 10px;
  background: #17212b;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .24);
  pointer-events: none;
  transform: translate(12px, 12px);
}
.baile-tooltip strong, .baile-tooltip span, .baile-tooltip small { display: block; }
.baile-tooltip span { margin-top: 3px; white-space: pre-line; }
.baile-tooltip small { margin-top: 5px; color: #cae7ff; }

.baile-legenda { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 16px 0 0; padding: 0; list-style: none; }
.baile-legenda li { display: flex; align-items: center; gap: 8px; }
.legenda-amostra { display: inline-grid; width: 28px; height: 28px; place-items: center; border: 2px solid; border-radius: 50%; font-weight: 900; }
.legenda-disponivel { background: #c8ead3; border-color: #176538; }
.legenda-parcial { background: var(--ambr-amarelo); border-color: #795b00; border-style: dashed; }
.legenda-esgotada { background: repeating-linear-gradient(45deg, #e5e7eb, #e5e7eb 3px, #6b7280 3px, #6b7280 4px); border-color: #4b5563; }
.legenda-indisponivel { background: #374151; border-color: #111827; color: #fff; }
.legenda-venda-fechada { background: radial-gradient(#f9fafb 13%, #374151 16%); background-size: 4px 4px; border-color: #111827; color: #fff; }
.legenda-inativa { background: #f9fafb; border: 4px double #4b5563; color: #4b5563; }

.mesas-lista { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.mesas-lista a, .mesas-lista div {
  display: flex;
  min-height: 72px;
  flex-direction: column;
  justify-content: center;
  padding: 12px 14px;
  border: 1px solid var(--borda);
  border-left: 5px solid #667784;
  border-radius: 10px;
  background: #f8fafb;
  color: var(--texto);
  text-decoration: none;
}
.mesas-lista a { border-left-color: var(--ambr-verde); }
.mesas-lista a:hover { background: #edf8f1; }
.mesas-lista span { margin-top: 4px; color: var(--texto-suave); }
.mesas-lista small { display: block; margin-top: 6px; color: var(--texto-suave); }
.mesas-lista--admin a { border-left-color: var(--ambr-azul); }
.mesas-lista--admin a:hover { background: #edf6ff; }

.mesa-painel-toque { position: fixed; z-index: 30; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .5); }
.mesa-painel-toque[hidden] { display: none; }
.mesa-painel-toque__conteudo { position: relative; width: min(100%, 480px); padding: 24px; border-radius: 16px 16px 8px 8px; background: #fff; box-shadow: 0 -8px 30px rgba(0, 0, 0, .2); }
.mesa-painel-toque__conteudo h2 { margin: 0 44px 8px 0; }
.mesa-painel-toque__conteudo p { white-space: pre-line; }
.mesa-painel-toque__fechar { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #e8eef3; color: #263746; font-size: 1.5rem; cursor: pointer; }
.baile-botao { display: block; min-height: 48px; margin-top: 16px; padding: 13px 18px; border: 0; border-radius: 9px; background: var(--ambr-azul); color: #fff; text-align: center; text-decoration: none; font-weight: 800; cursor: pointer; }
.baile-botao:hover { background: var(--ambr-azul-escuro); }
.baile-botao--verde { background: var(--ambr-verde); }
.baile-botao--verde:hover { background: #185f34; }
.baile-botao-secundario { background: #e5edf3; color: var(--ambr-azul-escuro); }
.baile-botao-secundario:hover { background: #d6e3ed; }

.baile-etapa { max-width: 680px; }
.baile-etapa__evento { margin: 0; color: var(--texto-suave); font-weight: 700; }
.baile-etapa label { display: block; margin: 20px 0 7px; font-weight: 800; }
.baile-etapa input[type="number"] { width: 100%; min-height: 48px; margin-bottom: 16px; padding: 10px 12px; border: 1px solid #8da3b5; border-radius: 8px; font: inherit; }
.baile-checkout .baile-cabecalho { padding-bottom: 14px; border-bottom: 1px solid var(--borda); }
.baile-sucesso { display: flex; align-items: center; gap: 10px; margin: 20px 0; color: #155c32; font-weight: 800; }
.baile-sucesso span { display: inline-grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: #c8ead3; }
.baile-validade { margin: 16px 0; color: var(--texto-suave); }
.baile-formas-pagamento { margin: 20px 0 0; padding: 0; border: 0; }
.baile-formas-pagamento legend { margin-bottom: 10px; font-weight: 800; }
.baile-opcao-pagamento { display: flex !important; align-items: flex-start; gap: 12px; margin: 10px 0 !important; padding: 14px; border: 1px solid var(--borda); border-radius: 10px; background: #fbfdff; cursor: pointer; }
.baile-opcao-pagamento:hover { border-color: var(--ambr-azul); background: #edf6ff; }
.baile-opcao-pagamento input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ambr-azul); }
.baile-opcao-pagamento span, .baile-opcao-pagamento small { display: block; }
.baile-opcao-pagamento small { margin-top: 3px; color: var(--texto-suave); font-weight: 400; }
.baile-parcelas { margin-top: 16px; padding: 16px; border-left: 4px solid var(--ambr-azul); border-radius: 0 10px 10px 0; background: #edf6ff; }
.baile-parcelas label { margin-top: 0; }
.baile-parcelas select { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #8da3b5; border-radius: 8px; background: #fff; font: inherit; }
.baile-resumo { margin: 20px 0; }
.baile-resumo div { display: flex; justify-content: space-between; gap: 20px; padding: 10px 0; border-bottom: 1px solid var(--borda); }
.baile-resumo dt { color: var(--texto-suave); }
.baile-resumo dd { margin: 0; text-align: right; font-weight: 800; }

.baile-admin { max-width: 1400px; color: var(--texto); }
.baile-admin-status { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.baile-admin-status span {
  padding: 7px 10px;
  border: 1px solid var(--borda);
  border-radius: 999px;
  background: #f8fafb;
}
.baile-admin-indicadores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.baile-admin-indicadores article {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--borda);
  border-radius: 12px;
  background: #f8fafb;
}
.baile-admin-indicadores span,
.baile-admin-indicadores strong { display: block; }
.baile-admin-indicadores span { color: var(--texto-suave); font-size: .82rem; }
.baile-admin-indicadores strong { margin-top: 4px; font-size: 1.35rem; }

.baile-pagamento-form input:focus-visible,
.baile-pagamento-form select:focus-visible { outline: 3px solid #ffbf47; outline-offset: 3px; }

.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0); white-space: nowrap !important; border: 0 !important; }
[hidden] { display: none !important; }

@media (max-width: 640px) {
  .baile-pagina { width: 100%; margin: 0; padding: 16px 12px 24px; border-radius: 0; }
  .baile-controles button { flex: 1 1 auto; }
  .baile-mapa-viewport { max-height: 72vh; }
  .baile-legenda { display: grid; grid-template-columns: 1fr 1fr; }
  .baile-planta { width: max(100%, 720px); }
}

@media (prefers-reduced-motion: reduce) { .baile-planta { transition: none; } }
