:root {
  --primary: #e63946;
  --primary-dark: #c1121f;
  --secondary: #f4a261;
  --dark: #1d3557;
  --light: #f8f9fa;
  --gray: #6c757d;
  --success: #2a9d8f;
  --white: #ffffff;
  --shadow: 0 2px 12px rgba(0,0,0,0.10);
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f0f0;
  color: #222;
  min-height: 100%;
  overflow-y: auto;
  overscroll-behavior-y: none;
}

/* ─── HEADER ─────────────────────────────────── */
.header {
  background: var(--primary);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header h1 { font-size: 1.3rem; font-weight: 700; }
.header .logo-icon { font-size: 1.6rem; margin-right: 8px; }

/* ─── CARRINHO FLUTUANTE ─────────────────────── */
.cart-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(230,57,70,0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 200;
  transition: transform .2s, box-shadow .2s;
}
.cart-btn:hover { transform: scale(1.05); box-shadow: 0 6px 24px rgba(230,57,70,0.55); }
.cart-btn .badge {
  background: #fff;
  color: var(--primary);
  border-radius: 50%;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  font-weight: 800;
}

/* ─── MODAL BASE ─────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 300;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-box {
  background: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 580px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px 20px 32px;
  transform: translateY(100%); transition: transform .3s ease;
}
.modal-overlay.active .modal-box { transform: translateY(0); }
.modal-box h2 { font-size: 1.25rem; margin-bottom: 18px; color: var(--dark); }
.modal-close {
  float: right; background: none; border: none;
  font-size: 1.5rem; cursor: pointer; color: var(--gray);
  margin-top: -4px;
}

/* ─── FORM ───────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.form-control {
  width: 100%; border: 1.5px solid #ddd; border-radius: 8px;
  padding: 11px 13px; font-size: 1rem;
  transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ─── BOTÕES ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; border: none; border-radius: 10px;
  padding: 12px 22px; font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: .2s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #21867a; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: .88rem; }
.btn-whatsapp { background: #25D366; color: #fff; }
.btn-whatsapp:hover { background: #1ebe5d; }

/* ─── CATEGORIAS ─────────────────────────────── */
.categories-bar {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 14px 16px; background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
  position: sticky; top: 60px; z-index: 90;
}
.categories-bar::-webkit-scrollbar { display: none; }
.cat-btn {
  white-space: nowrap; border: none;
  background: #f0f0f0; border-radius: 50px;
  padding: 8px 18px; font-size: .9rem; font-weight: 600;
  cursor: pointer; color: var(--dark); transition: .2s;
}
.cat-btn.active, .cat-btn:hover { background: var(--primary); color: #fff; }

/* ─── CARDÁPIO ───────────────────────────────── */
.menu-section { padding: 0 12px 8px; }
.section-title {
  font-size: 1.1rem; font-weight: 700;
  color: var(--dark); padding: 18px 4px 10px;
  border-bottom: 2px solid var(--primary);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.products-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 8px;
}

.product-card {
  background: #fff; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  cursor: pointer; transition: transform .2s, box-shadow .2s;
}
.product-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.13); }
.product-card img {
  width: 100%; height: 130px; object-fit: cover; background: #eee;
}
.product-card .no-img {
  width: 100%; height: 130px; background: linear-gradient(135deg,#ffddd2,#e63946);
  display: flex; align-items: center; justify-content: center; font-size: 3rem;
}
.product-card .info { padding: 10px 11px 12px; }
.product-card .info h3 { font-size: .95rem; margin-bottom: 4px; }
.product-card .info .desc { font-size: .78rem; color: var(--gray); margin-bottom: 8px; line-height: 1.4; }
.product-card .info .price { font-size: 1.05rem; font-weight: 700; color: var(--primary); }
.product-card .destaque-badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--secondary); color: #fff;
  border-radius: 50px; padding: 3px 10px; font-size: .72rem; font-weight: 700;
}
.product-card { position: relative; }

/* ─── CARRINHO ───────────────────────────────── */
.cart-items { max-height: 48vh; overflow-y: auto; margin-bottom: 16px; }
.cart-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #eee;
}
.cart-item .item-info { flex: 1; }
.cart-item .item-name { font-weight: 600; font-size: .95rem; }
.cart-item .item-obs { font-size: .78rem; color: var(--gray); }
.cart-item .item-price { font-weight: 700; color: var(--primary); min-width: 70px; text-align: right; }
.qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qty-ctrl button {
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: var(--primary); color: #fff; font-size: 1rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.qty-ctrl button.minus { background: #ddd; color: #333; }
.qty-ctrl span { font-weight: 700; min-width: 22px; text-align: center; }

.cart-summary { border-top: 2px solid #eee; padding-top: 12px; }
.cart-row { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: .95rem; }
.cart-row.total { font-weight: 700; font-size: 1.1rem; color: var(--dark); margin-top: 6px; }

/* ─── CUPOM ──────────────────────────────────── */
.cupom-row { display: flex; gap: 8px; margin: 10px 0; }
.cupom-row input { flex: 1; }
.cupom-msg { font-size: .85rem; margin-top: 4px; }
.cupom-msg.ok { color: var(--success); }
.cupom-msg.err { color: var(--primary); }

/* ─── PAGAMENTO ──────────────────────────────── */
.pgto-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.pgto-btn {
  border: 2px solid #ddd; border-radius: 8px;
  padding: 9px 16px; background: #fff; cursor: pointer;
  font-size: .9rem; transition: .15s;
}
.pgto-btn.active { border-color: var(--primary); color: var(--primary); background: #fff0f0; }

/* ─── STATUS DO PEDIDO ───────────────────────── */
.status-timeline { margin: 16px 0; }
.status-step {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  opacity: .4; transition: .3s;
}
.status-step.done { opacity: 1; }
.status-step .dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: #ddd; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.status-step.done .dot { background: var(--success); color: #fff; }
.status-step .label { font-size: .95rem; font-weight: 600; }

/* ─── TOAST ──────────────────────────────────── */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: var(--dark); color: #fff;
  padding: 12px 22px; border-radius: 50px;
  font-size: .95rem; z-index: 999;
  opacity: 0; transition: opacity .3s;
  pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ─── HISTÓRICO ──────────────────────────────── */
.historico-item {
  border: 1.5px solid #eee; border-radius: 10px;
  padding: 13px; margin-bottom: 10px; cursor: pointer;
  transition: border-color .2s;
}
.historico-item:hover { border-color: var(--primary); }
.historico-item .hi-header { display: flex; justify-content: space-between; align-items: center; }
.historico-item .hi-date { font-size: .8rem; color: var(--gray); }
.historico-item .hi-total { font-weight: 700; color: var(--primary); }

/* ─── STEP WIZARD ────────────────────────────── */
.step { display: none; }
.step.active { display: block; }
.step-indicator {
  display: flex; gap: 0; margin-bottom: 22px;
}
.step-dot {
  flex: 1; height: 5px; background: #ddd; border-radius: 4px;
  margin: 0 2px; transition: background .3s;
}
.step-dot.done { background: var(--primary); }

/* ─── ADMIN ──────────────────────────────────── */
.admin-sidebar {
  width: 220px; background: var(--dark); color: #fff;
  height: 100%; padding: 20px 0; flex-shrink: 0;
  transition: width .25s ease; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: none;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent;
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-track { background: transparent; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 2px; }
.admin-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.38); }
.admin-sidebar.collapsed { width: 62px; }
.admin-sidebar .logo {
  padding: 0 20px 20px; font-size: 1.1rem; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.1);
  white-space: nowrap; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between;
}
.admin-sidebar .logo .logo-text { transition: opacity .2s; }
.admin-sidebar.collapsed .logo .logo-text { opacity: 0; width: 0; overflow: hidden; }
.sidebar-toggle {
  background: none; border: none; color: rgba(255,255,255,.7);
  cursor: pointer; padding: 2px 4px; font-size: 1rem; flex-shrink: 0;
  transition: color .2s;
}
.sidebar-toggle:hover { color: #fff; }
.admin-sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 20px; color: rgba(255,255,255,.75);
  text-decoration: none; font-size: .95rem; transition: .2s;
  white-space: nowrap; overflow: hidden;
}
.admin-sidebar.collapsed nav a { justify-content: center; padding: 13px 0; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.admin-sidebar nav a span { transition: opacity .2s, width .2s; }
.admin-sidebar.collapsed nav a span { opacity: 0; width: 0; overflow: hidden; display: none; }
.admin-sidebar.collapsed nav a i { font-size: 1.15rem; }
.admin-layout { display: flex; height: 100vh; overflow: hidden; }
.admin-content { flex: 1; padding: 24px; background: #f0f2f5; overflow-y: auto; overflow-x: clip; min-width: 0; height: 100%; min-height: 0; overscroll-behavior: none; scrollbar-width: thin; scrollbar-color: rgba(29,53,87,.22) transparent; }
.admin-content::-webkit-scrollbar { width: 6px; }
.admin-content::-webkit-scrollbar-track { background: transparent; }
.admin-content::-webkit-scrollbar-thumb { background: rgba(29,53,87,.2); border-radius: 3px; }
.admin-content::-webkit-scrollbar-thumb:hover { background: rgba(29,53,87,.38); }
.admin-topbar {
  background: #fff; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow); margin-bottom: 24px; border-radius: var(--radius);
}
.admin-topbar h2 { font-size: 1.2rem; color: var(--dark); }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.stat-card .s-value { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-card .s-label { font-size: .85rem; color: var(--gray); margin-top: 4px; }

.table-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.table-card table { width: 100%; border-collapse: collapse; }
.table-card th, .table-card td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #eee; font-size: .9rem; }
.table-card th { background: #f8f9fa; font-weight: 600; color: var(--dark); }
.table-card tr:hover td { background: #fff8f8; }

.status-badge {
  padding: 4px 10px; border-radius: 50px; font-size: .78rem; font-weight: 600;
}
.status-novo { background: #fff3cd; color: #856404; }
.status-confirmado { background: #cfe2ff; color: #084298; }
.status-preparando { background: #fff3cd; color: #664d03; }
.status-saiu { background: #d1ecf1; color: #0c5460; }
.status-entregue { background: #d4edda; color: #155724; }
.status-cancelado { background: #f8d7da; color: #721c24; }

.badge-pulsing {
  display: inline-block; border-radius: 50%; width: 10px; height: 10px;
  background: var(--primary); margin-right: 6px;
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: .6; }
}

/* ─── ADMIN DARK THEME ────────────────────────── */
.admin-header {
  padding: 16px 24px 8px;
  color: #e2e8f0;
}
.admin-header h1 { color: #e2e8f0 !important; font-size: 1.2rem; }
.admin-content {
  background: #0f172a !important;
  color: #e2e8f0;
}
.admin-topbar {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  box-shadow: none !important;
  border-radius: 12px !important;
}
.admin-topbar h2 { color: #e2e8f0 !important; }

.stat-card {
  background: #1e293b !important;
  box-shadow: none !important;
  border: 1px solid #334155 !important;
}
.stat-card .s-value { color: #3b82f6 !important; }
.stat-card .s-label { color: #64748b !important; }

.table-card {
  background: #1e293b !important;
  box-shadow: none !important;
  border: 1px solid #334155 !important;
}
.table-card th {
  background: #243047 !important;
  color: #64748b !important;
  border-bottom-color: #334155 !important;
}
.table-card td {
  border-bottom-color: #334155 !important;
  color: #e2e8f0 !important;
}
.table-card tr:hover td { background: rgba(255,255,255,.03) !important; }

.admin-content .form-control {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
.admin-content .form-control:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15) !important;
  outline: none !important;
}
.admin-content label { color: #94a3b8 !important; }
.admin-content .form-group label { color: #94a3b8 !important; }
.admin-content .btn-outline {
  background: transparent !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
.admin-content .btn-outline:hover {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #64748b !important;
}

/* ─── RESPONSIVE ─────────────────────────────── */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .products-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-sidebar { width: 62px !important; }
  .admin-sidebar nav a span { display: none !important; }
  .admin-sidebar .logo .logo-text { display: none; }
  .admin-sidebar nav a { justify-content: center; padding: 13px 0; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
}
