:root {
    --sidebar-width: 240px;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    margin: 0;
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.2s;
    overflow-y: auto;
}

.sidebar-link {
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem;
    border-radius: 0.375rem;
    margin: 0 0.5rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.sidebar-link.active {
    color: #fff;
    background: var(--primary);
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.card {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--card-bg);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.stat-card {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.25rem;
    background: var(--card-bg);
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-card .stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

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

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

.table {
    font-size: 0.875rem;
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    border-bottom-width: 2px;
}

.badge {
    font-weight: 500;
    font-size: 0.75rem;
}

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.modal-header {
    border-bottom: 1px solid var(--border);
}

.modal-footer {
    border-top: 1px solid var(--border);
}

.pos-cart {
    max-height: calc(100vh - 350px);
    overflow-y: auto;
}

.pos-product-btn {
    cursor: pointer;
    transition: box-shadow 0.15s;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-align: center;
    font-size: 0.8rem;
}

.pos-product-btn:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

.search-highlight {
    background: #fef3c7;
    padding: 0 2px;
    border-radius: 2px;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.loading-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.product-image-preview {
    width: 100%;
    height: 120px;
    border: 2px dashed var(--border);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: #f9fafb;
    overflow: hidden;
}

.product-thumb img {
    display: block;
}

.receipt-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.receipt-container {
    background: #fff;
    width: 380px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 0.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.receipt-content {
    padding: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #000;
    line-height: 1.5;
}

.receipt-content .receipt-header {
    text-align: center;
    border-bottom: 1px dashed #999;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.receipt-content .receipt-header h5 {
    font-weight: 700;
    margin: 0;
    font-size: 1rem;
}

.receipt-content .receipt-line {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.receipt-content .receipt-divider {
    border: none;
    border-top: 1px dashed #999;
    margin: 0.5rem 0;
}

.receipt-content .receipt-items {
    margin-bottom: 0.5rem;
}

.receipt-content .receipt-item {
    margin-bottom: 0.25rem;
}

.receipt-content .receipt-total {
    font-weight: 700;
    font-size: 1rem;
}

.receipt-content .receipt-footer {
    text-align: center;
    border-top: 1px dashed #999;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #666;
}

.receipt-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    justify-content: center;
    flex-wrap: wrap;
}

@media print {
    body > *:not(#receipt-modal):not(#budget-receipt-modal) { display: none !important; }
    .sidebar, .main-content, .navbar { display: none !important; }
    #receipt-modal, #budget-receipt-modal { position: static !important; }
    .receipt-overlay {
        position: static !important;
        background: none !important;
        display: block !important;
    }
    .receipt-container {
        box-shadow: none !important;
        width: 80mm;
        max-height: none;
        border-radius: 0;
    }
    .receipt-actions { display: none !important; }
    .receipt-content {
        padding: 5mm;
    }
}
