/* ============================================================
   DTPro Restaurante - CSS Global
   Tema: Escuro (Azul Navy + Laranja)
   ============================================================ */

:root {
  --navy:       #0f172a;
  --navy-2:     #1e293b;
  --navy-3:     #334155;
  --navy-4:     #475569;
  --orange:     #f97316;
  --orange-dk:  #ea6c0a;
  --orange-lt:  #fed7aa;
  --white:      #f8fafc;
  --gray-lt:    #e2e8f0;
  --gray:       #94a3b8;
  --text:       #f1f5f9;
  --text-muted: #94a3b8;

  --verde:      #22c55e;
  --vermelho:   #ef4444;
  --amarelo:    #f59e0b;
  --azul:       #3b82f6;
  --roxo:       #8b5cf6;
  --ciano:      #06b6d4;

  --sidebar-w: 240px;
  --header-h:  60px;
  --radius:    10px;
  --shadow:    0 2px 12px rgba(0,0,0,0.35);
  --transition: 0.2s ease;
}

/* Tema claro */
body.tema-claro {
  --navy:    #f1f5f9;
  --navy-2:  #ffffff;
  --navy-3:  #e2e8f0;
  --navy-4:  #cbd5e1;
  --text:    #0f172a;
  --text-muted: #64748b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--navy);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--orange-dk); }

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-2);
  border-right: 1px solid var(--navy-3);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 16px 20px;
  border-bottom: 1px solid var(--navy-3);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo img { height: 36px; }
.sidebar-logo span {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-empresa {
  padding: 12px 20px;
  border-bottom: 1px solid var(--navy-3);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-empresa-nome {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-empresa-trocar {
  font-size: 11px;
  color: var(--orange);
  cursor: pointer;
}
.sidebar-empresa-icon {
  width: 34px; height: 34px;
  background: var(--orange);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--navy-3); border-radius: 3px; }

.nav-section {
  padding: 16px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--navy-4);
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
  font-size: 13.5px;
}
.nav-item:hover {
  background: var(--navy-3);
  color: var(--text);
  border-left-color: var(--navy-3);
}
.nav-item.ativo {
  background: rgba(249,115,22,0.12);
  color: var(--orange);
  border-left-color: var(--orange);
  font-weight: 600;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--navy-3);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user-nome { font-size: 13px; font-weight: 600; }
.sidebar-user-tipo {
  font-size: 11px;
  color: var(--orange);
  text-transform: capitalize;
}
.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--navy-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--orange);
  flex-shrink: 0;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  height: var(--header-h);
  background: var(--navy-2);
  border-bottom: 1px solid var(--navy-3);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-w);
  z-index: 99;
}

.header-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.header-title {
  font-size: 16px;
  font-weight: 700;
  flex: 1;
}
.header-title span { color: var(--text-muted); font-weight: 400; font-size: 13px; margin-left: 6px; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--navy-3);
  border: none;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
  font-size: 15px;
  position: relative;
}
.btn-icon:hover { background: var(--navy-4); }
.btn-icon .badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--orange);
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  width: 16px; height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   CONTEÚDO PRINCIPAL
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--header-h);
  min-height: 100vh;
  flex: 1;
}
.page-body { padding: 24px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--navy-2);
  border: 1px solid var(--navy-3);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--navy-3);
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i { color: var(--orange); }

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--navy-2);
  border: 1px solid var(--navy-3);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.kpi-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.kpi-icon.laranja  { background: rgba(249,115,22,0.15); color: var(--orange); }
.kpi-icon.verde    { background: rgba(34,197,94,0.15);  color: var(--verde); }
.kpi-icon.azul     { background: rgba(59,130,246,0.15); color: var(--azul); }
.kpi-icon.roxo     { background: rgba(139,92,246,0.15); color: var(--roxo); }
.kpi-icon.ciano    { background: rgba(6,182,212,0.15);  color: var(--ciano); }
.kpi-icon.amarelo  { background: rgba(245,158,11,0.15); color: var(--amarelo); }
.kpi-valor {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.kpi-variacao { font-size: 11px; margin-top: 4px; }
.kpi-variacao.up   { color: var(--verde); }
.kpi-variacao.down { color: var(--vermelho); }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-primary   { background: var(--orange);  color: white; }
.btn-primary:hover { background: var(--orange-dk); color: white; }
.btn-secondary { background: var(--navy-3);  color: var(--text); }
.btn-secondary:hover { background: var(--navy-4); }
.btn-success   { background: var(--verde);   color: white; }
.btn-danger    { background: var(--vermelho); color: white; }
.btn-warning   { background: var(--amarelo); color: white; }
.btn-info      { background: var(--azul);    color: white; }
.btn-outline   { background: transparent; border: 1.5px solid var(--navy-3); color: var(--text); }
.btn-outline:hover { border-color: var(--orange); color: var(--orange); }

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--navy);
  border: 1.5px solid var(--navy-3);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--orange); }
.form-control::placeholder { color: var(--navy-4); }
select.form-control { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ============================================================
   TABELAS
   ============================================================ */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--navy-3);
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--navy-3);
  vertical-align: middle;
  font-size: 13.5px;
}
tr:hover td { background: rgba(249,115,22,0.04); }
tr:last-child td { border-bottom: none; }

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-verde    { background: rgba(34,197,94,0.15);   color: var(--verde); }
.badge-vermelho { background: rgba(239,68,68,0.15);   color: var(--vermelho); }
.badge-amarelo  { background: rgba(245,158,11,0.15);  color: var(--amarelo); }
.badge-azul     { background: rgba(59,130,246,0.15);  color: var(--azul); }
.badge-roxo     { background: rgba(139,92,246,0.15);  color: var(--roxo); }
.badge-ciano    { background: rgba(6,182,212,0.15);   color: var(--ciano); }
.badge-laranja  { background: rgba(249,115,22,0.15);  color: var(--orange); }
.badge-gray     { background: var(--navy-3);          color: var(--text-muted); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.ativo { display: flex; }
.modal {
  background: var(--navy-2);
  border: 1px solid var(--navy-3);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease;
}
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--navy-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--orange); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--navy-3);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   TOAST / ALERTAS
   ============================================================ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--navy-2);
  border: 1px solid var(--navy-3);
  border-radius: 10px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
  border-left: 4px solid var(--navy-3);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast.sucesso { border-left-color: var(--verde); }
.toast.erro    { border-left-color: var(--vermelho); }
.toast.aviso   { border-left-color: var(--amarelo); }
.toast.info    { border-left-color: var(--azul); }
.toast i { font-size: 18px; }
.toast.sucesso i { color: var(--verde); }
.toast.erro i    { color: var(--vermelho); }
.toast.aviso i   { color: var(--amarelo); }
.toast.info i    { color: var(--azul); }
.toast-msg { font-size: 13.5px; flex: 1; }

/* ============================================================
   MESAS - MAPA
   ============================================================ */
.mapa-wrapper {
  background: var(--navy);
  border: 2px dashed var(--navy-3);
  border-radius: 12px;
  position: relative;
  min-height: 580px;
  overflow: hidden;
}
.mesa-item {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 10px;
  border: 2px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
  font-size: 11px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  gap: 2px;
}
.mesa-item:hover { transform: scale(1.06); box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.mesa-item.redonda { border-radius: 50%; }
.mesa-numero { font-size: 15px; font-weight: 800; }
.mesa-info   { font-size: 10px; opacity: 0.85; text-align: center; line-height: 1.3; }
.mesa-tempo  { font-size: 10px; font-weight: 600; }

/* Legenda mesas */
.mesa-legenda {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.mesa-legenda-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.mesa-legenda-cor {
  width: 14px; height: 14px;
  border-radius: 4px;
}

/* ============================================================
   COZINHA
   ============================================================ */
.cozinha-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.pedido-card {
  background: var(--navy-2);
  border: 1px solid var(--navy-3);
  border-radius: 12px;
  overflow: hidden;
}
.pedido-card-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--navy-3);
}
.pedido-card-body { padding: 14px 16px; }
.pedido-card-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--navy-3);
  font-size: 13.5px;
}
.pedido-card-item:last-child { border-bottom: none; }
.pedido-qtd {
  width: 28px; height: 28px;
  background: var(--orange);
  color: white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.pedido-card-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--navy-3);
  display: flex;
  gap: 8px;
}
.pedido-card-footer .btn { flex: 1; justify-content: center; }

/* ============================================================
   PÁGINA DE LOGIN
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  padding: 20px;
}
.login-box {
  background: var(--navy-2);
  border: 1px solid var(--navy-3);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo img { height: 56px; }
.login-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
}
.login-title span { color: var(--orange); }

/* ============================================================
   SELEÇÃO DE EMPRESA/CAIXA
   ============================================================ */
.selecao-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.selecao-item {
  background: var(--navy);
  border: 2px solid var(--navy-3);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 14px;
}
.selecao-item:hover { border-color: var(--orange); background: rgba(249,115,22,0.06); }
.selecao-item.selecionado { border-color: var(--orange); background: rgba(249,115,22,0.1); }
.selecao-icon {
  width: 42px; height: 42px;
  background: rgba(249,115,22,0.15);
  color: var(--orange);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.selecao-nome { font-size: 14px; font-weight: 700; }
.selecao-detalhe { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   PESQUISA / FILTROS
   ============================================================ */
.search-bar {
  position: relative;
  flex: 1;
}
.search-bar i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}
.search-bar input {
  padding-left: 36px;
}

.filtros-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs-header {
  display: flex;
  border-bottom: 2px solid var(--navy-3);
  margin-bottom: 20px;
  gap: 4px;
}
.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}
.tab-btn.ativo, .tab-btn:hover { color: var(--orange); border-bottom-color: var(--orange); }
.tab-panel { display: none; }
.tab-panel.ativo { display: block; }

/* ============================================================
   PAGINAÇÃO
   ============================================================ */
.paginacao {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}
.pag-btn {
  width: 34px; height: 34px;
  background: var(--navy-3);
  border: none;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pag-btn:hover, .pag-btn.ativo { background: var(--orange); color: white; }

/* ============================================================
   LOADING / SPINNER
   ============================================================ */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--navy-3);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
}
.loading-overlay.ativo { display: flex; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h4 { font-size: 16px; margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.aberta {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .header {
    left: 0;
  }
  .header-toggle { display: flex; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-body { padding: 16px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .login-box { padding: 28px 20px; }
}

/* ============================================================
   SCROLLBAR GLOBAL
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--navy); }
::-webkit-scrollbar-thumb { background: var(--navy-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--navy-4); }

/* ============================================================
   AJUSTES RESPONSIVOS GERAIS - CELULAR/TABLET
   ============================================================ */
.sidebar-backdrop {
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.58);
  z-index:98;
}
.sidebar-backdrop.ativo { display:block; }

img, video, canvas { max-width:100%; height:auto; }
.card { overflow:hidden; }
.table-container { width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }

/* Mapa responsivo: no celular o usuário consegue arrastar/rolar o salão inteiro */
.mapa-wrapper {
  overflow:auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  min-width: 0;
}
.mapa-wrapper::after {
  content:'';
  position:absolute;
  left:1100px;
  top:720px;
  width:1px;
  height:1px;
  pointer-events:none;
}
.mesa-drag { touch-action:none; }

@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .page-body { padding:18px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 900px) {
  body { font-size:13px; }
  .sidebar {
    width: min(82vw, 310px);
    transform: translateX(-105%);
    box-shadow: 12px 0 35px rgba(0,0,0,.45);
    z-index: 101;
  }
  .sidebar.aberta { transform: translateX(0); }
  .main-content { margin-left:0; }
  .header { left:0; padding:0 12px; gap:8px; }
  .header-toggle {
    display:flex;
    align-items:center;
    justify-content:center;
    width:40px;
    height:40px;
    border-radius:10px;
    background:var(--navy-3);
  }
  .header-title { font-size:15px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .header-title span { display:none; }
  .header-actions { gap:6px; }
  .btn-icon { width:38px; height:38px; }
  .page-body { padding:14px; }
  .card { padding:14px; border-radius:12px; }
  .card-header { align-items:flex-start; gap:10px; flex-wrap:wrap; }
  .btn { min-height:40px; justify-content:center; }
  .btn-sm { min-height:38px; padding:8px 12px; }
  .form-row, .form-row-3 { grid-template-columns:1fr; gap:0; }
  .modal-overlay { padding:10px; align-items:flex-end; }
  .modal { max-width:100%; max-height:92vh; border-radius:16px 16px 0 0; }
  .modal-header { padding:16px; }
  .modal-body { padding:16px; }
  .modal-footer { padding:14px 16px; flex-wrap:wrap; }
  .modal-footer .btn { flex:1; }
  .tabs-header, .tabs { overflow-x:auto; flex-wrap:nowrap !important; padding-bottom:6px; -webkit-overflow-scrolling:touch; }
  .tab-btn, .tabs .btn { flex:0 0 auto; white-space:nowrap; }
  .mesa-legenda { gap:8px; overflow-x:auto; flex-wrap:nowrap; padding-bottom:8px; margin-bottom:6px; }
  .mesa-legenda-item { flex:0 0 auto; }
  .mapa-wrapper {
    min-height: calc(100vh - 270px) !important;
    max-height: calc(100vh - 210px);
    overflow:auto !important;
    border-radius:12px;
  }
  .mapa-wrapper::after { left:950px; top:650px; }
  .mesa-item { min-width:72px; min-height:72px; }
  .mesa-numero { font-size:14px; }
  .mesa-info, .mesa-tempo { font-size:10px; }
  .toast-container { left:12px; right:12px; top:72px; }
  .toast { min-width:0; max-width:none; width:100%; }
}

@media (max-width: 560px) {
  .header { height:56px; }
  .main-content { padding-top:56px; }
  .header-actions .btn-icon:nth-child(1),
  .header-actions .btn-icon:nth-child(2) { display:none; }
  .page-body { padding:10px; }
  .kpi-grid { grid-template-columns:1fr; gap:10px; }
  .kpi-card { padding:14px; }
  .filtros-bar, .card-header, .modal-footer { flex-direction:column; align-items:stretch; }
  .filtros-bar .btn, .card-header .btn { width:100%; }
  .btn { width:auto; }
  .btn.btn-block, button.btn { width:100%; }
  .login-page { padding:14px; }
  .login-box { padding:24px 16px; border-radius:14px; }
  .sidebar-logo img { height:32px; }
  .sidebar-footer { padding-bottom:calc(12px + env(safe-area-inset-bottom)); }
  .mapa-wrapper {
    min-height: calc(100vh - 240px) !important;
    max-height: calc(100vh - 178px);
  }
  .mapa-wrapper::after { left:850px; top:620px; }
  .mesa-item { min-width:68px; min-height:68px; }
  .modal-body .form-control { font-size:16px; } /* evita zoom no iPhone */
}
