:root {
    --color-background: #f3f1ed;
    --color-surface: #ffffff;
    --color-surface-alt: #f7f4ee;
    --color-primary: #1f4f66;
    --color-primary-dark: #163a4b;
    --color-primary-light: #2f6780;
    --color-primary-contrast: #fefcf8;
    --color-accent: #f0a04b;
    --color-accent-dark: #d9871e;
    --color-success: #2d8a6d;
    --color-success-dark: #1f6a51;
    --color-danger: #d64550;
    --color-danger-dark: #b33a43;
    --color-info: #1c6e8c;
    --color-warning: #f7c948;
    --color-border: #d9d2c1;
    --color-text: #2f2a25;
    --color-text-muted: #6d6255;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--color-background);
    color: var(--color-text);
    overflow-x: hidden;
    min-height: 100vh;
    padding-bottom: 20px;
}

body.dialog-open {
    overflow: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

.network-status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--color-warning);
    color: var(--color-text);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.network-status-banner.network-offline {
    background: var(--color-danger);
    color: #fff;
}

.network-status-banner.network-syncing {
    background: var(--color-info);
    color: #fff;
}

.network-status-banner .network-sync-status {
    margin-left: auto;
    font-weight: 600;
}

.notification-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2000;
    max-width: 320px;
    width: calc(100% - 48px);
    pointer-events: none;
}

.notification {
    background: var(--color-surface);
    color: var(--color-text);
    padding: 16px 18px;
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(0,0,0,0.18);
    border-left: 6px solid var(--color-primary);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
}

.notification.visible {
    opacity: 1;
    transform: translateY(0);
}

.notification-success {
    border-left-color: var(--color-success);
}

.notification-error {
    border-left-color: var(--color-danger);
}

.notification-info {
    border-left-color: var(--color-info);
}

.hidden {
    display: none !important;
}

.auth-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(31,79,102,0.9) 0%, rgba(47,103,128,0.9) 100%);
    backdrop-filter: blur(6px);
    z-index: 999;
    padding: 20px;
}

.login-card {
    background: var(--color-surface);
    border-radius: 16px;
    padding: 40px 32px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    border: 1px solid var(--color-border);
}

.login-title {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    color: var(--color-primary-dark);
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 24px;
    font-size: 15px;
}

#login-form .form-group {
    margin-bottom: 18px;
}

#login-form .password-field {
    position: relative;
    display: flex;
    align-items: center;
}

#login-form .password-field input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    transition: color 0.2s ease;
}

.password-toggle:focus {
    outline: none;
}

.password-toggle:hover {
    color: var(--color-primary-dark);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.password-toggle .icon-eye-closed {
    display: none;
}

.password-toggle.active .icon-eye-open {
    display: none;
}

.password-toggle.active .icon-eye-closed {
    display: inline;
}

#login-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text);
}

#login-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 15px;
    background: var(--color-surface);
    color: var(--color-text);
}

#login-form input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(31,79,102,0.2);
}

.form-error {
    background: rgba(244, 67, 54, 0.1);
    color: #d93025;
    border: 1px solid rgba(244, 67, 54, 0.2);
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
}

.btn-link {
    background: transparent;
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-decoration: underline;
    padding: 0 8px;
    min-width: auto;
    min-height: auto;
}

.btn-link:hover {
    color: #e0e0ff;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
    flex: 0 0 auto;
}

.user-name {
    font-weight: 600;
    color: #ffffff;
}

.user-role {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.open {
    display: flex;
}

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
}

.modal .close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
}

.modal .close:hover {
    color: #000;
}

.modal-body {
    margin-bottom: 24px;
    color: #333;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-confirm-danger {
    background: var(--color-danger);
    color: #fff;
}

.modal-confirm-danger:hover {
    filter: brightness(0.95);
}

.modal form .form-group {
    margin-bottom: 18px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: var(--color-primary-contrast, #ffffff);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 2em;
    font-weight: 600;
    flex: 1 1 220px;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex: 2 1 320px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    min-height: 48px;
    min-width: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 6px 12px rgba(31,79,102,0.18);
}

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

.btn-secondary {
    background: rgba(255,255,255,0.18);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.35);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.28);
}

.btn-success {
    background: var(--color-success);
    color: #ffffff;
    box-shadow: 0 6px 12px rgba(45,138,109,0.18);
}

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

.btn-danger {
    background: var(--color-danger);
    color: #ffffff;
    box-shadow: 0 6px 12px rgba(214,69,80,0.18);
}

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

.btn-large {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    margin-top: 10px;
}

/* POS Layout */
.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
    min-height: 500px;
    align-items: stretch;
}

/* Product Section */
.product-section {
    background: var(--color-surface);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
    min-height: 400px;
    max-height: calc(100vh - 200px);
}

.stock-filters {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    padding: 12px;
    background: var(--color-surface-alt);
    border-radius: 8px;
    flex-wrap: wrap;
    border: 1px solid var(--color-border);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: var(--color-text);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.checkbox-label span {
    font-weight: 500;
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: 5px;
    font-size: 16px;
    background: var(--color-surface);
    color: var(--color-text);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.product-list {
    overflow-x: auto;
    width: 100%;
    padding-bottom: 10px;
}

.product-list::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.product-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.product-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.product-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.pos-products-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

.pos-products-table thead {
    position: sticky;
    top: 0;
    background: var(--color-primary);
    z-index: 10;
}

.pos-products-table th {
    background: var(--color-primary);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border: none;
}

.pos-products-table td {
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
    word-wrap: break-word;
}

.pos-products-table .clickable-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.pos-products-table .clickable-row:hover {
    background-color: #f0f0f0;
}

.pos-products-table .out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
}

.pos-products-table .stock-out {
    color: var(--color-danger);
    font-weight: bold;
}

table tr.expired-product td {
    background-color: rgba(214, 69, 80, 0.12);
}

table tr.expired-product td[data-label="Expiry"] {
    color: var(--color-danger);
    font-weight: 600;
}

table tr.expired-product:hover td {
    background-color: rgba(214, 69, 80, 0.18);
}

table tr.expiring-soon td {
    background-color: rgba(240, 160, 75, 0.12);
}

table tr.expiring-soon td[data-label="Expiry"] {
    color: var(--color-accent-dark);
    font-weight: 600;
}

table tr.expiring-soon:hover td {
    background-color: rgba(240, 160, 75, 0.18);
}

.pos-products-table .text-muted {
    color: #999;
    font-style: italic;
}

.pos-products-table .btn-sm {
    padding: 6px 12px;
    font-size: 14px;
    min-height: 36px;
    min-width: 60px;
}

.pos-products-table .btn-primary.btn-sm {
    background: var(--color-success);
}

.pos-products-table .btn-primary.btn-sm:hover {
    background: var(--color-success-dark);
}

.product-card {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 120px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(31,79,102,0.16);
}

.product-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--color-text);
    line-height: 1.3;
}

.product-card .price {
    font-size: 22px;
    font-weight: bold;
    color: var(--color-success);
    margin-bottom: 8px;
}

.product-card .stock {
    font-size: 12px;
    color: #666;
}

.product-card .barcode {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

/* Cart Section */
.cart-section {
    background: var(--color-surface);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
    min-height: 400px;
    max-height: calc(100vh - 200px);
}

.cart-section h2 {
    margin-bottom: 20px;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 10px;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding-right: 6px;
}

.cart-items::-webkit-scrollbar {
    width: 6px;
}

.cart-items::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.cart-table-wrapper {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    background: #fdfdfd;
}

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

.cart-table thead {
    background: var(--color-primary);
    color: #fff;
}

.cart-table thead th {
    text-align: left;
    font-weight: 600;
    padding: 12px 14px;
    font-size: 14px;
}

.cart-table tbody tr {
    border-bottom: 1px solid #ededed;
}

.cart-table tbody tr:last-child {
    border-bottom: none;
}

.cart-cell {
    padding: 14px;
    vertical-align: middle;
    font-size: 15px;
    background: #fff;
}

.cart-cell-item {
    width: 40%;
}

.cart-item-name {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    color: #333;
}

.cart-item-meta {
    color: #666;
    font-size: 13px;
}

.cart-cell-qty,
.cart-cell-price,
.cart-cell-total,
.cart-cell-remove {
    text-align: center;
    white-space: nowrap;
}

.cart-qty-input {
    width: 80px;
    padding: 10px 8px;
    text-align: center;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    font-size: 16px;
    min-height: 42px;
    -webkit-appearance: none;
    touch-action: manipulation;
    background: var(--color-surface);
    color: var(--color-text);
}

.cart-qty-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(31,79,102,0.2);
}

.cart-remove-btn {
    background: var(--color-danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 22px;
    min-width: 40px;
    min-height: 40px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.cart-summary {
    border-top: 2px solid #e0e0e0;
    padding-top: 20px;
    flex-shrink: 0;
    background: #fff;
    margin-top: auto;
}

.cart-overview {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-overview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-primary-dark);
}

.cart-overview-count {
    background: var(--color-primary);
    color: #fff;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
}

.cart-overview-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-overview-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cart-overview-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.cart-overview-name {
    font-weight: 600;
    color: var(--color-text);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-overview-meta {
    font-size: 12px;
    color: var(--color-text-muted);
}

.cart-overview-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-overview-line-total {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-primary-dark);
}

.cart-overview-remove {
    background: transparent;
    border: none;
    color: var(--color-danger);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.cart-overview-remove:hover {
    background: rgba(214, 69, 80, 0.1);
    color: var(--color-danger-dark);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 16px;
}

.summary-row input {
    width: 120px;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    font-size: 16px;
    min-height: 44px;
    -webkit-appearance: none;
    touch-action: manipulation;
    background: var(--color-surface);
    color: var(--color-text);
}

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

.payment-method {
    margin: 20px 0 15px 0;
}

.payment-method label {
    display: block;
    margin-bottom: 5px;
}

.payment-method select {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-size: 18px;
    min-height: 50px;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
    touch-action: manipulation;
    background-color: var(--color-surface);
    color: var(--color-text);
}

/* Page System */
.page {
    display: none;
    width: 100%;
    clear: both;
    position: relative;
}

.page.active {
    display: block;
    width: 100%;
}

.page-content {
    background: var(--color-surface);
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-height: auto;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-primary);
    width: 100%;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h2 {
    color: var(--color-text);
    font-size: 28px;
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.page-header .btn {
    white-space: nowrap;
}

.product-form {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding: 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.form-actions .btn {
    flex: 1;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    box-sizing: border-box;
}

#products-table-container,
#sales-table-container {
    overflow-x: auto;
    width: 100%;
}

table th, table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: nowrap;
}

table td:last-child {
    white-space: normal;
}

table th {
    background: var(--color-primary);
    color: white;
    font-weight: 600;
}

table tr:hover {
    background: rgba(31,79,102,0.06);
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--color-border);
    border-radius: 5px;
    font-size: 14px;
    background: var(--color-surface);
    color: var(--color-text);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-state h3 {
    margin-bottom: 10px;
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }
    
    .container {
        padding: 8px;
        max-width: 100%;
    }
    
    .header {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
        border-radius: 8px;
        margin-bottom: 12px;
    }
    
    .header h1 {
        font-size: 1.5em;
        text-align: center;
        margin: 0;
    }
    
    .header-actions {
        width: 100%;
        flex-direction: row;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .header-actions .btn {
        flex: 1;
        min-width: calc(50% - 4px);
        padding: 12px 8px;
        font-size: 14px;
    }
    
    .pos-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
        gap: 12px;
    }
    
    .product-section {
        padding: 12px;
        border-radius: 8px;
        max-height: none;
    }
    
    .search-bar {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .search-bar input {
        width: 100%;
        font-size: 18px;
    }
    
    .search-bar .btn {
        width: 100%;
        padding: 14px;
    }
    
    .product-list {
        overflow-x: auto;
    }
    
    .pos-products-table {
        font-size: 14px;
    }
    
    .pos-products-table th,
    .pos-products-table td {
        padding: 10px 8px;
        font-size: 14px;
    }
    
    .pos-products-table .btn-sm {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 40px;
    }
    
    .cart-section {
        max-height: none;
        padding: 12px;
        border-radius: 8px;
        position: relative;
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        margin-top: 12px;
    }
    
    .cart-section h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .cart-overview {
        padding: 10px 12px;
        gap: 10px;
    }

    .cart-overview-header {
        font-size: 13px;
    }

    .cart-overview-count {
        font-size: 11px;
    }

    .cart-overview-list {
        gap: 8px;
    }

    .cart-overview-name {
        font-size: 14px;
    }

    .cart-overview-meta {
        font-size: 12px;
    }

    .cart-overview-line-total {
        font-size: 14px;
    }

    .cart-overview-remove {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .cart-items {
        padding-right: 0;
    }

    .cart-table-wrapper {
        border-radius: 8px;
    }

    .cart-table thead {
        display: none;
    }

    .cart-table,
    .cart-table tbody,
    .cart-table tr,
    .cart-cell {
        display: block;
        width: 100%;
    }

    .cart-table tbody tr {
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        background: #fff;
        margin-bottom: 12px;
        padding: 12px;
    }

    .cart-cell {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 6px 0;
    }

    .cart-cell::before {
        content: attr(data-label);
        font-weight: 600;
        color: #555;
        font-size: 14px;
        float: none;
    }

    .cart-cell-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .cart-cell-item::before {
        display: none;
    }

    .cart-item-name {
        font-size: 16px;
    }

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

    .cart-cell-qty::before,
    .cart-cell-price::before,
    .cart-cell-total::before,
    .cart-cell-remove::before {
        min-width: 120px;
    }

    .cart-cell-remove {
        justify-content: flex-end;
    }

    .cart-qty-input {
        width: 100px;
        font-size: 18px;
    }

    .cart-remove-btn {
        width: 48px;
        height: 48px;
        font-size: 26px;
    }
    
    .summary-row {
        font-size: 18px;
        padding: 8px 0;
    }
    
    .summary-row input {
        width: 100%;
        max-width: 150px;
    }
    
    .summary-row.total {
        font-size: 22px;
        padding-top: 15px;
        margin-top: 15px;
    }
    
    .payment-method {
        margin: 15px 0;
    }
    
    .payment-method select {
        font-size: 18px;
        padding: 14px;
    }
    
    .btn-large {
        padding: 16px;
        font-size: 18px;
        margin-top: 12px;
        min-height: 54px;
    }
    
    .page-content {
        padding: 12px;
        min-height: auto;
        border-radius: 8px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 20px;
        padding-bottom: 12px;
    }
    
    .page-header h2 {
        font-size: 22px;
        width: 100%;
        margin: 0;
    }
    
    .page-header .btn {
        width: 100%;
    }
    
    .product-form {
        max-width: 100%;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 14px;
        font-size: 18px;
        min-height: 50px;
        border-radius: 8px;
    }
    
    .form-group textarea {
        min-height: 120px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .form-actions .btn {
        width: 100%;
        padding: 16px;
        font-size: 18px;
    }
    
    .stock-filters {
        flex-direction: column;
        gap: 12px;
        padding: 15px;
    }
    
    .checkbox-label {
        font-size: 16px;
    }
    
    /* Mobile Table Styles - Convert to Cards */
    #products-table-container,
    #sales-table-container,
    #reports-container table {
        display: block;
    }
    
    table {
        display: block;
        width: 100%;
    }
    
    table thead {
        display: none;
    }
    
    table tbody {
        display: block;
        width: 100%;
    }
    
    table tr {
        display: block;
        margin-bottom: 15px;
        background: white;
        border: 2px solid #e0e0e0;
        border-radius: 12px;
        padding: 12px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    table td {
        display: block;
        padding: 10px 0;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        white-space: normal;
        font-size: 16px;
        text-align: right;
    }
    
    table td:last-child {
        border-bottom: none;
    }
    
    table td:before {
        content: attr(data-label);
        font-weight: bold;
        color: var(--color-primary);
        float: left;
    }
    
    /* Reports Mobile Styles */
    .reports-filters {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group input[type="date"],
    .filter-group select {
        width: 100%;
        padding: 14px;
        font-size: 18px;
        min-height: 50px;
    }
    
    .filter-group .btn {
        margin-top: 0;
        width: 100%;
    }
    
    .filter-actions {
        flex-direction: row;
        gap: 10px;
    }
    
    .filter-actions .btn {
        flex: 1;
        min-width: 0;
    }
    
    .export-buttons {
        flex-direction: column;
        gap: 12px;
        margin-top: 15px;
        width: 100%;
    }
    
    .export-buttons .btn {
        width: 100%;
        min-width: 0;
        flex: none;
        font-size: 16px;
        padding: 16px 20px;
        min-height: 50px;
        touch-action: manipulation;
    }
    
    .export-buttons .btn-success:not(:disabled):hover {
        transform: none;
    }
    
    .export-buttons .btn-success:not(:disabled):active {
        transform: scale(0.98);
        background: var(--color-success-dark);
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .summary-card {
        padding: 18px;
    }
    
    .summary-card h4 {
        font-size: 14px;
    }
    
    .summary-card p {
        font-size: 24px;
    }
    
    .empty-state {
        padding: 30px 20px;
    }
    
    .empty-state h3 {
        font-size: 18px;
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    .container {
        padding: 6px;
    }
    
    .header {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.3em;
    }
    
    .header-actions .btn {
        font-size: 13px;
        padding: 10px 6px;
    }
    
    .product-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .product-card {
        padding: 12px;
    }
    
    .cart-section {
        padding: 10px;
    }
    
    .page-content {
        padding: 10px;
    }
    
    .summary-cards {
        gap: 10px;
    }
    
    .summary-card {
        padding: 15px;
    }
    
    .summary-card p {
        font-size: 22px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn:hover,
    .product-card:hover {
        transform: none;
    }
    
    .btn:active {
        transform: scale(0.98);
        opacity: 0.8;
    }
    
    .product-card:active {
        transform: scale(0.97);
        background: #f0f0f0;
    }
}

/* Settings Page */
.settings-form {
    max-width: 800px;
    margin: 0 auto;
}

.settings-subtitle {
    color: #666;
    font-size: 14px;
    margin-top: 5px;
    font-style: italic;
}

.form-section {
    background: var(--color-surface-alt);
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 1px solid var(--color-border);
}

.form-section h3 {
    color: var(--color-primary);
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 0;
}

.form-hint {
    display: block;
    color: #999;
    font-size: 12px;
    margin-top: 5px;
    font-style: italic;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .settings-form {
        max-width: 100%;
    }
    
    .form-section {
        padding: 20px 15px;
    }
}

/* Reports Module */
.reports-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--color-surface-alt);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    font-weight: 500;
    font-size: 14px;
    color: var(--color-text);
}

.filter-group select,
.filter-group input[type="date"] {
    padding: 8px 12px;
    border: 2px solid var(--color-border);
    border-radius: 5px;
    font-size: 14px;
    background: var(--color-surface);
    color: var(--color-text);
}

.filter-group select:focus,
.filter-group input[type="date"]:focus {
    outline: none;
    border-color: var(--color-primary);
}

.filter-group .btn {
    margin-top: 20px;
}

.filter-group:last-child {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-top: 0;
}

.filter-group:last-child .btn {
    margin-top: 0;
    flex: 1;
}

/* Export buttons group styling */
.filter-actions {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.filter-actions .btn {
    flex: 1;
    margin-top: 0;
}

.export-buttons {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
    justify-content: stretch;
}

.export-buttons .btn {
    flex: 1;
    min-width: 180px;
    margin-top: 0;
    white-space: nowrap;
    font-weight: 500;
    transition: all 0.3s ease;
}

.export-buttons .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.export-buttons .btn-success:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(45, 138, 109, 0.3);
}

.export-buttons .btn-success:not(:disabled):active {
    transform: translateY(0);
}

#users-page .page-header {
    justify-content: space-between;
    align-items: center;
}

.table-container {
    background: var(--color-surface);
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    overflow-x: auto;
}

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

.users-table th,
.users-table td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
}

.users-table th {
    background: var(--color-surface-alt);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
}

.users-table tr:hover {
    background: rgba(31,79,102,0.06);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-admin { background: rgba(31, 79, 102, 0.12); color: var(--color-primary); }
.badge-manager { background: rgba(240, 160, 75, 0.18); color: var(--color-accent-dark); }
.badge-cashier { background: rgba(28, 110, 140, 0.15); color: var(--color-info); }
.badge-inventory_clerk { background: rgba(45, 138, 109, 0.18); color: var(--color-success); }

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
}

.status-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-active { color: var(--color-success); }
.status-active .dot { background: var(--color-success); }
.status-inactive { color: var(--color-danger); }
.status-inactive .dot { background: var(--color-danger); }

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

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

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Monthly sales chart responsiveness */
#monthly-sales-chart-container {
    width: 100%;
}
#monthly-sales-chart-container canvas {
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 600px) {
    #monthly-sales-title {
        font-size: 1.1rem;
    }
}

.report-content {
    margin-top: 20px;
}

.report-summary h3 {
    color: var(--color-text);
    margin-bottom: 20px;
    font-size: 24px;
}

.report-summary p {
    color: var(--color-text-muted);
    margin-bottom: 20px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.summary-card h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    opacity: 0.9;
}

.summary-card p {
    font-size: 28px;
    font-weight: bold;
    margin: 0;
    color: white;
}

.out-of-stock {
    background-color: #ffebee;
}

.low-stock {
    background-color: #fff3e0;
}

/* Print Styles */
@media print {
    .header-actions,
    .reports-filters .filter-group:last-child,
    .btn {
        display: none !important;
    }
    
    .page-content {
        box-shadow: none;
        padding: 0;
    }
    
    .summary-cards {
        break-inside: avoid;
    }
}

