:root {
  --bg: #0f0f12;
  --panel: rgba(22, 22, 30, 0.72);
  --stroke: rgba(255, 255, 255, 0.08);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #f59e0b;
  --accent-2: #fbbf24;
  --danger: #ef4444;
  --ok: #22c55e;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  --radius: 18px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Ubuntu, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

body.app-body {
  background-image: linear-gradient(180deg, rgba(15, 15, 18, 0.2), rgba(15, 15, 18, 0.92)),
    url("https://images.unsplash.com/photo-1414235077428-338989a2e8c0?w=1600&q=60");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

body.app-body::before {
  content: "";
  position: fixed;
  inset: 0;
  backdrop-filter: none;
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 18px 120px;
}

.topbar {
  text-align: center;
  margin-bottom: 22px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  margin: 0;
}

.sub {
  margin: 6px 0 6px;
  color: var(--ok);
  font-size: 0.95rem;
  font-weight: 600;
}

.status-fechado {
  color: var(--danger) !important;
}

.grid-pratos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (min-width: 840px) {
  .grid-pratos {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

.card-prato {
  border: 2px solid var(--stroke);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  position: relative;
}

.card-prato:hover {
  transform: translateY(-2px) scale(1.01);
}

.card-prato:active {
  transform: scale(0.99);
}

.card-prato.selected {
  border-color: rgba(245, 158, 11, 0.85);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35), 0 20px 60px rgba(245, 158, 11, 0.18);
  transform: scale(1.02);
}

.card-prato .thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.card-prato img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.card-prato:hover img,
.card-prato.selected img {
  transform: scale(1.06);
}

.card-body {
  padding: 14px 16px 16px;
}

.card-body h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.ing {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.badge-selected {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(34, 197, 94, 0.95);
  color: #052e16;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.card-prato.selected .badge-selected {
  opacity: 1;
  transform: translateY(0);
}

.panel {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

.panel h4 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
}

.row-sizes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pill {
  border: 2px solid var(--stroke);
  border-radius: 14px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s ease, transform 0.15s ease, background 0.2s ease;
}

.pill strong {
  display: block;
  font-size: 1rem;
}

.pill span {
  color: var(--accent-2);
  font-weight: 700;
}

.pill.selected {
  border-color: rgba(245, 158, 11, 0.9);
  background: rgba(245, 158, 11, 0.12);
}

.pill-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.pill-stock {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.pill-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px 4px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-4px);
  transition: max-height 0.28s ease, opacity 0.24s ease, transform 0.24s ease;
  pointer-events: none;
}

.pill-qty.is-visible {
  max-height: 56px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.qty-label {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.inp-qty {
  width: 52px;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

.pedido-detalhe {
  margin-top: 8px;
  font-size: 0.92rem;
}

.pedido-linha {
  margin-bottom: 4px;
}

.pedido-linha:last-child {
  margin-bottom: 0;
}

.pedido-ok {
  color: var(--ok);
  margin-right: 4px;
}

.modal--cliente {
  z-index: 70;
}

.modal-dialog--pay {
  width: min(400px, 100%);
}

.pay-intro {
  margin: 0 0 14px;
  line-height: 1.45;
}

.pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.pay-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 12px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  font: inherit;
}

.pay-tile:hover {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
}

.pay-tile:active {
  transform: scale(0.98);
}

.pay-tile-label {
  font-weight: 800;
  font-size: 1rem;
}

.pay-tile-hint {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}

.pay-tile--pix .pay-tile-label {
  letter-spacing: 0.04em;
}

.pix-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--stroke);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.28s ease;
}

.pix-panel.is-open {
  max-height: 420px;
  opacity: 1;
}

.pix-panel:not([hidden]).is-open {
  overflow: visible;
}

.pix-aviso {
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: var(--accent-2);
  line-height: 1.45;
}

.pay-pix-cta {
  width: 100%;
  margin-top: 14px;
}

.pix-admin-meta {
  margin-top: 4px;
  font-size: 0.72rem;
  line-height: 1.35;
}

.pill:active {
  transform: scale(0.98);
}

select.input {
  width: 100%;
  padding: 14px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 1rem;
}

.resumo {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
}

.resumo .line {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.resumo .total {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 1.1rem;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--stroke);
}

.cta-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(10, 10, 12, 0.92) 25%);
  z-index: 20;
}

.cta-bar .inner {
  max-width: 1100px;
  margin: 0 auto;
}

.btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 16px;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease, filter 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #1a0b00;
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.btn-primary:not(:disabled):active {
  transform: scale(0.98);
}

.toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  background: rgba(20, 20, 24, 0.95);
  border: 1px solid var(--stroke);
  padding: 10px 14px;
  border-radius: 12px;
  z-index: 70;
  transition: transform 0.25s ease;
  max-width: min(520px, 92vw);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.loader {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.tab.active {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.12);
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
}

.link {
  color: var(--accent-2);
  text-decoration: none;
}

.panel-admin {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}

table.simple {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

table.simple th,
table.simple td {
  border-bottom: 1px solid var(--stroke);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}

.badge-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.st-pendente {
  background: rgba(234, 179, 8, 0.2);
  color: #facc15;
}
.st-preparo {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}
.st-saiu_entrega {
  background: rgba(168, 85, 247, 0.2);
  color: #e9d5ff;
}
.st-entregue {
  background: rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
}
.st-cancelado {
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
}

.st-pix_pendente {
  background: rgba(249, 115, 22, 0.22);
  color: #fed7aa;
  border: 1px solid rgba(249, 115, 22, 0.45);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.btn-sm {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-size: 0.78rem;
}

.btn-sm.primary {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.15);
}

.btn-sm.is-active {
  border-color: rgba(245, 158, 11, 0.75);
  background: rgba(245, 158, 11, 0.22);
  color: var(--text);
}

/* ——— Admin: layout limpo + modais ——— */
body.admin-page .wrap--admin {
  max-width: 960px;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.admin-brand {
  margin: 0;
  text-align: left;
}

.admin-sub {
  margin: 4px 0 0;
  text-align: left;
}

.admin-toolbar {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.icon-tool {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent-2);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.icon-tool:hover {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
}

.icon-tool:active {
  transform: scale(0.96);
}

.panel-admin--primary {
  border-color: rgba(245, 158, 11, 0.22);
}

.admin-pedidos-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-section-title {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
}

.filter-pedidos {
  margin-top: 0;
}

.table-scroll {
  overflow: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.td-acoes {
  white-space: nowrap;
}

body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal.is-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.modal-dialog {
  position: relative;
  width: min(520px, 100%);
  max-height: min(88vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #16161c;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translateY(12px);
  transition: transform 0.22s ease;
}

.modal.is-open .modal-dialog {
  transform: translateY(0);
}

.modal-dialog--wide {
  width: min(640px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
}

.modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.modal-body {
  padding: 14px 16px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-subtitle {
  margin: 16px 0 8px;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.modal-subtitle:first-of-type {
  margin-top: 0;
}

.modal-footnote {
  margin-top: 14px;
  font-size: 0.78rem;
  line-height: 1.4;
}

.modal-actions-bar {
  margin-bottom: 12px;
}

.panel-nested {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 8px;
}

.input-compact {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 0.9rem;
}

.input-area {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  font-family: inherit;
}

.fin-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

@media (min-width: 480px) {
  .fin-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.fin-kpi {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
}

.fin-kpi span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.fin-kpi strong {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-2);
}

.prato-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chk-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
}

.pratos-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prato-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
}

.prato-row--inativo {
  opacity: 0.55;
}

.prato-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.prato-thumb--empty {
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed var(--stroke);
}

.prato-row-body {
  flex: 1;
  min-width: 0;
}

.prato-row-body strong {
  display: block;
  font-size: 0.9rem;
}

.btn-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.btn-icon:hover {
  color: var(--text);
  border-color: rgba(245, 158, 11, 0.35);
}

.btn-icon--danger:hover {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.45);
}

.bairros-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bairro-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
}

.bairro-row .bnome {
  flex: 1 1 140px;
  min-width: 120px;
}

.bairro-row .taxa {
  width: 96px;
  flex-shrink: 0;
}

.chk-ativo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.btn-danger-outline:hover {
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca;
}

@media (min-width: 640px) {
  .modal {
    place-items: center;
    padding: 20px;
  }

  .modal-dialog {
    max-height: 85vh;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.field-label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.foto-prato-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.btn-foto-acao {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent-2);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.btn-foto-acao:hover {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
}

.btn-foto-acao:active {
  transform: scale(0.96);
}

.foto-prato-preview-wrap {
  flex: 1 1 120px;
  min-width: 100px;
  max-width: 160px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  aspect-ratio: 4 / 3;
  background: rgba(0, 0, 0, 0.25);
}

.foto-prato-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.foto-prato-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
}

.fab-perfil {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(30, 30, 36, 0.85);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, background 0.2s ease;
}

.fab-perfil:hover {
  background: rgba(40, 40, 48, 0.95);
  transform: scale(1.05);
}

.fab-perfil:active {
  transform: scale(0.95);
}
