/* 2026-08-20 18:47 - Estilos principais Appfood Degust UI estilo POS @filipemontt */
:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff6ff;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #ef4444;
  --success: #10b981;
  --radius: 16px;
  --sidebar-w: 260px;
  --order-w: 360px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

#app { display: flex; height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem;
  flex-shrink: 0;
  z-index: 30;
}
.sidebar-logo { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.sidebar-logo img, .avatar-img {
  width: 40px; height: 40px; border-radius: 12px; object-fit: cover; background: var(--brand-soft);
}
.sidebar-logo strong { font-size: 1.1rem; letter-spacing: -.02em; }
.sidebar-search {
  width: 100%; border: 1px solid var(--border); border-radius: 999px;
  padding: .55rem 1rem; font-size: .875rem; outline: none; margin-bottom: 1rem;
}
.sidebar-search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.nav-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .25rem; }
.nav-item, .nav-sub {
  display: flex; align-items: center; gap: .65rem;
  padding: .65rem .85rem; border-radius: 12px; border: 0; background: transparent;
  color: var(--muted); font-size: .9rem; cursor: pointer; width: 100%; text-align: left;
  transition: .15s ease;
}
.nav-ico {
  display: inline-flex; width: 16px; height: 16px; flex-shrink: 0;
  align-items: center; justify-content: center;
}
.nav-ico svg { display: block; }
.nav-item:hover, .nav-sub:hover { background: #f9fafb; color: var(--text); }
.nav-item.active, .nav-sub.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-group-title { font-weight: 500; color: var(--text); justify-content: space-between; }
.nav-subs { padding-left: .5rem; display: none; flex-direction: column; gap: .15rem; }
.nav-subs.open { display: flex; }

/* 2026-08-20 19:45 - Vendas como card cinza + Novo Pedido negrito @filipemontt */
/* 2026-08-20 20:42 - Vendas e Mesas em negrito @filipemontt */
.nav-group--sales { margin: .35rem 0; }
.nav-sales-card {
  background: #f3f4f6 !important;
  border: 1px solid #d1d5db !important;
  border-radius: 14px !important;
  color: #374151 !important;
  font-weight: 700 !important;
  padding: .75rem .9rem !important;
  box-shadow: none;
}
.nav-sales-card:hover {
  background: #e5e7eb !important;
  color: #111827 !important;
}
.nav-group--sales .nav-subs.open ~ .nav-sales-card,
.nav-group--sales:has(.nav-subs.open) .nav-sales-card {
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}
.nav-sales-card__left {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
}
.nav-sales-card__chev { color: #9ca3af; font-size: .75rem; }
.nav-group--sales .nav-subs {
  padding: .35rem 0 0 .35rem;
  margin-top: .15rem;
}
.nav-sub--strong,
.nav-item--strong {
  font-weight: 700 !important;
  color: #111827;
}
.sidebar-footer { border-top: 1px solid var(--border); padding-top: .75rem; margin-top: .5rem; }
/* 2026-08-20 21:06 - promo Appfood acima do divider Configuracoes @filipemontt */
.sidebar-promo {
  display: block;
  margin: .5rem .35rem 0;
  padding: .35rem;
  border-radius: 12px;
  line-height: 0;
  transition: opacity .15s ease;
}
.sidebar-promo:hover { opacity: .9; }
.sidebar-promo img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  object-fit: contain;
  background: transparent;
}
.profile-card {
  display: flex; align-items: center; gap: .75rem; padding: .65rem;
  background: #f9fafb; border-radius: 14px; cursor: pointer; margin-top: .5rem;
}
.profile-card:hover { background: var(--brand-soft); }
.profile-card .meta { min-width: 0; }
.profile-card .meta strong { display: block; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-card .meta span { font-size: .75rem; color: var(--muted); }

/* Main layout */
.main-wrap { flex: 1; display: flex; min-width: 0; }
.main-content {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  padding: 1.25rem 1.25rem 1rem; overflow: hidden;
}
.order-panel {
  width: var(--order-w); background: var(--card); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1.25rem; flex-shrink: 0;
}
.order-panel.hidden { display: none; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
/* 2026-08-20 20:53 - Voltar + busca no header do POS @filipemontt */
.pos-header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pos-header-actions .btn { width: auto; white-space: nowrap; }
.pos-header-actions .search-pill { min-width: 200px; }
.page-header h1 { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.page-header .date { color: var(--muted); font-size: .875rem; margin-top: .2rem; }
.search-pill {
  border: 1px solid var(--border); border-radius: 999px; padding: .6rem 1rem;
  min-width: 220px; outline: none; font-size: .875rem; background: #fff;
}
.search-pill:focus { border-color: var(--brand); }

.alert-banner {
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
  border-radius: 12px; padding: .75rem 1rem; font-size: .8rem; margin-bottom: 1rem; line-height: 1.4;
}
.alert-banner a { color: #991b1b; font-weight: 700; text-decoration: underline; }

.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: 1rem;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .9rem 1rem;
}
.stat-card .label { font-size: .75rem; color: var(--muted); }
.stat-card .value { font-size: 1.25rem; font-weight: 700; margin-top: .15rem; }

.category-tabs { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: 1rem; }
.cat-tab {
  min-width: 140px; background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: .85rem 1rem; text-align: left; cursor: pointer; flex-shrink: 0;
}
.cat-tab.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.cat-tab strong { display: block; font-size: .9rem; }
.cat-tab span { font-size: .75rem; color: var(--muted); }

.content-scroll { flex: 1; overflow-y: auto; padding-right: .25rem; }
.product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem;
}
.product-card, .add-product-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: .15s ease; text-align: left;
}
.product-card:hover, .add-product-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.06); }
.product-card.selected { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(37,99,235,.2); }
.product-card img {
  width: 100%; aspect-ratio: 1; object-fit: cover; background: #f3f4f6; display: block;
}
.product-card .body { padding: .75rem; }
.product-card .name { font-size: .875rem; font-weight: 600; margin: 0 0 .35rem; }
.product-card .price { font-size: .9rem; font-weight: 700; color: var(--text); }
.add-product-card {
  min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-style: dashed; color: var(--muted); gap: .5rem;
}
.add-product-card .plus {
  width: 48px; height: 48px; border-radius: 14px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 1.5rem; font-weight: 700;
}

.tabs-switch {
  display: inline-flex; background: #f3f4f6; border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 1rem;
}
.tabs-switch button {
  border: 0; background: transparent; padding: .5rem 1rem; border-radius: 10px;
  font-size: .85rem; cursor: pointer; color: var(--muted); font-weight: 500;
}
.tabs-switch button.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.panel-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 1rem; }
.field { margin-bottom: .85rem; }
.field label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .35rem; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 12px;
  padding: .7rem .85rem; font-size: .875rem; outline: none; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }

/* 2026-08-20 19:35 - checkbox alinhado ao label (nao herda width 100% do input) @filipemontt */
.field input[type="checkbox"],
.field input[type="radio"] {
  width: auto;
  min-width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
  vertical-align: middle;
}
.field-check {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: .85rem;
  padding: .75rem .85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  user-select: none;
}
.field-check:hover { border-color: #d1d5db; background: #fafafa; }
.field-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
}
.field-check span {
  font-size: .875rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.2;
}
.check-list label {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: .4rem 0;
  font-size: .875rem;
  color: var(--text);
  cursor: pointer;
}
.check-list input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
  flex-shrink: 0;
  cursor: pointer;
}
.order-item .addons-line {
  margin-top: .15rem;
  font-size: .72rem;
  color: #6b7280;
  line-height: 1.3;
}
.order-items { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .75rem; margin: .5rem 0 1rem; }
.order-item {
  display: grid; grid-template-columns: 48px 1fr auto; gap: .65rem; align-items: center;
}
.order-item img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: #f3f4f6; }
.order-item .name { font-size: .85rem; font-weight: 600; }
.order-item .meta { font-size: .75rem; color: var(--muted); }
.qty-ctrl { display: inline-flex; align-items: center; gap: .35rem; margin-top: .35rem; }
.qty-ctrl button {
  width: 24px; height: 24px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: .85rem;
}
.order-item .line-total { font-weight: 700; font-size: .85rem; text-align: right; }
.order-item .trash { border: 0; background: transparent; color: var(--danger); cursor: pointer; padding: .25rem; }
.summary-box { border-top: 1px solid var(--border); padding-top: .85rem; }
.summary-row { display: flex; justify-content: space-between; font-size: .875rem; margin-bottom: .4rem; color: var(--muted); }
.summary-row.total { color: var(--text); font-weight: 700; font-size: 1.05rem; margin-top: .35rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 0; border-radius: 12px; padding: .75rem 1rem; font-weight: 600; cursor: pointer; font-size: .9rem;
}
.btn-primary { background: var(--brand); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-danger { background: #fef2f2; color: var(--danger); }
.btn-sm { padding: .45rem .75rem; font-size: .8rem; border-radius: 10px; }

/* Tables / lists */
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .875rem; }
.data-table th { background: #f9fafb; color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; }
/* 2026-08-20 20:46 - row clicavel abre detalhe do pedido @filipemontt */
.data-table tr.row-click { cursor: pointer; transition: background .12s ease; }
.data-table tr.row-click:hover { background: #f8fafc; }
.data-table tr.row-click:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.detail-meta {
  display: grid; gap: .55rem; margin-bottom: 1rem; font-size: .875rem;
}
.detail-meta > div { display: flex; flex-direction: column; gap: .1rem; }
.detail-meta .muted, .detail-item .muted { color: var(--muted); font-size: .8rem; font-weight: 400; }
.detail-section-title { font-size: .95rem; font-weight: 700; margin: 0 0 .65rem; }
.detail-items { display: flex; flex-direction: column; gap: .55rem; margin-bottom: .85rem; }
.detail-item {
  display: flex; justify-content: space-between; gap: .75rem;
  padding: .65rem .75rem; background: #f9fafb; border-radius: 12px; font-size: .85rem;
}
.detail-item__total { font-weight: 700; white-space: nowrap; }
.detail-totals { border-top: 1px solid var(--border); padding-top: .75rem; }
/* 2026-08-20 21:08 - select de status simples (sem card colorido) @filipemontt */
.detail-status-field { margin-bottom: 1rem; }
.detail-status-select {
  width: 100%;
  font-size: 1.05rem;
  font-weight: 600;
  padding: .85rem 1rem;
  border-radius: 12px;
  min-height: 48px;
}
.badge {
  display: inline-flex; padding: .2rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em;
}
.badge-blue { background: var(--brand-soft); color: var(--brand); }
.badge-green { background: #ecfdf5; color: #059669; }
.badge-yellow { background: #fffbeb; color: #d97706; }
.badge-red { background: #fef2f2; color: #dc2626; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-indigo { background: #e0e7ff; color: #4338ca; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-teal { background: #ccfbf1; color: #0f766e; }

.data-table tr.row-status-preparing { background: #fffbeb; }
.data-table tr.row-status-ready { background: #eff6ff; }
.data-table tr.row-status-way { background: #eef2ff; }
.data-table tr.row-status-delivered { background: #ecfdf5; }
.data-table tr.row-status-cancelled { background: #fef2f2; }
.data-table tr.row-status-open { background: #fff7ed; }
.data-table tr.row-status-finished { background: #f0fdfa; }
.data-table tr.row-click.row-status-preparing:hover,
.data-table tr.row-click.row-status-ready:hover,
.data-table tr.row-click.row-status-way:hover,
.data-table tr.row-click.row-status-delivered:hover,
.data-table tr.row-click.row-status-cancelled:hover,
.data-table tr.row-click.row-status-open:hover,
.data-table tr.row-click.row-status-finished:hover { filter: brightness(.98); }
.data-table tr.row-click.row-status-cancelled:hover,
.data-table tr.row-click.row-status-open:hover,
.data-table tr.row-click.row-status-finished:hover { filter: brightness(.98); }
/* 2026-08-20 20:49 - data DD/MM + hora extra small @filipemontt */
.date-cell { display: inline-flex; flex-direction: column; line-height: 1.15; }
.date-cell__day { font-weight: 600; font-size: .875rem; color: var(--text); }
.date-cell__time { font-size: .65rem; color: var(--muted); font-weight: 500; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--muted); background: #fff;
  border: 1px dashed var(--border); border-radius: var(--radius);
}

/* Offcanvas */
.offcanvas-backdrop {
  position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 80;
  opacity: 0; pointer-events: none; transition: .2s ease;
}
.offcanvas-backdrop.open { opacity: 1; pointer-events: auto; }
.offcanvas {
  position: fixed; top: 0; right: 0; height: 100%; width: min(440px, 100%);
  background: #fff; z-index: 90; transform: translateX(100%); transition: .25s ease;
  display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(0,0,0,.12);
}
.offcanvas.open { transform: translateX(0); }
.offcanvas-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--border);
}
.offcanvas-header h2 { margin: 0; font-size: 1.1rem; }
.offcanvas-body { flex: 1; overflow-y: auto; padding: 1.25rem; }
.offcanvas-footer {
  padding: 1rem 1.25rem; border-top: 1px solid var(--border);
  display: flex; gap: .5rem; justify-content: flex-end;
}
.close-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 1.1rem;
}

/* Toast */
.toast-wrap {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 100;
  display: flex; flex-direction: column; gap: .5rem;
}
.toast {
  background: #111827; color: #fff; padding: .75rem 1rem; border-radius: 12px;
  font-size: .85rem; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: slideIn .2s ease;
}
.toast.error { background: #b91c1c; }
.toast.success { background: #047857; }
@keyframes slideIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Crop area */
.crop-wrap { max-width: 100%; }
.crop-wrap img { max-width: 100%; display: block; }
.crop-preview {
  width: 200px; height: 200px; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--border); margin: .75rem auto 0;
}

/* 2026-08-20 19:17 - painel de crop sobre o offcanvas (nao substitui o form) @filipemontt */
.crop-panel {
  position: fixed; inset: 0; z-index: 120; pointer-events: none;
}
.crop-panel.open { pointer-events: auto; }
.crop-panel-backdrop {
  position: absolute; inset: 0; background: rgba(17,24,39,.55);
}
.crop-panel-sheet {
  position: absolute; top: 0; right: 0; height: 100%; width: min(520px, 100%);
  background: #fff; display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,.18); transform: translateX(100%);
  transition: transform .25s ease;
}
.crop-panel.open .crop-panel-sheet { transform: translateX(0); }
.crop-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--border);
}
.crop-panel-header h2 { margin: 0; font-size: 1.1rem; }
.crop-panel-body { flex: 1; overflow-y: auto; padding: 1.25rem; }
.crop-panel-footer {
  padding: 1rem 1.25rem; border-top: 1px solid var(--border);
  display: flex; gap: .5rem; justify-content: flex-end;
}
.mesa-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .85rem;
}
.mesa-card {
  position: relative;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; padding-top: 1.15rem; cursor: pointer; min-height: 120px;
}
.mesa-card.ocupada { border-color: #f59e0b; background: #fffbeb; }
.mesa-card.livre { border-color: #10b981; }
.mesa-card h3 { margin: 0 0 .35rem; font-size: 1rem; padding-right: 2rem; }
.mesa-card p { margin: 0; font-size: .8rem; color: var(--muted); }
.comanda-mesa { font-weight: 600; color: var(--text); }
.comanda-guest { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
/* 2026-08-20 20:54 - editar mesa: icone redondo cinza no canto @filipemontt */
.mesa-card__edit {
  position: absolute;
  top: .55rem;
  right: .55rem;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1.5px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  transition: .15s ease;
  z-index: 2;
}
.mesa-card__edit:hover {
  border-color: #9ca3af;
  color: #374151;
  background: #f9fafb;
}
.mesa-card__open { width: 100%; }

.receipt {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  width: 280px; margin: 0 auto; padding: 1rem; background: #fff;
}
.receipt .center { text-align: center; }
.receipt .row { display: flex; justify-content: space-between; }
.receipt hr { border: 0; border-top: 1px dashed #999; margin: .5rem 0; }

.mobile-toggle {
  display: none; position: fixed; bottom: 1rem; left: 1rem; z-index: 50;
  width: 48px; height: 48px; border-radius: 14px; border: 0; background: var(--brand); color: #fff;
  box-shadow: 0 8px 24px rgba(37,99,235,.35); cursor: pointer;
}

@media (max-width: 1100px) {
  .order-panel { width: 320px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: .25s ease; box-shadow: 8px 0 32px rgba(0,0,0,.12);
  }
  .sidebar.open { transform: translateX(0); }
  .order-panel { display: none; }
  .order-panel.mobile-open {
    display: flex; position: fixed; right: 0; top: 0; bottom: 0; z-index: 40; width: min(360px, 100%);
  }
  .mobile-toggle { display: grid; place-items: center; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
