/* =======================
   MINI CRM - CSS MODERNIZADO
   Versão: 2.0
======================== */

/* =======================
   BASE / TOKENS
======================== */
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --danger: #991b1b;
  --danger-hover: #7f1d1d;
  --warning: #f59e0b;
  --cancel: #9ca3af;
  --cancel-hover: #6b7280;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =======================
   LAYOUT GERAL
======================== */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

aside {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-right: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

main {
  padding: 24px 28px;
  overflow-x: hidden;
}

h2 {
  margin: 0 0 16px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.grid {
  display: grid;
  gap: 16px;
}

.kpis {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
}

.card .hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.card .hd .icon {
  font-size: 18px;
  line-height: 1;
}

.card .hd h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card .bd {
  padding: 16px;
}

/* =======================
   SIDEBAR / NAV
======================== */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  box-shadow: var(--shadow-sm);
}

.brand h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.navbtn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.navbtn:hover {
  background: #f8fafc;
  border-color: var(--primary);
  transform: translateX(2px);
}

.navbtn.active {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow);
}

.badge {
  margin-left: auto;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.navbtn.active .badge {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.note {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
}

.note-sm {
  font-size: 12px;
  color: var(--muted);
}

/* =======================
   TOOLBAR / CONTROLES
======================== */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0 0 16px 0;
  flex-wrap: wrap;
}

.toolbar .hint {
  color: var(--muted);
  font-size: 14px;
  margin-left: 8px;
}

.search {
  flex: 1;
  min-width: 240px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 15px;
  transition: var(--transition);
}

.search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn:hover {
  background: #f8fafc;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-weight: 600;
}

.btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn.success {
  background: var(--success);
  border-color: var(--success);
  color: white;
  font-weight: 600;
}

.btn.success:hover {
  background: #059669;
  border-color: #059669;
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
  font-weight: 600;
}

.btn.danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

.btn.ghost {
  background: var(--cancel);
  border-color: var(--cancel);
  color: white;
  font-weight: 600;
}

.btn.ghost:hover {
  background: var(--cancel-hover);
  border-color: var(--cancel-hover);
}

/* =======================
   TABELAS
======================== */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--border);
  padding: 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: #f8fafc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tbody tr {
  transition: var(--transition);
}

tbody tr:hover {
  background: #f8fafc;
}

.thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
  background: #f1f5f9;
}

.thumb-lg {
  width: 126px;
  height: 126px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #f1f5f9;
}

/* Coluna de ações */
th:last-child {
  width: 220px;
}

td.actions {
  text-align: right;
  white-space: nowrap;
}

td.actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  min-width: 90px;
  margin: 0;
}

td.actions .btn + .btn {
  margin-left: 8px;
}

/* =======================
   BOTÕES ESPECÍFICOS
======================== */
.btn-edit {
  background: #e5e7eb;
  color: #1f2937;
  font-weight: 600;
  padding: 0 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: none;
  min-width: 90px;
  height: 36px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  transition: var(--transition);
}

.btn-edit:hover {
  background: #d1d5db;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-danger {
  background: var(--danger);
  color: white;
  font-weight: 600;
  padding: 0 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: none;
  min-width: 90px;
  height: 36px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  transition: var(--transition);
}

.btn-danger:hover {
  background: var(--danger-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-status {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  min-width: 120px;
  height: 36px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  transition: var(--transition);
}

.btn-status:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-cancel {
  background: var(--cancel) !important;
  color: white !important;
  border-color: var(--cancel) !important;
  font-weight: 600 !important;
}

.btn-cancel:hover {
  background: var(--cancel-hover) !important;
  border-color: var(--cancel-hover) !important;
}

.btn-pago {
  background: var(--success);
  color: white;
}

.btn-entrega {
  background: var(--warning);
  color: #78350f;
}

.btn-status:not(.btn-pago):not(.btn-entrega) {
  background: #e5e7eb;
  color: #1f2937;
  border: 1px solid #cbd5e1;
}

/* =======================
   TAGS / STATUS
======================== */
.tag {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  font-weight: 500;
}

.tag.pag-pendente {
  background: linear-gradient(135deg, #991b1b, #7f1d1d);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  border: none;
  padding: 6px 12px;
  min-width: 90px;
  text-align: center;
}

.tag.pag-confirmado {
  background: linear-gradient(135deg, #10b981, #047857);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  border: none;
  padding: 6px 12px;
  min-width: 90px;
  text-align: center;
}

.tag.entrega-aguardando {
  background: linear-gradient(135deg, #facc15, #ca8a04);
  color: #000;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
  border: none;
  padding: 6px 12px;
  min-width: 90px;
  text-align: center;
}

.tag.entrega-entregue {
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  border: none;
  padding: 6px 12px;
  min-width: 90px;
  text-align: center;
}

/* =======================
   FEEDBACK / MODAL
======================== */
#status {
  position: fixed;
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 100;
  font-weight: 500;
}

#status.status--danger {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #7f1d1d;
}

#status.status--ok {
  background: #d1fae5;
  border-color: #a7f3d0;
  color: #065f46;
}

#err {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 20px;
  background: #fef2f2;
  color: #7f1d1d;
  border: 1px solid #fca5a5;
  padding: 16px;
  border-radius: var(--radius);
  display: none;
  box-shadow: var(--shadow-lg);
  white-space: pre-wrap;
  z-index: 100;
}

.modal-wrap {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  width: min(860px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.modal header strong {
  font-size: 18px;
  font-weight: 700;
}

.modal main {
  padding: 20px;
  flex: 1 1 auto;
  overflow: auto;
}

.modal footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
}

.modal.modal-create {
  width: min(760px, 100%);
}

/* =======================
   FORMS
======================== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.field input,
.field textarea,
.field select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  transition: var(--transition);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.field input[readonly] {
  background: #f4f7fb;
  color: #475569;
  cursor: not-allowed;
}

.mini {
  font-size: 12px;
  color: var(--muted);
}

.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #eef2ff;
  font-size: 13px;
  font-weight: 500;
}

.pill.ok {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #065f46;
}

.pill.warn {
  background: #fef9c3;
  border-color: #fde68a;
  color: #78350f;
}

.pill.err {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #7f1d1d;
}

/* =======================
   KPIs
======================== */
.grid.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.kpi {
  padding: 16px;
}

.kpi h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

.kpi .v,
.kpi .value {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

/* =======================
   USER PANEL
======================== */
.userpanel {
  margin-top: auto;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
}

.usercard {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.useravatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.userinfo {
  flex: 1;
  min-width: 0;
}

.userinfo .name {
  font-weight: 700;
  font-size: 15px;
  color: #111827;
  line-height: 1.2;
}

.userinfo .sub {
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  margin-top: 12px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #f1f5f9;
  background: #ffffff;
  color: var(--danger);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-logout:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-logout:active {
  transform: translateY(0);
}

/* =======================
   UTILITÁRIOS
======================== */
.muted {
  color: var(--muted);
}

.right {
  text-align: right;
}

/* =======================
   WHATSAPP
======================== */
.qrbox {
  width: 100%;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#f8fafc 0% 25%, #f1f5f9 0% 50%) 50% / 24px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.qrbox img {
  max-width: 100%;
  max-height: 420px;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 18px rgba(15, 23, 42, 0.15));
}

.saved-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.saved-list li {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: #334155;
  font-weight: 600;
  font-size: 14px;
}

/* =======================
   PROMOÇÕES
======================== */
#pr_titulo,
#pr_msg {
  background-color: #e0f2fe !important;
  border: 2px solid #bae6fd !important;
}

#view-promocoes .grid.kpis {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 16px;
}

#view-promocoes > .grid {
  grid-template-columns: 1.1fr 0.9fr !important;
  gap: 16px !important;
}

#view-promocoes .grid > *,
#view-promocoes .card {
  min-width: 0;
}

#view-promocoes .card .bd {
  overflow-x: hidden;
}

#view-promocoes .toolbar {
  flex-wrap: wrap;
}

#view-promocoes .toolbar .search {
  min-width: 0;
  flex: 1 1 180px;
}

#view-promocoes img,
#view-promocoes select,
#view-promocoes input,
#view-promocoes textarea {
  max-width: 100%;
}

#view-promocoes .field > div[style*="display: flex"] {
  flex-wrap: wrap;
}

#view-promocoes #pr_inst {
  flex: 1 1 240px !important;
  min-width: 0;
}

#view-promocoes #pr_preview,
#view-promocoes #pr_enviar {
  flex: 0 0 auto !important;
  margin-top: 8px;
}

#view-promocoes #pr_enviar {
  flex-grow: 0 !important;
}

/* =======================
   PEDIDOS
======================== */
#ped-tableWrap table {
  border-collapse: collapse;
}

#ped-tableWrap thead th {
  border-bottom: 1px solid var(--border);
}

#ped-tableWrap tbody td {
  border-bottom: 1px solid var(--border) !important;
}

#ped-tableWrap tbody tr:last-child td {
  border-bottom: 0 !important;
}

#ped-tableWrap td[data-l="Status"] .tag {
  font-size: 15px;
  line-height: 1.2;
  padding: 6px 12px;
}

#view-pedidos .btn-status:not(.btn-pago):not(.btn-entrega) {
  background: #e5e7eb;
  color: #111827;
  border: 1px solid #cbd5e1;
  box-shadow: var(--shadow-sm);
}

/* =======================
   CLIENTES
======================== */
#view-clientes .toolbar {
  flex-wrap: wrap;
}

#view-clientes .toolbar .search {
  min-width: 0;
  flex: 1 1 200px;
}

#view-clientes .card,
#view-clientes .card .bd,
#view-clientes table {
  min-width: 0;
  overflow-x: hidden;
}

/* =======================
   WHATSAPP LAYOUT
======================== */
#view-whatsapp .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "dados qr";
  gap: 16px;
}

#view-whatsapp .grid-2 > .card:nth-child(1) {
  grid-area: qr;
}

#view-whatsapp .grid-2 > .card:nth-child(2) {
  grid-area: dados;
}

#view-whatsapp .toolbar {
  flex-wrap: wrap;
}

#view-whatsapp .toolbar .search {
  min-width: 0;
  flex: 1 1 180px;
}

#view-whatsapp .grid-2 > * {
  min-width: 0;
}

#view-whatsapp .card .bd {
  overflow-x: hidden;
}

#view-whatsapp img {
  max-width: 100%;
  height: auto;
}

/* =======================
   RESPONSIVO - TABLET
======================== */
@media (max-width: 960px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  
  #view-dashboard .grid.cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  #view-promocoes .grid.kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  
  #view-promocoes > .grid {
    grid-template-columns: 1fr !important;
  }
  
  #view-whatsapp .grid-2 {
    grid-template-columns: 1fr;
    grid-template-areas:
      "dados"
      "qr";
  }
}

/* =======================
   RESPONSIVO - MOBILE
======================== */
@media (max-width: 720px) {
  .app {
    grid-template-columns: 1fr;
  }
  
  aside {
    display: none;
  }
  
  main {
    padding: 16px;
  }
  
  .kpis {
    grid-template-columns: 1fr;
  }
  
  #view-dashboard .grid.cards {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }
  
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  
  .toolbar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  
  .toolbar .search {
    grid-column: 1 / -1;
  }
  
  .toolbar .hint {
    display: none;
  }
  
  .toolbar .btn {
    padding: 10px 8px;
    font-size: 12px;
  }
  
  h2 {
    font-size: 20px;
  }
  
  .userinfo .name {
    font-size: 14px;
  }
  
  .userinfo .sub {
    font-size: 12px;
  }
}

/* =======================
   TABELAS MOBILE - CARDS
======================== */
@media (max-width: 720px) {
  /* Dashboard - Últimos pedidos */
  #dash-last thead {
    display: none;
  }
  
  #dash-last tbody {
    display: block;
  }
  
  #dash-last tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-sm);
  }
  
  #dash-last td {
    border: 0;
    padding: 0;
    background: transparent;
  }
  
  #dash-last td.data {
    grid-column: 1;
    grid-row: 1;
    font-weight: 700;
    color: #334155;
  }
  
  #dash-last td.pedido {
    grid-column: 1;
    grid-row: 2;
    color: #475569;
  }
  
  #dash-last td.cliente {
    grid-column: 1;
    grid-row: 3;
    margin-top: 4px;
  }
  
  #dash-last td.valor {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
    font-weight: 800;
    color: var(--text);
  }
  
  #dash-last td.valor::before {
    content: 'Valor: ';
    color: var(--muted);
    font-weight: 600;
    margin-right: 4px;
  }
  
  #dash-last td.pagamento {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }
  
  #dash-last td.entrega {
    grid-column: 2;
    grid-row: 3;
    justify-self: end;
  }
  
  #dash-last .tag {
    min-width: 36px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    padding: 4px 10px;
  }
  
  #dash-last th.telefone,
  #dash-last td.telefone {
    display: none;
  }
}

@media (max-width: 720px) {
  /* Clientes - Tabela para cards */
  #view-clientes table thead {
    display: none;
  }
  
  #view-clientes table,
  #view-clientes tbody,
  #view-clientes tr,
  #view-clientes td {
    display: block;
    width: 100%;
  }
  
  #view-clientes tbody {
    display: block;
  }
  
  #view-clientes tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-sm);
  }
  
  #view-clientes td {
    border: 0;
    padding: 8px 0;
    background: transparent;
  }
  
  #view-clientes td::before {
    content: attr(data-l);
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  #view-clientes td.actions {
    display: flex !important;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding-top: 12px;
  }
  
  #view-clientes td.actions .txt {
    display: none;
  }
  
  #view-clientes td.actions .ico {
    display: inline-block;
    font-size: 18px;
    line-height: 1;
  }
  
  #view-clientes td.actions .btn,
  #view-clientes td.actions .btn-edit,
  #view-clientes td.actions .btn-danger,
  #view-clientes td.actions .btn.success {
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    min-width: 0;
  }
}

@media (max-width: 720px) {
  /* Pedidos - Status tags maiores */
  #ped-tableWrap td[data-l="Status"] .tag {
    font-size: 16px;
  }
  
  /* Promoções - Ajustes mobile */
  #view-promocoes .grid.kpis {
    grid-template-columns: 1fr !important;
  }
  
  #view-promocoes .grid-2 {
    grid-template-columns: 1fr !important;
  }
}

/* =======================
   PEDIDOS - DESKTOP
======================== */
@media (min-width: 900px) {
  #ped-tableWrap table {
    table-layout: auto;
  }
  
  #ped-tableWrap thead th:nth-child(1),
  #ped-tableWrap tbody td:nth-child(1) {
    width: 110px;
  }
  
  #ped-tableWrap thead th:nth-child(2),
  #ped-tableWrap tbody td:nth-child(2) {
    width: 90px;
  }
  
  #ped-tableWrap thead th:nth-child(3),
  #ped-tableWrap tbody td:nth-child(3) {
    width: 120px;
  }
  
  #ped-tableWrap thead th:nth-child(4),
  #ped-tableWrap tbody td:nth-child(4) {
    width: 90px;
  }
  
  #ped-tableWrap thead th:nth-child(5),
  #ped-tableWrap tbody td:nth-child(5) {
    width: 28%;
    min-width: 240px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
  }
  
  #ped-tableWrap thead th:nth-child(6),
  #ped-tableWrap tbody td:nth-child(6) {
    width: 80px;
    text-align: right;
  }
  
  #ped-tableWrap thead th:nth-child(7),
  #ped-tableWrap tbody td:nth-child(7) {
    width: 110px;
    text-align: right;
  }
  
  #ped-tableWrap thead th:nth-child(8),
  #ped-tableWrap tbody td:nth-child(8),
  #ped-tableWrap thead th:nth-child(9),
  #ped-tableWrap tbody td:nth-child(9),
  #ped-tableWrap thead th:nth-child(10),
  #ped-tableWrap tbody td:nth-child(10) {
    width: 140px;
  }
  
  #ped-tableWrap thead th:nth-child(11),
  #ped-tableWrap tbody td:nth-child(11) {
    width: 160px;
  }
  
  #ped-tableWrap thead th:nth-child(12),
  #ped-tableWrap tbody td:nth-child(12) {
    width: 130px;
  }
  
  #ped-tableWrap thead th:nth-child(13),
  #ped-tableWrap tbody td:nth-child(13) {
    width: 220px;
  }
  
  /* Ações compactas */
  #view-pedidos thead th:last-child {
    width: 160px !important;
    max-width: 160px !important;
    min-width: 0 !important;
  }
  
  #view-pedidos td.actions-vertical {
    padding: 8px !important;
    white-space: normal !important;
  }
  
  #view-pedidos td.actions-vertical .btn-grid {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end;
    gap: 6px !important;
    width: auto !important;
  }
  
  #view-pedidos td.actions-vertical .btn-grid .btn-status {
    width: 132px !important;
    min-width: 132px !important;
    height: 36px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
    border-radius: var(--radius-sm) !important;
  }
}

/* =======================
   PROMOÇÕES - DESKTOP
======================== */
@media (min-width: 900px) {
  #view-promocoes .grid.kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  
  #view-promocoes .grid.kpis {
    margin-bottom: 16px !important;
  }
  
  #view-promocoes .grid.kpis .kpi {
    min-width: 0;
  }
}

/* =======================
   AJUSTES FINAIS
======================== */
@media (max-width: 560px) {
  #view-promocoes .grid.kpis {
    grid-template-columns: 1fr !important;
  }
  
  #view-promocoes .grid-2 {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 420px) {
  #view-dashboard .grid.cards {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px;
  }
}

@media (max-width: 680px) {
  .userinfo .name {
    font-size: 14px;
  }
  
  .userinfo .sub {
    font-size: 12px;
  }
}


/* =======================
   MENU HAMBÚRGUER MOBILE
======================== */
.menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 101;
  width: 48px;
  height: 48px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}

.menu-toggle:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

@media (max-width: 720px) {
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  aside {
    display: flex;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
  }
  
  aside.open {
    transform: translateX(0);
  }
  
  .menu-overlay.open {
    display: block;
  }
  
  main {
    padding-top: 80px;
  }
}
