/* assets/css/app.css — MATC POS Global Styles */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --primary: #6366f1;
  --primary-d: #4f46e5;
  --primary-l: #e0e7ff;
  --secondary: #8b5cf6;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  --dark: #0f172a;

  /* Theme Variables - Light (Premium Modern) */
  --body-bg: #f4f7fe;
  --sidebar-bg: #ffffff;
  --header-bg: #ffffff;
  --card-bg: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.4);
  --border-color: #e9edf7;
  --border-light: #f8faff;
  --text-main: #475569;
  --text-muted: #8c98a4;
  --text-heading: #1e293b;
  --input-bg: #f4f7fe;
  --dropdown-bg: #ffffff;

  --sidebar-w: 260px;
  --sidebar-min-w: 70px;
  --header-h: 64px;
  --card-radius: 14px;
  --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.02);
  --modal-overlay: rgba(15, 23, 42, 0.5);
  --font-main: "Plus Jakarta Sans", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --body-bg: #0f172a;
  --sidebar-bg: #1e293b;
  --header-bg: #1e293b;
  --card-bg: #1e293b;
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --border-color: #334155;
  --border-light: #1e293b;
  --text-main: #94a3b8;
  --text-muted: #64748b;
  --text-heading: #f1f5f9;
  --input-bg: #0f172a;
  --dropdown-bg: #1e293b;
  --card-shadow: 0 4px 25px rgba(0, 0, 0, 0.2);
  --modal-overlay: rgba(0, 0, 0, 0.7);
}

/* Dark Theme Stat Icon Refinements */
[data-theme="dark"] .stat-icon.purple {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
}
[data-theme="dark"] .stat-icon.blue {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
}
[data-theme="dark"] .stat-icon.green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}
[data-theme="dark"] .stat-icon.orange {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
[data-theme="dark"] .stat-icon.red {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}
[data-theme="dark"] .stat-icon.cyan {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
}

/* Dark Theme Badge Refinements */
[data-theme="dark"] .badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}
[data-theme="dark"] .badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}
[data-theme="dark"] .badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
[data-theme="dark"] .badge-info {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
}
[data-theme="dark"] .badge-purple {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}
[data-theme="dark"] .badge-gray {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background: var(--body-bg);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
  transition:
    background-color var(--transition),
    color var(--transition),
    border-color var(--transition);
}

body.sidebar-minimized {
  --sidebar-w: var(--sidebar-min-w);
}

a {
  text-decoration: none;
  color: inherit;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 99px;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition:
    width var(--transition),
    transform var(--transition),
    background-color var(--transition),
    border-color var(--transition);
  border-right: 1px solid var(--border-color);
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  height: var(--header-h);
  border-bottom: 1px solid var(--border-light);
  overflow: hidden;
  position: relative;
  transition: border-color var(--transition);
}

.sidebar-brand .brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  transition:
    opacity var(--transition),
    visibility var(--transition);
}

.sidebar-brand .brand-text h4 {
  color: var(--text-heading);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  transition: color var(--transition);
}

.sidebar-brand .brand-text span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
}

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

.nav-section-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 20px 22px 8px;
  transition:
    opacity var(--transition),
    color var(--transition);
}

.nav-item {
  margin: 2px 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-main);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--body-bg);
  color: var(--primary);
}

.nav-link.active {
  background: var(--primary-l);
  color: var(--primary);
}

.nav-link .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-link span {
  transition:
    opacity var(--transition),
    visibility var(--transition),
    color var(--transition);
}

.nav-link .nav-arrow {
  margin-left: auto;
  font-size: 10px;
  transition:
    transform var(--transition),
    opacity var(--transition);
}

.nav-link[aria-expanded="true"] .nav-arrow {
  transform: rotate(90deg);
}

.nav-submenu {
  padding: 4px 0 4px 44px;
  transition: max-height var(--transition);
}
.nav-submenu .nav-link {
  font-size: 13px;
  color: var(--text-main);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-submenu .nav-link i {
  font-size: 14px;
  color: var(--text-muted);
  transition: color var(--transition);
}
.nav-submenu .nav-link:hover {
  color: var(--primary);
  background: var(--body-bg);
}
.nav-submenu .nav-link.active {
  color: var(--primary);
  background: var(--primary-l);
  font-weight: 700;
  width: max-content;
}
.nav-submenu .nav-link:hover i,
.nav-submenu .nav-link.active i {
  color: var(--primary);
}

/* Minimized state adjustments */
body.sidebar-minimized .sidebar {
  overflow: visible !important;
}
body.sidebar-minimized .sidebar-nav {
  overflow: visible !important;
  padding: 10px 0;
}

body.sidebar-minimized .sidebar-brand {
  justify-content: flex-start;
  padding: 32px 18px;
  cursor: pointer;
}
body.sidebar-minimized .sidebar-brand .sidebar-minimize-btn {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
body.sidebar-minimized .brand-text,
body.sidebar-minimized .nav-section-label,
body.sidebar-minimized .nav-link span,
body.sidebar-minimized .nav-arrow,
body.sidebar-minimized .sidebar-footer .sf-info,
body.sidebar-minimized .sidebar-footer .sf-logout {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.sidebar-minimized .nav-section-label {
  display: none;
}
body.sidebar-minimized .nav-item {
  margin: 1px 10px;
}
body.sidebar-minimized .nav-link {
  justify-content: flex-start;
  padding: 10px 18px;
}
body.sidebar-minimized .nav-submenu {
  display: none;
  max-height: 0;
  overflow: hidden;
}

/* Minimized Hover Sub-menus */
body.sidebar-minimized .nav-item {
  position: relative;
}
body.sidebar-minimized .nav-item:hover > .nav-submenu {
  display: block !important;
  position: absolute;
  left: 100%;
  top: 0;
  width: 200px;
  background: var(--dropdown-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  padding: 8px;
  z-index: 2000; /* Ensure it's above everything */
  max-height: none !important;
  overflow: visible !important;
  margin-left: 2px;
}

body.sidebar-minimized .nav-submenu .nav-link {
  padding: 8px 12px;
  font-size: 13px;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: all !important;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
}

.sidebar-footer .sf-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 12px;
  flex-shrink: 0;
}

.sidebar-footer .sf-info {
  flex: 1;
  overflow: hidden;
  transition: opacity var(--transition);
}
.sidebar-footer .sf-info .sf-name {
  color: var(--text-heading);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer .sf-info .sf-role {
  color: var(--text-muted);
  font-size: 11px;
}

.sidebar-footer .sf-logout {
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px;
  cursor: pointer;
  transition:
    color var(--transition),
    opacity var(--transition);
}
.sidebar-footer .sf-logout:hover {
  color: #ef4444;
}

/* ── Main Wrapper ──────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

/* ── Top Header ────────────────────────────────────────────── */
.top-header {
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 900;
  transition:
    background-color var(--transition),
    border-color var(--transition);
}

.header-search {
  flex: 1;
  max-width: 460px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 13px;
  font-family: var(--font-main);
  outline: none;
  color: var(--text-main);
  transition:
    border-color var(--transition),
    background-color var(--transition),
    color var(--transition);
}

.header-search input:focus {
  border-color: var(--primary);
  background: var(--header-bg);
}
.header-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 14px;
}

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

.header-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  font-size: 16px;
  transition: all var(--transition);
  position: relative;
}
.header-btn:hover {
  background: var(--primary-l);
  color: var(--primary);
  border-color: var(--primary-l);
}

.header-btn .badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #fff;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  transition: all var(--transition);
}
.header-user:hover {
  border-color: var(--primary);
}

.header-user .hu-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
}
.header-user .hu-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}
.header-user .hu-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Page Content ──────────────────────────────────────────── */
.page-content {
  padding: 28px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.2;
  transition: color var(--transition);
}

.page-title p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: 22px 24px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background-color var(--transition),
    border-color var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.1);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.purple {
  background: #ede9fe;
  color: #7c3aed;
}
.stat-icon.blue {
  background: #dbeafe;
  color: #2563eb;
}
.stat-icon.green {
  background: #d1fae5;
  color: #059669;
}
.stat-icon.orange {
  background: #fef3c7;
  color: #d97706;
}
.stat-icon.red {
  background: #fee2e2;
  color: #dc2626;
}
.stat-icon.cyan {
  background: #cffafe;
  color: #0891b2;
}

.stat-body {
  flex: 1;
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.2;
  margin: 4px 0;
}
.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-sub .up {
  color: var(--success);
}
.stat-sub .down {
  color: var(--danger);
}

/* ── Dashboard Premium Components ────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card-premium {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: var(--card-shadow);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
}

.stat-card-premium:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.stat-card-premium.clickable {
  cursor: pointer;
}
.stat-card-premium.clickable:hover {
  background: var(--input-bg);
}

.stat-card-premium::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.05;
  z-index: 0;
}

.stat-card-premium .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 0;
  flex-shrink: 0;
  z-index: 1;
}

.stat-label-p {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value-p {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 8px;
}

.stat-trend {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trend-up {
  color: #10b981;
}
.trend-neutral {
  color: #94a3b8;
}

.chart-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.04);
  margin-bottom: 24px;
}

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

.chart-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-legend {
  display: flex;
  gap: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.recent-table-card {
  background: var(--card-bg);
  border-radius: 24px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.badge-premium {
  padding: 6px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pos-table-p thead th {
  background: var(--input-bg);
  padding: 16px 20px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.8px;
}

.pos-table-p td {
  padding: 16px 20px;
  vertical-align: middle;
}

/* ── Report-specific Styles ───────────────────────────────── */
.pl-card .card-header {
  text-align: center;
  padding: 24px;
  border-bottom: 2px solid var(--border-light);
}

.pl-card-title {
  margin: 0;
  font-size: 20px;
  color: var(--text-heading);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pl-card-subtitle {
  margin: 8px 0 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.pl-table {
  width: 100%;
  border-collapse: collapse;
}

.pl-section-header {
  background: var(--input-bg);
  padding: 12px 24px;
  font-weight: 700;
  color: var(--text-heading);
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
}

.pl-row-details {
  padding: 16px 24px 8px 48px;
  color: var(--text-main);
}

.pl-row-value {
  padding: 16px 24px 8px 24px;
  text-align: right;
  font-weight: 600;
  color: var(--text-heading);
}

.pl-total-row {
  border-top: 1px dashed var(--border-color);
}

.pl-total-label {
  padding: 16px 24px;
  font-weight: 700;
  color: var(--text-heading);
  text-indent: 24px;
}

.pl-total-value {
  padding: 16px 24px;
  text-align: right;
  font-weight: 800;
  color: var(--primary);
  font-size: 16px;
}

.pl-profit-row {
  background: #0f172a;
  color: #fff;
}

.pl-profit-label {
  padding: 20px 24px;
  font-weight: 700;
  font-size: 16px;
}

.pl-profit-value {
  padding: 20px 24px;
  text-align: right;
  font-weight: 800;
  font-size: 20px;
}

/* ── Print Styles ─────────────────────────────────────────── */
@media print {
  body:not(.receipt-thermal) * {
    visibility: hidden;
  }
  .page-content,
  .card:not(.hide-print) {
    visibility: visible;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    box-shadow: none;
    border: none;
  }
  .card-header,
  .card-body,
  .card-footer,
  table,
  th,
  td,
  tr {
    visibility: visible;
  }
  .btn,
  form,
  .page-header,
  .hide-print {
    display: none !important;
  }
  body {
    background: #fff;
  }
}

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

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i {
  color: var(--primary);
}
.card-body {
  padding: 22px;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

table.pos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.pos-table thead th {
  background: var(--input-bg);
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

table.pos-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
}

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

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success {
  background: #d1fae5;
  color: #065f46;
}
.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}
.badge-warning {
  background: #fef3c7;
  color: #92400e;
}
.badge-info {
  background: #cffafe;
  color: #164e63;
}
.badge-purple {
  background: #ede9fe;
  color: #5b21b6;
}
.badge-gray {
  background: #f1f5f9;
  color: #475569;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-d);
}
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: #059669;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
}
.btn-warning {
  background: var(--warning);
  color: #fff;
}
.btn-outline {
  background: transparent;
  border: 1.5px solid #e2e8f0;
  color: #475569;
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-sm {
  padding: 6px 13px;
  font-size: 12.5px;
}
.btn-xs {
  padding: 4px 10px;
  font-size: 12px;
}
.btn-icon {
  padding: 8px;
}
.btn-ghost {
  background: transparent;
  color: #64748b;
}
.btn-ghost:hover {
  background: #f1f5f9;
  color: #334155;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  background: var(--input-bg);
  border: 1.5px solid var(--border-color);
  border-radius: 9px;
  font-size: 13.5px;
  font-family: var(--font-main);
  color: var(--text-main);
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background-color var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: var(--header-bg);
}

.form-control.is-invalid {
  border-color: var(--danger);
}
.invalid-feedback {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
}
.valid-feedback {
  color: var(--success);
  font-size: 12px;
  margin-top: 4px;
}

.input-group {
  position: relative;
}
.input-group .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 15px;
  pointer-events: none;
}
.input-group .form-control {
  padding-left: 38px;
}
.input-group .input-suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 15px;
  cursor: pointer;
}

select.form-control {
  cursor: pointer;
}
textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-success {
  background: #d1fae5;
  color: #065f46;
  border-left: 3px solid #10b981;
}
.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border-left: 3px solid #ef4444;
}
.alert-warning {
  background: #fef3c7;
  color: #92400e;
  border-left: 3px solid #f59e0b;
}
.alert-info {
  background: #cffafe;
  color: #164e63;
  border-left: 3px solid #06b6d4;
}

/* ── Auth Pages ─────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.auth-left {
  flex: 1;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: "";
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.3), transparent 70%);
  top: -100px;
  right: -100px;
  border-radius: 50%;
}

.auth-left::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2), transparent 70%);
  bottom: -80px;
  left: -80px;
  border-radius: 50%;
}

.auth-branding {
  position: relative;
  z-index: 1;
  text-align: center;
}

.auth-branding .logo-box {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 24px;
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.4);
}

.auth-branding h1 {
  color: var(--text-heading);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.auth-branding p {
  color: #64748b;
  font-size: 15px;
  line-height: 1.7;
  max-width: 340px;
}

.auth-features {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #94a3b8;
  font-size: 13.5px;
}

.auth-feature .af-icon {
  width: 32px;
  height: 32px;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a5b4fc;
  font-size: 14px;
  flex-shrink: 0;
}

.auth-right {
  width: 480px;
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 50px;
}

.auth-box {
  width: 100%;
  max-width: 380px;
}

.auth-box .auth-header {
  margin-bottom: 28px;
}
.auth-box .auth-header h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.5px;
}
.auth-box .auth-header p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.auth-footer-link {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 20px;
}
.auth-footer-link a {
  color: var(--primary);
  font-weight: 600;
}

/* ── OTP Input ──────────────────────────────────────────────── */
.otp-inputs {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}
.otp-field {
  width: 100%;
  max-width: 280px;
  height: 68px;
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 8px;
  text-indent: 8px;
  border-radius: 16px;
  background: var(--input-bg);
  border: 2px solid var(--border-color);
  color: var(--primary);
  font-family: var(--font-mono);
  outline: none;
  transition: all var(--transition);
}
.otp-field:focus {
  background: var(--card-bg);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}
.otp-field::placeholder {
  color: var(--text-muted);
  letter-spacing: 4px;
  font-weight: 400;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 22px;
  border-top: 1px solid #f1f5f9;
  flex-wrap: wrap;
}
.page-btn {
  padding: 6px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all var(--transition);
}
.page-btn:hover,
.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(3px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--card-bg);
  border-radius: 16px;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition:
    transform 0.2s,
    background-color var(--transition);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-color);
}
.modal-overlay.show .modal-box {
  transform: scale(1);
}

.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-heading);
}
.modal-close {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  padding: 4px;
  border-radius: 6px;
  transition: color var(--transition);
}
.modal-close:hover {
  color: var(--danger);
}
.modal-body {
  padding: 24px;
}
.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Dropdown ───────────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--dropdown-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1500;
  padding: 6px;
  display: none;
  transition:
    background-color var(--transition),
    border-color var(--transition);
}
.dropdown-menu.show {
  display: block;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-main);
  cursor: pointer;
  transition: background var(--transition);
}
.dropdown-item:hover {
  background: var(--body-bg);
}
.dropdown-item.danger {
  color: var(--danger);
}
.dropdown-item.danger:hover {
  background: #fee2e2;
}
.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN SYSTEM
   Breakpoints: 1024px | 768px | 640px | 480px | 360px
══════════════════════════════════════════════════════════════ */

/* ────────────────────────────────────────────────────────────
   TABLET (≤ 1024px) — Sidebar becomes slide-in drawer
──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  /* Sidebar: slide-in drawer */
  body.sidebar-minimized {
    --sidebar-w: 260px;
  }
  .sidebar {
    transform: translateX(-100%);
    width: 260px !important;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  .sidebar-minimize-btn {
    display: none !important;
  }

  /* Auth pages */
  .auth-left {
    display: none;
  }
  .auth-right {
    width: 100%;
  }

  /* Restore sidebar nav look on mobile */
  body.sidebar-minimized .nav-link span,
  body.sidebar-minimized .brand-text,
  body.sidebar-minimized .nav-section-label,
  body.sidebar-minimized .nav-arrow,
  body.sidebar-minimized .sidebar-footer .sf-info,
  body.sidebar-minimized .sidebar-footer .sf-logout {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: all !important;
  }
  body.sidebar-minimized .nav-link {
    justify-content: flex-start !important;
    padding: 10px 14px !important;
  }
  body.sidebar-minimized .nav-submenu {
    display: block !important;
  }

  /* Top header */
  .top-header {
    padding: 0 16px;
    gap: 10px;
  }
  .header-search {
    display: none;
  }

  /* Page header */
  .page-header {
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
  }

  /* Card header filters */
  .card-header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .card-header form {
    width: 100%;
    flex-wrap: wrap;
    margin-left: 0 !important;
  }
  .card-header .input-group {
    max-width: none !important;
    flex: 1;
    min-width: 0;
  }
  .card-header select {
    flex: 1;
    min-width: 0;
  }

  /* Dashboard Charts */
  .dashboard-main-chart {
    grid-column: span 1 !important;
  }
  .chart-legend {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Tables: always horizontally scrollable */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ────────────────────────────────────────────────────────────
   TABLET PORTRAIT (≤ 768px)
──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Page content spacing */
  .page-content {
    padding: 20px 16px;
  }

  /* Page header: stack vertically */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }
  .page-header .btn,
  .page-header a.btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  .page-header .header-actions,
  .page-header .d-flex {
    flex-direction: column;
    width: 100%;
  }
  .page-header .card {
    width: 100% !important;
  }

  /* Stat cards: 2 per row */
  .stat-card {
    padding: 16px 18px;
  }
  [style*="grid-template-columns: repeat(auto-fit, minmax(18"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Card header: stack */
  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
  }
  .card-header form {
    flex-direction: column;
    width: 100%;
    margin-left: 0 !important;
    gap: 8px !important;
  }
  .card-header .input-group {
    max-width: 100% !important;
    width: 100% !important;
  }
  .card-header select {
    width: 100% !important;
  }
  .card-header .btn {
    width: 100% !important;
  }
  .card-title {
    font-size: 14px;
  }

  /* Tables */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 14px 14px;
  }
  table.pos-table {
    min-width: 600px;
    font-size: 13px;
  }
  table.pos-table thead th {
    padding: 10px 12px;
    font-size: 10px;
  }
  table.pos-table tbody td {
    padding: 10px 12px;
  }

  /* Chart grid: stack */
  .charts-grid,
  div[style*="grid-template-columns: repeat(auto-fit, minmax(300px"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .dashboard-main-chart {
    grid-column: span 1 !important;
  }

  /* Activity grid: stack */
  .activity-grid,
  div[style*="grid-template-columns: repeat(auto-fit, minmax(320px"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Modal: full width */
  .modal-box {
    width: calc(100vw - 32px) !important;
    max-width: none !important;
    margin: 16px;
  }
  .modal-body {
    padding: 16px;
  }
  .modal-head {
    padding: 16px;
  }
  .modal-foot {
    padding: 12px 16px;
    flex-direction: column;
  }
  .modal-foot .btn {
    width: 100%;
    justify-content: center;
  }

  /* Form grids: stack */
  .form-grid,
  .form-row {
    grid-template-columns: 1fr !important;
  }

  /* Pagination: smaller */
  .pagination {
    gap: 4px;
  }
  .page-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Auth */
  .auth-right {
    padding: 32px 20px;
  }

  /* Dashboard summary inline card */
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }

  /* Report P&L layout */
  .pl-card .card-header {
    text-align: left;
    padding: 16px;
  }
  .pl-row-details {
    padding: 10px 16px 6px 24px;
    font-size: 13px;
  }
  .pl-row-value {
    padding: 10px 16px 6px 16px;
    font-size: 13px;
  }
  .pl-total-label {
    padding: 12px 16px;
    font-size: 13px;
  }
  .pl-total-value {
    padding: 12px 16px;
    font-size: 15px;
  }
  .pl-profit-label,
  .pl-profit-value {
    padding: 14px 16px;
    font-size: 15px;
  }

  /* Supplier / Customer detail layout */
  .detail-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  /* Settings tabs: scrollable */
  .tab-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    gap: 4px;
  }
  .tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* ────────────────────────────────────────────────────────────
   MOBILE (≤ 640px)
──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Page content */
  .page-content {
    padding: 14px;
  }

  /* Top header: compact */
  .top-header {
    padding: 0 12px;
    gap: 8px;
  }
  .header-btn {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  /* Page title */
  .page-title h2 {
    font-size: 18px;
  }
  .page-title p {
    font-size: 12px;
  }

  /* Stat cards: 1 per row */
  .stat-card {
    flex-direction: row;
    align-items: center;
    padding: 14px 16px;
    gap: 12px;
  }
  .stat-icon {
    width: 42px;
    height: 42px;
    font-size: 18px;
    flex-shrink: 0;
    margin-bottom: 0;
  }
  .stat-body {
    text-align: left;
  }
  .stat-value {
    font-size: 18px !important;
  }
  .stat-label {
    font-size: 11px;
  }

  /* Dashboard premium stat cards */
  .stat-card-premium {
    padding: 14px 16px;
    gap: 12px;
  }
  .stat-icon {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }
  .stat-value-p {
    font-size: 20px;
  }
  .stat-label-p {
    font-size: 11px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }

  /* Tables: horizontal scroll, smaller text */
  table.pos-table {
    min-width: 520px;
    font-size: 12.5px;
  }
  table.pos-table thead th {
    padding: 9px 10px;
  }
  table.pos-table tbody td {
    padding: 9px 10px;
  }

  /* Hide lower-priority table columns on mobile */
  .pos-table .col-hide-mobile {
    display: none !important;
  }

  /* Filter form: full width single column */
  .card-header form {
    flex-direction: column;
    gap: 8px !important;
  }
  .card-header select,
  .card-header input,
  .card-header .input-group {
    width: 100% !important;
    max-width: 100% !important;
  }
  .card-header .btn {
    width: 100% !important;
  }

  /* Badges: slightly smaller */
  .badge {
    font-size: 10px;
    padding: 3px 8px;
  }
  .badge-premium {
    font-size: 10px;
    padding: 4px 9px;
  }

  /* Cards */
  .card {
    border-radius: 12px;
  }
  .card-header {
    padding: 14px 16px;
  }
  .card-body {
    padding: 16px;
  }

  /* Chart card */
  .chart-card {
    padding: 16px;
    border-radius: 16px;
  }
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
  }
  .chart-legend {
    flex-wrap: wrap;
    gap: 8px;
  }
  .h-320 {
    height: 240px !important;
  }
  .h-240 {
    height: 200px !important;
  }

  /* Recent table card */
  .recent-table-card {
    border-radius: 16px;
  }

  /* Action button groups: stack */
  .d-flex.gap-4:has(.btn-xs) {
    gap: 4px;
    flex-wrap: wrap;
  }
  .btn-xs {
    padding: 5px 9px;
    font-size: 11px;
  }

  /* Auth */
  .auth-right {
    padding: 24px 16px;
  }

  /* Forms */
  .form-control {
    font-size: 14px;
    padding: 10px 12px;
  }
  .form-label {
    font-size: 13px;
  }

  /* Modals */
  .modal-box {
    width: calc(100vw - 24px) !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-head h4 {
    font-size: 15px;
  }
  .modal-foot {
    flex-direction: column;
    gap: 8px;
  }
  .modal-foot .btn {
    width: 100%;
  }

  /* POS page: compact */
  .pos-layout {
    flex-direction: column !important;
    height: auto !important;
  }

  /* Pagination */
  .pagination {
    gap: 3px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .page-btn {
    padding: 5px 9px;
    font-size: 11px;
    min-width: 32px;
  }

  /* Users page status/role badges compact */
  .user-role,
  .user-status {
    font-size: 10px;
  }

  /* Settings tabs: icon only on small */
  .settings-tab-label {
    display: none;
  }

  /* Inventory adjustments */
  .inv-stat-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }

  /* Dropdown menus: full-width on mobile */
  .card-header .dropdown-menu {
    min-width: 160px;
  }
}

/* ────────────────────────────────────────────────────────────
   SMALL MOBILE (≤ 480px)
──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  /* Page content: minimal padding */
  .page-content {
    padding: 12px;
  }

  /* Stat cards: single column */
  .dashboard-grid,
  [style*="grid-template-columns: repeat(auto-fit, minmax(18"] {
    grid-template-columns: 1fr !important;
  }

  /* Tables: tighter */
  table.pos-table {
    min-width: 440px;
    font-size: 12px;
  }
  table.pos-table thead th {
    padding: 8px 9px;
    font-size: 10px;
  }
  table.pos-table tbody td {
    padding: 8px 9px;
  }

  /* Page title */
  .page-title h2 {
    font-size: 16px;
  }

  /* Top header: very compact */
  .top-header {
    gap: 6px;
  }

  /* Charts: shorter */
  .h-320 {
    height: 200px !important;
  }
  .h-240 {
    height: 180px !important;
  }

  /* Card radius: smaller on tiny screens */
  .card,
  .chart-card,
  .recent-table-card {
    border-radius: 10px;
  }

  /* Tabs: scrollable */
  .tab-list {
    gap: 2px;
    padding-bottom: 4px;
  }
  .tab-btn {
    padding: 7px 12px;
    font-size: 12px;
  }

  /* Modal: full screen */
  .modal-box {
    width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    overflow-y: auto;
  }

  /* Purchases/Sales view page: detail grid */
  .view-detail-grid {
    grid-template-columns: 1fr !important;
  }
  .view-info-card {
    padding: 14px !important;
  }

  /* POS: product grid compact */
  .pos-products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* Pagination */
  .page-btn {
    padding: 5px 7px;
    font-size: 10px;
  }

  /* Report P&L */
  .pl-section-header {
    padding: 8px 12px;
    font-size: 11px;
  }
  .pl-row-details,
  .pl-row-value,
  .pl-total-label,
  .pl-total-value {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* ────────────────────────────────────────────────────────────
   VERY SMALL MOBILE (≤ 360px)
──────────────────────────────────────────────────────────── */
@media (max-width: 360px) {
  .page-content {
    padding: 10px;
  }
  .page-title h2 {
    font-size: 15px;
  }
  .top-header {
    padding: 0 10px;
  }
  .header-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  /* Stat cards: truly single column */
  .stat-card {
    padding: 12px 14px;
    gap: 10px;
  }
  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .stat-value {
    font-size: 16px !important;
  }
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }

  /* Tables */
  table.pos-table {
    min-width: 380px;
    font-size: 11.5px;
  }

  /* Charts */
  .h-320 {
    height: 180px !important;
  }
  .chart-card {
    padding: 12px;
  }

  /* Badges */
  .badge {
    font-size: 9px;
    padding: 2px 6px;
  }

  /* Buttons */
  .btn {
    font-size: 12px;
    padding: 8px 14px;
  }
  .btn-sm {
    font-size: 11px;
    padding: 6px 10px;
  }
  .btn-xs {
    font-size: 10px;
    padding: 4px 7px;
  }
}

/* ── Utility ────────────────────────────────────────────────── */
.text-muted {
  color: var(--text-muted) !important;
}
.text-primary {
  color: var(--primary) !important;
}
.text-success {
  color: var(--success) !important;
}
.text-danger {
  color: var(--danger) !important;
}
.text-warning {
  color: var(--warning) !important;
}
.text-heading {
  color: var(--text-heading) !important;
}
.text-dark {
  color: var(--text-heading) !important;
}
.fw-600 {
  font-weight: 600;
}
.fw-700 {
  font-weight: 700;
}
.fw-800 {
  font-weight: 800;
}
.d-flex {
  display: flex;
}
.flex-column {
  flex-direction: column;
}
.flex-wrap {
  flex-wrap: wrap;
}
.align-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.justify-center {
  justify-content: center;
}
.gap-4 {
  gap: 4px;
}
.gap-8 {
  gap: 8px;
}
.gap-12 {
  gap: 12px;
}
.gap-16 {
  gap: 16px;
}
.gap-20 {
  gap: 20px;
}
.gap-24 {
  gap: 24px;
}
.mb-0 {
  margin-bottom: 0 !important;
}
.mb-8 {
  margin-bottom: 8px !important;
}
.mb-16 {
  margin-bottom: 16px !important;
}
.mb-24 {
  margin-bottom: 24px !important;
}
.mb-30 {
  margin-bottom: 30px !important;
}
.mb-32 {
  margin-bottom: 32px !important;
}
.mt-4 {
  margin-top: 4px !important;
}
.mt-8 {
  margin-top: 8px !important;
}
.mt-10 {
  margin-top: 10px !important;
}
.mt-16 {
  margin-top: 16px !important;
}
.mt-20 {
  margin-top: 20px !important;
}
.mt-24 {
  margin-top: 24px !important;
}
.p-0 {
  padding: 0 !important;
}
.p-16 {
  padding: 16px !important;
}
.p-20 {
  padding: 20px !important;
}
.p-24 {
  padding: 24px !important;
}
.text-center {
  text-align: center !important;
}
.text-right {
  text-align: right !important;
}
.w-100 {
  width: 100% !important;
}
.max-w-800 {
  max-width: 800px;
}
.mono {
  font-family: var(--font-mono);
}
.mono-700 {
  font-family: var(--font-mono);
  font-weight: 700;
}
.rounded-12 {
  border-radius: 12px;
}
.rounded-14 {
  border-radius: 14px;
}
.shadow-primary {
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}
.bg-white {
  background: var(--card-bg) !important;
}
.border-f1 {
  border-bottom: 1px solid var(--border-light);
}
.fs-10 {
  font-size: 10px;
}
.fs-11 {
  font-size: 11px;
}
.fs-12 {
  font-size: 12px;
}
.fs-13 {
  font-size: 13px;
}
.fs-14 {
  font-size: 14px;
}
.fs-15 {
  font-size: 15px;
}
.fs-16 {
  font-size: 16px;
}
.fs-20 {
  font-size: 20px;
}
.fs-28 {
  font-size: 28px;
}
.ls-n05 {
  letter-spacing: -0.5px;
}
.ls-08 {
  letter-spacing: 0.8px;
}
.indent-24 {
  text-indent: 24px;
}
.br-8 {
  border-radius: 8px;
}
.br-3 {
  border-radius: 3px;
}
.wh-12 {
  width: 12px;
  height: 12px;
}
.h-240 {
  height: 240px;
}
.h-320 {
  height: 320px;
}
.relative {
  position: relative;
}

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Toggle sidebar on mobile ───────────────────────────────── */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #334155;
}
@media (max-width: 1024px) {
  .sidebar-toggle {
    display: flex;
  }
}

/* ── Message Admin header button ─────────────────────────────── */
.header-chat-btn:hover {
  background: rgba(99, 102, 241, 0.1) !important;
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}

/* ════════════════════════════════════════════════════════════════
   NOTIFICATION BELL & DROPDOWN
═══════════════════════════════════════════════════════════════════ */
.header-btn .badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 99px;
  padding: 0 3px;
  border: 2px solid var(--header-bg);
}

.notif-dropdown {
  padding: 0 !important;
  overflow: hidden;
  flex-direction: column;
}

/* Override app.js show class to use flex instead of block */
.notif-dropdown.show {
  display: flex !important;
}

.notif-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-weight: 700;
  color: var(--text-heading);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--dropdown-bg);
}

.notif-mark-all {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  transition: background var(--transition);
  display: inline-flex;
  align-items: center;
}
.notif-mark-all:hover {
  background: var(--primary-l);
}

.notif-list {
  overflow-y: auto;
  max-height: 360px;
  background: var(--dropdown-bg);
}

.notif-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.notif-empty i {
  font-size: 28px;
  opacity: 0.4;
}
.notif-empty p {
  font-size: 13px;
}

.notif-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
  color: inherit;
  text-decoration: none;
}
.notif-item:hover {
  background: var(--body-bg);
}
.notif-item:last-child {
  border-bottom: none;
}

.notif-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.notif-body {
  flex: 1;
  min-width: 0;
}
.notif-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-preview {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.notif-badge {
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}

.notif-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--dropdown-bg);
  text-align: center;
}
.notif-footer a {
  font-size: 12.5px;
  color: var(--primary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: opacity var(--transition);
}
.notif-footer a:hover {
  opacity: 0.75;
}

/* ════════════════════════════════════════════════════════════════
   ADMIN CHAT CONSOLE  (ac- prefix = Admin Chat)
═══════════════════════════════════════════════════════════════════ */

/* ── Layout ─────────────────────────────────────────────────── */
.ac-layout {
  display: flex;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
  background: var(--body-bg);
  position: relative;
}

/* ── Mobile Overlay ─────────────────────────────────────────── */
.ac-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 200;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.ac-overlay.show {
  display: block;
  opacity: 1;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.ac-sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--card-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  transition:
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    background-color var(--transition),
    border-color var(--transition);
  z-index: 210;
}

.ac-sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  flex-shrink: 0;
}

.ac-sidebar-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ac-sidebar-icon {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

.ac-sidebar-label {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.ac-sidebar-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 1px;
}

.ac-total-badge {
  background: #fff;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ── Search Box ──────────────────────────────────────────────── */
.ac-search-box {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  flex-shrink: 0;
}
.ac-search-box i {
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
}
.ac-search-box input {
  flex: 1;
  background: var(--body-bg);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-main);
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition);
}
.ac-search-box input:focus {
  border-color: var(--primary);
}
.ac-search-box input::placeholder {
  color: var(--text-muted);
}

/* ── User List ───────────────────────────────────────────────── */
.ac-user-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}
.ac-user-list::-webkit-scrollbar {
  width: 4px;
}
.ac-user-list::-webkit-scrollbar-track {
  background: transparent;
}
.ac-user-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.ac-user-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.ac-empty-anim {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--body-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-muted);
  opacity: 0.5;
  animation: emptyPulse 2s ease-in-out infinite;
}
@keyframes emptyPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}
.ac-user-empty p {
  font-size: 13px;
}

.ac-user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
  position: relative;
}
.ac-user-item:hover {
  background: var(--body-bg);
}
.ac-user-item.active {
  background: var(--primary-l);
  border-left: 3px solid var(--primary);
}
[data-theme="dark"] .ac-user-item.active {
  background: rgba(99, 102, 241, 0.12);
  border-left: 3px solid var(--primary);
}

.ac-user-avatar-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.ac-user-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ac-unread-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  background: var(--success);
  border-radius: 50%;
  border: 2px solid var(--card-bg);
}

.ac-user-meta {
  flex: 1;
  min-width: 0;
}
.ac-um-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.ac-um-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-um-time {
  font-size: 10.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.ac-um-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ac-um-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.ac-unread-badge {
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.ac-initials {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
}

/* ── Main Area ───────────────────────────────────────────────── */
.ac-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--body-bg);
  transition: background-color var(--transition);
}

/* ── Empty State ─────────────────────────────────────────────── */
.ac-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px;
  text-align: center;
}

.ac-empty-graphic {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.ac-empty-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0.15;
  animation: rippleOut 2.5s ease-out infinite;
}
.ac-ring-1 {
  width: 120px;
  height: 120px;
  animation-delay: 0s;
}
.ac-ring-2 {
  width: 90px;
  height: 90px;
  animation-delay: 0.4s;
}
.ac-ring-3 {
  width: 60px;
  height: 60px;
  animation-delay: 0.8s;
}
@keyframes rippleOut {
  0% {
    transform: scale(0.85);
    opacity: 0.25;
  }
  50% {
    transform: scale(1);
    opacity: 0.12;
  }
  100% {
    transform: scale(0.85);
    opacity: 0.25;
  }
}

.ac-empty-center {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.35);
  position: relative;
  z-index: 1;
}

.ac-empty-state h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.5px;
}

.ac-empty-state p {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.6;
}

.ac-open-sidebar-btn {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}
.ac-open-sidebar-btn:hover {
  background: var(--primary-d);
  transform: translateY(-1px);
}

/* ── Chat Window ─────────────────────────────────────────────── */
.ac-chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ── Chat Header ─────────────────────────────────────────────── */
.ac-chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.ac-chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.ac-back-btn {
  display: none;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  background: var(--body-bg);
  border: 1.5px solid var(--border-color);
  border-radius: 9px;
  font-size: 15px;
  color: var(--text-main);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}
.ac-back-btn:hover {
  background: var(--primary-l);
  border-color: var(--primary);
  color: var(--primary);
}

.ac-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.ac-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ac-chat-info {
  min-width: 0;
  flex: 1;
}
.ac-chat-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-chat-email {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.ac-chat-header-right {
  flex-shrink: 0;
}

.ac-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.ac-status-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
  0%,
  100% {
    box-shadow: none;
  }
  50% {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  }
}

/* ── Messages Area ───────────────────────────────────────────── */
.ac-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--body-bg);
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}
.ac-messages::-webkit-scrollbar {
  width: 4px;
}
.ac-messages::-webkit-scrollbar-track {
  background: transparent;
}
.ac-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.ac-date-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 4px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.ac-date-sep::before,
.ac-date-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
}
.ac-date-sep span {
  background: var(--body-bg);
  padding: 0 8px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  white-space: nowrap;
}

.ac-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 68%;
  animation: acMsgIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes acMsgIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.ac-msg.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.ac-msg.theirs {
  align-self: flex-start;
}

.ac-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}
.ac-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ac-msg-bubble {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ac-msg-text {
  padding: 10px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.ac-msg.mine .ac-msg-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ac-msg.theirs .ac-msg-text {
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}
[data-theme="dark"] .ac-msg.mine .ac-msg-text {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
[data-theme="dark"] .ac-msg.theirs .ac-msg-text {
  background: #1e293b;
  border-color: #334155;
}

.ac-msg-time {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}
.ac-msg.mine .ac-msg-time {
  justify-content: flex-end;
}

.ac-no-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 40px;
}

/* ── Input Area ──────────────────────────────────────────────── */
.ac-input-area {
  padding: 14px 20px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--card-bg);
  flex-shrink: 0;
}

.ac-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--body-bg);
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
  padding: 8px 8px 8px 16px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.ac-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ac-input-wrap textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-main);
  font-size: 13.5px;
  color: var(--text-main);
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  min-height: 22px;
  padding-top: 2px;
}
.ac-input-wrap textarea::placeholder {
  color: var(--text-muted);
}

.ac-send-btn {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  transition: all var(--transition);
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.35);
}
.ac-send-btn:hover {
  transform: scale(1.08) translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.45);
}
.ac-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ac-input-hint {
  margin-top: 7px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
}

kbd {
  background: var(--border-color);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-main);
}

/* ════════════════════════════════════════════════════════════════
   FLOATING CHAT WIDGET (Regular Users)
═══════════════════════════════════════════════════════════════════ */
.chat-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1800;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-widget-panel {
  width: 360px;
  height: 500px;
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: panelIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes panelIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.chat-widget-header {
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}

.chat-avatar-wrap {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.chat-initials {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
}

.chat-widget-header-text {
  min-width: 0;
  flex: 1;
}
.chat-widget-header-text div:first-child {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-widget-header-text div:last-child {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 1px;
}

.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--body-bg);
}

.chat-widget-input {
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--card-bg);
}

.chat-widget-input textarea {
  flex: 1;
  background: var(--body-bg);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-main);
  color: var(--text-main);
  outline: none;
  resize: none;
  max-height: 80px;
  transition: border-color var(--transition);
}
.chat-widget-input textarea:focus {
  border-color: var(--primary);
}
.chat-widget-input textarea::placeholder {
  color: var(--text-muted);
}

.chat-widget-input button {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: all var(--transition);
}
.chat-widget-input button:hover {
  background: var(--primary-d);
}
.chat-widget-input button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Widget Message Bubbles */
.widget-date-sep {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 4px 0;
}

.widget-msg {
  display: flex;
  max-width: 85%;
  animation: msgIn 0.2s ease;
}
.widget-msg.mine {
  align-self: flex-end;
  justify-content: flex-end;
}
.widget-msg.theirs {
  align-self: flex-start;
}

.widget-msg-bubble {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.widget-msg-text {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.widget-msg.mine .widget-msg-text {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.widget-msg.theirs .widget-msg-text {
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 3px;
}

.widget-msg-time {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  gap: 3px;
  align-items: center;
}
.widget-msg.mine .widget-msg-time {
  justify-content: flex-end;
}

/* ── Dark Mode Chat Adjustments ──────────────────────────────── */
[data-theme="dark"] .widget-msg.mine .widget-msg-text {
  background: #6366f1;
}
[data-theme="dark"] .widget-msg.theirs .widget-msg-text {
  background: #1e293b;
  border-color: #334155;
}

/* ════════════════════════════════════════════════════════════════
   ADMIN CHAT — RESPONSIVE BREAKPOINTS
═══════════════════════════════════════════════════════════════════ */

/* Tablet: sidebar slightly narrower */
@media (max-width: 1024px) {
  .ac-sidebar {
    width: 280px;
    min-width: 280px;
  }
}

/* Mobile: sidebar becomes a slide-in drawer */
@media (max-width: 768px) {
  /* Sidebar becomes full-height absolute drawer */
  .ac-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: 300px;
    min-width: unset;
    transform: translateX(-100%);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.15);
  }
  .ac-sidebar.open {
    transform: translateX(0);
  }

  /* Main takes full width */
  .ac-main {
    width: 100%;
  }

  /* Show "View Conversations" button on empty state */
  .ac-open-sidebar-btn {
    display: inline-flex;
  }

  /* Show back button inside chat header */
  .ac-back-btn {
    display: flex;
  }

  /* Messages: expand max-width on small screens */
  .ac-msg {
    max-width: 82%;
  }

  /* Input area: less padding */
  .ac-input-area {
    padding: 10px 14px 12px;
  }
  .ac-input-hint {
    display: none;
  }

  /* Chat header padding */
  .ac-chat-header {
    padding: 12px 14px;
  }

  /* Messages area padding */
  .ac-messages {
    padding: 16px 14px;
  }

  /* Widget */
  .chat-widget {
    bottom: 16px;
    right: 16px;
  }
  .chat-widget-panel {
    width: calc(100vw - 32px);
    height: 70vh;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .ac-sidebar {
    width: 290px;
  }
  .ac-msg {
    max-width: 88%;
  }
  .ac-empty-state h2 {
    font-size: 18px;
  }
  .ac-chat-name {
    font-size: 13px;
  }
  .ac-chat-email {
    display: none;
  }
  .ac-status-badge {
    font-size: 10px;
    padding: 3px 8px;
  }
  .ac-um-time {
    display: none;
  }
}

/* Very small screens */
@media (max-width: 360px) {
  .ac-sidebar {
    width: 100vw;
  }
  .ac-msg {
    max-width: 92%;
  }
}

/* -- Consolidated Utility Classes ---------------------------- */
.text-right {
  text-align: right !important;
}
.text-center {
  text-align: center !important;
}
.text-success {
  color: var(--success) !important;
}
.text-danger {
  color: var(--danger) !important;
}
.text-muted {
  color: var(--text-muted) !important;
}
.fw-400 {
  font-weight: 400 !important;
}
.fw-500 {
  font-weight: 500 !important;
}
.fw-600 {
  font-weight: 600 !important;
}
.fw-700 {
  font-weight: 700 !important;
}
.fw-800 {
  font-weight: 800 !important;
}
.d-flex {
  display: flex !important;
}
.d-none {
  display: none !important;
}
.flex-column {
  flex-direction: column !important;
}
.justify-between {
  justify-content: space-between !important;
}
.align-center {
  align-items: center !important;
}
.gap-4 {
  gap: 4px !important;
}
.gap-8 {
  gap: 8px !important;
}
.gap-12 {
  gap: 12px !important;
}
.w-100 {
  width: 100% !important;
}
.m-0 {
  margin: 0 !important;
}
.mt-4 {
  margin-top: 4px !important;
}
.mt-8 {
  margin-top: 8px !important;
}
.mb-8 {
  margin-bottom: 8px !important;
}
.p-0 {
  padding: 0 !important;
}
.p-4 {
  padding: 4px !important;
}
.p-8 {
  padding: 8px !important;
}
.p-16 {
  padding: 16px !important;
}
.pos-relative {
  position: relative !important;
}
.overflow-hidden {
  overflow: hidden !important;
}

/* -- Consolidated From Page-Level Blocks --------------------- */

/* Invoice View Page Styles */
.invoice-page {
  --inv-primary: #6366f1;
  --inv-primary-dark: #4f46e5;
  --inv-text-main: #1e293b;
  --inv-text-muted: #64748b;
  --inv-bg-body: #f8fafc;
  --inv-border: #e2e8f0;
  font-family: "Inter", sans-serif;
  background-color: var(--inv-bg-body);
  color: var(--inv-text-main);
  margin: 0;
  padding: 20px;
  line-height: 1.5;
  min-height: 100vh;
}
.invoice-page .no-print-zone {
  max-width: 900px;
  margin: 0 auto 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.invoice-page .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-size: 14px;
  border: 1px solid transparent;
}
.invoice-page .btn-primary {
  background: var(--inv-primary);
  color: white;
}
.invoice-page .btn-primary:hover {
  background: var(--inv-primary-dark);
}
.invoice-page .btn-outline {
  border-color: var(--inv-border);
  background: white;
  color: var(--inv-text-main);
}
.invoice-page .btn-outline:hover {
  background: #f1f5f9;
}
.invoice-page .invoice-card {
  max-width: 900px;
  margin: 0 auto;
  background: white;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  padding: 40px;
  position: relative;
  overflow: hidden;
}
.invoice-page .invoice-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--inv-primary), #818cf8);
}
.invoice-page .header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 40px;
  align-items: flex-start;
}
.invoice-page .shop-info h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--inv-primary);
}
.invoice-page .shop-info p {
  margin: 4px 0;
  color: var(--inv-text-muted);
  font-size: 14px;
}
.invoice-page .invoice-meta {
  text-align: right;
}
.invoice-page .invoice-meta h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  text-transform: uppercase;
  color: #0f172a;
}
.invoice-page .invoice-meta .ref {
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--inv-primary);
}
.invoice-page .invoice-meta .date {
  color: var(--inv-text-muted);
  font-size: 14px;
  margin-top: 4px;
}
.invoice-page .billing-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
  padding: 24px;
  background: #f1f5f9;
  border-radius: 12px;
}
.invoice-page .info-box h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--inv-text-muted);
  margin-bottom: 12px;
  font-weight: 700;
}
.invoice-page .info-box p {
  margin: 4px 0;
  font-weight: 600;
}
.invoice-page .info-box .name {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}
.invoice-page table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
}
.invoice-page th {
  text-align: left;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 2px solid var(--inv-border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--inv-text-muted);
}
.invoice-page td {
  padding: 16px;
  border-bottom: 1px solid var(--inv-border);
  vertical-align: middle;
}
.invoice-page .product-name {
  font-weight: 700;
  color: #1e293b;
}
.invoice-page .product-sku {
  font-size: 11px;
  color: var(--inv-text-muted);
  font-family: "JetBrains Mono", monospace;
}
.invoice-page .footer-summary {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}
.invoice-page .summary-box {
  width: 300px;
}
.invoice-page .summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
}
.invoice-page .summary-row.total {
  border-top: 2px solid var(--inv-border);
  margin-top: 10px;
  padding-top: 15px;
  color: var(--inv-primary);
  font-weight: 800;
  font-size: 20px;
}
.invoice-page .badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.invoice-page .badge-success {
  background: #d1fae5;
  color: #065f46;
}
.invoice-page .badge-warning {
  background: #fef3c7;
  color: #92400e;
}
.invoice-page .badge-danger {
  background: #fee2e2;
  color: #991b1b;
}
.invoice-page .badge-info {
  background: #e0e7ff;
  color: #3730a3;
}
.invoice-page .note {
  margin-top: 40px;
  padding: 20px;
  border-left: 4px solid var(--inv-border);
  color: var(--inv-text-muted);
  font-size: 14px;
  font-style: italic;
  background: #f8fafc;
}
.invoice-page .watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  font-size: 150px;
  font-weight: 900;
  color: rgba(239, 68, 68, 0.15);
  z-index: 0;
  pointer-events: none;
  text-transform: uppercase;
  white-space: nowrap;
}
@media print {
  .invoice-page {
    padding: 0;
    background: white;
  }
  .invoice-page .no-print {
    display: none !important;
  }
  .invoice-page .invoice-card {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    max-width: 100%;
  }
  .invoice-page .invoice-card::before {
    display: none;
  }
  .invoice-page .watermark {
    color: rgba(239, 68, 68, 0.1) !important;
  }
}

/* POS Terminal Styles (Consolidated from sales/pos.php) */
.pos-wrap {
  display: flex;
  height: calc(100vh - var(--header-h));
  gap: 20px;
  padding: 20px;
  background: var(--body-bg);
  width: 100%;
  transition: background-color var(--transition);
}
.pos-products-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  min-width: 0;
}
.pos-filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.pos-filter-search {
  flex: 1;
  min-width: 200px;
}
.pos-filter-cat {
  width: 200px;
}
.pos-grid {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}
.unit-tooltip {
  position: relative;
  cursor: help;
}
.unit-tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: 0.2s;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.unit-tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}
.pos-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 14px;
}
.pos-cart-panel {
  width: 380px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}
.pos-cart-fab {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 600;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.pos-cart-fab:hover {
  transform: scale(1.04);
}
.pos-cart-fab-count {
  background: #fff;
  color: var(--primary);
  border-radius: 50px;
  font-size: 12px;
  font-weight: 800;
  padding: 1px 8px;
  min-width: 22px;
  text-align: center;
}
.pos-cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 700;
}
.pos-cart-overlay.active {
  display: block;
}
.pos-cart-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 710;
  border-radius: 20px 20px 0 0;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.pos-cart-drawer.open {
  transform: translateY(0);
}
.pos-item-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
  text-align: center;
  position: relative;
}
.pos-item-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--card-shadow);
}
.pos-item-card.disabled {
  filter: grayscale(1);
  cursor: not-allowed;
  opacity: 0.6;
}
.pos-item-img {
  height: 72px;
  width: 100%;
  background: var(--input-bg);
  border-radius: 8px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--text-muted);
}
.pos-item-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-heading);
  line-height: 1.3;
  margin-bottom: 5px;
  height: 34px;
  overflow: hidden;
}
.pos-item-price {
  font-size: 15px;
  color: var(--primary);
  font-weight: 800;
}
.pos-item-stock {
  font-size: 11px;
  margin-top: 5px;
  background: var(--input-bg);
  padding: 3px;
  border-radius: 4px;
}
.cart-row {
  display: flex;
  padding: 12px;
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  gap: 12px;
}
.qty-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
@media (max-width: 960px) {
  .pos-cart-panel {
    width: 320px;
  }
  .pos-items-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }
}
@media (max-width: 768px) {
  .pos-wrap {
    padding: 12px;
    gap: 0;
  }
  .pos-cart-panel {
    display: none;
  }
  .pos-products-panel {
    height: 100%;
    padding-bottom: 80px;
  }
  .pos-cart-fab {
    display: flex;
  }
  .pos-items-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .pos-filter-cat {
    width: 100%;
  }
}
@media (max-width: 480px) {
  .pos-items-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .pos-item-img {
    height: 56px;
    font-size: 22px;
  }
  .pos-item-name {
    font-size: 12px;
    height: 30px;
  }
  .pos-item-price {
    font-size: 13px;
  }
  .pos-wrap {
    padding: 10px;
  }
}
@media (max-width: 360px) {
  .pos-items-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .pos-item-card {
    padding: 10px;
  }
}

/* 80mm Thermal Receipt Styles (Consolidated from receipt.php) */
.receipt-thermal {
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  color: #000;
  background: #fff;
  width: 80mm;
  max-width: 80mm;
  padding: 4mm 3mm;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid #ddd;
}
.receipt-thermal .shop-name {
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 2px;
}
.receipt-thermal .shop-sub {
  font-size: 10px;
  text-align: center;
  color: #555;
}
.receipt-thermal .divider {
  border: none;
  border-top: 1px dashed #000;
  margin: 6px 0;
}
.receipt-thermal .divider-solid {
  border: none;
  border-top: 2px solid #000;
  margin: 6px 0;
}
.receipt-thermal .row {
  display: flex;
  font-size: 11px;
  line-height: 1.5;
  align-items: flex-start;
}
.receipt-thermal .row-header {
  display: flex;
  font-size: 10px;
  font-weight: bold;
  border-bottom: 1px solid #000;
  padding-bottom: 3px;
  margin-bottom: 3px;
  align-items: center;
}
.receipt-thermal .item-name {
  flex: 1;
  font-size: 11px;
  line-height: 1.3;
  padding-right: 6px;
  word-break: break-word;
}
.receipt-thermal .item-qty {
  width: 50px;
  text-align: left;
  word-break: break-all;
}
.receipt-thermal .item-price {
  width: 60px;
  text-align: right;
}
.receipt-thermal .item-total {
  width: 65px;
  text-align: right;
  font-weight: bold;
}
.receipt-thermal .total-label {
  font-weight: bold;
  flex: 1;
  text-align: right;
  padding-right: 15px;
}
.receipt-thermal .grand-total {
  font-size: 15px;
  font-weight: bold;
}
.receipt-thermal .footer {
  font-size: 10px;
  text-align: center;
  color: #333;
  margin-top: 8px;
  line-height: 1.6;
}
.receipt-thermal .badge-paid {
  font-size: 10px;
  font-weight: bold;
}
.receipt-thermal .qr-note {
  font-size: 9px;
  text-align: center;
  color: #888;
  margin-top: 6px;
}
.receipt-thermal .print-btn {
  display: block;
  width: 60mm;
  margin: 16px auto;
  padding: 10px;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  font-weight: bold;
}
.receipt-thermal .close-btn {
  display: block;
  width: 60mm;
  margin: 6px auto;
  padding: 8px;
  background: #e2e8f0;
  color: #334155;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
/* Report-specific Styles (Trial Balance, Monthly Profit, etc.) */
.tb-section-header {
  background: var(--body-bg);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--primary);
  padding: 10px 20px;
  border-top: 2px solid var(--primary);
}
.tb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 24px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  transition: background 0.1s;
}
.tb-row:hover {
  background: var(--body-bg);
}
.tb-row-label {
  color: var(--text-muted);
}
.tb-row-label span {
  font-size: 11px;
  display: block;
  color: var(--text-muted);
  opacity: 0.7;
}
.tb-debit {
  font-weight: 700;
  color: var(--text-heading);
  text-align: right;
  min-width: 130px;
}
.tb-credit {
  font-weight: 700;
  color: var(--success);
  text-align: right;
  min-width: 130px;
}
.tb-neutral {
  font-weight: 700;
  color: var(--primary);
  text-align: right;
  min-width: 130px;
}
.tb-danger {
  font-weight: 700;
  color: var(--danger);
  text-align: right;
  min-width: 130px;
}
.tb-subtotal {
  display: flex;
  justify-content: space-between;
  padding: 10px 24px;
  background: rgba(99, 102, 241, 0.05);
  font-size: 13px;
  font-weight: 700;
  border-top: 1px solid var(--border-color);
}
.tb-grand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-top: 3px solid var(--border-color);
  font-size: 15px;
  font-weight: 800;
}
.balance-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 900px) {
  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 500px) {
  .kpi-strip {
    grid-template-columns: 1fr;
  }
}
.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 20px;
}
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-heading);
}
.report-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  height: 100%;
  transition: transform 0.2s;
}
.report-stat-card:hover {
  transform: translateY(-4px);
}
.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-heading);
}
.stat-diff {
  font-size: 12px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
@media (max-width: 1200px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}
.profit-chart-bar {
  height: 8px;
  border-radius: 4px;
  background: #e2e8f0;
  overflow: hidden;
  margin: 12px 0;
}
.profit-chart-fill {
  height: 100%;
  background: var(--primary);
}
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}
.detail-row:last-child {
  border-bottom: none;
}
.detail-label {
  color: var(--text-muted);
}
.detail-value {
  font-weight: 600;
  color: var(--text-heading);
}
.badge-profit {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
}
.badge-loss {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
}
@media print {
  .hide-print,
  .page-header .btn,
  nav,
  .sidebar,
  .top-header,
  .sidebar-overlay {
    display: none !important;
  }
  .page-content {
    padding: 0 !important;
  }
  body {
    background: white !important;
  }
}

/* Inventory Valuation Report Styles */
.val-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  height: 100%;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.val-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}
.val-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}
.val-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.val-amount {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-heading);
  margin-top: 4px;
}
.val-diff {
  font-size: 11px;
  margin-top: 8px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
}
.cat-row {
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
  cursor: pointer;
}
.cat-row:hover {
  background: var(--body-bg);
  border-left: 3px solid var(--primary);
  padding-left: 13px;
}
.cat-name {
  font-weight: 700;
  color: var(--text-heading);
  font-size: 14px;
}
.cat-stats {
  display: flex;
  gap: 32px;
  text-align: right;
}
.cat-stat-item {
  min-width: 100px;
}
.cat-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 2px;
}
.cat-stat-val {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-heading);
}

/* EOD Report Styles */
.eod-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 992px) {
  .eod-grid {
    grid-template-columns: 1fr;
  }
}
.date-input-v2 {
  width: 180px;
}
@media (max-width: 576px) {
  .date-input-v2 {
    width: 100%;
  }
}

.eod-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1200px) {
  .eod-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 576px) {
  .eod-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.eod-banner {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 14px;
  padding: 20px 28px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  gap: 20px;
}
.eod-banner-stats {
  text-align: right;
}
@media (max-width: 576px) {
  .eod-banner {
    flex-direction: column;
    text-align: center;
    padding: 24px;
  }
  .eod-banner-stats {
    text-align: center;
  }
}

.eod-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}
.eod-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.eod-kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}
.eod-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.eod-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.eod-kpi-icon i {
  font-size: 20px;
}
.eod-kpi-info {
  min-width: 0;
}
.eod-kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eod-kpi-value {
  font-size: 16px;
  font-weight: 800;
}

.eod-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}
.eod-row:last-child {
  border-bottom: none;
}
.eod-total {
  display: flex;
  justify-content: space-between;
  padding: 14px 0 0;
  font-size: 16px;
  font-weight: 700;
  border-top: 2px solid var(--border-color);
  margin-top: 8px;
}
.method-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}
.pill-cash {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}
.pill-bank {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}
.pill-mobile {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}
.pill-credit {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Barcode Label Generator Styles */
.blg-wrap {
  display: flex;
  gap: 24px;
  align-items: start;
}
.blg-list {
  flex: 1;
  min-width: 0;
}
.blg-panel {
  width: 320px;
  flex-shrink: 0;
  position: sticky;
  top: 24px;
}

@media (max-width: 1100px) {
  .blg-wrap {
    flex-direction: column;
  }
  .blg-panel {
    width: 100%;
    position: static;
  }
}
.blg-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px 18px;
}
.blg-toolbar-title {
  font-weight: 800;
  font-size: 15px;
  color: var(--text-heading);
  flex: 1;
}
.blg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

@media (max-width: 640px) {
  .blg-toolbar {
    padding: 12px;
    gap: 8px;
  }
  .blg-toolbar-title {
    width: 100%;
    margin-bottom: 4px;
    flex: none;
  }
  .blg-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
}
.blg-card {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.blg-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.12);
}
.blg-card.selected-piece {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.04);
}
.blg-card.selected-box {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}
.blg-card.selected-both {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}
.blg-check {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
}
.blg-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  transition: 0.15s;
  border: 2px solid var(--border-color);
  background: var(--input-bg);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.blg-badge.active-p {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}
.blg-badge.active-b {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.blg-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-heading);
  margin-bottom: 6px;
  line-height: 1.3;
  padding-right: 48px; /* space for badges */
}
.blg-prices {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.blg-price-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}
.blg-price-tag.pcs {
  background: rgba(16, 185, 129, 0.12);
  color: #065f46;
}
.blg-price-tag.box {
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
}
.blg-sku {
  font-size: 10px;
  color: var(--text-muted);
  font-family: monospace;
  margin-top: 6px;
}
.type-btn {
  flex: 1;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  background: var(--input-bg);
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: 0.15s;
}
.type-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.type-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.type-btn.green {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}
.type-btn.amber {
  background: #f59e0b;
  color: #fff;
  border-color: #f59e0b;
}
.sel-counter {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}
.sel-counter strong {
  color: var(--text-heading);
  font-size: 20px;
  display: block;
}
.blg-search {
  position: relative;
  margin-bottom: 14px;
}
.blg-search input {
  padding-left: 38px;
}
.blg-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Product Create/Edit Forms */
.prd-outer-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
.prd-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.prd-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.prd-unit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.prd-price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.prd-sku-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.profit-preview-bar {
  margin-top: 16px;
  padding: 14px 18px;
  background: rgba(16, 185, 129, 0.08);
  border-radius: 12px;
  border-left: 4px solid var(--success);
}
.profit-preview-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.profit-stat-label {
  font-size: 11px;
  color: var(--text-muted);
}
.profit-stat-value {
  font-weight: 800;
  font-size: 17px;
}
.prd-sticky-save {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  z-index: 500;
  gap: 10px;
}
@media (max-width: 900px) {
  .prd-outer-grid {
    grid-template-columns: 1fr;
  }
  .prd-right .card:first-child {
    order: -1;
  }
}
@media (max-width: 640px) {
  .prd-unit-grid {
    grid-template-columns: 1fr 1fr;
  }
  .prd-price-grid {
    grid-template-columns: 1fr;
  }
  .prd-sku-grid {
    grid-template-columns: 1fr;
  }
  .prd-sticky-save {
    display: flex;
  }
  .prd-save-card {
    display: none;
  }
}

/* -- Modal System -------------------------------------------- */
.modal,
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.show,
.modal-overlay.show {
  display: flex;
}
.modal-content,
.modal-box {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 500px;
  position: relative;
  overflow: hidden;
}
.modal-header,
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3,
.modal-head h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-heading);
}
.modal-body {
  padding: 20px;
}
.modal-close {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  transition: color 0.2s;
}
.modal-close:hover {
  color: var(--danger);
}

/* Searchable Select Stylings */
.searchable-select-wrapper {
  position: relative;
  width: 100%;
}
.searchable-select-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
  color: var(--text-main);
  font-weight: 500;
}
.searchable-select-display:hover {
  border-color: var(--primary);
}
.searchable-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  margin-top: 6px;
  background: var(--dropdown-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideInDown 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.searchable-select-dropdown.show {
  display: flex;
}
.searchable-select-search {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  background: rgba(0, 0, 0, 0.02);
}
.searchable-select-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: var(--card-bg);
  color: var(--text-main);
  transition: var(--transition);
}
.searchable-select-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-l);
}
.searchable-select-list {
  max-height: 250px;
  overflow-y: auto;
  padding: 6px;
}
.searchable-select-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  border-radius: 8px;
  transition: all 0.15s;
  color: var(--text-main);
}
.searchable-select-item:hover {
  background: var(--border-light);
  color: var(--primary);
  transform: translateX(4px);
}
.searchable-select-item.selected {
  background: var(--primary-l);
  color: var(--primary);
  font-weight: 700;
}
.searchable-select-item.hidden {
  display: none;
}
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
