/* ===========================================================================
   Aashir Lubricants — Modern UI System
   A clean, responsive admin/POS interface. Mobile-first, soft and tactile.
   =========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Core palette */
    --bg:            #f1f5f9;
    --panel:         #1e293b;
    --page-dark:     #0f172a;
    --accent:        #f97316;
    --accent-hover:  #ea6c0a;
    --accent-light:  #fff7ed;
    --card:          #ffffff;
    --border:        #e2e8f0;
    --muted:         #64748b;
    --ink:           #0f172a;

    /* Product category colors */
    --cat-oil:       #3b82f6;
    --cat-filter:    #f59e0b;
    --cat-loose_oil: #22c55e;
    --cat-other:     #a855f7;

    /* Design tokens */
    --radius:     18px;
    --radius-sm:  12px;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
    --shadow:    0 4px 16px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.04);
    --shadow-lg: 0 18px 40px -12px rgba(15,23,42,.22);
    --shadow-accent: 0 8px 20px -6px rgba(249,115,22,.5);
    --sidebar-w: 264px;
    --ease: cubic-bezier(.4, 0, .2, 1);

    --brand: var(--accent);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--accent-hover); }

::selection { background: rgba(249,115,22,.2); }

/* Custom scrollbars */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

/* ---- Bootstrap accent overrides ----------------------------------------- */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    letter-spacing: .01em;
    transition: transform .12s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
    padding: .5rem 1rem;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-sm { border-radius: 9px; }

.btn-primary {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: var(--accent-hover);
    --bs-btn-hover-border-color: var(--accent-hover);
    --bs-btn-active-bg: var(--accent-hover);
    --bs-btn-active-border-color: var(--accent-hover);
    --bs-btn-disabled-bg: var(--accent);
    --bs-btn-disabled-border-color: var(--accent);
    background-image: linear-gradient(135deg, #fb923c, var(--accent));
    box-shadow: var(--shadow-accent);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -6px rgba(249,115,22,.6); }
.btn-outline-primary {
    --bs-btn-color: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: var(--accent);
    --bs-btn-hover-border-color: var(--accent);
    --bs-btn-active-bg: var(--accent-hover);
}
.btn-light { background: #f1f5f9; border-color: #e2e8f0; }
.text-primary { color: var(--accent) !important; }
.text-muted { color: var(--muted) !important; }

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border);
    padding: .55rem .85rem;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.form-control-sm, .form-select-sm { border-radius: 9px; }
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(249,115,22,.14);
}
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(249,115,22,.14); }
.form-label { font-weight: 600; font-size: .85rem; color: #334155; margin-bottom: .35rem; }

.badge { font-weight: 600; border-radius: var(--radius-pill); padding: .4em .75em; letter-spacing: .01em; }

/* ===========================================================================
   LOGIN
   =========================================================================== */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 1.25rem;
    position: relative; overflow: hidden;
    background: radial-gradient(1200px 600px at 10% -10%, #1e3a8a 0%, transparent 50%),
                radial-gradient(900px 500px at 110% 110%, #b45309 0%, transparent 45%),
                linear-gradient(135deg, var(--page-dark) 0%, var(--panel) 100%);
}
/* floating blobs */
.login-page::before, .login-page::after {
    content: ""; position: absolute; border-radius: 50%; filter: blur(8px); opacity: .25;
    background: var(--accent);
}
.login-page::before { width: 320px; height: 320px; top: -80px; right: -60px; animation: float 9s ease-in-out infinite; }
.login-page::after  { width: 240px; height: 240px; bottom: -70px; left: -50px; background: #3b82f6; animation: float 11s ease-in-out infinite reverse; }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(22px) } }

.login-card {
    width: 100%; max-width: 410px; border: none; position: relative; z-index: 2;
    border-radius: 24px;
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg);
    animation: pop .45s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.98) } to { opacity: 1; transform: none } }

.brand-mark {
    width: 64px; height: 64px; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #fb923c, var(--accent));
    color: #fff; font-size: 1.8rem; border-radius: 20px;
    box-shadow: var(--shadow-accent);
}
.input-icon { position: relative; }
.input-icon > .bi {
    position: absolute; left: .9rem; top: 50%; transform: translateY(-50%);
    color: var(--muted); pointer-events: none; font-size: 1rem;
}
.input-icon > .form-control { padding-left: 2.5rem; }

/* ===========================================================================
   APP LAYOUT
   =========================================================================== */
.app-layout { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: linear-gradient(180deg, #111c33 0%, var(--page-dark) 100%);
    color: #cbd5e1;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; height: 100dvh;
    z-index: 1045;
    transition: width .28s var(--ease);
    overflow: hidden;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .7rem;
    padding: 1.25rem 1.35rem; font-weight: 700; font-size: 1.05rem; color: #fff;
    letter-spacing: .01em;
}
.sidebar-brand .logo {
    width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #fb923c, var(--accent));
    border-radius: 12px; color: #fff; font-size: 1.2rem; box-shadow: var(--shadow-accent);
    flex-shrink: 0;
}
.sidebar-brand small { display: block; font-size: .7rem; font-weight: 500; color: #94a3b8; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-close-btn {
    margin-left: auto; flex-shrink: 0;
    border: none; background: rgba(255,255,255,.08); color: #94a3b8;
    width: 32px; height: 32px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .95rem; cursor: pointer;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.sidebar-close-btn:hover { background: rgba(255,255,255,.15); color: #fff; }

.sidebar-section { padding: .4rem 1.35rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #64748b; font-weight: 700; margin-top: .5rem; }

.sidebar-nav { padding: .35rem .75rem 1rem; overflow-y: auto; flex: 1; }
.sidebar-nav a {
    display: flex; align-items: center; gap: .8rem;
    padding: .7rem .85rem; margin: .15rem 0; color: #cbd5e1;
    font-size: .92rem; font-weight: 500; border-radius: 12px;
    position: relative; transition: background .15s var(--ease), color .15s var(--ease), transform .12s var(--ease);
}
.sidebar-nav a .bi { font-size: 1.15rem; width: 1.4rem; text-align: center; opacity: .9; }
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(251,146,60,.95), rgba(249,115,22,.95));
    color: #fff; box-shadow: var(--shadow-accent);
}
.sidebar-nav a.active .bi { opacity: 1; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Topbar — light, frosted, sticky */
.topbar {
    display: flex; align-items: center; gap: .75rem;
    background: rgba(255,255,255,.8);
    backdrop-filter: saturate(180%) blur(12px);
    padding: .7rem 1.25rem;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 1030;
    min-height: 62px;
}
.topbar-title { font-weight: 700; font-size: 1.05rem; color: var(--ink); margin: 0; }
.hamburger {
    border: none; background: #f1f5f9; color: var(--ink);
    width: 40px; height: 40px; border-radius: 11px; display: inline-flex;
    align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0;
    transition: background .15s var(--ease);
}
.hamburger:hover { background: #e2e8f0; }

.topbar-user { display: flex; align-items: center; gap: .6rem; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #fb923c, var(--accent));
    color: #fff; font-weight: 700; font-size: .9rem;
    box-shadow: var(--shadow-sm);
}
.topbar-user .meta { line-height: 1.15; }
.topbar-user .meta .name { font-weight: 600; font-size: .88rem; }
.topbar-user .meta .role { font-size: .72rem; color: var(--muted); }
.btn-logout {
    border: 1px solid var(--border); background: #fff; color: #ef4444;
    width: 40px; height: 40px; border-radius: 11px; display: inline-flex;
    align-items: center; justify-content: center; font-size: 1.1rem;
    transition: all .15s var(--ease);
}
.btn-logout:hover { background: #ef4444; color: #fff; border-color: #ef4444; }

.content { padding: 1.5rem; flex: 1; animation: fadeIn .35s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

/* Desktop sidebar collapsed state */
@media (min-width: 768px) {
    .sidebar.collapsed { width: 0; }
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.5);
    backdrop-filter: blur(2px); opacity: 0; visibility: hidden;
    transition: opacity .25s var(--ease); z-index: 1040;
}
.sidebar-overlay.show { opacity: 1; visibility: visible; }

/* ===========================================================================
   PAGE PRIMITIVES
   =========================================================================== */
.page-header { margin-bottom: 1.4rem; }
.page-header h3 { font-weight: 800; font-size: 1.5rem; color: var(--ink); margin: 0; letter-spacing: -.01em; }
.page-header p { font-size: .9rem; }

.card {
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius);
    background: var(--card);
}
.card-body { padding: 1.25rem; }

/* Stat cards */
.stat-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem;
    display: flex; align-items: center; gap: 1rem; height: 100%;
    box-shadow: var(--shadow-sm);
    transition: transform .18s var(--ease), box-shadow .18s var(--ease);
    position: relative; overflow: hidden;
}
.stat-card::after {
    content: ""; position: absolute; right: -30px; top: -30px;
    width: 110px; height: 110px; border-radius: 50%;
    background: var(--chip, rgba(249,115,22,.08)); opacity: .35;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.stat-card-clickable { cursor: pointer; }
.stat-card-clickable::before {
    content: "\2192"; position: absolute;
    right: 12px; bottom: 8px; font-size: .95rem; color: var(--muted); opacity: 0;
    transition: opacity .15s var(--ease), transform .15s var(--ease); z-index: 1;
}
.stat-card-clickable:hover::before { opacity: .6; transform: translateX(3px); }
.stat-chip {
    width: 54px; height: 54px; border-radius: 16px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
    color: #fff; z-index: 1;
}
.stat-chip.c-blue   { background: linear-gradient(135deg,#60a5fa,#3b82f6); }
.stat-chip.c-green  { background: linear-gradient(135deg,#4ade80,#22c55e); }
.stat-chip.c-amber  { background: linear-gradient(135deg,#fbbf24,#f59e0b); }
.stat-chip.c-orange { background: linear-gradient(135deg,#fb923c,#f97316); }
.stat-chip.c-purple { background: linear-gradient(135deg,#c084fc,#a855f7); }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; color: var(--ink); z-index: 1; }
.stat-card .stat-label { color: var(--muted); font-size: .82rem; font-weight: 500; z-index: 1; }

/* Tables — modern, airy */
.table { margin: 0; --bs-table-bg: transparent; }
.table > thead th {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--border);
    padding: .8rem 1rem; background: #f8fafc; white-space: nowrap;
}
.table > tbody td { padding: .8rem 1rem; vertical-align: middle; border-bottom: 1px solid #f1f5f9; }
.table.table-sm > tbody td, .table.table-sm > thead th { padding: .55rem .75rem; }
.table-hover > tbody > tr { transition: background .12s var(--ease); }
.table-hover > tbody > tr:hover { background: var(--accent-light); }
.table tbody tr:last-child td { border-bottom: none; }

/* Tabs — pill style */
.nav-tabs { border-bottom: 1px solid var(--border); gap: .25rem; }
.nav-tabs .nav-link {
    border: none; color: var(--muted); font-weight: 600; border-radius: 10px 10px 0 0;
    padding: .6rem 1rem; transition: all .15s var(--ease);
}
.nav-tabs .nav-link:hover { color: var(--ink); background: #f8fafc; }
.nav-tabs .nav-link.active {
    color: var(--accent); background: transparent;
    border-bottom: 3px solid var(--accent);
}

/* Modal — rounded, soft */
.modal-content { border: none; border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header { border-bottom: 1px solid var(--border); padding: 1.1rem 1.35rem; }
.modal-title { font-weight: 700; }
.modal-body { padding: 1.35rem; }
.modal-footer { border-top: 1px solid var(--border); padding: 1rem 1.35rem; }
.modal-backdrop.show { opacity: .55; backdrop-filter: blur(2px); }

/* Toasts */
.toast { border-radius: 12px; box-shadow: var(--shadow); }

/* Inventory type selector — segmented pill buttons */
.inv-selector { display: flex; flex-wrap: wrap; gap: .6rem; }
.inv-type-btn {
    flex: 1 1 160px;
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .85rem 1rem; border-radius: var(--radius-sm);
    border: 1.5px solid var(--border); background: var(--card); color: #475569;
    font-weight: 600; font-size: .95rem; cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all .15s var(--ease);
}
.inv-type-btn .bi { font-size: 1.15rem; }
.inv-type-btn:hover { border-color: #cbd5e1; transform: translateY(-1px); }
.inv-type-btn.active {
    background: linear-gradient(135deg, #fb923c, var(--accent));
    border-color: var(--accent); color: #fff; box-shadow: var(--shadow-accent);
}

/* Product category badges */
.cat-badge { color: #fff; }
.cat-oil        { background: var(--cat-oil); }
.cat-filter     { background: var(--cat-filter); }
.cat-loose_oil  { background: var(--cat-loose_oil); }
.cat-other      { background: var(--cat-other); }

/* Retail / Wholesale rate badges */
.rate-badge      { font-weight: 600; }
.rate-retail     { background: #dbeafe; color: #1d4ed8; }
.rate-wholesale  { background: #fce7f3; color: #be185d; }

/* Empty / loading rows */
#products-tbody td, #users-tbody td, #audit-tbody td { color: #475569; }

/* ===========================================================================
   POS TERMINAL (AutoPOS design)
   =========================================================================== */
.pos-wrap {
    display: flex; overflow: hidden;
    /* cancel .content padding for a full-bleed terminal */
    margin: -1.5rem;
    height: calc(100vh - 62px); height: calc(100dvh - 62px);
    position: relative;
}

/* Products panel */
.pos-products { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 14px 14px 0; }

.pos-filter-row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-shrink: 0; flex-wrap: wrap; }
.pos-cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pos-cat-tab {
    padding: 7px 15px; border-radius: 8px; border: 1.5px solid var(--border);
    background: #fff; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted);
    white-space: nowrap; transition: all .14s; font-family: inherit;
}
.pos-cat-tab:hover { border-color: var(--accent); color: var(--accent); }
.pos-cat-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.pos-search-wrap { flex: 1; position: relative; min-width: 160px; }
.pos-search-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #cbd5e1; pointer-events: none; font-size: 13px; }
.pos-search-input {
    width: 100%; padding: 8px 14px 8px 34px; border-radius: 8px;
    border: 1.5px solid var(--border); font-size: 13px; font-family: inherit;
    outline: none; background: #fff; transition: border-color .14s;
}
.pos-search-input:focus { border-color: var(--accent); }
.pos-search-input::placeholder { color: #cbd5e1; }

.pos-mode-toggle { display: flex; background: #fff; border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; }
.pos-mode-btn {
    padding: 7px 15px; font-size: 12px; font-weight: 700; cursor: pointer;
    color: var(--muted); border: none; background: none; font-family: inherit;
    letter-spacing: .3px; transition: all .14s;
}
.pos-mode-btn.active { background: var(--accent); color: #fff; }

/* Printer status chip (top bar) */
.pos-printer-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 12px; border-radius: 8px; border: 1.5px solid var(--border);
    background: #fff; cursor: pointer; font-size: 12px; font-weight: 600;
    font-family: inherit; white-space: nowrap; transition: all .14s; line-height: 1;
}
.pos-printer-chip i { font-size: 13px; }
.pos-printer-chip:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.pos-printer-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; flex-shrink: 0; }

.pos-printer-chip.ready    { border-color: #bbf7d0; background: #f0fdf4; color: #16a34a; }
.pos-printer-chip.ready    .pos-printer-dot { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.pos-printer-chip.offline  { border-color: #fecaca; background: #fef2f2; color: #dc2626; }
.pos-printer-chip.offline  .pos-printer-dot { background: #dc2626; }
.pos-printer-chip.missing  { border-color: #e2e8f0; background: #f8fafc; color: #64748b; }
.pos-printer-chip.missing  .pos-printer-dot { background: #94a3b8; }
.pos-printer-chip.checking { color: #64748b; }
.pos-printer-chip.checking .pos-printer-dot { background: #f59e0b; animation: pos-pulse 1s ease-in-out infinite; }

@keyframes pos-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* Product grid */
.pos-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 12px; overflow-y: auto; padding-bottom: 14px; align-content: start; flex: 1;
}
.pos-card {
    background: #fff; border-radius: 12px; border: 1.5px solid var(--border);
    overflow: hidden; cursor: pointer;
    transition: transform .12s, box-shadow .12s, border-color .14s;
}
.pos-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.09); border-color: var(--accent); }
.pos-card:active { transform: translateY(0); }
.pos-card.out { opacity: .55; }
.pos-stripe { height: 4px; width: 100%; }
.pos-card-body { padding: 13px 14px; }
.pos-card-cat { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 3px; }
.pos-card-name { font-size: 14px; font-weight: 600; line-height: 1.3; margin-bottom: 3px; }
.pos-card-sub { font-size: 11px; color: var(--muted); margin-bottom: 11px; }
.pos-card-foot { display: flex; align-items: center; justify-content: space-between; }
.pos-card-price { font-size: 16px; font-weight: 700; }
.pos-card-add {
    width: 27px; height: 27px; border-radius: 50%;
    background: var(--accent-light); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; line-height: 1; transition: background .12s, color .12s;
}
.pos-card:hover .pos-card-add { background: var(--accent); color: #fff; }
.pos-no-result { grid-column: 1/-1; text-align: center; padding: 60px 20px; color: var(--muted); font-size: 15px; }
@keyframes posflash { 0%,100% { opacity: 1 } 50% { opacity: .4 } }
.pos-card.flash { animation: posflash .4s ease; }

/* Invoice panel (dark) */
.pos-invoice {
    width: 300px; background: var(--panel); color: #fff;
    display: flex; flex-direction: column; flex-shrink: 0;
    border-left: 1px solid rgba(255,255,255,.05);
}
.pos-inv-head { padding: 14px 16px 12px; border-bottom: 1px solid rgba(255,255,255,.07); }
.pos-inv-label { font-size: 10px; font-weight: 700; letter-spacing: 1.8px; text-transform: uppercase; color: #64748b; margin-bottom: 8px; }
.pos-inv-no { font-size: 11px; color: #94a3b8; margin-bottom: 8px; }
.pos-cust-select {
    width: 100%; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px; padding: 8px 12px; color: #fff; font-size: 13px;
    font-family: inherit; outline: none; cursor: pointer; appearance: none;
}
.pos-cust-select option { background: #1e293b; }

.pos-cart { flex: 1; overflow-y: auto; padding: 10px 14px; }
.pos-cart-empty { text-align: center; color: #64748b; padding: 48px 0; font-size: 13px; line-height: 1.8; }
.pos-cart-item { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.pos-ci-info { flex: 1; min-width: 0; }
.pos-ci-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 1px; }
.pos-ci-tag { background: var(--cat-other); color: #fff; font-size: 8px; font-weight: 700; padding: 1px 5px; border-radius: 4px; vertical-align: middle; letter-spacing: .5px; }
.pos-ci-unit { font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-ci-qty { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.pos-q-btn {
    width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.07); color: #fff; font-size: 13px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-family: inherit;
    transition: background .12s;
}
.pos-q-btn:hover { background: rgba(255,255,255,.15); }
.pos-q-num {
    font-size: 13px; font-weight: 600; width: 32px; text-align: center;
    background: rgba(255,255,255,.07); color: #fff; border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px; padding: 2px 0; -moz-appearance: textfield;
}
.pos-q-num::-webkit-outer-spin-button, .pos-q-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pos-q-num:focus { outline: none; border-color: var(--accent); background: rgba(255,255,255,.12); }
.pos-ci-amt { font-size: 12px; font-weight: 600; min-width: 58px; text-align: right; }
.pos-ci-del { font-size: 14px; color: #ef4444; cursor: pointer; padding: 0 3px; opacity: .7; transition: opacity .12s; }
.pos-ci-del:hover { opacity: 1; }

.pos-inv-foot { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,.07); }
.pos-other-btn {
    width: 100%; padding: 8px; margin-bottom: 10px;
    background: rgba(168,85,247,.14); border: 1px dashed rgba(168,85,247,.5);
    border-radius: 8px; color: #c084fc; font-size: 12px; font-weight: 600;
    font-family: inherit; cursor: pointer; transition: all .14s;
}
.pos-other-btn:hover { background: rgba(168,85,247,.25); }
.pos-disc-input {
    width: 100%; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px; padding: 7px 12px; color: #fff; font-size: 13px;
    font-family: inherit; outline: none; margin-bottom: 10px;
}
.pos-disc-input::placeholder { color: #475569; }
.pos-disc-input:focus { border-color: rgba(249,115,22,.5); }

.pos-paid-row { margin-bottom: 10px; }
.pos-paid-row label { display: block; font-size: 12px; color: #94a3b8; margin-bottom: 4px; }
.pos-paid-row .pos-disc-input { margin-bottom: 4px; }
.pos-paid-remain { font-size: 12px; font-weight: 600; min-height: 14px; }
.pos-paid-remain.due { color: #fbbf24; }
.pos-paid-remain.clear { color: #4ade80; }

.pos-t-row { display: flex; justify-content: space-between; font-size: 13px; color: #94a3b8; margin-bottom: 5px; }
.pos-t-row.pos-grand {
    font-size: 18px; font-weight: 700; color: #fff;
    margin-top: 8px; padding-top: 9px; border-top: 1px solid rgba(255,255,255,.1); margin-bottom: 12px;
}
.pos-t-row.pos-grand span:last-child { color: var(--accent); }
.pos-green { color: #4ade80; }

.pos-pay-row { display: flex; gap: 6px; margin-bottom: 12px; }
.pos-pay-btn {
    flex: 1; padding: 7px 4px; border-radius: 8px; border: 1.5px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.05); color: #94a3b8; font-size: 12px; font-weight: 600;
    cursor: pointer; text-align: center; font-family: inherit; transition: all .14s;
}
.pos-pay-btn.active { border-color: var(--accent); background: rgba(249,115,22,.12); color: var(--accent); }
.pos-pay-btn:disabled { opacity: .4; cursor: not-allowed; }

.pos-charge-btn {
    width: 100%; padding: 13px; background: var(--accent); color: #fff; border: none;
    border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer;
    font-family: inherit; transition: background .14s; letter-spacing: .2px;
}
.pos-charge-btn:hover:not(:disabled) { background: var(--accent-hover); }
.pos-charge-btn:disabled { opacity: .35; cursor: not-allowed; }
.pos-clear-btn {
    width: 100%; padding: 8px; margin-top: 7px; background: transparent;
    border: 1px solid rgba(255,255,255,.08); border-radius: 10px; color: #64748b;
    font-size: 12px; font-family: inherit; cursor: pointer; transition: all .14s;
}
.pos-clear-btn:hover:not(:disabled) { color: #94a3b8; border-color: rgba(255,255,255,.15); }
.pos-clear-btn:disabled { opacity: .3; cursor: not-allowed; }

/* Mobile cart FAB + bottom-sheet cart */
.pos-cart-fab {
    display: none; position: absolute; right: 16px; bottom: 16px; z-index: 20;
    width: 56px; height: 56px; border-radius: 50%; border: none;
    background: linear-gradient(135deg, #fb923c, var(--accent)); color: #fff; font-size: 1.4rem;
    box-shadow: var(--shadow-accent); cursor: pointer;
}
.pos-fab-count {
    position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px;
    border-radius: 11px; background: #fff; color: var(--accent);
    font-size: .75rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
    padding: 0 5px; box-shadow: var(--shadow-sm);
}

@media (max-width: 991.98px) {
    .pos-wrap { margin: -1.1rem; height: calc(100vh - 62px); height: calc(100dvh - 62px); }
    .pos-invoice {
        position: absolute; right: 0; top: 0; bottom: 0; width: min(320px, 88vw);
        transform: translateX(100%); transition: transform .28s var(--ease);
        z-index: 15; box-shadow: var(--shadow-lg);
    }
    .pos-invoice.open { transform: translateX(0); }
    .pos-cart-fab { display: block; }
}
@media (max-width: 767.98px) {
    .pos-wrap { margin: -.9rem; }
    .pos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ===========================================================================
   RESPONSIVE
   =========================================================================== */
@media (max-width: 991.98px) {
    .content { padding: 1.1rem; }
    .page-header h3 { font-size: 1.3rem; }
}

@media (max-width: 767.98px) {
    .sidebar {
        position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh;
        transform: translateX(-100%);
        transition: transform .28s var(--ease);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .topbar { padding: .6rem .9rem; }
    .content { padding: .9rem; }
    .topbar-user .meta { display: none; }       /* keep avatar, drop text */
    .card-body { padding: 1rem; }
    .stat-card { padding: 1rem; }
    .stat-card .stat-value { font-size: 1.35rem; }
    .modal-body { padding: 1.1rem; }
    /* Comfortable horizontal scroll for wide tables */
    .table-responsive { -webkit-overflow-scrolling: touch; }
    .table > thead th, .table > tbody td { white-space: nowrap; }
}

@media (max-width: 575.98px) {
    .page-header { margin-bottom: 1rem; }
    .btn { padding: .5rem .85rem; }
    .modal-dialog { margin: .5rem; }
}

/* Receipt logo preview (Settings) — simulates the monochrome thermal print */
.receipt-preview {
    width: 200px; max-width: 100%; padding: 14px 12px 12px; text-align: center;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
    /* dashed torn-paper edge at the bottom */
    background-image: linear-gradient(#fff, #fff);
}
.receipt-preview img {
    max-width: 150px; max-height: 70px; width: auto; height: auto;
    /* approximate 1-bit thermal output: grayscale + hard contrast */
    filter: grayscale(1) contrast(1.6) brightness(1.05);
}
.receipt-preview-name {
    margin-top: 8px; font-weight: 800; font-size: 14px; color: #111;
    letter-spacing: .3px; text-transform: uppercase;
}
.receipt-preview-sub {
    margin-top: 4px; font-size: 10px; letter-spacing: 2px; color: #333;
    border-top: 1px dashed #cbd5e1; padding-top: 6px;
}

/* Reports — KPI delta chips */
.rep-delta { font-size: 11px; font-weight: 700; white-space: nowrap; }
.rep-delta.up   { color: #16a34a; }
.rep-delta.down { color: #dc2626; }
#rep-tabs .nav-link, #exp-tabs .nav-link, #ret-tabs .nav-link { cursor: pointer; }
#rep-presets .btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Returns — refund summary box */
.ret-summary {
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 16px;
}
.ret-summary .fs-5 { font-size: 1.05rem; }
#ret-items-tbody .ret-qty { max-width: 90px; margin: 0 auto; }
#ret-tabs .nav-link { cursor: pointer; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
