/* ============================================================
   POS MODERN UI — Shared Design System
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
    --pos-primary: #1E4D3A;
    --pos-primary-dark: #163A2B;
    --pos-primary-light: #3A7D5A;
    --pos-primary-lighter: #F0F9F5;
    --pos-primary-extra-light: #F7FCFA;
    --pos-accent: #06b6d4;
    --pos-success: #10b981;
    --pos-warning: #f59e0b;
    --pos-danger: #ef4444;
    --pos-bg: #F7FCFA;
    --pos-surface: #ffffff;
    --pos-text: #1e293b;
    --pos-text-secondary: #64748b;
    --pos-border: #e2e8f0;
    --pos-shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --pos-shadow-md: 0 4px 16px rgba(0,0,0,0.10);
    --pos-shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --pos-shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
    --pos-radius: 12px;
    --pos-radius-lg: 16px;
    --pos-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   TYPOGRAPHY SYSTEM — Consistent across all screens
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---------- Base ---------- */
body, body.pos-body {
    background: var(--pos-bg);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--pos-text);
    margin: 0;
    padding: 0 12px;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Typography Scale --- */
h1, .h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; color: var(--pos-text); }
h2, .h2 { font-size: 1.5rem;  font-weight: 700; line-height: 1.25; color: var(--pos-text); }
h3, .h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; color: var(--pos-text); }
h4, .h4 { font-size: 1.1rem;  font-weight: 600; line-height: 1.35; color: var(--pos-text); }
h5, .h5 { font-size: 0.95rem; font-weight: 600; line-height: 1.4; color: var(--pos-text); }
h6, .h6 { font-size: 0.85rem; font-weight: 600; line-height: 1.4; color: var(--pos-text-secondary); }
p       { font-size: 0.875rem; line-height: 1.6; color: var(--pos-text); margin-bottom: 0.5rem; }
small, .small { font-size: 0.8rem; color: var(--pos-text-secondary); }
label, .form-label { font-size: 0.8125rem; font-weight: 600; color: var(--pos-text-secondary); letter-spacing: 0.2px; }

/* --- Consistent form controls --- */
.form-control, .form-select {
    font-family: inherit;
    font-size: 0.875rem;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1.5px solid var(--pos-border);
    height: 38px;
    transition: var(--pos-transition);
}

.form-control-sm, .form-select-sm { height: 32px; font-size: 0.8125rem; padding: 4px 10px; }
.form-control-lg, .form-select-lg { height: 44px; font-size: 1rem; padding: 10px 14px; }

/* --- Consistent button sizing --- */
.btn {
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--pos-transition);
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.btn-sm { height: 32px; font-size: 0.75rem; padding: 4px 12px; }
.btn-lg { height: 44px; font-size: 0.9375rem; padding: 10px 24px; }

/* --- Form submit buttons: right-aligned, never full-width --- */
form .d-grid {
    display: flex !important;
    justify-content: flex-end;
}

form .d-grid .btn {
    width: auto !important;
}

/* --- Radio buttons in filter bars (reports) --- */
.form-check-inline {
    margin-right: 12px;
}

.form-check-inline .form-check-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--pos-text);
    cursor: pointer;
    padding-left: 4px;
}

/* --- Consistent checkbox/radio --- */
.form-check-input {
    width: 18px;
    height: 18px;
    border: 2px solid var(--pos-border);
    border-radius: 4px;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--pos-primary);
    border-color: var(--pos-primary);
}

.form-check-input[type="radio"] { border-radius: 50%; }
.form-check-label { font-size: 0.875rem; cursor: pointer; }

/* --- Logo in header --- */
.pos-header-logo {
    height: 32px;
    width: 32px;
    margin-right: 10px;
    vertical-align: middle;
    border-radius: 6px;
    object-fit: contain;
}

/* ============================================================
   BOOTSTRAP OVERRIDES — Brand Green Everywhere
   ============================================================ */

/* --- Primary buttons --- */
.btn-primary,
.btn-primary:visited {
    background-color: var(--pos-primary) !important;
    border-color: var(--pos-primary) !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active {
    background-color: var(--pos-primary-dark) !important;
    border-color: var(--pos-primary-dark) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(30, 77, 58, 0.35) !important;
}

/* --- Success buttons --- */
.btn-success,
.btn-success:visited {
    background-color: var(--pos-primary) !important;
    border-color: var(--pos-primary) !important;
    color: #fff !important;
}

.btn-success:hover,
.btn-success:focus,
.btn-success:active {
    background-color: var(--pos-primary-dark) !important;
    border-color: var(--pos-primary-dark) !important;
    box-shadow: 0 4px 12px rgba(30, 77, 58, 0.35) !important;
}

/* --- Warning buttons → brand light green --- */
.btn-warning,
.btn-warning:visited {
    background-color: var(--pos-primary-light) !important;
    border-color: var(--pos-primary-light) !important;
    color: #fff !important;
}

.btn-warning:hover,
.btn-warning:focus,
.btn-warning:active {
    background-color: var(--pos-primary) !important;
    border-color: var(--pos-primary) !important;
    color: #fff !important;
}

/* --- Outline-primary --- */
.btn-outline-primary {
    color: var(--pos-primary) !important;
    border-color: var(--pos-primary) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:active {
    background-color: var(--pos-primary) !important;
    color: #fff !important;
}

/* --- Secondary buttons --- */
.btn-secondary,
.btn-secondary:visited {
    background-color: var(--pos-text-secondary) !important;
    border-color: var(--pos-text-secondary) !important;
}

/* --- Table headers → brand green --- */
.table-dark th,
thead.table-dark th,
.table > thead.table-dark > tr > th {
    background-color: var(--pos-primary) !important;
    border-color: var(--pos-primary-dark) !important;
    color: #fff !important;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.table-dark td,
.table-dark {
    --bs-table-bg: var(--pos-primary) !important;
    --bs-table-border-color: var(--pos-primary-dark) !important;
}

/* --- Table row hover --- */
.table > tbody > tr:hover {
    background-color: var(--pos-primary-extra-light) !important;
}

/* --- Bootstrap bg utilities --- */
.bg-primary {
    background-color: var(--pos-primary) !important;
}

.bg-success {
    background-color: var(--pos-primary) !important;
}

.bg-dark {
    background-color: var(--pos-primary) !important;
}

.bg-info {
    background-color: var(--pos-primary-light) !important;
}

/* --- Text utilities --- */
.text-primary {
    color: var(--pos-primary) !important;
}

/* --- Form focus states --- */
.form-control:focus,
.form-select:focus {
    border-color: var(--pos-primary-light) !important;
    box-shadow: 0 0 0 0.2rem rgba(30, 77, 58, 0.15) !important;
}

/* --- Links --- */
a {
    color: var(--pos-primary);
}

a:hover {
    color: var(--pos-primary-dark);
}

/* --- Pagination --- */
.page-link {
    color: var(--pos-primary);
}

.page-item.active .page-link {
    background-color: var(--pos-primary) !important;
    border-color: var(--pos-primary) !important;
}

/* --- Nav / Tabs --- */
.nav-link.active,
.nav-pills .nav-link.active {
    background-color: var(--pos-primary) !important;
    color: #fff !important;
}

/* --- Alerts --- */
.alert-primary {
    background-color: var(--pos-primary-lighter) !important;
    border-color: var(--pos-primary-light) !important;
    color: var(--pos-primary-dark) !important;
}

/* --- Badge --- */
.badge.bg-primary {
    background-color: var(--pos-primary) !important;
}

/* --- Global search input consistency --- */
input[type="search"],
input[type="text"][id*="search" i],
input[type="text"][id*="Search" i],
input[type="text"][placeholder*="Search" i],
input[type="text"][placeholder*="search" i] {
    font-family: inherit;
    font-size: 0.875rem;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1.5px solid var(--pos-border);
    height: 38px;
    transition: var(--pos-transition);
    background: var(--pos-surface);
    min-width: 220px;
}

input[type="search"]:focus,
input[type="text"][placeholder*="Search" i]:focus,
input[type="text"][placeholder*="search" i]:focus {
    border-color: var(--pos-primary);
    box-shadow: 0 0 0 3px rgba(30, 77, 58, 0.12);
    outline: none;
}

/* --- Ensure all thead th gets brand color even without table-dark --- */
.table > thead > tr > th {
    background-color: var(--pos-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border-color: var(--pos-primary-dark);
}

/* ============================================================
   END BOOTSTRAP OVERRIDES
   ============================================================ */

/* ============================================================
   TABLE TOOLS — Print & Excel toolbar
   ============================================================ */
.pos-table-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 16px 8px 4px;
    margin-bottom: 4px;
}

.pos-btn-tool {
    padding: 5px 14px !important;
    font-size: 0.75rem !important;
    height: 32px !important;
    border-radius: 6px !important;
    border: 1.5px solid var(--pos-border) !important;
    background: var(--pos-surface) !important;
    color: var(--pos-text) !important;
    cursor: pointer;
    transition: var(--pos-transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.pos-btn-tool:hover {
    background: var(--pos-primary) !important;
    color: #fff !important;
    border-color: var(--pos-primary) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(30, 77, 58, 0.2);
}

.pos-btn-tool i {
    font-size: 12px;
}

@media print {
    .pos-table-toolbar { display: none !important; }
}

/* ============================================================
   GLOBAL RESPONSIVE TABLES — Uniform scroll height, sticky
   header / footer always visible. Tables shorter than the
   limit simply render without a scrollbar.
   ============================================================ */
.table-responsive,
.table-scroll-body,
.table-container,
.table-wrapper {
    max-height: calc(100vh - 200px) !important;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: auto;
}

.table-responsive table,
.table-scroll-body table,
.table-container table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto;
}

/* Global sticky thead & tfoot inside scroll containers */
.table-responsive thead th,
.table-scroll-body thead th,
.table-container thead th,
.table-wrapper thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-responsive tfoot td,
.table-responsive tfoot th,
.table-scroll-body tfoot td,
.table-scroll-body tfoot th,
.table-container tfoot td,
.table-container tfoot th,
.table-wrapper tfoot td,
.table-wrapper tfoot th {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--pos-primary, #1E4D3A) !important;
    color: #fff !important;
    font-weight: 700;
}

.table-responsive table th,
.table-responsive table td,
.table-scroll-body table th,
.table-scroll-body table td,
.table-container table th,
.table-container table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8125rem;
    padding: 6px 8px;
    max-width: 180px;
}

/* Allow text wrapping on smaller viewports */
@media (max-width: 1400px) {
    .table-responsive table th,
    .table-responsive table td,
    .table-scroll-body table th,
    .table-scroll-body table td,
    .table-container table th,
    .table-container table td {
        font-size: 0.75rem;
        padding: 4px 6px;
        max-width: 140px;
    }
}

@media (max-width: 992px) {
    .table-responsive table th,
    .table-responsive table td,
    .table-scroll-body table th,
    .table-scroll-body table td,
    .table-container table th,
    .table-container table td {
        font-size: 0.7rem;
        padding: 3px 4px;
        max-width: 110px;
    }
}

/* ---------- Dashboard Header ---------- */
.pos-header {
    background: var(--pos-surface);
    border-radius: var(--pos-radius);
    padding: 12px 28px;
    margin: 12px;
    box-shadow: var(--pos-shadow-md);
    animation: posSlideDown 0.5s ease;
    border-bottom: 3px solid var(--pos-primary);
}

/* All h5 inside pos-header — consistent baseline */
.pos-header h5 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
}

/* Left title: company name */
.pos-header .col-5:first-child h5,
.pos-header .header-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--pos-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Company name bold */
.pos-header h5 b,
.pos-header .header-title b {
    color: var(--pos-primary);
    font-weight: 700;
}

/* Center: page title */
.pos-header .col-2 h5,
.pos-header .header-page-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--pos-primary);
    margin: 0;
    letter-spacing: 0.5px;
    justify-content: center;
}

/* ---------- Header Buttons ---------- */
.pos-btn {
    padding: 8px 20px;
    border-radius: 8px;
    border: 2px solid transparent;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--pos-transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.3px;
}

.pos-btn-primary {
    background: var(--pos-primary-lighter);
    color: var(--pos-primary);
    border-color: var(--pos-primary);
}

.pos-btn-primary:hover {
    background: var(--pos-primary);
    border-color: var(--pos-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 77, 58, 0.25);
}

/* Back button — green outline, matches brand */
.pos-btn-outline {
    background: var(--pos-primary-lighter);
    color: var(--pos-primary);
    border-color: var(--pos-primary);
}

.pos-btn-outline:hover {
    background: var(--pos-primary);
    color: #fff;
    border-color: var(--pos-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 77, 58, 0.25);
}

/* Logout button — outline style matching Back button */
.pos-btn-danger {
    background: var(--pos-primary-lighter);
    color: var(--pos-primary);
    border-color: var(--pos-primary);
}

.pos-btn-danger:hover {
    background: var(--pos-primary);
    border-color: var(--pos-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 77, 58, 0.25);
}

/* ---------- Dashboard Wrapper ---------- */
.pos-dashboard {
    padding: 0 12px 24px;
}

/* ---------- Tile Grid ---------- */
.pos-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 8px 0;
}

/* ---------- Tile Card ---------- */
.pos-tile {
    position: relative;
    background: var(--pos-primary-lighter);
    border-radius: var(--pos-radius);
    height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: var(--pos-shadow-sm);
    cursor: pointer;
    transition: var(--pos-transition);
    text-decoration: none;
    color: var(--pos-primary);
    border: 2px solid var(--pos-primary);
    overflow: hidden;
    /* scroll-triggered animation initial state */
    opacity: 0;
    transform: translateY(24px);
}

.pos-tile.pos-visible {
    animation: posFadeUp 0.5s ease forwards;
}

.pos-tile::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--pos-primary), var(--pos-primary-light));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.pos-tile:hover::before {
    opacity: 1;
}

.pos-tile:hover {
    transform: translateY(-6px);
    box-shadow: var(--pos-shadow-lg);
    border-color: var(--pos-primary);
    color: #fff;
}

.pos-tile i,
.pos-tile .tile-icon {
    font-size: 28px;
    z-index: 1;
    transition: var(--pos-transition);
    color: var(--pos-primary);
}

.pos-tile:hover i,
.pos-tile:hover .tile-icon {
    color: #fff;
    transform: scale(1.15);
}

.pos-tile .tile-label {
    font-size: 14px;
    font-weight: 600;
    z-index: 1;
    text-align: center;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.pos-tile:hover .tile-label {
    color: #fff;
}

/* ---------- Stagger Delay (applied via data-delay or nth-child) ---------- */
.pos-tile-grid .pos-tile:nth-child(1)  { transition-delay: 0.00s; }
.pos-tile-grid .pos-tile:nth-child(2)  { transition-delay: 0.04s; }
.pos-tile-grid .pos-tile:nth-child(3)  { transition-delay: 0.08s; }
.pos-tile-grid .pos-tile:nth-child(4)  { transition-delay: 0.12s; }
.pos-tile-grid .pos-tile:nth-child(5)  { transition-delay: 0.16s; }
.pos-tile-grid .pos-tile:nth-child(6)  { transition-delay: 0.20s; }
.pos-tile-grid .pos-tile:nth-child(7)  { transition-delay: 0.24s; }
.pos-tile-grid .pos-tile:nth-child(8)  { transition-delay: 0.28s; }
.pos-tile-grid .pos-tile:nth-child(9)  { transition-delay: 0.32s; }
.pos-tile-grid .pos-tile:nth-child(10) { transition-delay: 0.36s; }
.pos-tile-grid .pos-tile:nth-child(11) { transition-delay: 0.40s; }
.pos-tile-grid .pos-tile:nth-child(12) { transition-delay: 0.44s; }

/* ---------- Shimmer on hover ---------- */
.pos-tile::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    z-index: 1;
    transition: left 0.5s ease;
}

.pos-tile:hover::after {
    left: 100%;
}

/* ---------- Unauthorized Tile ---------- */
.pos-tile-disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(0.5);
}

.pos-tile-disabled::before {
    display: none;
}

.pos-tile-unauthorized {
    cursor: pointer;
    opacity: 0.7;
}

.pos-tile-unauthorized .tile-label::after {
    content: ' 🔒';
    font-size: 12px;
}

.pos-tile-unauthorized:hover {
    border-color: var(--pos-danger);
    color: var(--pos-danger);
    transform: translateY(-2px);
}

.pos-tile-unauthorized:hover::before {
    opacity: 0;
}

/* ---------- Login Card ---------- */
.pos-login-area {
    min-height: calc(100vh - 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.pos-login-card {
    width: 460px;
    border-radius: var(--pos-radius-lg);
    background: var(--pos-surface);
    box-shadow: var(--pos-shadow-xl);
    overflow: hidden;
    animation: posFadeUp 0.6s ease;
}

.pos-login-accent {
    height: 5px;
    background: linear-gradient(90deg, var(--pos-primary), var(--pos-accent), var(--pos-primary));
}

.pos-login-body {
    padding: 36px 40px;
}

/* ---------- Form Styles ---------- */
.pos-form .form-label {
    color: var(--pos-text-secondary);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.pos-form .form-control {
    border-radius: 10px;
    font-size: 14px;
    padding: 11px 14px;
    border: 1.5px solid var(--pos-border);
    background: #f8fafc;
    transition: var(--pos-transition);
}

.pos-form .form-control:focus {
    border-color: var(--pos-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(30, 77, 58, 0.12);
}

.pos-form .btn-login {
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    padding: 12px;
    background: linear-gradient(135deg, var(--pos-primary), var(--pos-primary-light));
    border: none;
    color: #fff;
    letter-spacing: 0.4px;
    box-shadow: 0 4px 16px rgba(30, 77, 58, 0.3);
    transition: var(--pos-transition);
}

.pos-form .btn-login:hover {
    background: linear-gradient(135deg, var(--pos-primary-dark), var(--pos-primary));
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(30, 77, 58, 0.4);
    color: #fff;
}

/* ---------- Submenu (Expandable) ---------- */
.pos-submenu {
    max-height: 0;
    overflow: hidden;
    background: var(--pos-surface);
    border-radius: var(--pos-radius);
    margin-top: 8px;
    box-shadow: var(--pos-shadow-md);
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
}

.pos-submenu.show {
    max-height: 500px;
    opacity: 1;
}

.pos-submenu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--pos-text);
    border-radius: 8px;
    margin: 4px 8px;
    font-size: 13px;
    font-weight: 500;
    transition: var(--pos-transition);
}

.pos-submenu a:hover {
    background: linear-gradient(135deg, var(--pos-primary), var(--pos-primary-light));
    color: #fff;
    transform: translateX(6px);
}

.pos-submenu a i {
    font-size: 15px;
    width: 20px;
    text-align: center;
    color: var(--pos-text-secondary);
    transition: color 0.3s ease;
}

.pos-submenu a:hover i {
    color: #fff;
}

/* ---------- Table Styles ---------- */
.pos-table-wrap {
    background: var(--pos-surface);
    border-radius: var(--pos-radius);
    box-shadow: var(--pos-shadow-sm);
    overflow: hidden;
    border: 1px solid var(--pos-border);
}

.pos-table-wrap .table thead th {
    background: var(--pos-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 10px 8px;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.pos-table-wrap .table tbody td {
    font-size: 13px;
    padding: 8px;
    vertical-align: middle;
    border-color: var(--pos-border);
}

.pos-table-wrap .table tbody tr {
    transition: background 0.2s ease;
}

.pos-table-wrap .table tbody tr:hover {
    background: rgba(30, 77, 58, 0.04);
}

.pos-table-scroll {
    max-height: 70vh;
    overflow-y: auto;
}

/* ---------- Loading Overlay ---------- */
.pos-loading {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.pos-loading.active {
    display: flex;
}

.pos-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: var(--pos-primary-light);
    border-radius: 50%;
    animation: posSpin 0.8s linear infinite;
}

/* ---------- Section Title ---------- */
.pos-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--pos-text);
    margin: 16px 0 8px;
    padding-left: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pos-section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--pos-primary);
    border-radius: 2px;
}

/* ---------- Card (general) ---------- */
.pos-card {
    background: var(--pos-surface);
    border-radius: var(--pos-radius);
    box-shadow: var(--pos-shadow-sm);
    border: 1px solid var(--pos-border);
    padding: 24px;
    transition: var(--pos-transition);
}

.pos-card:hover {
    box-shadow: var(--pos-shadow-md);
}

/* ---------- Empty / Placeholder ---------- */
.pos-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--pos-text-secondary);
}

.pos-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--pos-border);
}

.pos-empty h4 {
    font-weight: 600;
    color: var(--pos-text);
    margin-bottom: 8px;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

/* Slide down — header entrance */
@keyframes posSlideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Fade up — tile/card entrance */
@keyframes posFadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Fade in — general */
@keyframes posFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Spinner */
@keyframes posSpin {
    to { transform: rotate(360deg); }
}

/* Scale pop — for modals / alerts */
@keyframes posScalePop {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .pos-header {
        padding: 10px 16px;
        margin: 8px;
    }

    .pos-tile-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
    }

    .pos-tile {
        height: 110px;
    }

    .pos-tile .tile-label {
        font-size: 12px;
    }

    .pos-login-body {
        padding: 28px 24px;
    }

    .pos-btn {
        padding: 8px 14px;
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .pos-tile-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .pos-tile {
        height: 100px;
    }

    .pos-header .header-title {
        font-size: 0.85rem;
    }
}

/* ============================================================
   POS BILLING SCREEN
   ============================================================ */

/* --- Toolbar strip (below header) --- */
.pos-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--pos-surface);
    border-radius: var(--pos-radius);
    margin: 0 12px 12px;
    box-shadow: var(--pos-shadow-sm);
    border: 1px solid var(--pos-border);
    flex-wrap: wrap;
}

.pos-toolbar .form-control,
.pos-toolbar .form-select {
    border-radius: 8px;
    font-size: 13px;
    border: 1.5px solid var(--pos-border);
    padding: 8px 12px;
    transition: var(--pos-transition);
    height: 38px;
}

.pos-toolbar .form-control:focus,
.pos-toolbar .form-select:focus {
    border-color: var(--pos-primary);
    box-shadow: 0 0 0 3px rgba(30, 77, 58, 0.1);
}

.pos-toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pos-toolbar-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--pos-text-secondary);
    white-space: nowrap;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* --- Action button strip --- */
.pos-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pos-btn-sm {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid var(--pos-border);
    background: var(--pos-surface);
    color: var(--pos-text);
    cursor: pointer;
    transition: var(--pos-transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.pos-btn-sm:hover {
    background: var(--pos-primary);
    color: #fff;
    border-color: var(--pos-primary);
    transform: translateY(-1px);
}

.pos-btn-sm.pos-btn-success {
    background: var(--pos-success);
    color: #fff;
    border-color: var(--pos-success);
}

.pos-btn-sm.pos-btn-success:hover {
    background: #059669;
    border-color: #059669;
}

.pos-btn-sm.pos-btn-warning {
    background: var(--pos-warning);
    color: var(--pos-text);
    border-color: var(--pos-warning);
}

.pos-btn-sm.pos-btn-warning:hover {
    background: #d97706;
    color: #fff;
    border-color: #d97706;
}

/* --- Product/Cart Table --- */
.pos-bill-table {
    background: var(--pos-surface);
    border-radius: var(--pos-radius);
    box-shadow: var(--pos-shadow-sm);
    overflow: hidden;
    border: 1px solid var(--pos-border);
    margin: 0 12px;
}

.pos-bill-table .table {
    margin-bottom: 0;
}

.pos-bill-table .table thead th {
    background: linear-gradient(135deg, var(--pos-primary), var(--pos-primary-light));
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 10px 8px;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-align: center;
}

.pos-bill-table .table tbody td {
    font-size: 13px;
    padding: 8px;
    vertical-align: middle;
    border-color: var(--pos-border);
    text-align: center;
}

.pos-bill-table .table tbody tr {
    transition: background 0.15s ease;
}

.pos-bill-table .table tbody tr:hover {
    background: rgba(30, 77, 58, 0.03);
}

.pos-bill-table .qty-input,
.pos-bill-table .discount-input {
    width: 65px !important;
    border-radius: 8px;
    border: 1.5px solid var(--pos-border);
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    padding: 6px;
    transition: var(--pos-transition);
}

.pos-bill-table .qty-input:focus,
.pos-bill-table .discount-input:focus {
    border-color: var(--pos-primary);
    box-shadow: 0 0 0 2px rgba(30, 77, 58, 0.12);
}

.pos-bill-table .btn-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--pos-transition);
    color: var(--pos-text-secondary);
}

.pos-bill-table .btn-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--pos-danger);
}

/* --- Summary Cards Row --- */
.pos-summary-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    padding: 16px 12px;
}

.pos-summary-card {
    background: var(--pos-surface);
    border-radius: var(--pos-radius);
    border: 1px solid var(--pos-border);
    box-shadow: var(--pos-shadow-sm);
    padding: 20px;
    transition: var(--pos-transition);
}

.pos-summary-card:hover {
    box-shadow: var(--pos-shadow-md);
}

.pos-summary-card h5 {
    font-size: 14px;
    font-weight: 700;
    color: var(--pos-text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pos-summary-card h5 i {
    color: var(--pos-primary);
    font-size: 16px;
}

.pos-summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    color: var(--pos-text);
}

.pos-summary-line span:first-child {
    font-weight: 500;
    color: var(--pos-text-secondary);
}

.pos-summary-line span:last-child {
    font-weight: 700;
}

.pos-summary-line.pos-summary-total {
    border-top: 2px solid var(--pos-primary);
    margin-top: 8px;
    padding-top: 12px;
    font-size: 18px;
}

.pos-summary-line.pos-summary-total span:last-child {
    color: var(--pos-primary);
}

/* --- Payment Inputs --- */
.pos-payment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.pos-payment-row label {
    font-size: 13px;
    font-weight: 600;
    color: var(--pos-text);
    min-width: 100px;
    margin: 0;
}

.pos-payment-row .form-control {
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    border: 1.5px solid var(--pos-border);
    padding: 8px 12px;
    max-width: 200px;
    transition: var(--pos-transition);
}

.pos-payment-row .form-control:focus {
    border-color: var(--pos-primary);
    box-shadow: 0 0 0 3px rgba(30, 77, 58, 0.1);
}

/* --- Pay Now Button --- */
.pos-btn-pay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--pos-radius);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--pos-transition);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.pos-btn-pay-green {
    background: linear-gradient(135deg, var(--pos-success), #059669);
    color: #fff;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

.pos-btn-pay-green:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.45);
}

.pos-btn-pay-yellow {
    background: linear-gradient(135deg, var(--pos-warning), #d97706);
    color: var(--pos-text);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
    margin-top: 8px;
}

.pos-btn-pay-yellow:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
}

/* --- Info strip (showroom, address, salesman, etc) --- */
.pos-info-strip {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 8px 16px;
    background: var(--pos-surface);
    border-radius: var(--pos-radius);
    margin: 0 12px 8px;
    box-shadow: var(--pos-shadow-sm);
    border: 1px solid var(--pos-border);
    flex-wrap: wrap;
    font-size: 13px;
}

.pos-info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pos-info-item label {
    font-weight: 600;
    color: var(--pos-text-secondary);
    font-size: 12px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.pos-info-item span,
.pos-info-item strong {
    color: var(--pos-text);
    font-weight: 600;
}

/* --- Keyboard shortcut hints --- */
.pos-kbd {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    background: var(--pos-bg);
    border: 1px solid var(--pos-border);
    border-radius: 4px;
    color: var(--pos-text-secondary);
    font-family: monospace;
    line-height: 1.4;
}

/* --- Badge (for status labels) --- */
.pos-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.pos-badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--pos-success);
}

.pos-badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--pos-warning);
}

.pos-badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--pos-danger);
}

.pos-badge-primary {
    background: rgba(30, 77, 58, 0.1);
    color: var(--pos-primary);
}

/* --- Additional button variants --- */
.pos-btn-success {
    background: var(--pos-success);
    color: #fff;
    border-color: var(--pos-success);
}

.pos-btn-success:hover {
    background: #059669;
    border-color: #059669;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.pos-btn-warning {
    background: var(--pos-warning);
    color: var(--pos-text);
    border-color: var(--pos-warning);
}

.pos-btn-warning:hover {
    background: #d97706;
    color: #fff;
    border-color: #d97706;
    transform: translateY(-1px);
}

.pos-btn-ghost {
    background: transparent;
    color: var(--pos-text-secondary);
    border-color: transparent;
}

.pos-btn-ghost:hover {
    background: var(--pos-bg);
    color: var(--pos-text);
}

/* --- Divider --- */
.pos-divider {
    height: 1px;
    background: var(--pos-border);
    margin: 12px 0;
}

/* --- Text Utilities --- */
.pos-text-success { color: var(--pos-success) !important; }
.pos-text-danger  { color: var(--pos-danger) !important; }
.pos-text-warning { color: var(--pos-warning) !important; }
.pos-text-primary { color: var(--pos-primary) !important; }
.pos-text-muted   { color: var(--pos-text-secondary) !important; }

/* --- Responsive for billing screen --- */
@media (max-width: 992px) {
    .pos-summary-row {
        grid-template-columns: 1fr;
    }

    .pos-toolbar {
        gap: 8px;
    }

    .pos-info-strip {
        gap: 12px;
    }

    /* Billing toolbar wrapping */
    .no-print .d-flex {
        flex-wrap: wrap;
    }

    .bill-table {
        font-size: 12px;
    }

    .bill-table td, .bill-table th {
        padding: 4px;
    }

    .product-search-form input[name="searchTerm"] {
        width: 180px !important;
    }

    .form-select {
        min-width: 120px !important;
    }
}

@media (max-width: 768px) {
    /* Billing screen — stack summary cards vertically */
    .row.mt-3 > .col-md-5,
    .row.mt-3 > .col-md-4,
    .row.mt-3 > .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Action buttons wrap nicely */
    .d-flex.justify-content-end {
        flex-wrap: wrap;
        gap: 8px !important;
    }

    .btn {
        min-width: auto;
        font-size: 0.75rem;
        padding: 6px 10px;
        height: 34px;
    }

    /* Billing table scroll */
    .bill-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .qty-input, .discount-input {
        width: 55px !important;
    }

    /* Info strip stack */
    .d-flex.justify-content-between.align-items-center.text-primary {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 4px;
    }

    /* Header — keep inline but compact */
    .pos-header {
        padding: 10px 16px;
    }

    .pos-header .header-title {
        font-size: 0.9rem;
    }

    .pos-header .header-page-name {
        font-size: 0.9rem;
    }

    .pos-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .pos-header {
        padding: 8px 12px;
        margin: 8px;
    }

    .pos-header .row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .pos-header .row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
        text-align: center !important;
    }

    .pos-header .row > .col-5:last-child {
        justify-content: center !important;
    }

    .pos-header .header-title {
        font-size: 0.85rem;
        justify-content: center;
    }

    .pos-header .header-page-name {
        font-size: 0.85rem;
    }

    .pos-header-logo {
        height: 22px;
    }

    .pos-btn {
        padding: 5px 10px;
        font-size: 11px;
    }

    .btn {
        font-size: 0.7rem;
        padding: 4px 8px;
        height: 30px;
    }
}

/* ============================================================
   PAYMENT CARD — Consistent sizing
   ============================================================ */
.payment-card label {
    font-size: 0.8125rem !important;
    font-weight: 600;
    color: var(--pos-text);
}

.payment-card .form-control {
    font-size: 0.875rem;
    height: 38px;
}

.payment-card h4 {
    font-size: 1rem;
}

.payment-card h4 span {
    font-size: 1rem;
}

/* ============================================================
   SWEETALERT2 — Brand-consistent popups
   ============================================================ */
.swal2-popup {
    border-radius: var(--pos-radius-lg) !important;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif !important;
    box-shadow: var(--pos-shadow-xl) !important;
    padding: 24px 28px !important;
}

.swal2-title {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: var(--pos-text) !important;
}

.swal2-html-container {
    font-size: 0.875rem !important;
    color: var(--pos-text-secondary) !important;
    line-height: 1.6 !important;
}

.swal2-confirm {
    background-color: var(--pos-primary) !important;
    border-radius: 8px !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    padding: 10px 24px !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(30, 77, 58, 0.3) !important;
    transition: var(--pos-transition) !important;
}

.swal2-confirm:hover {
    background-color: var(--pos-primary-dark) !important;
    box-shadow: 0 6px 16px rgba(30, 77, 58, 0.4) !important;
}

.swal2-cancel {
    background-color: var(--pos-text-secondary) !important;
    border-radius: 8px !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    padding: 10px 24px !important;
    border: none !important;
}

.swal2-cancel:hover {
    background-color: #4b5563 !important;
}

.swal2-icon.swal2-success .swal2-success-ring {
    border-color: var(--pos-primary) !important;
}

.swal2-icon.swal2-success [class^='swal2-success-line'] {
    background-color: var(--pos-primary) !important;
}

.swal2-icon.swal2-warning {
    border-color: var(--pos-warning) !important;
    color: var(--pos-warning) !important;
}

@media print {
    .no-print { display: none !important; }
    .pos-header, .pos-toolbar, .pos-info-strip { display: none !important; }
    .pos-bill-table { box-shadow: none; border: 1px solid #000; margin: 0; }
}
