* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6F4E37;
    --primary-dark: #4A3428;
    --primary-light: #8B6B55;
    --secondary: #D4A574;
    --accent: #C9A961;
    --success: #27ae60;
    --success-dark: #219a52;
    --warning: #f39c12;
    --danger: #e74c3c;
    --danger-dark: #c0392b;
    --info: #3498db;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #e9ecef;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
}

body {
    font-family: 'Kantumruy Pro', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Login Screen */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-container {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    max-width: 120px;
    height: auto;
    margin-bottom: 15px;
}

.login-logo i {
    font-size: 64px;
    color: var(--primary);
    margin-bottom: 10px;
}

.login-logo h1 {
    color: var(--primary);
    font-size: 32px;
    margin-bottom: 5px;
}

.login-logo p {
    color: var(--text-light);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
}

.form-group label i {
    margin-right: 8px;
    color: var(--primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Kantumruy Pro', sans-serif;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(111, 78, 55, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-light);
    font-size: 12px;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Kantumruy Pro', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.login-demo {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    font-size: 13px;
}

.login-demo i {
    margin-right: 5px;
}

/* App Screen */
.app-screen {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 25px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header img.sidebar-logo {
    max-width: 40px;
    height: auto;
}

.sidebar-header i {
    font-size: 32px;
}

.sidebar-header span {
    font-size: 22px;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.nav-item:active::before {
    width: 300px;
    height: 300px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: var(--accent);
    transform: translateX(0);
    animation: slideInActive 0.3s ease-out;
}

@keyframes slideInActive {
    from {
        transform: translateX(-10px);
        opacity: 0.7;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.nav-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
    transition: transform 0.3s ease;
}

.nav-item:active i {
    transform: scale(1.2);
}

.nav-item span {
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    font-size: 14px;
}

.user-info i {
    font-size: 24px;
}

.btn-logout {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 25px;
}

.page {
    animation: slideUp 0.3s ease;
}

#itemsPage {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 50px);
    min-height: 0;
    overflow: hidden;
}

#itemsPage .items-container {
    flex: 1;
    min-height: 0;
    padding: 12px 20px 20px;
}

#itemsPage .search-filter {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--card-bg);
    margin-bottom: 12px;
    padding-bottom: 0;
}

#itemsPage .items-view-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    margin-bottom: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

#itemsPage .items-view-indicator {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 8px 18px rgba(111, 78, 55, 0.18);
    will-change: transform, width, height;
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), width 0.42s cubic-bezier(0.22, 1, 0.36, 1), height 0.42s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

#itemsPage .items-view-btn {
    position: relative;
    z-index: 1;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-light);
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
}

#itemsPage .items-view-btn.active {
    color: white;
    box-shadow: none;
}

#itemsPage .items-panel.hidden {
    display: none;
}

#itemsPage .items-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#itemsPage .category-list-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    align-content: start;
    overflow-y: auto;
    padding-right: 6px;
}

#itemsPage .categories {
    margin-bottom: 12px;
    padding: 4px 2px 6px;
}

#itemsPage .category-list-card {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.9), var(--card-bg));
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    text-align: left;
    transition: all 0.25s ease;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}

#itemsPage .category-list-card[role="button"] {
    outline: none;
}

#itemsPage .category-list-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

#itemsPage .category-list-card.active {
    border-color: var(--primary);
}

#itemsPage .category-list-edit {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 12px;
    background: rgba(111, 78, 55, 0.08);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    flex: 0 0 auto;
}

#itemsPage .category-list-edit:hover {
    background: rgba(111, 78, 55, 0.16);
    transform: translateY(-1px);
}

#itemsPage .category-list-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(111, 78, 55, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

#itemsPage .category-list-icon i {
    font-size: 22px;
}

#itemsPage .category-list-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#itemsPage .category-list-body strong {
    font-size: 16px;
    color: var(--text);
}

#itemsPage .category-list-body span {
    font-size: 13px;
    color: var(--text-light);
}

#itemsPage .category-list-chevron {
    color: var(--text-light);
    flex: 0 0 auto;
}

#itemsPage .empty-state-card {
    min-height: 240px;
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: 16px;
}

#itemsPage .items-grid {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

#itemsPage .filter-select {
    display: none;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.page-header h1 {
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 26px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-action {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-action:hover {
    background: var(--primary-dark);
}

.btn-action-primary {
    padding: 10px 20px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-action-primary:hover {
    background: var(--success-dark);
}

.date-filter,
.period-select,
.filter-select,
.date-quick-filter {
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-quick-filter:hover {
    border-color: var(--primary);
}

.date-quick-filter:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(111, 78, 55, 0.1);
}

.date-range-filter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.seller-filter {
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 14px;
    background: white;
    cursor: pointer;
    min-width: 150px;
}

.export-dropdown {
    position: relative;
}

.export-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    min-width: 150px;
}

.export-menu.show {
    display: block;
}

.export-menu button {
    width: 100%;
    padding: 12px 20px;
    border: none;
    background: white;
    text-align: left;
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.export-menu button:first-child {
    border-radius: 6px 6px 0 0;
}

.export-menu button:last-child {
    border-radius: 0 0 6px 6px;
}

.export-menu button:hover {
    background: var(--bg);
}

.export-menu button i:first-child {
    width: 20px;
}

.export-menu button i.fa-file-excel {
    color: #217346;
}

.export-menu button i.fa-file-word {
    color: #2b579a;
}

.export-menu button i.fa-file-pdf {
    color: #dc2626;
}

.date-range-filter span {
    color: var(--text-light);
    font-size: 14px;
}

.custom-date-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-date-range.hidden {
    display: none;
}

.custom-date-range span {
    color: var(--text-light);
    font-size: 14px;
}

.report-period-title {
    background: var(--card-bg);
    padding: 15px 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    color: var(--text);
}

.report-period-title i {
    color: var(--primary);
    font-size: 20px;
}

/* POS Container */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    height: calc(100vh - 130px);
}

.products-section {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 20px;
}

.search-bar i {
    color: var(--text-light);
    font-size: 18px;
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 14px;
    outline: none;
}

.categories {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 2px 10px;
    position: relative;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.categories::-webkit-scrollbar {
    height: 0;
}

.category-indicator {
    position: absolute;
    top: 6px;
    left: 0;
    z-index: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 8px 18px rgba(111, 78, 55, 0.22);
    will-change: transform, width, height;
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), width 0.42s cubic-bezier(0.22, 1, 0.36, 1), height 0.42s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.category-btn {
    padding: 10px 18px;
    background: var(--bg);
    color: var(--text);
    border: 2px solid transparent;
    border-radius: 10px;
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.25s ease, color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
    flex: 0 0 auto;
    white-space: nowrap;
    scroll-snap-align: start;
    position: relative;
    z-index: 1;
}

.category-btn:hover {
    transform: translateY(-1px);
    background: rgba(111, 78, 55, 0.08);
}

.category-btn.active {
    background: transparent;
    color: white;
    box-shadow: none;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 15px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
    align-content: start;
}

.product-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.product-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.product-card img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
}

.product-card .product-icon {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 10px;
}

.product-card .product-icon i {
    font-size: 50px;
    color: var(--primary);
}

.product-card h3 {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 8px;
    font-weight: 600;
}

.product-card .price {
    color: var(--primary);
    font-weight: 700;
    font-size: 16px;
}

.product-card .sale-price {
    color: var(--danger);
    font-weight: 700;
    font-size: 14px;
    margin-top: 5px;
}

.product-card .original-price {
    color: var(--text-light);
    text-decoration: line-through;
    font-size: 12px;
}

.product-card.out-of-stock {
    opacity: 0.5;
    cursor: not-allowed;
}

.product-card .stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    background: var(--success);
    color: white;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
}

/* Cart Section */
.cart-section {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.cart-header h2 {
    color: var(--primary);
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#cartCount {
    font-size: 14px;
    color: var(--text-light);
}

.btn-clear {
    padding: 8px 12px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-clear:hover {
    background: var(--danger-dark);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
}

.empty-cart {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-cart i {
    font-size: 64px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 10px;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.cart-item-icon {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-icon i {
    color: white;
    font-size: 24px;
}

.cart-item-info {
    flex: 1;
}

.cart-item-info h4 {
    font-size: 14px;
    margin-bottom: 5px;
    color: var(--text);
}

.cart-item-price {
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
}

/* Cart Item Customization Tags */
.cart-item-customization {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.customization-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.sugar-tag {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    color: #d63031;
}

.ice-tag {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

.customization-tag i {
    font-size: 10px;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.qty-btn:hover {
    background: var(--primary-dark);
}

.cart-item-qty {
    font-weight: 600;
    min-width: 25px;
    text-align: center;
    font-size: 14px;
}

.cart-item-remove {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--danger);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.cart-item-remove:hover {
    background: var(--danger-dark);
}

.cart-summary {
    border-top: 2px solid var(--border);
    padding-top: 15px;
    margin-bottom: 15px;
}

/* Exchange Rate Display in Cart */
.exchange-rate-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.exchange-rate-display.show {
    display: flex !important;
}

.exchange-rate-display i {
    font-size: 16px;
}

.exchange-rate-display strong {
    font-size: 15px;
    font-weight: 700;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
}

.discount-row,
.sale-row {
    color: var(--danger);
}

.discount-input,
.sale-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.discount-input label,
.sale-input label {
    font-size: 13px;
    color: var(--text-light);
}

.discount-input input,
.sale-input input {
    width: 80px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-align: right;
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 14px;
}

.discount-amount {
    font-weight: 600;
}

.summary-row.total {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--border);
}

.cart-actions {
    margin-top: auto;
}

.btn-checkout {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Kantumruy Pro', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

.btn-checkout:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-checkout:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

/* Items Management */
.items-container {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 190px);
    overflow: hidden;
}

.search-filter {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--card-bg);
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 10px;
}

.search-box {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--bg);
    border-radius: 10px;
}

.search-box i {
    color: var(--text-light);
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 14px;
    outline: none;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    align-content: start;
    grid-auto-rows: min-content;
    padding-right: 6px;
}

.item-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: auto;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
}

.item-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.item-card-image {
    width: 100%;
    height: 130px;
    object-fit: cover;
    background: var(--bg);
}

.item-card-icon {
    width: 100%;
    height: 130px;
    background: linear-gradient(180deg, rgba(111, 78, 55, 0.08) 0%, rgba(111, 78, 55, 0.03) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-card-icon i {
    color: var(--primary);
    font-size: 52px;
}

.item-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 14px 14px;
}

.item-card-body h3 {
    font-size: 15px;
    margin-bottom: 6px;
    color: var(--text);
    line-height: 1.25;
}

.item-card-body .category-tag {
    display: inline-block;
    padding: 3px 10px;
    background: var(--bg);
    border-radius: 15px;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.item-card-body .price-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.item-card-body .price {
    color: var(--primary);
    font-weight: 700;
    font-size: 16px;
}

.item-card-body .sale-price {
    color: var(--danger);
    font-weight: 700;
    font-size: 15px;
}

.item-card-body .original-price {
    color: var(--text-light);
    text-decoration: line-through;
    font-size: 12px;
}

.item-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.item-card-actions button {
    flex: 1;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.3s;
}

.btn-edit-item {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(111, 78, 55, 0.2);
}

.btn-edit-item:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(111, 78, 55, 0.3);
}

.btn-delete-item {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.2);
}

.btn-delete-item:hover {
    background: var(--danger-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

/* Orders Table */
.orders-table-container {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.orders-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: collapse;
}

.orders-table th:nth-child(1),
.orders-table td:nth-child(1) {
    width: 4%;
}

.orders-table th:nth-child(2),
.orders-table td:nth-child(2) {
    width: 13%;
}

.orders-table th:nth-child(3),
.orders-table td:nth-child(3) {
    width: 14%;
}

.orders-table th:nth-child(4),
.orders-table td:nth-child(4) {
    width: 28%;
}

.orders-table th:nth-child(5),
.orders-table td:nth-child(5) {
    width: 6%;
}

.orders-table th:nth-child(6),
.orders-table td:nth-child(6) {
    width: 10%;
}

.orders-table th:nth-child(7),
.orders-table td:nth-child(7) {
    width: 9%;
}

.orders-table th:nth-child(8),
.orders-table td:nth-child(8) {
    width: 10%;
}

.orders-table th:nth-child(9),
.orders-table td:nth-child(9) {
    width: 6%;
}

.orders-table th {
    background: var(--primary);
    color: white;
    padding: 14px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.orders-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.orders-table tr:hover {
    background: var(--bg);
}

.orders-table td.order-items-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.orders-table td[data-label="សកម្មភាព"] {
    text-align: center;
}

.btn-view-order {
    padding: 8px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(111, 78, 55, 0.2);
}

.btn-view-order:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(111, 78, 55, 0.3);
}

/* Reports */
.reports-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.reports-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.report-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    border-left: 4px solid var(--primary);
}

.report-card.primary { border-left-color: var(--primary); }
.report-card.success { border-left-color: var(--success); }
.report-card.warning { border-left-color: var(--warning); }
.report-card.info { border-left-color: var(--info); }

.report-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.report-card.primary .report-icon {
    background: rgba(111, 78, 55, 0.1);
    color: var(--primary);
}

.report-card.success .report-icon {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
}

.report-card.warning .report-icon {
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning);
}

.report-card.info .report-icon {
    background: rgba(52, 152, 219, 0.1);
    color: var(--info);
}

.report-info h4 {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
}

.report-info h2 {
    color: var(--text);
    font-size: 28px;
    font-weight: 700;
}

.reports-content {
    display: grid;
    gap: 20px;
}

.report-section {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.report-section h3 {
    color: var(--primary);
    font-size: 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.stat-box {
    padding: 20px;
    background: var(--bg);
    border-radius: 10px;
    text-align: center;
}

.stat-box label {
    display: block;
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-box span {
    display: block;
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
}

.top-products-container {
    display: flex;
    gap: 40px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding: 20px 0;
}

.top-products {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-products-chart-container {
    width: 600px;
    height: 600px;
    flex-shrink: 0;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
    margin: 20px auto;
}

.top-products-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 540px !important;
    max-height: 540px !important;
    display: block;
    margin: 0 auto;
}

.top-product-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg);
    border-radius: 10px;
}

.top-product-item:not(:last-child)::after {
    content: none;
}

.top-product-rank {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.top-product-info {
    flex: 1;
}

.top-product-info .top-product-name {
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 4px;
}

.top-product-info .top-product-qty {
    font-size: 13px;
    color: var(--text-light);
}

/* Users Table */
.users-table-container {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th {
    background: var(--primary);
    color: white;
    padding: 14px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.users-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.users-table tr:hover {
    background: var(--bg);
}

.role-badge {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
}

.role-badge.admin {
    background: rgba(111, 78, 55, 0.1);
    color: var(--primary);
}

.role-badge.manager {
    background: rgba(52, 152, 219, 0.1);
    color: var(--info);
}

.role-badge.staff {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
}

.perm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.perm-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.perm-chip.perm-pos     { background: rgba(111,78,55,0.1);  color: var(--primary); }
.perm-chip.perm-items   { background: rgba(52,152,219,0.1); color: var(--info); }
.perm-chip.perm-orders  { background: rgba(39,174,96,0.1);  color: var(--success); }
.perm-chip.perm-reports { background: rgba(243,156,18,0.1); color: var(--warning); }
.perm-chip.perm-users   { background: rgba(155,89,182,0.1); color: #9b59b6; }

/* Modal */
.modal-content {
    background: var(--card-bg);
    border-radius: 15px;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    position: relative;
}

.modal-content.checkout-modal {
    max-width: 850px;
}

.confirm-modal {
    max-width: 440px;
}

.confirm-modal .modal-body {
    padding: 24px 20px 12px;
}

.confirm-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
}

.confirm-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.14), rgba(243, 156, 18, 0.14));
    color: var(--danger);
    box-shadow: inset 0 0 0 1px rgba(231, 76, 60, 0.12);
}

.confirm-icon i {
    font-size: 28px;
}

.confirm-box p {
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}

.confirm-modal .modal-footer {
    justify-content: center;
}

.btn-confirm.danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
}

.btn-confirm.danger:hover {
    background: linear-gradient(135deg, var(--danger-dark), #a93226);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 10;
    border-radius: 15px 15px 0 0;
}

.modal-header h2 {
    color: var(--primary);
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--danger);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 20px;
    border-top: 2px solid var(--border);
    position: sticky;
    bottom: 0;
    background: var(--card-bg);
    z-index: 10;
    border-radius: 0 0 15px 15px;
}

.btn-cancel {
    padding: 12px 25px;
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cancel:hover {
    background: var(--border);
}

.btn-save,
.btn-confirm {
    padding: 12px 25px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-save:hover,
.btn-confirm:hover {
    background: var(--primary-dark);
}

/* Image Upload */
.image-upload-group .image-upload {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
}

.image-upload-group .image-upload:hover {
    border-color: var(--primary);
    background: rgba(111, 78, 55, 0.02);
}

.image-upload input[type="file"] {
    display: none;
}

.upload-placeholder {
    cursor: pointer;
    padding: 30px 20px;
}

.upload-placeholder i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
}

.upload-placeholder p {
    color: var(--text);
    font-weight: 600;
    margin-bottom: 5px;
}

.upload-placeholder span {
    color: var(--text-light);
    font-size: 13px;
}

.image-preview {
    position: relative;
    display: inline-block;
}

.image-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    border: 2px solid var(--border);
}

.image-preview .remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 32px;
    height: 32px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.image-preview .remove-image:hover {
    background: var(--danger-dark);
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Status Toggle */
.status-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.status-toggle label {
    cursor: pointer;
    font-weight: 500;
}

/* Permissions */
.permissions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.permissions-header label {
    font-weight: 600;
    font-size: 14px;
}

.perm-lock-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: rgba(111,78,55,0.12);
    color: var(--primary);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.perm-lock-badge.hidden { display: none; }

.permissions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}

.permission-item:has(input:checked) {
    border-color: var(--primary-light);
    background: rgba(111,78,55,0.05);
}

.permission-item input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.permission-item.locked {
    opacity: 0.72;
    cursor: not-allowed;
    border-color: rgba(111,78,55,0.2);
    background: rgba(111,78,55,0.06);
}

.perm-icon {
    font-size: 15px;
    color: var(--primary);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.perm-label {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.3;
}

.perm-label span {
    font-size: 13px;
    font-weight: 600;
}

.perm-label small {
    font-size: 11px;
    color: var(--text-light);
}

.perm-note {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-light);
}

/* Role description badge */
.role-description {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
}

.role-description.admin   { background: rgba(111,78,55,0.1);  color: var(--primary); }
.role-description.manager { background: rgba(52,152,219,0.1); color: var(--info); }
.role-description.staff   { background: rgba(39,174,96,0.1);  color: var(--success); }

/* Checkout Content */
.checkout-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.receipt-section {
    background: var(--bg);
    padding: 20px;
    border-radius: 10px;
}

.receipt {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.receipt-header {
    text-align: center;
    margin-bottom: 15px;
}

.receipt-header h3 {
    color: var(--primary);
    font-size: 20px;
    margin-bottom: 5px;
}

.receipt-header p {
    font-size: 12px;
    color: var(--text-light);
    margin: 3px 0;
}

.receipt-number,
.receipt-date,
.receipt-server {
    font-size: 12px;
    color: var(--text-light);
    margin: 5px 0;
}

.receipt-divider {
    height: 2px;
    background: repeating-linear-gradient(
        to right,
        var(--border) 0,
        var(--border) 10px,
        transparent 10px,
        transparent 20px
    );
    margin: 15px 0;
}

.receipt-items {
    margin-bottom: 15px;
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}

.receipt-item-name {
    flex: 1;
}

.receipt-item-qty {
    color: var(--text-light);
    margin: 0 10px;
}

.receipt-item-price {
    font-weight: 600;
    color: var(--primary);
}

.receipt-totals {
    padding-top: 10px;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.receipt-row.discount {
    color: var(--danger);
}

.receipt-row.total {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--border);
}

.payment-section {
    background: var(--bg);
    padding: 20px;
    border-radius: 10px;
}

.payment-section h4 {
    color: var(--text);
    font-size: 16px;
    margin-bottom: 15px;
}

.payment-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.payment-method {
    padding: 15px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.payment-method i {
    font-size: 24px;
    color: var(--primary);
}

.payment-method span {
    font-size: 13px;
    color: var(--text);
}

.payment-method.active {
    border-color: var(--primary);
    background: rgba(111, 78, 55, 0.05);
}

.payment-method.active i {
    color: var(--primary);
}

.payment-form .form-group {
    margin-bottom: 15px;
}

.payment-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Kantumruy Pro', sans-serif;
}

/* Exchange Rate Info in Checkout */
.exchange-rate-info {
    background: #e3f2fd;
    color: #1976d2;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    border-left: 4px solid #1976d2;
}

.exchange-rate-info.show {
    display: flex !important;
}

.exchange-rate-info i {
    font-size: 16px;
}

/* USD Payment Input */
#usdPaymentGroup {
    margin-top: 10px;
    display: none;
}

#usdPaymentGroup.show {
    display: block !important;
}

#usdPaymentGroup label {
    color: #4caf50;
    font-weight: 600;
}

#usdPaymentGroup input {
    border-color: #4caf50;
    background: #f1f8e9;
}

#usdPaymentGroup input:focus {
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Change Display with Dual Currency */
.change-amounts {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.change-khr {
    font-weight: 700;
    font-size: 18px;
    color: var(--success);
}

.change-usd {
    font-weight: 600;
    font-size: 14px;
    color: #4caf50;
    display: none;
}

.change-usd.show {
    display: inline !important;
}

/* Checkout Modal Exchange Rate */
#checkoutExchangeRateInfo {
    display: none;
}

#checkoutExchangeRateInfo.show {
    display: flex !important;
}

/* Receipt Amounts with Dual Currency */
.receipt-amounts {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.usd-amount {
    font-size: 12px;
    color: #4caf50;
    font-weight: 600;
    display: none;
}

.usd-amount.show {
    display: inline !important;
}

.change-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 8px;
    font-size: 16px;
}

.change-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
}

.change-label i {
    color: var(--warning);
}

.change-display span:last-child {
    color: var(--success);
    font-weight: 700;
    font-size: 20px;
}

/* Order View */
.order-view {
    padding: 10px;
}

.order-view-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.order-info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.order-info-item label {
    font-size: 12px;
    color: var(--text-light);
}

.order-info-item span {
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
}

.order-view-items {
    margin-bottom: 20px;
}

.order-view-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 8px;
}

.order-view-totals {
    padding-top: 15px;
    border-top: 2px solid var(--border);
}

/* Toast */
.toast {
    position: fixed;
    top: 18px;
    right: 18px;
    min-width: 320px;
    max-width: 420px;
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
    z-index: 2000;
    overflow: hidden;
    display: flex;
    align-items: stretch;
    gap: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.65);
    transform: translateY(-16px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s ease, opacity 0.28s ease;
}

.toast.hidden {
    display: none;
}

.toast.success {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.12), rgba(255, 255, 255, 0.96));
    border-left: 5px solid var(--success);
}

.toast.error {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.12), rgba(255, 255, 255, 0.96));
    border-left: 5px solid var(--danger);
}

.toast.warning {
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.14), rgba(255, 255, 255, 0.96));
    border-left: 5px solid var(--warning);
}

.toast.show {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.toast-icon {
    width: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: var(--primary);
}

.toast.success .toast-icon {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
}

.toast.error .toast-icon {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
}

.toast.warning .toast-icon {
    background: linear-gradient(135deg, var(--warning), #e08a00);
}

.toast-icon i {
    font-size: 18px;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px 14px 14px;
}

.toast-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.2px;
}

.toast-message {
    font-size: 13px;
    color: var(--text);
    line-height: 1.45;
}

.toast.success .toast-title {
    color: var(--success-dark);
}

.toast.error .toast-title {
    color: var(--danger-dark);
}

.toast.warning .toast-title {
    color: #b87400;
}

.toast::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.08);
}

.toast.success::after {
    background: linear-gradient(90deg, rgba(39, 174, 96, 0.9), rgba(39, 174, 96, 0.35));
}

.toast.error::after {
    background: linear-gradient(90deg, rgba(231, 76, 60, 0.9), rgba(231, 76, 60, 0.35));
}

.toast.warning::after {
    background: linear-gradient(90deg, rgba(243, 156, 18, 0.95), rgba(243, 156, 18, 0.35));
}

/* ========================================
   CUSTOMIZATION MODAL STYLES
   ======================================== */
.modal-content.customization-modal {
    max-width: 500px;
    padding: 0;
}

.customization-content {
    padding: 20px;
}

.custom-product-info {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 25px;
}

.custom-product-info h3 {
    font-size: 20px;
    color: var(--text);
    margin-bottom: 8px;
}

.custom-product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.customization-section {
    margin-bottom: 30px;
}

.customization-section h4 {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.customization-section h4 i {
    color: var(--primary);
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    border: 2px solid var(--border);
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Kantumruy Pro', sans-serif;
    font-size: 15px;
    text-align: left;
    width: 100%;
}

.option-btn:hover {
    border-color: var(--primary);
    background: rgba(111, 78, 55, 0.05);
}

.option-btn.selected {
    border-color: var(--primary);
    background: rgba(111, 78, 55, 0.1);
    box-shadow: 0 2px 8px rgba(111, 78, 55, 0.2);
}

.option-btn i {
    color: var(--primary);
    font-size: 18px;
}

.option-btn .fa-check-circle {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.option-btn.selected .fa-check-circle {
    opacity: 1;
}

/* Receipt Item Customization */
.receipt-item-custom {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-weight: 600;
    font-style: italic;
}

/* ========================================
   RESPONSIVE MEDIA QUERIES
   ======================================== */

/* Mobile Menu Toggle - Hidden by default on desktop */
.mobile-menu-toggle {
    display: none;
}

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

    .cart-section {
        position: fixed;
        right: 0;
        top: 0;
        height: calc(100vh - 130px);
        max-height: none;
        width: 380px;
        z-index: 200;
        border-radius: 0;
        overflow: hidden;
    }

    .products-section {
        height: calc(100vh - 130px);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
    }

    .pos-container {
        height: auto;
    }

    .products-section {
        height: auto;
        min-height: auto;
        overflow: visible;
    }

    .cart-section {
        position: relative;
        width: 100%;
        height: auto;
    }

    .checkout-content {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .reports-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }

    .receipt,
    .receipt * {
        visibility: visible;
    }

    .receipt {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        box-shadow: none;
    }
}

/* ========================================
   RESPONSIVE MEDIA QUERIES
   ======================================== */

/* Large Devices (Desktops, 1200px and up) */
@media (min-width: 1200px) {
    .main-content {
        padding: 30px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* Medium Devices (Tablets, 768px to 1199px) */
@media (max-width: 1199px) and (min-width: 768px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
        padding: 20px;
    }

    .pos-container {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
        gap: 15px;
        height: calc(100vh - 120px);
    }

    .products-section {
        height: 100%;
        min-width: 0;
    }

    .cart-section {
        position: relative;
        width: auto;
        height: 100%;
        max-height: none;
        order: 0;
        padding: 16px;
    }

    .cart-items {
        flex: 1;
        max-height: 28vh;
        overflow-y: auto;
    }

    .empty-cart {
        padding: 24px 16px;
    }

    .empty-cart i {
        font-size: 48px;
        margin-bottom: 10px;
    }

    .cart-item {
        padding: 8px;
        gap: 8px;
        margin-bottom: 8px;
    }

    .cart-item-image,
    .cart-item-icon {
        width: 48px;
        height: 48px;
    }

    .cart-item-icon i {
        font-size: 20px;
    }

    .cart-item-info h4 {
        font-size: 12px;
        margin-bottom: 3px;
    }

    .cart-item-price {
        font-size: 12px;
    }

    .cart-item-controls {
        gap: 6px;
    }

    .qty-btn,
    .cart-item-remove {
        width: 24px;
        height: 24px;
        font-size: 13px;
    }

    .cart-item-qty {
        min-width: 18px;
        font-size: 12px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .reports-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small Devices (Tablets in portrait, 576px to 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    /* Mobile Menu Toggle Button */
    .mobile-menu-toggle {
        display: block;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 999;
        width: 44px;
        height: 44px;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 20px;
        cursor: pointer;
        box-shadow: var(--shadow-lg);
        opacity: 0.12;
        transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    }

    .mobile-menu-toggle:hover,
    .mobile-menu-toggle:focus-visible {
        opacity: 0.7;
        transform: translateY(-1px);
    }

    .mobile-menu-toggle.hidden {
        display: none;
    }

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Hide sidebar by default */
    .sidebar {
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-header {
        padding: 25px 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
    }

    .sidebar-header img.sidebar-logo {
        max-width: 35px;
        height: auto;
    }

    .sidebar-header .close-sidebar-btn {
        background: none;
        border: none;
        color: white;
        font-size: 24px;
        cursor: pointer;
        display: block;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        transition: all 0.3s;
    }

    .sidebar-header .close-sidebar-btn:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .sidebar-header .close-sidebar-btn.hidden {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .pos-container {
        grid-template-columns: 1fr;
        gap: 15px;
        height: auto;
    }

    .cart-section {
        position: relative;
        width: 100%;
        height: auto;
        order: -1;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .checkout-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .checkout-modal {
        max-width: 95%;
    }

    .reports-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .payment-methods {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Extra Small Devices (Phones, less than 576px) */
@media (max-width: 575px) {
    /* Login Screen */
    .login-screen {
        padding: 15px;
    }

    .login-container {
        padding: 25px 20px;
        max-width: 100%;
    }

    .login-logo i {
        font-size: 48px;
    }

    .login-logo h1 {
        font-size: 26px;
    }

    .login-logo p {
        font-size: 13px;
    }

    .btn-login {
        padding: 12px;
        font-size: 14px;
    }

    /* Orders Table */
    .orders-table-container {
        padding: 12px;
        overflow-x: visible;
    }

    .orders-table thead {
        display: none;
    }

    .orders-table,
    .orders-table tbody,
    .orders-table tr,
    .orders-table td {
        display: block;
        width: 100%;
    }

    .orders-table tr {
        margin-bottom: 12px;
        background: var(--card-bg);
        border: 1px solid var(--border);
        border-radius: 14px;
        overflow: hidden;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
    }

    .orders-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 10px;
        padding: 9px 12px;
        border-bottom: 1px solid var(--border);
        font-size: 13px;
        white-space: normal;
    }

    .orders-table td:last-child {
        border-bottom: none;
    }

    .orders-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-light);
        min-width: 92px;
        flex: 0 0 92px;
    }

    .orders-table td.order-items-cell {
        white-space: normal;
    }

    .orders-table td[data-label="សកម្មភាព"] {
        justify-content: flex-end;
    }

    .orders-table td[data-label="សកម្មភាព"]::before {
        display: none;
    }

    /* Mobile Menu Toggle Button */
    .mobile-menu-toggle {
        display: block;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 999;
        width: 44px;
        height: 44px;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 20px;
        cursor: pointer;
        box-shadow: var(--shadow-lg);
    }

    .mobile-menu-toggle.hidden {
        display: none;
    }

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Sidebar - Hidden by default on small screens */
    .sidebar {
        width: 260px;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-header {
        padding: 25px 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
    }

    .sidebar-header img.sidebar-logo {
        max-width: 35px;
        height: auto;
    }

    .sidebar-header .close-sidebar-btn {
        background: none;
        border: none;
        color: white;
        font-size: 24px;
        cursor: pointer;
        display: block;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        transition: all 0.3s;
    }

    .sidebar-header .close-sidebar-btn:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .sidebar-header .close-sidebar-btn.hidden {
        display: none;
    }

    .sidebar-nav {
        padding: 20px 0;
    }

    .nav-item {
        flex-direction: row;
        padding: 14px 20px;
        font-size: 14px;
        gap: 12px;
        border-left: 3px solid transparent;
        border-bottom: none;
    }

    .nav-item.active {
        border-left-color: var(--accent);
        background: rgba(255,255,255,0.15);
    }

    .nav-item i {
        font-size: 18px;
    }

    .nav-item span {
        display: inline;
        font-size: 14px;
    }

    .sidebar-footer {
        display: block;
        padding: 20px;
    }

    /* Main Content */
    .main-content {
        margin-left: 0;
        margin-bottom: 0;
        padding: 15px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 15px;
        padding-bottom: 15px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn-action,
    .btn-action-primary {
        padding: 8px 15px;
        font-size: 13px;
        flex: 1;
        justify-content: center;
    }

    .date-filter,
    .period-select,
    .filter-select {
        width: 100%;
        font-size: 13px;
    }

    /* POS Container */
    .pos-container {
        grid-template-columns: 1fr;
        gap: 15px;
        height: auto;
    }

    .products-section {
        padding: 15px;
        border-radius: 12px;
    }

    .search-bar {
        padding: 10px 12px;
        margin-bottom: 15px;
    }

    .search-bar input {
        font-size: 13px;
    }

    .categories {
        gap: 8px;
        margin-bottom: 15px;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .category-btn {
        padding: 8px 14px;
        font-size: 13px;
        white-space: nowrap;
        border-radius: 10px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-card {
        padding: 12px;
        border-radius: 10px;
    }

    .product-card img,
    .product-card .product-icon {
        width: 70px;
        height: 70px;
    }

    .product-card .product-icon i {
        font-size: 35px;
    }

    .product-card h3 {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .product-card .price {
        font-size: 14px;
    }

    /* Cart Section */
    .cart-section {
        position: relative;
        right: auto;
        top: auto;
        width: calc(100% + 30px);
        max-width: calc(100% + 30px);
        margin-left: -15px;
        margin-right: -15px;
        max-height: 40vh;
        z-index: auto;
        border-radius: 0;
        padding: 15px;
        padding-top: 15px;
        transform: none;
        transition: none;
        order: -1;
        margin-bottom: 15px;
        display: flex;
        flex-direction: column;
    }

    .cart-section.active {
        transform: none;
    }

    .cart-items {
        flex: 1;
        overflow-y: auto;
        max-height: 25vh;
    }

    .cart-header h2 {
        font-size: 18px;
    }

    .cart-item {
        padding: 10px;
        gap: 10px;
    }

    .cart-item-image,
    .cart-item-icon {
        width: 50px;
        height: 50px;
    }

    .cart-item-info h4 {
        font-size: 13px;
    }

    .cart-item-price {
        font-size: 12px;
    }

    .qty-btn,
    .cart-item-remove {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }

    .cart-item-qty {
        min-width: 20px;
        font-size: 13px;
    }

    .summary-row {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .summary-row.total {
        font-size: 18px;
        margin-top: 12px;
        padding-top: 12px;
    }

    .discount-input input,
    .sale-input input {
        width: 60px;
        font-size: 13px;
    }

    .btn-checkout {
        padding: 14px;
        font-size: 16px;
    }

    /* Items Management */
    .search-filter {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 20px;
    }

    .search-box {
        width: 100%;
    }

    .filter-select {
        width: 100%;
    }

    .items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        overflow-y: visible;
        padding-right: 0;
    }

    #itemsPage .items-view-switch {
        width: 100%;
        justify-content: space-between;
    }

    #itemsPage .items-view-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
    }

    #itemsPage .category-list-grid {
        grid-template-columns: 1fr;
    }

    .items-container {
        height: auto;
        overflow: visible;
    }

    .item-card {
        border-radius: 10px;
    }

    .item-card-image,
    .item-card-icon {
        height: 120px;
    }

    .item-card-icon i {
        font-size: 48px;
    }

    .item-card-body {
        padding: 12px;
    }

    .item-card-body h3 {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .item-card-body .category-tag {
        font-size: 10px;
        padding: 3px 8px;
    }

    .item-card-body .price {
        font-size: 15px;
    }

    .item-card-actions button {
        padding: 8px;
        font-size: 12px;
    }

    /* Orders Table */
    .orders-table-container {
        padding: 15px;
        overflow-x: auto;
    }

    .orders-table {
        min-width: 0;
        table-layout: fixed;
    }

    .orders-table th,
    .orders-table td {
        padding: 10px 8px;
        font-size: 13px;
    }

    .btn-view-order {
        padding: 5px 10px;
        font-size: 11px;
    }

    /* Reports */
    .report-period-title {
        padding: 12px 15px;
        font-size: 14px;
    }

    .reports-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .report-card {
        padding: 20px;
        gap: 15px;
    }

    .report-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .report-info h4 {
        font-size: 13px;
    }

    .report-info h2 {
        font-size: 22px;
    }

    .report-section {
        padding: 20px 15px;
    }

    .report-section h3 {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-box {
        padding: 15px;
    }

    .stat-box label {
        font-size: 12px;
    }

    .stat-box span {
        font-size: 18px;
    }

    .top-products-container {
        flex-direction: column;
    }

    .top-products {
        gap: 10px;
    }

    .top-products-chart-container {
        width: 100%;
        max-width: 450px;
        height: 450px;
        padding: 20px;
        margin: 20px auto;
    }

    .top-product-item {
        padding: 12px;
        gap: 12px;
    }

    .top-product-rank {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .top-product-info .top-product-name {
        font-size: 13px;
    }

    .top-product-info .top-product-qty {
        font-size: 12px;
    }

    /* Users Table */
    .users-table-container {
        padding: 15px;
        overflow-x: scroll;
    }

    .users-table {
        min-width: 700px;
    }

    .users-table th,
    .users-table td {
        padding: 10px 8px;
        font-size: 13px;
    }

    .role-badge {
        padding: 4px 10px;
        font-size: 11px;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        max-width: 95%;
        max-height: 95vh;
    }

    .modal-content.checkout-modal {
        max-width: 100%;
        max-height: 100vh;
    }

    .confirm-modal {
        max-width: 100%;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 15px;
        flex-direction: column-reverse;
    }

    .btn-cancel,
    .btn-save,
    .btn-confirm {
        width: 100%;
        padding: 12px;
    }

    .checkout-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .receipt-section {
        padding: 15px;
    }

    .receipt {
        padding: 15px;
    }

    .receipt-header h3 {
        font-size: 18px;
    }

    .receipt-item {
        font-size: 12px;
    }

    .payment-section {
        padding: 15px;
    }

    .payment-section h4 {
        font-size: 14px;
    }

    .payment-methods {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .payment-method {
        padding: 12px;
    }

    .payment-method i {
        font-size: 20px;
    }

    .payment-method span {
        font-size: 11px;
    }

    .change-display {
        font-size: 14px;
        padding: 12px;
    }

    .change-display span:last-child {
        font-size: 18px;
    }

    /* Order View Modal */
    .order-view-header {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .order-info-item {
        flex-direction: row;
        justify-content: space-between;
    }

    .order-info-item label {
        font-size: 11px;
    }

    .order-info-item span {
        font-size: 13px;
    }

    .order-view-item {
        padding: 8px;
        font-size: 12px;
    }

    /* Form Elements */
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 13px;
    }

    .permissions {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .permission-item {
        padding: 10px;
        font-size: 13px;
    }

    .image-preview img {
        max-width: 150px;
        max-height: 150px;
    }

    /* Toast */
    .toast {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }

    .toast-icon {
        width: 48px;
    }

    .toast-content {
        padding: 12px 14px 12px 12px;
    }

    .toast-title,
    .toast-message {
        font-size: 12px;
    }

    /* Custom Scrollbar for mobile */
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    ::-webkit-scrollbar-track {
        background: rgba(0,0,0,0.1);
    }

    ::-webkit-scrollbar-thumb {
        background: var(--primary-light);
        border-radius: 3px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: var(--primary);
    }
}

/* Very Small Devices (320px to 375px) */
@media (max-width: 375px) {
    .login-logo i {
        font-size: 40px;
    }

    .login-logo h1 {
        font-size: 22px;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .items-grid {
        grid-template-columns: 1fr;
    }

    .payment-methods {
        grid-template-columns: 1fr;
    }

    .nav-item {
        padding: 6px 8px;
        font-size: 9px;
    }

    .nav-item i {
        font-size: 18px;
    }
}

/* Landscape orientation on small devices */
@media (max-width: 767px) and (orientation: landscape) {
    /* Mobile Menu Toggle Button */
    .mobile-menu-toggle {
        display: block;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 999;
        width: 40px;
        height: 40px;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 18px;
        cursor: pointer;
        box-shadow: var(--shadow-lg);
        opacity: 0.12;
        transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    }

    .mobile-menu-toggle:hover,
    .mobile-menu-toggle:focus-visible {
        opacity: 0.7;
        transform: translateY(-1px);
        opacity: 0.12;
        transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    }

    .mobile-menu-toggle:hover,
    .mobile-menu-toggle:focus-visible {
        opacity: 0.7;
        transform: translateY(-1px);
    }

    .mobile-menu-toggle.hidden {
        display: none;
    }

    /* Sidebar - Hidden by default in landscape */
    .sidebar {
        width: 260px;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-header {
        padding: 15px 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
    }

    .sidebar-header img.sidebar-logo {
        max-width: 35px;
        height: auto;
    }

    .sidebar-header .close-sidebar-btn {
        display: block;
    }

    .sidebar-header span,
    .nav-item span,
    .user-info div {
        display: inline;
    }

    .sidebar-nav {
        padding: 10px 0;
    }

    .nav-item {
        flex-direction: row;
        justify-content: flex-start;
        padding: 12px 20px;
    }

    .nav-item i {
        font-size: 18px;
    }

    .main-content {
        margin-left: 0;
        margin-bottom: 0;
        padding: 15px;
        padding-top: 60px;
    }

    .cart-section {
        width: 100%;
        max-width: none;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn-action,
    .btn-action-primary,
    .btn-checkout,
    .btn-save,
    .btn-confirm,
    .btn-cancel,
    .category-btn,
    .payment-method {
        min-height: 44px;
    }

    .qty-btn,
    .cart-item-remove,
    .btn-view-order {
        min-width: 44px;
        min-height: 44px;
    }

    .nav-item {
        min-height: 48px;
    }

    input,
    select,
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* High DPI / Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .product-card,
    .item-card,
    .report-card {
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (optional - can be activated) */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode support */
    /*
    :root {
        --bg: #1a1a1a;
        --card-bg: #2d2d2d;
        --text: #e0e0e0;
        --text-light: #a0a0a0;
        --border: #404040;
    }
    */
}

/* ═══════════════════════════════════════════════════════════════════
   ROLES & PERMISSIONS MANAGEMENT
   ═══════════════════════════════════════════════════════════════════ */

/* Roles Manager toolbar */
.roles-manager-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

/* Role card grid */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.role-card {
    background: var(--card-bg, #fff);
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    border-left: 4px solid #6f4e37;
    transition: box-shadow 0.2s ease;
}

.role-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.13);
}

.role-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.role-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.role-card-meta {
    flex: 1;
    min-width: 0;
}

.role-card-meta strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text, #2c2c2c);
}

.role-card-meta code {
    font-size: 0.75rem;
    color: var(--text-light, #888);
    background: rgba(0,0,0,0.06);
    padding: 1px 5px;
    border-radius: 4px;
}

.role-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.role-card-desc {
    font-size: 0.82rem;
    color: var(--text-light, #888);
    margin: 4px 0 10px;
    line-height: 1.4;
}

.role-perm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.role-system-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(0,0,0,0.06);
    color: var(--text-light, #888);
    margin-left: 4px;
}

/* ── Modern Role Card Design ───────────────────────────────────────────── */

.roles-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.role-card-modern {
    background: var(--card-bg, #fff);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.25s ease;
}

.role-card-modern:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.role-card-header-modern {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.role-card-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.role-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.role-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.role-card-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text, #2c2c2c);
}

.role-card-name {
    font-size: 0.78rem;
    color: var(--text-light, #888);
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.role-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.role-card-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid var(--border, #e0e0e0);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-light, #888);
}

.role-card-action-btn:hover {
    border-color: var(--primary, #6f4e37);
    color: var(--primary, #6f4e37);
    background: rgba(111, 78, 55, 0.05);
}

.role-card-action-btn-danger {
    border-color: #ff4444;
    color: #ff4444;
}

.role-card-action-btn-danger:hover {
    background: rgba(255, 68, 68, 0.1);
}

.role-card-desc {
    font-size: 0.85rem;
    color: var(--text-light, #888);
    margin: 8px 0 12px;
    line-height: 1.5;
}

/* ── Modern Buttons ────────────────────────────────────────────────────── */

.roles-manager-toolbar-modern {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.btn-modern {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-modern-primary {
    background: var(--primary, #6f4e37);
    color: white;
}

.btn-modern-primary:hover {
    background: #5a3e2e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(111, 78, 55, 0.3);
}

.btn-modern-outline {
    background: white;
    color: var(--primary, #6f4e37);
    border: 1.5px solid var(--primary, #6f4e37);
}

.btn-modern-outline:hover {
    background: rgba(111, 78, 55, 0.05);
    transform: translateY(-1px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--primary, #6f4e37);
    color: #fff;
}

.btn-primary:hover { opacity: 0.9; }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border, #ddd);
    color: var(--text, #333);
}

.btn-outline:hover { background: rgba(0,0,0,0.04); }

.btn-danger-outline {
    background: transparent;
    border: 1.5px solid #e74c3c;
    color: #e74c3c;
}

.btn-danger-outline:hover { background: rgba(231,76,60,0.08); }

.btn-sm {
    padding: 4px 9px;
    font-size: 0.78rem;
    border-radius: 5px;
}

/* Outline action button (in page header) */
.btn-outline-action {
    background: transparent;
    border: 1.5px solid var(--primary, #6f4e37);
    color: var(--primary, #6f4e37);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s ease;
}

.btn-outline-action:hover {
    background: rgba(111,78,55,0.08);
}

/* Permission checkboxes grid (dynamic, in user modal) */
.perm-checks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 8px;
    padding: 0;
}

/* Permission menu items - clean modern style */
.permission-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    border-radius: 8px;
    background: #fafafa;
    color: var(--text, #555);
    border: 2px solid #e8e8e8;
    position: relative;
}

.permission-menu-item:hover {
    background: #f0f0f0;
    border-color: #d0d0d0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.permission-menu-item.active {
    background: rgba(111, 78, 55, 0.08);
    border-color: var(--primary, #6f4e37);
    color: var(--primary, #6f4e37);
    box-shadow: 0 2px 10px rgba(111, 78, 55, 0.15);
}

.permission-menu-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--primary, #6f4e37);
    flex-shrink: 0;
    margin: 0;
}

.permission-menu-item i {
    font-size: 1.2rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(111, 78, 55, 0.1);
    color: var(--primary, #6f4e37);
    transition: all 0.25s ease;
}

.permission-menu-item.active i {
    background: var(--primary, #6f4e37);
    color: white;
}

.permission-menu-item span {
    font-size: 0.95rem;
    font-weight: 500;
    flex: 1;
}

.permission-menu-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.permission-menu-item.locked:hover {
    transform: none;
    box-shadow: none;
}

/* Responsive - single column on small screens */
@media (max-width: 600px) {
    .perm-checks-grid {
        grid-template-columns: 1fr;
    }
}

/* Old permission check item style (keep for compatibility) */
.perm-check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1.5px solid var(--border, #e0e0e0);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-size: 0.85rem;
}

.perm-check-item:hover {
    border-color: var(--primary, #6f4e37);
    background: rgba(111,78,55,0.04);
}

.perm-check-item.locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.perm-check-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(111,78,55,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    color: var(--primary, #6f4e37);
    flex-shrink: 0;
}

.perm-check-label {
    font-size: 0.83rem;
    color: var(--text, #333);
}

/* Color picker row */
.color-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker {
    width: 48px;
    height: 36px;
    padding: 2px;
    border: 1.5px solid var(--border, #ddd);
    border-radius: 7px;
    cursor: pointer;
    background: none;
}

.color-hex-label {
    font-size: 0.83rem;
    color: var(--text-light, #888);
    font-family: monospace;
}

/* Modal size variant */
.modal-lg .modal-content,
.modal-content.modal-lg {
    max-width: 800px;
    width: 95%;
}

/* Role description block (dynamic, in user modal) */
#roleDescription {
    margin-top: 6px;
    padding: 8px 12px;
    border-radius: 7px;
    border: 1px solid rgba(111,78,55,0.25);
    background: rgba(111,78,55,0.06);
    font-size: 0.83rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary, #6f4e37);
    transition: all 0.2s ease;
}

/* Settings Page Styles */
.settings-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.settings-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.settings-section h3 {
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-section h3 i {
    font-size: 1.4rem;
}

.settings-description {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* Exchange Rate Settings */
.exchange-rate-settings {
    max-width: 500px;
}

.exchange-rate-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.exchange-rate-input-group input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Kantumruy Pro', sans-serif;
}

.exchange-rate-input-group input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(111, 78, 55, 0.1);
}

.exchange-rate-unit {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    min-width: 40px;
}

.exchange-rate-hint {
    margin-top: 10px;
    color: var(--text-light);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.exchange-rate-hint i {
    color: var(--warning);
}

.exchange-rate-hint strong {
    color: var(--primary);
    font-weight: 700;
}

#saveExchangeRateBtn {
    margin-top: 20px;
}

/* Settings Actions */
.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    background: var(--bg);
    border-radius: 10px;
    border: 2px dashed var(--border);
}

.settings-hint {
    color: var(--text-light);
    font-size: 0.85rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.settings-hint::before {
    content: '\f05a';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--primary);
}

/* Logo Management */
.logo-management {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.logo-preview-section {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px;
    background: var(--bg);
    border-radius: 10px;
}

.logo-preview-container {
    flex-shrink: 0;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 15px;
}

.logo-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-info {
    flex: 1;
}

.logo-info p {
    margin: 8px 0;
    font-size: 0.95rem;
    color: var(--text);
}

.logo-usage-hint {
    color: var(--text-light);
    font-size: 0.85rem;
    font-style: italic;
}

.logo-upload-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    width: fit-content;
}

.upload-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.upload-btn i {
    font-size: 1.1rem;
}

.upload-hint {
    padding: 12px 16px;
    background: rgba(52, 152, 219, 0.1);
    border-left: 3px solid var(--info);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.85rem;
}

.upload-hint p {
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-hint i {
    color: var(--info);
}

