/* ==========================================================================
   CAUCHERA ADMIN - MODERN ERP DESIGN SYSTEM
   Vanilla CSS | Desktop-First | Responsive | Print Ready
   ========================================================================== */

:root {
  /* Color Palette */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-focus: rgba(37, 99, 235, 0.2);

  --secondary: #0f172a;
  --secondary-light: #1e293b;
  --secondary-hover: #334155;

  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-light: #fef3c7;

  --success: #10b981;
  --success-light: #d1fae5;
  --success-dark: #047857;

  --danger: #ef4444;
  --danger-light: #fee2e2;
  --danger-dark: #b91c1c;

  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --warning-dark: #b45309;

  --info: #0ea5e9;
  --info-light: #e0f2fe;
  --info-dark: #0369a1;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f1f5f9;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;

  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-focus: #3b82f6;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

  /* Dimensions */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

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

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--secondary);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: var(--transition);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  background-color: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 0.75rem;
}

.sidebar-brand img {
  max-height: 38px;
  max-width: 140px;
  object-fit: contain;
}

.sidebar-brand-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-close-btn {
  display: none;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-menu::-webkit-scrollbar {
  width: 4px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.menu-category {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 0.75rem 0.75rem 0.25rem;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: #94a3b8;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  transition: var(--transition);
  position: relative;
}

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

.menu-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  font-weight: 600;
}

.menu-item svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.menu-item .badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background-color: rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: capitalize;
}

/* Main Content Wrapper */
.main-wrapper {
  flex: 1 1 auto;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100% - var(--sidebar-width));
  transition: var(--transition);
}

/* Sidebar Collapsed / Minimized State (Desktop) */
body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-brand {
  padding: 0;
  justify-content: center;
}

body.sidebar-collapsed .sidebar-brand-text {
  display: none !important;
}

body.sidebar-collapsed .sidebar-brand img {
  max-width: 42px;
  max-height: 42px;
  margin: 0 auto;
}

body.sidebar-collapsed .menu-category {
  font-size: 0;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.08);
  margin: 0.5rem 0.5rem;
  padding: 0;
  overflow: hidden;
}

body.sidebar-collapsed .menu-item {
  justify-content: center;
  padding: 0.75rem 0;
  gap: 0;
  border-radius: var(--radius-md);
}

body.sidebar-collapsed .menu-item span,
body.sidebar-collapsed .menu-item .badge {
  display: none !important;
}

body.sidebar-collapsed .menu-item svg {
  margin: 0 auto;
}

body.sidebar-collapsed .sidebar-footer {
  padding: 0.75rem 0.35rem;
  flex-direction: column;
  gap: 0.65rem;
  justify-content: center;
  align-items: center;
}

body.sidebar-collapsed .sidebar-user .user-info {
  display: none !important;
}

body.sidebar-collapsed .main-wrapper {
  margin-left: var(--sidebar-collapsed-width);
  width: calc(100% - var(--sidebar-collapsed-width));
  max-width: calc(100% - var(--sidebar-collapsed-width));
}

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

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.sidebar-toggle:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

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

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-pos-quick {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  transition: var(--transition);
}

.btn-pos-quick:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Content Area */
.content-body {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Page Headers */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.page-header-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background-color: #ffffff;
}

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

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-light);
  background-color: #fafbfc;
}

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

.stat-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.primary::before { background-color: var(--primary); }
.stat-card.success::before { background-color: var(--success); }
.stat-card.warning::before { background-color: var(--warning); }
.stat-card.danger::before { background-color: var(--danger); }
.stat-card.info::before { background-color: var(--info); }

.stat-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0.35rem 0 0.2rem;
  letter-spacing: -0.03em;
}

.stat-desc {
  font-size: 0.78rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card.primary .stat-icon { background-color: var(--primary-light); color: var(--primary); }
.stat-card.success .stat-icon { background-color: var(--success-light); color: var(--success-dark); }
.stat-card.warning .stat-icon { background-color: var(--warning-light); color: var(--warning-dark); }
.stat-card.danger .stat-icon { background-color: var(--danger-light); color: var(--danger-dark); }
.stat-card.info .stat-icon { background-color: var(--info-light); color: var(--info-dark); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.25;
}

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

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
  background-color: var(--secondary);
  color: #ffffff;
}
.btn-secondary:hover:not(:disabled) {
  background-color: var(--secondary-hover);
}

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

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}
.btn-danger:hover:not(:disabled) {
  background-color: var(--danger-dark);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-outline:hover:not(:disabled) {
  background-color: var(--bg-hover);
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.75rem 1.4rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.btn-icon {
  padding: 0.45rem;
  border-radius: var(--radius-md);
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--bg-input);
  color: var(--text-main);
  transition: var(--transition);
  outline: none;
}

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

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

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.1rem;
  padding-right: 2.2rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-check-input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.table th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

.table tbody tr {
  transition: background-color 0.15s ease;
}

.table tbody tr:hover {
  background-color: #f8fafc;
}

.table-actions {
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  justify-content: flex-end !important;
}

.table-actions .btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.35rem !important;
  padding: 0.32rem 0.6rem !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  height: 30px !important;
  border-radius: var(--radius-sm) !important;
  transition: all 0.15s ease !important;
}

.table-actions .btn svg {
  flex-shrink: 0 !important;
  vertical-align: middle !important;
}

.table-actions .btn svg + span {
  margin-left: 0.2rem !important;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  line-height: 1.2;
}

.badge-primary { background-color: var(--primary-light); color: var(--primary); }
.badge-success { background-color: var(--success-light); color: var(--success-dark); }
.badge-warning { background-color: var(--warning-light); color: var(--warning-dark); }
.badge-danger { background-color: var(--danger-light); color: var(--danger-dark); }
.badge-info { background-color: var(--info-light); color: var(--info-dark); }
.badge-neutral { background-color: #f1f5f9; color: var(--text-muted); }

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

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

.modal-content {
  background-color: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 2.5rem);
  max-height: calc(100dvh - 2.5rem);
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  margin: auto;
  position: relative;
}

.modal-content.modal-lg {
  max-width: 840px;
}

.modal-content.modal-xl {
  max-width: 1100px;
}

.modal-backdrop.open .modal-content {
  transform: scale(1);
}

.modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  margin: 0;
}

.modal-header {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background-color: #ffffff;
}

.modal-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  display: flex;
  transition: var(--transition);
}

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

.modal-body {
  padding: 1.25rem 1.4rem;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
}

.modal-footer {
  padding: 0.85rem 1.4rem;
  border-top: 1px solid var(--border-light);
  background-color: #fafbfc;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: calc(1.25rem + env(safe-area-inset-top, 0px));
  right: 1.25rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.16), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  animation: slideInDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  user-select: none;
}

.toast:hover {
  box-shadow: 0 14px 28px -5px rgba(0, 0, 0, 0.22);
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-msg {
  flex: 1;
  line-height: 1.35;
}

.toast-close {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  margin-left: 0.25rem;
  flex-shrink: 0;
}

.toast-close:hover {
  color: var(--text-main);
  background-color: #f1f5f9;
}

.toast.success { border-left-color: var(--success); }
.toast.success .toast-icon { color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast.info .toast-icon { color: var(--info); }

@keyframes slideInDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 768px) {
  .toast-container {
    top: calc(0.75rem + env(safe-area-inset-top, 0px));
    right: 0.75rem;
    left: 0.75rem;
    max-width: none;
  }
}

/* Filters & Search Toolbar */
.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.search-input-group {
  position: relative;
  min-width: 260px;
  flex: 1;
}

.search-input-group svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 1.1rem;
  height: 1.1rem;
}

.search-input-group .form-control {
  padding-left: 2.5rem;
}

/* ==========================================================================
   POS SCREEN STYLES (PREMIUM MODERN AESTHETICS)
   ========================================================================== */
.pos-wrapper {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 1.25rem;
  height: calc(100vh - var(--topbar-height) - 2.5rem);
  min-height: 580px;
  max-height: calc(100vh - var(--topbar-height) - 2.5rem);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (min-width: 1600px) {
  .pos-layout {
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1.5rem;
  }
}

@media (max-width: 1200px) {
  .pos-layout {
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 1rem;
  }
}

.pos-catalog {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.pos-filters-panel {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex-shrink: 0;
}

.pos-categories {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
}

.pos-cat-btn {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-main);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}

.pos-cat-btn:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
  border-color: #cbd5e1;
}

.pos-cat-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
}

/* POS Products Grid - spacious responsive columns */
.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.15rem;
  flex: 1;
  overflow-y: auto;
  padding-right: 0.35rem;
  padding-bottom: 0.75rem;
  align-content: start;
}

@media (min-width: 1600px) {
  .pos-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.35rem;
  }
}

/* POS Product Card */
.pos-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 285px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.pos-card:hover {
  border-color: #93c5fd;
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -6px rgba(37, 99, 235, 0.15), 0 4px 8px -2px rgba(0, 0, 0, 0.05);
}

.pos-card-thumb-wrapper {
  position: relative;
  width: 100%;
  height: 155px;
  background: linear-gradient(180deg, #f8fafc 0%, #edf2f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
}

.pos-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.65rem;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pos-card-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  width: 100%;
  height: 100%;
}

.pos-card-sku-tag {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2;
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
  letter-spacing: 0.02em;
}

.pos-card-badge-top {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  font-size: 0.72rem;
  padding: 0.22rem 0.55rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pos-card-view-btn {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-main);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.pos-card:hover .pos-card-view-btn {
  opacity: 1;
  background: #ffffff;
  transform: scale(1.05);
}

.pos-card-body {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
  gap: 0.6rem;
  cursor: pointer;
}

.pos-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.pos-card-meta .brand-pill {
  background: #f1f5f9;
  color: var(--secondary);
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-sm);
}

.pos-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.pos-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-light);
  margin-top: 0.25rem;
  gap: 0.5rem;
}

.pos-card-price-container {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.pos-card-price {
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.pos-card-price-ves {
  font-size: 0.8rem;
  font-weight: 700;
  color: #059669;
  line-height: 1.1;
}

.pos-card-add-btn {
  background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  padding: 0.48rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
  flex-shrink: 0;
}

.pos-card-add-btn:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

.pos-card-add-btn:active {
  transform: translateY(1px);
}

.pos-card.out-of-stock {
  opacity: 0.55;
  filter: grayscale(0.5);
}

.pos-card.out-of-stock .pos-card-add-btn {
  background: #cbd5e1;
  color: #64748b;
  box-shadow: none;
  cursor: not-allowed;
}

/* POS Floating Checkout Sidebar */
.pos-cart {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.pos-cart-header {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
}

.pos-cart-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pos-cart-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 100px;
}

.pos-cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  background-color: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  gap: 0.5rem;
  transition: var(--transition);
}

.pos-cart-item:hover {
  border-color: #cbd5e1;
  background-color: #fafbfc;
}

.pos-item-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.pos-item-title {
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.pos-item-unit-price {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pos-qty-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  background: #f1f5f9;
  padding: 0.15rem;
  border-radius: var(--radius-sm);
}

.pos-qty-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: none;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: var(--transition);
}

.pos-qty-btn:hover {
  background-color: var(--primary);
  color: #ffffff;
}

.pos-qty-input {
  width: 36px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 800;
  border: none;
  background: transparent;
  padding: 0.1rem;
}

.pos-item-total {
  font-size: 0.92rem;
  font-weight: 800;
  min-width: 65px;
  text-align: right;
  color: var(--primary-hover);
}

.pos-cart-summary {
  padding: 1rem 1.15rem;
  border-top: 1px solid var(--border);
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-shrink: 0;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.04);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.summary-line.total {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
  margin-top: 0.25rem;
}

/* POS Floating Button (Mobile FAB) & Drawer Backdrop defaults (Desktop Hidden) */
.pos-mobile-fab-container {
  display: none;
}

.pos-cart-backdrop {
  display: none;
}

.pos-cart-mobile-header {
  display: none;
}

@keyframes fabPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.pos-mobile-fab.pulse {
  animation: fabPulse 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Product Detail Modal */
.product-detail-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
}

.product-detail-preview {
  background: linear-gradient(135deg, #f8fafc 0%, #eef2f6 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 280px;
  overflow: hidden;
  position: relative;
}

.product-detail-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1rem;
}

.product-detail-specs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  background: #f8fafc;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.spec-item {
  display: flex;
  flex-direction: column;
}

.spec-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.spec-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

@media (max-width: 640px) {
  .product-detail-layout {
    grid-template-columns: 1fr;
  }
}

/* Table Thumbnail for Inventory */
.table-product-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.table-thumb {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.table-thumb-placeholder {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* Image preview container in modals */
.img-preview-box {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.img-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  width: 3rem;
  height: 3rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.empty-state-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.empty-state-desc {
  font-size: 0.85rem;
  max-width: 360px;
}

/* Responsive Rules */
.sidebar-backdrop {
  display: none;
}

@media (max-width: 1200px) {
  .pos-layout {
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 1rem;
  }
}

@media (max-width: 1024px) {
  .pos-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 0.85rem;
  }
}

@media (max-width: 768px) {
  .sidebar-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .sidebar-backdrop.open {
    opacity: 1;
    visibility: visible;
  }

  .sidebar {
    width: 270px !important;
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 100 !important;
    transform: translateX(-100%) !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5) !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  .sidebar.open {
    transform: translateX(0) !important;
  }

  .sidebar-close-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-size: 1.4rem;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
  }

  .sidebar-close-btn:hover {
    background: rgba(239, 68, 68, 0.85);
    border-color: rgba(239, 68, 68, 1);
  }

  /* Reset all desktop collapsing behavior on mobile */
  body.sidebar-collapsed .sidebar {
    width: 270px !important;
  }

  body.sidebar-collapsed .sidebar-brand-text {
    display: block !important;
  }

  body.sidebar-collapsed .menu-category {
    font-size: 0.68rem !important;
    height: auto !important;
    background: transparent !important;
    padding: 0.75rem 0.75rem 0.25rem !important;
  }

  body.sidebar-collapsed .menu-item {
    justify-content: flex-start !important;
    padding: 0.65rem 0.85rem !important;
    gap: 0.75rem !important;
  }

  body.sidebar-collapsed .menu-item span,
  body.sidebar-collapsed .menu-item .badge {
    display: inline-flex !important;
  }

  body.sidebar-collapsed .sidebar-footer {
    flex-direction: row !important;
    justify-content: space-between !important;
    padding: 0.85rem 1rem !important;
  }

  body.sidebar-collapsed .sidebar-user .user-info {
    display: flex !important;
  }

  /* Full screen width on mobile */
  .main-wrapper,
  body.sidebar-collapsed .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
  }

  .topbar {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 0.75rem !important;
    height: 52px !important;
    min-height: 52px !important;
    gap: 0.5rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    background: #ffffff !important;
    border-bottom: 1px solid var(--border-light) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 40 !important;
  }

  .topbar-left {
    display: flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }

  .sidebar-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 0 !important;
    border-radius: var(--radius-sm) !important;
    background: #f8fafc !important;
    border: 1px solid var(--border-light) !important;
    color: var(--text-main) !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
  }

  .topbar-title {
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
    flex: 1 !important;
    max-width: 130px !important;
  }

  .topbar-right {
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    flex-shrink: 0 !important;
  }

  .btn-exchange-rate {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    padding: 0.25rem 0.5rem !important;
    font-size: 0.74rem !important;
    height: 32px !important;
    border-radius: 9999px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .btn-exchange-rate .rate-icon {
    font-size: 0.85rem !important;
  }

  .btn-exchange-rate .rate-label {
    display: none !important;
  }

  .btn-exchange-rate strong {
    font-size: 0.74rem !important;
    font-weight: 800 !important;
  }

  .btn-exchange-rate svg {
    width: 11px !important;
    height: 11px !important;
  }

  .btn-pos-quick {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    border-radius: var(--radius-sm) !important;
    flex-shrink: 0 !important;
  }

  .btn-pos-quick span,
  .btn-pos-quick .btn-pos-label {
    display: none !important;
  }

  .btn-topbar-profile,
  .topbar-right a[href*="profile"] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    border-radius: var(--radius-sm) !important;
    flex-shrink: 0 !important;
  }

  .btn-topbar-profile span,
  .btn-topbar-profile .btn-profile-label,
  .topbar-right a[href*="profile"] span {
    display: none !important;
  }

  .content-body {
    padding: 0.85rem !important;
  }

  @media (max-width: 440px) {
    .topbar {
      padding: 0 0.5rem !important;
      gap: 0.35rem !important;
    }

    .topbar-left {
      gap: 0.35rem !important;
    }

    .topbar-title {
      max-width: 85px !important;
      font-size: 0.82rem !important;
    }

    .btn-exchange-rate {
      padding: 0.2rem 0.4rem !important;
      font-size: 0.7rem !important;
      gap: 0.2rem !important;
    }

    .btn-exchange-rate strong {
      font-size: 0.72rem !important;
    }
  }

  /* POS Full Stack Mobile View & Floating Drawer */
  .pos-layout {
    grid-template-columns: 1fr !important;
    height: auto !important;
    max-height: none !important;
    gap: 1.25rem !important;
    padding-bottom: 95px !important; /* Space so bottom products are not obscured by the floating FAB */
  }

  .pos-catalog {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .pos-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    max-height: none !important;
    gap: 0.75rem !important;
    overflow: visible !important;
  }

  .pos-card {
    min-height: auto !important;
  }

  .pos-card-thumb-wrapper {
    height: 120px !important;
  }

  .pos-card-body {
    padding: 0.65rem 0.75rem !important;
    gap: 0.4rem !important;
  }

  .pos-card-name {
    font-size: 0.84rem !important;
    min-height: auto !important;
  }

  .pos-card-price {
    font-size: 1.12rem !important;
  }

  .pos-card-price-ves {
    font-size: 0.72rem !important;
  }

  .pos-card-add-btn {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.78rem !important;
  }

  /* Mobile FAB Bar */
  .pos-mobile-fab-container {
    display: block !important;
    position: fixed !important;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
    left: 1rem !important;
    right: 1rem !important;
    z-index: 95 !important;
    max-width: 520px !important;
    margin: 0 auto !important;
    pointer-events: none;
  }

  .pos-mobile-fab {
    pointer-events: auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 55%, #3b82f6 100%);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.28);
    border-radius: 9999px;
    padding: 0.65rem 1.15rem;
    box-shadow: 0 12px 28px -4px rgba(37, 99, 235, 0.55), 0 6px 14px -2px rgba(37, 99, 235, 0.35);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    backdrop-filter: blur(8px);
  }

  .pos-mobile-fab:active {
    transform: scale(0.96);
  }

  .pos-fab-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
  }

  .pos-fab-icon-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3);
  }

  .pos-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
    min-width: 19px;
    height: 19px;
    padding: 0 4px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  }

  .pos-fab-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .pos-fab-title {
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
  }

  .pos-fab-subtitle {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
  }

  .pos-fab-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-align: right;
  }

  .pos-fab-total-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
  }

  .pos-fab-total {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: #ffffff;
  }

  .pos-fab-total-ves {
    font-size: 0.74rem;
    color: #86efac;
    font-weight: 700;
  }

  .pos-fab-chevron {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  /* POS Mobile Drawer Backdrop */
  .pos-cart-backdrop {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(4px) !important;
    z-index: 1000 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s !important;
  }

  .pos-cart-backdrop.open {
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* POS Cart as Bottom Sliding Drawer */
  .pos-cart {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    max-width: 580px !important;
    margin: 0 auto !important;
    height: 88vh !important;
    max-height: 88vh !important;
    border-radius: 24px 24px 0 0 !important;
    z-index: 1010 !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35) !important;
    transform: translateY(105%) !important;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    overflow: hidden !important;
    border-left: 1px solid var(--border) !important;
    border-right: 1px solid var(--border) !important;
    border-top: 1px solid var(--border) !important;
    border-bottom: none !important;
  }

  .pos-cart.open {
    transform: translateY(0%) !important;
  }

  /* Drawer Mobile Header */
  .pos-cart-mobile-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 0.65rem 1rem 0.5rem !important;
    border-bottom: 1px solid var(--border-light) !important;
    background: #ffffff !important;
    flex-shrink: 0 !important;
  }

  .pos-cart-mobile-handle {
    width: 44px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 9999px;
    margin-bottom: 0.5rem;
  }

  .pos-cart-mobile-title-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .pos-cart-mobile-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-main);
  }

  .pos-cart-mobile-title svg {
    color: var(--primary);
  }

  .btn-close-cart-drawer {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
  }

  .btn-close-cart-drawer:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
  }

  .pos-cart-header {
    padding: 0.85rem 1rem !important;
    gap: 0.6rem !important;
    background: #f8fafc !important;
  }

  .pos-cart-items {
    flex: 1 !important;
    max-height: none !important;
    overflow-y: auto !important;
    padding: 0.75rem 1rem !important;
  }

  .pos-cart-summary {
    padding: 0.85rem 1rem 1.25rem !important;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.08) !important;
    background: #ffffff !important;
  }

  body.pos-drawer-open {
    overflow: hidden !important;
  }

  /* Cards, Grids and Tables */
  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .form-row {
    grid-template-columns: 1fr !important;
  }

  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
  }

  .modal-content {
    max-width: 95vw !important;
    margin: 0.5rem auto !important;
  }
}

/* ==========================================================================
   PRINT STYLES (@media print)
   ========================================================================== */
@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
    font-size: 12px;
  }

  .sidebar,
  .topbar,
  .page-header-actions,
  .filter-toolbar,
  .btn,
  .modal-backdrop,
  .toast-container,
  .no-print {
    display: none !important;
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

  .content-body {
    padding: 0 !important;
  }

  .card {
    border: none !important;
    box-shadow: none !important;
  }

  .printable-receipt {
    max-width: 80mm !important;
    margin: 0 auto;
    padding: 5px;
    font-family: monospace;
    line-height: 1.2;
  }

  .printable-voucher {
    width: 100% !important;
    max-width: 100% !important;
    padding: 20px !important;
  }

  .printable-voucher table {
    border-collapse: collapse !important;
    width: 100% !important;
  }

  .printable-voucher th,
  .printable-voucher td {
    border: 1px solid #ddd !important;
    padding: 6px 8px !important;
  }
}

/* ==========================================================================
   PAGINATION & SVG CONTAINMENT FIXES
   ========================================================================== */
svg {
  max-width: 100%;
}

.card-footer nav svg,
.pagination svg,
nav[role="navigation"] svg {
  width: 1.1rem !important;
  height: 1.1rem !important;
  max-width: 1.1rem !important;
  max-height: 1.1rem !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

.pagination {
  display: flex;
  padding-left: 0;
  list-style: none;
  gap: 0.35rem;
  align-items: center;
  margin: 0;
  flex-wrap: wrap;
}

.page-item {
  display: inline-block;
}

.page-item .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
}

.page-item .page-link:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-focus);
  color: var(--primary);
}

.page-item.active .page-link {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.page-item.disabled .page-link {
  color: var(--text-light);
  pointer-events: none;
  background-color: var(--bg-main);
  border-color: var(--border);
  opacity: 0.65;
}

/* ==========================================================================
   DATATABLES & EXPORT BUTTONS CUSTOM DESIGN SYSTEM
   ========================================================================== */
.dataTables_wrapper {
  position: relative;
  clear: both;
  width: 100%;
}

.dt-toolbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.dt-buttons-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* Master DataTables Button Reset & Styling */
div.dt-buttons .dt-button,
button.dt-button,
div.dt-button,
a.dt-button,
.dt-buttons-group .btn-dt {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  vertical-align: middle !important;
  padding: 0.45rem 0.95rem !important;
  font-size: 0.84rem !important;
  font-weight: 700 !important;
  font-family: var(--font-family) !important;
  border-radius: var(--radius-md) !important;
  border-width: 1.5px !important;
  border-style: solid !important;
  background-image: none !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  text-decoration: none !important;
  margin: 0 !important;
  line-height: 1 !important;
  height: 36px !important;
  box-sizing: border-box !important;
}

/* Ensure wrapper span created by DataTables is centered both horizontally and vertically */
div.dt-buttons .dt-button > span,
button.dt-button > span,
.dt-buttons-group .btn-dt > span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  vertical-align: middle !important;
  line-height: 1 !important;
  height: 100% !important;
}

/* Icon centering and right margin */
div.dt-buttons .dt-button .dt-icon,
button.dt-button .dt-icon,
.btn-dt .dt-icon,
div.dt-buttons .dt-button svg,
button.dt-button svg,
.btn-dt svg {
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-right: 0.45rem !important;
  margin-left: 0 !important;
  vertical-align: middle !important;
  transition: transform 0.2s ease !important;
}

div.dt-buttons .dt-button span span,
button.dt-button span span,
.btn-dt span span {
  display: inline-flex !important;
  align-items: center !important;
  line-height: 1 !important;
}

div.dt-buttons .dt-button:hover .dt-icon,
button.dt-button:hover .dt-icon,
.btn-dt:hover .dt-icon,
div.dt-buttons .dt-button:hover svg,
button.dt-button:hover svg,
.btn-dt:hover svg {
  transform: scale(1.15);
}

/* Specific Button Color Themes */

/* 1. COPIAR */
div.dt-buttons button.buttons-copy,
.dt-buttons-group .btn-dt-copy {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}
div.dt-buttons button.buttons-copy:hover,
.dt-buttons-group .btn-dt-copy:hover {
  background-color: #334155 !important;
  border-color: #1e293b !important;
  color: #ffffff !important;
  transform: translateY(-1.5px) !important;
  box-shadow: 0 4px 12px rgba(51, 65, 85, 0.25) !important;
}

/* 2. EXCEL (Emerald Green) */
div.dt-buttons button.buttons-excel,
.dt-buttons-group .btn-dt-excel {
  background-color: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #047857 !important;
}
div.dt-buttons button.buttons-excel:hover,
.dt-buttons-group .btn-dt-excel:hover {
  background-color: #10b981 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
  transform: translateY(-1.5px) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
}
div.dt-buttons button.buttons-excel:hover svg,
.dt-buttons-group .btn-dt-excel:hover svg {
  stroke: #ffffff !important;
}

/* 3. CSV (Sky Blue) */
div.dt-buttons button.buttons-csv,
.dt-buttons-group .btn-dt-csv {
  background-color: #f0f9ff !important;
  border-color: #0ea5e9 !important;
  color: #0369a1 !important;
}
div.dt-buttons button.buttons-csv:hover,
.dt-buttons-group .btn-dt-csv:hover {
  background-color: #0ea5e9 !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
  transform: translateY(-1.5px) !important;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35) !important;
}
div.dt-buttons button.buttons-csv:hover svg,
.dt-buttons-group .btn-dt-csv:hover svg {
  stroke: #ffffff !important;
}

/* 4. PDF (Ruby Red) */
div.dt-buttons button.buttons-pdf,
.dt-buttons-group .btn-dt-pdf {
  background-color: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
}
div.dt-buttons button.buttons-pdf:hover,
.dt-buttons-group .btn-dt-pdf:hover {
  background-color: #ef4444 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  transform: translateY(-1.5px) !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35) !important;
}
div.dt-buttons button.buttons-pdf:hover svg,
.dt-buttons-group .btn-dt-pdf:hover svg {
  stroke: #ffffff !important;
}

/* 5. IMPRIMIR (Royal Indigo) */
div.dt-buttons button.buttons-print,
.dt-buttons-group .btn-dt-print {
  background-color: #eef2ff !important;
  border-color: #6366f1 !important;
  color: #4338ca !important;
}
div.dt-buttons button.buttons-print:hover,
.dt-buttons-group .btn-dt-print:hover {
  background-color: #6366f1 !important;
  border-color: #4f46e5 !important;
  color: #ffffff !important;
  transform: translateY(-1.5px) !important;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35) !important;
}
div.dt-buttons button.buttons-print:hover svg,
.dt-buttons-group .btn-dt-print:hover svg {
  stroke: #ffffff !important;
}

/* 6. COLUMNAS (Dark Slate) */
div.dt-buttons button.buttons-colvis,
div.dt-buttons button.buttons-collection,
.dt-buttons-group .btn-dt-colvis {
  background-color: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: #334155 !important;
}
div.dt-buttons button.buttons-colvis:hover,
div.dt-buttons button.buttons-collection:hover,
.dt-buttons-group .btn-dt-colvis:hover {
  background-color: #0f172a !important;
  border-color: #0f172a !important;
  color: #ffffff !important;
  transform: translateY(-1.5px) !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.3) !important;
}
div.dt-buttons button.buttons-colvis:hover svg,
div.dt-buttons button.buttons-collection:hover svg,
.dt-buttons-group .btn-dt-colvis:hover svg {
  stroke: #ffffff !important;
}

/* DataTables Dropdown Collection (Columns selector) */
div.dt-button-collection {
  background-color: #ffffff !important;
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.2) !important;
  padding: 0.5rem !important;
  min-width: 190px !important;
}

div.dt-button-collection button.dt-button {
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--text-main) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.45rem 0.85rem !important;
  font-size: 0.82rem !important;
  margin: 0.15rem 0 !important;
  width: 100% !important;
  text-align: left !important;
  justify-content: flex-start !important;
}

div.dt-button-collection button.dt-button:hover {
  background: var(--bg-hover) !important;
  color: var(--primary) !important;
  transform: none !important;
  box-shadow: none !important;
}

div.dt-button-collection button.dt-button.active {
  background: var(--primary-light) !important;
  color: var(--primary) !important;
  border-color: #bfdbfe !important;
  font-weight: 700 !important;
}

.dt-search-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dt-search-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
}

.dt-search-group input[type="search"] {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  color: var(--text-main);
  outline: none;
  min-width: 220px;
  transition: var(--transition);
}

.dt-search-group input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

.dt-table-wrapper {
  overflow-x: auto;
  width: 100%;
}

.dt-footer-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border);
}

.dt-info-group {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.dt-pagination-group .dataTables_paginate {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.dt-pagination-group .paginate_button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border) !important;
  background: var(--bg-card) !important;
  color: var(--text-main) !important;
  cursor: pointer;
  transition: var(--transition);
  margin: 0 !important;
}

.dt-pagination-group .paginate_button:hover {
  background: var(--bg-hover) !important;
  border-color: var(--border-focus) !important;
  color: var(--primary) !important;
}

.dt-pagination-group .paginate_button.current {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
}

.dt-pagination-group .paginate_button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   MODERN TOOLTIP STYLES (Tippy.js)
   ========================================================================== */
.tippy-box[data-theme~='erp-dark'] {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  border-radius: 6px !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2) !important;
  padding: 3px 6px !important;
  line-height: 1.35 !important;
}

.tippy-box[data-theme~='erp-dark'] > .tippy-arrow {
  color: #0f172a !important;
}

.tippy-box[data-theme~='erp-dark'] > .tippy-content {
  padding: 4px 8px !important;
}

/* ==========================================================================
   EXCHANGE RATE (TASA DEL DÍA) & DUAL CURRENCY (USD / VES)
   ========================================================================== */
.btn-exchange-rate {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 1px 2px rgba(16, 185, 129, 0.08);
}

.btn-exchange-rate:hover {
  background-color: #dcfce7;
  border-color: #86efac;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(16, 185, 129, 0.15);
}

.btn-exchange-rate .rate-icon {
  font-size: 1rem;
}

.btn-exchange-rate .rate-label {
  color: #15803d;
  font-size: 0.78rem;
}

.btn-exchange-rate strong {
  color: #14532d;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.pos-card-price-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
}

.pos-card-price-ves {
  font-size: 0.82rem;
  font-weight: 700;
  color: #059669;
  letter-spacing: -0.01em;
}

.summary-line.total-ves {
  font-size: 1.05rem;
  font-weight: 800;
  color: #059669;
  background: #f0fdf4;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px dashed #86efac;
  margin-top: 0.25rem;
}

.table-price-ves {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #059669;
}

