/* =====================================================
   POS System - Professional Slate & Blue Theme
   ===================================================== */

:root {
    /* App-wide font, loaded via Google Fonts link in templates/header.php */
    --font-heading: 'Afacad Flux', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-base: 'Afacad Flux', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* UI zoom level, adjusted by the on-screen zoom control (see header.php) */
    --ui-zoom: 1;
    --primary-cyan: #2563eb;
    --primary-emerald: #eff6ff;
    --primary-teal: #dbeafe;
    --cyan-900: #f8fafc;
    --teal-900: #eef2f7;
    --emerald-900: #eaf0f6;

    --text-main: #0f172a;
    --text-muted: #475569;
    --text-soft: #64748b;

    --glass-bg: rgba(255, 255, 255, 0.82);
    --glass-border: rgba(51, 65, 85, 0.10);
    --glass-shadow: rgba(15, 23, 42, 0.08);
    --navbar-space: 0px;
    --sidebar-width: 272px;
    --topbar-height: 64px;
    --btn-primary-start: #2563eb;
    --btn-primary-end: #1e40af;
    --btn-secondary-start: #e2e8f0;
    --btn-secondary-end: #cbd5e1;
}

body.theme-dark {
    --primary-cyan: #60a5fa;
    --primary-emerald: #1e293b;
    --primary-teal: #1e2b3d;
    --cyan-900: #0b1220;
    --teal-900: #0f172a;
    --emerald-900: #111827;
    --text-main: #f1f5f9;
    --text-muted: #cbd5e1;
    --text-soft: #94a3b8;
    --glass-bg: rgba(15, 23, 42, 0.82);
    --glass-border: rgba(148, 163, 184, 0.16);
    --glass-shadow: rgba(0, 0, 0, 0.4);
    --btn-primary-start: #3b82f6;
    --btn-primary-end: #1d4ed8;
    --btn-secondary-start: #334155;
    --btn-secondary-end: #1e293b;
}

html {
    /* The on-screen zoom control scales the whole app by adjusting this,
       the same way the browser's native page zoom works (this keeps
       fixed/sticky elements like the sidebar and topbar scaling correctly,
       which transform:scale() would not). Supported in Chrome, Edge,
       Safari, and Firefox 126+. */
    zoom: var(--ui-zoom);
}

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

body {
    font-family: var(--font-base);
    background: #f4f6f9;
    min-height: 100vh;
    color: var(--text-main);
    line-height: 1.5;
    position: relative;
    overflow-x: hidden;
}

body.theme-dark {
    background: linear-gradient(135deg, var(--cyan-900) 0%, var(--teal-900) 50%, var(--emerald-900) 100%);
}

/* ===== Afacad Flux applied to every title / heading across the app ===== */
h1, h2, h3, h4, h5, h6,
.page-title,
.sidebar-brand-title,
.sidebar-group-title,
.mobile-drawer-group-title,
.mobile-topbar-title,
.modal-title,
.chart-title,
.dashboard-panel-title,
.advisor-title,
.insight-tip-title,
.section-title,
.cart-title,
.product-title,
.inventory-product-title,
.login-title,
.sub-title,
.selected-customer-title {
    font-family: var(--font-heading);
}

body::before,
body::after {
    content: "";
    position: fixed;
    width: 48vw;
    height: 48vw;
    border-radius: 50%;
    filter: blur(70px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.45;
}

body::before {
    top: -16vw;
    right: -8vw;
    background: radial-gradient(circle, rgba(191, 219, 254, 0.85), rgba(191, 219, 254, 0));
    animation: driftCloudA 12s ease-in-out infinite alternate;
}

body::after {
    bottom: -18vw;
    left: -12vw;
    background: radial-gradient(circle, rgba(147, 197, 253, 0.85), rgba(147, 197, 253, 0));
    animation: driftCloudB 14s ease-in-out infinite alternate;
}

body.theme-light::before,
body.theme-light::after {
    display: none;
}

body.theme-dark::before {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0));
}

body.theme-dark::after {
    background: radial-gradient(circle, rgba(30, 64, 175, 0.22), rgba(30, 64, 175, 0));
}

/* ===== Glassmorphism Components ===== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 var(--glass-shadow);
    padding: 1.5rem;
    color: var(--text-main);
}

.glass-card-sm {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    padding: 1rem;
    color: var(--text-main);
}

/* ===== Container ===== */
.container {
    max-width: 1460px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
}

.container-fluid {
    width: 100%;
    max-width: 1680px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
}

/* ===== App Shell: Sidebar ===== */
.has-shell {
    padding-left: calc(var(--sidebar-width) + 1rem);
    padding-top: 0.9rem;
    transition: padding-left 0.25s ease;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 1200;
    background: rgba(255, 255, 255, 0.93);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--glass-border);
    box-shadow: 6px 0 20px rgba(15, 23, 42, 0.06);
    padding: 1rem 0.9rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    animation: sidebarIn 0.35s ease-out;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    width: 100%;
    color: var(--text-main);
    text-decoration: none;
    margin-bottom: 0.9rem;
}

.sidebar-brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
}

.brand-logo-image {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.98);
    padding: 0.28rem;
    border: 1px solid rgba(51, 65, 85, 0.14);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    flex: 0 0 auto;
}

.brand-logo-image-sidebar {
    /* Fixed height (not auto) so a square/tall logo can't balloon to the
       full sidebar width in height and push the nav menu out of view on
       shorter tablet/laptop windows - object-fit keeps any shape (square
       or wide) centered and uncropped within this band. */
    width: 100%;
    height: 100px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
}

.brand-logo-image-sm {
    width: 36px;
    height: 36px;
    border-radius: 9px;
}

.sidebar-brand-title {
    font-size: 1.18rem;
    line-height: 1.2;
    font-weight: 700;
}

.sidebar-meta {
    font-size: 0.78rem;
    color: var(--text-soft);
    line-height: 1.35;
    margin-bottom: 0.9rem;
}

.sidebar-user-name {
    color: var(--text-main);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role .meta-sep {
    opacity: 0.6;
}

.sidebar-shortcuts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    margin-bottom: 0.9rem;
}

.theme-toggle-card {
    padding: 0.75rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    margin-bottom: 0.9rem;
}

.theme-toggle-label {
    font-size: 0.76rem;
    color: var(--text-soft);
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 0.45rem;
    text-transform: uppercase;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
}

.theme-toggle-compact {
    margin-right: 0.1rem;
}

.theme-toggle-btn {
    border: none;
    min-width: 56px;
    height: 34px;
    padding: 0 0.85rem;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.22s ease;
}

.theme-toggle-btn.active {
    background: linear-gradient(135deg, var(--btn-primary-start), var(--btn-primary-end));
    color: #fff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

.theme-toggle-btn:not(.active):hover {
    color: var(--text-main);
    background: rgba(37, 99, 235, 0.1);
}

.zoom-control {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    width: 100%;
    justify-content: space-between;
}

.zoom-btn {
    border: none;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: all 0.22s ease;
}

.zoom-btn:hover {
    color: #fff;
    background: linear-gradient(135deg, var(--btn-primary-start), var(--btn-primary-end));
}

.zoom-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent;
    color: var(--text-muted);
}

.zoom-level {
    flex: 1;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Theme mode + zoom controls share a single row in the sidebar. */
.sidebar-controls-row {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}

.sidebar-controls-row .theme-toggle {
    flex: 0 0 auto;
}

.sidebar-controls-row .theme-toggle-btn {
    min-width: 0;
    height: 32px;
    padding: 0 0.55rem;
    font-size: 0.72rem;
}

.sidebar-controls-row .zoom-control {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}

.sidebar-controls-row .zoom-btn {
    min-width: 28px;
    height: 32px;
    font-size: 0.95rem;
}

.sidebar-controls-row .zoom-level {
    font-size: 0.74rem;
}

.sidebar-shortcut {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.45rem 0.55rem;
    border-radius: 11px;
    background: linear-gradient(135deg, rgba(219, 234, 254, 0.95), rgba(191, 219, 254, 0.9));
    color: #1e3a8a;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 5px 14px rgba(37, 99, 235, 0.12);
}

.sidebar-shortcut:hover,
.sidebar-shortcut.active {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
}

.sidebar-scroll {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.22rem;
    padding-bottom: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.65) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 8px;
}

.sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.65);
    border-radius: 999px;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.75);
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
}

.sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 0.24rem;
}

.sidebar-group-title,
.mobile-drawer-group-title {
    padding: 0.52rem 0.78rem;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(226, 232, 240, 0.55);
    border: 1px solid rgba(100, 116, 139, 0.18);
    border-radius: 8px;
}

.sidebar-submenu,
.mobile-drawer-submenu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    margin: 0;
    padding: 0.45rem 0.35rem;
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.62rem 0.78rem;
    border-radius: 11px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.25s ease;
    font-weight: 600;
    line-height: 1.2;
    font-size: 0.92rem;
    letter-spacing: 0.01em;
}

.nav-sublink {
    margin-left: 0.8rem;
    padding-left: 1rem;
    font-size: 0.88rem;
    position: relative;
}

.nav-sublink::before {
    content: "";
    position: absolute;
    left: 0.2rem;
    top: 50%;
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.4);
    transform: translateY(-50%);
}

.nav-sublink.has-icon {
    margin-left: 0;
    padding-left: 0.78rem;
}

.nav-sublink.has-icon::before {
    display: none;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    flex: 0 0 1rem;
    color: currentColor;
}

.nav-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.nav-link:hover {
    background: rgba(37, 99, 235, 0.08);
    color: var(--text-main);
    transform: translateX(2px);
}

.nav-link.active {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e3a8a;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.16);
}

.sidebar-branch-wrap {
    flex: 0 0 auto;
    padding-top: 0.9rem;
    border-top: 1px solid var(--glass-border);
    margin-top: 0.35rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.sidebar-branch-wrap .form-label {
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    color: var(--text-soft);
}

body.theme-dark .sidebar,
body.theme-dark .mobile-topbar,
body.theme-dark .mobile-drawer,
body.theme-dark .theme-toggle,
body.theme-dark .theme-toggle-card,
body.theme-dark .zoom-control,
body.theme-dark .sidebar-branch-wrap,
body.theme-dark .glass-card-sm,
body.theme-dark .product-card,
body.theme-dark .cart-item,
body.theme-dark .stat-card {
    background: rgba(15, 23, 34, 0.9);
}

body.theme-dark .zoom-level {
    color: #cbd5e1;
}

body.theme-dark .sidebar {
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.32);
}

body.theme-dark .sidebar-brand-icon,
body.theme-dark .stat-icon {
    color: #fff;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

body.theme-dark .sidebar-shortcut {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.92), rgba(51, 65, 85, 0.88));
    color: #dbeafe;
}

body.theme-dark .sidebar-shortcut:hover,
body.theme-dark .sidebar-shortcut.active,
body.theme-dark .nav-link.active,
body.theme-dark .mobile-shortcut-btn.active {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
}

body.theme-dark .nav-link:hover {
    background: rgba(59, 130, 246, 0.14);
}

body.theme-dark .sidebar-group-title,
body.theme-dark .mobile-drawer-group-title {
    color: #93c5fd;
    background: rgba(51, 65, 85, 0.42);
    border-color: rgba(148, 163, 184, 0.14);
}

body.theme-dark .sidebar-submenu,
body.theme-dark .mobile-drawer-submenu {
    background: rgba(15, 23, 42, 0.86);
    border-color: rgba(148, 163, 184, 0.12);
}

body.theme-dark .nav-sublink::before {
    background: rgba(148, 163, 184, 0.5);
}

.branch-switch-select {
    min-width: 100%;
    padding: 0.5rem 0.66rem;
    font-size: 0.9rem;
}

.mobile-topbar {
    display: none;
}

.mobile-drawer,
.mobile-drawer-overlay {
    display: none;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.62rem 1.2rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--btn-primary-start), var(--btn-primary-end));
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.32);
}

.btn-primary:hover {
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.42);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--btn-secondary-start), var(--btn-secondary-end));
    color: #1e293b;
    box-shadow: 0 4px 14px rgba(100, 116, 139, 0.22);
}

.btn-secondary:hover {
    box-shadow: 0 8px 24px rgba(100, 116, 139, 0.3);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
}

body.theme-dark .btn,
body.theme-dark .btn span {
    color: #f8fafc;
}

body.theme-dark .btn-primary,
body.theme-dark .btn-primary:hover,
body.theme-dark .btn-danger,
body.theme-dark .btn-danger:hover {
    color: #ffffff;
}

body.theme-dark .btn-secondary,
body.theme-dark .btn-secondary:hover {
    background: linear-gradient(135deg, #475569, #334155);
    color: #f8fafc;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.28);
}

body.theme-dark .btn-success,
body.theme-dark .btn-success:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #ffffff;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.82rem 1.45rem;
    font-size: 1.125rem;
}

/* Filter/search bar buttons (Apply Filter, Reset, Load, Refresh, etc.)
   are always inside a <form class="glass-card-sm">. Scoping to the
   <form> element keeps this from touching Save/Add/Delete buttons that
   happen to sit inside a plain <div class="glass-card-sm"> card. */
form.glass-card-sm .btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.875rem;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    font-weight: 500;
}

.form-control {
    width: 100%;
    /* Large, rounded, touch-friendly: generous padding for a comfortable
       tap target and a full pill radius. */
    padding: 1rem 1.5rem;
    min-height: 52px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    border: 1.5px solid var(--glass-border);
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
}

body.theme-dark .form-control {
    background: rgba(15, 23, 34, 0.94);
    color: var(--text-main);
    border-color: rgba(148, 163, 184, 0.2);
}

.form-control::placeholder {
    color: #8a93a1;
}

body.theme-dark .form-control::placeholder {
    color: #7f8ea3;
}

.form-control:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
    background: #fff;
}

body.theme-dark .form-control:focus {
    background: rgba(15, 23, 34, 0.98);
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 3rem;
}

/* ===== Grid System ===== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.75rem;
}

.col,
.col-2,
.col-3,
.col-4,
.col-6,
.col-8,
.col-9,
.col-12 {
    flex: 1;
    padding: 0.75rem;
}

.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* ===== Product Cards ===== */
.product-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.32s ease;
    text-align: center;
}

.product-card:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-5px) scale(1.015);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.product-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.product-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.product-price {
    color: #0f172a;
    font-size: 1.25rem;
    font-weight: bold;
}

/* ===== Cart Items ===== */
.cart-item {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.cart-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.cart-item-name {
    font-weight: 600;
    color: var(--text-main);
}

.cart-item-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.quantity-btn:hover {
    background: #fff;
}

.quantity-display {
    min-width: 32px;
    text-align: center;
    font-weight: bold;
    color: var(--text-main);
}

/* ===== Tables ===== */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead {
    background: rgba(226, 232, 240, 0.6);
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #0f172a;
    border-bottom: 2px solid var(--glass-border);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(100, 116, 139, 0.14);
    color: #1e293b;
}

.table tbody tr {
    transition: background 0.2s;
}

.table tbody tr:hover {
    background: rgba(37, 99, 235, 0.05);
}

body.theme-dark .table thead {
    background: rgba(59, 130, 246, 0.1);
}

body.theme-dark .table th {
    color: var(--text-main);
    border-bottom-color: rgba(148, 163, 184, 0.18);
}

body.theme-dark .table td {
    color: #e5e7eb;
    border-bottom-color: rgba(148, 163, 184, 0.12);
}

body.theme-dark .table tbody tr:hover {
    background: rgba(59, 130, 246, 0.08);
}

/* ===== Badges & Tags ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
}

.badge-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.badge-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.badge-info {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
}

/* ===== Stats Cards ===== */
.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(241, 245, 249, 0.92));
    backdrop-filter: blur(16px);
    border-radius: 8px;
    border: 1px solid rgba(100, 116, 139, 0.16);
    padding: 1.5rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.page-header {
    margin-bottom: 1.35rem;
}

.page-title {
    font-size: clamp(1.35rem, 1rem + 1.1vw, 2rem);
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.4rem;
    line-height: 1.25;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.45;
}

/* ===== Force Dark Text On Light Theme ===== */
.glass-card,
.glass-card p,
.glass-card span,
.glass-card strong,
.glass-card label,
.glass-card h1,
.glass-card h2,
.glass-card h3,
.glass-card h4,
.glass-card h5,
.glass-card h6,
.glass-card-sm,
.glass-card-sm p,
.glass-card-sm span,
.glass-card-sm strong,
.glass-card-sm label {
    color: var(--text-main);
}

.product-price,
#subtotalAmount,
#gstAmount,
#totalAmount,
#modalTotal,
#modalBreakdown,
#changeAmount,
#splitTotal {
    color: #0f172a !important;
}

body.theme-dark .product-price,
body.theme-dark #subtotalAmount,
body.theme-dark #gstAmount,
body.theme-dark #totalAmount,
body.theme-dark #modalTotal,
body.theme-dark #modalBreakdown,
body.theme-dark #changeAmount,
body.theme-dark #splitTotal {
    color: #f8fafc !important;
}

#emptyCart,
.product-stock-text {
    color: var(--text-soft) !important;
}

/* ===== Alerts ===== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fcd34d;
}

.alert-info {
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.35);
    color: #0e7490;
}

body.theme-dark .alert-success {
    color: #bbf7d0;
}

body.theme-dark .alert-danger {
    color: #fecaca;
}

body.theme-dark .alert-warning {
    color: #fde68a;
}

body.theme-dark .alert-info {
    color: #a5f3fc;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 9999;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

body.theme-dark .modal-overlay {
    background: rgba(3, 7, 18, 0.52);
}

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.align-end { align-items: flex-end; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.card-stack > * + *,
.glass-card + .glass-card,
.glass-card + .glass-card-sm,
.glass-card-sm + .glass-card,
.glass-card-sm + .glass-card-sm,
.stat-card + .stat-card {
    margin-top: 0.9rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    :root {
        --navbar-space: var(--topbar-height);
    }

    .has-shell {
        padding-left: 0;
        padding-top: calc(var(--topbar-height) + 0.7rem);
    }

    .sidebar {
        display: none;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        left: 0;
        right: 0;
        top: 0;
        height: var(--topbar-height);
        z-index: 1250;
        background: rgba(255, 255, 255, 0.94);
        border-bottom: 1px solid var(--glass-border);
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
        padding: 0.65rem 0.85rem;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        gap: 0.6rem;
    }

    .mobile-topbar-brand {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        text-decoration: none;
        color: var(--text-main);
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }

    .mobile-topbar-brand .sidebar-brand-icon {
        width: 36px;
        height: 36px;
        border-radius: 9px;
        font-size: 1rem;
    }

.mobile-topbar-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.1;
    white-space: normal;
    word-break: break-word;
    max-width: 72px;
}

.mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    flex: 0 0 auto;
}

.mobile-shortcut-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 36px;
    padding: 0 0.6rem;
    border-radius: 10px;
    color: #1e3a8a;
    text-decoration: none;
    font-size: 0.74rem;
    font-weight: 700;
    border: 1px solid rgba(100, 116, 139, 0.2);
    transition: all 0.22s ease;
}

.mobile-shortcut-btn-filled {
    background: linear-gradient(135deg, rgba(219, 234, 254, 0.9), rgba(191, 219, 254, 0.85));
    color: #1e3a8a;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.14);
}

body.theme-dark .mobile-shortcut-btn-filled {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(51, 65, 85, 0.85));
    color: #dbeafe;
}

.mobile-shortcut-btn-filled:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
}

.mobile-shortcut-btn.active {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}

.mobile-menu-icon-btn {
    min-width: 38px;
    width: 38px;
    height: 34px;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
}

    .theme-toggle-compact .theme-toggle-btn {
        min-width: 32px;
        width: 32px;
        height: 32px;
        padding: 0;
        font-size: 0.72rem;
    }

body.theme-dark .mobile-menu-icon-btn {
    color: #e5e7eb;
}

    .mobile-drawer-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.28);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease;
        z-index: 1290;
    }

    .mobile-drawer-overlay.show {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(84vw, 320px);
        background: rgba(255, 255, 255, 0.96);
        border-right: 1px solid var(--glass-border);
        box-shadow: 8px 0 24px rgba(15, 23, 42, 0.14);
        z-index: 1300;
        transform: translateX(-105%);
        transition: transform 0.26s ease;
        padding: 0.9rem 0.8rem;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .mobile-drawer.open {
        transform: translateX(0);
    }

    .mobile-drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 0.6rem;
    }

    .mobile-drawer-links {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin: 0;
        padding: 0;
        overflow-y: auto;
        min-height: 0;
        flex: 1;
    }

    .mobile-drawer-links .nav-link {
        font-size: 0.95rem;
        padding: 0.68rem 0.78rem;
    }

    .mobile-drawer-submenu .nav-sublink {
        margin-left: 0.7rem;
    }

    .mobile-branch-wrap {
        border-top: 1px solid var(--glass-border);
        padding-top: 0.75rem;
        margin-top: 0.75rem;
    }

    .mobile-branch-wrap .form-label {
        margin-bottom: 0.35rem;
        font-size: 0.82rem;
    }

    body.drawer-open {
        overflow: hidden;
    }

    .glass-card {
        padding: 1rem;
    }

    .container,
    .container-fluid {
        padding: 0.75rem;
    }

    .col-2, .col-3, .col-4, .col-6, .col-8, .col-9 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .product-icon {
        font-size: 2.5rem;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.55s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes driftCloudA {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-28px, 20px) scale(1.08); }
}

@keyframes driftCloudB {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(24px, -16px) scale(1.06); }
}

@keyframes sidebarIn {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes riseSoft {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.glass-card,
.stat-card,
.table-responsive {
    animation: riseSoft 0.45s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ===== Print Styles ===== */
@media print {
    body {
        background: white;
        color: black;
    }

    .sidebar,
    .mobile-topbar,
    .mobile-drawer,
    .mobile-drawer-overlay,
    .btn,
    .no-print {
        display: none !important;
    }

    .has-shell {
        padding-left: 0 !important;
        padding-top: 0 !important;
    }

    .glass-card {
        background: white;
        border: 1px solid #ddd;
        box-shadow: none;
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(100, 116, 139, 0.15);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #94a3b8, #cbd5e1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #64748b, #94a3b8);
}