:root {
  --bg-primary: #f1f3f5;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8f9fa;
  --bg-hover: #e9ecef;
  
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  
  --accent-blue: #2563eb;
  --accent-blue-hover: #1d4ed8;
  --accent-emerald: #059669;
  --accent-emerald-hover: #047857;
  --accent-amber: #d97706;
  --accent-rose: #dc2626;
  --accent-purple: #7c3aed;
  --accent-cyan: #0891b2;

  --border-color: #e2e8f0;
  --border-color-strong: #cbd5e1;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --theme-transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

[data-theme="dark"] {
  --bg-primary: #0b0f19;
  --bg-surface: #131b2e;
  --bg-surface-elevated: #1e293b;
  --bg-hover: #26354d;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --accent-blue: #3b82f6;
  --accent-blue-hover: #60a5fa;
  --accent-emerald: #10b981;
  --accent-emerald-hover: #34d399;
  --accent-amber: #f59e0b;
  --accent-rose: #ef4444;
  --accent-purple: #a855f7;
  --accent-cyan: #06b6d4;

  --border-color: #243048;
  --border-color-strong: #334155;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Custom Smooth Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color-strong);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  transition: var(--theme-transition);
}

/* App Main Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Left Sidebar Menu (AZUL MARINHO / ROYAL BLUE) */
.sidebar {
  width: 275px;
  min-width: 275px;
  background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 60%, #1d4ed8 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(30, 58, 138, 0.15);
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: #ffffff;
  color: #1e3a8a;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.brand-title {
  font-weight: 700;
  font-size: 1.15rem;
  color: #ffffff;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: #93c5fd;
  font-weight: 400;
  margin-top: 2px;
}

.sidebar-section-title {
  padding: 1.5rem 1.25rem 0.5rem 1.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #93c5fd;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 0.5rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.nav-item {
  background: transparent;
  border: none;
  color: #dbeafe;
  font-size: 0.925rem;
  font-weight: 600;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: all var(--transition-fast);
  text-align: left;
  width: 100%;
}

.nav-item i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  color: #93c5fd;
  transition: color var(--transition-fast);
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.nav-item:hover i {
  color: #ffffff;
}

.nav-item.active {
  background: #ffffff;
  color: #1e3a8a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.nav-item.active i {
  color: #1e3a8a;
}

.nav-item.nav-highlight {
  background: rgba(5, 150, 105, 0.25);
  color: #ffffff;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.nav-item.nav-highlight.active {
  background: #059669;
  color: #ffffff;
}

.nav-item.nav-highlight.active i {
  color: #ffffff;
}

.sidebar-footer {
  padding: 1.1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
  color: #93c5fd;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}


/* Right Content Area (Fundo Cinza Claro) */
.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-primary);
}

/* Topbar Header */
.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar-title i {
  color: var(--accent-blue);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}


/* Main Container */
.main-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Module Views */
.module-view {
  display: none;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeIn 0.25s ease-out;
}

.module-view.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Stats KPI Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card.clickable {
  cursor: pointer;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-info h3 {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.stat-icon-total     { background: rgba(37, 99, 235, 0.1); color: var(--accent-blue); }
.stat-icon-active    { background: rgba(5, 150, 105, 0.1); color: var(--accent-emerald); }
.stat-icon-clients   { background: rgba(124, 58, 237, 0.1); color: var(--accent-purple); }
.stat-icon-suppliers { background: rgba(217, 119, 6, 0.1); color: var(--accent-amber); }
.stat-icon-warning   { background: rgba(220, 38, 38, 0.1); color: var(--accent-rose); }
.stat-icon-money     { background: rgba(8, 145, 178, 0.1); color: var(--accent-cyan); }


/* Dashboard Layout Grid */
.dashboard-panels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.dashboard-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.panel-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-header h3 i {
  color: var(--accent-blue);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-text:hover {
  text-decoration: underline;
}

/* Quick Actions Tiles Grid */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.action-tile {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.action-tile i {
  font-size: 1.75rem;
  transition: transform var(--transition-fast);
}

.action-tile span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.action-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.action-tile:hover i {
  transform: scale(1.1);
}

.action-emerald i { color: var(--accent-emerald); }
.action-blue i    { color: var(--accent-blue); }
.action-purple i  { color: var(--accent-purple); }
.action-cyan i    { color: var(--accent-cyan); }
.action-amber i   { color: var(--accent-amber); }


/* Top Groups List Widget */
.top-groups-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.top-group-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.top-group-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.group-progress-bar-bg {
  height: 8px;
  background: var(--bg-surface-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.group-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  border-radius: 4px;
  transition: width 0.5s ease;
}


/* Mini Data Tables */
.mini-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.825rem;
}

.mini-data-table th {
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-size: 0.725rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.mini-data-table td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}


/* ==================== POS / PDV MODULE STYLES ==================== */
.pos-header-card {
  padding: 0.85rem 1.25rem;
}

.pos-config-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.pos-config-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pos-config-item label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.pos-config-item label i {
  color: var(--accent-blue);
}

.pos-clock-badge {
  background: #1e3a8a;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.2);
}

.pos-main-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.5rem;
  align-items: start;
}

.pos-cart-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}

.pos-entry-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.pos-entry-grid {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.barcode-focus {
  font-size: 1.05rem !important;
  font-weight: 600;
  border-color: var(--accent-blue) !important;
}

.pos-results-overlay {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--accent-blue);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 120;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 4px;
}

.pos-result-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.pos-result-item:hover, .pos-result-item.selected {
  background: #dbeafe;
}

.pos-result-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.pos-result-meta {
  font-size: 0.775rem;
  color: var(--text-muted);
}

.pos-table-card {
  min-height: 200px;
  max-height: 320px;
  display: flex;
  flex-direction: column;
}

.pos-table-card .table-responsive {
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.pos-cart-table th {
  background: #1e3a8a;
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 5;
}

.pos-cart-table td {
  padding: 0.85rem 1.25rem;
  font-size: 0.9rem;
}

.pos-summary-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 90px;
}

.pos-totals-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color-strong);
  gap: 1.5rem;
}

.pos-totals-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pos-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.pos-discount-input {
  width: 120px !important;
  text-align: right;
  font-weight: 700;
}

.pos-grand-total {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

.pos-grand-total .lbl {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.pos-grand-total .val {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
}

.pos-hotkeys-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pos-btn-xl {
  padding: 1.1rem !important;
  font-size: 1rem !important;
  justify-content: center !important;
  text-align: center;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3) !important;
}

.pos-btn-xl small {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.9;
}

.pos-btn-sm {
  justify-content: center !important;
}

/* ==========================================================================
   PDV PHOTO SALES PANEL (PAINEL DE VENDA POR FOTO)
   ========================================================================== */

.pdv-view-toggles {
  display: flex;
  gap: 0.35rem;
  background: var(--bg-surface-elevated);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.pdv-view-toggles .btn-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.pdv-view-toggles .btn-toggle.active {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.pdv-photo-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all var(--transition-normal);
}

.pdv-category-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scrollbar-width: thin;
}

.pdv-category-chip {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
  user-select: none;
}

.pdv-category-chip:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.05);
}

.pdv-category-chip.active {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.pdv-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 0.6rem;
  max-height: 420px;
  overflow-y: auto;
  padding: 0.25rem;
  scrollbar-width: thin;
}

.pdv-product-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.pdv-product-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-blue);
  box-shadow: 0 6px 14px -3px rgba(59, 130, 246, 0.25);
}

.pdv-product-card:active {
  transform: scale(0.96);
}

.pdv-product-img-wrapper {
  width: 100%;
  height: 80px;
  background: var(--bg-surface);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

.pdv-product-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.pdv-product-card:hover .pdv-product-img-wrapper img {
  transform: scale(1.06);
}

.pdv-product-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  color: var(--text-muted);
  opacity: 0.6;
}

.pdv-product-placeholder i {
  font-size: 1.5rem !important;
}

.pdv-product-price-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  z-index: 2;
  font-family: monospace;
}

.pdv-product-info {
  padding: 0.45rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  justify-content: space-between;
}

.pdv-product-name {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 1.85rem;
}

.pdv-product-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.pdv-product-stock-tag {
  font-weight: 600;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
}



/* Payment Modal Grid */
.payment-total-banner {
  background: #1e3a8a;
  color: #ffffff;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.1rem;
}

.payment-total-banner strong {
  font-size: 1.8rem;
  color: #34d399;
}

.payment-methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.pay-method-card {
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.95rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  user-select: none;
}

.pay-method-card i {
  font-size: 1.6rem;
  transition: transform var(--transition-fast);
}

.pay-method-card span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.pay-method-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-blue);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.pay-method-card:hover i {
  transform: scale(1.1);
}

.pay-method-card.active {
  border-color: var(--accent-emerald) !important;
  background: rgba(16, 185, 129, 0.12) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25) !important;
}

.pay-method-card.active span {
  color: var(--accent-emerald) !important;
  font-weight: 700 !important;
}


/* Thermal Printable Receipt (DANFE NFC-e) */
.thermal-receipt {
  background: #ffffff;
  color: #000000;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.35;
  padding: 15px;
  width: 100%;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  border-radius: 4px;
}

.receipt-header {
  text-align: center;
}

.receipt-header h2 {
  font-size: 14px;
  font-weight: bold;
  text-transform: uppercase;
}

.receipt-header p {
  font-size: 11px;
  margin: 1px 0;
}

.receipt-title {
  font-size: 13px;
  font-weight: bold;
  margin-top: 4px;
}

.receipt-subtitle {
  font-size: 10px;
}

.receipt-divider {
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  font-size: 10px;
  margin: 6px 0;
}

.receipt-client-info {
  font-size: 10.5px;
  line-height: 1.35;
  text-align: left;
  margin: 4px 0 2px 0;
  word-break: break-word;
}

.receipt-client-info p {
  margin: 2px 0;
}

.receipt-client-info strong {
  font-weight: bold;
}

.receipt-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.receipt-items-table th {
  border-bottom: 1px dashed #000;
  padding-bottom: 4px;
  text-align: left;
}

.receipt-items-table td {
  padding: 3px 0;
  vertical-align: top;
}

.receipt-totals {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
}

.rec-row {
  display: flex;
  justify-content: space-between;
}

.rec-total-bold {
  font-size: 13px;
  font-weight: bold;
  border-top: 1px dashed #000;
  border-bottom: 1px dashed #000;
  padding: 4px 0;
  margin: 4px 0;
}

.receipt-nfce-info {
  font-size: 10px;
  text-align: center;
}

.rec-highlight-code {
  font-weight: bold;
  font-size: 11px;
  letter-spacing: 0.05em;
  margin: 2px 0;
}

.rec-key {
  font-size: 9px;
  word-break: break-all;
  font-weight: bold;
  margin: 2px 0;
}

.receipt-qrcode-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
}

#rec-qrcode-canvas img, #rec-qrcode-canvas canvas {
  margin: 0 auto;
}

.rec-consult-url {
  font-size: 9px;
  text-align: center;
  margin-top: 4px;
}

.receipt-footer {
  text-align: center;
  font-size: 11px;
  font-weight: bold;
  margin-top: 8px;
}


/* Media Print Rules */
@media print {
  body * {
    visibility: hidden;
  }
  #thermal-receipt-printable, #thermal-receipt-printable * {
    visibility: visible;
  }
  #thermal-receipt-printable {
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm !important;
    padding: 0 !important;
    box-shadow: none !important;
  }
}

/* Toolbar Filter Card */
.toolbar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.search-filter-group {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-input-wrapper {
  flex: 1;
  min-width: 280px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem 0.65rem 2.6rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.filter-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.filter-select:focus {
  border-color: var(--accent-blue);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-sm {
  padding: 0.5rem 0.85rem;
  font-size: 0.825rem;
}

.btn-primary {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: var(--accent-blue-hover);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.btn-emerald {
  background: var(--accent-emerald);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

.btn-emerald:hover {
  background: var(--accent-emerald-hover);
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.35);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.1);
  color: var(--accent-rose);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
  background: var(--accent-rose);
  color: #ffffff;
}

/* Data Table Card */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.table-responsive {
  overflow-x: auto;
}

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

.data-table th {
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.775rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

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

.data-table tbody tr {
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
  background-color: var(--bg-hover);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.badge-cliente    { background: rgba(37, 99, 235, 0.1); color: var(--accent-blue); border: 1px solid rgba(37, 99, 235, 0.2); }
.badge-fornecedor { background: rgba(217, 119, 6, 0.1); color: var(--accent-amber); border: 1px solid rgba(217, 119, 6, 0.2); }
.badge-vendedor   { background: rgba(124, 58, 237, 0.1); color: var(--accent-purple); border: 1px solid rgba(124, 58, 237, 0.2); }
.badge-transp     { background: rgba(8, 145, 178, 0.1); color: var(--accent-cyan); border: 1px solid rgba(8, 145, 178, 0.2); }
.badge-outro      { background: rgba(100, 116, 139, 0.1); color: var(--text-muted); border: 1px solid rgba(100, 116, 139, 0.2); }

.badge-active   { background: rgba(5, 150, 105, 0.1); color: var(--accent-emerald); border: 1px solid rgba(5, 150, 105, 0.2); }
.badge-inactive { background: rgba(220, 38, 38, 0.1); color: var(--accent-rose); border: 1px solid rgba(220, 38, 38, 0.2); }

.badge-group {
  background: rgba(124, 58, 237, 0.1);
  color: var(--accent-purple);
  border: 1px solid rgba(124, 58, 237, 0.2);
}

.badge-stock-ok {
  background: rgba(5, 150, 105, 0.1);
  color: var(--accent-emerald);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.badge-stock-low {
  background: rgba(217, 119, 6, 0.1);
  color: var(--accent-amber);
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.badge-stock-out {
  background: rgba(220, 38, 38, 0.1);
  color: var(--accent-rose);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

/* Pagination */
.pagination-wrapper {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.pagination-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-span {
  font-weight: 600;
  padding: 0 0.5rem;
  font-size: 0.85rem;
}

/* Modal Styling */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.modal-container.modal-lg {
  max-width: 920px;
}

.modal-backdrop.active .modal-container {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.75rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

.modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  flex: 1;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Form Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-7  { grid-column: span 7; }
.col-6  { grid-column: span 6; }
.col-5  { grid-column: span 5; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }
.col-2  { grid-column: span 2; }

@media (max-width: 1024px) {
  .pos-main-grid { grid-template-columns: 1fr; }
  .pos-summary-container { position: static; }
}

@media (max-width: 900px) {
  .dashboard-panels-grid { grid-template-columns: 1fr; }
  .sidebar { width: 80px; min-width: 80px; }
  .brand-info, .sidebar-section-title, .nav-item span, .sidebar-footer span { display: none; }
  .nav-item { justify-content: center; padding: 0.75rem; }
}

@media (max-width: 768px) {
  .col-8, .col-7, .col-6, .col-5, .col-4, .col-3, .col-2 { grid-column: span 12; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.85rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

.modal-footer {
  padding: 1.25rem 1.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-surface);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-success { border-left: 4px solid var(--accent-emerald); }
.toast-error, .toast-danger { border-left: 4px solid var(--accent-rose); }
.toast-warning { border-left: 4px solid var(--accent-amber); }
.toast-info    { border-left: 4px solid var(--accent-blue); }

.toast.fade-out {
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease-in;
}

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

.loading-td {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem !important;
}

/* ==================== THEME TOGGLE BUTTON ==================== */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.theme-toggle-btn i {
  font-size: 1rem;
  transition: transform 0.3s ease, color 0.25s ease;
}

.theme-toggle-btn:hover i {
  transform: rotate(20deg) scale(1.1);
}

/* Light theme default button state */
#theme-toggle-icon {
  color: var(--accent-purple);
}

/* Dark theme button state */
[data-theme="dark"] #theme-toggle-icon {
  color: #fcd34d; /* Warm sun yellow */
}

/* ==================== DARK MODE SPECIALIZED REFINEMENTS ==================== */
[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #090e1a 0%, #0f172a 60%, #15223c 100%);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .sidebar-brand {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .sidebar-footer {
  border-top-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .brand-icon {
  background: #3b82f6;
  color: #ffffff;
}

[data-theme="dark"] .nav-item.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

[data-theme="dark"] .nav-item.active i {
  color: #ffffff;
}

[data-theme="dark"] .pos-clock-badge {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: #60a5fa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .pos-cart-table th {
  background: #0f172a;
  color: #f8fafc;
}

[data-theme="dark"] .payment-total-banner {
  background: #0f172a;
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .pos-results-overlay {
  background: var(--bg-surface);
  border: 1px solid var(--accent-blue);
  box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .pos-result-item:hover,
[data-theme="dark"] .pos-result-item.selected {
  background: var(--bg-surface-elevated);
}

[data-theme="dark"] .pay-method-card:hover,
[data-theme="dark"] .pay-method-card.active {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.15);
}

/* Badges High Contrast in Dark Mode */
[data-theme="dark"] .badge-cliente {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

[data-theme="dark"] .badge-fornecedor {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

[data-theme="dark"] .badge-vendedor {
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

[data-theme="dark"] .badge-transp {
  background: rgba(6, 182, 212, 0.2);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.35);
}

[data-theme="dark"] .badge-outro {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

[data-theme="dark"] .badge-active,
[data-theme="dark"] .badge-stock-ok {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

[data-theme="dark"] .badge-inactive,
[data-theme="dark"] .badge-stock-out {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

[data-theme="dark"] .badge-stock-low {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

[data-theme="dark"] .badge-group {
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

/* Modal Backdrops & Overlays in Dark Mode */
[data-theme="dark"] .modal-backdrop {
  background: rgba(3, 7, 18, 0.78);
}

/* Ensure Thermal Receipt is always pristine white paper with black text */
.thermal-receipt,
[data-theme="dark"] .thermal-receipt {
  background: #ffffff !important;
  color: #000000 !important;
}

.thermal-receipt *,
[data-theme="dark"] .thermal-receipt * {
  color: #000000 !important;
  border-color: #000000 !important;
}

[data-theme="dark"] select option {
  background-color: #131b2e;
  color: #f8fafc;
}
