:root {
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.35);
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.12);
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --radius: 1rem;
}

[data-bs-theme="dark"] {
  --glass-bg: rgba(22, 27, 34, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.app-body {
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, 0.25), transparent),
    radial-gradient(900px 500px at 100% 0%, rgba(236, 72, 153, 0.12), transparent),
    var(--bs-body-bg);
}

.app-navbar {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--glass-bg) !important;
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.brand-gradient {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
}

.app-shell {
  min-height: calc(100vh - 56px);
}

.app-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.app-sidebar .nav-link {
  color: var(--bs-body-color);
  opacity: 0.85;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), transparent);
  color: var(--bs-body-color);
  opacity: 1;
}

.sidebar-section-label {
  letter-spacing: 0.06em;
  font-weight: 600;
  font-size: 0.68rem;
}

.sidebar-submenu {
  margin-left: 0.35rem;
  padding: 0.35rem 0.5rem 0.35rem 0.65rem;
  border-left: 2px solid rgba(var(--bs-primary-rgb), 0.25);
  border-radius: 0 0.5rem 0.5rem 0;
  background: rgba(var(--bs-primary-rgb), 0.04);
}

.sidebar-submenu .nav-link {
  font-size: 0.875rem;
  padding: 0.35rem 0.65rem;
}

.sidebar-submenu .nav-link.active {
  background: rgba(var(--bs-primary-rgb), 0.12);
  font-weight: 600;
}

.sidebar-submenu-heading {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-sidebar .nav-link[data-bs-toggle="collapse"].active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), transparent);
}

.app-sidebar .nav-link[data-bs-toggle="collapse"][aria-expanded="true"] .sidebar-chevron {
  transform: rotate(180deg);
}

.sidebar-chevron {
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.nav-tabs-settings {
  border-bottom-color: rgba(var(--bs-primary-rgb), 0.2);
  gap: 0.25rem;
}

.nav-tabs-settings .nav-link {
  white-space: nowrap;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--bs-body-color);
  opacity: 0.75;
  padding: 0.5rem 0.85rem;
}

.nav-tabs-settings .nav-link:hover {
  opacity: 1;
  border-bottom-color: rgba(var(--bs-primary-rgb), 0.35);
}

.nav-tabs-settings .nav-link.active {
  opacity: 1;
  font-weight: 600;
  background: transparent;
  border-bottom-color: var(--bs-primary);
  color: var(--bs-primary);
}

.app-main {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
  overflow-x: auto;
}

.app-site-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 0.5rem 0.25rem 0.15rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--bs-secondary-color);
  text-align: center;
  border-top: 1px solid var(--glass-border);
}

.app-site-footer-sep {
  opacity: 0.65;
}

.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 48px rgba(31, 38, 135, 0.18);
}

.glass-btn,
.glass-select {
  backdrop-filter: blur(8px);
  background: var(--glass-bg) !important;
  border: 1px solid var(--glass-border) !important;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: #fff;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    z-index: 1040;
    top: 56px;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
  .app-sidebar.show {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.15);
  }
  .app-main {
    width: 100%;
  }
}

.table-glass thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color);
  border-bottom-width: 1px;
}

.fade-in {
  animation: fadeIn 0.35s ease both;
}

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

/* ── POS Page Styles ── */

body.pos-active {
  overflow: hidden;
}
body.pos-active .app-main {
  overflow: hidden !important;
  padding: 0.5rem 0.75rem 1rem 0.75rem !important;
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
}

/* POS: sidebar hidden by default; shown only when user toggles menu */
body.pos-active #appSidebar {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  border: none !important;
  overflow: hidden !important;
}
body.pos-active #appShell.pos-sidebar-shown #appSidebar {
  display: block !important;
  width: 260px !important;
  min-width: 260px !important;
  overflow: auto !important;
}
body.pos-active .app-main {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  flex: 1 1 100% !important;
}
body.pos-active #appShell.pos-sidebar-shown .app-main {
  width: auto !important;
  max-width: none !important;
  flex: 1 1 auto !important;
}
.pos-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  padding-bottom: 0.5rem;
  box-sizing: border-box;
}

.pos-topbar {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.pos-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.pos-left-col {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding-top: 4px;
}

.pos-search-wrap {
  position: relative;
  flex-shrink: 0;
}
.pos-search-input .form-control {
  font-size: 1.15rem;
  padding: 0.7rem 1rem;
  font-weight: 500;
}
.pos-search-input .form-control:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  border-color: var(--accent);
}
.pos-search-input .input-group-text {
  background: rgba(99, 102, 241, 0.1);
  border-right: 0;
  color: var(--accent);
  font-size: 1.2rem;
}
.pos-search-input .form-control {
  border-left: 0;
}
.pos-search-dropdown {
  z-index: 1050;
}
.pos-customer-card {
  position: relative;
  z-index: 60;
  overflow: visible !important;
}
.pos-right-top {
  overflow: visible;
  position: relative;
  z-index: 55;
}
.pos-cust-search-wrap {
  position: relative;
  z-index: 61;
}
.pos-cust-search-wrap .input-group-text {
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent);
}
.pos-cust-dropdown {
  max-height: 240px;
  overflow-y: auto;
  z-index: 10050 !important;
  border: 1px solid var(--glass-border);
  background: var(--bs-body-bg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.pos-cust-dropdown .dropdown-item {
  white-space: normal;
}
.pos-cust-dropdown .dropdown-item:hover,
.pos-cust-dropdown .dropdown-item:focus {
  background: rgba(99, 102, 241, 0.12);
}

.pos-cart-card {
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
  flex: 1 1 auto;
}
.pos-cart-card:hover {
  transform: none;
}
.pos-cart-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.pos-cart-scroll::-webkit-scrollbar {
  width: 5px;
}
.pos-cart-scroll::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.2);
  border-radius: 5px;
}
.pos-cart-footer {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.pos-order-summary {
  flex-shrink: 0;
}
.pos-order-summary:hover {
  transform: none;
}
.pos-sum-label {
  font-size: 0.9rem;
  color: var(--bs-secondary-color);
}
.pos-amount {
  font-size: 1.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.pos-cart-footer .pos-amount {
  font-size: 1.35rem;
}
.pos-order-summary .pos-sum-grid .py-1 {
  padding-top: 0.2rem !important;
  padding-bottom: 0.2rem !important;
}
.pos-order-summary .pos-grand-total,
.pos-order-summary #smGrandTotal {
  font-size: 2.15rem;
  font-weight: 800;
}
.pos-pay-summary {
  font-size: 0.95rem;
}
.pos-pay-summary .pos-amount {
  font-size: 1.3rem;
}
.pos-pay-summary #smDue {
  font-size: 1.5rem;
}
.pos-shift-wrap {
  min-width: 0;
}
.pos-shift-compact {
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.35rem 0.55rem;
}
.pos-shift-compact:hover {
  filter: brightness(1.05);
}
.pos-shift-inline {
  min-width: 0;
  padding: 0.15rem 0.5rem;
  border-radius: 0.375rem;
  border: 1px solid rgba(25, 135, 84, 0.3);
  background: rgba(25, 135, 84, 0.06);
}
.pos-shift-inline strong {
  font-size: 0.95rem;
  font-weight: 700;
}
.pos-right-col {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 4px 8px 12px 4px;
}
.pos-right-panel {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.pos-right-panel .glass-card:hover {
  transform: none;
}
.pos-right-bottom {
  padding-top: 0.25rem;
  border-top: 1px solid var(--glass-border);
  background: var(--glass-bg);
  border-radius: var(--radius);
  padding-left: 0.25rem;
  padding-right: 0.25rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0.25rem;
}

.pos-pay-btn {
  font-size: 1.15rem;
  padding: 0.75rem 1.5rem;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 20px rgba(25, 135, 84, 0.35);
  transition: all 0.2s;
}
.pos-pay-btn:hover {
  box-shadow: 0 6px 28px rgba(25, 135, 84, 0.5);
  transform: translateY(-1px);
}
.pos-pay-btn kbd,
#btnPayFull kbd,
#btnClearCart kbd,
#btnNewSale kbd {
  font-size: 0.7em;
  padding: 0.1em 0.35em;
  vertical-align: middle;
}
.pos-pay-btn kbd {
  background: rgba(255, 255, 255, 0.25);
  color: inherit;
}
.pos-shortcut-hint kbd {
  font-size: 0.7em;
  padding: 0.12em 0.35em;
}

#posCartTable th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding: 0.4rem 0.5rem;
  color: var(--bs-secondary-color);
}
#posCartTable td {
  padding: 0.3rem 0.5rem;
  vertical-align: middle;
}
#posCartTable .qty-minus,
#posCartTable .qty-plus {
  padding: 0.15rem 0.4rem;
  font-size: 0.85rem;
  line-height: 1;
}

#posEmptyCart {
  padding: 3rem 1rem !important;
}
.opacity-15 {
  opacity: 0.15;
}

@media (max-width: 991.98px) {
  body.pos-active {
    overflow: auto;
  }
  body.pos-active .app-main {
    height: auto;
    max-height: none;
    overflow: visible !important;
  }
  .pos-page {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .pos-body {
    overflow: visible;
  }
  .pos-left-col {
    height: auto;
    min-height: 280px;
  }
  .pos-right-col {
    height: auto;
    overflow: visible;
    padding: 4px 8px;
  }
  .pos-right-panel {
    height: auto;
    overflow: visible;
  }
  .pos-cart-scroll {
    max-height: 40vh;
    min-height: 180px;
  }
}

@media (max-width: 767.98px) {
  .pos-search-input .form-control {
    font-size: 1rem;
  }
  .pos-pay-btn {
    font-size: 1rem;
    padding: 0.65rem 1rem;
  }
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
}

.subscription-badge {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 0.35rem;
  font-size: 0.78rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(99, 102, 241, 0.08);
  color: #4338ca;
}

.subscription-badge.is-warning {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

.subscription-badge.is-expired {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}

.subscription-badge-days {
  opacity: 0.9;
}

.subscription-alert {
  border-radius: 0.75rem;
}

.subscription-expired-panel {
  padding: 1.25rem 0.5rem 0.25rem;
}

.subscription-expired-icon {
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #dc2626;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(249, 115, 22, 0.1));
  border: 2px solid rgba(239, 68, 68, 0.25);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.12);
}

.subscription-expired-date {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: rgba(239, 68, 68, 0.06);
  border: 1px dashed rgba(239, 68, 68, 0.25);
}

.login-submit-btn {
  background: linear-gradient(120deg, #6366f1, #8b5cf6);
  border: none;
}
