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

[x-cloak] {
    display: none !important;
}

:root {
    /* Colors */
    --color-primary: #667eea;
    --color-primary-2: #764ba2;
    --color-primary-hover: #5568d3;

    --color-bg-app: #f5f5f5;
    --color-bg-hover: #f8f8f8;
    --color-bg-soft: #f0f0f0;
    --color-surface: #ffffff;

    --color-text: #333;
    --color-text-2: #555;
    --color-text-muted: #666;
    --color-text-subtle: #999;

    --color-border: #e0e0e0;
    --color-border-2: #ddd;

    /* Radii */
    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-sidebar: 2px 0 10px rgba(0,0,0,0.1);
    --shadow-header: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-card: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-float: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-modal: 0 10px 40px rgba(0,0,0,0.2);
    --shadow-toast: 0 10px 30px rgba(0,0,0,0.18);
    --shadow-login: 0 20px 60px rgba(0,0,0,0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-2) 100%);
    min-height: 100vh;
}

/* Login Page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
}

.login-card {
    background: var(--color-surface);
    padding: 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-login);
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: scaleIn 0.4s ease-out;
}

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

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.company-logo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    border: 4px solid var(--color-surface);
}

.login-card h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: var(--color-text);
}

.login-card h2 {
    color: var(--color-text-muted);
    margin-bottom: 30px;
    font-weight: normal;
}

.pin-input {
    width: 100%;
    padding: 15px;
    font-size: 24px;
    text-align: center;
    letter-spacing: 10px;
    border: 2px solid var(--color-border-2);
    border-radius: 10px;
    margin-bottom: 0;
}

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

.hint {
    margin-top: 20px;
    color: var(--color-text-subtle);
    font-size: 0.9em;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--color-bg-app);
}

/* Sidebar */
.app-sidebar {
    width: 280px;
    background: var(--color-surface);
    box-shadow: var(--shadow-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
    border: 2px solid var(--color-surface);
}

.sidebar-header h1 {
    font-size: 1.3em;
    color: var(--color-text);
    margin: 0;
}

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

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

.nav-section-title {
    font-size: 0.75em;
    text-transform: uppercase;
    color: var(--color-text-subtle);
    padding: 0 20px 10px;
    margin: 0;
    font-weight: 600;
    letter-spacing: 1px;
}

.nav-item {
    width: 100%;
    padding: 12px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.95em;
    text-align: left;
    transition: all 0.2s;
    color: var(--color-text-2);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-item.active .nav-icon {
    color: var(--color-surface);
}

.nav-item:hover {
    background: var(--color-bg-hover);
    color: var(--color-primary);
}

.nav-item.active {
    background: var(--color-primary);
    color: var(--color-surface);
    font-weight: 500;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--color-border);
}

/* Main Content Area */
.app-main {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background: var(--color-surface);
    padding: 20px 30px;
    box-shadow: var(--shadow-header);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h2 {
    font-size: 1.8em;
    color: var(--color-text);
    margin: 0;
}

.app-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

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

.page {
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeInPage 0.3s ease-out;
}

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

.page h2 {
    margin-bottom: 30px;
    color: var(--color-text);
    font-size: 2em;
}

.page h3 {
    margin: 30px 0 15px;
    color: var(--color-text);
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-icon {
    width: 18px;
    height: 18px;
}

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

.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-card);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.4);
    outline-offset: 2px;
}

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

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

.btn-secondary {
    background: var(--color-border);
    color: var(--color-text);
}

.btn-block {
    width: 100%;
}

.btn-remove {
    background: #ff4444;
    color: var(--color-surface);
    border: none;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-left: 10px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--color-surface);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    display: flex;
    gap: 15px;
    align-items: flex-start;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-float);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon i {
    width: 24px;
    height: 24px;
}

.stat-card-primary .stat-icon {
    background: rgba(102, 126, 234, 0.1);
    color: var(--color-primary);
}

.stat-card-success .stat-icon {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.stat-card-warning .stat-icon {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.stat-card-danger .stat-icon {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.stat-content {
    flex: 1;
    min-width: 0; /* Allow flexbox to shrink */
    overflow: hidden;
}

.stat-card h3 {
    font-size: 0.75em;
    color: var(--color-text-2);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--color-primary);
    margin: 5px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

.stat-card-success .stat-value {
    color: #28a745;
}

.stat-card-warning .stat-value {
    color: #ffc107;
}

.stat-card-danger .stat-value {
    color: #dc3545;
}

.stat-label {
    color: var(--color-text-subtle);
    font-size: 0.8em;
    margin: 0;
}

/* Table */
.table-container {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

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

thead {
    background: var(--color-bg-hover);
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.95em;
    border-bottom: 2px solid var(--color-border);
}

tbody tr {
    transition: background-color 0.2s;
}

tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    color: var(--color-text);
}

tbody tr:hover {
    background: var(--color-bg-hover);
    cursor: pointer;
}

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

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1em;
    color: var(--color-text);
    background: var(--color-surface);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--color-text-muted);
    opacity: 0.7;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.nav-item:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

/* Input with Icon */
.input-with-icon {
    position: relative;
}

.input-with-icon .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--color-text-muted);
    pointer-events: none;
}

.input-with-icon input {
    padding-left: 44px;
}

/* PIN field needs balanced padding so centered dots stay visually centered */
.input-with-icon .pin-input {
    padding-left: 44px;
    padding-right: 44px;
}

.input-error {
    border-color: #dc3545 !important;
}

.input-success {
    border-color: #28a745 !important;
}

/* Alert Messages */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-top: 15px;
    font-size: 0.95em;
}

.alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.alert-error {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #f57c00;
    border: 1px solid rgba(255, 193, 7, 0.2);
}

.alert-info {
    background: rgba(102, 126, 234, 0.1);
    color: var(--color-primary);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

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

.form-container {
    background: var(--color-surface);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    max-width: 800px;
}

/* Sales Page */
.sales-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.sales-search,
.sales-cart {
    background: var(--color-surface);
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.sales-search h3,
.sales-cart h3 {
    color: var(--color-text);
    font-weight: 600;
}

.search-input {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1em;
    margin-bottom: 15px;
    color: var(--color-text);
    background: var(--color-surface);
}

.search-input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.7;
}

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

.search-results {
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    padding: 15px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.search-result-item:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-primary);
    transform: translateX(4px);
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
}

.cart-item p {
    margin: 5px 0;
    color: var(--color-text-muted);
    font-size: 0.9em;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    background: var(--color-bg-hover);
    border-radius: var(--radius-md);
    margin: 20px 0;
    font-size: 1.3em;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--color-text-subtle);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    color: var(--color-border);
    margin: 0 auto 20px;
    display: block;
}

.empty-state-title {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--color-text-2);
    margin: 0 0 10px 0;
}

.empty-state-text {
    font-size: 0.95em;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Purchase Summary */
.purchase-summary {
    background: var(--color-bg-hover);
    padding: 20px;
    border-radius: var(--radius-md);
    margin: 20px 0;
}

.purchase-summary h3 {
    margin: 0 0 15px 0;
    color: var(--color-text);
    font-weight: 600;
}

.purchase-summary p {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
}

.purchase-summary .total {
    font-size: 1.2em;
    padding-top: 15px;
    border-top: 2px solid #ddd;
    margin-top: 15px;
}

/* Filters */
.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.filters input,
.filters select {
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1em;
    color: var(--color-text);
    background: var(--color-surface);
}

.filters input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.7;
}

.filters input {
    flex: 1;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
}

/* Report Filters */
.report-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.report-filters input {
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1em;
    color: var(--color-text);
    background: var(--color-surface);
}

/* Error Message */
.error-message {
    color: #ff4444;
    margin-top: 15px;
    text-align: center;
}

/* Textarea */
.textarea-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    color: var(--color-text);
    background: var(--color-surface);
}

.textarea-input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.7;
}

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

/* Badges */
.badge-success {
    background: #28a745;
    color: var(--color-surface);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
}

.badge-error {
    background: #dc3545;
    color: var(--color-surface);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
}

.badge-warning {
    background: #ffc107;
    color: var(--color-text);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
}

.badge-info {
    background: #fd7e14;
    color: var(--color-surface);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Stock Badges */
.stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

.stock-badge-success {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.stock-badge-danger {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.stock-badge-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #f57c00;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
}

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

.modal-content {
    background: var(--color-surface);
    padding: 30px;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-modal);
    animation: slideUp 0.3s ease-out;
}

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

/* Confirm Modal */
.confirm-modal {
    background: var(--color-surface);
    padding: 24px;
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 92%;
    box-shadow: var(--shadow-modal);
    animation: slideUp 0.3s ease-out;
}

.confirm-title {
    margin: 0 0 12px 0;
    color: var(--color-text);
}

.confirm-message {
    margin: 0 0 20px 0;
    color: var(--color-text-2);
    line-height: 1.4;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 3000;
    width: min(420px, calc(100vw - 36px));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-toast);
    border: 1px solid var(--color-border);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast-success { 
    border-left: 4px solid #28a745;
}

.toast-success .toast-icon {
    color: #28a745;
}

.toast-error { 
    border-left: 4px solid #dc3545;
}

.toast-error .toast-icon {
    color: #dc3545;
}

.toast-info { 
    border-left: 4px solid var(--color-primary);
}

.toast-info .toast-icon {
    color: var(--color-primary);
}

.toast-warning { 
    border-left: 4px solid #ffc107;
}

.toast-warning .toast-icon {
    color: #f57c00;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.toast-message {
    color: var(--color-text-2);
    font-size: 0.95em;
    line-height: 1.3;
    word-wrap: break-word;
}

.toast-close {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.toast-close i {
    width: 16px;
    height: 16px;
}

.toast-close:hover {
    background: var(--color-bg-soft);
}

.modal-content h3 {
    margin: 0 0 20px 0;
    color: var(--color-text);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

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

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

.mt-4 {
    margin-top: 20px;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    background: var(--color-surface);
    padding: 30px 40px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-modal);
}

.spinner-icon {
    width: 48px;
    height: 48px;
    color: var(--color-primary);
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner p {
    margin: 0;
    color: var(--color-text-2);
    font-size: 0.95em;
}

/* Button Loading State */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    color: var(--color-surface);
}

/* Skeleton Screens */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 20px;
}

.skeleton-table-row {
    height: 48px;
    margin-bottom: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .app-sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .app-main {
        margin-left: 0;
    }
    
    .sales-container {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 1.1em;
    }
    
    .stat-card h3 {
        font-size: 0.7em;
    }
    
    .app-content {
        padding: 15px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .toast-container {
        top: 12px;
        right: 12px;
        width: calc(100vw - 24px);
    }
}

/* Image Modal Styles */
.image-modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-modal);
    animation: slideUp 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.image-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-hover);
}

.image-modal-header h3 {
    margin: 0;
    color: var(--color-text);
    font-size: 1.2em;
    font-weight: 600;
}

.btn-close {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    color: var(--color-text-muted);
}

.btn-close i {
    width: 20px;
    height: 20px;
}

.btn-close:hover {
    background: var(--color-bg-soft);
}

.image-modal-body {
    padding: 30px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.image-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: var(--color-text-muted);
}

.image-loading .spinner-icon {
    width: 48px;
    height: 48px;
    color: var(--color-primary);
    animation: spin 1s linear infinite;
}

.image-loading p {
    margin: 0;
    font-size: 1em;
}

.image-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: var(--color-text-muted);
    text-align: center;
}

.image-error .error-icon {
    width: 64px;
    height: 64px;
    color: var(--color-text-subtle);
}

.image-error p {
    margin: 0;
    font-size: 1.1em;
    color: var(--color-text-2);
}

.image-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-container img {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.btn-view-image {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    gap: 6px;
    background: var(--color-primary);
    color: var(--color-surface);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9em;
}

.btn-view-image i {
    width: 16px;
    height: 16px;
}

.btn-view-image:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

.btn-view-image:active {
    transform: translateY(0);
}

/* Responsive Image Modal */
@media (max-width: 768px) {
    .image-modal {
        width: 98%;
        max-height: 95vh;
    }
    
    .image-modal-header {
        padding: 15px 18px;
    }
    
    .image-modal-header h3 {
        font-size: 1em;
    }
    
    .image-modal-body {
        padding: 20px;
        min-height: 300px;
    }
    
    .image-container img {
        max-height: 60vh;
    }
}

/* ========================================
   PROGRESSIVE STOCK OPNAME STYLES
   ======================================== */

/* Session Control Panel */
.opname-session-panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 25px;
    margin-bottom: 30px;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

.session-info h3 {
    margin: 0 0 8px 0;
    font-size: 1.3em;
    color: var(--color-text);
}

.session-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1em;
    color: var(--color-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.session-timer i {
    width: 20px;
    height: 20px;
}

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

/* Real-time Stats */
.opname-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    padding-top: 20px;
    border-top: 2px solid var(--color-border);
}

.opname-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border-radius: var(--radius-md);
    background: var(--color-bg-hover);
}

.opname-stat i {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.opname-stat-total {
    border-left: 4px solid var(--color-primary);
}

.opname-stat-total i {
    color: var(--color-primary);
}

.opname-stat-ok {
    border-left: 4px solid #28a745;
}

.opname-stat-ok i {
    color: #28a745;
}

.opname-stat-issue {
    border-left: 4px solid #dc3545;
}

.opname-stat-issue i {
    color: #dc3545;
}

.opname-stat-label {
    font-size: 0.85em;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.opname-stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--color-text);
    line-height: 1;
}

/* Scan Container */
.opname-scan-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.opname-scan-panel,
.opname-feed {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 25px;
}

.opname-scan-panel h3,
.opname-feed h3 {
    margin: 0 0 20px 0;
    font-size: 1.2em;
    color: var(--color-text);
}

/* Scan Input */
.scan-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.scan-input {
    flex: 1;
    padding: 15px;
    font-size: 1.1em;
    border: 3px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    font-weight: 500;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.scan-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.scan-button {
    padding: 15px 25px;
    white-space: nowrap;
}

/* Last Scan Indicator */
.last-scan-indicator {
    padding: 20px;
    border-radius: var(--radius-lg);
    display: flex;
    gap: 15px;
    align-items: flex-start;
    margin-top: 20px;
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.last-scan-success {
    background: rgba(40, 167, 69, 0.1);
    border: 2px solid #28a745;
}

.last-scan-error {
    background: rgba(220, 53, 69, 0.1);
    border: 2px solid #dc3545;
}

.last-scan-icon {
    flex-shrink: 0;
}

.last-scan-success .last-scan-icon i {
    width: 48px;
    height: 48px;
    color: #28a745;
}

.last-scan-error .last-scan-icon i {
    width: 48px;
    height: 48px;
    color: #dc3545;
}

.last-scan-details {
    flex: 1;
}

.last-scan-barcode {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--color-text);
    margin-bottom: 5px;
    font-family: 'Courier New', monospace;
}

.last-scan-message {
    font-size: 1em;
    color: var(--color-text-2);
    margin-bottom: 5px;
}

.last-scan-meta {
    font-size: 0.9em;
    color: var(--color-text-muted);
}

/* Live Scan Feed */
.opname-feed-list {
    max-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.opname-feed-item {
    display: flex;
    gap: 12px;
    padding: 15px;
    border-radius: var(--radius-md);
    border-left: 4px solid transparent;
    transition: all 0.2s;
    animation: slideInRight 0.3s ease-out;
}

.feed-item-success {
    background: rgba(40, 167, 69, 0.05);
    border-left-color: #28a745;
}

.feed-item-error {
    background: rgba(220, 53, 69, 0.05);
    border-left-color: #dc3545;
}

.feed-item-warning {
    background: rgba(255, 193, 7, 0.05);
    border-left-color: #ffc107;
}

.feed-item-info {
    background: rgba(253, 126, 20, 0.05);
    border-left-color: #fd7e14;
}

.feed-item-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.feed-item-success .feed-item-icon {
    background: rgba(40, 167, 69, 0.15);
}

.feed-item-success .feed-item-icon i {
    width: 18px;
    height: 18px;
    color: #28a745;
}

.feed-item-error .feed-item-icon {
    background: rgba(220, 53, 69, 0.15);
}

.feed-item-error .feed-item-icon i {
    width: 18px;
    height: 18px;
    color: #dc3545;
}

.feed-item-warning .feed-item-icon {
    background: rgba(255, 193, 7, 0.15);
}

.feed-item-warning .feed-item-icon i {
    width: 18px;
    height: 18px;
    color: #f57c00;
}

.feed-item-info .feed-item-icon {
    background: rgba(253, 126, 20, 0.15);
}

.feed-item-info .feed-item-icon i {
    width: 18px;
    height: 18px;
    color: #fd7e14;
}

.feed-item-content {
    flex: 1;
    min-width: 0;
}

.feed-item-barcode {
    font-size: 1em;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 3px;
    font-family: 'Courier New', monospace;
}

.feed-item-message {
    font-size: 0.9em;
    color: var(--color-text-2);
    margin-bottom: 3px;
}

.feed-item-meta {
    font-size: 0.85em;
    color: var(--color-text-muted);
}

.feed-item-time {
    flex-shrink: 0;
    font-size: 0.85em;
    color: var(--color-text-subtle);
    font-variant-numeric: tabular-nums;
}

/* Flash Feedback Overlay */
.opname-flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5000;
    opacity: 0;
}

.flash-success {
    background: rgba(40, 167, 69, 0.2);
    animation: flashPulse 0.3s ease-out;
}

.flash-error {
    background: rgba(220, 53, 69, 0.2);
    animation: flashPulse 0.3s ease-out;
}

@keyframes flashPulse {
    0% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Responsive Opname Layout */
@media (max-width: 1024px) {
    .opname-scan-container {
        grid-template-columns: 1fr;
    }
    
    .session-header {
        flex-direction: column;
    }
    
    .session-actions {
        width: 100%;
    }
    
    .session-actions .btn {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .opname-session-panel {
        padding: 20px;
    }
    
    .opname-scan-panel,
    .opname-feed {
        padding: 20px;
    }
    
    .scan-input-container {
        flex-direction: column;
    }
    
    .scan-button {
        width: 100%;
    }
    
    .opname-stats {
        grid-template-columns: 1fr;
    }
    
    .last-scan-indicator {
        padding: 15px;
    }
    
    .last-scan-icon i {
        width: 36px !important;
        height: 36px !important;
    }
    
    .last-scan-barcode {
        font-size: 1.1em;
    }
    
    .opname-feed-list {
        max-height: 400px;
    }
}

