/*
 ==========================================================================
 🐾 Pet Shop POS Premium Design System (styles.css)
 ==========================================================================
 Author: Antigravity (Senior Software Engineer)
 Theme: Sleek Glassmorphic Dark Mode with warm Amber & Emerald Accents
 ==========================================================================
*/

/* --- 1. Import Fonts & Setup Root Variables --- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette (Premium HSL & RGBA Tokens) */
    --bg-darker: #0c0d0f;
    --bg-dark: #121418;
    --bg-card: rgba(22, 26, 32, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(255, 143, 0, 0.15);
    
    /* Text Colors */
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #1f2937;
    
    /* Accents (Amber & Gold for Pets, Emerald for POS/Money, Coral for Alerts) */
    --accent-amber: #f59e0b;
    --accent-gold: #fbbf24;
    --accent-gold-rgb: 251, 191, 36;
    --color-emerald: #10b981;
    --color-emerald-rgb: 16, 185, 129;
    --color-coral: #ef4444;
    
    /* Font Families */
    --font-heading: 'Outfit', 'Sarabun', sans-serif;
    --font-body: 'Sarabun', 'Outfit', sans-serif;
    
    /* Transitions & Shadows */
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-glow: 0 0 15px rgba(251, 191, 36, 0.25);
    --shadow-emerald-glow: 0 0 15px rgba(16, 185, 129, 0.25);
    
    /* Layout Constants */
    --header-height: 70px;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
}

/* --- 2. CSS Reset & Global Styling --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
}

body {
    background-color: var(--bg-darker);
    background-image: 
        radial-gradient(at 10% 10%, rgba(245, 158, 11, 0.05) 0px, transparent 50%),
        radial-gradient(at 90% 90%, rgba(16, 185, 129, 0.05) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(12, 13, 15, 1) 0px, rgba(12, 13, 15, 0.95) 100%);
    background-attachment: fixed;
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-amber);
}

/* --- 3. Glassmorphism Utilities --- */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* --- 4. Main Navigation Header --- */
.app-header {
    height: var(--header-height);
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: 0.5px;
}

.header-brand i {
    color: var(--accent-gold);
    text-shadow: var(--shadow-glow);
}

.header-nav {
    display: flex;
    gap: 8px;
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-btn.active {
    background: rgba(251, 191, 36, 0.12);
    color: var(--accent-gold);
    border-color: rgba(251, 191, 36, 0.25);
    box-shadow: var(--shadow-glow);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Cashier Shift Status */
.shift-status-badge {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--color-emerald);
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.shift-status-badge.closed-badge {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--color-coral);
}

/* Network Connection Simulator Styles */
.network-badge {
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.network-badge.online {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--color-emerald);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.network-badge.online .status-dot {
    background-color: var(--color-emerald);
    box-shadow: 0 0 8px var(--color-emerald);
    animation: pulseGlow 2s infinite;
}

.network-badge.offline {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--accent-amber);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.1);
}

.network-badge.offline .status-dot {
    background-color: var(--accent-amber);
    box-shadow: 0 0 8px var(--accent-amber);
    animation: pulseAmber 1.5s infinite;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.net-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition-fast);
}

.net-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

/* --- 5. Main Content Structure --- */
.app-container {
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    padding: 24px;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

.app-view {
    display: none;
    animation: viewFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-view.active {
    display: block;
}

/* --- 6. POS Front Office View Layout --- */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 24px;
    height: calc(100vh - var(--header-height) - 48px);
}

.pos-catalog-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    overflow: hidden;
}

/* Catalog Filter Bar */
.catalog-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.search-wrapper {
    position: relative;
    flex: 1 1 320px;
    min-width: min(100%, 260px);
}

.scanner-search-wrapper .form-input {
    min-height: 44px;
    border-color: rgba(251, 191, 36, 0.28);
    background: rgba(251, 191, 36, 0.06);
}

.search-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 10px 14px 10px 40px;
    border-radius: var(--border-radius-md);
    outline: none;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.form-input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.15);
}

.scan-focus-btn {
    flex: 0 0 auto;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(251, 191, 36, 0.45);
    background: rgba(251, 191, 36, 0.12);
    color: var(--accent-gold);
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.scan-focus-btn:hover,
.scan-focus-btn:focus-visible {
    background: var(--accent-amber);
    color: var(--bg-darker);
    outline: none;
}

.category-tabs {
    flex: 1 1 100%;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.cat-tab {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 500;
    transition: var(--transition-fast);
}

.cat-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.cat-tab.active {
    background: var(--accent-amber);
    color: var(--bg-darker);
    border-color: var(--accent-amber);
    font-weight: 600;
    box-shadow: var(--shadow-glow);
}

/* Products Grid Container */
.products-grid-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

/* Product Card Styling */
.product-card {
    cursor: pointer;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    border-color: rgba(251, 191, 36, 0.3);
    box-shadow: var(--shadow-glow);
}

.prod-img-container {
    height: 140px;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.prod-img-container img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-smooth);
}

.prod-img-container .product-photo {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
    border-radius: 0;
}

.prod-img-container .product-photo + .product-fallback-icon {
    display: none;
}

.prod-img-container.image-load-failed .product-photo {
    display: none;
}

.prod-img-container.image-load-failed .product-fallback-icon {
    display: inline-block;
}

.product-card:hover .prod-img-container img {
    transform: scale(1.08);
}

.product-image-preview {
    min-height: 54px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--text-muted);
}

.product-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.low-stock-alert-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(239, 68, 68, 0.95);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.out-of-stock-alert-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(107, 114, 128, 0.95);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.product-card.out-of-stock {
    opacity: 0.55;
    filter: grayscale(40%);
}

.prod-details {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.prod-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 4px;
    line-clamp: 2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8em;
    line-height: 1.4;
}

.prod-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.prod-price {
    color: var(--accent-gold);
    font-weight: 700;
    font-size: 1.1rem;
    font-family: var(--font-heading);
}

.prod-stock-lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- 7. Cart & Sidebar Summary Panel --- */
.pos-cart-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.cart-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.clear-cart-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.clear-cart-btn:hover {
    color: var(--color-coral);
}

/* Cart Items Container */
.cart-items-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.empty-cart-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
}

.empty-cart-state i {
    font-size: 3rem;
    opacity: 0.2;
}

.cart-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition-fast);
}

.cart-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.cart-item-details {
    flex: 1;
    overflow: hidden;
}

.cart-item-name {
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-family: var(--font-heading);
    color: var(--accent-gold);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 2px;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2px 4px;
}

.qty-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-fast);
}

.qty-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.qty-input {
    width: 24px;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.85rem;
}

.remove-cart-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: var(--transition-fast);
}

.remove-cart-item:hover {
    color: var(--color-coral);
}

/* Cart Member Selection Section */
.cart-member-section {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.01);
}

.member-search-bar {
    position: relative;
}

.member-search-results {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #171b21;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.member-result-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.member-result-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.member-result-info {
    display: flex;
    flex-direction: column;
}

.member-result-name {
    font-weight: 500;
}

.member-result-phone {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.selected-member-card {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--border-radius-md);
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selected-member-info h4 {
    color: var(--color-emerald);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.member-tier-pill {
    background: var(--accent-gold);
    color: var(--bg-darker);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.selected-member-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.remove-member-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.remove-member-btn:hover {
    color: var(--color-coral);
}

/* Points Redemption Toggle */
.points-redeem-row {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.15);
    padding: 6px 10px;
    border-radius: var(--border-radius-sm);
    border: 1px dashed rgba(255, 255, 255, 0.08);
}

/* Cart Checkout Summary */
.cart-summary {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.summary-row.discount-row {
    color: var(--color-emerald);
}

.summary-row.total-row {
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.25rem;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}

.summary-row.total-row span:last-child {
    color: var(--accent-gold);
    font-family: var(--font-heading);
    text-shadow: var(--shadow-glow);
}

.checkout-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-amber) 0%, var(--accent-gold) 100%);
    border: none;
    color: var(--bg-darker);
    padding: 14px;
    border-radius: var(--border-radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    box-shadow: var(--shadow-glow);
    transition: var(--transition-fast);
}

.checkout-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.checkout-btn:active {
    transform: translateY(0);
}

/* --- 8. Modals & Dialog Screen Designs --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: var(--transition-smooth);
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
}

.close-modal:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Form Controls */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.select-dropdown {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 10px 12px;
    border-radius: var(--border-radius-md);
    outline: none;
    font-size: 0.95rem;
    cursor: pointer;
}

.select-dropdown option {
    background-color: var(--bg-dark);
}

/* Button Classes */
.btn {
    padding: 10px 20px;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-amber) 0%, var(--accent-gold) 100%);
    border: none;
    color: var(--bg-darker);
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.cash-quick-tender {
    display: grid;
    grid-template-columns: repeat(5, minmax(64px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.cash-quick-tender-btn {
    justify-content: center;
    min-width: 0;
    min-height: 42px;
    padding: 8px 6px;
    color: var(--text-main);
    font-size: 0.92rem;
    white-space: nowrap;
}

.cash-quick-tender-btn.active {
    background: rgba(245, 158, 11, 0.16);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2);
}

.cash-quick-tender-btn:disabled {
    cursor: not-allowed;
    opacity: 0.35;
}

@media (max-width: 560px) {
    .cash-quick-tender {
        grid-template-columns: repeat(3, minmax(72px, 1fr));
    }
}

.btn-emerald {
    background: var(--color-emerald);
    border: none;
    color: var(--bg-darker);
    box-shadow: var(--shadow-emerald-glow);
}

.btn-emerald:hover {
    filter: brightness(1.1);
}

/* --- 9. Checkout & QR Selector Modal Specific --- */
.payment-selector {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.pay-opt-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition-fast);
    text-align: left;
}

.pay-opt-btn:hover {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.03);
}

.pay-opt-btn.active {
    border-color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.06);
    box-shadow: var(--shadow-glow);
}

.pay-opt-icon {
    font-size: 2rem;
    color: var(--accent-amber);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
}

.pay-opt-btn.active .pay-opt-icon {
    background: var(--accent-amber);
    color: var(--bg-darker);
}

.pay-opt-info h4 {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
}

.pay-opt-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* QR Sub-selection details */
.qr-choices {
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

.qr-choice-btn {
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    padding: 12px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast);
}

.qr-choice-btn.kshop {
    border-color: rgba(16, 185, 129, 0.2);
}
.qr-choice-btn.kshop:hover, .qr-choice-btn.kshop.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--color-emerald);
}

.qr-choice-btn.kplus {
    border-color: rgba(251, 191, 36, 0.2);
}
.qr-choice-btn.kplus:hover, .qr-choice-btn.kplus.active {
    background: rgba(251, 191, 36, 0.06);
    border-color: var(--accent-gold);
}

.qr-display-container {
    text-align: center;
    padding: 20px;
    background: #ffffff;
    border-radius: var(--border-radius-lg);
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

.qr-display-container.kshop-theme {
    border: 6px solid var(--color-emerald);
}

.qr-display-container.kplus-theme {
    border: 6px solid var(--accent-amber);
}

.qr-header-title {
    color: #1f2937;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.qr-header-title.kshop-text {
    color: var(--color-emerald);
}

.qr-header-title.kplus-text {
    color: #0c4a60; /* Dark Teal commonly associated with KBANK */
}

.qr-image-placeholder {
    width: 200px;
    height: 200px;
    background: #f3f4f6;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
    border-radius: var(--border-radius-md);
}

.qr-price-tag {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1f2937;
    margin-top: 10px;
    font-family: var(--font-heading);
}

/* Verification Screen styling */
.slip-verify-card {
    border: 1px dashed rgba(255,255,255,0.15);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-md);
    padding: 16px;
    text-align: center;
    margin-top: 12px;
}

.slip-verify-card i {
    font-size: 2.2rem;
    color: var(--color-emerald);
    margin-bottom: 10px;
}

/* --- 10. Back Office Layout --- */
.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    min-height: calc(100vh - var(--header-height) - 48px);
}

.admin-sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-weight: 500;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-fast);
}

.admin-tab-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.admin-tab-btn.active {
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent-gold);
    font-weight: 600;
}

.admin-content-panel {
    min-height: 100%;
}

.admin-sub-view {
    display: none;
    animation: viewFadeIn 0.3s ease;
}

.admin-sub-view.active {
    display: block;
}

/* Dashboard Analytics Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

/* Inventory Valuation Grid (Premium v15) */
.inventory-valuation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
    margin-top: 20px;
}
@media (max-width: 1024px) {
    .inventory-valuation-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .inventory-valuation-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.stat-card {
    padding: 20px;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.stat-header i {
    font-size: 1.25rem;
    color: var(--accent-gold);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 10px;
    font-family: var(--font-heading);
}

.stat-footer {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-footer.success {
    color: var(--color-emerald);
}

/* Dashboard charts / layout section */
.dashboard-charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    padding: 20px;
    min-height: 300px;
}

.chart-container-mock {
    height: 220px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding-top: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.chart-bar-mock {
    width: 32px;
    background: linear-gradient(0deg, rgba(251, 191, 36, 0.2) 0%, var(--accent-gold) 100%);
    border-radius: 4px 4px 0 0;
    position: relative;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.chart-bar-mock:hover {
    filter: brightness(1.2);
    box-shadow: var(--shadow-glow);
}

.chart-bar-mock::after {
    content: attr(data-label);
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.chart-bar-mock::before {
    content: attr(data-value);
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-gold);
}

/* Tables Styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.premium-table th {
    background: rgba(255, 255, 255, 0.02);
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.premium-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.premium-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Image Upload Preview CSS */
.img-upload-box {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.img-upload-box:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

.img-upload-box:hover {
    border-color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.02);
}

.img-upload-box.has-image {
    border-style: solid;
    border-color: rgba(251, 191, 36, 0.45);
}

.img-upload-box.is-uploading {
    opacity: 0.72;
    pointer-events: none;
}

.img-upload-box img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.img-upload-box.has-image > i,
.img-upload-box.has-image > span,
.img-upload-box.has-image > small {
    position: relative;
    z-index: 1;
    padding: 3px 7px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.58);
}

.img-upload-box small {
    max-width: 100%;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.35;
}

.product-image-upload-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

/* --- 12. Customer Portal View Layout --- */
.customer-portal-card {
    max-width: 500px;
    margin: 40px auto;
    padding: 24px;
}

.customer-card-visual {
    background: linear-gradient(135deg, #1b2028 0%, #0d1013 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: var(--shadow-premium);
}

.customer-card-visual::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.customer-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.customer-card-header h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
}

.customer-card-points {
    margin-top: 30px;
}

.customer-card-points span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.customer-card-points h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-gold);
    font-family: var(--font-heading);
    text-shadow: var(--shadow-glow);
}

.customer-card-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Barcode Graphic placeholder */
.barcode-visual {
    background: #ffffff;
    padding: 10px;
    border-radius: var(--border-radius-sm);
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.barcode-stripes {
    height: 40px;
    width: 100%;
    background: repeating-linear-gradient(
        90deg,
        #000,
        #000 2px,
        #fff 2px,
        #fff 6px,
        #000 6px,
        #000 10px
    );
}

/* --- 12. Toast System & Custom UI Alerts --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999;
}

.toast {
    background: rgba(18, 20, 24, 0.9);
    border: 1px solid var(--border-color);
    padding: 14px 20px;
    border-radius: var(--border-radius-md);
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-premium);
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 280px;
}

.toast.success {
    border-left: 4px solid var(--color-emerald);
}

.toast.success i {
    color: var(--color-emerald);
}

.toast.error {
    border-left: 4px solid var(--color-coral);
}

.toast.error i {
    color: var(--color-coral);
}

.toast.warning {
    border-left: 4px solid var(--accent-amber);
}

.toast.warning i {
    color: var(--accent-amber);
}

/* Auto-Sync Overlay Banner */
.sync-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(12, 13, 15, 0.85);
    backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    display: none;
}

.sync-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(251, 191, 36, 0.1);
    border-top: 4px solid var(--accent-gold);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
    box-shadow: var(--shadow-glow);
}

.sync-progress-bar {
    width: 300px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.sync-progress-fill {
    height: 100%;
    background: var(--accent-gold);
    width: 0%;
    transition: width 0.3s ease;
}

/* --- 13. Keyframes & Animations --- */
@keyframes viewFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulseAmber {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* --- 14. 58mm Thermal Print Layout (@media print) --- */
@media print {
    /* Set page margins to zero and hide non-print UI */
    @page {
        size: 58mm 160mm;
        margin: 0;
    }
    
    body {
        background: #ffffff !important;
        color: #000000 !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 58mm;
        font-size: 11px !important;
        line-height: 1.3 !important;
        font-family: 'Tahoma', 'Sarabun', Arial, sans-serif !important;
    }
    
    /* Hide everything on screen except print container */
    body > *:not(.print-container-active) {
        display: none !important;
    }
    
    .print-container-active {
        display: block !important;
        width: 40mm !important;
        margin: 0 auto 0 0 !important;
        padding: 3mm 3mm 3mm 1.5mm !important;
        box-sizing: border-box !important;
        background: #fff !important;
        color: #000 !important;
    }
    
    /* Custom styled thermal receipt layout */
    .receipt-print {
        width: 100% !important;
        font-size: 10px !important;
    }
    
    .receipt-print-header {
        text-align: center;
        margin-bottom: 4mm;
        border-bottom: 1px dashed #000;
        padding-bottom: 2mm;
        margin-right: -3mm;
    }
    
    .receipt-print-title {
        font-size: 15px !important;
        font-weight: 700 !important;
        margin-bottom: 1mm;
        line-height: 1.15 !important;
    }
    
    .receipt-print-divider {
        border-bottom: 1px dashed #000;
        margin: 2mm -3mm 2mm 0;
    }
    
    .receipt-print-row {
        display: flex;
        justify-content: space-between;
        gap: 2mm;
        margin-bottom: 1mm;
    }

    .receipt-print-row span:first-child {
        flex-shrink: 0;
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .receipt-print-row span:last-child {
        flex-shrink: 0;
        text-align: right;
        padding-right: 0;
    }

    .receipt-transfer-row span:first-child {
        flex: 1 1 auto;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .receipt-transfer-row span:last-child {
        flex: 0 0 auto;
    }
    
    .receipt-print-item {
        font-weight: 500;
        margin-bottom: 0.5mm;
    }
    
    .receipt-print-subitem {
        font-size: 9.5px !important;
        color: #333 !important;
        font-weight: 500 !important;
        padding-left: 2mm;
    }
    
    .receipt-print-totals {
        border-top: 1px dashed #000;
        padding-top: 2mm;
        margin-top: 2mm;
    }
    
    .receipt-print-total-bold {
        font-size: 12px !important;
        font-weight: 700 !important;
        display: flex;
        justify-content: space-between;
    }

    .receipt-print-total-bold span:last-child {
        padding-right: 0;
    }
    
    .receipt-print-footer {
        text-align: center;
        margin: 4mm -3mm 0 0;
        font-size: 9px !important;
    }
    
    /* QR Code ท้ายใบเสร็จ */
    #receipt-qr-container {
        display: flex !important;
        justify-content: center !important;
        padding: 2mm 0 !important;
    }
    
    #receipt-qr-container img {
        width: 25mm !important;
        height: 25mm !important;
        image-rendering: pixelated;
    }
    
    #receipt-qr-container canvas {
        display: none !important;
    }
}

/* --- 18. Member Management Extended Styles --- */
/* Member action buttons in table */
.premium-table td .btn {
    min-width: unset;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.premium-table td .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.premium-table td .btn:hover i.fa-edit {
    color: var(--accent-gold);
}

.premium-table td .btn:hover i.fa-history {
    color: #60a5fa;
}

.premium-table td .btn:hover i.fa-coins {
    color: var(--accent-gold);
}

.premium-table td .btn:hover i.fa-trash-alt {
    color: var(--color-coral);
}

/* Points type toggle buttons */
.pts-type-btn {
    transition: var(--transition-fast) !important;
}

.pts-type-btn.active {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Member tier pills with color variation */
.member-tier-pill {
    transition: var(--transition-fast);
}

tr:hover .member-tier-pill {
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.3);
}

/* Member stats bar animation */
#member-stats-bar > div {
    transition: var(--transition-fast);
}

#member-stats-bar > div:hover {
    transform: translateY(-2px);
    border-color: rgba(251, 191, 36, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Member history modal table stripe effect */
#member-history-tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

#member-history-tbody tr:hover {
    background: rgba(251, 191, 36, 0.04);
}

/* --- 19. Customer Portal Premium Styles --- */

/* Portal Login Screen */
.portal-login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-height) - 48px);
}

.portal-login-card {
    max-width: 440px;
    width: 100%;
    padding: 40px 32px;
    text-align: center;
}

.portal-login-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(251,191,36,0.15), rgba(245,158,11,0.08));
    border: 2px solid rgba(251,191,36,0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: var(--accent-gold);
    box-shadow: var(--shadow-glow);
    animation: pulseGlow 3s infinite;
}

.portal-login-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-amber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.portal-login-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Portal Dashboard Layout */
.portal-dashboard {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
    animation: viewFadeIn 0.3s ease;
}

.portal-left-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.portal-right-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.portal-section {
    padding: 20px;
}

/* Portal Member Card */
.portal-member-card {
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(251,191,36,0.2);
}

.portal-card-top {
    padding: 20px 20px 14px;
    background: linear-gradient(135deg, rgba(251,191,36,0.08) 0%, rgba(16,185,129,0.05) 100%);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.portal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.portal-card-header h2 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
}

.portal-card-benefits {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Tier Badges */
.portal-tier-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.portal-tier-badge.tier-silver {
    background: rgba(156,163,175,0.15);
    border: 1px solid rgba(156,163,175,0.3);
    color: #9ca3af;
}

.portal-tier-badge.tier-gold {
    background: rgba(251,191,36,0.15);
    border: 1px solid rgba(251,191,36,0.3);
    color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(251,191,36,0.1);
}

.portal-tier-badge.tier-platinum {
    background: rgba(16,185,129,0.15);
    border: 1px solid rgba(16,185,129,0.3);
    color: var(--color-emerald);
    box-shadow: 0 0 10px rgba(16,185,129,0.1);
}

/* Points Display */
.portal-points-display {
    padding: 20px;
    text-align: center;
    background: rgba(0,0,0,0.15);
}

.portal-points-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.portal-points-value {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-amber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(251,191,36,0.3));
}

.portal-points-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Card Info */
.portal-card-info {
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.portal-card-info i {
    width: 18px;
    text-align: center;
    color: var(--accent-gold);
    margin-right: 6px;
}

/* QR Section */
.portal-qr-section {
    padding: 20px;
    text-align: center;
}

/* Reward Items in Portal */
.portal-reward-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
    background: rgba(255,255,255,0.01);
}

.portal-reward-item.redeemable {
    border-color: rgba(16,185,129,0.2);
    background: rgba(16,185,129,0.03);
}

.portal-reward-item.redeemable:hover {
    border-color: rgba(16,185,129,0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16,185,129,0.1);
}

.portal-reward-item.locked {
    opacity: 0.6;
}

.portal-reward-info {
    flex: 1;
    margin-right: 12px;
}

.portal-reward-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.portal-reward-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.portal-reward-meta {
    display: flex;
    gap: 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.portal-reward-points {
    color: var(--accent-gold);
    font-weight: 600;
}

.portal-reward-points i {
    margin-right: 3px;
}

/* Purchase History in Portal */
.portal-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.portal-history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.portal-history-row:hover {
    border-color: rgba(251,191,36,0.15);
    background: rgba(251,191,36,0.03);
}

/* Responsive: Portal on mobile */
@media (max-width: 768px) {
    .portal-dashboard {
        grid-template-columns: 1fr;
    }
    
    .portal-points-value {
        font-size: 2.2rem;
    }
}

/* --- PORTAL PIN & FORGOT PIN CSS --- */
.portal-pin-field-wrapper {
    position: relative;
    max-width: 280px;
    margin: 20px auto 10px;
}

.portal-pin-input-field {
    width: 100%;
    padding: 12px 45px 12px 20px;
    font-size: 1.8rem;
    text-align: center;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    letter-spacing: 10px;
    transition: all 0.2s ease;
}

.portal-pin-input-field:focus {
    border-color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.1);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
    outline: none;
}

.portal-forgot-link {
    display: inline-block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 12px 0 15px;
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
}

.portal-forgot-link:hover {
    color: var(--accent-gold);
    text-decoration: underline;
}

.portal-forgot-card {
    text-align: left;
    margin-top: 15px;
}

/* Shake Animation when passcode fails */
.shake-anim {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* --- PREMIUM GOLD TICKETS & COUPONS STYLING --- */
.portal-vouchers-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.voucher-ticket {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.08) 0%, rgba(245, 158, 11, 0.04) 100%);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: var(--transition-fast);
}

.voucher-ticket.active {
    border-color: rgba(251, 191, 36, 0.3);
}

.voucher-ticket.active:hover {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.12);
}

.voucher-ticket.used {
    opacity: 0.5;
    border-color: var(--border-color);
    background: rgba(255, 255, 255, 0.01);
}

.voucher-details {
    display: flex;
    align-items: center;
    gap: 12px;
}

.voucher-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent-gold);
    font-size: 1rem;
}

.voucher-ticket.used .voucher-icon-box {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-muted);
}

.voucher-text h5 {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-main);
    margin: 0;
}

.voucher-ticket.used .voucher-text h5 {
    text-decoration: line-through;
    color: var(--text-muted);
}

.voucher-text p {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 2px 0 0 0;
}

.voucher-value-tag {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent-gold);
    text-shadow: var(--shadow-glow);
}

.voucher-ticket.used .voucher-value-tag {
    color: var(--text-muted);
    text-shadow: none;
}

/* Ticket tear effect (subtle circles on edges) */
.voucher-ticket::before, .voucher-ticket::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: #0c0d0f; /* Match outer page dark background to make a hole */
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

.voucher-ticket::before {
    left: -5px;
    border-right: 1px solid rgba(251, 191, 36, 0.2);
}

.voucher-ticket::after {
    right: -5px;
    border-left: 1px solid rgba(251, 191, 36, 0.2);
}

.voucher-ticket.used::before {
    border-right-color: var(--border-color);
}
.voucher-ticket.used::after {
    border-left-color: var(--border-color);
}

/* MV-2: Expired voucher ticket */
.voucher-ticket.expired {
    background: linear-gradient(135deg, rgba(107,114,128,0.12), rgba(75,85,99,0.08));
    border: 1px dashed rgba(107,114,128,0.3);
    opacity: 0.55;
}
.voucher-ticket.expired .voucher-icon-box {
    background: rgba(107,114,128,0.15); color: #6b7280;
}
.voucher-ticket.expired .voucher-value-tag {
    background: rgba(107,114,128,0.2); color: #6b7280;
}

/* MV-2: Voucher history section */
.voucher-history-section {
    margin-top: 16px; padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}
.voucher-history-section h5 {
    color: var(--text-muted); font-size: 0.8rem;
    font-family: var(--font-heading); margin-bottom: 8px;
}

/* MV-5: Summary counters styling */
.voucher-counters {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 15px;
}
.voucher-counter-card {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: var(--transition-fast);
}
.voucher-counter-card.active {
    background: rgba(251, 191, 36, 0.04);
    border-color: rgba(251, 191, 36, 0.2);
}
.voucher-counter-card .counter-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.2;
}
.voucher-counter-card.active .counter-value {
    color: var(--accent-gold);
    text-shadow: var(--shadow-glow);
}
.voucher-counter-card.used .counter-value {
    color: var(--text-muted);
}
.voucher-counter-card.expired .counter-value {
    color: var(--color-coral);
}
.voucher-counter-card .counter-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Badge คืนเงินสำหรับ Used Voucher */
.voucher-refund-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-coral);
    margin-left: 6px;
    vertical-align: middle;
}
.voucher-ticket.used.bill-refunded {
    border-color: rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.02);
}




/* ======================================================
   EXP Bar Game-Style Animations
   ====================================================== */
@keyframes shimmer-bar {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

@keyframes tier-glow-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.05); }
}

@keyframes exp-bar-fill {
    from { width: 0%; }
    to   { width: var(--exp-progress); }
}
/* ======================================================
   STEP 3: Database Maintenance & Backup Styles
   ====================================================== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#admin-backup-panel select.form-control:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.3);
}

#admin-backup-panel select.form-control option {
    background: #171b21;
    color: #fff;
}

/* ======================================================
   STEP 5: Real-time Multi-tab Sync Styles
   ====================================================== */
.toast.info {
    border-left: 4px solid #06b6d4 !important;
}
.toast.info i {
    color: #06b6d4 !important;
    text-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}


/* ======================================================
   T-016, T-017, T-018 Dashboard Analytics Upgrade
   ====================================================== */

/* Badge indicators for rankings */
.rank-badge {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.85rem;
}
.rank-gold {
    background: rgba(251, 191, 36, 0.2);
    color: var(--accent-gold);
    border: 1px solid rgba(251, 191, 36, 0.4);
}
.rank-silver {
    background: rgba(156, 163, 175, 0.2);
    color: #cbd5e1;
    border: 1px solid rgba(156, 163, 175, 0.4);
}
.rank-bronze {
    background: rgba(180, 83, 9, 0.2);
    color: #f97316;
    border: 1px solid rgba(180, 83, 9, 0.4);
}
.rank-normal {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

/* Stock warning colors */
.stock-warning-orange {
    color: #f59e0b !important;
    font-weight: 600;
}
.stock-warning-red {
    color: #ef4444 !important;
    font-weight: 600;
}

/* Stock warning badges */
.stock-status-pill {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-pill-orange {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}
.status-pill-red {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}
.status-pill-green {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

/* Toggle buttons styling */
.btn-filter-stock {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}
.btn-filter-stock:hover {
    color: var(--text-main);
}
.btn-filter-stock.active {
    background: var(--accent-gold) !important;
    color: #000 !important;
    font-weight: 600;
}

/* SVG Chart styling */
.svg-chart-axis {
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 1;
}
.svg-chart-grid {
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 1;
    stroke-dasharray: 4 4;
}
.svg-chart-axis-text {
    fill: var(--text-muted);
    font-size: 10px;
    font-family: var(--font-sans);
}
.svg-chart-bar-sales {
    fill: #10b981;
    opacity: 0.85;
    transition: opacity 0.2s;
}
.svg-chart-bar-sales:hover {
    opacity: 1;
}
.svg-chart-bar-cost {
    fill: #f97316;
    opacity: 0.85;
    transition: opacity 0.2s;
}
.svg-chart-bar-cost:hover {
    opacity: 1;
}
.svg-chart-line-profit {
    stroke: #fbbf24;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.svg-chart-dot-profit {
    fill: #fbbf24;
    stroke: #0c0d0f;
    stroke-width: 2;
    cursor: pointer;
    transition: r 0.2s;
}
.svg-chart-dot-profit:hover {
    r: 6;
}
.chart-tooltip {
    position: absolute;
    background: rgba(12, 13, 15, 0.95);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--border-radius-md);
    font-size: 0.75rem;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    color: var(--text-main);
    display: none;
}
/* ======================================================
   T-019: P&L Chart Hardening — Negative Profit & Empty State
   ====================================================== */

/* Negative profit bar (red, below baseline) */
.svg-chart-bar-profit-neg {
    fill: #ef4444;
    opacity: 0.85;
    transition: opacity 0.2s;
}
.svg-chart-bar-profit-neg:hover {
    opacity: 1;
}

/* Positive profit bar (emerald, above baseline) */
.svg-chart-bar-profit-pos {
    fill: #10b981;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.svg-chart-bar-profit-pos:hover {
    opacity: 1;
}

/* Zero baseline when chart has negative values */
.svg-chart-zero-line {
    stroke: rgba(255, 255, 255, 0.25);
    stroke-width: 1.5;
    stroke-dasharray: none;
}

/* Negative value text on Y axis */
.svg-chart-axis-text-neg {
    fill: #ef4444;
    font-size: 10px;
    font-family: var(--font-sans);
}

/* Empty state placeholder inside chart container */
.chart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 250px;
    color: var(--text-muted);
    gap: 12px;
    animation: viewFadeIn 0.4s ease;
}
.chart-empty-state i {
    font-size: 2.5rem;
    opacity: 0.25;
    color: var(--accent-gold);
}
.chart-empty-state p {
    font-size: 0.85rem;
    margin: 0;
}


/* ===== T-021: Stock Movement Log Badges ===== */
.stock-move-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.02em;
}
.stock-move-receive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.stock-move-adjust {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}
.stock-move-sale {
    background: rgba(248, 113, 113, 0.15);
    color: var(--color-coral);
    border: 1px solid rgba(248, 113, 113, 0.3);
}
.stock-move-split {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-amber);
    border: 1px solid rgba(251, 191, 36, 0.3);
}


/* ===== T-023: Hold Bill / พักบิล CSS Styling ===== */
.held-bills-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}
.held-bills-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-gold);
}
.held-badge {
    background: var(--accent-gold);
    color: #000;
    font-size: 0.72rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    display: inline-block;
}
.hold-cart-btn {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: var(--accent-gold);
    padding: 8px 12px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast);
}
.hold-cart-btn:hover {
    background: rgba(251, 191, 36, 0.2);
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.2);
}
.held-bills-dropdown {
    position: absolute;
    top: 48px;
    right: 0;
    width: 340px;
    max-height: 420px;
    background: rgba(20, 24, 33, 0.98);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: toastSlideIn 0.2s ease;
}
.held-bills-dropdown .dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--accent-gold);
}
.held-bills-dropdown .close-dropdown-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
}
.held-bills-dropdown .close-dropdown-btn:hover {
    color: var(--text-main);
}
.dropdown-list-content {
    overflow-y: auto;
    max-height: 340px;
    padding: 8px 0;
}
.held-bill-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.held-bill-item:last-child {
    border-bottom: none;
}
.held-bill-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.held-bill-label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.88rem;
    word-break: break-all;
}
.held-bill-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.held-bill-summary {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.held-bill-total {
    font-weight: 600;
    color: var(--accent-gold);
}
.held-bill-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}
.held-bill-btn-resume {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--color-emerald);
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition-fast);
}
.held-bill-btn-resume:hover {
    background: rgba(16, 185, 129, 0.3);
    border-color: var(--color-emerald);
}
.held-bill-btn-delete {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--color-coral);
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition-fast);
}
.held-bill-btn-delete:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
}
.btn-danger {
    background: #dc3545 !important;
    border: 1px solid rgba(220, 53, 69, 0.5) !important;
    color: #fff !important;
}
.btn-danger:hover {
    background: #bd2130 !important;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.4);
}
/* T-022 Refund Badge mapping placeholder */
.stock-move-refund {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

/* ================================================================= */
/* ================================================================= */
/* T-022: REFUND STYLES                                                */
/* ================================================================= */

.refund-badge {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}

.refund-status-section {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 12px;
}

.btn-refund {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: opacity 0.2s, transform 0.15s;
}
.btn-refund:hover { opacity: 0.85; transform: translateY(-1px); }
.btn-refund:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.refund-warning-text {
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid #f59e0b;
    padding: 12px;
    border-radius: 4px;
    line-height: 1.8;
    font-size: 0.9rem;
    margin-bottom: 12px;
}
/* T-024: SPLIT PAYMENT STYLES                                        */
/* ================================================================= */

.split-payment-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.25s ease;
    user-select: none;
}
.split-payment-toggle-label:hover {
    background: rgba(var(--accent-amber-rgb, 245,158,11), 0.1);
    border-color: var(--accent-amber);
}
.split-payment-toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-amber);
    cursor: pointer;
}
.split-payment-toggle-label span {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}
.split-payment-toggle-label span i {
    color: var(--accent-amber);
    margin-right: 4px;
}

#checkout-split-section {
    animation: fadeSlideDown 0.3s ease;
}

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.split-payment-form .split-row select,
.split-payment-form .split-row input {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.split-payment-form .split-row select:focus,
.split-payment-form .split-row input:focus {
    border-color: var(--accent-amber);
    box-shadow: 0 0 0 2px rgba(var(--accent-amber-rgb, 245,158,11), 0.25);
}

#split-remain-val {
    transition: color 0.2s ease;
}
#split-remain-val.balanced {
    color: var(--color-emerald) !important;
}

/* Receipt split payment breakdown */
.receipt-split-breakdown {
    margin-top: 1mm;
    padding-left: 2mm;
}
.receipt-split-row {
    display: flex;
    justify-content: space-between;
    gap: 2mm;
    font-size: 10px;
    margin-bottom: 0.5mm;
}

/* ==========================================================================
   T-025 CSV Importer premium UI styles
   ========================================================================== */
.csv-import-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.import-mode-selector {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.import-mode-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.import-mode-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.import-mode-btn.active {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #fff;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.import-mode-btn.active.mode-adjust {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.csv-import-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.csv-import-dropzone::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.08) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.csv-import-dropzone:hover {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.03);
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.1) inset;
}

.csv-import-dropzone:hover::before {
    opacity: 1;
}

.csv-import-dropzone.dragover {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.08);
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.15) inset;
}

.csv-import-dropzone i {
    font-size: 2.2rem;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.csv-import-dropzone:hover i, .csv-import-dropzone.dragover i {
    color: var(--accent-cyan);
    transform: translateY(-4px);
}

.csv-import-filename {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-top: 4px;
}

/* CSV Import Result Modal styles */
.import-result-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.summary-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.summary-card.success {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.05);
}

.summary-card.warning {
    border-color: rgba(234, 179, 8, 0.3);
    background: rgba(234, 179, 8, 0.05);
}

.summary-card.error {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}

.summary-val {
    font-size: 1.4rem;
    font-weight: 700;
    font-family: var(--font-heading);
    margin-bottom: 4px;
}

.summary-card.success .summary-val { color: #4ade80; }
.summary-card.warning .summary-val { color: #facc15; }
.summary-card.error .summary-val { color: #f87171; }

.summary-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.import-error-log-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding: 12px;
}

.import-error-list {
    margin: 0;
    padding-left: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.import-error-item {
    font-size: 0.8rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.85);
}

.import-error-item.err {
    color: #f87171;
}

.import-error-item.warn {
    color: #facc15;
}

/* ============================================================
   18. Responsive / Mobile pass (CSS-only) — added by Cowork (UI-RESP)
   Desktop layout unchanged. Tablet <=768px, Phone <=480px.
   ============================================================ */

/* ---- Tablet & down: stack the core shells, free the locked heights ---- */
@media (max-width: 768px) {
    .app-container { padding: 16px; }

    /* POS: catalog on top, cart below — no fixed viewport-height lock */
    .pos-layout {
        grid-template-columns: 1fr;
        height: auto;
        gap: 16px;
    }
    .pos-cart-panel { height: auto; max-height: none; }
    .pos-catalog-panel { height: auto; }

    /* Admin: sidebar tabs become a horizontal scroll strip above content */
    .admin-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .admin-sidebar {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    .admin-tab-btn { white-space: nowrap; flex: 0 0 auto; }
    .admin-content-panel,
    .admin-sub-view { min-height: 0; min-width: 0; }
    .print-settings-card { max-width: 100%; min-width: 0; }
    .print-settings-card > div:first-of-type { grid-template-columns: 1fr !important; }
    .print-settings-card .form-group > div { flex-wrap: wrap; }

    /* Modals never wider than the screen */
    .modal-box { max-width: min(560px, 94vw); }
}

/* ---- Phone: compact header (icon-only), bigger tap targets, fluid grids ---- */
@media (max-width: 480px) {
    .app-container { padding: 12px; }

    /* Header stays one row at 70px; hide long labels, keep icons */
    .app-header { padding: 0 12px; gap: 8px; }
    .header-brand #header-store-name { display: none; }
    .header-nav { gap: 4px; }
    .nav-btn { font-size: 0; padding: 10px; min-height: 44px; }
    .nav-btn i { font-size: 1.15rem; }
    .header-controls { gap: 8px; }
    /* network badge -> dot only; net toggle -> icon only */
    #network-badge { font-size: 0; padding: 6px; }
    #network-badge .status-dot { margin: 0; }
    .net-toggle-btn { font-size: 0; padding: 10px; min-height: 44px; }
    .net-toggle-btn i { font-size: 1.05rem; }

    /* Product catalog: more columns fit small screens */
    .pos-catalog-panel .product-grid,
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }

    /* Touch targets >= 44px on the common tappables */
    .nav-btn, .cat-tab, .admin-tab-btn, .btn, button.primary-btn,
    .modal-footer button, .net-toggle-btn { min-height: 44px; }

    /* Modals edge-to-edge-ish + comfortable body padding */
    .modal-box { max-width: 94vw; }
    .modal-body { padding: 16px; }
    .modal-footer { padding: 12px 16px; }
    .modal-footer button { flex: 1; }

    /* Cart dropdowns / popovers shouldn't exceed viewport */
    .dropdown-panel, .popover, .voucher-dropdown { max-width: 94vw; }
}

/* LAN low-power notebook mode: opt in with ?perf=lite or ?lite=1 */
body.perf-lite *,
body.perf-lite *::before,
body.perf-lite *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

body.perf-lite .glass-panel,
body.perf-lite .product-card,
body.perf-lite .pos-cart-panel,
body.perf-lite .modal-box,
body.perf-lite .toast,
body.perf-lite .btn,
body.perf-lite .nav-btn,
body.perf-lite .cat-tab {
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.perf-lite .toast {
    animation: none !important;
    transition: none !important;
}

body.perf-lite .product-card:hover,
body.perf-lite .btn:hover,
body.perf-lite .nav-btn:hover,
body.perf-lite .cat-tab:hover {
    transform: none !important;
}


/* --- 15. Mobile POS Mode & Sunmi V2s Optimization --- */
.btn-mobile-toggle {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: var(--accent-gold);
    padding: 8px 14px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}
.btn-mobile-toggle:hover {
    background: rgba(251, 191, 36, 0.2);
    box-shadow: var(--shadow-glow);
}

/* Bottom Navigation Bar style */
.mobile-nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #111827; /* Solid dark color to save Sunmi V2s CPU */
    border-top: 1px solid var(--border-color);
    display: none;
    grid-template-columns: 1fr 1fr;
    z-index: 100;
}
.mobile-nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition-fast);
}
.mobile-nav-item i {
    font-size: 1.25rem;
}
.mobile-nav-item.active {
    color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.04);
}
.mobile-badge {
    background: var(--color-coral);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: bold;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
    display: inline-block;
}

/* Logic when mobile-mode-active is on the body */
body.mobile-mode-active .mobile-nav-bar {
    display: grid !important;
}

body.mobile-mode-active.mobile-admin-available .mobile-nav-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.mobile-mode-active .app-container {
    padding: 12px 12px 76px 12px !important;
    height: auto !important;
    min-height: calc(100vh - var(--header-height));
}

body.mobile-mode-active .pos-layout {
    grid-template-columns: 1fr !important;
    height: auto !important;
    gap: 16px;
}

/* Control show/hide panel in mobile POS tabs */
body.mobile-mode-active.mobile-tab-catalog .pos-catalog-panel {
    display: flex !important;
}
body.mobile-mode-active.mobile-tab-catalog .pos-cart-panel {
    display: none !important;
}

body.mobile-mode-active.mobile-tab-cart .pos-catalog-panel {
    display: none !important;
}
body.mobile-mode-active.mobile-tab-cart .pos-cart-panel {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Adjust Product Grid for Mobile screens */
body.mobile-mode-active .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
}

body.mobile-mode-active .product-card {
    padding: 10px !important;
    min-height: 110px !important;
    box-shadow: none !important; /* Disable shadow for Sunmi CPU */
    background: rgba(255, 255, 255, 0.03) !important;
}
body.mobile-mode-active .prod-name {
    font-size: 0.82rem !important;
    line-height: 1.2 !important;
}
body.mobile-mode-active .prod-price {
    font-size: 0.95rem !important;
}

/* Target touch optimization for Sunmi V2s screen (360-480px) */
@media (max-width: 480px) {
    .btn-mobile-toggle span {
        display: none;
    }
    .btn-mobile-toggle {
        padding: 8px 10px;
    }
}

body.mobile-mode-active .checkout-btn {
    height: 48px !important;
    font-size: 1.05rem !important;
}

body.mobile-mode-active .cart-item-qty .qty-btn {
    width: 32px !important;
    height: 32px !important;
}

body.mobile-mode-active .cart-item {
    padding: 10px 4px !important;
}


/* --- 16. Mobile Mode GPU & Rendering Performance Tuning --- */
/* ปิดการเบลอหลังคาดและเงาทั้งหมดเพื่อรักษาความลื่นไหลสูงสุดของ GPU/CPU บน Sunmi V2s */
body.mobile-mode-active .modal-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(12, 13, 15, 0.92) !important; /* ใช้สีทึบแทนเพื่อไม่ให้ GPU คำนวณเบลอ */
    transition: none !important;
    animation: none !important;
}

body.mobile-mode-active .modal-box {
    transform: none !important;
    transition: none !important;
    animation: none !important;
    box-shadow: none !important;
    background: #111827 !important; /* พื้นหลังทึบพิเศษสี Dark */
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.mobile-mode-active .glass-panel {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #1f2937 !important; /* การ์ดสีทึบแบบไม่มีเบลอ */
    box-shadow: none !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* ลบเงาสะท้อนเรืองแสงและปุ่มลดแรงโหลด CPU */
body.mobile-mode-active .prod-name, 
body.mobile-mode-active .prod-price,
body.mobile-mode-active .btn {
    text-shadow: none !important;
    box-shadow: none !important;
}

body.mobile-mode-active * {
    transition-duration: 0s !important; /* ปิด transitions ทั้งหมดในโหมดพกพา */
    animation-duration: 0s !important; /* ปิด animations ทั้งหมดในโหมดพกพา */
}

/* PERF-AUTO 2026-07-06: lite mode - flat background (no fixed-attachment repaint, no gradient rasterize) */
body.perf-lite {
    background-image: none !important;
    background-attachment: scroll !important;
}

/* D2-SYNC-HEALTH: Sync Health Widget (admin dashboard) — compact, no blur (perf-lite friendly) */
.sync-health-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-left: 3px solid var(--accent-gold, #f59e0b);
    border-radius: 8px;
    font-size: 0.82rem;
}
.sync-health-bar .sh-status { color: var(--text-main, #fff); }
.sync-health-bar .sh-metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sync-health-bar .sh-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted, #9ca3af);
    white-space: nowrap;
}
.sync-health-bar .sh-chip.sh-warn { color: var(--accent-gold, #f59e0b); border-color: rgba(245, 158, 11, 0.4); }
.sync-health-bar .sh-chip.sh-bad { color: #ef4444; border-color: rgba(239, 68, 68, 0.4); }
.sync-health-bar .sh-sync-btn { font-size: 0.75rem; padding: 4px 12px; }
.sync-health-bar .sh-loading { color: var(--text-muted, #9ca3af); }

/* D1-D3-DISCOUNT-ANALYTICS: Dashboard ส่วนลด & แต้ม — compact, no blur (perf-lite friendly) */
.da-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.da-controls { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-muted, #9ca3af); }
.da-month-select { width: auto; font-size: 0.82rem; padding: 5px 10px; height: auto; }
.da-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 12px; }
.da-kpi { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color, rgba(255,255,255,0.1)); border-left: 3px solid var(--accent-gold, #f59e0b); border-radius: 8px; padding: 10px 14px; }
.da-kpi-label { font-size: 0.72rem; color: var(--text-muted, #9ca3af); margin-bottom: 4px; }
.da-kpi-value { font-size: 1.25rem; font-weight: 700; color: var(--accent-gold, #f59e0b); }
.da-kpi-sub { font-size: 0.72rem; color: var(--text-muted, #9ca3af); margin-top: 3px; }
.da-breakdown { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; font-size: 0.78rem; }
.da-chip { padding: 3px 12px; border-radius: 999px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); }
.da-seg-promo-c { color: #f59e0b; } .da-seg-tier-c { color: #38bdf8; } .da-seg-points-c { color: #a78bfa; } .da-seg-voucher-c { color: #34d399; }
.da-two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.da-card { background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border-color, rgba(255,255,255,0.08)); border-radius: 8px; padding: 12px 14px; font-size: 0.8rem; }
.da-card h5 { margin: 0 0 10px 0; font-size: 0.85rem; color: var(--text-main, #fff); }
.da-trend-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.da-trend-row.da-trend-active .da-trend-label { color: var(--accent-gold, #f59e0b); font-weight: 700; }
.da-trend-label { width: 52px; font-size: 0.72rem; color: var(--text-muted, #9ca3af); flex-shrink: 0; }
.da-trend-bar { flex: 1; display: flex; height: 14px; background: rgba(255,255,255,0.04); border-radius: 4px; overflow: hidden; }
.da-seg { display: inline-block; height: 100%; }
.da-seg-promo { background: #f59e0b; } .da-seg-tier { background: #38bdf8; } .da-seg-points { background: #a78bfa; } .da-seg-voucher { background: #34d399; }
.da-trend-val { width: 84px; text-align: right; font-size: 0.72rem; color: var(--text-muted, #9ca3af); flex-shrink: 0; }
.da-funnel div { margin-bottom: 5px; }
.da-note { font-size: 0.68rem; color: var(--text-muted, #9ca3af); opacity: 0.8; }
.da-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.da-table th, .da-table td { padding: 5px 8px; border-bottom: 1px solid rgba(255,255,255,0.06); text-align: left; }
.da-table th { color: var(--text-muted, #9ca3af); font-weight: 600; }
.da-empty { color: var(--text-muted, #9ca3af); text-align: center; padding: 10px; }

/* F6-HEATMAP */
.hm-grid { overflow-x: auto; font-size: 0.7rem; }
.hm-row { display: flex; gap: 3px; margin-bottom: 3px; align-items: center; }
.hm-day { width: 26px; color: var(--text-muted, #9ca3af); flex-shrink: 0; text-align: right; padding-right: 4px; }
.hm-hour { width: 30px; text-align: center; color: var(--text-muted, #9ca3af); flex-shrink: 0; }
.hm-cell { width: 30px; height: 22px; border-radius: 4px; flex-shrink: 0; border: 1px solid rgba(255,255,255,0.04); }

/* F1-LASTBUY */
.mqh-wrap { padding: 6px 10px; }
.mqh-label { font-size: 0.7rem; color: var(--text-muted, #9ca3af); margin-bottom: 4px; }
.mqh-chip { font-size: 0.72rem; padding: 3px 10px; margin: 2px; border-radius: 999px; background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.35); color: var(--accent-gold, #f59e0b); cursor: pointer; }
.mqh-chip.mqh-out { opacity: 0.35; cursor: not-allowed; }
/* UI-RESP FIX (Codex 2026-07-11): header ล้น viewport ช่วง 481-768px และ 390px */
@media (max-width: 768px) {
    .app-header { flex-wrap: wrap; height: auto; min-height: 0; padding: 8px 12px; row-gap: 6px; }
    .app-header .header-brand { flex-shrink: 1; min-width: 0; }
    .app-header .header-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34vw; display: inline-block; vertical-align: bottom; }
    .app-header .header-nav { order: 3; flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 4px; }
    .app-header .nav-btn { font-size: 0.72rem; padding: 6px 10px; flex: 1 1 auto; white-space: nowrap; }
    .app-header .header-controls { margin-left: auto; flex-wrap: wrap; gap: 6px; justify-content: flex-end; min-width: 0; max-width: 58vw; }
}
@media (max-width: 480px) {
    .app-header { padding: 6px 8px; }
    .app-header .header-brand span { max-width: 42vw; font-size: 0.8rem; }
    .app-header .header-controls { flex: 1 1 100%; order: 4; max-width: 100%; justify-content: flex-start; }
    .app-header .nav-btn { font-size: 0.68rem; padding: 5px 8px; }
}

/* UI-RESP FIX v2 (Codex 2026-07-11): header ที่ wrap สูงขึ้นต้องไม่ทับเนื้อหา — เปลี่ยนเป็น sticky ให้กินพื้นที่ใน flow */
@media (max-width: 768px) {
    .app-header { position: sticky; }
    .app-container { margin-top: 0; min-height: calc(100vh - var(--header-height)); }
}


/* --- RBAC CAPABILITY & ADMIN LOGIN UI STYLING (RBAC-U1) --- */

.admin-users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.admin-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.admin-user-row:hover {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.3);
    transform: translateY(-1px);
}

.admin-user-row:active {
    transform: translateY(0);
}

.admin-user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.admin-user-name {
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--text-main);
}

.admin-user-role {
    font-size: 0.75rem;
    color: var(--accent-gold);
    margin-top: 2px;
}

.admin-user-icon {
    font-size: 1.1rem;
    color: var(--accent-gold);
    opacity: 0.8;
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 16px 0;
}

.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    transition: background-color 0.15s, border-color 0.15s;
}

.pin-dot.filled {
    background-color: var(--accent-gold);
    border-color: var(--accent-gold);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 280px;
    margin: 0 auto;
}

.pin-key {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 1.35rem;
    font-weight: 600;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.pin-key:hover {
    background: rgba(251, 191, 36, 0.1);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.pin-key:active {
    background: rgba(251, 191, 36, 0.2);
    transform: scale(0.95);
}

.pin-key.pin-fn {
    font-size: 0.95rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.02);
}

.pin-key.pin-fn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

@media (prefers-reduced-motion: reduce) {
    .shake-anim {
        animation: none !important;
        border-color: #ef4444 !important;
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.5) !important;
    }
}
/* UI-SUNMI-COMPACT 2026-07-16 */
@media (max-width: 480px) {
    body.mobile-mode-active .app-header {
        position: sticky;
        top: 0;
        height: 54px;
        min-height: 54px;
        padding: 6px 8px;
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        overflow: hidden;
    }

    body.mobile-mode-active .app-header .header-brand,
    body.mobile-mode-active .app-header .header-nav,
    body.mobile-mode-active #net-toggle-btn,
    body.mobile-mode-active #mobile-mode-toggle-btn {
        display: none !important;
    }

    body.mobile-mode-active .app-header .header-controls {
        order: initial;
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
        min-width: 0;
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 6px;
        overflow: hidden;
    }

    body.mobile-mode-active #network-badge {
        flex: 0 0 32px;
        width: 32px;
        height: 40px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
    }

    body.mobile-mode-active #admin-login-header-btn {
        flex: 0 0 42px;
        width: 42px;
        height: 40px;
        min-height: 40px;
        padding: 0 !important;
        justify-content: center;
    }

    body.mobile-mode-active #rbac-session-badge {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        height: 40px;
        padding: 0 6px !important;
        justify-content: flex-start;
        gap: 5px !important;
        overflow: hidden;
    }

    body.mobile-mode-active #rbac-session-badge.role-admin {
        color: #fbbf24 !important;
        background: rgba(245, 158, 11, 0.14) !important;
        border-color: rgba(245, 158, 11, 0.55) !important;
    }

    body.mobile-mode-active #rbac-session-badge.role-owner {
        color: #34d399 !important;
        background: rgba(16, 185, 129, 0.14) !important;
        border-color: rgba(16, 185, 129, 0.55) !important;
    }

    body.mobile-mode-active #rbac-session-info {
        display: block;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.68rem;
    }

    body.mobile-mode-active #admin-logout-btn {
        min-width: 26px;
        min-height: 32px;
        margin-left: 0 !important;
        padding: 4px !important;
    }

    body.mobile-mode-active #shift-badge {
        flex: 1 1 auto;
        min-width: 0;
        height: 40px;
        padding: 0 8px;
        font-size: 0.72rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.mobile-mode-active.rbac-authenticated #shift-badge {
        flex: 0 0 42px;
        width: 42px;
        padding: 0;
        justify-content: center;
        font-size: 0;
    }

    body.mobile-mode-active.rbac-authenticated #shift-badge i {
        font-size: 0.95rem;
    }

    body.mobile-mode-active .app-container {
        padding: 8px 8px 64px !important;
        min-height: calc(100vh - 54px);
        min-height: calc(100dvh - 54px);
    }

    body.mobile-mode-active .pos-layout,
    body.mobile-mode-active .pos-catalog-panel {
        gap: 8px;
    }

    body.mobile-mode-active .catalog-controls {
        gap: 8px;
    }

    body.mobile-mode-active .scanner-search-wrapper {
        flex: 1 1 0;
        min-width: 0;
    }

    body.mobile-mode-active .scanner-search-wrapper .form-input {
        height: 44px;
        padding-left: 38px;
        font-size: 0.84rem;
    }

    body.mobile-mode-active .scan-focus-btn {
        flex: 0 0 48px;
        width: 48px;
        min-width: 48px;
        padding: 0;
    }

    body.mobile-mode-active .scan-focus-btn span {
        display: none;
    }

    body.mobile-mode-active .category-tabs {
        gap: 6px;
        padding-bottom: 2px;
    }

    body.mobile-mode-active .cat-tab {
        min-height: 40px;
        padding: 7px 12px;
        font-size: 0.78rem;
    }

    body.mobile-mode-active .products-grid {
        gap: 8px !important;
    }

    body.mobile-mode-active .product-card {
        min-height: 170px !important;
        padding: 0 !important;
        border-radius: 6px;
    }

    body.mobile-mode-active .prod-img-container {
        height: 96px;
    }

    body.mobile-mode-active .prod-img-container .product-fallback-icon {
        font-size: 2.1rem !important;
    }

    body.mobile-mode-active .prod-details {
        min-height: 74px;
        padding: 8px;
    }

    body.mobile-mode-active .prod-name {
        height: 2.4em;
        margin-bottom: 3px;
        font-size: 0.8rem !important;
        line-height: 1.2 !important;
    }

    body.mobile-mode-active .prod-price {
        font-size: 0.92rem !important;
    }

    body.mobile-mode-active .prod-stock-lbl {
        font-size: 0.68rem;
    }

    body.mobile-mode-active .mobile-nav-bar {
        height: 56px;
    }

    body.mobile-mode-active .mobile-nav-item {
        min-height: 56px;
        font-size: 0.74rem;
    }

    body.mobile-mode-active .mobile-nav-item i {
        font-size: 1.1rem;
    }

    body.mobile-mode-active .pos-cart-panel {
        min-height: calc(100vh - 126px);
        min-height: calc(100dvh - 126px);
        border-radius: 6px;
    }

    body.mobile-mode-active .cart-header {
        padding: 10px;
    }

    body.mobile-mode-active .cart-header h3 {
        font-size: 0.92rem;
    }
}

/* SUCCESS STATE FOR PRINT MODES (SET-S1) */
.print-success-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 20px;
    gap: 16px;
}
.print-success-state .success-icon {
    font-size: 3.5rem;
    color: var(--color-emerald, #10b981);
}
.print-success-state .success-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--text-main, #fff);
    margin: 0;
}
.print-success-state .success-meta {
    font-size: 0.9rem;
    color: var(--text-muted, #9ca3af);
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.print-success-state .btn-print-big {
    background: linear-gradient(135deg, var(--accent-amber, #f59e0b), var(--accent-gold, #d97706));
    color: #000;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-glow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.print-success-state .btn-print-big:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}
.print-success-state .btn-print-big:active {
    transform: translateY(0);
}

/* --- SETTINGS HUB (SET-S5) --- */
.settings-hub-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.settings-hub-header h2 { margin: 0 0 6px; color: var(--accent-gold); }
.settings-hub-header p { margin: 0; color: var(--text-muted); line-height: 1.5; }
.settings-hub-role-badge {
    padding: 6px 12px;
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 999px;
    color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.08);
    font-size: 0.78rem;
    font-weight: 700;
}

.settings-hub-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.settings-hub-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: linear-gradient(145deg, rgba(255,255,255,0.035), rgba(255,255,255,0.012));
    display: flex;
    flex-direction: column;
    gap: 13px;
}
.settings-hub-card[hidden] { display: none !important; }
.settings-hub-card-live { border-color: rgba(16, 185, 129, 0.3); }
.settings-hub-card-placeholder { border-style: dashed; }
.settings-hub-card p { margin: 0; color: var(--text-muted); line-height: 1.5; font-size: 0.86rem; }

.settings-card-heading { display: flex; align-items: center; gap: 12px; }
.settings-card-heading > i {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(251, 191, 36, 0.1);
    color: var(--accent-gold);
}
.settings-card-heading h3 { margin: 0 0 2px; font-size: 1rem; color: var(--text-main); }
.settings-card-heading span { color: var(--color-emerald); font-size: 0.72rem; }
.settings-hub-card-placeholder .settings-card-heading span { color: var(--text-muted); }

.settings-choice-group { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 0.84rem; }
.settings-choice-group strong { flex-basis: 100%; color: var(--text-main); }
.settings-choice-group label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.settings-number-field { display: flex; flex-direction: column; gap: 7px; color: var(--text-main); }
.settings-number-field input { max-width: 180px; }
.settings-number-field small { color: var(--text-muted); }
.settings-card-action { margin-top: auto; align-self: flex-end; }
.legacy-settings-anchor { display: block; position: relative; top: -12px; }

@media (max-width: 900px) {
    .settings-hub-grid { grid-template-columns: 1fr; }
    .settings-hub-header { flex-direction: column; }
    .settings-card-action { width: 100%; justify-content: center; }
}

/* SUNMI SETTINGS READABILITY 2026-07-18: mobile-mode only; desktop remains unchanged. */
@media (max-width: 480px) {
    body.mobile-mode-active #admin-view .admin-layout {
        gap: 10px;
    }

    body.mobile-mode-active #admin-view .admin-sidebar {
        padding: 6px !important;
        border-radius: 8px;
        scrollbar-width: none;
    }

    body.mobile-mode-active #admin-view .admin-sidebar::-webkit-scrollbar {
        display: none;
    }

    body.mobile-mode-active #admin-view .admin-sidebar > h3 {
        display: none;
    }

    body.mobile-mode-active #admin-view .admin-tab-btn {
        min-height: 44px;
        padding: 9px 12px;
        font-size: 0.86rem;
        gap: 8px;
    }

    body.mobile-mode-active #admin-view .dashboard-sub-nav-bar {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        margin-bottom: 12px !important;
        padding-bottom: 8px !important;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    body.mobile-mode-active #admin-view .dashboard-sub-nav-bar::-webkit-scrollbar {
        display: none;
    }

    body.mobile-mode-active #admin-view .dash-sub-tab-btn {
        flex: 0 0 auto;
        min-height: 44px;
        font-size: 0.86rem !important;
        padding: 9px 12px !important;
    }

    body.mobile-mode-active #admin-view #dash-branch-switcher-container {
        flex: 0 0 auto;
        margin-left: 0 !important;
    }

    body.mobile-mode-active #admin-view .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 14px;
    }

    body.mobile-mode-active #admin-view .dashboard-charts-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    body.mobile-mode-active #admin-view .stat-card {
        padding: 14px;
    }

    body.mobile-mode-active #admin-view .stat-header {
        font-size: 0.9rem;
        line-height: 1.45;
    }

    body.mobile-mode-active #admin-view .stat-value {
        margin-top: 6px;
        font-size: 1.45rem;
    }

    body.mobile-mode-active #admin-view .settings-hub-header {
        gap: 8px;
        margin-bottom: 12px;
    }

    body.mobile-mode-active #admin-view .settings-hub-header h2 {
        font-size: 1.25rem;
        line-height: 1.35;
    }

    body.mobile-mode-active #admin-view .settings-hub-card {
        padding: 14px;
        gap: 11px;
    }

    body.mobile-mode-active #admin-view .settings-hub-card p,
    body.mobile-mode-active #admin-view .settings-choice-group,
    body.mobile-mode-active #admin-view .settings-number-field {
        font-size: 0.92rem;
        line-height: 1.55;
    }

    body.mobile-mode-active #admin-view .legacy-settings-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    body.mobile-mode-active #admin-view .legacy-settings-grid .form-input,
    body.mobile-mode-active #admin-view .legacy-settings-grid select,
    body.mobile-mode-active #admin-view .legacy-settings-grid input {
        min-height: 46px;
        font-size: 1rem !important;
    }

    body.mobile-mode-active #admin-view .legacy-settings-grid label {
        font-size: 0.92rem !important;
        line-height: 1.45;
    }

    body.mobile-mode-active #admin-view .legacy-settings-grid + div > .btn,
    body.mobile-mode-active #admin-view .legacy-settings-grid + div > button {
        width: 100%;
        justify-content: center;
    }

    body.mobile-mode-active #loyalty-settings-modal {
        align-items: stretch;
        padding: 0;
    }

    body.mobile-mode-active #loyalty-settings-modal .loyalty-settings-box {
        width: 100vw;
        max-width: 100vw !important;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        overflow-y: auto;
        border: 0 !important;
        border-radius: 0;
    }

    body.mobile-mode-active #loyalty-settings-modal .modal-header {
        position: sticky;
        top: 0;
        z-index: 2;
        padding: 12px 14px;
        background: #111827;
    }

    body.mobile-mode-active #loyalty-settings-modal .modal-header h3 {
        margin: 0;
        font-size: 1.05rem;
        line-height: 1.35;
    }

    body.mobile-mode-active #loyalty-settings-modal .close-modal {
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
    }

    body.mobile-mode-active #loyalty-settings-modal .loyalty-settings-body {
        flex: 0 0 auto;
        max-height: none !important;
        overflow: visible !important;
        padding: 14px !important;
        font-size: 0.95rem !important;
    }

    body.mobile-mode-active #loyalty-settings-modal .loyalty-rate-grid,
    body.mobile-mode-active #loyalty-settings-modal .loyalty-tier-grid,
    body.mobile-mode-active #loyalty-settings-modal .loyalty-upgrade-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    body.mobile-mode-active #loyalty-settings-modal .loyalty-upgrade-section {
        padding: 0 14px 14px !important;
        font-size: 0.95rem !important;
    }

    body.mobile-mode-active #loyalty-settings-modal .form-group label,
    body.mobile-mode-active #loyalty-settings-modal small,
    body.mobile-mode-active #loyalty-settings-modal .loyalty-upgrade-section p,
    body.mobile-mode-active #loyalty-settings-modal .loyalty-upgrade-section label {
        font-size: 0.9rem !important;
        line-height: 1.5;
    }

    body.mobile-mode-active #loyalty-settings-modal .form-input {
        min-height: 46px;
        padding-left: 12px !important;
        font-size: 1rem !important;
    }

    body.mobile-mode-active #loyalty-settings-modal .modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 2;
        padding: 10px 12px;
        background: #111827;
    }

    body.mobile-mode-active #loyalty-settings-modal .modal-footer button {
        min-height: 48px;
        font-size: 0.92rem;
        justify-content: center;
    }
}
/* --- RBAC-U4 ONLINE REFUND APPROVAL --- */
.refund-approval-modal .modal-header small { color: var(--text-muted); }
.refund-online-notice {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.25);
    color: #bae6fd;
    font-size: 0.8rem;
    line-height: 1.5;
}
.refund-bill-summary { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px; color: var(--text-muted); }
.refund-bill-summary strong { color: var(--text-main); }
.refund-state-panel { min-height: 190px; }
.refund-state-panel[hidden] { display: none !important; }
.refund-state-panel label { display: block; margin: 10px 0 5px; font-weight: 600; font-size: 0.84rem; }
.refund-state-panel textarea, .refund-state-panel select, .refund-state-panel input { width: 100%; }
.refund-state-center { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; color: var(--text-muted); }
.refund-state-center > i { font-size: 2.2rem; color: var(--accent-gold); }
.refund-state-center h4, .refund-state-center p { margin: 0; }
.refund-method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.refund-method-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    padding: 14px;
    text-align: left;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(255,255,255,0.025);
    cursor: pointer;
}
.refund-method-card:hover { border-color: var(--accent-gold); background: rgba(251,191,36,0.06); }
.refund-method-card > i { color: var(--accent-gold); font-size: 1.3rem; }
.refund-method-card span { color: var(--text-muted); font-size: 0.76rem; line-height: 1.4; }
.refund-inline-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.refund-otp-input { max-width: 260px; margin: 0 auto; text-align: center; font-size: 1.6rem; letter-spacing: 0.55rem; font-weight: 800; }
.refund-line-state > i { color: #06c755; }
.refund-success-state > i { color: var(--color-emerald); }
.refund-error-state > i { color: var(--color-coral); }
.refund-full-button { width: 100%; justify-content: center; }
.refund-approval-error { margin-top: 10px; text-align: center; color: var(--color-coral); }
.required-mark { color: var(--color-coral); }

@media (max-width: 600px) {
    .refund-method-grid { grid-template-columns: 1fr; }
    .refund-inline-actions { flex-direction: column-reverse; }
    .refund-inline-actions .btn { width: 100%; justify-content: center; }
}

/* SET-S7: Station identity and rebind */
.station-identity-grid {
    display: grid;
    gap: 0.65rem;
    margin: 0.85rem 0;
}

.station-identity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border-color, #dfe5eb);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.station-identity-row span {
    color: var(--text-muted, #64748b);
}

.station-identity-row strong {
    color: var(--text-main);
    overflow-wrap: anywhere;
    text-align: right;
}

.station-rebind-reason {
    margin: 0.65rem 0;
    color: var(--danger-color, #b42318);
    font-size: 0.9rem;
}

.station-rebind-modal-body {
    display: grid;
    gap: 0.85rem;
}

@media (max-width: 640px) {
    .station-identity-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.3rem;
    }

    .station-identity-row strong {
        text-align: left;
    }
}
