:root {
  /* Vend Design System - Alive POS Palette */
  --canvas: #F3F4F6;
  --surface: #FFFFFF;
  --surface-subtle: #F9FAFB;
  --ink: #111827;
  --ink-muted: #4b5563;
  --line: #E5E7EB;
  --brand: #4F46E5;
  --brand-strong: #4338CA;
  --brand-soft: #EEF2FF;
  --success: #10B981;
  --success-soft: #D1FAE5;
  --warning: #F59E0B;
  --warning-soft: #FEF3C7;
  --danger: #EF4444;
  --danger-soft: #FEE2E2;
  --info: #3B82F6;

  /* Legacy variable mapping to prevent breaking existing HTML */
  --bg: var(--canvas);
  --bg-alt: var(--surface);
  --panel: var(--surface);
  --muted: var(--ink-muted);
  --primary: var(--brand);
  --primary-dark: var(--brand-strong);
  --accent: var(--brand);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.08);
  --shadow: var(--shadow-sm);
  --shadow-hover: var(--shadow-md);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'ABeeZee', sans-serif;
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.5; /* Body 14/22 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 14px; /* Body 14px */
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  color: var(--ink);
  font-family: 'ABeeZee', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.display { font-size: 36px; line-height: 44px; font-weight: 700; font-family: 'ABeeZee', sans-serif; }
h1 { font-size: 28px; line-height: 36px; font-weight: 700; }
h2 { font-size: 22px; line-height: 30px; font-weight: 700; }
h3 { font-size: 16px; line-height: 24px; font-weight: 700; }
h4 { font-size: 14px; line-height: 22px; font-weight: 600; }

p { margin-top: 0; margin-bottom: 1rem; color: var(--muted); }

small, .small-text, .caption {
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

label {
  display: block;
  font-size: 14px;
  line-height: 22px;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--ink);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(246, 248, 251, .88);
  backdrop-filter: blur(8px);
  z-index: 50;
  transition: opacity .25s ease, visibility .25s ease;
}
.app-loader.hidden { opacity: 0; visibility: hidden; }
.loader-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #dbeafe;
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  transition: transform .22s ease, box-shadow .22s ease, background .22s ease, border-color .22s ease;
  min-height: 40px;
  font-size: 14px;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.btn.primary { background: var(--brand); color: white; box-shadow: none; }
.btn.primary:hover { background: var(--brand-strong); box-shadow: var(--shadow-sm); }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.light { background: var(--brand-soft); color: var(--brand-strong); }
.btn.ghost { background: transparent; color: var(--ink-muted); border: 1px solid transparent; }
.btn.ghost:hover { border-color: var(--line); color: var(--ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.icon { width: 40px; height: 40px; padding: 0; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.site-nav, .hero, .section-inner {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}
.site-nav {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
}
.nav-actions { display: flex; align-items: center; gap: 10px; }
.hero {
  min-height: calc(100vh - 96px);
  display: grid;
  grid-template-columns: 1fr 430px;
  gap: 44px;
  align-items: center;
  padding: 24px 0 72px;
}
.eyebrow { color: var(--primary); font-weight: 800; text-transform: uppercase; font-size: 12px; letter-spacing: .12em; }
.hero h1 { font-size: clamp(42px, 6vw, 76px); line-height: .98; margin: 12px 0 18px; letter-spacing: 0; }
.hero p { color: var(--muted); font-size: 18px; line-height: 1.7; margin: 0 0 24px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}
.mock-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.pill { background: #ecfdf5; color: #047857; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.mock-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mock-product { border: 1px solid var(--line); border-radius: 8px; padding: 14px; min-height: 96px; background: #fbfdff; }
.mock-product strong { display: block; margin-top: 24px; }
.mock-product span { color: var(--muted); font-size: 13px; }
.mock-total { margin-top: 14px; padding: 16px; border-radius: 8px; color: white; background: #102033; display: flex; justify-content: space-between; align-items: center; }

.section { padding: 72px 0; background: white; border-top: 1px solid var(--line); }
.section.alt { background: #f7fafc; }
.section-title { font-size: 34px; margin: 0 0 10px; }
.section-copy { color: var(--muted); max-width: 660px; line-height: 1.7; }
.feature-grid, .price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
.feature, .price-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.feature svg { color: var(--primary); }
.price-card strong { font-size: 30px; display: block; margin: 12px 0; }
.cta-band { background: #102033; color: white; padding: 46px; border-radius: 8px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.cta-band p { color: #cbd5e1; }
.cta-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background-color: var(--bg-alt);
  color: var(--ink);
  background-image: radial-gradient(circle at top, #eef4ff, var(--bg-alt) 70%);
}
.auth-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
  padding: 32px 28px;
}
.auth-card h1 { margin: 16px 0 8px; font-size: 28px; color: var(--ink); }
.auth-card p { color: var(--muted); line-height: 1.6; }
.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { color: var(--ink); font-size: 0.875rem; font-weight: 600; margin-bottom: 6px; display: block; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 40px;
  padding: 10px 14px;
  background: var(--surface-subtle);
  color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  background: var(--surface);
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.check-row { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; cursor: pointer; }

.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}

/* Sidebar Collapse Icon Float */
.collapse-btn-float {
  position: absolute;
  top: 32px;
  right: -14px;
  width: 28px;
  height: 28px;
  background: var(--surface);
  border: 1px solid var(--line, var(--border));
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  z-index: 50;
  transition: transform 0.2s, background 0.2s, color 0.2s;
}
.collapse-btn-float:hover {
  background: var(--bg-alt);
  color: var(--text-main);
}
@media (max-width: 920px) {
  .collapse-btn-float { display: none; }
}
.sidebar {
  background: var(--surface);
  color: var(--ink);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.sidebar .brand { 
  display: flex; 
  align-items: center; 
  justify-content: center;
  margin: 16px 0 24px; 
  padding: 0 12px;
  font-size: 20px; 
  font-weight: 700; 
  font-family: 'ABeeZee', sans-serif; 
  color: var(--ink); 
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}
.side-nav { 
  display: flex; 
  flex-direction: column; 
  gap: 4px; 
  overflow-y: auto; 
  flex-grow: 1; 
  padding-right: 8px; 
}
/* Modern Scrollbar for side-nav and panels */
.side-nav::-webkit-scrollbar,
.modal::-webkit-scrollbar,
.cart-list::-webkit-scrollbar,
.modal-backdrop::-webkit-scrollbar,
.pos-date-card::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
  width: 8px;
}
.side-nav::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track,
.cart-list::-webkit-scrollbar-track,
.modal-backdrop::-webkit-scrollbar-track,
.pos-date-card::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.side-nav::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb,
.cart-list::-webkit-scrollbar-thumb,
.modal-backdrop::-webkit-scrollbar-thumb,
.pos-date-card::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(203, 213, 225, 0.65);
  border-radius: 4px;
}
.side-nav:hover::-webkit-scrollbar-thumb,
.modal:hover::-webkit-scrollbar-thumb,
.cart-list:hover::-webkit-scrollbar-thumb,
.modal-backdrop:hover::-webkit-scrollbar-thumb,
.pos-date-card:hover::-webkit-scrollbar-thumb,
.sidebar:hover::-webkit-scrollbar-thumb {
  background: rgba(203, 213, 225, 0.8);
}
.nav-group { margin-bottom: 16px; flex-shrink: 0; }
.side-footer { flex-shrink: 0; }
.nav-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 8px;
  padding-left: 12px;
}
.side-link {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  transition: all .15s ease;
  width: 100%;
}
.side-link.active, .side-link:hover { background: var(--brand-soft); color: var(--brand-strong); transform: translateX(2px); }
.side-footer { margin-top: auto; display: grid; gap: 10px; color: #94a3b8; font-size: 13px; }
.main-area { min-width: 0; }
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(255,255,255,.86);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}
.mobile-menu { display: none; }
.page { padding: 24px; animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 28px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 380px; gap: 18px; align-items: start; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.panel-pad { padding: 18px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { flex: 1; min-width: 180px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.product-card {
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 124px;
  display: grid;
  align-content: space-between;
  transition: transform .18s ease, border .18s ease, box-shadow .18s ease;
}
.product-card:hover { transform: translateY(-2px); border-color: #bfdbfe; box-shadow: var(--shadow-hover); }
.product-card small, .muted { color: var(--muted); font-weight: 500; line-height: 1.6; }
.price { font-weight: 800; color: var(--primary); }
.cart-list { display: grid; gap: 10px; max-height: 350px; overflow: auto; }
.cart-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.qty { display: inline-flex; align-items: center; gap: 7px; }
.qty button { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.totals { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; display: grid; gap: 8px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-size: 22px; font-weight: 800; color: var(--ink); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 10px 12px; height: 48px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--ink-muted); font-size: 13px; font-weight: 600; background: var(--surface-subtle); }
tr:hover td { background: rgba(0,0,0,0.01); }
.actions { display: flex; gap: 8px; justify-content: flex-end; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { padding: 18px; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 700; }
.stat strong { display: block; margin-top: 8px; font-size: 26px; }
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 92px; gap: 12px; align-items: center; }
.bar { height: 12px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
  z-index: 40;
}
.modal {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; }
.receipt { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: #111827; }
.receipt-row { display: flex; justify-content: space-between; gap: 12px; margin: 7px 0; }
.receipt hr { border: 0; border-top: 1px dashed #94a3b8; margin: 12px 0; }
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; gap: 10px; }
@media (max-width: 768px) {
  .toast-root { bottom: 84px; right: 50%; transform: translateX(50%); align-items: center; justify-items: center; }
  .toast { text-align: center; }
}
.toast {
  width: min(360px, calc(100vw - 36px));
  background: #102033;
  color: white;
  padding: 13px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: toastIn .2s ease;
}
.toast.success { background: #047857; }
.toast.error { background: #b91c1c; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media print {
  body * { visibility: hidden; }
  .modal, .modal * { visibility: visible; }
  .modal { position: absolute; inset: 0; width: 100%; box-shadow: none; }
  .modal-head .btn, .modal-head button { display: none; }
}

@media (max-width: 920px) {
  .hero { grid-template-columns: 1fr; padding-top: 10px; }
  .feature-grid, .price-grid, .stat-grid, .grid-2 { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    transform: translateX(-102%);
    transition: transform .22s ease;
    z-index: 30;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .mobile-store-title { padding-left: 14px; }
  .page { padding: 16px; }
  .cta-band { display: grid; padding: 28px; }
  .cta-actions { align-items: stretch; }
}

@media (max-width: 560px) {
  .site-nav { height: auto; padding: 14px 0; align-items: flex-start; }
  .nav-actions { flex-wrap: wrap; justify-content: flex-end; }
  .hero h1 { font-size: 42px; }
  .mock-grid { grid-template-columns: 1fr; }
  .page-head { display: grid; }
  .toolbar .btn, .toolbar .field { width: 100%; }
  .actions { justify-content: flex-start; flex-wrap: wrap; }
  .checkout-controls { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 10px 10px 80px 10px !important; }
  .modal { max-height: calc(100vh - 100px) !important; }
}

/* Requirement update additions */
.sidebar-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .38);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
  z-index: 25;
}
.sidebar-scrim.open { opacity: 1; visibility: visible; }
.sidebar { transition: transform .24s ease, box-shadow .24s ease; }
.home-page .hero-head { align-items: flex-start; }
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr);
  gap: 22px;
  align-items: stretch;
}
.home-page { background: radial-gradient(circle at top left, rgba(37, 99, 235, .04), transparent 34%), radial-gradient(circle at 80% 10%, rgba(16, 185, 129, .04), transparent 30%); }
.home-page .panel { border-radius: var(--radius-md); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title h2 { margin: 0; }
.status-badge, .muted-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
}
.status-badge.success { color: #047857; background: #d1fae5; }
.status-badge.danger { color: #b91c1c; background: #fee2e2; }
.muted-pill { color: #475569; background: #f1f5f9; }
.checkin-status { display: grid; gap: 8px; align-content: start; }
.checkin-status p { margin: 0; line-height: 1.6; font-size: 14px; font-weight: 500; color: var(--muted); }
.empty-state { font-size: 22px; font-weight: 800; margin: 0; }
.attendance-image { width: min(260px, 100%); border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 14px 30px rgba(15, 23, 42, .12); }
.sales-highlight { align-self: start;
  background: var(--surface);
  color: var(--ink);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
}
.checkin-card { background: var(--surface); border: 1px solid var(--line); align-self: start; }
.stock-card { background: var(--surface); border: 1px solid var(--line); align-self: start; }

.sales-highlight > * { position: relative; z-index: 1; }
.sales-highlight strong, .expenses-snapshot strong { display: block; font-size: clamp(30px, 5vw, 46px); margin: 10px 0; color: var(--ink); }
.sales-highlight p { color: var(--ink-muted); }
.stock-card { grid-column: span 1; }
.expenses-snapshot { align-self: start; }
.mini-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 12px 0 18px; }
.mini-stats div { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fbfdff; }
.mini-stats span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.mini-stats strong { display: block; font-size: 28px; margin-top: 8px; }
.stock-chart-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.pie-chart { width: 154px; height: 154px; border-radius: 999px; border: 10px solid #fff; box-shadow: 0 18px 45px rgba(15, 23, 42, .12); }
.pie-chart.clickable { cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.pie-chart.clickable:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 22px 52px rgba(15, 23, 42, .16); }
.pie-chart.clickable:focus-visible { outline: 3px solid rgba(37, 99, 235, .28); outline-offset: 4px; }
.legend { display: grid; gap: 9px; color: var(--muted); font-weight: 700; }
.legend span, .legend button { display: flex; align-items: center; gap: 8px; }
.legend button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 8px 11px;
  font-weight: 800;
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.legend button:hover { transform: translateY(-1px); border-color: #bfdbfe; box-shadow: 0 10px 24px rgba(37, 99, 235, .08); }
.legend i { width: 11px; height: 11px; border-radius: 999px; display: inline-block; }
.transactions-layout { grid-template-columns: 1fr 360px; }
.checkout-panel { position: sticky; top: 90px; }
.transaction-panel { margin-top: 18px; }
.elevated-panel { border-radius: 20px; box-shadow: 0 18px 50px rgba(15, 23, 42, .08); }
.transaction-filters { align-items: end; padding: 4px; border-radius: 16px; background: #f8fafc; }
.summary-strip { padding: 16px 18px; border-radius: 16px; background: linear-gradient(135deg, #eff6ff, #ecfdf5); color: #1d4ed8; font-weight: 900; margin-bottom: 16px; box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .08); }
.transaction-groups { display: grid; gap: 18px; max-height: 560px; overflow: auto; padding-right: 4px; }
.transaction-group { display: grid; gap: 9px; }
.transaction-day { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.transaction-day h3 { margin: 0; }
.transaction-day span { color: var(--muted); font-weight: 800; }
.transaction-item { display: flex; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 10px 24px rgba(15, 23, 42, .04); }
.transaction-day { background: #fff; position: sticky; top: 0; z-index: 1; border-radius: 12px; padding: 10px 12px; }
.report-filters { margin-bottom: 18px; }
.report-stat-grid { grid-template-columns: repeat(5, 1fr); }
.stat.net { background: #ecfdf5; border-color: #a7f3d0; }
.product-card:disabled { background: #f8fafc; color: #94a3b8; }
.checkout-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.checkout-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; }
.checkout-product-grid .product-card { min-height: 112px; border-radius: 14px; }
.checkout-summary-panel { position: sticky; top: 88px; }
.compact-cart { max-height: min(44vh, 360px); }
.sticky-total { position: sticky; bottom: 0; background: var(--panel); }
.checkout-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.users-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.user-attendance-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: #fff; display: grid; gap: 10px; }
.user-attendance-card strong { display: block; font-size: 17px; }
.user-attendance-card span, .user-attendance-card p { color: var(--muted); margin: 0; }
.attendance-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.attendance-thumb { width: 86px; height: 86px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.attendance-workspace { min-height: 420px; display: grid; align-items: center; }
.attendance-empty { text-align: center; display: grid; gap: 12px; justify-items: center; padding: 46px 18px; }
.attendance-empty h2 { margin: 0; font-size: clamp(30px, 5vw, 52px); letter-spacing: -.04em; }
.attendance-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.attendance-detail-card { border: 1px solid var(--line); border-radius: 22px; padding: 18px; background: linear-gradient(180deg, #fff, #f8fbff); display: grid; gap: 14px; align-content: start; }
.attendance-detail-card h2 { margin: 0; font-size: clamp(24px, 4vw, 38px); letter-spacing: -.04em; }
.attendance-large-image { width: 100%; max-height: 360px; object-fit: cover; border-radius: 18px; border: 1px solid var(--line); box-shadow: 0 18px 42px rgba(15, 23, 42, .10); }

.hidden-field {
  display: none !important;
}

.pos-date-panel {
  margin-bottom: 16px;
}

.pos-date-toolbar {
  margin-bottom: 0;
  align-items: end;
}

.pos-balance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.pos-balance-card {
  display: grid;
  gap: 12px;
  min-height: 190px;
}



.pos-balance-card strong {
  display: block;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
  letter-spacing: -.04em;
}

.pos-balance-card p {
  margin: 0;
  color: var(--muted);
}

.pos-quick-row,
.amount-stepper {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
}

.pos-quick-row input,
.amount-stepper input {
  text-align: center;
  font-weight: 800;
}

.pos-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.pos-action-form {
  display: grid;
  gap: 10px;
}

.pos-action-form textarea {
  min-height: 92px;
  resize: vertical;
}

.pos-actions-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.pos-action-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.pos-action-item strong {
  display: block;
  line-height: 1.45;
}

.pos-action-item p {
  margin: 6px 0 0;
  color: var(--muted);
}

.pos-action-item span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pos-action-item small {
  align-self: start;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 6px 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* POS ledger redesign */
.pos-page {
  max-width: 1320px;
}

.pos-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}

.pos-hero::after {
  content: '';
  position: absolute;
  inset: auto -80px -120px auto;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .10);
}

.pos-hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 8px;
}

.pos-hero-copy .eyebrow {
  color: var(--muted);
}

.pos-hero h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  letter-spacing: -.045em;
}

.pos-hero p {
  max-width: 620px;
  margin: 0;
  color: var(--ink-muted);
  font-size: 16px;
}

.pos-date-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-content: end;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 18px;
  background: rgba(255, 255, 255, .10);
  backdrop-filter: blur(12px);
}

.pos-date-card .field {
  margin-bottom: 0;
}

.pos-date-card label {
  color: rgba(255, 255, 255, .74);
}

.pos-date-card select,
.pos-date-card input {
  border-color: rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .96);
}

.pos-date-card .btn {
  width: 100%;
  background: #fff;
  color: #1d4ed8;
}

.pos-balance-grid {
  grid-template-columns: 1.16fr .92fr .92fr;
  gap: 18px;
  margin-bottom: 18px;
}

.pos-balance-card {
  position: relative;
  overflow: hidden;
  padding: clamp(18px, 2.4vw, 24px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(16, 24, 40, .08);
  display: grid;
  align-content: space-between;
  gap: 14px;
  min-height: 236px;
}

.pos-balance-card::after {
  content: '';
  position: absolute;
  right: -44px;
  top: -56px;
  width: 150px;
  height: 150px;
  border-radius: 999px;
  background: #eff6ff;
}

.pos-balance-card.total {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--shadow-md);
}

.pos-balance-card.cash::after {
  background: #ecfdf5;
}

.pos-balance-card.bank::after {
  background: #fff7ed;
}

.pos-card-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pos-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 900;
}

.pos-balance-card.total .pos-card-icon {
  background: var(--surface-subtle);
  color: var(--ink);
}

.pos-balance-card.cash .pos-card-icon {
  background: #d1fae5;
  color: #047857;
}

.pos-balance-card.bank .pos-card-icon {
  background: #ffedd5;
  color: #c2410c;
}

.pos-balance-card .eyebrow,
.pos-balance-card strong,
.pos-balance-card p,
.pos-mini-label,
.pos-quick-row {
  position: relative;
  z-index: 1;
}

.pos-balance-card strong {
  font-size: clamp(30px, 4.3vw, 48px);
  letter-spacing: -.055em;
}

.pos-balance-card.total .eyebrow,
.pos-balance-card.total p {
  color: var(--muted);
}

.pos-mini-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.pos-quick-row,
.amount-stepper {
  grid-template-columns: 44px minmax(92px, 1fr) 44px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.pos-quick-row .btn,
.amount-stepper .btn {
  border-radius: 12px;
  background: #fff;
  color: #172033;
  box-shadow: 0 8px 18px rgba(16, 24, 40, .05);
}

.pos-quick-row input,
.amount-stepper input {
  border: 0;
  background: transparent;
  min-height: 38px;
  padding: 4px;
}

.pos-workspace {
  grid-template-columns: minmax(330px, 430px) minmax(0, 1fr);
  gap: 18px;
}

.pos-action-panel,
.pos-history-panel {
  padding: clamp(18px, 2.4vw, 24px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 18px 44px rgba(16, 24, 40, .07);
}

.pos-action-panel {
  position: sticky;
  top: 88px;
}

.pos-action-panel .card-title p,
.pos-history-panel .card-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.pos-action-form {
  gap: 12px;
}

.pos-action-form .field {
  margin-bottom: 0;
}

.pos-action-form select,
.pos-action-form input,
.pos-action-form textarea {
  background: #fbfdff;
}

.pos-action-form .btn.primary {
  min-height: 50px;
  margin-top: 4px;
}

.pos-history-panel {
  min-height: 430px;
}

.pos-actions-list {
  max-height: 640px;
  gap: 12px;
}

.pos-action-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 16px 16px 16px 18px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 24, 40, .06);
}

.pos-action-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 999px;
  background: #2563eb;
}

.pos-action-item strong {
  font-size: 15px;
}

.pos-action-item small {
  background: #f1f5f9;
  color: #475569;
  border-radius: 999px;
}

.pos-action-item.withdrawal::before {
  background: #0f766e;
}

.pos-action-item.withdrawal small {
  background: #ccfbf1;
  color: #0f766e;
}

.pos-action-item.add::before {
  background: #16a34a;
}

.pos-action-item.add small {
  background: #dcfce7;
  color: #15803d;
}

.pos-action-item.subtract::before {
  background: #dc2626;
}

.pos-action-item.subtract small {
  background: #fee2e2;
  color: #b91c1c;
}

.pos-action-item.set::before {
  background: #7c3aed;
}

.pos-action-item.set small {
  background: #ede9fe;
  color: #6d28d9;
}

@media (max-width: 1080px) {
  .dashboard-grid, .transactions-layout, .report-stat-grid, .checkout-layout, .pos-balance-grid, .pos-workspace { grid-template-columns: 1fr; }
  .checkout-panel { position: static; }
  .checkout-summary-panel { position: sticky; bottom: 0; top: auto; z-index: 8; border-radius: 18px 18px 0 0; box-shadow: 0 -18px 40px rgba(15, 23, 42, .12); }
  .checkout-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .checkout-controls { grid-template-columns: 1fr 1fr; }
  .compact-cart { max-height: 190px; }
  .attendance-detail-grid { grid-template-columns: 1fr; }
  .pos-hero { grid-template-columns: 1fr; }
  .pos-action-panel { position: static; }
}

@media (min-width: 921px) {
  .sidebar-scrim { display: none; }
}

/* Modern responsive polish pass */


.dashboard {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 22% 0%, rgba(37, 99, 235, .08), transparent 34%),
    linear-gradient(180deg, #f8fbff 0%, #f7f9fc 42%, #f5f7fb 100%);
}



.topbar {
  height: 68px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .04);
}

.page {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(14px, 2.2vw, 28px);
}

.page-head {
  align-items: flex-start;
  margin-bottom: clamp(16px, 2.2vw, 26px);
}

.page-head h1 {
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.06;
  letter-spacing: -.045em;
  font-weight: 800;
}

.page-head p {
  max-width: 680px;
  font-size: 15px;
}

.panel {
  border-color: var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.panel-pad {
  padding: clamp(15px, 2vw, 22px);
}

.btn {
  border-radius: 12px;
  min-height: 44px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.btn.primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 12px 26px rgba(37, 99, 235, .22);
}

.btn.ghost {
  background: rgba(255, 255, 255, .72);
}

input,
select,
textarea {
  min-height: 40px;
  border-radius: var(--radius-sm);
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(14px, 2vw, 22px);
}

.sales-highlight { align-self: start;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
}

.checkin-card,
.stock-card,
.expenses-snapshot { align-self: start;
  min-width: 0;
}

.mini-stats {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.mini-stats strong,
.stat strong {
  letter-spacing: -.035em;
}

.stock-chart-wrap {
  align-items: center;
}

.transaction-filters,
.toolbar {
  gap: 12px;
}

.transaction-item {
  align-items: flex-start;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  min-width: 760px;
}

.checkout-layout,
.transactions-layout,
.grid-2 {
  min-width: 0;
}

.checkout-product-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.floating-cart-btn {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 45;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #111827, #1d4ed8);
  color: white;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 18px 40px rgba(29, 78, 216, .24);
}

.floating-cart-btn.has-items {
  background: linear-gradient(135deg, #0f172a, #0f766e);
}

.floating-cart-icon {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.floating-cart-meta {
  display: grid;
  gap: 1px;
  text-align: left;
}

.floating-cart-meta span {
  font-size: 11px;
  color: rgba(255,255,255,.78);
  font-weight: 800;
}

.floating-cart-meta strong {
  font-size: 15px;
  line-height: 1;
}

.cart-modal-shell {
  display: grid;
  gap: 14px;
}

.cart-modal-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.cart-modal-topline span {
  color: var(--muted);
  font-weight: 800;
}

.cart-modal-controls {
  margin-top: 4px;
}

.sale-success-shell {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 18px 10px 8px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.sale-success-shell h2,
.sale-success-shell p {
  margin: 0;
}

.sale-success-check {
  width: 76px;
  height: 76px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #10b981, #2563eb);
  color: white;
  font-size: 38px;
  font-weight: 900;
  box-shadow: 0 18px 40px rgba(16, 185, 129, .22);
}

.sale-success-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sale-success-confetti span {
  position: absolute;
  top: -8px;
  left: calc((var(--piece) * 5.2%) + 4%);
  width: 9px;
  height: 18px;
  border-radius: 999px;
  background: hsl(calc(var(--piece) * 20deg), 90%, 60%);
  animation: confettiDrop .95s ease-out forwards;
  animation-delay: calc(var(--piece) * .03s);
  transform: rotate(calc(var(--piece) * 12deg));
}

.cart-item {
  min-width: 0;
}

@media (min-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr);
  }

  .sales-highlight { align-self: start;
    min-height: 220px;
  }
}

@media (max-width: 920px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 15px;
  }

  .dashboard {
    display: block;
  }

  .sidebar {
    width: min(86vw, 320px);
    height: 100dvh;
    overflow-y: auto;
    box-shadow: 24px 0 70px rgba(15, 23, 42, .26);
  }

  .sidebar-scrim.open {
    backdrop-filter: blur(2px);
  }

  .main-area {
    width: 100%;
    min-width: 0;
  }

  .topbar {
    height: 64px;
    gap: 10px;
  }

  .topbar strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-head {
    display: grid;
    gap: 10px;
  }

  .page-head .btn,
  .page-head .status-badge {
    justify-self: start;
  }

  .stat-grid,
  .report-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .transaction-groups {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .transaction-day {
    position: static;
  }

  .checkout-layout {
    gap: 12px;
  }

  .checkout-products-panel {
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 12px;
  }

  .panel-pad {
    padding: 14px;
  }

  .page-head h1 {
    font-size: clamp(25px, 9vw, 34px);
  }

  .pos-action-item {
    display: grid;
  }

  .pos-action-item small {
    justify-self: start;
  }

  .pos-hero {
    border-radius: 20px;
    padding: 18px;
  }

  .pos-date-card {
    padding: 12px;
  }

  .pos-balance-card,
  .pos-action-panel,
  .pos-history-panel {
    border-radius: 18px;
  }

  .pos-quick-row,
  .amount-stepper {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
  }

  .card-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar,
  .transaction-filters {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .toolbar .field,
  .toolbar .btn,
  .transaction-filters .field,
  .transaction-filters .btn {
    width: 100%;
  }

  .stat-grid,
  .report-stat-grid,
  .mini-stats {
    grid-template-columns: 1fr;
  }

  .sales-highlight strong,
  .expenses-snapshot strong {
    font-size: clamp(30px, 10vw, 42px);
  }

  .stock-chart-wrap {
    justify-content: center;
    text-align: left;
  }

  .checkout-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .checkout-product-grid .product-card {
    padding: 12px;
    min-height: 104px;
  }

  .checkout-controls {
    grid-template-columns: 1fr;
  }

  .cart-item {
    grid-template-columns: 1fr;
  }

  .qty {
    justify-content: space-between;
  }

  .transaction-item,
  .transaction-day {
    display: grid;
    grid-template-columns: 1fr;
  }

  .attendance-workspace {
    min-height: auto;
  }

  .attendance-empty {
    padding: 28px 8px;
  }

  .attendance-large-image {
    max-height: 260px;
  }
}

@media (max-width: 380px) {
  .checkout-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar .muted {
    display: none;
  }
}

/* Checkout speed pass: keep sale logging compact on phones */
.checkout-products-panel {
  min-width: 0;
}

.checkout-product-grid .product-card {
  gap: 8px;
  overflow: hidden;
}

.checkout-product-grid .product-card strong {
  display: block;
  margin-top: 3px;
  line-height: 1.15;
}

@media (max-width: 920px) {
  .checkout-layout {
    gap: 12px;
  }

  .floating-cart-btn {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    padding: 9px 11px;
    gap: 8px;
  }
}

@media (max-width: 640px) {
  .checkout-toolbar {
    margin-bottom: 10px;
  }

  .checkout-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .checkout-product-grid .product-card {
    min-height: 86px;
    padding: 10px;
    border-radius: 13px;
    font-size: 13px;
  }

  .checkout-product-grid .product-card small {
    font-size: 11px;
    line-height: 1.2;
  }

  .checkout-product-grid .price {
    font-size: 15px;
  }

  .cart-item {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
  }

  .cart-item small {
    font-size: 12px;
  }

  .qty {
    justify-content: flex-end;
    gap: 5px;
  }

  .qty button {
    width: 26px;
    height: 26px;
    border-radius: 8px;
  }

  .qty .btn.icon {
    width: 28px;
    height: 28px;
  }

  .checkout-controls {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .checkout-controls label {
    font-size: 12px;
  }

  .totals {
    margin-top: 10px;
    padding-top: 10px;
  }

  .totals .grand {
    font-size: 18px;
  }

  .floating-cart-meta strong {
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  .checkout-product-grid .product-card {
    min-height: 78px;
    padding: 9px;
  }

  .checkout-controls {
    grid-template-columns: 1fr;
  }
}

@keyframes confettiDrop {
  0% {
    opacity: 0;
    transform: translateY(-12px) rotate(0deg);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(170px) rotate(220deg);
  }
}

/* Stock drill-down */
.stock-explorer-panel {
  display: grid;
  gap: 18px;
}

.stock-filter-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stock-filter-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 11px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(16, 24, 40, .05);
}

.stock-filter-btn i {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
}

.stock-filter-btn.active {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.stock-empty {
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.stock-empty h2 {
  margin: 0 0 6px;
}

.stock-results-title {
  margin-bottom: 12px;
}

.stock-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.stock-product-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(16, 24, 40, .05);
  display: grid;
  gap: 7px;
}

.stock-product-card strong {
  font-size: 17px;
}

.stock-product-card span {
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 640px) {
  .stock-filter-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .stock-filter-btn {
    justify-content: center;
    padding: 11px 10px;
  }

  .stock-product-grid {
    grid-template-columns: 1fr;
  }
}

/* Tab styles */
.tab-container {
  margin-top: 16px;
}
.tab-headers {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 16px;
}
.tab-btn {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
}
.tab-btn:hover {
  color: #1e293b;
}
.tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Product wrapper and footer additions */
.product-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.product-card-footer {
  font-size: 0.78rem;
  color: #64748b;
  padding: 0 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.product-card-footer a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}
.product-card-footer a:hover {
  text-decoration: underline;
}

/* Product history modal and badges */
.product-history-modal table {
  width: 100%;
  border-collapse: collapse;
}
.product-history-modal th, .product-history-modal td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}
.text-success {
  color: #10b981 !important;
}
.text-danger {
  color: #ef4444 !important;
}
.pill-sale { background-color: #fee2e2; color: #991b1b; padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; }
.pill-restock { background-color: #d1fae5; color: #065f46; padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; }
.pill-initial { background-color: #dbeafe; color: #1e40af; padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; }
.pill-adjustment { background-color: #fef3c7; color: #92400e; padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; }

.product-history-badge {
  display: inline-block;
  background: #ecfdf5;
  color: #047857;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 4px;
}
.history-link {
  color: #2563eb;
  text-decoration: none;
  font-size: 0.8rem;
  margin-left: 6px;
}
.history-link:hover {
  text-decoration: underline;
}

/* Insights Styles */
.insights-panel {
  box-shadow: 0 10px 26px rgba(16, 24, 40, .05);
}
.insight-item {
  transition: transform 0.2s ease;
}
.insight-item:hover {
  transform: translateX(2px);
}

/* Quick Stock Adjust Style */
.quick-stock-adjust input.stock-adj-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-color, var(--line));
  text-align: center;
  transition: border-color 0.2s ease;
}
.quick-stock-adjust input.stock-adj-input:focus {
  outline: none;
  border-color: var(--primary);
}
.quick-stock-adjust button {
  transition: transform 0.1s ease, opacity 0.2s ease;
}
.quick-stock-adjust button:hover {
  transform: scale(1.05);
  opacity: 0.9;
}
.quick-stock-adjust button:active {
  transform: scale(0.95);
}

/* Skeleton Loading States */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite ease-in-out;
  border-radius: 6px;
  color: transparent !important;
  border-color: transparent !important;
}
.skeleton * {
  visibility: hidden !important;
}
@keyframes skeletonLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty States */
.empty-state-card {
  text-align: center;
  padding: 48px 24px;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 240px;
}
.empty-state-card svg {
  width: 54px;
  height: 54px;
  color: #cbd5e1;
  margin-bottom: 8px;
}
.empty-state-card h3 {
  color: var(--ink);
  margin: 0;
  font-size: 18px;
}
.empty-state-card p {
  margin: 0;
  max-width: 320px;
  line-height: 1.5;
}

.mobile-bottom-nav { display: none; }
@media (max-width: 767px) {
  .mobile-bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--panel); border-top: 1px solid var(--line); justify-content: space-around; padding-bottom: env(safe-area-inset-bottom); z-index: 100; box-shadow: 0 -4px 12px rgba(0,0,0,0.05); }
  .mobile-bottom-nav .nav-item { background: none; border: none; flex: 1; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 0.7rem; font-weight: 600; }
  .mobile-bottom-nav .nav-item.active { color: var(--primary); }
  .main-area { padding-bottom: 70px; }
  .topbar .mobile-menu { display: flex; /* Show the hamburger on the top bar */ }
  .btn.btn-checkout-action { font-size: 1.1rem; padding: 16px; box-shadow: 0 4px 16px rgba(22, 163, 74, .4); }
  .floating-cart-btn { bottom: calc(75px + env(safe-area-inset-bottom)) !important; }
}

/* --- UI/UX Refinements: Skeleton Loading, Top Progress Bar, Sidebar Collapse --- */

#top-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--brand);
  z-index: 9999;
  width: 0%;
  transition: width 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}
#top-progress-bar.active {
  opacity: 1;
}

.skeleton {
  background: #e2e8f0;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text {
  height: 16px;
  width: 100%;
  margin-bottom: 8px;
}
.skeleton-text.short { width: 60%; }
.skeleton-title { height: 28px; width: 40%; margin-bottom: 16px; }
.skeleton-card { height: 120px; width: 100%; }
.skeleton-button { height: 40px; width: 100px; }

@media (min-width: 921px) {
  .dashboard.sidebar-collapsed {
    grid-template-columns: 74px 1fr;
  }
  .dashboard.sidebar-collapsed .sidebar {
    padding: 24px 12px;
    overflow: visible !important;
  }
  .dashboard.sidebar-collapsed .brand {
    justify-content: center !important;
  }
  .dashboard.sidebar-collapsed .brand .full-logo {
    display: none !important;
  }
  .dashboard.sidebar-collapsed .brand .icon-logo {
    display: block !important;
    margin-right: 0 !important;
    margin-bottom: 12px;
  }
  .dashboard.sidebar-collapsed .brand {
    flex-direction: column;
  }
  .dashboard.sidebar-collapsed .collapse-btn-float {
    transform: rotate(180deg);
  }
  .dashboard.sidebar-collapsed .nav-label {
    display: none;
  }
  .dashboard.sidebar-collapsed .side-link {
    justify-content: center;
    padding: 12px;
    position: relative;
  }

  .dashboard.sidebar-collapsed .side-link span {
    display: none;
  }
  .dashboard.sidebar-collapsed .side-link svg {
    margin-right: 0 !important;
    transform: scale(1.3);
  }
  .dashboard.sidebar-collapsed .brand img {
    margin-right: 0 !important;
  }
  .dashboard.sidebar-collapsed .brand span {
    display: none;
  }
  .dashboard.sidebar-collapsed .side-footer > div > div:first-child {
    display: none !important;
  }
  .dashboard.sidebar-collapsed .plan-menu-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
  }
  .dashboard.sidebar-collapsed .plan-menu-popup {
    right: auto !important;
    left: 100% !important;
    bottom: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin-left: 10px;
  }
}




/* Tooltip Styles */
.tooltip-container {
  display: inline-flex;
  position: relative;
  cursor: help;
  outline: none;
}
.info-icon {
  opacity: 0.8;
  transition: opacity 0.2s;
}
.tooltip-container:hover .info-icon, .tooltip-container:focus .info-icon {
  opacity: 1;
}
.tooltip-popover {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  background: var(--primary);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  width: max-content;
  max-width: 250px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  box-shadow: var(--shadow-md);
  z-index: 50;
  line-height: 1.4;
}
.tooltip-container:hover .tooltip-popover,
.tooltip-container:focus .tooltip-popover,
.tooltip-container:focus-within .tooltip-popover {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-2px);
}
