/* ============================================================
   ATLAS PDV - Estilos Globais
   CSS3 puro, sem frameworks. Layout com Grid e Flexbox.
   As cores vêm de CSS variables injetadas via PHP (theme_css_vars)
   com fallbacks para o tema claro padrão.
   ============================================================ */

/* ---------- Reset básico ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { max-width: 100%; }

/* O atributo `hidden` deve sempre ocultar o elemento, mesmo quando
   outra regra define `display: flex` (ex.: .modal-backdrop). Sem isso,
   os modais do PDV (#pay-modal e #done-modal) aparecem já abertos ao
   carregar ?route=sales e bloqueiam toda a tela. */
[hidden] { display: none !important; }

/* ---------- Tipografia e base ---------- */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text, #1f2937);
  background: var(--color-background, #f4f6f8);
  min-height: 100vh;
}

h1 { font-size: 1.6rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
a { color: var(--color-primary, #0d6efd); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: rgba(125,125,125,.14); padding: 1px 5px; border-radius: 4px; font-size: .85em; }
kbd {
  background: #e8eaed; border: 1px solid #c6c9ce; border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 6px; font-size: .78em; font-family: monospace;
}

/* ============================================================
   LAYOUT DA APLICAÇÃO (sidebar + conteúdo)
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--color-secondary, #1e293b);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width .2s ease, transform .25s ease;
  z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo { width: 34px; height: 34px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px; }
.sidebar-logo-fallback {
  width: 34px; height: 34px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-primary, #0d6efd); color: #fff;
  font-weight: 700; font-size: 1.15rem; border-radius: 8px;
}
.sidebar-brand-name { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { flex: 1; padding: 10px 8px; }
.nav-section { margin-bottom: 14px; }
.nav-section-label {
  display: block; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .08em; color: rgba(226,232,240,.5);
  padding: 4px 10px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px;
  color: #cbd5e1; font-size: .9rem;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--color-primary, #0d6efd); color: #fff; }
.nav-icon { display: inline-flex; width: 20px; height: 20px; flex-shrink: 0; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: .7rem; color: rgba(226,232,240,.45);
}

/* Sidebar colapsada */
.app-shell.sidebar-collapsed .sidebar { width: 64px; }
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .nav-section-label,
.app-shell.sidebar-collapsed .sidebar-brand-name,
.app-shell.sidebar-collapsed .sidebar-footer { display: none; }
.app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; }
.app-shell.sidebar-collapsed .nav-link { justify-content: center; padding: 10px; }

/* ---------- Área principal ---------- */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* essencial para tables responsivas */
}
.app-header {
  display: flex; align-items: center; gap: 14px;
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.08);
  padding: 10px 20px;
  position: sticky; top: 0; z-index: 30;
}
.app-header-brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.header-logo { height: 28px; width: auto; object-fit: contain; }
.app-header-company { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header-user { display: flex; align-items: center; gap: 12px; }
.user-info { text-align: right; line-height: 1.2; }
.user-info strong { display: block; font-size: .88rem; }
.user-info small { color: #6b7280; font-size: .72rem; }

.app-content { flex: 1; padding: 22px; max-width: 1400px; width: 100%; margin: 0 auto; }
.app-footer {
  padding: 12px 22px; text-align: center;
  font-size: .74rem; color: #94a3b8;
}

/* ============================================================
   COMPONENTES
   ============================================================ */

/* ---------- Cabeçalho de página ---------- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 7px;
  padding: 8px 16px; font-size: .88rem; font-weight: 600;
  cursor: pointer; text-decoration: none !important;
  transition: filter .15s, background .15s;
  font-family: inherit; line-height: 1.3;
}
.btn:hover { filter: brightness(.93); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--color-primary, #0d6efd); color: #fff; }
.btn-outline {
  background: transparent; color: var(--color-text, #1f2937);
  border-color: rgba(125,125,125,.4);
}
.btn-danger { color: var(--color-error, #dc3545); border-color: currentColor; }
.btn-warning { color: #92400e; }
.btn-ghost { background: transparent; color: inherit; border-color: transparent; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.btn-sm { padding: 4px 10px; font-size: .78rem; border-radius: 5px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 7px;
  background: transparent; border: none; cursor: pointer;
  color: inherit;
}
.icon-btn:hover { background: rgba(125,125,125,.12); }

/* ---------- Cards ---------- */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  border: 1px solid rgba(0,0,0,.04);
}
.card-title {
  font-size: 1.02rem; margin: 0 0 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-title-link { font-size: .78rem; font-weight: 500; }

/* ---------- Widgets do dashboard ---------- */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.widget {
  background: #fff; border-radius: 10px; padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  display: flex; flex-direction: column; gap: 2px;
  border-left: 4px solid var(--color-primary, #0d6efd);
}
.widget-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; }
.widget-value { font-size: 1.55rem; font-weight: 700; }
.widget-value-sm { font-size: 1.05rem; }
.widget-sub { font-size: .74rem; color: #94a3b8; }

/* ---------- Grades ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.table th {
  text-align: left; padding: 8px 10px;
  border-bottom: 2px solid rgba(0,0,0,.08);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: #6b7280; white-space: nowrap;
}
.table td { padding: 9px 10px; border-bottom: 1px solid rgba(0,0,0,.06); vertical-align: middle; }
.table tbody tr:hover { background: rgba(125,125,125,.05); }
.row-danger { background: rgba(220, 53, 69, .07); }
.row-muted { opacity: .55; }
.row-total td { border-top: 2px solid rgba(0,0,0,.1); font-weight: 700; }
.ta-r { text-align: right; }
.ta-c { text-align: center; }
.actions-cell { white-space: nowrap; }
.inline-form { display: inline; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  background: rgba(125,125,125,.15); color: inherit;
}
.badge-completed { background: rgba(25, 135, 84, .14); color: var(--color-success, #198754); }
.badge-returned   { background: rgba(220, 53, 69, .12); color: var(--color-error, #dc3545); }
.badge-suspended  { background: rgba(243, 156, 18, .16); color: #b45309; }
.badge-service    { background: rgba(13, 110, 253, .12); color: var(--color-primary, #0d6efd); }

/* ---------- Alertas ---------- */
.alert {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 16px;
  font-size: .9rem; border: 1px solid transparent;
}
.alert-success { background: rgba(25,135,84,.1); color: #14532d; border-color: rgba(25,135,84,.3); }
.alert-error   { background: rgba(220,53,69,.09); color: #7f1d1d; border-color: rgba(220,53,69,.3); }
.alert-warning { background: rgba(243,156,18,.12); color: #78350f; border-color: rgba(243,156,18,.4); }
.alert-info    { background: rgba(13,110,253,.09); color: #1e3a8a; border-color: rgba(13,110,253,.25); }

/* ---------- Formulários ---------- */
.form-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; align-items: flex-start; }
.form-row:last-child { margin-bottom: 0; }
.form-col { flex: 1; min-width: 150px; }
.form-col-2 { flex: 2; }
.form-col-btn { display: flex; align-items: flex-end; gap: 8px; }
.field-label {
  display: block; font-size: .78rem; font-weight: 600;
  margin-bottom: 4px; color: #374151;
}
.field-input {
  width: 100%; padding: 8px 11px;
  border: 1px solid rgba(125,125,125,.4); border-radius: 7px;
  font-size: .9rem; font-family: inherit;
  background: #fff; color: var(--color-text, #1f2937);
}
.field-input:focus {
  outline: 2px solid var(--color-primary, #0d6efd);
  outline-offset: -1px; border-color: transparent;
}
.field-input:disabled { background: rgba(125,125,125,.1); color: #9ca3af; }
.field-input-sm { width: 110px; padding: 4px 8px; font-size: .8rem; }
textarea.field-input { resize: vertical; }
select.field-input { cursor: pointer; }

.checkbox-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .86rem; cursor: pointer; padding: 4px 0;
}
.checkbox-label-top { padding-top: 24px; }
.perm-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 16px;
}

.fieldset {
  border: 1px solid rgba(125,125,125,.3); border-radius: 8px;
  padding: 14px 16px; margin: 4px 0 16px;
}
.fieldset legend { font-size: .82rem; font-weight: 700; padding: 0 8px; }

.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.filter-bar {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  background: #fff; border-radius: 10px; padding: 14px 18px;
  margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.filter-bar .field-input { width: auto; min-width: 150px; }
.filter-bar-wrap { padding-bottom: 10px; }

.color-input {
  width: 100%; height: 42px; padding: 3px;
  border: 1px solid rgba(125,125,125,.4); border-radius: 7px;
  background: #fff; cursor: pointer;
}

.img-preview {
  display: block; height: 64px; width: auto; max-width: 160px;
  object-fit: contain; border: 1px solid rgba(0,0,0,.1);
  border-radius: 6px; padding: 4px; background: #fff; margin-bottom: 6px;
}
.img-preview-sm { height: 32px; }
.upload-preview { margin-bottom: 8px; }

/* ---------- Listas de detalhes ---------- */
.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.detail-list dt { font-weight: 600; font-size: .82rem; color: #6b7280; }
.detail-list dd { margin: 0; font-size: .9rem; }

/* ---------- Abas ---------- */
.tab-nav {
  display: flex; gap: 4px; margin-bottom: 16px;
  border-bottom: 2px solid rgba(125,125,125,.2);
}
.tab-link {
  padding: 9px 18px; font-size: .9rem; font-weight: 600;
  color: #6b7280; border-radius: 7px 7px 0 0;
  margin-bottom: -2px; border-bottom: 2px solid transparent;
}
.tab-link:hover { text-decoration: none; color: var(--color-text); }
.tab-link.active {
  color: var(--color-primary, #0d6efd);
  border-bottom-color: var(--color-primary, #0d6efd);
}

/* ---------- Estados vazios e dicas ---------- */
.empty-state {
  text-align: center; color: #94a3b8; padding: 26px 10px;
  font-size: .9rem;
}
.hint { font-size: .76rem; color: #6b7280; margin: 6px 0 0; }
.text-success { color: var(--color-success, #198754); }
.text-error { color: var(--color-error, #dc3545); }
.text-warning { color: #b45309; }
.text-muted { color: #94a3b8; }

/* ============================================================
   TELA DE LOGIN
   ============================================================ */
body.login-page {
  background: var(--color-secondary, #1e293b);
  background-image: linear-gradient(135deg, var(--color-secondary, #1e293b), var(--color-primary, #0d6efd));
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
  position: relative;
}
.login-wrapper {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-card {
  background: #fff; border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 18px 50px rgba(0,0,0,.3);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-logo { max-height: 72px; max-width: 220px; object-fit: contain; }
.login-logo-fallback {
  width: 64px; height: 64px; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-primary, #0d6efd); color: #fff;
  font-size: 1.9rem; font-weight: 800; border-radius: 16px;
}
.login-company { font-size: 1.3rem; margin: 8px 0 0; color: #1f2937; }
.login-form { display: flex; flex-direction: column; gap: 4px; }
.login-form .field-label { margin-top: 10px; }
.login-form .field-input { padding: 11px 13px; font-size: .95rem; }
.login-form .btn { margin-top: 18px; }
.login-recover {
  display: block; text-align: center; margin-top: 18px;
  font-size: .84rem;
}
.login-footer {
  text-align: center; color: rgba(255,255,255,.65); font-size: .74rem;
}

/* ---------- Página de erro ---------- */
body.error-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--color-background, #f4f6f8);
}
.error-card {
  background: #fff; border-radius: 14px; padding: 44px;
  text-align: center; max-width: 420px;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
}
.error-code {
  font-size: 3.6rem; font-weight: 800; line-height: 1;
  color: var(--color-primary, #0d6efd); opacity: .25;
}

/* ============================================================
   PDV (FRENTE DE CAIXA)
   ============================================================ */
.pos-shell {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 1000px) { .pos-shell { grid-template-columns: 1fr; } }

.pos-left {
  display: flex; flex-direction: column;
  background: #fff; border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  overflow: hidden;
}
.pos-search-bar {
  display: flex; gap: 8px; padding: 12px;
  border-bottom: 1px solid rgba(0,0,0,.07);
  position: relative;
}
.pos-search-input {
  flex: 1; padding: 12px 14px;
  border: 2px solid var(--color-primary, #0d6efd);
  border-radius: 8px; font-size: 1rem;
}
.pos-search-input:focus { outline: none; }
.pos-search-results {
  /* Ancorado na .pos-search-bar (position:relative): ocupa só a largura da
     coluna do PDV, dentro das margens — sem vazar para baixo da sidebar. */
  position: absolute; top: calc(100% + 4px); left: 12px; right: 12px;
  max-width: calc(100% - 24px);
  background: #fff; border: 1px solid rgba(0,0,0,.12);
  border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.15);
  max-height: 340px; overflow-y: auto; z-index: 20;
  /* Cores fixas (sem var()): o dropdown é sempre fundo claro, então o
     texto deve ser sempre escuro — independente do tema/white-label ou
     de preferência de modo escuro do SO. Branco-sobre-branco aqui
     deixava o nome do produto invisível (só o preço aparecia). */
  color: #1f2937;
}
.search-item {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid rgba(0,0,0,.05);
  font-size: .9rem;
  color: #1f2937;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover, .search-item.selected { background: rgba(13,110,253,.07); }
.search-item .search-main {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  overflow-wrap: break-word;
  color: #1f2937;
}
.search-item .search-main strong {
  display: block;
  font-weight: 700;
  font-size: .9rem;
  color: #111827;
  white-space: normal;
  overflow: visible;
}
.search-item .search-sub { color: #4b5563; font-size: .76rem; display: block; margin-top: 2px; }
.search-item .search-price {
  flex-shrink: 0;
  margin-left: auto;
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
  color: #111827;
}
.search-item mark { background: #fef08a; color: inherit; border-radius: 3px; padding: 0 1px; }

.pos-cart { flex: 1; overflow-y: auto; max-height: 46vh; min-height: 180px; }
.pos-cart-table td { padding: 7px 8px; }
.cart-empty td { padding: 40px 10px; }
.qty-input {
  width: 74px; text-align: center; padding: 5px 6px;
  border: 1px solid rgba(125,125,125,.4); border-radius: 6px;
  font-size: .88rem;
}
.cart-remove {
  background: none; border: none; cursor: pointer;
  color: var(--color-error, #dc3545); padding: 4px;
  display: inline-flex;
}

.pos-totals { padding: 12px 16px; background: rgba(125,125,125,.05); }
.pos-total-row {
  display: flex; justify-content: space-between;
  padding: 4px 0; font-size: .92rem;
}
.pos-total-grand {
  font-size: 1.25rem; font-weight: 800;
  border-top: 2px solid rgba(0,0,0,.1); margin-top: 6px; padding-top: 10px;
  color: var(--color-primary, #0d6efd);
}
.pos-actions {
  display: flex; gap: 8px; padding: 12px; flex-wrap: wrap;
}
.pos-actions .btn-lg { flex: 1; }

.pos-right { display: flex; flex-direction: column; gap: 16px; }
.customer-points { margin-top: 8px; font-size: .82rem; color: #6b7280; }

.table-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.table-chip {
  display: inline-block; padding: 6px 14px; border-radius: 20px;
  background: rgba(25,135,84,.12); color: #14532d;
  font-size: .82rem; font-weight: 700; text-decoration: none !important;
  border: 1px solid transparent; cursor: pointer; font-family: inherit;
}
a.table-chip:hover { text-decoration: none !important; filter: brightness(.95); }
.table-chip.table-occupied { background: rgba(220,53,69,.12); color: #7f1d1d; }
.table-chip.table-closing { background: rgba(243,156,18,.2); color: #78350f; }
.table-chip.table-active { outline: 3px solid var(--color-primary, #0d6efd); outline-offset: 1px; }
.table-chip .table-chip-num { display: block; font-weight: 700; }
.table-chip .table-chip-sub { display: block; font-size: .68rem; font-weight: 500; opacity: .85; }

/* ---------- Mesa em atendimento (contexto no PDV) ---------- */
.table-context { border-left: 4px solid var(--color-warning, #f39c12); }
.tc-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .78rem; color: #6b7280; margin-bottom: 10px; }
.tc-people-row { display: flex; gap: 6px; align-items: center; }
.tc-people-input { text-align: center; max-width: 90px; }
.tc-totals { background: rgba(125,125,125,.06); border-radius: 8px; padding: 8px 12px; margin-top: 10px; }
.tc-save-state { min-height: 18px; margin-top: 4px; }
.tc-actions { margin-top: 6px; }
.note-input {
  width: 100%; margin-top: 4px; padding: 4px 8px; font-size: .76rem;
  border: 1px dashed rgba(125,125,125,.45); border-radius: 6px; color: inherit; background: transparent;
}
.note-input::placeholder { color: #9ca3af; }

.suspended-list { list-style: none; margin: 0; padding: 0; }
.suspended-list li {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.suspended-list li a {
  flex: 1; padding: 8px 4px; font-size: .84rem; color: inherit;
}
.suspended-list li a:hover { text-decoration: none; color: var(--color-primary); }
.suspended-list small { display: block; color: #94a3b8; font-size: .7rem; }

.shortcut-list { list-style: none; margin: 0; padding: 0; font-size: .82rem; }
.shortcut-list li { padding: 5px 0; color: #6b7280; }

/* ---------- Modais ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10,15,25,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal {
  background: #fff; border-radius: 12px;
  padding: 24px 26px; width: 100%; max-width: 520px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-sm { max-width: 380px; }
.modal h2 { margin-bottom: 14px; }
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px;
}
.modal-actions .btn-outline:first-child { margin-right: auto; }

.pay-summary { background: rgba(125,125,125,.07); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.pay-method {
  display: grid; grid-template-columns: 1fr 130px 44px; gap: 10px;
  align-items: center; margin-bottom: 10px;
}
.pay-method .field-input { padding: 8px 10px; }
.pay-totals { border-top: 2px solid rgba(0,0,0,.1); padding-top: 10px; margin-top: 6px; }
.done-summary { font-size: 1rem; }

/* ---------- Toasts ---------- */
#toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 10px; z-index: 200;
  max-width: 360px;
}
.toast {
  background: #1f2937; color: #fff;
  padding: 13px 18px; border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  font-size: .88rem;
  animation: toast-in .25s ease;
  display: flex; align-items: center; gap: 10px;
}
.toast-success { background: var(--color-success, #198754); }
.toast-error   { background: var(--color-error, #dc3545); }
.toast-warning { background: #d97706; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Temas (cards de seleção) ---------- */
.theme-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.theme-card {
  border: 2px solid rgba(125,125,125,.25); border-radius: 10px;
  background: #fff; padding: 10px 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  font-family: inherit; font-size: .86rem;
  transition: border-color .15s, transform .1s;
}
.theme-card:hover { border-color: var(--color-primary, #0d6efd); }
.theme-card.theme-active {
  border-color: var(--color-primary, #0d6efd);
  box-shadow: 0 0 0 3px rgba(13,110,253,.18);
}
.theme-name { font-weight: 700; }
.theme-swatches { display: flex; gap: 4px; }
.theme-swatches span {
  flex: 1; height: 18px; border-radius: 4px;
  border: 1px solid rgba(0,0,0,.1);
}

/* ---------- Pré-visualização ao vivo ---------- */
.live-preview {
  display: flex; border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(0,0,0,.12); margin-top: 6px;
  min-height: 170px;
}
.lp-sidebar {
  width: 130px; padding: 12px 10px; font-size: .78rem;
  display: flex; flex-direction: column; gap: 6px;
}
.lp-link { padding: 4px 8px; border-radius: 5px; }
.lp-link.ativo { background: var(--color-primary); color: #fff; }
.lp-main { flex: 1; display: flex; flex-direction: column; }
.lp-header {
  padding: 10px 14px; font-weight: 700; font-size: .85rem;
  background: #fff; border-bottom: 1px solid rgba(0,0,0,.08);
}
.lp-content {
  flex: 1; padding: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}

/* ---------- Mesas ---------- */
.table-grid-lg {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.table-card {
  background: #fff; border: 2px solid rgba(25,135,84,.4);
  border-radius: 10px; padding: 14px;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  text-align: center;
}
.table-card-occupied { border-color: var(--color-error, #dc3545); background: rgba(220,53,69,.05); }
.table-card-number { font-weight: 800; font-size: 1.05rem; }
.table-card-status { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; }
.mt-4 { margin-top: 4px; }

/* ---------- Sugestões de recompra ---------- */
.suggestion-list { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestion-chip small { opacity: .7; }
.suggestion-chip.added { background: rgba(25,135,84,.15); border-color: var(--color-success); }

/* ---------- Pontos ---------- */
.points-form { display: flex; gap: 6px; margin-top: 8px; }
.timeclock-card { text-align: center; padding: 30px; }

/* ---------- Canvas ---------- */
canvas { width: 100%; height: auto; display: block; }

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */
@media (max-width: 780px) {
  /* Sidebar vira drawer */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    width: 240px !important;
  }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .app-shell.sidebar-open::after {
    content: ''; position: fixed; inset: 0;
    background: rgba(0,0,0,.4); z-index: 35;
  }
  /* labels sempre visíveis no modo drawer */
  .app-shell.sidebar-collapsed .nav-label,
  .app-shell.sidebar-collapsed .nav-section-label { display: block; }

  .app-content { padding: 14px; }
  .app-header { padding: 8px 12px; }
  .user-info small { display: none; }

  .form-col { min-width: 100%; }
  .filter-bar .field-input { min-width: 120px; flex: 1; }
  .page-header h1 { font-size: 1.25rem; }

  .pos-cart { max-height: 38vh; }
  .pos-actions { flex-direction: column; }
  .pos-actions .btn-lg { width: 100%; }

  .pay-method { grid-template-columns: 1fr 100px 40px; }
  .detail-list { grid-template-columns: 1fr; gap: 2px; }
  .detail-list dd { margin-bottom: 8px; }
}

/* ---------- Acessibilidade: foco visível ---------- */
.btn:focus-visible, .nav-link:focus-visible, .tab-link:focus-visible,
.field-input:focus-visible, a:focus-visible {
  outline: 3px solid var(--color-primary, #0d6efd);
  outline-offset: 2px;
}

/* ---------- Utilidades para modo escuro ---------- */
/* Como os cards são fixos em #fff, no tema escuro adaptamos */
body.dark-bg .card, body.dark-bg .filter-bar, body.dark-bg .app-header,
body.dark-bg .widget, body.dark-bg .modal, body.dark-bg .theme-card,
body.dark-bg .table-card, body.dark-bg .login-card {
  background: #232c3d; color: #e5e7eb; border-color: rgba(255,255,255,.1);
}
body.dark-bg .table th { color: #9ca3af; border-bottom-color: rgba(255,255,255,.15); }
body.dark-bg .table td { border-bottom-color: rgba(255,255,255,.08); }
body.dark-bg .field-label { color: #cbd5e1; }
body.dark-bg .field-input { background: #1a2233; border-color: rgba(255,255,255,.2); color: #e5e7eb; }
body.dark-bg .alert-success { color: #86efac; }
body.dark-bg .alert-error { color: #fca5a5; }
body.dark-bg .hint, body.dark-bg .widget-sub, body.dark-bg .empty-state { color: #9ca3af; }
