/* =====================================================================
   QWICKPOS — ENTERPRISE UI v3 (SAP Fiori / Dynamics 365 inspired)
   Professional, clean, card-based design system for ERP productivity.
   ===================================================================== */

/* ---------- 0. DESIGN TOKENS ---------- */
:root {
  /* Brand palette — enterprise blue */
  --brand: #1e4e8c;
  --brand-dark: #163d6f;
  --brand-darker: #0f2e54;
  --brand-light: #e8f0fa;
  --brand-lighter: #f4f8fd;
  --brand-glow: rgba(30, 78, 140, 0.10);
  --accent: #2563eb;
  --accent-dark: #1d4ed8;

  /* Semantic */
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --danger-glow: rgba(220, 38, 38, 0.10);
  --warning: #d97706;
  --warning-light: #fffbeb;
  --warning-glow: rgba(217, 119, 6, 0.10);
  --info: #2563eb;
  --info-light: #eff6ff;
  --info-glow: rgba(37, 99, 235, 0.10);
  --success: #16a34a;
  --success-light: #f0fdf4;
  --success-glow: rgba(22, 163, 74, 0.10);

  /* Neutrals — enterprise palette */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --surface-3: #e9ecf0;
  --sidebar-bg: #1a2332;
  --sidebar-surface: #232e3f;
  --sidebar-hover: #2c3a4e;
  --border: #e2e6ea;
  --border-strong: #c9ced4;
  --text: #1a2332;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;

  /* Radii */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --radius-pill: 999px;

  /* Enterprise shadows — flat, subtle */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.10), 0 6px 16px rgba(0, 0, 0, 0.06);
  --shadow-focus: 0 0 0 3px rgba(30, 78, 140, 0.20);
  --shadow-brand: 0 4px 14px rgba(30, 78, 140, 0.25);
  --brand-deep: #0a1628;

  /* Layout */
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 72px;
  --topbar-h: 56px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 0.15s;
  --dur: 0.25s;
  --dur-slow: 0.35s;

  /* Typography — enterprise scale */
  font-size: 15px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Courier New", monospace;

  /* Spacing system (8px base) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
}

/* ---------- DARK MODE ---------- */
[data-theme="dark"] {
  --brand: #60a5fa;
  --brand-dark: #3b82f6;
  --brand-darker: #2563eb;
  --brand-light: rgba(96, 165, 250, 0.12);
  --brand-lighter: rgba(96, 165, 250, 0.10);
  --brand-glow: rgba(96, 165, 250, 0.15);

  --danger: #f87171;
  --danger-light: rgba(248, 113, 113, 0.10);
  --danger-glow: rgba(248, 113, 113, 0.15);
  --warning: #fbbf24;
  --warning-light: rgba(251, 191, 36, 0.10);
  --warning-glow: rgba(251, 191, 36, 0.15);
  --info: #60a5fa;
  --info-light: rgba(96, 165, 250, 0.10);
  --info-glow: rgba(96, 165, 250, 0.15);
  --success: #4ade80;
  --success-light: rgba(74, 222, 128, 0.10);
  --success-glow: rgba(74, 222, 128, 0.15);

  --bg: #0f1729;
  --surface: #1a2332;
  --surface-2: #232e3f;
  --surface-3: #2c3a4e;
  --sidebar-bg: #0f1729;
  --sidebar-surface: #1a2332;
  --sidebar-hover: #232e3f;
  --border: #232e3f;
  --border-strong: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.20);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.30), 0 2px 4px rgba(0, 0, 0, 0.20);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.40), 0 6px 16px rgba(0, 0, 0, 0.30);
  --shadow-focus: 0 0 0 3px rgba(96, 165, 250, 0.25);
  --shadow-brand: 0 4px 14px rgba(96, 165, 250, 0.3);
  --brand-deep: #050d1a;
}

/* Dark mode overrides for brand topbar and sidebar */
[data-theme="dark"] .topbar-right .topbar-btn .badge-dot {
  border-color: var(--sidebar-bg);
}
[data-theme="dark"] .sidebar {
  background: var(--surface);
  border-color: var(--border);
}

/* ---------- 1. RESET & BASE ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  line-height: 1.5;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
a { color: inherit; text-decoration: none; }

/* Custom scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ---------- 2. LAYOUT / APP SHELL ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  padding-top: var(--topbar-h);
}

/* Top Navigation Bar — brand background */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--brand);
  border-bottom: 2px solid var(--brand-dark);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  gap: var(--space-md);
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.topbar-left .logo-wrap {
  width: 30px;
  height: 30px;
  background: #fff;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar-left .logo-wrap img {
  width: 20px;
  height: 20px;
  display: block;
}
.topbar-left .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.topbar-left .business-name {
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-left .branch-sub {
  font-size: 10.5px;
  color: rgba(255,255,255,0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-divider {
  width: 1px;
  height: 26px;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
  margin: 0 var(--space-xs);
}
.topbar-center {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-pill);
  padding: 6px 20px;
  margin: 0 var(--space-lg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}
.topbar-right .topbar-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  transition: all var(--dur-fast) var(--ease);
  position: relative;
}
.topbar-right .topbar-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.topbar-right .topbar-btn .badge-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--brand);
}
.topbar-right .user-chip {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 3px 10px 3px 3px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  background: rgba(255,255,255,0.1);
  font-size: 12.5px;
}
.topbar-right .user-chip:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.35);
}
.topbar-right .user-chip .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
}
.topbar-right .user-chip .user-name {
  font-weight: 600;
  color: #fff;
}
.topbar-right .user-chip .user-role {
  font-size: 10.5px;
  color: rgba(255,255,255,0.55);
}

/* Picker selects on brand topbar */
.topbar select {
  background: rgba(255,255,255,0.12) !important;
  color: #fff !important;
  border-color: rgba(255,255,255,0.25) !important;
}
.topbar select option {
  background: var(--surface);
  color: var(--text);
}

/* ---------- 3. SIDEBAR ---------- */
.sidebar {
  width: var(--sidebar-collapsed-w);
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: calc(var(--topbar-h) + var(--space-sm));
  left: var(--space-sm);
  bottom: var(--space-sm);
  height: calc(100vh - var(--topbar-h) - var(--space-sm) * 2);
  overflow-y: auto;
  overflow-x: visible;
  z-index: 40;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: width var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease);
  will-change: width;
}
body.sidebar-expanded .sidebar {
  width: var(--sidebar-w);
  box-shadow: var(--shadow-md);
}

/* ── Sidebar scrollbar ── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--brand); border-radius: 4px; }
.sidebar { scrollbar-width: thin; scrollbar-color: var(--brand) transparent; }

.sidebar-inner {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Nav items — flat, clean enterprise style ── */
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  box-shadow: none;
  width: 100%;
  text-align: left;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  position: relative;
  white-space: nowrap;
  height: 36px;
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav-link.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}
body.sidebar-expanded .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}

/* Nav icons — brand background */
.nav-link .icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  transition: background var(--dur-fast) var(--ease);
}
.nav-link:hover .icon {
  background: var(--brand-dark);
}
.nav-link.active .icon {
  background: var(--brand-dark);
}
.nav-link.nav-link-locked {
  opacity: 0.40;
}
.nav-link.nav-link-locked::after {
  content: "\1F512";
  margin-left: auto;
  font-size: 10px;
  opacity: 0.5;
}

/* ── Expanded state ── */
body.sidebar-expanded .sidebar-inner .nav-link {
  height: 38px;
  padding: 8px 10px;
  gap: 10px;
  border-radius: 8px;
}
body.sidebar-expanded .sidebar-inner .nav-link.active {
  font-weight: 600;
}

/* Expanded child nav items */
body.sidebar-expanded .sidebar-inner .nav-children .nav-link .icon {
  width: 30px;
  height: 30px;
  font-size: 14px;
  background: var(--brand-light);
  color: var(--brand);
  border-radius: 6px;
}
body.sidebar-expanded .sidebar-inner .nav-children .nav-link:hover .icon {
  background: var(--brand);
  color: #fff;
}
body.sidebar-expanded .sidebar-inner .nav-children .nav-link.active .icon {
  background: var(--brand);
  color: #fff;
}

.nav-label {
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  pointer-events: none;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}
body.sidebar-expanded .nav-label {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.nav-chevron {
  margin-left: auto;
  font-size: 9px;
  opacity: 0;
  transition: opacity 0.25s var(--ease), transform 0.3s var(--ease);
  color: var(--text-muted);
}
body.sidebar-expanded .nav-chevron {
  opacity: 0.5;
}
.nav-module.open > .nav-parent .nav-chevron {
  transform: rotate(90deg);
}

.nav-badge {
  margin-left: auto;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  line-height: 16px;
  min-width: 18px;
  text-align: center;
}

/* ── Nav Modules ── */
.nav-module {
  position: relative;
}
.nav-children {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s var(--ease), opacity 0.2s var(--ease);
  opacity: 0;
}
.nav-module.open > .nav-children {
  max-height: 400px;
  opacity: 1;
}
.nav-children .nav-link {
  padding-left: 56px;
  font-size: 12.5px;
  font-weight: 400;
  height: 34px;
  color: var(--text-muted);
  border-radius: 6px;
  border-left: 2px solid var(--border);
  margin-left: 12px;
}
.nav-children .nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}
.nav-children .nav-link.active {
  color: var(--brand);
  background: var(--brand-light);
  font-weight: 500;
}
.nav-children .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}

/* ── Sidebar footer ── */
.sidebar-footer {
  margin-top: auto;
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--border);
}
.sidebar-footer .btn {
  font-size: 12.5px;
  height: 38px;
  color: var(--text-muted);
  border-color: var(--border);
  background: var(--surface);
}
.sidebar-footer .btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

/* ── Collapsed: fly-out submenu on hover ── */
body:not(.sidebar-expanded) .nav-module {
  position: relative;
}
body:not(.sidebar-expanded) .nav-module .nav-children {
  position: fixed;
  left: calc(var(--sidebar-collapsed-w) + var(--space-sm) + 12px);
  top: auto;
  width: 240px;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  max-height: none;
  overflow: visible;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s var(--ease), visibility 0.18s var(--ease);
  z-index: 200;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
body:not(.sidebar-expanded) .nav-module:hover .nav-children {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body:not(.sidebar-expanded) .nav-children .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 6px 10px 6px 48px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  white-space: nowrap;
  border-radius: 6px;
  border-left: none;
  margin-left: 0;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
body:not(.sidebar-expanded) .nav-children .nav-link .icon {
  width: 30px;
  height: 30px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--brand-light);
  color: var(--brand);
  border-radius: 6px;
}
body:not(.sidebar-expanded) .nav-children .nav-link:hover {
  background: var(--surface-2);
  color: var(--brand);
}
body:not(.sidebar-expanded) .nav-children .nav-link.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
  box-shadow: none;
}
body:not(.sidebar-expanded) .nav-children .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}

/* ── Nav link tooltip when collapsed ── */
body:not(.sidebar-expanded) .nav-link::before,
body:not(.sidebar-expanded) .nav-parent::before {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  color: var(--text);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
  box-shadow: var(--shadow-md);
  z-index: 200;
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
body:not(.sidebar-expanded) .nav-link:hover::before,
body:not(.sidebar-expanded) .nav-parent:hover::before {
  opacity: 1;
}
/* Don't show tooltip for modules that have a fly-out (the fly-out replaces it) */
body:not(.sidebar-expanded) .nav-module:hover .nav-parent::before {
  opacity: 0;
  pointer-events: none;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

/* ── Sidebar collapse toggle ── */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  flex-shrink: 0;
  font-size: 12px;
}
.sidebar-collapse-btn:hover {
  background: rgba(255,255,255,0.14);
  color: #fff;
}


.offline-pill {
  display: none;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  background: rgba(0,0,0,0.04);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
  font-weight: 500;
}
.offline-pill.show { display: flex; }
.offline-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse-dot 1.8s ease-in-out infinite;
}
.offline-pill.offline-pill-danger {
  background: rgba(220,38,38,0.15);
  color: #fca5a5;
}
.offline-pill.offline-pill-danger .dot {
  background: var(--danger);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes sidebar-flash {
  0% { box-shadow: 0 0 0 0 var(--sidebar-bg-glow, rgba(15, 107, 74, 0.4)); }
  50% { box-shadow: 0 0 20px 4px var(--sidebar-bg-glow, rgba(15, 107, 74, 0.4)); }
  100% { box-shadow: var(--shadow); }
}
.sidebar-flash {
  animation: sidebar-flash 0.8s ease-out;
}

/* ---------- 4. MAIN CONTENT / TOPBAR ---------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: calc(var(--sidebar-collapsed-w) + var(--space-md));
  margin-right: var(--space-sm);
  transition: margin-left var(--dur-slow) var(--ease);
}
body.sidebar-expanded .main {
  margin-left: calc(var(--sidebar-w) + var(--space-md));
}

.menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #fff;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast);
}
.menu-btn:hover { background: rgba(255,255,255,0.12); }

/* Keep legacy topbar-cta styles for backward compat */
.topbar-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255,255,255,0.25);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.topbar-cta:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.4);
}
.topbar-cta .cta-icon { font-size: 14px; }
.topbar-cta-group { display: flex; gap: 8px; margin-left: 8px; }
.topbar h1 { display: none; }
.topbar .spacer { flex: 1; }

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--dur-fast) var(--ease);
}
.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.icon-btn:active { transform: translateY(0); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--dur-fast) var(--ease);
}
.user-chip:hover {
  border-color: var(--border);
  background: var(--surface-3);
}
.user-chip .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.user-chip .role {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: capitalize;
  font-weight: 500;
}

/* ---------- 5. VIEW CONTAINER ---------- */
.view {
  padding: var(--space-sm) 24px 24px 24px;
  flex: 1;
  min-width: 0;
  animation: fadeInUp var(--dur) var(--ease-out);
}
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.view-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.view-header p.sub {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------- 6. GRID HELPERS & MINI CHARTS ---------- */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
@media (max-width: 980px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
.dash-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
@media (max-width: 640px) {
  .dash-charts { grid-template-columns: 1fr; }
}

.mini-chart { display: flex; align-items: flex-end; gap: 6px; height: 100px; padding-top: 8px; }

/* ---------- 7. ENTERPRISE BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
  height: 44px;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-primary:hover {
  background: var(--brand-dark);
  box-shadow: var(--shadow-focus);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-lighter);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 75%, #000);
  box-shadow: 0 0 0 3px var(--danger-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  height: auto;
  padding: 6px 10px;
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-sm { height: 36px; padding: 6px 14px; font-size: 12.5px; }
.btn-block { width: 100%; }

@media (max-width: 640px) {
  .btn { height: 48px; padding: 12px 20px; font-size: 14px; }
  .btn-sm { height: 40px; padding: 8px 14px; font-size: 13px; }
}

/* ---------- 8. PAGE HEADER ---------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}
.page-header-info h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.page-header-info p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 4px 0 0;
}
.page-header-actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .page-header { flex-direction: column; gap: var(--space-sm); }
  .page-header-info h1 { font-size: 22px; }
  .page-header-info p { font-size: 13px; }
}

/* ---------- 9. ENTERPRISE CARDS ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  box-shadow: var(--shadow);
  transition: box-shadow var(--dur-fast) var(--ease);
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.card + .card {
  margin-top: var(--space-lg);
}

/* ---------- 10. ENTERPRISE TABLES ---------- */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table-wrap thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.table-wrap th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.table-wrap td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table-wrap tbody tr:hover {
  background: var(--surface-2);
}
.table-wrap tbody tr:last-child td {
  border-bottom: none;
}
.table-wrap tbody tr.active {
  background: var(--brand-light);
}

/* ---------- 11. STATUS BADGES ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.01em;
  height: 24px;
  white-space: nowrap;
}
.badge-green { background: var(--success-light); color: var(--success); }
.badge-blue { background: var(--info-light); color: var(--info); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-gray { background: var(--surface-2); color: var(--text-muted); }
[data-theme="dark"] .badge-green { background: rgba(74,222,128,0.1); color: #4ade80; }
[data-theme="dark"] .badge-red { background: rgba(248,113,113,0.1); color: #f87171; }
[data-theme="dark"] .badge-yellow { background: rgba(251,191,36,0.1); color: #fbbf24; }
[data-theme="dark"] .badge-blue { background: rgba(96,165,250,0.1); color: #60a5fa; }
[data-theme="dark"] .badge-gray { background: rgba(148,163,184,0.1); color: #94a3b8; }

.text-success { color: var(--success, #22c55e); }
.text-danger { color: var(--danger, #ef4444); }

/* ---------- 12. KPIs / METRIC CARDS ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: var(--space-lg);
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--dur-fast) var(--ease);
}
.kpi-card:hover {
  box-shadow: var(--shadow-md);
}
.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--surface-2);
}
.kpi-content { flex: 1; min-width: 0; }
.kpi-content .label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-content .value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-top: 1px;
  letter-spacing: -0.02em;
}
.kpi-content .delta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}
.kpi-content .delta.up { color: var(--success); }
.kpi-content .delta.down { color: var(--danger); }

/* ═══════════ EXECUTIVE KPI GROUPS (v2) ═══════════ */
.kpi-groups { display: flex; flex-direction: column; gap: 18px; }
.kpi-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 2px; padding-left: 2px;
}
.kpi-group { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi-main-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow); transition: box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  cursor: pointer; position: relative; overflow: hidden;
}
.kpi-main-card:hover { box-shadow: var(--shadow-md); }
.kpi-main-card.kpi-active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-glow, rgba(59,130,246,0.12)); }
.kpi-top-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kpi-emoji { font-size: 18px; line-height: 1; flex-shrink: 0; }
.kpi-badge {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 20px;
  white-space: nowrap; line-height: 1.4;
}
.kpi-badge.kpi-up { background: #dcfce7; color: #166534; }
.kpi-badge.kpi-down { background: #fee2e2; color: #991b1b; }
.kpi-badge.kpi-neutral { background: #f1f5f9; color: #64748b; }
.kpi-label { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.02em; }
.kpi-value { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -0.03em; line-height: 1.15; }
.kpi-sub { font-size: 10.5px; color: var(--text-muted); line-height: 1.3; }
.kpi-sub b { font-weight: 600; }
.kpi-sparkline { margin-top: 4px; height: 28px; width: 100%; }
.kpi-sparkline svg { width: 100%; height: 100%; display: block; }

/* Group accent stripe */
.kpi-group--revenue .kpi-main-card { border-top: 2.5px solid #3b82f6; }
.kpi-group--orders .kpi-main-card { border-top: 2.5px solid #6366f1; }
.kpi-group--financial .kpi-main-card { border-top: 2.5px solid #f59e0b; }

/* Group color themes for emoji bg */
.kpi-group--revenue .kpi-emoji { background: #eff6ff; border-radius: 6px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.kpi-group--orders .kpi-emoji { background: #eef2ff; border-radius: 6px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.kpi-group--financial .kpi-emoji { background: #fffbeb; border-radius: 6px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }

/* Performance badges (below KPI) */
.kpi-perf { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.kpi-perf-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.kpi-perf-dot.green { background: #22c55e; }
.kpi-perf-dot.red { background: #ef4444; }
.kpi-perf-dot.amber { background: #f59e0b; }
.kpi-perf-text { font-size: 10px; font-weight: 600; }
.kpi-perf-text.green { color: #16a34a; }
.kpi-perf-text.red { color: #dc2626; }
.kpi-perf-text.amber { color: #d97706; }

@media (max-width: 900px) {
  .kpi-group { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .kpi-group { grid-template-columns: 1fr 1fr; gap: 6px; }
  .kpi-main-card { padding: 10px 10px 8px; }
  .kpi-value { font-size: 16px; }
  .kpi-label { font-size: 10px; }
  .kpi-badge { font-size: 9px; padding: 1px 5px; }
  .kpi-sparkline { height: 22px; }
}
@media (max-width: 400px) {
  .kpi-group { grid-template-columns: 1fr 1fr; gap: 4px; }
  .kpi-main-card { padding: 8px; }
  .kpi-value { font-size: 14px; }
  .kpi-label { font-size: 9px; }
  .kpi-sparkline { height: 18px; }
}

/* ---------- 13. FORMS ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* ── Product Image ── */
.product-image-upload {
  margin-top: 6px;
}
.product-image-preview {
  width: 100%;
  max-width: 64px;
  height: 64px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-alt, #f8f9fa);
  cursor: pointer;
}
.product-image-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  width: auto;
  height: auto;
}
.product-image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.3;
}

/* ═══════════ DASHBOARD SECTIONS ═══════════ */
.dash-section {
  margin-bottom: var(--space-lg);
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.dash-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}
.dash-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
}
.dash-section-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.dash-grid-2 {
  grid-template-columns: 1fr 1fr;
}

/* Summary comparison rows */
.summary-compare {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.sc-row b {
  color: var(--text);
  font-weight: 700;
}
.sc-divider {
  border-top: 2px solid var(--border);
  border-bottom: none;
  padding-top: 8px;
  margin-top: 4px;
}

/* Chart card */
.card-chart {
  min-height: 240px;
  display: flex;
  flex-direction: column;
}
.line-chart-wrap {
  flex: 1;
  min-height: 160px;
}

/* Professional chart */
.professional-chart { width: 100%; height: auto; display: block; }
.professional-chart text { font-family: inherit; }
.chart-y-label { font-size: 9.5px; fill: var(--text-muted, #94a3b8); font-weight: 500; }
.chart-x-label { font-size: 10px; fill: var(--text-muted, #94a3b8); font-weight: 500; }
.chart-dot { transition: r 0.15s ease, stroke-width 0.15s ease; }
.chart-hover-zone { cursor: pointer; }
.chart-tooltip { opacity: 0; transition: opacity 0.15s ease; }
.chart-tooltip-text { font-size: 10px; font-weight: 700; fill: var(--text, #e2e8f0); }
.chart-point-group:hover .chart-tooltip { opacity: 1; }
.chart-point-group:hover .chart-dot { r: 6; stroke-width: 2.5; }

/* Donut */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.donut-svg {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.donut-legend-label {
  color: var(--text-muted);
  flex: 1;
}
.donut-legend-value {
  font-weight: 700;
  color: var(--text);
}

/* EFRIS pipeline */
.efris-pipeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.efris-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}
.efris-label {
  font-weight: 500;
  text-transform: capitalize;
}
.efris-count {
  font-weight: 700;
}

/* Alert cards */
.card-alert {
  border-left: 4px solid var(--warning, #f59e0b);
}

/* ═══════════ SALES TRENDS — PROFESSIONAL REDESIGN ═══════════ */

/* Time filter tabs */
.trend-filters {
  display: flex;
  gap: 4px;
  background: var(--surface-2, #f1f5f9);
  border-radius: var(--radius-sm, 6px);
  padding: 3px;
}
.tf-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-xs, 4px);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.tf-btn:hover {
  color: var(--text, #0f172a);
  background: var(--surface, #fff);
}
.tf-btn.active {
  background: var(--surface, #fff);
  color: var(--brand, #3b82f6);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Trend KPI cards */
.trend-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: var(--space-md, 16px);
}
.tkpi-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-sm, 6px);
  padding: 12px 14px;
  box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,0.04));
}
.tkpi-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.tkpi-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text, #0f172a);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.tkpi-delta {
  font-size: 11px;
  margin-top: 4px;
  color: var(--text-muted, #94a3b8);
}
.tkpi-delta.up { color: var(--success, #22c55e); }
.tkpi-delta.down { color: var(--danger, #ef4444); }
.tkpi-sub {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  margin-top: 2px;
}

/* Trend chart grid: 70/30 split */
.dash-grid-trend {
  grid-template-columns: 1fr 280px;
  gap: 16px;
  align-items: start;
}

/* Chart container */
.trend-chart {
  width: 100%;
  height: auto;
  display: block;
}
.trend-chart text {
  font-family: inherit;
}
.chart-y-label {
  font-size: 9.5px;
  fill: var(--text-muted, #94a3b8);
  font-weight: 500;
}
.chart-x-label {
  font-size: 10px;
  fill: var(--text-muted, #94a3b8);
  font-weight: 500;
}

/* Bar hover */
.chart-bar-group {
  transition: opacity 0.15s ease;
}
.chart-bar {
  transition: filter 0.15s ease;
}

/* Tooltip / hover zone */
.chart-hover-zone {
  cursor: pointer;
}
.chart-tooltip {
  opacity: 0;
  transition: opacity 0.15s ease;
}
.chart-tooltip-text {
  font-size: 10.5px;
  font-weight: 700;
  fill: var(--text, #e2e8f0);
}
.chart-tooltip-sub {
  font-size: 9px;
  fill: var(--text-muted, #94a3b8);
}
.chart-point-group:hover .chart-tooltip {
  opacity: 1;
}
.chart-point-group:hover .chart-bar {
  filter: brightness(1.1);
}

/* Chart legend */
.chart-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
}
.cl-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  font-weight: 500;
}
.cl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Card chart container */
.card-card-chart,
.card-chart {
  padding: 16px;
}

/* ── Horizontal product bars ── */
.hp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border, #f1f5f9);
}
.hp-row:last-child {
  border-bottom: none;
}
.hp-label {
  flex-shrink: 0;
  width: 130px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text, #0f172a);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hp-bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface-2, #f1f5f9);
  border-radius: 99px;
  overflow: hidden;
}
.hp-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.hp-value {
  flex-shrink: 0;
  width: 40px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--text, #0f172a);
}

/* ── Recent sales table ── */
.recent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.recent-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 0;
  border-bottom: 2px solid var(--border, #e2e8f0);
}
.recent-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--border, #f1f5f9);
  color: var(--text, #0f172a);
}
.recent-table tr:last-child td {
  border-bottom: none;
}
.rt-invoice {
  font-weight: 600;
  color: var(--text, #0f172a);
}
.rt-time {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  margin-top: 1px;
}

/* ── Quick Insights ── */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.insight-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-sm, 6px);
  padding: 12px 14px;
  transition: border-color 0.15s ease;
}
.insight-card:hover {
  border-color: var(--brand, #3b82f6);
}
.insight-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}
.insight-text {
  font-size: 12.5px;
  color: var(--text, #334155);
  line-height: 1.5;
}
.insight-text b {
  color: var(--text, #0f172a);
  font-weight: 700;
}

/* Responsive */
@media (max-width: 768px) {
  .dash-grid-2 {
    grid-template-columns: 1fr;
  }
  .dash-section {
    padding: 16px;
  }
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all var(--dur-fast) var(--ease);
}
.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--border-strong);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--shadow-focus);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .field input, .field select, .field textarea {
    padding: 13px 16px;
    font-size: 16px;
  }
}
.help-text {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ---------- 9. TABLES ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  text-align: left;
  padding: 11px 16px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
tbody tr {
  transition: background var(--dur-fast);
}
tbody tr:hover {
  background: var(--surface-2);
}

/* ---------- 10. BADGES ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-green { background: var(--brand-light); color: var(--brand); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-blue { background: var(--info-light); color: var(--info); }
.badge-gray { background: var(--surface-2); color: var(--text-muted); }

/* ---------- 11. POS SCREEN ---------- */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  height: calc(100vh - 130px);
}
@media (max-width: 980px) {
  .pos-layout {
    grid-template-columns: 1fr;
    height: 100dvh;
    gap: 0;
  }
  .pos-layout .cart-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 55vh;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: var(--shadow-xl);
    transform: translateY(calc(100% - 52px));
    transition: transform var(--dur) var(--ease);
  }
  .pos-layout .cart-panel.cart-open { transform: translateY(0); }
  .pos-layout .cart-panel .cart-header::after {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border-strong);
    border-radius: 2px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
  }
  .pos-layout .pos-catalog {
    height: 100dvh;
    overflow: hidden;
    padding-bottom: 52px;
  }
}

.pos-catalog {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.pos-search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.pos-search-row input {
  flex: 1;
  font-size: 15px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all var(--dur-fast);
}
.pos-search-row input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--shadow-focus);
}
.pos-search-row button {
  min-width: 44px;
  min-height: 44px;
}

.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.category-chips .chip { scroll-snap-align: start; }
.chip {
  flex-shrink: 0;
  padding: 7px 15px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.chip:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.chip:active { transform: scale(0.95); }
.chip.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-brand);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding-bottom: 12px;
  flex: 1;
  min-height: 0;
}
@media (max-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 4px;
  }
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
  min-height: 140px;
  max-height: 160px;
}
.product-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.product-card:active { transform: scale(0.97); }
.product-card .pname {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  min-height: 26px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
}
.product-card .pprice {
  font-size: 12px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.02em;
}
.product-card .pstock {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}
.product-card .pstock.low {
  color: var(--danger);
  font-weight: 700;
}
.product-card-img {
  width: 40px;
  height: 40px;
  background: var(--brand);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.product-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-emoji { font-size: 18px; width:40px; height:40px; background:var(--brand); border-radius:8px; display:flex; align-items:center; justify-content:center; color:#fff; flex-shrink:0; }
.inv-product-img { width:28px; height:28px; background:var(--brand); border-radius:6px; display:flex; align-items:center; justify-content:center; overflow:hidden; flex-shrink:0; }
.inv-product-img img { width:100%; height:100%; object-fit:cover; }
.inv-product-emoji { width:28px; height:28px; background:var(--brand); border-radius:6px; display:flex; align-items:center; justify-content:center; font-size:13px; color:#fff; flex-shrink:0; }
.psku {
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1.1;
}

/* Product card qty badge (when item is in cart) */
.product-card .qty-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--brand);
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 2;
  animation: badge-pop 0.2s ease;
}
@keyframes badge-pop {
  0% { transform: scale(0.5); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.product-card { position: relative; }

/* Quantity picker modal */
.qty-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease;
}
.qty-picker {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 280px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  animation: slide-up 0.2s ease;
}
.qty-picker h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
}
.qty-picker .qp-price {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}
.qty-picker .qp-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}
.qty-picker .qp-stepper button {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast);
  color: var(--brand);
}
.qty-picker .qp-stepper button:hover {
  border-color: var(--brand);
  background: var(--brand-light);
}
.qty-picker .qp-stepper button:active { transform: scale(0.92); }
.qty-picker .qp-stepper .qp-qty {
  font-size: 28px;
  font-weight: 800;
  min-width: 60px;
  text-align: center;
}
.qty-picker .qp-actions {
  display: flex;
  gap: 8px;
}
.qty-picker .qp-actions button {
  flex: 1;
}

/* Customer search dropdown */
.pos-customer-opt:hover {
  background: var(--brand-light);
}
.pos-customer-opt:last-child {
  border-bottom: none;
}

/* Delivery toggle */
#pos-delivery-toggle {
  accent-color: var(--brand);
  cursor: pointer;
}

/* Order success modal CTA buttons */
.modal .btn {
  min-height: 44px;
  font-size: 13px;
}
.modal .btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.modal .btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 80%, black);
}

/* Cart panel fields compact */
.cart-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.cart-fields {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cart-panel .field {
  margin-bottom: 0;
}
.cart-panel .field label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
  display: block;
}
.cart-panel .field input,
.cart-panel .field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--text);
  transition: all var(--dur-fast);
}
.cart-panel .field input::placeholder {
  color: var(--text-faint);
}
.cart-panel .field label {
  font-size: 11px;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-weight: 600;
}
.cart-panel .field input,
.cart-panel .field select {
  padding: 8px 10px;
  font-size: 13px;
}
.cart-panel .field input::placeholder {
  font-size: 12px;
}

/* Cart panel */
.cart-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: var(--shadow-md);
}
.cart-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  cursor: pointer;
}
@media (max-width: 980px) {
  .cart-header {
    justify-content: center;
    padding: 14px 18px;
    user-select: none;
  }
}
.cart-items {
  padding: 8px 14px;
}
.cart-row {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cart-row:hover { background: var(--surface-2); border-radius: var(--radius-xs); }
.cart-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-row-top .info { flex: 1; min-width: 0; }
.cart-row-top .info .name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-row-top .info .unit {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.cart-row-remove {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  color: var(--danger);
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  transition: all var(--dur-fast);
}
.cart-row-remove:hover {
  background: var(--danger-light);
}
.cart-row-controls {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.cart-row-controls > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cart-row-controls label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.cart-qty-group .qty-stepper {
  height: 34px;
}
.cart-tax-select {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 6px;
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  min-width: 90px;
}
.cart-disc-input {
  height: 34px;
  width: 72px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: right;
}
.cart-line-total .line-total {
  height: 34px;
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
}
.cart-item-tax {
  color: var(--brand);
  font-weight: 500;
}

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.qty-stepper button {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
  color: var(--brand);
}
.qty-stepper button:hover {
  background: var(--brand);
  color: white;
}
.qty-stepper button:active { transform: scale(0.90); }
.qty-stepper .qty-val {
  min-width: 36px;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: var(--radius-xs);
  transition: background var(--dur-fast);
}
.qty-stepper .qty-val:hover {
  background: var(--surface-2);
}
.qty-stepper .qty-val editing {
  background: var(--surface-2);
  outline: 2px solid var(--brand);
}
.qty-input-inline {
  width: 50px;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  border: 2px solid var(--brand);
  border-radius: var(--radius-xs);
  padding: 4px 2px;
  background: var(--surface);
  outline: none;
}
@media (max-width: 640px) {
  .qty-stepper button { width: 40px; height: 40px; font-size: 20px; }
  .qty-stepper .qty-val { font-size: 16px; min-width: 40px; }
  .cart-row { padding: 12px 4px; }
  .cart-row .line-total-old { font-size: 14px; }
}
.cart-row .line-total-old {
  width: 80px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
}

.cart-summary {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
}
@media (max-width: 640px) {
  .cart-summary .btn { padding: 14px 18px; font-size: 15px; min-height: 48px; }
  .cart-summary .summary-row.total { font-size: 19px; }
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--text-muted);
}
.summary-row.total {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 12px;
  letter-spacing: -0.02em;
}
.summary-row.tax-toggle-row {
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  font-weight: 600;
  color: var(--text);
}
.summary-row.tax-detail {
  padding: 2px 0 2px 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.tax-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}
.tax-toggle input { opacity: 0; width: 0; height: 0; }
.tax-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 20px;
  transition: background 0.2s;
}
.tax-toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.tax-toggle input:checked + .tax-toggle-slider {
  background: var(--brand);
}
.tax-toggle input:checked + .tax-toggle-slider::before {
  transform: translateX(16px);
}
.currency-select-row {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}
.currency-select-row select { flex: 1; }

/* ---------- 11b. REPORT BARS ---------- */
.category-bars { display: flex; flex-direction: column; gap: 12px; }
.cat-bar-row { display: flex; flex-direction: column; gap: 3px; }
.cat-bar-label { display: flex; justify-content: space-between; align-items: baseline; }
.cat-bar-name { font-size: 13px; font-weight: 600; color: var(--text); }
.cat-bar-amt { font-size: 13px; font-weight: 700; color: var(--text); }
.cat-bar-track { height: 8px; background: var(--bg-alt, #f1f3f5); border-radius: 4px; overflow: hidden; }
.cat-bar-fill { height: 100%; background: var(--brand); border-radius: 4px; transition: width 0.4s ease; }
.cat-bar-fill.method-fill { background: var(--success, #16a34a); }
.cat-bar-meta { font-size: 11px; color: var(--text-muted); }

/* ---------- Suppliers Table ---------- */
.sup-table table { table-layout: fixed; width: 100%; }
.sup-table th, .sup-table td { padding: 8px; font-size: 12.5px; }
.sup-table th { white-space: nowrap; color: var(--text-muted); }
.sup-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-table td:nth-child(1) { width: 24%; }
.sup-table td:nth-child(2) { width: 14%; }
.sup-table td:nth-child(3) { width: 16%; }
.sup-table td:nth-child(4) { width: 18%; }
.sup-table td:nth-child(5) { width: 10%; }
.sup-table td:nth-child(6) { width: 10%; }
.sup-table td:nth-child(7) { width: 6%; text-align: center; }
.sup-table td:nth-child(8) { width: 12%; }
.sup-table .sup-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sup-table .sup-name-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-light); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: var(--brand); flex-shrink: 0; }
.sup-table .sup-name-text { min-width: 0; }
.sup-table .sup-name-text b { font-size: 13px; }
.sup-table .sup-name-text span { font-size: 11px; color: var(--text-muted); display: block; }
.sup-table .sup-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.sup-table .sup-actions .btn { min-width: 0; padding: 6px 8px; font-size: 12px; }

/* ---------- 12. ACCOUNTING STATEMENTS ---------- */
.stmt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.stmt-table td { padding: 8px 4px; }
.stmt-table td.num { text-align: right; white-space: nowrap; }
.stmt-table tr.subtotal td {
  border-top: 1px solid var(--border);
  padding-top: 11px;
}
.stmt-table tr.total td {
  border-top: 2px solid var(--text);
  padding-top: 13px;
  font-size: 15.5px;
  font-weight: 700;
}

/* ---------- 13. MODAL ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.60);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: fadeIn var(--dur) var(--ease);
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 520px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  padding: 24px;
  animation: modalIn var(--dur) var(--ease-bounce);
}
.modal.modal-lg { max-width: 780px; }
.modal-close { position: absolute; }
.modal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-title-row h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 14. TOAST ---------- */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}
.toast {
  background: var(--surface);
  color: var(--text);
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  min-width: 240px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-faint);
  animation: toastIn var(--dur) var(--ease-bounce);
}
.toast.error {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.toast.success {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  border-color: var(--brand);
  border-left-color: var(--brand-darker);
}

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

/* ---------- 15. LOGIN / AUTH SCREENS ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-darker) 0%, var(--brand-dark) 40%, var(--brand-deep) 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
/* Animated background orbs */
.login-wrap::before,
.login-wrap::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: float 12s ease-in-out infinite;
}
.login-wrap::before {
  width: 400px;
  height: 400px;
  background: var(--brand);
  top: -100px;
  left: -100px;
}
.login-wrap::after {
  width: 350px;
  height: 350px;
  background: var(--accent);
  bottom: -80px;
  right: -80px;
  animation-delay: -6s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 30px) scale(0.95); }
}

.login-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.05);
  position: relative;
  z-index: 1;
  animation: cardIn var(--dur-slow) var(--ease-bounce);
}
.login-card[style*="680px"] {
  max-width: 680px;
}
.login-card[style*="520px"] {
  max-width: 520px;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card .flag-strip {
  height: 6px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #000 0 33%, #fcdc00 33% 66%, #d90000 66% 100%);
  margin-bottom: 22px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
}
.login-logo img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  box-shadow: var(--shadow-md);
}
.login-logo h1 {
  font-size: 22px;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.login-logo p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
  max-width: 280px;
  line-height: 1.5;
}

/* Login form enhancements */
#login-form .field input,
#signup-form .field input,
#reset-form .field input,
#create-business-form .field input {
  padding: 13px 16px;
  font-size: 15px;
}
#login-form .btn-primary,
#signup-form .btn-primary,
#reset-form .btn-primary,
#create-business-form .btn-primary {
  padding: 13px 20px;
  font-size: 15px;
  min-height: 48px;
}

/* ---------- 16. RECEIPT ---------- */
.receipt {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: #fff;
  color: #111;
  padding: 18px;
  border-radius: var(--radius-sm);
}
.receipt .center { text-align: center; }
.receipt hr {
  border: none;
  border-top: 1px dashed #999;
  margin: 8px 0;
}
.receipt table { width: 100%; font-size: 12px; }
.receipt td { padding: 2px 0; border: none; }

/* ---------- 17. MISC / UTILITIES ---------- */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state .big-icon {
  font-size: 44px;
  margin-bottom: 14px;
  display: block;
}
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.flex { display: flex; }
.flex.gap { gap: 8px; }
.flex.between { justify-content: space-between; align-items: center; }
.hidden { display: none !important; }
.sidebar-backdrop { display: none; }

/* Loading spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton shimmer */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .topbar-cta-group { display: none !important; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    border-radius: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open {
    transform: translateX(0);
    height: calc(100% - var(--topbar-h));
    top: var(--topbar-h);
  }
  .main {
    margin-left: 0;
    margin-right: 0;
  }
  body.sidebar-expanded .main {
    margin-left: 0;
    margin-right: 0;
  }
  .sidebar-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 39;
  }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .view { padding: var(--space-sm) 16px 16px 16px; }
  .topbar { padding: 0 16px; }
  .topbar h1 { font-size: 16px; }
}

/* ---------- 18. NOTIFICATIONS ---------- */
.notif-wrapper { position: relative; }
.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  pointer-events: none;
  border: 2px solid var(--surface);
  box-shadow: 0 2px 6px var(--danger-glow);
}
.notif-dropdown {
  position: absolute;
  top: 46px;
  right: 0;
  width: 380px;
  max-height: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: dropdownIn var(--dur) var(--ease-out);
}
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
}
.notif-list { overflow-y: auto; flex: 1; }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--dur-fast);
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--brand-lighter); }
.notif-item .notif-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}
.notif-item .notif-body { flex: 1; min-width: 0; }
.notif-item .notif-title { font-weight: 600; font-size: 13px; }
.notif-item .notif-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}
.notif-item .notif-time {
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 4px;
}
@media (max-width: 480px) {
  .notif-dropdown { width: 320px; right: -50px; }
}

/* ---------- 19. CHAT ---------- */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  height: calc(100vh - 130px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
@media (max-width: 860px) {
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-sidebar { display: none; }
  .chat-sidebar.open {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--surface);
  }
}
.chat-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.chat-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 15px;
}
.chat-list { flex: 1; overflow-y: auto; }
.chat-list-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--dur-fast);
}
.chat-list-item:hover { background: var(--surface-2); }
.chat-list-item.active { background: var(--brand-light); }
.chat-list-item .chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.chat-list-item .chat-info { flex: 1; min-width: 0; }
.chat-list-item .chat-name {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-list-item .chat-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-list-item .unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
  box-shadow: 0 0 6px var(--brand-glow);
}
.chat-main {
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
}
.chat-main-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 11px;
}
.chat-main-header .chat-avatar { width: 32px; height: 32px; }
.chat-main-header .chat-title { font-weight: 700; font-size: 14px; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
  animation: fadeInUp var(--dur) var(--ease-out);
}
.chat-msg.sent {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: var(--shadow);
}
.chat-msg.received {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-xs);
}
.chat-msg .msg-sender {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 3px;
  opacity: 0.8;
}
.chat-msg .msg-time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
  text-align: right;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-input-row input {
  flex: 1;
  padding: 11px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: all var(--dur-fast);
}
.chat-input-row input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--shadow-focus);
}
.chat-input-row button {
  border-radius: var(--radius-pill);
  padding: 11px 20px;
}
.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- 20. ADMIN TABS ---------- */
.admin-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.admin-tab {
  padding: 11px 20px;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all var(--dur-fast);
  margin-bottom: -2px;
}
.admin-tab:hover {
  color: var(--text);
  background: var(--surface-2);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.admin-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 700;
}

/* ---------- 21. IMPERSONATION BANNER ---------- */
.impersonate-banner {
  background: linear-gradient(90deg, #f59e0b, #d97706);
  color: #000;
  padding: 11px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
  z-index: 60;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}
.impersonate-banner button {
  background: #000;
  color: #f59e0b;
  border: none;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.impersonate-banner button:hover { filter: brightness(1.2); }

/* ---------- 22. NOTIFICATIONS FULL VIEW ---------- */
.notif-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.notif-full-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--dur-fast);
  position: relative;
}
.notif-full-item:hover { background: var(--surface-2); }
.notif-full-item.unread { background: var(--brand-lighter); }
.notif-full-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.notif-full-body { flex: 1; min-width: 0; }
.notif-full-title { font-weight: 600; font-size: 14px; }
.notif-full-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.45;
}
.notif-full-time {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 5px;
}
.notif-full-item .unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
  margin-top: 7px;
  box-shadow: 0 0 6px var(--brand-glow);
}

/* ---------- 23. ACCESSIBILITY ---------- */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  box-shadow: var(--shadow-focus);
}

/* Focus-visible for nav links uses inset shadow */
.nav-link:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--brand);
}

/* ---------- 24. RESPONSIVE TWEAKS ---------- */
@media (max-width: 640px) {
  .login-card { padding: 28px 22px; border-radius: 16px; }
  .login-logo h1 { font-size: 20px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .kpi-card { padding: 10px; gap: 6px; }
  .kpi-card .value { font-size: 14px; }
  .kpi-icon { width: 26px; height: 26px; font-size: 13px; }
  .kpi-card .label { font-size: 8px; }
  .kpi-card .delta { font-size: 9px; }
  .view-header h2 { font-size: 19px; }
  .card { padding: 14px; }
  .modal { padding: 20px; border-radius: 16px; }
  .toast-stack { bottom: 16px; right: 16px; left: 16px; }
  .toast { min-width: 0; }
  .dash-charts { grid-template-columns: 1fr; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  /* Trends redesign responsive */
  .dash-grid-trend { grid-template-columns: 1fr; }
  .trend-kpis { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .tkpi-value { font-size: 15px; }
  .trend-filters { flex-wrap: wrap; }
  .tf-btn { padding: 5px 10px; font-size: 11px; }
  .chart-legend { gap: 10px; }
  .hp-label { width: 100px; font-size: 11px; }
  .insights-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
   25. SPLASH SCREEN
   ===================================================================== */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-darker) 0%, var(--brand-dark) 40%, var(--brand-deep) 100%);
  transition: opacity 0.5s var(--ease), visibility 0.5s var(--ease);
}
.splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}
.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fadeInUp 0.6s var(--ease-out);
}
.splash-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(255,255,255,0.1);
  animation: splashPulse 2s ease-in-out infinite;
}
@keyframes splashPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 32px rgba(255,255,255,0.1); }
  50% { transform: scale(1.05); box-shadow: 0 12px 40px rgba(30,78,140,0.3); }
}
.splash-name {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
}
.splash-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-top: 4px;
}
.splash-tag {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* =====================================================================
   26. THEME COLOR PICKER
   ===================================================================== */
.theme-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.theme-color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 3px solid transparent;
  transition: all var(--dur-fast) var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  font-weight: 700;
}
.theme-color-swatch:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-md);
}
.theme-color-swatch.active {
  border-color: var(--text);
  box-shadow: var(--shadow-md);
}
.theme-color-swatch.active {
  border-color: var(--text);
  box-shadow: var(--shadow-md);
}

/* =====================================================================
   27. PROFILE PAGE
   ===================================================================== */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}
.profile-avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}
.profile-info h2 {
  margin: 0 0 4px;
  font-size: 22px;
}
.profile-info .profile-role {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: capitalize;
}
.profile-info .profile-business {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.profile-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}
.profile-stat .stat-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.profile-stat .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* =====================================================================
   28. COUPONS / GIFT CARDS
   ===================================================================== */
.coupon-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: all var(--dur-fast) var(--ease);
  position: relative;
  overflow: hidden;
}
.coupon-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.coupon-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--brand);
}
.coupon-card.expired::before { background: var(--danger); }
.coupon-card.used::before { background: var(--text-faint); }
.coupon-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-light);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.coupon-info { flex: 1; min-width: 0; }
.coupon-code {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.05em;
  font-family: var(--font-mono);
}
.coupon-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.coupon-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--brand);
}
.coupon-status {
  font-size: 11px;
  margin-top: 4px;
}

/* =====================================================================
   29. ORDERS MANAGEMENT
   ===================================================================== */
.order-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
}
.order-status-pending { background: var(--warning-light); color: var(--warning); }
.order-status-processing { background: var(--info-light); color: var(--info); }
.order-status-completed { background: var(--brand-light); color: var(--brand); }
.order-status-cancelled { background: var(--danger-light); color: var(--danger); }

/* =====================================================================
   30. ACTIVITY FEED (Dashboard)
   ===================================================================== */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.activity-dot.sale { background: var(--brand-light); color: var(--brand); }
.activity-dot.stock { background: var(--warning-light); color: var(--warning); }
.activity-dot.user { background: var(--info-light); color: var(--info); }
.activity-dot.alert { background: var(--danger-light); color: var(--danger); }
.activity-body { flex: 1; min-width: 0; }
.activity-title { font-size: 13px; font-weight: 600; }
.activity-time { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

/* Quick action buttons on dashboard */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  text-decoration: none;
  color: var(--text);
}
.quick-action:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.quick-action .qa-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.quick-action .qa-label {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

/* =====================================================================
   31. LANDING PAGE
   ===================================================================== */
.landing-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-darker) 0%, var(--brand-dark) 40%, var(--brand-deep) 100%);
  position: relative;
  overflow: hidden;
  padding: 40px 20px;
}
.landing-hero::before,
.landing-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.12;
  animation: float 14s ease-in-out infinite;
}
.landing-hero::before {
  width: 500px; height: 500px;
  background: var(--brand);
  top: -150px; left: -150px;
}
.landing-hero::after {
  width: 400px; height: 400px;
  background: var(--accent);
  bottom: -100px; right: -100px;
  animation-delay: -7s;
}
.landing-hero-content {
  max-width: 900px;
  text-align: center;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.8s var(--ease-out);
}
.landing-hero img {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(255,255,255,0.1);
  margin-bottom: 20px;
}
.landing-hero h1 {
  font-size: 48px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 12px;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.landing-hero h1 .accent { color: var(--brand); }
.landing-hero p {
  font-size: 18px;
  color: rgba(255,255,255,0.7);
  max-width: 600px;
  margin: 0 auto 28px;
  line-height: 1.6;
}
.landing-hero .btn {
  padding: 14px 32px;
  font-size: 16px;
}
.landing-hero .btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border: none;
}
.landing-cta-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.landing-features {
  padding: 80px 20px;
  max-width: 1200px;
  margin: 0 auto;
}
.landing-features h2 {
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 40px;
}
.landing-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.landing-feature {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: all var(--dur) var(--ease);
}
.landing-feature:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}
.landing-feature .lf-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 16px;
}
.landing-feature h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 8px;
}
.landing-feature p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}
.landing-pricing {
  padding: 80px 20px;
  background: var(--surface-2);
}
.landing-pricing h2 {
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 40px;
}
.landing-pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 1000px;
  margin: 0 auto;
}
.landing-pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  transition: all var(--dur) var(--ease);
}
.landing-pricing-card.featured {
  border-color: var(--brand);
  box-shadow: var(--shadow-brand);
  transform: scale(1.03);
}
.landing-pricing-card:hover {
  box-shadow: var(--shadow-lg);
}
.landing-pricing-card .plan-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}
.landing-pricing-card .plan-price {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 12px 0;
}
.landing-pricing-card .plan-price small {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}
.landing-pricing-card .plan-features {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  text-align: left;
}
.landing-pricing-card .plan-features li {
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.landing-pricing-card .plan-features li:last-child { border-bottom: none; }
.landing-footer {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
}
@media (max-width: 640px) {
  .landing-hero h1 { font-size: 32px; }
  .landing-hero p { font-size: 15px; }
  .landing-features h2, .landing-pricing h2 { font-size: 24px; }
  .landing-pricing-card.featured { transform: none; }
  .landing-nav-links a:not(.btn) { display: none; }
}

/* =====================================================================
   32. LANDING NAVBAR
   ===================================================================== */
.landing-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: var(--brand-darker, rgba(15, 46, 84, 0.85));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.landing-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.landing-nav-brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}
.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}
.landing-nav-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color var(--dur-fast);
}
.landing-nav-links a:hover {
  color: #fff;
}
.landing-nav-links .btn {
  color: #fff;
}

/* Dashboard expand/collapse */
.dash-expand-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--dur-fast) var(--ease);
  background: transparent;
  width: 100%;
}
.dash-expand-bar:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-light);
}

/* BI group dropdown compact */
#bi-sub-tabs .admin-tab {
  padding: 7px 14px;
  font-size: 12.5px;
}

/* =====================================================================
   33. MOBILE / DEVICE OPTIMISATIONS
   ===================================================================== */

/* Safe area insets for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  .sidebar { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .cart-panel { padding-bottom: env(safe-area-inset-bottom); }
  .toast-stack { bottom: calc(24px + env(safe-area-inset-bottom)); }
  .modal-overlay { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* All touch targets at least 44px on any device */
@media (pointer: coarse) {
  .btn, .chip, .nav-link, .product-card,
  .qty-stepper button, .icon-btn, .menu-btn { min-height: 44px; }
  select, input, textarea { font-size: 16px !important; }
  .field input, .field select, .field textarea { padding: 14px 16px; }
}

/* Small screens — topbar cleanup */
@media (max-width: 700px) {
  .topbar-left .branch-sub { display: none; }
  .topbar .topbar-cta-group { display: none !important; }
  #lang-picker, #currency-picker { display: none !important; }
  .topbar-center {
    margin: 0 var(--space-sm);
    padding: 4px 12px;
    font-size: 11px;
  }
}
@media (max-width: 480px) {
  .topbar-left .brand-text { display: none; }
  .topbar-divider { display: none; }
  .topbar-center { display: none; }
  .topbar-right .user-chip .avatar { width: 22px; height: 22px; font-size: 10px; }
  .topbar-right .user-chip { padding: 2px 6px 2px 2px; }
}

/* Very small screens (< 400px) — make everything compact */
@media (max-width: 400px) {
  .view { padding: var(--space-xs) 10px 10px 10px; }
  .view-header h2 { font-size: 17px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; }
  .kpi-card { padding: 8px; gap: 4px; }
  .kpi-card .value { font-size: 13px; }
  .kpi-card .label { font-size: 7px; }
  .kpi-icon { width: 22px; height: 22px; font-size: 12px; border-radius: 6px; }
  .card { padding: 12px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .product-card { padding: 8px; }
  .product-card .pname { font-size: 11px; min-height: 28px; }
  .product-card .pprice { font-size: 13px; }
  .modal { padding: 16px; border-radius: 12px; max-height: 92vh; }
  .modal.modal-lg { max-width: 100%; }
  .login-card { padding: 20px 16px; }
  .login-logo h1 { font-size: 18px; }
  .login-logo img { width: 44px; height: 44px; }
  .field-row { grid-template-columns: 1fr; gap: 8px; }
  .table-wrap { font-size: 12px; }
  thead th, tbody td { padding: 8px 10px; }
  .cart-row { padding: 10px 2px; }
  .toast { min-width: 0; font-size: 12.5px; padding: 11px 14px; }
  .toast-stack { right: 8px; left: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .profile-header { flex-direction: column; align-items: center; text-align: center; }
  .profile-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mini-chart { height: 80px; gap: 4px; }
  .mini-bar-value { font-size: 8px; }
  .mini-bar-label { font-size: 9px; }
  .mini-bar-track { max-width: 24px; }
  .donut-svg { width: 80px; height: 80px; }
  /* Trends redesign — very small */
  .trend-kpis { grid-template-columns: 1fr 1fr; gap: 4px; }
  .tkpi-card { padding: 8px 10px; }
  .tkpi-value { font-size: 13px; }
  .tkpi-label { font-size: 8px; }
  .tf-btn { padding: 4px 8px; font-size: 10px; }
  .hp-label { width: 80px; font-size: 10px; }
  .hp-value { width: 32px; font-size: 10px; }
  .insight-card { padding: 10px 12px; }
  .insight-text { font-size: 11.5px; }
}

/* Sidebar overlay z-index & backdrop fix on mobile */
@media (max-width: 860px) {
  .sidebar { z-index: 50; }
  .sidebar-backdrop.show { z-index: 49; }
  .sidebar-collapse-btn { display: none; }
  /* On mobile, sidebar is always full width when opened */
  .sidebar.open {
    width: var(--sidebar-w);
  }
  .modal-overlay { padding: 8px; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-width: 100%; }
  .modal.modal-lg { border-radius: 16px 16px 0 0; }
  .topbar { gap: 8px; }
  .topbar .user-chip span:last-child { display: none; }
}

/* Table minimum width so columns don't collapse on mobile */
.table-wrap table {
  min-width: 600px;
}

/* Prevent pull-to-refresh / overscroll on mobile */
body { overscroll-behavior: none; }

/* Smooth category chip scroll on POS */
.category-chips { -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }

/* POS: full-screen cart on smallest screens */
@media (max-width: 420px) and (max-height: 700px) {
  .pos-layout .cart-panel { max-height: 70vh; border-radius: 12px 12px 0 0; }
  .pos-layout .cart-panel.cart-open { max-height: 85vh; }
}

/* Chat layout mobile fixes */
@media (max-width: 480px) {
  .chat-layout { border-radius: 0; border: none; }
  .chat-messages { padding: 10px; }
  .chat-msg { max-width: 85%; font-size: 13px; }
  .chat-input-row { padding: 10px 12px; }
}

/* =====================================================================
   34. PAGINATION
   ===================================================================== */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--border);
  background: var(--surface);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-size: 13px;
  color: var(--text-muted);
}
.pagination-bar .btn {
  height: 32px;
  min-width: 32px;
  padding: 0 var(--space-sm);
  font-size: 12px;
  border-radius: var(--radius-xs);
}
.pagination-bar .btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}
.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pagination-pages .page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.pagination-pages .page-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-light);
}
.pagination-pages .page-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}
.pagination-pages .page-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}
@media (max-width: 400px) {
  .pagination-bar { flex-direction: column; text-align: center; }
}

/* =====================================================================
   35. PROFESSIONAL RECEIPT / DOCUMENT STYLING
   ===================================================================== */
.professional-doc {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  color: #111827;
  font-family: "Inter", -apple-system, sans-serif;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.professional-doc .doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 2px solid #111827;
  margin-bottom: 20px;
}
.professional-doc .doc-logo {
  max-height: 56px;
  max-width: 160px;
  object-fit: contain;
}
.professional-doc .doc-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: #111827;
}
.professional-doc .doc-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
  font-size: 13px;
  line-height: 1.5;
}
.professional-doc .doc-meta .label { color: #6b7280; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.professional-doc .doc-meta .value { font-weight: 600; color: #111827; }
.professional-doc table.doc-items {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 13px;
}
.professional-doc table.doc-items th {
  background: #f3f4f6;
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  border-bottom: 2px solid #e5e7eb;
}
.professional-doc table.doc-items td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}
.professional-doc .doc-totals {
  margin-left: auto;
  width: 300px;
  border-top: 2px solid #111827;
  padding-top: 12px;
}
.professional-doc .doc-totals .row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}
.professional-doc .doc-totals .row.grand {
  font-size: 17px;
  font-weight: 800;
  border-top: 1px solid #e5e7eb;
  margin-top: 6px;
  padding-top: 10px;
}
.professional-doc .doc-footer {
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  font-size: 11px;
  color: #9ca3af;
  text-align: center;
}
.professional-doc .doc-qr {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}
.professional-doc .doc-qr img {
  width: 80px;
  height: 80px;
}
