/* ============================================================
   SISTEMA DE FATURAÇÃO — CSS GLOBAL
   Design: Profissional, escuro com acentos âmbar/dourado
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  /* Cores principais */
  --bg-primary: #0F1117;
  --bg-secondary: #1A1D2E;
  --bg-card: #1E2235;
  --bg-hover: #252840;
  --bg-active: #2D3154;

  /* Bordas */
  --border: #2A2D45;
  --border-light: #363A5A;

  /* Acento âmbar/dourado */
  --accent: #F59E0B;
  --accent-light: #FCD34D;
  --accent-dark: #D97706;
  --accent-bg: rgba(245,158,11,0.12);

  /* Texto */
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-inverse: #0F1117;

  /* Status */
  --green: #10B981;
  --green-bg: rgba(16,185,129,0.12);
  --red: #EF4444;
  --red-bg: rgba(239,68,68,0.12);
  --blue: #3B82F6;
  --blue-bg: rgba(59,130,246,0.12);
  --orange: #F97316;
  --orange-bg: rgba(249,115,22,0.12);
  --purple: #8B5CF6;
  --purple-bg: rgba(139,92,246,0.12);
  --yellow: #EAB308;
  --yellow-bg: rgba(234,179,8,0.12);

  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);

  /* Fontes */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transições */
  --transition: all 0.18s cubic-bezier(0.4,0,0.2,1);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-light); }

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font-sans); }
input, select, textarea { font-family: var(--font-sans); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-text {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.sidebar-logo .logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
}

.nav-item .nav-icon { font-size: 1.1rem; width: 20px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-user:hover { background: var(--bg-hover); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
  flex-shrink: 0;
}

.user-info .user-name { font-size: 0.825rem; font-weight: 600; color: var(--text-primary); }
.user-info .user-role { font-size: 0.7rem; color: var(--text-muted); }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.page-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.kpi-card.amber::before { background: var(--accent); }
.kpi-card.green::before { background: var(--green); }
.kpi-card.blue::before { background: var(--blue); }
.kpi-card.red::before { background: var(--red); }
.kpi-card.purple::before { background: var(--purple); }
.kpi-card.orange::before { background: var(--orange); }

.kpi-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { font-size: 2rem; font-weight: 800; color: var(--text-primary); line-height: 1.1; margin-top: 6px; }
.kpi-value.mono { font-family: var(--font-mono); }
.kpi-change { font-size: 0.75rem; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.kpi-change.up { color: var(--green); }
.kpi-change.down { color: var(--red); }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--text-inverse); }
.btn-primary:hover:not(:disabled) { background: var(--accent-light); }

.btn-secondary { background: var(--bg-hover); color: var(--text-primary); border: 1px solid var(--border-light); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-active); }

.btn-success { background: var(--green); color: white; }
.btn-success:hover:not(:disabled) { background: #059669; }

.btn-danger { background: var(--red); color: white; }
.btn-danger:hover:not(:disabled) { background: #DC2626; }

.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }

.btn-icon { padding: 8px; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394A3B8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

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

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-addon {
  padding: 9px 13px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

/* Toggle */
.toggle-wrapper { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 2px; top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: white; }

/* ============================================================
   TABELAS
   ============================================================ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   BADGES / TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--accent-bg); color: var(--accent); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-gray { background: rgba(100,116,139,0.15); color: var(--text-muted); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  opacity: 0;
  animation: fadeIn 0.15s ease forwards;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  animation: slideUp 0.2s ease forwards;
}

.modal-sm { max-width: 420px; }
.modal-md { max-width: 580px; }
.modal-lg { max-width: 780px; }
.modal-xl { max-width: 1000px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1rem; font-weight: 700; }

.modal-close {
  width: 32px; height: 32px;
  background: var(--bg-hover);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--red-bg); color: var(--red); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@keyframes fadeIn { to { opacity: 1; } }
@keyframes slideUp { to { transform: translateY(0); } }

/* ============================================================
   TOAST / NOTIFICAÇÕES
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
  border-left: 4px solid var(--border);
}

.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--accent); }
.toast.info { border-left-color: var(--blue); }

.toast-icon { font-size: 1.1rem; }
.toast-msg { flex: 1; font-size: 0.875rem; color: var(--text-primary); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: 2px; background: var(--bg-primary); padding: 4px; border-radius: var(--radius-sm); }

.tab-btn {
  padding: 7px 14px;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: var(--transition);
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { background: var(--bg-card); color: var(--text-primary); font-weight: 600; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state .empty-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state .empty-msg { font-size: 0.875rem; max-width: 300px; margin: 0 auto 20px; }

/* ============================================================
   PÁGINA DE LOGIN
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .icon { font-size: 3rem; }
.login-logo h1 { font-size: 1.5rem; font-weight: 800; color: var(--accent); margin-top: 8px; }
.login-logo p { font-size: 0.825rem; color: var(--text-muted); }

.pin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 20px 0;
}

.pin-btn {
  aspect-ratio: 1;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.pin-btn:hover { background: var(--bg-active); border-color: var(--accent); color: var(--accent); }
.pin-btn:active { transform: scale(0.95); }

.pin-display {
  text-align: center;
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.pin-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  transition: var(--transition);
}

.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
}

/* ============================================================
   MAPA DE MESAS
   ============================================================ */
.mesas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}

.mesa-card {
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.mesa-card:hover { transform: scale(1.04); box-shadow: var(--shadow); }
.mesa-card:active { transform: scale(0.97); }

.mesa-card.livre { background: var(--green-bg); border-color: var(--green); }
.mesa-card.ocupada { background: var(--red-bg); border-color: var(--red); }
.mesa-card.reservada { background: var(--yellow-bg); border-color: var(--yellow); }
.mesa-card.bloqueada { background: rgba(100,116,139,0.1); border-color: var(--border); cursor: not-allowed; opacity: 0.5; }

.mesa-numero { font-size: 1.8rem; font-weight: 900; }
.mesa-card.livre .mesa-numero { color: var(--green); }
.mesa-card.ocupada .mesa-numero { color: var(--red); }
.mesa-card.reservada .mesa-numero { color: var(--yellow); }

.mesa-zona { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; }
.mesa-total { font-size: 0.75rem; font-weight: 700; font-family: var(--font-mono); margin-top: 2px; }
.mesa-card.ocupada .mesa-total { color: var(--accent); }

/* ============================================================
   INTERFACE DE PEDIDOS (Garçom)
   ============================================================ */
.pedido-layout {
  display: grid;
  grid-template-columns: 220px 1fr 320px;
  height: calc(100vh - var(--topbar-height));
  gap: 0;
  overflow: hidden;
}

.categorias-panel {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 8px;
}

.cat-btn {
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}

.cat-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.cat-btn.active { background: var(--accent-bg); color: var(--accent); }
.cat-icon { font-size: 1.1rem; }

.produtos-panel {
  background: var(--bg-primary);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.produtos-search {
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  padding-bottom: 8px;
  z-index: 2;
}

.produtos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.produto-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.produto-btn:hover { border-color: var(--accent); background: var(--accent-bg); transform: translateY(-2px); }
.produto-btn:active { transform: scale(0.97); }
.produto-btn.indisponivel { opacity: 0.4; cursor: not-allowed; }
.produto-btn.indisponivel:hover { transform: none; border-color: var(--border); background: var(--bg-card); }

.produto-emoji { font-size: 1.8rem; }
.produto-nome { font-size: 0.78rem; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.produto-preco { font-size: 0.875rem; font-weight: 800; color: var(--accent); font-family: var(--font-mono); }

.pedido-panel {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pedido-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.pedido-itens {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.item-name { flex: 1; font-size: 0.825rem; font-weight: 500; }
.item-qty-controls { display: flex; align-items: center; gap: 4px; }
.qty-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-primary);
  font-size: 0.875rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.qty-btn:hover { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.qty-btn-sm {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-primary);
  font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.qty-btn-sm:hover { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.qty-num { font-size: 0.875rem; font-weight: 700; min-width: 20px; text-align: center; }
.item-subtotal { font-family: var(--font-mono); font-size: 0.825rem; font-weight: 700; color: var(--accent); min-width: 52px; text-align: right; }

.pedido-totais {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.825rem;
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: var(--text-secondary);
}

.total-row.total-final {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
}

.total-row .val { font-family: var(--font-mono); }

.pedido-actions {
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ============================================================
   KDS — ECRÃ COZINHA/BAR
   ============================================================ */
.kds-layout {
  background: #0A0A0A;
  min-height: 100vh;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kds-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kds-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.kds-title.cozinha { color: #FF6B35; }
.kds-title.bar { color: #3B82F6; }
.kds-title.geral { color: #10B981; }

.kds-clock {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.kds-tickets {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  flex-wrap: wrap;
}

.kds-ticket {
  background: #1A1A1A;
  border: 2px solid #333;
  border-radius: 16px;
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition);
}

.kds-ticket.urgente { border-color: var(--red); animation: pulse 1.5s infinite; }
.kds-ticket.pronto { border-color: var(--green); opacity: 0.6; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

.kds-ticket-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #222;
  border-bottom: 1px solid #333;
}

.kds-mesa { font-size: 1.4rem; font-weight: 900; }
.kds-time { font-size: 0.9rem; font-family: var(--font-mono); }
.kds-time.ok { color: var(--green); }
.kds-time.aviso { color: var(--accent); }
.kds-time.urgente { color: var(--red); font-weight: 700; }

.kds-items { padding: 12px; flex: 1; }

.kds-item {
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  background: #2A2A2A;
  border: 1px solid #333;
}

.kds-item:hover { background: #333; }
.kds-item.feito { background: rgba(16,185,129,0.15); border-color: var(--green); }
.kds-item.feito .kds-item-nome { text-decoration: line-through; opacity: 0.5; }

.kds-item-row { display: flex; align-items: center; gap: 8px; }
.kds-item-qty { font-size: 1.1rem; font-weight: 900; min-width: 28px; color: var(--accent); }
.kds-item-nome { font-size: 0.9rem; font-weight: 600; flex: 1; }
.kds-item-obs { font-size: 0.75rem; color: #EAB308; margin-top: 4px; padding-left: 36px; }

.kds-ticket-footer { padding: 10px 12px; background: #222; border-top: 1px solid #333; }

.kds-btn-pronto {
  width: 100%;
  padding: 10px;
  background: var(--green);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kds-btn-pronto:hover { background: #059669; }
.kds-btn-pronto.ja-pronto { background: #333; color: var(--text-muted); }

/* ============================================================
   PAGAMENTO MODAL
   ============================================================ */
.payment-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.pay-method-btn {
  padding: 14px 8px;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pay-method-btn:hover { border-color: var(--border-light); background: var(--bg-hover); }
.pay-method-btn.active { border-color: var(--accent); background: var(--accent-bg); }

.pay-method-icon { font-size: 1.5rem; }
.pay-method-label { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); }
.pay-method-btn.active .pay-method-label { color: var(--accent); }

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.numpad-btn {
  aspect-ratio: 1.5;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.numpad-btn:hover { background: var(--bg-active); }
.numpad-btn:active { transform: scale(0.95); }
.numpad-btn.clear { color: var(--red); }
.numpad-btn.backspace { color: var(--accent); }

.troco-box {
  padding: 12px;
  background: var(--green-bg);
  border: 1px solid var(--green);
  border-radius: var(--radius-sm);
  text-align: center;
  margin-top: 12px;
}
.troco-label { font-size: 0.75rem; color: var(--green); font-weight: 600; text-transform: uppercase; }
.troco-value { font-size: 2rem; font-weight: 800; color: var(--green); font-family: var(--font-mono); }

/* ============================================================
   FECHO DE CAIXA
   ============================================================ */
.nota-grid {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.nota-label { font-size: 0.875rem; font-weight: 600; }
.nota-input { text-align: right; }
.nota-subtotal { font-family: var(--font-mono); font-weight: 700; color: var(--accent); min-width: 80px; text-align: right; }

/* ============================================================
   GRÁFICOS / FINANCEIRO
   ============================================================ */
.chart-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-bar-label { font-size: 0.8rem; min-width: 120px; color: var(--text-secondary); }
.chart-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-hover);
  border-radius: 99px;
  overflow: hidden;
}
.chart-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}
.chart-bar-value { font-size: 0.8rem; font-family: var(--font-mono); font-weight: 700; min-width: 70px; text-align: right; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.alert-icon { font-size: 1rem; flex-shrink: 0; }
.alert-success { background: var(--green-bg); border: 1px solid var(--green); color: var(--green); }
.alert-error { background: var(--red-bg); border: 1px solid var(--red); color: var(--red); }
.alert-warning { background: var(--accent-bg); border: 1px solid var(--accent); color: var(--accent); }
.alert-info { background: var(--blue-bg); border: 1px solid var(--blue); color: var(--blue); }

/* ============================================================
   PAGINAÇÃO
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 16px 0;
}

.page-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.825rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.page-btn:hover { background: var(--bg-hover); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: var(--text-inverse); font-weight: 700; }

/* ============================================================
   UTILIDADES
   ============================================================ */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-auto { margin-top: auto; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.825rem; }
.text-xs { font-size: 0.75rem; }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-heavy { font-weight: 800; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.spacer { flex: 1; }

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .pedido-layout { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .payment-methods { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  .sidebar, .topbar { display: none; }
  .main-content { margin-left: 0; }
  body { background: white; color: black; }
  .card { border: 1px solid #ddd; }
}
