/* ── DESIGN SYSTEM & CONSTANTS ── */
:root {
    /* Colors - Curated Premium Light Theme */
    --bg-base: #f8fafc;             /* Slate 50 - Page background */
    --bg-card: #ffffff;             /* Pure White - Cards & Panels */
    --bg-sidebar: #ffffff;          /* Pure White - Sidebar background */
    --border-color: #e2e8f0;        /* Slate 200 - Clean crisp borders */
    --border-hover: #cbd5e1;        /* Slate 300 - Border on hover */
    
    --text-primary: #0f172a;        /* Slate 900 - High-contrast text */
    --text-muted: #475569;          /* Slate 600 - Muted secondary text */
    --text-hint: #94a3b8;           /* Slate 400 - Hint/placeholder text */
    
    /* Brand Accents */
    --color-primary: #2563eb;       /* Professional Cobalt Blue */
    --color-primary-glow: rgba(37, 99, 235, 0.08); /* Faded glow for active items */
    --color-secondary: #0284c7;     /* Professional Sky Blue */
    
    /* Semantic Status Colors */
    --color-success: #16a34a;       /* Emerald Green */
    --color-success-bg: #f0fdf4;    /* Very soft green background */
    --color-warning: #d97706;       /* Amber Yellow */
    --color-warning-bg: #fffbeb;    /* Very soft amber background */
    --color-danger: #dc2626;        /* Rose Red */
    --color-danger-bg: #fef2f2;     /* Very soft red background */
    
    /* Typography */
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Border Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    /* Animation Speeds */
    --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-normal: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── BASE RESET ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    position: relative;
    min-height: 100vh;
}

/* ── AMBIENT BACKGROUND GLOWS ── */
.ambient-glow {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    background: var(--bg-base);
}

/* ── SCROLLBARS ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ── UTILITIES ── */
.hidden {
    display: none !important;
}
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--color-primary); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.btn-block { width: 100%; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #6366f1 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--color-primary-glow);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px var(--color-primary-glow);
    filter: brightness(1.1);
}

.btn-ghost {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: var(--border-hover);
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}
.btn-icon:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
    border-color: var(--border-hover);
}
.btn-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Action Link Buttons inside Tables */
.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: var(--transition-fast);
    padding: 4px 8px;
    border-radius: 4px;
}
.action-btn-primary {
    color: var(--color-secondary);
}
.action-btn-primary:hover {
    background: rgba(14, 165, 233, 0.1);
}
.action-btn-success {
    color: var(--color-success);
}
.action-btn-success:hover {
    background: rgba(16, 185, 129, 0.1);
}
.action-btn-danger {
    color: var(--color-danger);
}
.action-btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ── INPUT FIELDS & FORMS ── */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.form-group label {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 13px;
    color: var(--text-muted);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-hint);
    pointer-events: none;
}

input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    transition: var(--transition-fast);
}
.input-wrapper input {
    padding-left: 38px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
    background: #ffffff;
}

.field-hint {
    font-size: 11px;
    color: var(--text-hint);
    margin-top: 4px;
}

/* ── LOGIN SCREEN ── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    z-index: 10;
    position: relative;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: fadeInScale 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}
.app-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4);
}
.logo-icon {
    width: 28px;
    height: 28px;
    color: #ffffff;
}
.login-header h1 {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}
.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.error-msg {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--color-danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: var(--color-danger);
    font-size: 13px;
    margin-bottom: 20px;
}
.error-msg svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.login-footer {
    margin-top: 32px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}
.login-footer p {
    font-size: 11px;
    color: var(--text-hint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    text-align: center;
}
.cred-hints {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 10px;
    border-radius: var(--radius-sm);
}

/* ── MAIN LAYOUT ── */
.app-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
    width: 100vw;
    z-index: 5;
    position: relative;
    animation: fadeIn 0.4s ease both;
}

/* ── SIDEBAR ── */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}
.brand-icon {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
}
.sidebar-brand span {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.01em;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.nav-item {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-fast);
    position: relative;
}
.nav-item svg {
    width: 18px;
    height: 18px;
}
.nav-item:hover {
    color: var(--text-primary);
    background: #f1f5f9;
}
.nav-item.active {
    color: var(--color-primary);
    background: var(--color-primary-glow);
    border: 1px solid rgba(37, 99, 235, 0.2);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 4px;
    background: var(--color-primary);
    border-radius: 0 4px 4px 0;
}
.nav-item .badge {
    position: absolute;
    right: 16px;
}

/* User widget bottom of sidebar */
.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
}
.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    color: #ffffff;
}
.user-info {
    flex: 1;
    min-width: 0;
}
.user-name {
    display: block;
    font-weight: 600;
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}
.logout-btn {
    background: none;
    border: none;
    color: var(--text-hint);
    cursor: pointer;
    transition: var(--transition-fast);
    padding: 6px;
    border-radius: var(--radius-sm);
}
.logout-btn:hover {
    color: var(--color-danger);
    background: rgba(239, 68, 68, 0.1);
}

/* ── CONTENT CONTAINER ── */
.content-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    padding: 32px 40px 48px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}
.content-header h2 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* Real-Time connection status */
.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(0, 0, 0, 0.2);
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.sync-status.connected {
    color: var(--color-success);
    border-color: rgba(16, 185, 129, 0.2);
}
.sync-status.connected .status-dot {
    background-color: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
    animation: blink 2s infinite;
}
.sync-status.disconnected {
    color: var(--color-danger);
    border-color: rgba(239, 68, 68, 0.2);
}
.sync-status.disconnected .status-dot {
    background-color: var(--color-danger);
    box-shadow: 0 0 8px var(--color-danger);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── STATS CARDS GRID ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px 24px 34px 24px; /* extra bottom padding for hint */
    display: flex;
    flex-direction: column;
    gap: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.2s ease;
}
.stat-card::after {
    content: "View Details →";
    position: absolute;
    bottom: 8px;
    right: 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-primary);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.2s var(--transition-fast), transform 0.2s var(--transition-fast);
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
    border-color: var(--color-primary);
}
.stat-card:hover::after {
    opacity: 1;
    transform: translateX(0);
}
.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.stat-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}
.stat-icon {
    width: 20px;
    height: 20px;
}
.stat-value {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

/* ── GENERAL CARDS & TABLES ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
}

.table-wrapper {
    overflow-x: auto;
    width: 100%;
}
.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.table th, .table td {
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.table th {
    background: #f1f5f9;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.table tbody tr:last-child td {
    border-bottom: none;
}
.table tbody tr:hover td {
    background: #f8fafc;
}

/* Stock Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}
.badge-green {
    background-color: var(--color-success-bg);
    color: #15803d;
    border-color: rgba(16, 185, 129, 0.2);
}
.badge-amber {
    background-color: var(--color-warning-bg);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.2);
}
.badge-red {
    background-color: var(--color-danger-bg);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.2);
}
.badge-accent {
    background-color: var(--color-primary);
    color: #ffffff;
}

/* Transaction Type Badges */
.tx-type-tag {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}
.tx-type-receive { background: #f0fdf4; color: #16a34a; }
.tx-type-dispatch { background: #f0f9ff; color: #0284c7; }
.tx-type-adjustment { background: #faf5ff; color: #9333ea; }
.tx-type-transfer_in { background: #eff6ff; color: #2563eb; }
.tx-type-transfer_out { background: #eef2ff; color: #4f46e5; }
.tx-type-damage { background: #fef2f2; color: #dc2626; }

/* ── TABLE ACTIONS BAR ── */
.table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}
.search-filters {
    display: flex;
    gap: 12px;
    align-items: center;
    flex: 1;
}
.search-box {
    max-width: 380px;
    flex: 1;
}
.table-actions select {
    width: auto;
    min-width: 180px;
}
.location-select-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}
.location-select-wrapper label {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-muted);
}
.select-large {
    font-size: 16px;
    font-weight: 700;
    padding: 8px 16px;
    border-color: var(--color-primary);
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.1);
}

/* ── PAGINATION ── */
.pagination {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
}
.page-info {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── MODALS (OVERLAYS) ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
    animation: fadeIn 0.25s ease both;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 680px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
    overflow: hidden;
}
.modal-card.modal-sm {
    max-width: 460px;
}

.modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}
.modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.modal-card form {
    padding: 32px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.col-span-2 {
    grid-column: span 2;
}

/* Modal Summary Details Banner */
.modal-summary-panel {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}
.summary-row .label {
    color: var(--text-muted);
}
.summary-row .value {
    font-weight: 600;
}

/* Alert Boxes inside forms */
.info-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.2);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: #0369a1;
    font-size: 12.5px;
    line-height: 1.6;
    margin-bottom: 20px;
}
.info-alert svg {
    width: 18px;
    height: 18px;
    color: var(--color-secondary);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Role restriction overlays */
.admin-manager-only {
    /* Set visually, script will block/hide element if role doesn't match */
}

/* Status Bar Column */
.status-bar-container {
    width: 100px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}
.status-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-fast) ease-in-out;
}
.status-bar-fill.green {
    background-color: var(--color-success);
    box-shadow: 0 0 6px var(--color-success);
}
.status-bar-fill.amber {
    background-color: var(--color-warning);
    box-shadow: 0 0 6px var(--color-warning);
}
.status-bar-fill.red {
    background-color: var(--color-danger);
    box-shadow: 0 0 6px var(--color-danger);
}

/* ── ANIMATIONS ── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes fadeInScale {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ── RESPONSIVE DESIGN ── */
@media (max-width: 992px) {
    .app-layout {
        grid-template-columns: 80px 1fr;
    }
    .sidebar-brand span, 
    .sidebar-user .user-info, 
    .nav-item span {
        display: none;
    }
    .sidebar-brand {
        justify-content: center;
        padding: 20px 0;
    }
    .nav-item {
        justify-content: center;
        padding: 12px;
    }
    .sidebar-user {
        justify-content: center;
        padding: 16px 0;
    }
    .logout-btn {
        display: none;
    }
    .content-container {
        padding: 24px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ── PAYMENT MODE BADGES ── */
.payment-mode-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.payment-cash {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.payment-upi {
    background: rgba(14, 165, 233, 0.15);
    color: var(--color-secondary);
    border: 1px solid rgba(14, 165, 233, 0.2);
}
.payment-card {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ── BILLING & POINT OF SALE (POS) LAYOUT ── */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    align-items: start;
    margin-top: 10px;
}

@media (max-width: 1200px) {
    .pos-layout {
        grid-template-columns: 1fr;
    }
}

.pos-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pos-sidebar {
    position: sticky;
    top: 20px;
}

.pos-header-panel {
    border-radius: var(--radius-md);
}

.pos-meta-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 20px;
    padding: 14px 20px;
}

.cashier-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.cashier-info .label {
    font-size: 11px;
    color: var(--text-hint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cashier-info .value {
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--color-primary);
}

.pos-search-container {
    position: relative;
    padding: 12px;
    overflow: visible !important;
    z-index: 100;
}

.search-clear {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-hint);
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    border-radius: 50%;
}
.search-clear:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% - 4px);
    left: 12px;
    right: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 50;
    max-height: 280px;
    overflow-y: auto;
    border-top: none;
}

.search-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-fast);
}
.search-item:last-child {
    border-bottom: none;
}
.search-item:hover {
    background: #f8fafc;
}
.search-item .item-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.search-item .item-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
.search-item .item-sub {
    font-size: 11px;
    color: var(--text-muted);
}
.search-item .item-stock {
    font-size: 12px;
    font-weight: 600;
}

.pos-cart-card {
    min-height: 300px;
}

.cart-item-title {
    font-weight: 600;
    color: var(--text-primary);
}
.cart-item-barcode {
    font-size: 11px;
    color: var(--text-hint);
    margin-top: 2px;
}

.cart-input {
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
    text-align: right;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-base);
}
.cart-input:focus {
    border-color: var(--color-primary);
    background: #ffffff;
}

.cart-qty-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}
.btn-qty {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    border-radius: 4px;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition-fast);
}
.btn-qty:hover {
    background: var(--border-hover);
}

.pos-checkout-card {
    padding: 24px;
}

.payment-mode-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.btn-payment {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 12px;
    transition: var(--transition-fast);
}
.btn-payment svg {
    width: 18px;
    height: 18px;
}
.btn-payment:hover {
    background: #f8fafc;
    color: var(--text-primary);
    border-color: var(--border-hover);
}
.btn-payment.active {
    border-color: var(--color-primary);
    background: var(--color-primary-glow);
    color: var(--color-primary);
    box-shadow: 0 0 10px var(--color-primary-glow);
}

.pos-summary-panel {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pos-summary-panel .summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}
.pos-summary-panel .summary-row.total-row {
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
    margin-top: 4px;
    font-weight: 800;
    font-size: 18px;
    color: var(--color-success);
}
.pos-summary-panel .summary-row.total-row span {
    font-family: var(--font-display);
}

/* ── BARCODE SCANNER INTEGRATION STYLES ── */
.scan-trigger-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary);
    cursor: pointer;
    background: none;
    border: none;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    z-index: 5;
}
.scan-trigger-btn:hover {
    background: var(--color-primary-glow);
    color: var(--color-primary-dark);
}

/* Shift search clear button when scan button is present */
.pos-search-container .search-clear {
    right: 48px !important;
}

/* Scanner Modal Specific Customization */
.scanner-viewport-wrapper #scanner-preview video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Laser animation keyframes */
@keyframes scanline {
    0% {
        top: 4%;
    }
    50% {
        top: 96%;
    }
    100% {
        top: 4%;
    }
}

@keyframes rowFlash {
    0% {
        background-color: var(--color-primary-glow);
    }
    100% {
        background-color: transparent;
    }
}
.row-highlight {
    animation: rowFlash 2s ease-out !important;
}

/* ── SPINNER & STATS DETAILS STYLING ── */
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.bg-danger-soft {
    background-color: var(--color-danger-bg) !important;
}
.bg-warning-soft {
    background-color: var(--color-warning-bg) !important;
}
.bg-success-soft {
    background-color: var(--color-success-bg) !important;
}

/* ── CUSTOMER MANAGEMENT STYLING ── */
.badge-paid {
    background-color: rgba(22, 163, 74, 0.1) !important;
    color: #16a34a !important;
    border: 1px solid rgba(22, 163, 74, 0.2);
    font-size: 11px;
    font-weight: 600;
}
.badge-due {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-size: 11px;
    font-weight: 600;
}
.badge-partial {
    background-color: rgba(245, 158, 11, 0.1) !important;
    color: #f59e0b !important;
    border: 1px solid rgba(245, 158, 11, 0.2);
    font-size: 11px;
    font-weight: 600;
}




