﻿:root {
        /* --- LIGHT THEME --- */
        --primary: #D32F2F; 
        --primary-gradient: linear-gradient(135deg, #D32F2F, #B71C1C);
        --accent: #F57C00;
        
        --bg-body: #F2F4F8;
        --surface-glass: rgba(255, 255, 255, 0.90);
        --surface-card: #FFFFFF;
        
        --text-main: #1A1A1A;
        --text-sub: #8C8C8C;
        --text-on-primary: #FFFFFF;
        
        --input-bg: #F0F2F5;
        --border-light: rgba(255,255,255,0.6);
        --shadow-card: 0 10px 20px rgba(0, 0, 0, 0.04), 0 2px 6px rgba(0, 0, 0, 0.02);
        --shadow-float: 0 15px 35px rgba(211, 47, 47, 0.25);
        
        /* Module Accents */
        --acc-red-bg: #FFEBEE; --acc-red-text: #D32F2F;
        --acc-org-bg: #FFF3E0; --acc-org-text: #F57C00;
        --acc-blue-bg: #E3F2FD; --acc-blue-text: #1976D2;
        --acc-green-bg: #E8F5E9; --acc-green-text: #388E3C;
        
        /* Fonts */
        --font-head: 'Montserrat', sans-serif;
        --font-body: 'Lato', sans-serif;
      }

      /* --- DARK THEME OVERRIDES --- */
      [data-theme="dark"] {
        --bg-body: #121212;
        --surface-glass: rgba(25, 25, 25, 0.90);
        --surface-card: #1E1E1E;
        
        --text-main: #FFFFFF;
        --text-sub: #A0A0A0;
        
        --input-bg: #2C2C2C;
        --border-light: rgba(255,255,255,0.08);
        --shadow-card: 0 10px 25px rgba(0,0,0,0.3);
        --shadow-float: 0 15px 35px rgba(0,0,0,0.5);

        --acc-red-bg: rgba(211, 47, 47, 0.15); --acc-red-text: #EF5350;
        --acc-org-bg: rgba(245, 124, 0, 0.15); --acc-org-text: #FF9800;
        --acc-blue-bg: rgba(25, 118, 210, 0.15); --acc-blue-text: #64B5F6;
        --acc-green-bg: rgba(56, 142, 60, 0.15); --acc-green-text: #81C784;
      }

      * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
        -webkit-tap-highlight-color: transparent;
        user-select: none; 
      }

      body {
        font-family: var(--font-body);
        background-color: var(--bg-body);
        color: var(--text-main);
        height: 100vh;
        height: -webkit-fill-available; 
        width: 100vw;
        overflow: hidden; 
        display: flex;
        flex-direction: column;
        transition: background-color 0.3s ease;
      }

      /* --- ANIMATIONS --- */
      @keyframes fadeUp {
        from { opacity: 0; transform: translateY(15px); }
        to { opacity: 1; transform: translateY(0); }
      }
      @keyframes floatBlob {
        0% { transform: translate(0px, 0px) scale(1); }
        33% { transform: translate(30px, -50px) scale(1.1); }
        66% { transform: translate(-20px, 20px) scale(0.9); }
        100% { transform: translate(0px, 0px) scale(1); }
      }
      @keyframes popIn {
        from { transform: scale(0.8); opacity: 0; }
        to { transform: scale(1); opacity: 1; }
      }

      /* --- UTILITIES --- */
      .hidden { display: none !important; }
      
      .btn {
        border: none; padding: 16px; border-radius: 14px;
        font-family: var(--font-head); font-weight: 700; cursor: pointer;
        transition: all 0.2s; font-size: 14px; letter-spacing: 1px; text-transform: uppercase;
      }
      .btn:active { transform: scale(0.97); }
      .btn-primary { background: var(--primary-gradient); color: var(--text-on-primary); width: 100%; box-shadow: 0 8px 20px rgba(211, 47, 47, 0.25); }
      .btn-secondary { background: var(--input-bg); color: var(--text-main); }
      .btn-danger { background: #FFEBEE; color: #D32F2F; } 

      /* --- LOGIN VIEW --- */
      #login-view {
        position: absolute; top: 0; left: 0; width: 100%; height: 100%;
        display: flex; flex-direction: column; justify-content: center; align-items: center;
        padding: 30px; background: var(--surface-card); z-index: 100;
      }
      .bg-blob {
        position: absolute; width: 300px; height: 300px;
        background: radial-gradient(circle, rgba(245,124,0,0.15) 0%, rgba(211,47,47,0.05) 60%, transparent 70%);
        border-radius: 50%; top: 10%; left: 50%; margin-left: -150px; z-index: 0;
        animation: floatBlob 10s infinite ease-in-out;
      }
      .login-content { z-index: 1; width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 30px; }
      .logo-container { text-align: center; }
      .logo-text { font-family: var(--font-head); font-size: 56px; font-weight: 900; line-height: 1; letter-spacing: -3px; }
      .logo-tak { color: var(--primary); }
      .logo-os { color: var(--text-main); }
      .logo-sub { font-size: 12px; font-weight: 800; color: var(--text-sub); letter-spacing: 5px; margin-top: 10px; text-transform: uppercase; }
      .login-form { width: 100%; display: flex; flex-direction: column; gap: 18px; }
      .input-wrapper { background: var(--input-bg); border-radius: 14px; padding: 8px 16px; border: 2px solid transparent; transition: all 0.2s; }
      .input-wrapper:focus-within { background: var(--surface-card); border-color: var(--accent); box-shadow: 0 4px 15px rgba(245, 124, 0, 0.1); }
      .input-label { font-size: 10px; font-weight: 700; color: var(--text-sub); text-transform: uppercase; margin-bottom: 2px; }
      .clean-input { width: 100%; padding: 8px 0; border: none; background: transparent; font-size: 16px; font-family: var(--font-body); font-weight: 600; color: var(--text-main); outline: none; }
      #login-error { color: var(--primary); font-size: 13px; font-weight: 600; text-align: center; min-height: 20px; }

      /* --- APP STRUCTURE --- */
      #dashboard-view {
        height: 100%; width: 100%;
        display: flex; flex-direction: column;
        background-color: var(--bg-body);
        position: relative;
        overflow: hidden;
      }

      /* HEADER */
      header {
        flex: 0 0 70px; width: 100%; padding: 0 24px;
        display: flex; justify-content: space-between; align-items: center;
        z-index: 20; background: var(--surface-glass);
        backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border-light);
        position: relative;
      }
      .user-info-left { display: flex; align-items: center; gap: 12px; z-index: 2; }
      .user-avatar { width: 38px; height: 38px; background: var(--input-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-main); }
      .user-name { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: var(--text-main); }
      .header-center {
        position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
        font-family: var(--font-head); font-weight: 900; letter-spacing: 2px;
        color: var(--text-main); font-size: 14px; text-transform: uppercase; z-index: 1; opacity: 0.8;
      }
      .date-info-right { text-align: right; z-index: 2; }
      .current-date { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: var(--text-main); }
      .current-day { font-size: 10px; color: var(--text-sub); font-weight: 700; text-transform: uppercase; }

      /* CONTENT AREA */
      .scroll-container {
        flex: 1; overflow-y: auto; padding: 20px; padding-bottom: 100px;
        -webkit-overflow-scrolling: touch; position: relative;
      }

      /* MENU GRID */
      .section-group { margin-bottom: 30px; }
      .section-title { font-family: var(--font-head); font-weight: 800; font-size: 11px; color: var(--text-sub); margin-bottom: 15px; letter-spacing: 1.5px; padding-left: 5px; text-transform: uppercase; }
      .module-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
      .module-card {
        background: var(--surface-card); border-radius: 20px; padding: 20px;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
        box-shadow: var(--shadow-card); border: 1px solid var(--border-light);
        cursor: pointer; height: 120px; position: relative; overflow: hidden;
      }
      .module-card:active { transform: scale(0.96); }
      .module-card.full-width {
        grid-column: span 2; flex-direction: row; justify-content: flex-start;
        padding-left: 30px; height: 100px; background: var(--primary-gradient); color: white;
        box-shadow: 0 8px 20px rgba(211, 47, 47, 0.3); border: none;
      }
      .module-card.full-width .icon-box { background: rgba(255,255,255,0.2) !important; color: white !important; }
      .module-card.full-width .module-title { color: white; font-size: 16px; text-align: left; }
      .icon-box { width: 48px; height: 48px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background-color: var(--input-bg); color: var(--text-main); }
      .icon-box span { font-size: 26px; }
      .module-title { font-size: 11px; font-weight: 700; text-align: center; color: var(--text-main); }
      .module-card[data-module="POS"] .icon-box { background: var(--acc-red-bg); color: var(--acc-red-text); }
      .module-card[data-module="EXPENSES"] .icon-box { background: var(--acc-org-bg); color: var(--acc-org-text); }
      .module-card[data-module="INVENTORY"] .icon-box { background: var(--acc-blue-bg); color: var(--acc-blue-text); }
      .module-card[data-module="REPORTS"] .icon-box { background: var(--acc-green-bg); color: var(--acc-green-text); }

      /* ACTIVE MODULE VIEW */
      #active-module-view {
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        min-height: 60vh; text-align: center; animation: fadeUp 0.4s ease;
      }
      .module-placeholder-icon {
        font-size: 64px; color: var(--text-sub); margin-bottom: 20px; opacity: 0.5;
      }
      .module-placeholder-title {
        font-family: var(--font-head); font-weight: 900; font-size: 24px; color: var(--text-main); margin-bottom: 10px;
      }
      .module-placeholder-desc { color: var(--text-sub); font-size: 14px; }

      /* FOOTER */
      .footer-container {
        position: absolute; bottom: 30px; left: 0; width: 100%;
        display: flex; justify-content: center; pointer-events: none; z-index: 30;
      }
      .glass-nav {
        pointer-events: auto; height: 65px; width: calc(100% - 40px);
        background: var(--surface-glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        border-radius: 35px; display: flex; justify-content: space-between; align-items: center;
        padding: 0 40px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); border: 1px solid var(--border-light); position: relative;
      }
      .nav-btn { background: none; border: none; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; color: #B0B0B0; cursor: pointer; }
      .nav-btn:active, .nav-btn.active { color: var(--text-main); }
      .nav-btn i { font-size: 28px; }
      .nav-btn-home {
        background: var(--primary-gradient); color: white; width: 60px; height: 60px; border-radius: 50%;
        position: absolute; left: 50%; transform: translateX(-50%); bottom: 12px;
        box-shadow: var(--shadow-float); border: 4px solid var(--bg-body);
      }
      .nav-btn-home:active { transform: translateX(-50%) scale(0.95); }
      .nav-btn-home i { font-size: 32px; }

      /* SETTINGS VIEW */
      #settings-view {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: var(--bg-body); z-index: 50; padding: 20px;
        transform: translateY(100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex; flex-direction: column;
      }
      #settings-view.active { transform: translateY(0); }
      .settings-header { display: flex; align-items: center; margin-bottom: 30px; margin-top: 20px; }
      .settings-title { font-family: var(--font-head); font-size: 24px; font-weight: 800; color: var(--text-main); margin-left: 15px; }
      .back-btn { background: none; border: none; color: var(--text-main); }
      .settings-card { background: var(--surface-card); border-radius: 20px; padding: 25px; margin-bottom: 20px; box-shadow: var(--shadow-card); border: 1px solid var(--border-light); }
      .setting-row { display: flex; justify-content: space-between; align-items: center; }
      .setting-label { font-weight: 700; color: var(--text-main); font-size: 15px; }
      .switch { position: relative; display: inline-block; width: 52px; height: 28px; }
      .switch input { opacity: 0; width: 0; height: 0; }
      .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #E0E0E0; transition: .4s; border-radius: 34px; }
      .slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
      input:checked + .slider { background-color: var(--primary); }
      input:checked + .slider:before { transform: translateX(24px); }
      .pass-group { margin-bottom: 12px; }
      #pass-msg { font-size: 12px; margin-top: 10px; text-align: center; min-height: 18px; font-weight:600; }
      .msg-success { color: var(--acc-green-text); }
      .msg-error { color: var(--primary); }

      /* MODAL CONFIRMATION */
      #modal-overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.4); z-index: 10000;
        display: flex; justify-content: center; align-items: center;
        backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
      }
      .modal-box {
        background: var(--surface-card); width: 85%; max-width: 320px;
        padding: 25px; border-radius: 20px; box-shadow: 0 20px 40px rgba(0,0,0,0.2);
        text-align: center; animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
      }
      .modal-icon { font-size: 40px; margin-bottom: 10px; color: var(--primary); }
      .modal-title { font-family: var(--font-head); font-weight: 800; font-size: 18px; margin-bottom: 8px; color: var(--text-main); }
      .modal-text { font-size: 14px; color: var(--text-sub); margin-bottom: 25px; line-height: 1.5; }
      .modal-actions { display: flex; gap: 10px; }
      .modal-actions button { flex: 1; padding: 12px; font-size: 13px; }

      /* LOADING */
      #loading-overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: var(--surface-card); z-index: 9999;
        display: flex; justify-content: center; align-items: center; gap: 12px;
        transition: opacity 0.3s ease;
      }
      .dot { width: 18px; height: 18px; border-radius: 50%; animation: bounce 1.4s infinite ease-in-out both; }
      .dot:nth-child(1) { background-color: var(--primary); animation-delay: -0.32s; }
      .dot:nth-child(2) { background-color: var(--accent); animation-delay: -0.16s; }
      .dot:nth-child(3) { background-color: var(--text-main); }
      @keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

      /* --- ANIMATIONS & INTERACTIVITY --- */
      /* Button Press Effect */
      button:active, .item-card:active {
        transform: scale(0.95);
        transition: transform 0.1s;
      }

      /* --- LOADING ANIMATION --- */
      #loading-overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: var(--bg-body); z-index: 9999;
        display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 20px;
        /* Glassmorphism background for modern feel */
        backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
      }

      .loader-box { position: relative; width: 80px; height: 80px; display: flex; justify-content: center; align-items: center; }

      /* The Ripple Effect */
      .ripple {
        position: absolute; border: 4px solid var(--primary); opacity: 1;
        border-radius: 50%;
        animation: ripple-anim 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
      }
      .ripple:nth-child(2) { animation-delay: -0.5s; }

      @keyframes ripple-anim {
        0% { width: 0; height: 0; opacity: 0; }
        5% { width: 0; height: 0; opacity: 1; }
        100% { width: 72px; height: 72px; opacity: 0; }
      }

      .loading-text { 
        font-family: var(--font-head); font-weight: 800; letter-spacing: 3px; 
        font-size: 14px; color: var(--text-main); 
        animation: fadeText 1.5s infinite alternate; 
      }
      @keyframes fadeText { from { opacity: 0.3; } to { opacity: 1; } }

      /* --- POS MODULE STYLING --- */
      .pos-wrapper {
        max-width: 1000px; margin: 0 auto; padding-bottom: 80px;
        display: flex; flex-direction: column; gap: 20px;
      }

      /* POS Header */
      .pos-header {
        display: flex; justify-content: space-between; align-items: center;
        margin-bottom: 10px;
      }
      .pos-title { font-family: var(--font-head); font-weight: 900; font-size: 20px; color: var(--text-main); }

      /* Item Grid (The Menu Container) */
      .item-grid {
        display: grid; 
        /* CHANGE THIS LINE: */
        grid-template-columns: repeat(3, 1fr); /* Forces exactly 3 items per row */
        gap: 10px; /* Reduced gap slightly to fit better */
        
        /* Keep the rest of your existing styles below... */
        height: 400px;
        overflow-y: auto;
        padding: 15px;
        background: #fff;
        border: 2px solid #eee;
        border-radius: 16px;
        margin-bottom: 20px;
      }
      .item-card {
        border-radius: 16px; padding: 15px;
        box-shadow: var(--shadow-card); border: 1px solid rgba(0,0,0,0.05);
        display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
        height: 110px; cursor: pointer; position: relative; overflow: hidden;
        transition: transform 0.1s;
      }
      .item-card:active { transform: scale(0.95); }

      /* Item Typography Swapped */
      .item-code { font-family: var(--font-head); font-weight: 900; font-size: 20px; margin-bottom: 5px; opacity: 0.9; }
      .item-name { font-weight: 600; font-size: 11px; line-height: 1.2; color: rgba(0,0,0,0.7); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
      .item-price-tag { 
        position: absolute; bottom: 0; left: 0; width: 100%; 
        background: rgba(255,255,255,0.6); font-size: 11px; font-weight: 700; 
        padding: 4px; color: var(--text-main);
      }

      /* Pastel Color Classes */
      .bg-rv { background-color: #C8E6C9; color: #1B5E20; } /* Green */
      .bg-km { background-color: #FFF9C4; color: #F57F17; } /* Yellow */
      .bg-dy { background-color: #E6EE9C; color: #558B2F; } /* Pastel Yellow-Green (Lime) */
      .bg-hc { background-color: #F8BBD0; color: #880E4F; } /* Pink */
      .bg-ct { background-color: #E1BEE7; color: #4A148C; } /* Purple */
      .bg-kk { background-color: #FFCDD2; color: #B71C1C; } /* Red */
      .bg-vc { background-color: #A5D6A7; color: #1B5E20; } /* Dark Green Pastel */
      .bg-def { background-color: #F5F5F5; color: #424242; } /* Default */

      /* Cart Section */
      .cart-container {
        background: var(--surface-card); border-radius: 20px; padding: 20px;
        box-shadow: var(--shadow-card); border: 1px solid var(--border-light);
        display: flex; flex-direction: column; gap: 15px;
      }
      .cart-title { font-weight: 800; color: var(--text-sub); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; border-bottom: 1px solid var(--border-light); padding-bottom: 10px; }

      /* Modern Table */
      .cart-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
      .cart-table th { text-align: left; font-size: 10px; color: var(--text-sub); padding: 0 10px; }
      .cart-table td { background: var(--input-bg); padding: 10px; font-size: 14px; font-weight: 600; color: var(--text-main); vertical-align: middle; }
      .cart-table td:first-child { border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
      .cart-table td:last-child { border-top-right-radius: 10px; border-bottom-right-radius: 10px; text-align: right; }

      /* Quantity Rockers */
      .qty-control { display: flex; align-items: center; gap: 5px; background: white; border-radius: 8px; padding: 2px; width: fit-content; border: 1px solid #ddd; }
      .qty-btn { 
        width: 24px; height: 24px; border: none; background: #eee; border-radius: 6px; 
        font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center;
      }
      .qty-btn:active { background: #ccc; }
      .qty-input {
        width: 30px; border: none; text-align: center; font-weight: 800; font-size: 13px; outline: none;
      }

      /* Order Summary & Inputs */
      .summary-section { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
      .pos-input-group { display: flex; gap: 10px; }
      .pos-input-wrapper {
        flex: 1; 
        background: var(--input-bg); 
        border-radius: 12px; 
        padding: 0 15px;
        display: flex; 
        align-items: center; 
        height: 45px;           /* Fixed Height */
        min-height: 45px;       /* Force Minimum */
        max-height: 45px;       /* Force Maximum */
        border: 1px solid transparent;
        transition: all 0.2s;
        box-sizing: border-box; /* Ensure padding doesn't add to height */
      }
      .pos-input-wrapper:focus-within { background: var(--surface-card); border-color: var(--accent); box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
      .pos-input { width: 100%; border: none; background: transparent; font-family: var(--font-body); font-weight: 600; font-size: 13px; color: var(--text-main); outline: none; }

      /* Grand Total Box */
      .grand-total-box {
        background: var(--text-main); color: var(--bg-body);
        padding: 15px; border-radius: 14px; display: flex; justify-content: space-between; align-items: center;
        margin-top: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
      }
      .gt-label { font-size: 12px; font-weight: 700; opacity: 0.8; letter-spacing: 1px; }
      .gt-value { font-size: 20px; font-weight: 900; font-family: var(--font-head); }

      /* Action Buttons */
      .pos-actions { display: flex; gap: 10px; margin-top: 10px; }
      .pos-btn-submit { flex: 2; background: var(--primary-gradient); color: white; border: none; padding: 15px; border-radius: 14px; font-weight: 700; letter-spacing: 1px; font-size: 14px; cursor: pointer; box-shadow: 0 5px 15px rgba(211,47,47,0.3); }
      .pos-btn-clear { flex: 1; background: var(--input-bg); color: var(--text-sub); border: none; padding: 15px; border-radius: 14px; font-weight: 700; cursor: pointer; }
      .btn-icon-del { background: #FFEBEE; color: #D32F2F; border: none; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

      /* --- MODULE ICON COLORS --- */

      /* POS: Red */
      .module-card[data-module="POS"] .icon-box {
        background-color: #FFEBEE; /* Light Red bg */
        color: #D32F2F;            /* Red Icon */
      }

      /* Expenses: Yellow */
      .module-card[data-module="EXPENSES"] .icon-box {
        background-color: #FFF9C4; /* Light Yellow bg */
        color: #FBC02D;            /* Dark Yellow/Gold Icon */
      }

      /* Inventory: Blue */
      .module-card[data-module="INVENTORY"] .icon-box {
        background-color: #E3F2FD; /* Light Blue bg */
        color: #1976D2;            /* Blue Icon */
      }

      /* Reports: Green */
      .module-card[data-module="REPORTS"] .icon-box {
        background-color: #E8F5E9; /* Light Green bg */
        color: #388E3C;            /* Green Icon */
      }

      /* --- OPTIMIZED POS STYLING --- */

      /* Wrapper: Better use of width */
      .pos-wrapper {
        max-width: 100%; /* Use full width available */
        margin: 0 auto; 
        padding-bottom: 90px; /* Space for footer */
        display: flex; flex-direction: column; gap: 15px; /* Reduced gap */
      }

      /* POS Header: Tighter */
      .pos-header {
        display: flex; justify-content: space-between; align-items: center;
        margin-bottom: 5px; padding: 0 5px;
      }

      /* Item Grid: 3 Columns, Tighter Gaps */
      .item-grid {
        display: grid; 
        grid-template-columns: repeat(3, 1fr); /* Force 3 columns */
        gap: 8px; /* Tighter gap */
        
        height: 380px; /* Fixed height for scrolling */
        overflow-y: auto;
        padding: 10px; /* Reduced inner padding */
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 12px;
        margin-bottom: 15px;
      }

      /* Item Card: More Compact */
      .item-card {
        border-radius: 12px; padding: 8px; /* Reduced padding */
        box-shadow: 0 2px 5px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.05);
        display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
        height: 95px; /* Shorter height */
        cursor: pointer; position: relative; overflow: hidden;
        transition: transform 0.1s;
      }
      .item-card:active { transform: scale(0.96); }

      /* Typography inside Item Card */
      .item-code { 
        font-family: var(--font-head); font-weight: 800; 
        font-size: 14px; /* Slightly smaller to fit */
        margin-bottom: 3px; opacity: 0.9; 
        line-height: 1.1;
        word-break: break-all; /* Ensure code wraps if absolutely necessary inside grid */
      }
      .item-name { 
        font-weight: 600; font-size: 10px; line-height: 1.1; 
        color: rgba(0,0,0,0.6); 
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; 
      }
      .item-price-tag { 
        position: absolute; bottom: 0; left: 0; width: 100%; 
        background: rgba(255,255,255,0.85); font-size: 10px; font-weight: 800; 
        padding: 3px; color: var(--text-main);
      }

      /* Cart Container: Tighter Spacing */
      .cart-container {
        background: var(--surface-card); border-radius: 16px; padding: 15px;
        box-shadow: var(--shadow-card); border: 1px solid var(--border-light);
        display: flex; flex-direction: column; gap: 10px;
      }

      /* CART TABLE OPTIMIZATION */
      .cart-table { width: 100%; border-collapse: collapse; /* Changed to collapse for tighter fit */ }

      .cart-table th { 
        text-align: left; font-size: 9px; color: var(--text-sub); 
        padding: 4px 6px; text-transform: uppercase; letter-spacing: 0.5px;
        border-bottom: 1px solid #eee;
      }

      .cart-table td { 
        padding: 8px 4px; /* Reduced vertical padding */
        border-bottom: 1px solid #f0f0f0;
        vertical-align: middle;
      }

      /* Specific Column Styles */
      .col-code { 
        font-weight: 800; font-size: 11px; color: var(--text-main); 
        white-space: nowrap; /* PREVENT WRAPPING */
      }
      .col-price { font-size: 11px; color: var(--text-sub); }
      .col-total { font-weight: 700; font-size: 12px; color: var(--text-main); }

      /* Quantity Control: Smaller */
      .qty-control { 
        display: flex; align-items: center; gap: 0; 
        background: #f5f5f5; border-radius: 6px; padding: 1px; 
        width: fit-content; border: 1px solid #ddd; 
      }
      .qty-btn { 
        width: 20px; height: 20px; border: none; background: transparent; 
        font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center;
        font-size: 12px;
      }
      .qty-input {
        width: 24px; border: none; background: transparent; text-align: center; 
        font-weight: 700; font-size: 11px; outline: none; padding: 0;
      }

      /* Delete Button */
      .btn-icon-del { 
        background: #FFEBEE; color: #D32F2F; border: none; 
        width: 24px; height: 24px; border-radius: 6px; 
        cursor: pointer; display: flex; align-items: center; justify-content: center; 
      }

      /* --- VISUAL DISTINCTION STYLES --- */

      /* 1. Scrollable Cart Table Area */
      /* This ensures the list scrolls if it gets too long, keeping inputs visible */
      .cart-scroll-area {
        max-height: 250px; 
        overflow-y: auto;
        margin-bottom: 15px;
        border-bottom: 1px dashed var(--border-light);
        padding-bottom: 10px;
      }

      /* 2. Distinct Checkout Form Area */
      .checkout-form {
        background-color: var(--input-bg); /* Use the gray input background for the whole block */
        border-radius: 12px;
        padding: 15px;
        border: 1px solid var(--border-light);
        display: flex; 
        flex-direction: column; 
        gap: 10px;
      }

      /* Dark mode adjustment for the form block */
      [data-theme="dark"] .checkout-form {
        background-color: rgba(255,255,255,0.03);
      }

      /* 3. Section Label */
      .form-section-label {
        font-size: 10px; 
        font-weight: 800; 
        color: var(--text-sub); 
        text-transform: uppercase; 
        letter-spacing: 1px;
        margin-bottom: 5px;
        display: flex; align-items: center; gap: 5px;
      }

      /* 4. Tweak Inputs to stand out against the new gray background */
      .checkout-form .pos-input-wrapper {
        background-color: var(--surface-card); /* White inputs on Gray bg */
        border: 1px solid rgba(0,0,0,0.05);
        height: 40px; /* Slightly compact */
        min-height: 40px;
      }
      .checkout-form .pos-input-wrapper:focus-within {
        border-color: var(--accent);
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
      }

      /* --- RECEIPT MODAL STYLES (Add this to your CSS) --- */
      #pos-modal {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.6); z-index: 10000;
        display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 15px;
        backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
        opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
      }

      #pos-modal.active {
        opacity: 1; pointer-events: auto;
      }

      .receipt-paper {
        background: #fff; width: 320px; padding: 25px;
        box-shadow: 0 20px 40px rgba(0,0,0,0.3);
        font-family: 'Courier New', Courier, monospace; /* Monospace for receipt look */
        color: #000;
        animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        transform-origin: top center;
        /* Paper jagged edge effect (optional simple version) */
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
      }

      @keyframes slideUp { from { transform: translateY(50px) scale(0.95); } to { transform: translateY(0) scale(1); } }

      .rec-header { text-align: center; margin-bottom: 15px; }
      .rec-brand { font-weight: 900; font-size: 16px; margin-bottom: 5px; letter-spacing: 1px; }
      .rec-meta { font-size: 10px; color: #555; margin-bottom: 2px; }

      .rec-divider { 
        border-bottom: 1px dashed #000; margin: 10px 0; opacity: 0.3; width: 100%; 
      }

      .rec-row { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 4px; font-weight: 600; }
      .rec-row.bold { font-weight: 900; font-size: 13px; margin-top: 5px; }
      .rec-item-name { max-width: 180px; }

      .receipt-actions { display: flex; gap: 10px; width: 320px; }
      .receipt-actions button { flex: 1; padding: 12px; border-radius: 8px; font-weight: 700; cursor: pointer; border: none; }
